summaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
authorTravis Watkins <amaranth@ubuntu.com>2013-03-13 17:33:27 -0500
committerTravis Watkins <amaranth@ubuntu.com>2013-03-15 13:28:59 -0500
commit83d29e461c85733f0113b6eb19db6e3b42da2949 (patch)
treeb3063a1c28f478ab368d5ba3413a842def68c28f /src/main
parentba6e4c38cfa98ad291974195cc46d70a4f138ac1 (diff)
downloadcraftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar
craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.gz
craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.lz
craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.tar.xz
craftbukkit-83d29e461c85733f0113b6eb19db6e3b42da2949.zip
Update CraftBukkit to Minecraft 1.5
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/net/minecraft/server/Block.java489
-rw-r--r--src/main/java/net/minecraft/server/BlockBloodStone.java4
-rw-r--r--src/main/java/net/minecraft/server/BlockButtonAbstract.java (renamed from src/main/java/net/minecraft/server/BlockButton.java)97
-rw-r--r--src/main/java/net/minecraft/server/BlockCactus.java26
-rw-r--r--src/main/java/net/minecraft/server/BlockCocoa.java32
-rw-r--r--src/main/java/net/minecraft/server/BlockCommand.java41
-rw-r--r--src/main/java/net/minecraft/server/BlockCrops.java44
-rw-r--r--src/main/java/net/minecraft/server/BlockDiode.java228
-rw-r--r--src/main/java/net/minecraft/server/BlockDiodeAbstract.java261
-rw-r--r--src/main/java/net/minecraft/server/BlockDispenser.java93
-rw-r--r--src/main/java/net/minecraft/server/BlockDoor.java65
-rw-r--r--src/main/java/net/minecraft/server/BlockDragonEgg.java32
-rw-r--r--src/main/java/net/minecraft/server/BlockEnderPortal.java8
-rw-r--r--src/main/java/net/minecraft/server/BlockFire.java52
-rw-r--r--src/main/java/net/minecraft/server/BlockFlowing.java59
-rw-r--r--src/main/java/net/minecraft/server/BlockGrass.java7
-rw-r--r--src/main/java/net/minecraft/server/BlockIce.java20
-rw-r--r--src/main/java/net/minecraft/server/BlockJukeBox.java77
-rw-r--r--src/main/java/net/minecraft/server/BlockLeaves.java101
-rw-r--r--src/main/java/net/minecraft/server/BlockLever.java103
-rw-r--r--src/main/java/net/minecraft/server/BlockMinecartDetector.java56
-rw-r--r--src/main/java/net/minecraft/server/BlockMobSpawner.java8
-rw-r--r--src/main/java/net/minecraft/server/BlockMushroom.java27
-rw-r--r--src/main/java/net/minecraft/server/BlockMycel.java7
-rw-r--r--src/main/java/net/minecraft/server/BlockNetherWart.java18
-rw-r--r--src/main/java/net/minecraft/server/BlockOre.java12
-rw-r--r--src/main/java/net/minecraft/server/BlockPiston.java185
-rw-r--r--src/main/java/net/minecraft/server/BlockPistonExtension.java30
-rw-r--r--src/main/java/net/minecraft/server/BlockPortal.java33
-rw-r--r--src/main/java/net/minecraft/server/BlockPressurePlate.java207
-rw-r--r--src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java174
-rw-r--r--src/main/java/net/minecraft/server/BlockPressurePlateBinary.java71
-rw-r--r--src/main/java/net/minecraft/server/BlockPumpkin.java29
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneLamp.java11
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneOre.java42
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneTorch.java45
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneWire.java303
-rw-r--r--src/main/java/net/minecraft/server/BlockReed.java21
-rw-r--r--src/main/java/net/minecraft/server/BlockSand.java78
-rw-r--r--src/main/java/net/minecraft/server/BlockSapling.java52
-rw-r--r--src/main/java/net/minecraft/server/BlockSign.java9
-rw-r--r--src/main/java/net/minecraft/server/BlockSkull.java29
-rw-r--r--src/main/java/net/minecraft/server/BlockSnow.java40
-rw-r--r--src/main/java/net/minecraft/server/BlockSoil.java29
-rw-r--r--src/main/java/net/minecraft/server/BlockStationary.java25
-rw-r--r--src/main/java/net/minecraft/server/BlockStem.java33
-rw-r--r--src/main/java/net/minecraft/server/BlockTNT.java79
-rw-r--r--src/main/java/net/minecraft/server/BlockTrapdoor.java35
-rw-r--r--src/main/java/net/minecraft/server/BlockTripwire.java32
-rw-r--r--src/main/java/net/minecraft/server/BlockTripwireHook.java58
-rw-r--r--src/main/java/net/minecraft/server/BlockVine.java55
-rw-r--r--src/main/java/net/minecraft/server/Chunk.java82
-rw-r--r--src/main/java/net/minecraft/server/ChunkProviderServer.java4
-rw-r--r--src/main/java/net/minecraft/server/ChunkRegionLoader.java33
-rw-r--r--src/main/java/net/minecraft/server/ConsoleLogFormatter.java43
-rw-r--r--src/main/java/net/minecraft/server/ConsoleLogManager.java94
-rw-r--r--src/main/java/net/minecraft/server/Container.java425
-rw-r--r--src/main/java/net/minecraft/server/ContainerAnvil.java38
-rw-r--r--src/main/java/net/minecraft/server/ContainerAnvilInventory.java8
-rw-r--r--src/main/java/net/minecraft/server/ContainerBeacon.java10
-rw-r--r--src/main/java/net/minecraft/server/ContainerBrewingStand.java2
-rw-r--r--src/main/java/net/minecraft/server/ContainerChest.java6
-rw-r--r--src/main/java/net/minecraft/server/ContainerDispenser.java2
-rw-r--r--src/main/java/net/minecraft/server/ContainerEnchantTable.java4
-rw-r--r--src/main/java/net/minecraft/server/ContainerEnchantTableInventory.java8
-rw-r--r--src/main/java/net/minecraft/server/ContainerFurnace.java2
-rw-r--r--src/main/java/net/minecraft/server/ContainerHopper.java85
-rw-r--r--src/main/java/net/minecraft/server/ContainerMerchant.java6
-rw-r--r--src/main/java/net/minecraft/server/ContainerPlayer.java8
-rw-r--r--src/main/java/net/minecraft/server/ContainerWorkbench.java4
-rw-r--r--src/main/java/net/minecraft/server/ControllerLook.java10
-rw-r--r--src/main/java/net/minecraft/server/ControllerMove.java2
-rw-r--r--src/main/java/net/minecraft/server/CraftingManager.java21
-rw-r--r--src/main/java/net/minecraft/server/CrashReport.java6
-rw-r--r--src/main/java/net/minecraft/server/DedicatedServer.java96
-rw-r--r--src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java79
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorBoat.java19
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java19
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java17
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorFireball.java14
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorFireworks.java10
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorItem.java4
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorMinecart.java27
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java18
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java4
-rw-r--r--src/main/java/net/minecraft/server/Entity.java451
-rw-r--r--src/main/java/net/minecraft/server/EntityAgeable.java53
-rw-r--r--src/main/java/net/minecraft/server/EntityArrow.java60
-rw-r--r--src/main/java/net/minecraft/server/EntityBlaze.java16
-rw-r--r--src/main/java/net/minecraft/server/EntityBoat.java45
-rw-r--r--src/main/java/net/minecraft/server/EntityChicken.java8
-rw-r--r--src/main/java/net/minecraft/server/EntityCow.java14
-rw-r--r--src/main/java/net/minecraft/server/EntityCreature.java30
-rw-r--r--src/main/java/net/minecraft/server/EntityCreeper.java12
-rw-r--r--src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java13
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderCrystal.java6
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderDragon.java162
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderman.java46
-rw-r--r--src/main/java/net/minecraft/server/EntityExperienceOrb.java16
-rw-r--r--src/main/java/net/minecraft/server/EntityFallingBlock.java90
-rw-r--r--src/main/java/net/minecraft/server/EntityFireball.java22
-rw-r--r--src/main/java/net/minecraft/server/EntityFireworks.java12
-rw-r--r--src/main/java/net/minecraft/server/EntityFishingHook.java48
-rw-r--r--src/main/java/net/minecraft/server/EntityGhast.java26
-rw-r--r--src/main/java/net/minecraft/server/EntityHanging.java20
-rw-r--r--src/main/java/net/minecraft/server/EntityHuman.java380
-rw-r--r--src/main/java/net/minecraft/server/EntityIronGolem.java20
-rw-r--r--src/main/java/net/minecraft/server/EntityItem.java27
-rw-r--r--src/main/java/net/minecraft/server/EntityLightning.java10
-rw-r--r--src/main/java/net/minecraft/server/EntityLiving.java686
-rw-r--r--src/main/java/net/minecraft/server/EntityMagmaCube.java14
-rw-r--r--src/main/java/net/minecraft/server/EntityMinecart.java1050
-rw-r--r--src/main/java/net/minecraft/server/EntityMinecartAbstract.java888
-rw-r--r--src/main/java/net/minecraft/server/EntityMinecartContainer.java236
-rw-r--r--src/main/java/net/minecraft/server/EntityMonster.java14
-rw-r--r--src/main/java/net/minecraft/server/EntityMushroomCow.java6
-rw-r--r--src/main/java/net/minecraft/server/EntityOcelot.java24
-rw-r--r--src/main/java/net/minecraft/server/EntityPig.java20
-rw-r--r--src/main/java/net/minecraft/server/EntityPigZombie.java28
-rw-r--r--src/main/java/net/minecraft/server/EntityPlayer.java257
-rw-r--r--src/main/java/net/minecraft/server/EntityProjectile.java16
-rw-r--r--src/main/java/net/minecraft/server/EntitySheep.java20
-rw-r--r--src/main/java/net/minecraft/server/EntitySilverfish.java29
-rw-r--r--src/main/java/net/minecraft/server/EntitySkeleton.java63
-rw-r--r--src/main/java/net/minecraft/server/EntitySlime.java39
-rw-r--r--src/main/java/net/minecraft/server/EntitySmallFireball.java4
-rw-r--r--src/main/java/net/minecraft/server/EntitySnowman.java12
-rw-r--r--src/main/java/net/minecraft/server/EntitySpider.java24
-rw-r--r--src/main/java/net/minecraft/server/EntitySquid.java64
-rw-r--r--src/main/java/net/minecraft/server/EntityTNTPrimed.java12
-rw-r--r--src/main/java/net/minecraft/server/EntityTracker.java30
-rw-r--r--src/main/java/net/minecraft/server/EntityTrackerEntry.java187
-rw-r--r--src/main/java/net/minecraft/server/EntityWitch.java40
-rw-r--r--src/main/java/net/minecraft/server/EntityWither.java61
-rw-r--r--src/main/java/net/minecraft/server/EntityWitherSkull.java8
-rw-r--r--src/main/java/net/minecraft/server/EntityWolf.java60
-rw-r--r--src/main/java/net/minecraft/server/EntityZombie.java83
-rw-r--r--src/main/java/net/minecraft/server/Explosion.java23
-rw-r--r--src/main/java/net/minecraft/server/FoodMetaData.java2
-rw-r--r--src/main/java/net/minecraft/server/IDataManager.java2
-rw-r--r--src/main/java/net/minecraft/server/IInventory.java8
-rw-r--r--src/main/java/net/minecraft/server/InventoryCraftResult.java12
-rw-r--r--src/main/java/net/minecraft/server/InventoryCrafting.java12
-rw-r--r--src/main/java/net/minecraft/server/InventoryEnderChest.java16
-rw-r--r--src/main/java/net/minecraft/server/InventoryLargeChest.java20
-rw-r--r--src/main/java/net/minecraft/server/InventoryMerchant.java24
-rw-r--r--src/main/java/net/minecraft/server/InventorySubcontainer.java16
-rw-r--r--src/main/java/net/minecraft/server/ItemBed.java6
-rw-r--r--src/main/java/net/minecraft/server/ItemBlock.java16
-rw-r--r--src/main/java/net/minecraft/server/ItemBoat.java4
-rw-r--r--src/main/java/net/minecraft/server/ItemBow.java8
-rw-r--r--src/main/java/net/minecraft/server/ItemBucket.java6
-rw-r--r--src/main/java/net/minecraft/server/ItemDoor.java12
-rw-r--r--src/main/java/net/minecraft/server/ItemDye.java235
-rw-r--r--src/main/java/net/minecraft/server/ItemFireball.java4
-rw-r--r--src/main/java/net/minecraft/server/ItemFishingRod.java6
-rw-r--r--src/main/java/net/minecraft/server/ItemFlintAndSteel.java4
-rw-r--r--src/main/java/net/minecraft/server/ItemFood.java34
-rw-r--r--src/main/java/net/minecraft/server/ItemHoe.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemMinecart.java12
-rw-r--r--src/main/java/net/minecraft/server/ItemMonsterEgg.java20
-rw-r--r--src/main/java/net/minecraft/server/ItemRedstone.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemReed.java8
-rw-r--r--src/main/java/net/minecraft/server/ItemSeedFood.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemSeeds.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemSign.java4
-rw-r--r--src/main/java/net/minecraft/server/ItemSkull.java10
-rw-r--r--src/main/java/net/minecraft/server/ItemSnow.java36
-rw-r--r--src/main/java/net/minecraft/server/ItemStack.java103
-rw-r--r--src/main/java/net/minecraft/server/ItemStep.java8
-rw-r--r--src/main/java/net/minecraft/server/ItemWaterLily.java2
-rw-r--r--src/main/java/net/minecraft/server/MinecraftServer.java298
-rw-r--r--src/main/java/net/minecraft/server/MobEffectList.java8
-rw-r--r--src/main/java/net/minecraft/server/MobSpawnerAbstract.java281
-rw-r--r--src/main/java/net/minecraft/server/NetworkManager.java116
-rw-r--r--src/main/java/net/minecraft/server/Packet.java44
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java52
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java12
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalBreed.java21
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalEatTile.java11
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java10
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalSit.java4
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalTarget.java8
-rw-r--r--src/main/java/net/minecraft/server/PendingConnection.java65
-rw-r--r--src/main/java/net/minecraft/server/PlayerConnection.java223
-rw-r--r--src/main/java/net/minecraft/server/PlayerInteractManager.java38
-rw-r--r--src/main/java/net/minecraft/server/PlayerInventory.java92
-rw-r--r--src/main/java/net/minecraft/server/PlayerList.java188
-rw-r--r--src/main/java/net/minecraft/server/PortalTravelAgent.java22
-rw-r--r--src/main/java/net/minecraft/server/PropertyManager.java21
-rw-r--r--src/main/java/net/minecraft/server/RecipeArmorDye.java3
-rw-r--r--src/main/java/net/minecraft/server/RecipeFireworks.java4
-rw-r--r--src/main/java/net/minecraft/server/RecipeMapClone.java4
-rw-r--r--src/main/java/net/minecraft/server/RecipesFurnace.java2
-rw-r--r--src/main/java/net/minecraft/server/SecondaryWorldServer.java5
-rw-r--r--src/main/java/net/minecraft/server/ShapedRecipes.java2
-rw-r--r--src/main/java/net/minecraft/server/ShapelessRecipes.java2
-rw-r--r--src/main/java/net/minecraft/server/SpawnerCreature.java14
-rw-r--r--src/main/java/net/minecraft/server/ThreadCommandReader.java2
-rw-r--r--src/main/java/net/minecraft/server/TileEntity.java27
-rw-r--r--src/main/java/net/minecraft/server/TileEntityBeacon.java35
-rw-r--r--src/main/java/net/minecraft/server/TileEntityBrewingStand.java81
-rw-r--r--src/main/java/net/minecraft/server/TileEntityChest.java135
-rw-r--r--src/main/java/net/minecraft/server/TileEntityCommand.java63
-rw-r--r--src/main/java/net/minecraft/server/TileEntityDispenser.java34
-rw-r--r--src/main/java/net/minecraft/server/TileEntityFurnace.java39
-rw-r--r--src/main/java/net/minecraft/server/TileEntityHopper.java417
-rw-r--r--src/main/java/net/minecraft/server/TileEntityMobSpawner.java233
-rw-r--r--src/main/java/net/minecraft/server/TileEntityPiston.java12
-rw-r--r--src/main/java/net/minecraft/server/Village.java4
-rw-r--r--src/main/java/net/minecraft/server/VillageSiege.java2
-rw-r--r--src/main/java/net/minecraft/server/World.java938
-rw-r--r--src/main/java/net/minecraft/server/WorldGenForest.java8
-rw-r--r--src/main/java/net/minecraft/server/WorldGenGroundBush.java2
-rw-r--r--src/main/java/net/minecraft/server/WorldGenHugeMushroom.java4
-rw-r--r--src/main/java/net/minecraft/server/WorldGenMegaTree.java16
-rw-r--r--src/main/java/net/minecraft/server/WorldGenSwampTree.java2
-rw-r--r--src/main/java/net/minecraft/server/WorldGenTaiga1.java2
-rw-r--r--src/main/java/net/minecraft/server/WorldGenTaiga2.java2
-rw-r--r--src/main/java/net/minecraft/server/WorldGenTrees.java8
-rw-r--r--src/main/java/net/minecraft/server/WorldGenerator.java3
-rw-r--r--src/main/java/net/minecraft/server/WorldMap.java8
-rw-r--r--src/main/java/net/minecraft/server/WorldMapHumanTracker.java2
-rw-r--r--src/main/java/net/minecraft/server/WorldNBTStorage.java23
-rw-r--r--src/main/java/net/minecraft/server/WorldServer.java183
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftServer.java6
-rw-r--r--src/main/java/org/bukkit/craftbukkit/CraftWorld.java16
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java26
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java16
-rw-r--r--src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java10
-rw-r--r--src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java17
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java8
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java28
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java28
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java16
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartMobSpawner.java16
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java11
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java9
-rw-r--r--src/main/java/org/bukkit/craftbukkit/entity/CraftStorageMinecart.java13
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java2
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java12
243 files changed, 8469 insertions, 6729 deletions
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index f29eace6..4392cb2d 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -6,177 +6,188 @@ import java.util.Random;
public class Block {
private CreativeModeTab creativeTab;
- public static final StepSound d = new StepSound("stone", 1.0F, 1.0F);
- public static final StepSound e = new StepSound("wood", 1.0F, 1.0F);
- public static final StepSound f = new StepSound("gravel", 1.0F, 1.0F);
- public static final StepSound g = new StepSound("grass", 1.0F, 1.0F);
- public static final StepSound h = new StepSound("stone", 1.0F, 1.0F);
- public static final StepSound i = new StepSound("stone", 1.0F, 1.5F);
- public static final StepSound j = new StepSoundStone("stone", 1.0F, 1.0F);
- public static final StepSound k = new StepSound("cloth", 1.0F, 1.0F);
- public static final StepSound l = new StepSound("sand", 1.0F, 1.0F);
- public static final StepSound m = new StepSound("snow", 1.0F, 1.0F);
- public static final StepSound n = new StepSoundLadder("ladder", 1.0F, 1.0F);
- public static final StepSound o = new StepSoundAnvil("anvil", 0.3F, 1.0F);
+ public static final StepSound f = new StepSound("stone", 1.0F, 1.0F);
+ public static final StepSound g = new StepSound("wood", 1.0F, 1.0F);
+ public static final StepSound h = new StepSound("gravel", 1.0F, 1.0F);
+ public static final StepSound i = new StepSound("grass", 1.0F, 1.0F);
+ public static final StepSound j = new StepSound("stone", 1.0F, 1.0F);
+ public static final StepSound k = new StepSound("stone", 1.0F, 1.5F);
+ public static final StepSound l = new StepSoundStone("stone", 1.0F, 1.0F);
+ public static final StepSound m = new StepSound("cloth", 1.0F, 1.0F);
+ public static final StepSound n = new StepSound("sand", 1.0F, 1.0F);
+ public static final StepSound o = new StepSound("snow", 1.0F, 1.0F);
+ public static final StepSound p = new StepSoundLadder("ladder", 1.0F, 1.0F);
+ public static final StepSound q = new StepSoundAnvil("anvil", 0.3F, 1.0F);
public static final Block[] byId = new Block[4096];
- public static final boolean[] q = new boolean[4096];
- public static final int[] lightBlock = new int[4096];
public static final boolean[] s = new boolean[4096];
- public static final int[] lightEmission = new int[4096];
+ public static final int[] lightBlock = new int[4096];
public static final boolean[] u = new boolean[4096];
- public static boolean[] v = new boolean[4096];
- public static final Block STONE = (new BlockStone(1, 1)).c(1.5F).b(10.0F).a(h).b("stone");
- public static final BlockGrass GRASS = (BlockGrass) (new BlockGrass(2)).c(0.6F).a(g).b("grass");
- public static final Block DIRT = (new BlockDirt(3, 2)).c(0.5F).a(f).b("dirt");
- public static final Block COBBLESTONE = (new Block(4, 16, Material.STONE)).c(2.0F).b(10.0F).a(h).b("stonebrick").a(CreativeModeTab.b);
- public static final Block WOOD = (new BlockWood(5)).c(2.0F).b(5.0F).a(e).b("wood").r();
- public static final Block SAPLING = (new BlockSapling(6, 15)).c(0.0F).a(g).b("sapling").r();
- public static final Block BEDROCK = (new Block(7, 17, Material.STONE)).s().b(6000000.0F).a(h).b("bedrock").D().a(CreativeModeTab.b);
- public static final Block WATER = (new BlockFlowing(8, Material.WATER)).c(100.0F).h(3).b("water").D().r();
- public static final Block STATIONARY_WATER = (new BlockStationary(9, Material.WATER)).c(100.0F).h(3).b("water").D().r();
- public static final Block LAVA = (new BlockFlowing(10, Material.LAVA)).c(0.0F).a(1.0F).h(255).b("lava").D().r();
- public static final Block STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).h(255).b("lava").D().r();
- public static final Block SAND = (new BlockSand(12, 18)).c(0.5F).a(l).b("sand");
- public static final Block GRAVEL = (new BlockGravel(13, 19)).c(0.6F).a(f).b("gravel");
- public static final Block GOLD_ORE = (new BlockOre(14, 32)).c(3.0F).b(5.0F).a(h).b("oreGold");
- public static final Block IRON_ORE = (new BlockOre(15, 33)).c(3.0F).b(5.0F).a(h).b("oreIron");
- public static final Block COAL_ORE = (new BlockOre(16, 34)).c(3.0F).b(5.0F).a(h).b("oreCoal");
- public static final Block LOG = (new BlockLog(17)).c(2.0F).a(e).b("log").r();
- public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18, 52)).c(0.2F).h(1).a(g).b("leaves").r();
- public static final Block SPONGE = (new BlockSponge(19)).c(0.6F).a(g).b("sponge");
- public static final Block GLASS = (new BlockGlass(20, 49, Material.SHATTERABLE, false)).c(0.3F).a(j).b("glass");
- public static final Block LAPIS_ORE = (new BlockOre(21, 160)).c(3.0F).b(5.0F).a(h).b("oreLapis");
- public static final Block LAPIS_BLOCK = (new Block(22, 144, Material.STONE)).c(3.0F).b(5.0F).a(h).b("blockLapis").a(CreativeModeTab.b);
- public static final Block DISPENSER = (new BlockDispenser(23)).c(3.5F).a(h).b("dispenser").r();
- public static final Block SANDSTONE = (new BlockSandStone(24)).a(h).c(0.8F).b("sandStone").r();
- public static final Block NOTE_BLOCK = (new BlockNote(25)).c(0.8F).b("musicBlock").r();
- public static final Block BED = (new BlockBed(26)).c(0.2F).b("bed").D().r();
- public static final Block GOLDEN_RAIL = (new BlockMinecartTrack(27, 179, true)).c(0.7F).a(i).b("goldenRail").r();
- public static final Block DETECTOR_RAIL = (new BlockMinecartDetector(28, 195)).c(0.7F).a(i).b("detectorRail").r();
- public static final Block PISTON_STICKY = (new BlockPiston(29, 106, true)).b("pistonStickyBase").r();
- public static final Block WEB = (new BlockWeb(30, 11)).h(1).c(4.0F).b("web");
- public static final BlockLongGrass LONG_GRASS = (BlockLongGrass) (new BlockLongGrass(31, 39)).c(0.0F).a(g).b("tallgrass");
- public static final BlockDeadBush DEAD_BUSH = (BlockDeadBush) (new BlockDeadBush(32, 55)).c(0.0F).a(g).b("deadbush");
- public static final Block PISTON = (new BlockPiston(33, 107, false)).b("pistonBase").r();
- public static final BlockPistonExtension PISTON_EXTENSION = (BlockPistonExtension) (new BlockPistonExtension(34, 107)).r();
- public static final Block WOOL = (new BlockCloth()).c(0.8F).a(k).b("cloth").r();
+ public static final int[] lightEmission = new int[4096];
+ public static boolean[] w = new boolean[4096];
+ public static final Block STONE = (new BlockStone(1)).c(1.5F).b(10.0F).a(j).c("stone");
+ public static final BlockGrass GRASS = (BlockGrass) (new BlockGrass(2)).c(0.6F).a(i).c("grass");
+ public static final Block DIRT = (new BlockDirt(3)).c(0.5F).a(h).c("dirt");
+ public static final Block COBBLESTONE = (new Block(4, Material.STONE)).c(2.0F).b(10.0F).a(j).c("stonebrick").a(CreativeModeTab.b);
+ public static final Block WOOD = (new BlockWood(5)).c(2.0F).b(5.0F).a(g).c("wood");
+ public static final Block SAPLING = (new BlockSapling(6)).c(0.0F).a(i).c("sapling");
+ public static final Block BEDROCK = (new Block(7, Material.STONE)).r().b(6000000.0F).a(j).c("bedrock").D().a(CreativeModeTab.b);
+ public static final BlockFluids WATER = (BlockFluids) (new BlockFlowing(8, Material.WATER)).c(100.0F).k(3).c("water").D();
+ public static final Block STATIONARY_WATER = (new BlockStationary(9, Material.WATER)).c(100.0F).k(3).c("water").D();
+ public static final BlockFluids LAVA = (BlockFluids) (new BlockFlowing(10, Material.LAVA)).c(0.0F).a(1.0F).c("lava").D();
+ public static final Block STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).c("lava").D();
+ public static final Block SAND = (new BlockSand(12)).c(0.5F).a(n).c("sand");
+ public static final Block GRAVEL = (new BlockGravel(13)).c(0.6F).a(h).c("gravel");
+ public static final Block GOLD_ORE = (new BlockOre(14)).c(3.0F).b(5.0F).a(j).c("oreGold");
+ public static final Block IRON_ORE = (new BlockOre(15)).c(3.0F).b(5.0F).a(j).c("oreIron");
+ public static final Block COAL_ORE = (new BlockOre(16)).c(3.0F).b(5.0F).a(j).c("oreCoal");
+ public static final Block LOG = (new BlockLog(17)).c(2.0F).a(g).c("log");
+ public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18)).c(0.2F).k(1).a(i).c("leaves");
+ public static final Block SPONGE = (new BlockSponge(19)).c(0.6F).a(i).c("sponge");
+ public static final Block GLASS = (new BlockGlass(20, Material.SHATTERABLE, false)).c(0.3F).a(l).c("glass");
+ public static final Block LAPIS_ORE = (new BlockOre(21)).c(3.0F).b(5.0F).a(j).c("oreLapis");
+ public static final Block LAPIS_BLOCK = (new Block(22, Material.STONE)).c(3.0F).b(5.0F).a(j).c("blockLapis").a(CreativeModeTab.b);
+ public static final Block DISPENSER = (new BlockDispenser(23)).c(3.5F).a(j).c("dispenser");
+ public static final Block SANDSTONE = (new BlockSandStone(24)).a(j).c(0.8F).c("sandStone");
+ public static final Block NOTE_BLOCK = (new BlockNote(25)).c(0.8F).c("musicBlock");
+ public static final Block BED = (new BlockBed(26)).c(0.2F).c("bed").D();
+ public static final Block GOLDEN_RAIL = (new BlockPoweredRail(27)).c(0.7F).a(k).c("goldenRail");
+ public static final Block DETECTOR_RAIL = (new BlockMinecartDetector(28)).c(0.7F).a(k).c("detectorRail");
+ public static final BlockPiston PISTON_STICKY = (BlockPiston) (new BlockPiston(29, true)).c("pistonStickyBase");
+ public static final Block WEB = (new BlockWeb(30)).k(1).c(4.0F).c("web");
+ public static final BlockLongGrass LONG_GRASS = (BlockLongGrass) (new BlockLongGrass(31)).c(0.0F).a(i).c("tallgrass");
+ public static final BlockDeadBush DEAD_BUSH = (BlockDeadBush) (new BlockDeadBush(32)).c(0.0F).a(i).c("deadbush");
+ public static final BlockPiston PISTON = (BlockPiston) (new BlockPiston(33, false)).c("pistonBase");
+ public static final BlockPistonExtension PISTON_EXTENSION = new BlockPistonExtension(34);
+ public static final Block WOOL = (new BlockCloth()).c(0.8F).a(m).c("cloth");
public static final BlockPistonMoving PISTON_MOVING = new BlockPistonMoving(36);
- public static final BlockFlower YELLOW_FLOWER = (BlockFlower) (new BlockFlower(37, 13)).c(0.0F).a(g).b("flower");
- public static final BlockFlower RED_ROSE = (BlockFlower) (new BlockFlower(38, 12)).c(0.0F).a(g).b("rose");
- public static final BlockFlower BROWN_MUSHROOM = (BlockFlower) (new BlockMushroom(39, 29)).c(0.0F).a(g).a(0.125F).b("mushroom");
- public static final BlockFlower RED_MUSHROOM = (BlockFlower) (new BlockMushroom(40, 28)).c(0.0F).a(g).b("mushroom");
- public static final Block GOLD_BLOCK = (new BlockOreBlock(41, 23)).c(3.0F).b(10.0F).a(i).b("blockGold");
- public static final Block IRON_BLOCK = (new BlockOreBlock(42, 22)).c(5.0F).b(10.0F).a(i).b("blockIron");
- public static final BlockStepAbstract DOUBLE_STEP = (BlockStepAbstract) (new BlockStep(43, true)).c(2.0F).b(10.0F).a(h).b("stoneSlab");
- public static final BlockStepAbstract STEP = (BlockStepAbstract) (new BlockStep(44, false)).c(2.0F).b(10.0F).a(h).b("stoneSlab");
- public static final Block BRICK = (new Block(45, 7, Material.STONE)).c(2.0F).b(10.0F).a(h).b("brick").a(CreativeModeTab.b);
- public static final Block TNT = (new BlockTNT(46, 8)).c(0.0F).a(g).b("tnt");
- public static final Block BOOKSHELF = (new BlockBookshelf(47, 35)).c(1.5F).a(e).b("bookshelf");
- public static final Block MOSSY_COBBLESTONE = (new Block(48, 36, Material.STONE)).c(2.0F).b(10.0F).a(h).b("stoneMoss").a(CreativeModeTab.b);
- public static final Block OBSIDIAN = (new BlockObsidian(49, 37)).c(50.0F).b(2000.0F).a(h).b("obsidian");
- public static final Block TORCH = (new BlockTorch(50, 80)).c(0.0F).a(0.9375F).a(e).b("torch").r();
- public static final BlockFire FIRE = (BlockFire) (new BlockFire(51, 31)).c(0.0F).a(1.0F).a(e).b("fire").D();
- public static final Block MOB_SPAWNER = (new BlockMobSpawner(52, 65)).c(5.0F).a(i).b("mobSpawner").D();
- public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD, 0)).b("stairsWood").r();
- public static final Block CHEST = (new BlockChest(54)).c(2.5F).a(e).b("chest").r();
- public static final Block REDSTONE_WIRE = (new BlockRedstoneWire(55, 164)).c(0.0F).a(d).b("redstoneDust").D().r();
- public static final Block DIAMOND_ORE = (new BlockOre(56, 50)).c(3.0F).b(5.0F).a(h).b("oreDiamond");
- public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57, 24)).c(5.0F).b(10.0F).a(i).b("blockDiamond");
- public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(e).b("workbench");
- public static final Block CROPS = (new BlockCrops(59, 88)).b("crops");
- public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(f).b("farmland").r();
- public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(h).b("furnace").r().a(CreativeModeTab.c);
- public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(h).a(0.875F).b("furnace").r();
- public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(e).b("sign").D().r();
- public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(e).b("doorWood").D().r();
- public static final Block LADDER = (new BlockLadder(65, 83)).c(0.4F).a(n).b("ladder").r();
- public static final Block RAILS = (new BlockMinecartTrack(66, 128, false)).c(0.7F).a(i).b("rail").r();
- public static final Block COBBLESTONE_STAIRS = (new BlockStairs(67, COBBLESTONE, 0)).b("stairsStone").r();
- public static final Block WALL_SIGN = (new BlockSign(68, TileEntitySign.class, false)).c(1.0F).a(e).b("sign").D().r();
- public static final Block LEVER = (new BlockLever(69, 96)).c(0.5F).a(e).b("lever").r();
- public static final Block STONE_PLATE = (new BlockPressurePlate(70, STONE.textureId, EnumMobType.MOBS, Material.STONE)).c(0.5F).a(h).b("pressurePlate").r();
- public static final Block IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(i).b("doorIron").D().r();
- public static final Block WOOD_PLATE = (new BlockPressurePlate(72, WOOD.textureId, EnumMobType.EVERYTHING, Material.WOOD)).c(0.5F).a(e).b("pressurePlate").r();
- public static final Block REDSTONE_ORE = (new BlockRedstoneOre(73, 51, false)).c(3.0F).b(5.0F).a(h).b("oreRedstone").r().a(CreativeModeTab.b);
- public static final Block GLOWING_REDSTONE_ORE = (new BlockRedstoneOre(74, 51, true)).a(0.625F).c(3.0F).b(5.0F).a(h).b("oreRedstone").r();
- public static final Block REDSTONE_TORCH_OFF = (new BlockRedstoneTorch(75, 115, false)).c(0.0F).a(e).b("notGate").r();
- public static final Block REDSTONE_TORCH_ON = (new BlockRedstoneTorch(76, 99, true)).c(0.0F).a(0.5F).a(e).b("notGate").r().a(CreativeModeTab.d);
- public static final Block STONE_BUTTON = (new BlockButton(77, STONE.textureId, false)).c(0.5F).a(h).b("button").r();
- public static final Block SNOW = (new BlockSnow(78, 66)).c(0.1F).a(m).b("snow").r().h(0);
- public static final Block ICE = (new BlockIce(79, 67)).c(0.5F).h(3).a(j).b("ice");
- public static final Block SNOW_BLOCK = (new BlockSnowBlock(80, 66)).c(0.2F).a(m).b("snow");
- public static final Block CACTUS = (new BlockCactus(81, 70)).c(0.4F).a(k).b("cactus");
- public static final Block CLAY = (new BlockClay(82, 72)).c(0.6F).a(f).b("clay");
- public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83, 73)).c(0.0F).a(g).b("reeds").D();
- public static final Block JUKEBOX = (new BlockJukeBox(84, 74)).c(2.0F).b(10.0F).a(h).b("jukebox").r();
- public static final Block FENCE = (new BlockFence(85, 4)).c(2.0F).b(5.0F).a(e).b("fence");
- public static final Block PUMPKIN = (new BlockPumpkin(86, 102, false)).c(1.0F).a(e).b("pumpkin").r();
- public static final Block NETHERRACK = (new BlockBloodStone(87, 103)).c(0.4F).a(h).b("hellrock");
- public static final Block SOUL_SAND = (new BlockSlowSand(88, 104)).c(0.5F).a(l).b("hellsand");
- public static final Block GLOWSTONE = (new BlockLightStone(89, 105, Material.SHATTERABLE)).c(0.3F).a(j).a(1.0F).b("lightgem");
- public static final BlockPortal PORTAL = (BlockPortal) (new BlockPortal(90, 14)).c(-1.0F).a(j).a(0.75F).b("portal");
- public static final Block JACK_O_LANTERN = (new BlockPumpkin(91, 102, true)).c(1.0F).a(e).a(1.0F).b("litpumpkin").r();
- public static final Block CAKE_BLOCK = (new BlockCake(92, 121)).c(0.5F).a(k).b("cake").D().r();
- public static final Block DIODE_OFF = (new BlockDiode(93, false)).c(0.0F).a(e).b("diode").D().r();
- public static final Block DIODE_ON = (new BlockDiode(94, true)).c(0.0F).a(0.625F).a(e).b("diode").D().r();
- public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(e).b("lockedchest").b(true).r();
- public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(e).b("trapdoor").D().r();
- public static final Block MONSTER_EGGS = (new BlockMonsterEggs(97)).c(0.75F).b("monsterStoneEgg");
- public static final Block SMOOTH_BRICK = (new BlockSmoothBrick(98)).c(1.5F).b(10.0F).a(h).b("stonebricksmooth");
- public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 142, 0)).c(0.2F).a(e).b("mushroom").r();
- public static final Block BIG_MUSHROOM_2 = (new BlockHugeMushroom(100, Material.WOOD, 142, 1)).c(0.2F).a(e).b("mushroom").r();
- public static final Block IRON_FENCE = (new BlockThinFence(101, 85, 85, Material.ORE, true)).c(5.0F).b(10.0F).a(i).b("fenceIron");
- public static final Block THIN_GLASS = (new BlockThinFence(102, 49, 148, Material.SHATTERABLE, false)).c(0.3F).a(j).b("thinGlass");
- public static final Block MELON = (new BlockMelon(103)).c(1.0F).a(e).b("melon");
- public static final Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(e).b("pumpkinStem").r();
- public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(e).b("pumpkinStem").r();
- public static final Block VINE = (new BlockVine(106)).c(0.2F).a(g).b("vine").r();
- public static final Block FENCE_GATE = (new BlockFenceGate(107, 4)).c(2.0F).b(5.0F).a(e).b("fenceGate").r();
- public static final Block BRICK_STAIRS = (new BlockStairs(108, BRICK, 0)).b("stairsBrick").r();
- public static final Block STONE_STAIRS = (new BlockStairs(109, SMOOTH_BRICK, 0)).b("stairsStoneBrickSmooth").r();
- public static final BlockMycel MYCEL = (BlockMycel) (new BlockMycel(110)).c(0.6F).a(g).b("mycel");
- public static final Block WATER_LILY = (new BlockWaterLily(111, 76)).c(0.0F).a(g).b("waterlily");
- public static final Block NETHER_BRICK = (new Block(112, 224, Material.STONE)).c(2.0F).b(10.0F).a(h).b("netherBrick").a(CreativeModeTab.b);
- public static final Block NETHER_FENCE = (new BlockFence(113, 224, Material.STONE)).c(2.0F).b(10.0F).a(h).b("netherFence");
- public static final Block NETHER_BRICK_STAIRS = (new BlockStairs(114, NETHER_BRICK, 0)).b("stairsNetherBrick").r();
- public static final Block NETHER_WART = (new BlockNetherWart(115)).b("netherStalk").r();
- public static final Block ENCHANTMENT_TABLE = (new BlockEnchantmentTable(116)).c(5.0F).b(2000.0F).b("enchantmentTable");
- public static final Block BREWING_STAND = (new BlockBrewingStand(117)).c(0.5F).a(0.125F).b("brewingStand").r();
- public static final Block CAULDRON = (new BlockCauldron(118)).c(2.0F).b("cauldron").r();
+ public static final BlockFlower YELLOW_FLOWER = (BlockFlower) (new BlockFlower(37)).c(0.0F).a(i).c("flower");
+ public static final BlockFlower RED_ROSE = (BlockFlower) (new BlockFlower(38)).c(0.0F).a(i).c("rose");
+ public static final BlockFlower BROWN_MUSHROOM = (BlockFlower) (new BlockMushroom(39, "mushroom_brown")).c(0.0F).a(i).a(0.125F).c("mushroom");
+ public static final BlockFlower RED_MUSHROOM = (BlockFlower) (new BlockMushroom(40, "mushroom_red")).c(0.0F).a(i).c("mushroom");
+ public static final Block GOLD_BLOCK = (new BlockOreBlock(41)).c(3.0F).b(10.0F).a(k).c("blockGold");
+ public static final Block IRON_BLOCK = (new BlockOreBlock(42)).c(5.0F).b(10.0F).a(k).c("blockIron");
+ public static final BlockStepAbstract DOUBLE_STEP = (BlockStepAbstract) (new BlockStep(43, true)).c(2.0F).b(10.0F).a(j).c("stoneSlab");
+ public static final BlockStepAbstract STEP = (BlockStepAbstract) (new BlockStep(44, false)).c(2.0F).b(10.0F).a(j).c("stoneSlab");
+ public static final Block BRICK = (new Block(45, Material.STONE)).c(2.0F).b(10.0F).a(j).c("brick").a(CreativeModeTab.b);
+ public static final Block TNT = (new BlockTNT(46)).c(0.0F).a(i).c("tnt");
+ public static final Block BOOKSHELF = (new BlockBookshelf(47)).c(1.5F).a(g).c("bookshelf");
+ public static final Block MOSSY_COBBLESTONE = (new Block(48, Material.STONE)).c(2.0F).b(10.0F).a(j).c("stoneMoss").a(CreativeModeTab.b);
+ public static final Block OBSIDIAN = (new BlockObsidian(49)).c(50.0F).b(2000.0F).a(j).c("obsidian");
+ public static final Block TORCH = (new BlockTorch(50)).c(0.0F).a(0.9375F).a(g).c("torch");
+ public static final BlockFire FIRE = (BlockFire) (new BlockFire(51)).c(0.0F).a(1.0F).a(g).c("fire").D();
+ public static final Block MOB_SPAWNER = (new BlockMobSpawner(52)).c(5.0F).a(k).c("mobSpawner").D();
+ public static final Block WOOD_STAIRS = (new BlockStairs(53, WOOD, 0)).c("stairsWood");
+ public static final BlockChest CHEST = (BlockChest) (new BlockChest(54, 0)).c(2.5F).a(g).c("chest");
+ public static final BlockRedstoneWire REDSTONE_WIRE = (BlockRedstoneWire) (new BlockRedstoneWire(55)).c(0.0F).a(f).c("redstoneDust").D();
+ public static final Block DIAMOND_ORE = (new BlockOre(56)).c(3.0F).b(5.0F).a(j).c("oreDiamond");
+ public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57)).c(5.0F).b(10.0F).a(k).c("blockDiamond");
+ public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(g).c("workbench");
+ public static final Block CROPS = (new BlockCrops(59)).c("crops");
+ public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(h).c("farmland");
+ public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(j).c("furnace").a(CreativeModeTab.c);
+ public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(j).a(0.875F).c("furnace");
+ public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(g).c("sign").D();
+ public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(g).c("doorWood").D();
+ public static final Block LADDER = (new BlockLadder(65)).c(0.4F).a(p).c("ladder");
+ public static final Block RAILS = (new BlockMinecartTrack(66)).c(0.7F).a(k).c("rail");
+ public static final Block COBBLESTONE_STAIRS = (new BlockStairs(67, COBBLESTONE, 0)).c("stairsStone");
+ public static final Block WALL_SIGN = (new BlockSign(68, TileEntitySign.class, false)).c(1.0F).a(g).c("sign").D();
+ public static final Block LEVER = (new BlockLever(69)).c(0.5F).a(g).c("lever");
+ public static final Block STONE_PLATE = (new BlockPressurePlateBinary(70, "stone", Material.STONE, EnumMobType.MOBS)).c(0.5F).a(j).c("pressurePlate");
+ public static final Block IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(k).c("doorIron").D();
+ public static final Block WOOD_PLATE = (new BlockPressurePlateBinary(72, "wood", Material.WOOD, EnumMobType.EVERYTHING)).c(0.5F).a(g).c("pressurePlate");
+ public static final Block REDSTONE_ORE = (new BlockRedstoneOre(73, false)).c(3.0F).b(5.0F).a(j).c("oreRedstone").a(CreativeModeTab.b);
+ public static final Block GLOWING_REDSTONE_ORE = (new BlockRedstoneOre(74, true)).a(0.625F).c(3.0F).b(5.0F).a(j).c("oreRedstone");
+ public static final Block REDSTONE_TORCH_OFF = (new BlockRedstoneTorch(75, false)).c(0.0F).a(g).c("notGate");
+ public static final Block REDSTONE_TORCH_ON = (new BlockRedstoneTorch(76, true)).c(0.0F).a(0.5F).a(g).c("notGate").a(CreativeModeTab.d);
+ public static final Block STONE_BUTTON = (new BlockStoneButton(77)).c(0.5F).a(j).c("button");
+ public static final Block SNOW = (new BlockSnow(78)).c(0.1F).a(o).c("snow").k(0);
+ public static final Block ICE = (new BlockIce(79)).c(0.5F).k(3).a(l).c("ice");
+ public static final Block SNOW_BLOCK = (new BlockSnowBlock(80)).c(0.2F).a(o).c("snow");
+ public static final Block CACTUS = (new BlockCactus(81)).c(0.4F).a(m).c("cactus");
+ public static final Block CLAY = (new BlockClay(82)).c(0.6F).a(h).c("clay");
+ public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83)).c(0.0F).a(i).c("reeds").D();
+ public static final Block JUKEBOX = (new BlockJukeBox(84)).c(2.0F).b(10.0F).a(j).c("jukebox");
+ public static final Block FENCE = (new BlockFence(85, "wood", Material.WOOD)).c(2.0F).b(5.0F).a(g).c("fence");
+ public static final Block PUMPKIN = (new BlockPumpkin(86, false)).c(1.0F).a(g).c("pumpkin");
+ public static final Block NETHERRACK = (new BlockBloodStone(87)).c(0.4F).a(j).c("hellrock");
+ public static final Block SOUL_SAND = (new BlockSlowSand(88)).c(0.5F).a(n).c("hellsand");
+ public static final Block GLOWSTONE = (new BlockLightStone(89, Material.SHATTERABLE)).c(0.3F).a(l).a(1.0F).c("lightgem");
+ public static final BlockPortal PORTAL = (BlockPortal) (new BlockPortal(90)).c(-1.0F).a(l).a(0.75F).c("portal");
+ public static final Block JACK_O_LANTERN = (new BlockPumpkin(91, true)).c(1.0F).a(g).a(1.0F).c("litpumpkin");
+ public static final Block CAKE_BLOCK = (new BlockCake(92)).c(0.5F).a(m).c("cake").D();
+ public static final BlockRepeater DIODE_OFF = (BlockRepeater) (new BlockRepeater(93, false)).c(0.0F).a(g).c("diode").D();
+ public static final BlockRepeater DIODE_ON = (BlockRepeater) (new BlockRepeater(94, true)).c(0.0F).a(0.625F).a(g).c("diode").D();
+ public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(g).c("lockedchest").b(true);
+ public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(g).c("trapdoor").D();
+ public static final Block MONSTER_EGGS = (new BlockMonsterEggs(97)).c(0.75F).c("monsterStoneEgg");
+ public static final Block SMOOTH_BRICK = (new BlockSmoothBrick(98)).c(1.5F).b(10.0F).a(j).c("stonebricksmooth");
+ public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 0)).c(0.2F).a(g).c("mushroom");
+ public static final Block BIG_MUSHROOM_2 = (new BlockHugeMushroom(100, Material.WOOD, 1)).c(0.2F).a(g).c("mushroom");
+ public static final Block IRON_FENCE = (new BlockThinFence(101, "fenceIron", "fenceIron", Material.ORE, true)).c(5.0F).b(10.0F).a(k).c("fenceIron");
+ public static final Block THIN_GLASS = (new BlockThinFence(102, "glass", "thinglass_top", Material.SHATTERABLE, false)).c(0.3F).a(l).c("thinGlass");
+ public static final Block MELON = (new BlockMelon(103)).c(1.0F).a(g).c("melon");
+ public static final Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(g).c("pumpkinStem");
+ public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(g).c("pumpkinStem");
+ public static final Block VINE = (new BlockVine(106)).c(0.2F).a(i).c("vine");
+ public static final Block FENCE_GATE = (new BlockFenceGate(107)).c(2.0F).b(5.0F).a(g).c("fenceGate");
+ public static final Block BRICK_STAIRS = (new BlockStairs(108, BRICK, 0)).c("stairsBrick");
+ public static final Block STONE_STAIRS = (new BlockStairs(109, SMOOTH_BRICK, 0)).c("stairsStoneBrickSmooth");
+ public static final BlockMycel MYCEL = (BlockMycel) (new BlockMycel(110)).c(0.6F).a(i).c("mycel");
+ public static final Block WATER_LILY = (new BlockWaterLily(111)).c(0.0F).a(i).c("waterlily");
+ public static final Block NETHER_BRICK = (new Block(112, Material.STONE)).c(2.0F).b(10.0F).a(j).c("netherBrick").a(CreativeModeTab.b);
+ public static final Block NETHER_FENCE = (new BlockFence(113, "netherBrick", Material.STONE)).c(2.0F).b(10.0F).a(j).c("netherFence");
+ public static final Block NETHER_BRICK_STAIRS = (new BlockStairs(114, NETHER_BRICK, 0)).c("stairsNetherBrick");
+ public static final Block NETHER_WART = (new BlockNetherWart(115)).c("netherStalk");
+ public static final Block ENCHANTMENT_TABLE = (new BlockEnchantmentTable(116)).c(5.0F).b(2000.0F).c("enchantmentTable");
+ public static final Block BREWING_STAND = (new BlockBrewingStand(117)).c(0.5F).a(0.125F).c("brewingStand");
+ public static final BlockCauldron CAULDRON = (BlockCauldron) (new BlockCauldron(118)).c(2.0F).c("cauldron");
public static final Block ENDER_PORTAL = (new BlockEnderPortal(119, Material.PORTAL)).c(-1.0F).b(6000000.0F);
- public static final Block ENDER_PORTAL_FRAME = (new BlockEnderPortalFrame(120)).a(j).a(0.125F).c(-1.0F).b("endPortalFrame").r().b(6000000.0F).a(CreativeModeTab.c);
- public static final Block WHITESTONE = (new Block(121, 175, Material.STONE)).c(3.0F).b(15.0F).a(h).b("whiteStone").a(CreativeModeTab.b);
- public static final Block DRAGON_EGG = (new BlockDragonEgg(122, 167)).c(3.0F).b(15.0F).a(h).a(0.125F).b("dragonEgg");
- public static final Block REDSTONE_LAMP_OFF = (new BlockRedstoneLamp(123, false)).c(0.3F).a(j).b("redstoneLight").a(CreativeModeTab.d);
- public static final Block REDSTONE_LAMP_ON = (new BlockRedstoneLamp(124, true)).c(0.3F).a(j).b("redstoneLight");
- public static final BlockStepAbstract WOOD_DOUBLE_STEP = (BlockStepAbstract) (new BlockWoodStep(125, true)).c(2.0F).b(5.0F).a(e).b("woodSlab");
- public static final BlockStepAbstract WOOD_STEP = (BlockStepAbstract) (new BlockWoodStep(126, false)).c(2.0F).b(5.0F).a(e).b("woodSlab");
- public static final Block COCOA = (new BlockCocoa(127)).c(0.2F).b(5.0F).a(e).b("cocoa").r();
- public static final Block SANDSTONE_STAIRS = (new BlockStairs(128, SANDSTONE, 0)).b("stairsSandStone").r();
- public static final Block EMERALD_ORE = (new BlockOre(129, 171)).c(3.0F).b(5.0F).a(h).b("oreEmerald");
- public static final Block ENDER_CHEST = (new BlockEnderChest(130)).c(22.5F).b(1000.0F).a(h).b("enderChest").r().a(0.5F);
- public static final BlockTripwireHook TRIPWIRE_SOURCE = (BlockTripwireHook) (new BlockTripwireHook(131)).b("tripWireSource").r();
- public static final Block TRIPWIRE = (new BlockTripwire(132)).b("tripWire").r();
- public static final Block EMERALD_BLOCK = (new BlockOreBlock(133, 25)).c(5.0F).b(10.0F).a(i).b("blockEmerald");
- public static final Block SPRUCE_WOOD_STAIRS = (new BlockStairs(134, WOOD, 1)).b("stairsWoodSpruce").r();
- public static final Block BIRCH_WOOD_STAIRS = (new BlockStairs(135, WOOD, 2)).b("stairsWoodBirch").r();
- public static final Block JUNGLE_WOOD_STAIRS = (new BlockStairs(136, WOOD, 3)).b("stairsWoodJungle").r();
- public static final Block COMMAND = (new BlockCommand(137)).b("commandBlock");
- public static final Block BEACON = (new BlockBeacon(138)).b("beacon").a(1.0F);
- public static final Block COBBLE_WALL = (new BlockCobbleWall(139, COBBLESTONE)).b("cobbleWall");
- public static final Block FLOWER_POT = (new BlockFlowerPot(140)).c(0.0F).a(d).b("flowerPot");
- public static final Block CARROTS = (new BlockCarrots(141)).b("carrots");
- public static final Block POTATOES = (new BlockPotatoes(142)).b("potatoes");
- public static final Block WOOD_BUTTON = (new BlockButton(143, WOOD.textureId, true)).c(0.5F).a(e).b("button").r();
- public static final Block SKULL = (new BlockSkull(144)).c(1.0F).a(h).b("skull").r();
- public static final Block ANVIL = (new BlockAnvil(145)).c(5.0F).a(o).b(2000.0F).b("anvil").r();
- public int textureId;
+ public static final Block ENDER_PORTAL_FRAME = (new BlockEnderPortalFrame(120)).a(l).a(0.125F).c(-1.0F).c("endPortalFrame").b(6000000.0F).a(CreativeModeTab.c);
+ public static final Block WHITESTONE = (new Block(121, Material.STONE)).c(3.0F).b(15.0F).a(j).c("whiteStone").a(CreativeModeTab.b);
+ public static final Block DRAGON_EGG = (new BlockDragonEgg(122)).c(3.0F).b(15.0F).a(j).a(0.125F).c("dragonEgg");
+ public static final Block REDSTONE_LAMP_OFF = (new BlockRedstoneLamp(123, false)).c(0.3F).a(l).c("redstoneLight").a(CreativeModeTab.d);
+ public static final Block REDSTONE_LAMP_ON = (new BlockRedstoneLamp(124, true)).c(0.3F).a(l).c("redstoneLight");
+ public static final BlockStepAbstract WOOD_DOUBLE_STEP = (BlockStepAbstract) (new BlockWoodStep(125, true)).c(2.0F).b(5.0F).a(g).c("woodSlab");
+ public static final BlockStepAbstract WOOD_STEP = (BlockStepAbstract) (new BlockWoodStep(126, false)).c(2.0F).b(5.0F).a(g).c("woodSlab");
+ public static final Block COCOA = (new BlockCocoa(127)).c(0.2F).b(5.0F).a(g).c("cocoa");
+ public static final Block SANDSTONE_STAIRS = (new BlockStairs(128, SANDSTONE, 0)).c("stairsSandStone");
+ public static final Block EMERALD_ORE = (new BlockOre(129)).c(3.0F).b(5.0F).a(j).c("oreEmerald");
+ public static final Block ENDER_CHEST = (new BlockEnderChest(130)).c(22.5F).b(1000.0F).a(j).c("enderChest").a(0.5F);
+ public static final BlockTripwireHook TRIPWIRE_SOURCE = (BlockTripwireHook) (new BlockTripwireHook(131)).c("tripWireSource");
+ public static final Block TRIPWIRE = (new BlockTripwire(132)).c("tripWire");
+ public static final Block EMERALD_BLOCK = (new BlockOreBlock(133)).c(5.0F).b(10.0F).a(k).c("blockEmerald");
+ public static final Block SPRUCE_WOOD_STAIRS = (new BlockStairs(134, WOOD, 1)).c("stairsWoodSpruce");
+ public static final Block BIRCH_WOOD_STAIRS = (new BlockStairs(135, WOOD, 2)).c("stairsWoodBirch");
+ public static final Block JUNGLE_WOOD_STAIRS = (new BlockStairs(136, WOOD, 3)).c("stairsWoodJungle");
+ public static final Block COMMAND = (new BlockCommand(137)).c("commandBlock");
+ public static final BlockBeacon BEACON = (BlockBeacon) (new BlockBeacon(138)).c("beacon").a(1.0F);
+ public static final Block COBBLE_WALL = (new BlockCobbleWall(139, COBBLESTONE)).c("cobbleWall");
+ public static final Block FLOWER_POT = (new BlockFlowerPot(140)).c(0.0F).a(f).c("flowerPot");
+ public static final Block CARROTS = (new BlockCarrots(141)).c("carrots");
+ public static final Block POTATOES = (new BlockPotatoes(142)).c("potatoes");
+ public static final Block WOOD_BUTTON = (new BlockWoodButton(143)).c(0.5F).a(g).c("button");
+ public static final Block SKULL = (new BlockSkull(144)).c(1.0F).a(j).c("skull");
+ public static final Block ANVIL = (new BlockAnvil(145)).c(5.0F).a(q).b(2000.0F).c("anvil");
+ public static final Block TRAPPED_CHEST = (new BlockChest(146, 1)).c(2.5F).a(g).c("chestTrap");
+ public static final Block GOLD_PLATE = (new BlockPressurePlateWeighted(147, "blockGold", Material.ORE, 64)).c(0.5F).a(g).c("weightedPlate_light");
+ public static final Block IRON_PLATE = (new BlockPressurePlateWeighted(148, "blockIron", Material.ORE, 640)).c(0.5F).a(g).c("weightedPlate_heavy");
+ public static final BlockRedstoneComparator REDSTONE_COMPARATOR_OFF = (BlockRedstoneComparator) (new BlockRedstoneComparator(149, false)).c(0.0F).a(g).c("comparator").D();
+ public static final BlockRedstoneComparator REDSTONE_COMPARATOR_ON = (BlockRedstoneComparator) (new BlockRedstoneComparator(150, true)).c(0.0F).a(0.625F).a(g).c("comparator").D();
+ public static final BlockDaylightDetector DAYLIGHT_DETECTOR = (BlockDaylightDetector) (new BlockDaylightDetector(151)).c(0.2F).a(g).c("daylightDetector");
+ public static final Block REDSTONE_BLOCK = (new BlockRedstone(152)).c(5.0F).b(10.0F).a(k).c("blockRedstone");
+ public static final Block QUARTZ_ORE = (new BlockOre(153)).c(3.0F).b(5.0F).a(j).c("netherquartz");
+ public static final BlockHopper HOPPER = (BlockHopper) (new BlockHopper(154)).c(3.0F).b(8.0F).a(g).c("hopper");
+ public static final Block QUARTZ_BLOCK = (new BlockQuartz(155)).a(j).c(0.8F).c("quartzBlock");
+ public static final Block QUARTZ_STAIRS = (new BlockStairs(156, QUARTZ_BLOCK, 0)).c("stairsQuartz");
+ public static final Block ACTIVATOR_RAIL = (new BlockPoweredRail(157)).c(0.7F).a(k).c("activatorRail");
+ public static final Block DROPPER = (new BlockDropper(158)).c(3.5F).a(j).c("dropper");
public final int id;
protected float strength;
protected float durability;
- protected boolean cp;
- protected boolean cq;
- protected boolean cr;
+ protected boolean cC = true;
+ protected boolean cD = true;
+ protected boolean cE;
protected boolean isTileEntity;
protected double minX;
protected double minY;
@@ -185,16 +196,14 @@ public class Block {
protected double maxY;
protected double maxZ;
public StepSound stepSound;
- public float cA;
+ public float cN;
public final Material material;
public float frictionFactor;
private String name;
protected Block(int i, Material material) {
- this.cp = true;
- this.cq = true;
- this.stepSound = d;
- this.cA = 1.0F;
+ this.stepSound = f;
+ this.cN = 1.0F;
this.frictionFactor = 0.6F;
if (byId[i] != null) {
throw new IllegalArgumentException("Slot " + i + " is already occupied by " + byId[i] + " when adding " + this);
@@ -203,30 +212,20 @@ public class Block {
byId[i] = this;
this.id = i;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
- q[i] = this.c();
+ s[i] = this.c();
lightBlock[i] = this.c() ? 255 : 0;
- s[i] = !material.blocksLight();
+ u[i] = !material.blocksLight();
}
}
- protected Block r() {
- u[this.id] = true;
- return this;
- }
-
- protected void t_() {}
-
- protected Block(int i, int j, Material material) {
- this(i, material);
- this.textureId = j;
- }
+ protected void s_() {}
protected Block a(StepSound stepsound) {
this.stepSound = stepsound;
return this;
}
- protected Block h(int i) {
+ protected Block k(int i) {
lightBlock[this.id] = i;
return this;
}
@@ -241,17 +240,17 @@ public class Block {
return this;
}
- public static boolean i(int i) {
+ public static boolean l(int i) {
Block block = byId[i];
- return block == null ? false : block.material.k() && block.b();
+ return block == null ? false : block.material.k() && block.b() && !block.isPowerSource();
}
public boolean b() {
return true;
}
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
+ public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return !this.material.isSolid();
}
@@ -268,25 +267,25 @@ public class Block {
return this;
}
- protected Block s() {
+ protected Block r() {
this.c(-1.0F);
return this;
}
- public float m(World world, int i, int j, int k) {
+ public float l(World world, int i, int j, int k) {
return this.strength;
}
protected Block b(boolean flag) {
- this.cr = flag;
+ this.cE = flag;
return this;
}
public boolean isTicking() {
- return this.cr;
+ return this.cE;
}
- public boolean u() {
+ public boolean t() {
return this.isTileEntity;
}
@@ -303,23 +302,15 @@ public class Block {
return iblockaccess.getMaterial(i, j, k).isBuildable();
}
- public int a(int i, int j) {
- return this.a(i);
- }
-
- public int a(int i) {
- return this.textureId;
- }
-
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) {
- AxisAlignedBB axisalignedbb1 = this.e(world, i, j, k);
+ AxisAlignedBB axisalignedbb1 = this.b(world, i, j, k);
if (axisalignedbb1 != null && axisalignedbb.a(axisalignedbb1)) {
list.add(axisalignedbb1);
}
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
return AxisAlignedBB.a().a((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) j + this.maxY, (double) k + this.maxZ);
}
@@ -335,13 +326,13 @@ public class Block {
return true;
}
- public void b(World world, int i, int j, int k, Random random) {}
+ public void a(World world, int i, int j, int k, Random random) {}
public void postBreak(World world, int i, int j, int k, int l) {}
public void doPhysics(World world, int i, int j, int k, int l) {}
- public int r_() {
+ public int a(World world) {
return 10;
}
@@ -358,9 +349,9 @@ public class Block {
}
public float getDamage(EntityHuman entityhuman, World world, int i, int j, int k) {
- float f = this.m(world, i, j, k);
+ float f = this.l(world, i, j, k);
- return f < 0.0F ? 0.0F : (!entityhuman.b(this) ? 1.0F / f / 100.0F : entityhuman.a(this) / f / 30.0F);
+ return f < 0.0F ? 0.0F : (!entityhuman.a(this) ? entityhuman.a(this, false) / f / 100.0F : entityhuman.a(this, true) / f / 30.0F);
}
public final void c(World world, int i, int j, int k, int l, int i1) {
@@ -397,7 +388,7 @@ public class Block {
}
}
- protected void f(World world, int i, int j, int k, int l) {
+ protected void j(World world, int i, int j, int k, int l) {
if (!world.isStatic) {
while (l > 0) {
int i1 = EntityExperienceOrb.getOrbValue(l);
@@ -522,7 +513,11 @@ public class Block {
return vec3d == null ? false : vec3d.c >= this.minX && vec3d.c <= this.maxX && vec3d.d >= this.minY && vec3d.d <= this.maxY;
}
- public void wasExploded(World world, int i, int j, int k) {}
+ public void wasExploded(World world, int i, int j, int k, Explosion explosion) {}
+
+ public boolean canPlace(World world, int i, int j, int k, int l, ItemStack itemstack) {
+ return this.canPlace(world, i, j, k, l);
+ }
public boolean canPlace(World world, int i, int j, int k, int l) {
return this.canPlace(world, i, j, k);
@@ -550,32 +545,32 @@ public class Block {
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {}
- public final double v() {
+ public final double u() {
return this.minX;
}
- public final double w() {
+ public final double v() {
return this.maxX;
}
- public final double x() {
+ public final double w() {
return this.minY;
}
- public final double y() {
+ public final double x() {
return this.maxY;
}
- public final double z() {
+ public final double y() {
return this.minZ;
}
- public final double A() {
+ public final double z() {
return this.maxZ;
}
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- return false;
+ public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ return 0;
}
public boolean isPowerSource() {
@@ -584,17 +579,17 @@ public class Block {
public void a(World world, int i, int j, int k, Entity entity) {}
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- return false;
+ public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ return 0;
}
- public void f() {}
+ public void g() {}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
entityhuman.a(StatisticList.C[this.id], 1);
entityhuman.j(0.025F);
- if (this.s_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
- ItemStack itemstack = this.f_(l);
+ if (this.r_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
+ ItemStack itemstack = this.c_(l);
if (itemstack != null) {
this.b(world, i, j, k, itemstack);
@@ -606,14 +601,14 @@ public class Block {
}
}
- protected boolean s_() {
+ protected boolean r_() {
return this.b() && !this.isTileEntity;
}
- protected ItemStack f_(int i) {
+ protected ItemStack c_(int i) {
int j = 0;
- if (this.id >= 0 && this.id < Item.byId.length && Item.byId[this.id].l()) {
+ if (this.id >= 0 && this.id < Item.byId.length && Item.byId[this.id].m()) {
j = i;
}
@@ -624,16 +619,16 @@ public class Block {
return this.a(random);
}
- public boolean d(World world, int i, int j, int k) {
+ public boolean f(World world, int i, int j, int k) {
return true;
}
- public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {}
+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {}
public void postPlace(World world, int i, int j, int k, int l) {}
- public Block b(String s) {
- this.name = "tile." + s;
+ public Block c(String s) {
+ this.name = s;
return this;
}
@@ -642,21 +637,23 @@ public class Block {
}
public String a() {
- return this.name;
+ return "tile." + this.name;
}
- public void b(World world, int i, int j, int k, int l, int i1) {}
+ public boolean b(World world, int i, int j, int k, int l, int i1) {
+ return false;
+ }
public boolean C() {
- return this.cq;
+ return this.cD;
}
protected Block D() {
- this.cq = false;
+ this.cD = false;
return this;
}
- public int q_() {
+ public int h() {
return this.material.getPushReaction();
}
@@ -673,9 +670,9 @@ public class Block {
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {}
- public void h(World world, int i, int j, int k, int l) {}
+ public void l(World world, int i, int j, int k, int l) {}
- public void f(World world, int i, int j, int k) {}
+ public void g(World world, int i, int j, int k) {}
public boolean l() {
return true;
@@ -685,6 +682,22 @@ public class Block {
return true;
}
+ public boolean i(int i) {
+ return this.id == i;
+ }
+
+ public static boolean b(int i, int j) {
+ return i == j ? true : (i != 0 && j != 0 && byId[i] != null && byId[j] != null ? byId[i].i(j) : false);
+ }
+
+ public boolean q_() {
+ return false;
+ }
+
+ public int b_(World world, int i, int j, int k, int l) {
+ return 0;
+ }
+
static {
Item.byId[WOOL.id] = (new ItemCloth(WOOL.id - 256)).b("cloth");
Item.byId[LOG.id] = (new ItemMultiTexture(LOG.id - 256, LOG, BlockLog.a)).b("log");
@@ -692,6 +705,7 @@ public class Block {
Item.byId[MONSTER_EGGS.id] = (new ItemMultiTexture(MONSTER_EGGS.id - 256, MONSTER_EGGS, BlockMonsterEggs.a)).b("monsterStoneEgg");
Item.byId[SMOOTH_BRICK.id] = (new ItemMultiTexture(SMOOTH_BRICK.id - 256, SMOOTH_BRICK, BlockSmoothBrick.a)).b("stonebricksmooth");
Item.byId[SANDSTONE.id] = (new ItemMultiTexture(SANDSTONE.id - 256, SANDSTONE, BlockSandStone.a)).b("sandStone");
+ Item.byId[QUARTZ_BLOCK.id] = (new ItemMultiTexture(QUARTZ_BLOCK.id - 256, QUARTZ_BLOCK, BlockQuartz.a)).b("quartzBlock");
Item.byId[STEP.id] = (new ItemStep(STEP.id - 256, STEP, DOUBLE_STEP, false)).b("stoneSlab");
Item.byId[DOUBLE_STEP.id] = (new ItemStep(DOUBLE_STEP.id - 256, STEP, DOUBLE_STEP, true)).b("stoneSlab");
Item.byId[WOOD_STEP.id] = (new ItemStep(WOOD_STEP.id - 256, WOOD_STEP, WOOD_DOUBLE_STEP, false)).b("woodSlab");
@@ -700,6 +714,7 @@ public class Block {
Item.byId[LEAVES.id] = (new ItemLeaves(LEAVES.id - 256)).b("leaves");
Item.byId[VINE.id] = new ItemWithAuxData(VINE.id - 256, false);
Item.byId[LONG_GRASS.id] = (new ItemWithAuxData(LONG_GRASS.id - 256, true)).a(new String[] { "shrub", "grass", "fern"});
+ Item.byId[SNOW.id] = new ItemSnow(SNOW.id - 256, SNOW);
Item.byId[WATER_LILY.id] = new ItemWaterLily(WATER_LILY.id - 256);
Item.byId[PISTON.id] = new ItemPiston(PISTON.id - 256);
Item.byId[PISTON_STICKY.id] = new ItemPiston(PISTON_STICKY.id - 256);
@@ -715,7 +730,7 @@ public class Block {
if (byId[i] != null) {
if (Item.byId[i] == null) {
Item.byId[i] = new ItemBlock(i - 256);
- byId[i].t_();
+ byId[i].s_();
}
boolean flag = false;
@@ -732,7 +747,7 @@ public class Block {
flag = true;
}
- if (s[i]) {
+ if (u[i]) {
flag = true;
}
@@ -740,11 +755,11 @@ public class Block {
flag = true;
}
- v[i] = flag;
+ w[i] = flag;
}
}
- s[0] = true;
+ u[0] = true;
StatisticList.b();
}
diff --git a/src/main/java/net/minecraft/server/BlockBloodStone.java b/src/main/java/net/minecraft/server/BlockBloodStone.java
index fb891933..91be87e1 100644
--- a/src/main/java/net/minecraft/server/BlockBloodStone.java
+++ b/src/main/java/net/minecraft/server/BlockBloodStone.java
@@ -4,8 +4,8 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockBloodStone extends Block {
- public BlockBloodStone(int i, int j) {
- super(i, j, Material.STONE);
+ public BlockBloodStone(int i) {
+ super(i, Material.STONE);
this.a(CreativeModeTab.b);
}
diff --git a/src/main/java/net/minecraft/server/BlockButton.java b/src/main/java/net/minecraft/server/BlockButtonAbstract.java
index ab8bc44f..b8f62e5b 100644
--- a/src/main/java/net/minecraft/server/BlockButton.java
+++ b/src/main/java/net/minecraft/server/BlockButtonAbstract.java
@@ -8,22 +8,22 @@ import org.bukkit.event.block.BlockRedstoneEvent;
import org.bukkit.event.entity.EntityInteractEvent;
// CraftBukkit end
-public class BlockButton extends Block {
+public abstract class BlockButtonAbstract extends Block {
private final boolean a;
- protected BlockButton(int i, int j, boolean flag) {
- super(i, j, Material.ORIENTABLE);
+ protected BlockButtonAbstract(int i, boolean flag) {
+ super(i, Material.ORIENTABLE);
this.b(true);
this.a(CreativeModeTab.d);
this.a = flag;
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
- public int r_() {
+ public int a(World world) {
return this.a ? 30 : 20;
}
@@ -36,11 +36,11 @@ public class BlockButton extends Block {
}
public boolean canPlace(World world, int i, int j, int k, int l) {
- return l == 2 && world.t(i, j, k + 1) ? true : (l == 3 && world.t(i, j, k - 1) ? true : (l == 4 && world.t(i + 1, j, k) ? true : l == 5 && world.t(i - 1, j, k)));
+ return l == 2 && world.u(i, j, k + 1) ? true : (l == 3 && world.u(i, j, k - 1) ? true : (l == 4 && world.u(i + 1, j, k) ? true : l == 5 && world.u(i - 1, j, k)));
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.t(i - 1, j, k) ? true : (world.t(i + 1, j, k) ? true : (world.t(i, j, k - 1) ? true : world.t(i, j, k + 1)));
+ return world.u(i - 1, j, k) ? true : (world.u(i + 1, j, k) ? true : (world.u(i, j, k - 1) ? true : world.u(i, j, k + 1)));
}
public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
@@ -48,57 +48,57 @@ public class BlockButton extends Block {
int k1 = j1 & 8;
j1 &= 7;
- if (l == 2 && world.t(i, j, k + 1)) {
+ if (l == 2 && world.u(i, j, k + 1)) {
j1 = 4;
- } else if (l == 3 && world.t(i, j, k - 1)) {
+ } else if (l == 3 && world.u(i, j, k - 1)) {
j1 = 3;
- } else if (l == 4 && world.t(i + 1, j, k)) {
+ } else if (l == 4 && world.u(i + 1, j, k)) {
j1 = 2;
- } else if (l == 5 && world.t(i - 1, j, k)) {
+ } else if (l == 5 && world.u(i - 1, j, k)) {
j1 = 1;
} else {
- j1 = this.l(world, i, j, k);
+ j1 = this.k(world, i, j, k);
}
return j1 + k1;
}
- private int l(World world, int i, int j, int k) {
- return world.t(i - 1, j, k) ? 1 : (world.t(i + 1, j, k) ? 2 : (world.t(i, j, k - 1) ? 3 : (world.t(i, j, k + 1) ? 4 : 1)));
+ private int k(World world, int i, int j, int k) {
+ return world.u(i - 1, j, k) ? 1 : (world.u(i + 1, j, k) ? 2 : (world.u(i, j, k - 1) ? 3 : (world.u(i, j, k + 1) ? 4 : 1)));
}
public void doPhysics(World world, int i, int j, int k, int l) {
- if (this.n(world, i, j, k)) {
+ if (this.m(world, i, j, k)) {
int i1 = world.getData(i, j, k) & 7;
boolean flag = false;
- if (!world.t(i - 1, j, k) && i1 == 1) {
+ if (!world.u(i - 1, j, k) && i1 == 1) {
flag = true;
}
- if (!world.t(i + 1, j, k) && i1 == 2) {
+ if (!world.u(i + 1, j, k) && i1 == 2) {
flag = true;
}
- if (!world.t(i, j, k - 1) && i1 == 3) {
+ if (!world.u(i, j, k - 1) && i1 == 3) {
flag = true;
}
- if (!world.t(i, j, k + 1) && i1 == 4) {
+ if (!world.u(i, j, k + 1) && i1 == 4) {
flag = true;
}
if (flag) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
}
}
}
- private boolean n(World world, int i, int j, int k) {
+ private boolean m(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
return false;
} else {
return true;
@@ -108,10 +108,10 @@ public class BlockButton extends Block {
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
- this.e(l);
+ this.d(l);
}
- private void e(int i) {
+ private void d(int i) {
int j = i & 7;
boolean flag = (i & 8) > 0;
float f = 0.375F;
@@ -146,8 +146,8 @@ public class BlockButton extends Block {
} else {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
- int old = (k1 != 8) ? 1 : 0;
- int current = (k1 == 8) ? 1 : 0;
+ int old = (k1 != 8) ? 15 : 0;
+ int current = (k1 == 8) ? 15 : 0;
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
world.getServer().getPluginManager().callEvent(eventRedstone);
@@ -157,11 +157,11 @@ public class BlockButton extends Block {
}
// CraftBukkit end
- world.setData(i, j, k, j1 + k1);
- world.e(i, j, k, i, j, k);
+ world.setData(i, j, k, j1 + k1, 3);
+ world.g(i, j, k, i, j, k);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
this.d(world, i, j, k, j1);
- world.a(i, j, k, this.id, this.r_());
+ world.a(i, j, k, this.id, this.a(world));
return true;
}
}
@@ -176,19 +176,19 @@ public class BlockButton extends Block {
super.remove(world, i, j, k, l, i1);
}
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- return (iblockaccess.getData(i, j, k) & 8) > 0;
+ public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ return (iblockaccess.getData(i, j, k) & 8) > 0 ? 15 : 0;
}
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
int i1 = iblockaccess.getData(i, j, k);
if ((i1 & 8) == 0) {
- return false;
+ return 0;
} else {
int j1 = i1 & 7;
- return j1 == 5 && l == 1 ? true : (j1 == 4 && l == 2 ? true : (j1 == 3 && l == 3 ? true : (j1 == 2 && l == 4 ? true : j1 == 1 && l == 5)));
+ return j1 == 5 && l == 1 ? 15 : (j1 == 4 && l == 2 ? 15 : (j1 == 3 && l == 3 ? 15 : (j1 == 2 && l == 4 ? 15 : (j1 == 1 && l == 5 ? 15 : 0))));
}
}
@@ -196,7 +196,7 @@ public class BlockButton extends Block {
return true;
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
int l = world.getData(i, j, k);
@@ -204,7 +204,7 @@ public class BlockButton extends Block {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
- BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 1, 0);
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
world.getServer().getPluginManager().callEvent(eventRedstone);
if (eventRedstone.getNewCurrent() > 0) {
@@ -213,20 +213,20 @@ public class BlockButton extends Block {
// CraftBukkit end
if (this.a) {
- this.o(world, i, j, k);
+ this.n(world, i, j, k);
} else {
- world.setData(i, j, k, l & 7);
+ world.setData(i, j, k, l & 7, 3);
int i1 = l & 7;
this.d(world, i, j, k, i1);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
- world.e(i, j, k, i, j, k);
+ world.g(i, j, k, i, j, k);
}
}
}
}
- public void f() {
+ public void g() {
float f = 0.1875F;
float f1 = 0.125F;
float f2 = 0.125F;
@@ -246,37 +246,38 @@ public class BlockButton extends Block {
return;
}
// CraftBukkit end
- this.o(world, i, j, k);
+
+ this.n(world, i, j, k);
}
}
}
}
- private void o(World world, int i, int j, int k) {
+ private void n(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
int i1 = l & 7;
boolean flag = (l & 8) != 0;
- this.e(l);
+ this.d(l);
List list = world.a(EntityArrow.class, AxisAlignedBB.a().a((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) j + this.maxY, (double) k + this.maxZ));
boolean flag1 = !list.isEmpty();
if (flag1 && !flag) {
- world.setData(i, j, k, i1 | 8);
+ world.setData(i, j, k, i1 | 8, 3);
this.d(world, i, j, k, i1);
- world.e(i, j, k, i, j, k);
+ world.g(i, j, k, i, j, k);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
}
if (!flag1 && flag) {
- world.setData(i, j, k, i1);
+ world.setData(i, j, k, i1, 3);
this.d(world, i, j, k, i1);
- world.e(i, j, k, i, j, k);
+ world.g(i, j, k, i, j, k);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
}
if (flag1) {
- world.a(i, j, k, this.id, this.r_());
+ world.a(i, j, k, this.id, this.a(world));
}
}
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java
index dd680201..83cc09da 100644
--- a/src/main/java/net/minecraft/server/BlockCactus.java
+++ b/src/main/java/net/minecraft/server/BlockCactus.java
@@ -6,13 +6,13 @@ import org.bukkit.event.entity.EntityDamageByBlockEvent; // CraftBukkit
public class BlockCactus extends Block {
- protected BlockCactus(int i, int j) {
- super(i, j, Material.CACTUS);
+ protected BlockCactus(int i) {
+ super(i, Material.CACTUS);
this.b(true);
this.a(CreativeModeTab.c);
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
if (world.isEmpty(i, j + 1, k)) {
int l;
@@ -25,24 +25,21 @@ public class BlockCactus extends Block {
if (i1 == 15) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit
- world.setData(i, j, k, 0);
+ world.setData(i, j, k, 0, 4);
+ this.doPhysics(world, i, j + 1, k, this.id);
} else {
- world.setData(i, j, k, i1 + 1);
+ world.setData(i, j, k, i1 + 1, 4);
}
}
}
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
float f = 0.0625F;
return AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f));
}
- public int a(int i) {
- return i == 1 ? this.textureId - 1 : (i == 0 ? this.textureId + 1 : this.textureId);
- }
-
public boolean b() {
return false;
}
@@ -56,17 +53,16 @@ public class BlockCactus extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
- return !super.canPlace(world, i, j, k) ? false : this.d(world, i, j, k);
+ return !super.canPlace(world, i, j, k) ? false : this.f(world, i, j, k);
}
public void doPhysics(World world, int i, int j, int k, int l) {
- if (!this.d(world, i, j, k)) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, 0);
+ if (!this.f(world, i, j, k)) {
+ world.setAir(i, j, k, true);
}
}
- public boolean d(World world, int i, int j, int k) {
+ public boolean f(World world, int i, int j, int k) {
if (world.getMaterial(i - 1, j, k).isBuildable()) {
return false;
} else if (world.getMaterial(i + 1, j, k).isBuildable()) {
diff --git a/src/main/java/net/minecraft/server/BlockCocoa.java b/src/main/java/net/minecraft/server/BlockCocoa.java
index ae97d4ad..b7007d94 100644
--- a/src/main/java/net/minecraft/server/BlockCocoa.java
+++ b/src/main/java/net/minecraft/server/BlockCocoa.java
@@ -4,34 +4,36 @@ import java.util.Random;
public class BlockCocoa extends BlockDirectional {
+ public static final String[] a = new String[] { "cocoa_0", "cocoa_1", "cocoa_2"};
+
public BlockCocoa(int i) {
- super(i, 168, Material.PLANT);
+ super(i, Material.PLANT);
this.b(true);
}
- public void b(World world, int i, int j, int k, Random random) {
- if (!this.d(world, i, j, k)) {
+ public void a(World world, int i, int j, int k, Random random) {
+ if (!this.f(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
} else if (world.random.nextInt(5) == 0) {
int l = world.getData(i, j, k);
int i1 = c(l);
if (i1 < 2) {
++i1;
- org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, i1 << 2 | e(l)); // CraftBukkit
+ org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, i1 << 2 | j(l)); // CraftBukkit
}
}
}
- public boolean d(World world, int i, int j, int k) {
- int l = e(world.getData(i, j, k));
+ public boolean f(World world, int i, int j, int k) {
+ int l = j(world.getData(i, j, k));
i += Direction.a[l];
k += Direction.b[l];
int i1 = world.getTypeId(i, j, k);
- return i1 == Block.LOG.id && BlockLog.e(world.getData(i, j, k)) == 3;
+ return i1 == Block.LOG.id && BlockLog.d(world.getData(i, j, k)) == 3;
}
public int d() {
@@ -46,14 +48,14 @@ public class BlockCocoa extends BlockDirectional {
return false;
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
- return super.e(world, i, j, k);
+ return super.b(world, i, j, k);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
- int i1 = e(l);
+ int i1 = j(l);
int j1 = c(l);
int k1 = 4 + j1 * 2;
int l1 = 5 + j1 * 2;
@@ -77,10 +79,10 @@ public class BlockCocoa extends BlockDirectional {
}
}
- public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
int l = ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3) + 0) % 4;
- world.setData(i, j, k, l);
+ world.setData(i, j, k, l, 2);
}
public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
@@ -92,9 +94,9 @@ public class BlockCocoa extends BlockDirectional {
}
public void doPhysics(World world, int i, int j, int k, int l) {
- if (!this.d(world, i, j, k)) {
+ if (!this.f(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockCommand.java b/src/main/java/net/minecraft/server/BlockCommand.java
index 34f50ca4..c464beb9 100644
--- a/src/main/java/net/minecraft/server/BlockCommand.java
+++ b/src/main/java/net/minecraft/server/BlockCommand.java
@@ -7,10 +7,10 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockCommand extends BlockContainer {
public BlockCommand(int i) {
- super(i, 184, Material.ORE);
+ super(i, Material.ORE);
}
- public TileEntity a(World world) {
+ public TileEntity b(World world) {
return new TileEntityCommand();
}
@@ -22,31 +22,34 @@ public class BlockCommand extends BlockContainer {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
- int old = flag1 ? 1 : 0;
- int current = flag ? 1 : 0;
+ int old = flag1 ? 15 : 0;
+ int current = flag ? 15 : 0;
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
world.getServer().getPluginManager().callEvent(eventRedstone);
// CraftBukkit end
if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) { // CraftBukkit
- world.setRawData(i, j, k, i1 | 1);
- world.a(i, j, k, this.id, this.r_());
+ world.setData(i, j, k, i1 | 1, 4);
+ world.a(i, j, k, this.id, this.a(world));
} else if (!(eventRedstone.getNewCurrent() > 0) && eventRedstone.getOldCurrent() > 0) { // CraftBukkit
- world.setRawData(i, j, k, i1 & -2);
+ world.setData(i, j, k, i1 & -2, 4);
}
}
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
TileEntity tileentity = world.getTileEntity(i, j, k);
if (tileentity != null && tileentity instanceof TileEntityCommand) {
- ((TileEntityCommand) tileentity).a(world);
+ TileEntityCommand tileentitycommand = (TileEntityCommand) tileentity;
+
+ tileentitycommand.a(tileentitycommand.a(world));
+ world.m(i, j, k, this.id);
}
}
- public int r_() {
+ public int a(World world) {
return 1;
}
@@ -59,4 +62,22 @@ public class BlockCommand extends BlockContainer {
return true;
}
+
+ public boolean q_() {
+ return true;
+ }
+
+ public int b_(World world, int i, int j, int k, int l) {
+ TileEntity tileentity = world.getTileEntity(i, j, k);
+
+ return tileentity != null && tileentity instanceof TileEntityCommand ? ((TileEntityCommand) tileentity).d() : 0;
+ }
+
+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
+ TileEntityCommand tileentitycommand = (TileEntityCommand) world.getTileEntity(i, j, k);
+
+ if (itemstack.hasName()) {
+ tileentitycommand.c(itemstack.getName());
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java
index a2ce8f94..14a1c3bd 100644
--- a/src/main/java/net/minecraft/server/BlockCrops.java
+++ b/src/main/java/net/minecraft/server/BlockCrops.java
@@ -4,31 +4,29 @@ import java.util.Random;
public class BlockCrops extends BlockFlower {
- protected BlockCrops(int i, int j) {
- super(i, j);
- this.textureId = j;
+ protected BlockCrops(int i) {
+ super(i);
this.b(true);
float f = 0.5F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
this.a((CreativeModeTab) null);
this.c(0.0F);
- this.a(g);
+ this.a(Block.i); // CraftBukkit - i -> Block.i, decompile error
this.D();
- this.r();
}
- protected boolean d_(int i) {
+ protected boolean f_(int i) {
return i == Block.SOIL.id;
}
- public void b(World world, int i, int j, int k, Random random) {
- super.b(world, i, j, k, random);
+ public void a(World world, int i, int j, int k, Random random) {
+ super.a(world, i, j, k, random);
if (world.getLightLevel(i, j + 1, k) >= 9) {
int l = world.getData(i, j, k);
if (l < 7) {
- float f = this.l(world, i, j, k);
+ float f = this.k(world, i, j, k);
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
@@ -37,11 +35,17 @@ public class BlockCrops extends BlockFlower {
}
}
- public void c_(World world, int i, int j, int k) {
- world.setData(i, j, k, 7);
+ public void e_(World world, int i, int j, int k) {
+ int l = world.getData(i, j, k) + MathHelper.nextInt(world.random, 2, 5);
+
+ if (l > 7) {
+ l = 7;
+ }
+
+ world.setData(i, j, k, l, 2);
}
- private float l(World world, int i, int j, int k) {
+ private float k(World world, int i, int j, int k) {
float f = 1.0F;
int l = world.getTypeId(i, j, k - 1);
int i1 = world.getTypeId(i, j, k + 1);
@@ -82,23 +86,15 @@ public class BlockCrops extends BlockFlower {
return f;
}
- public int a(int i, int j) {
- if (j < 0) {
- j = 7;
- }
-
- return this.textureId + j;
- }
-
public int d() {
return 6;
}
- protected int h() {
+ protected int j() {
return Item.SEEDS.id;
}
- protected int j() {
+ protected int k() {
return Item.WHEAT.id;
}
@@ -110,7 +106,7 @@ public class BlockCrops extends BlockFlower {
for (int k1 = 0; k1 < j1; ++k1) {
if (world.random.nextInt(15) <= l) {
- this.b(world, i, j, k, new ItemStack(this.h(), 1, 0));
+ this.b(world, i, j, k, new ItemStack(this.j(), 1, 0));
}
}
}
@@ -118,7 +114,7 @@ public class BlockCrops extends BlockFlower {
}
public int getDropType(int i, Random random, int j) {
- return i == 7 ? this.j() : this.h();
+ return i == 7 ? this.k() : this.j();
}
public int a(Random random) {
diff --git a/src/main/java/net/minecraft/server/BlockDiode.java b/src/main/java/net/minecraft/server/BlockDiode.java
deleted file mode 100644
index 2e06725d..00000000
--- a/src/main/java/net/minecraft/server/BlockDiode.java
+++ /dev/null
@@ -1,228 +0,0 @@
-package net.minecraft.server;
-
-import java.util.Random;
-
-import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
-
-public class BlockDiode extends BlockDirectional {
-
- public static final double[] a = new double[] { -0.0625D, 0.0625D, 0.1875D, 0.3125D};
- private static final int[] b = new int[] { 1, 2, 3, 4};
- private final boolean c;
-
- protected BlockDiode(int i, boolean flag) {
- super(i, 6, Material.ORIENTABLE);
- this.c = flag;
- this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
- }
-
- public boolean b() {
- return false;
- }
-
- public boolean canPlace(World world, int i, int j, int k) {
- return !world.v(i, j - 1, k) ? false : super.canPlace(world, i, j, k);
- }
-
- public boolean d(World world, int i, int j, int k) {
- return !world.v(i, j - 1, k) ? false : super.d(world, i, j, k);
- }
-
- public void b(World world, int i, int j, int k, Random random) {
- int l = world.getData(i, j, k);
- boolean flag = this.e(world, i, j, k, l);
-
- if (!flag) {
- boolean flag1 = this.i(world, i, j, k, l);
-
- if (this.c && !flag1) {
- // CraftBukkit start
- if (CraftEventFactory.callRedstoneChange(world, i, j, k, 15, 0).getNewCurrent() != 0) {
- return;
- }
- // CraftBukkit end
-
- world.setTypeIdAndData(i, j, k, Block.DIODE_OFF.id, l);
- } else if (!this.c) {
- // CraftBukkit start
- if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() != 15) {
- return;
- }
- // CraftBukkit end
-
- world.setTypeIdAndData(i, j, k, Block.DIODE_ON.id, l);
- if (!flag1) {
- int i1 = (l & 12) >> 2;
-
- world.a(i, j, k, Block.DIODE_ON.id, b[i1] * 2);
- }
- }
- }
- }
-
- public int a(int i, int j) {
- return i == 0 ? (this.c ? 99 : 115) : (i == 1 ? (this.c ? 147 : 131) : 5);
- }
-
- public int d() {
- return 15;
- }
-
- public int a(int i) {
- return this.a(i, 0);
- }
-
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- return this.b(iblockaccess, i, j, k, l);
- }
-
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- if (!this.c) {
- return false;
- } else {
- int i1 = e(iblockaccess.getData(i, j, k));
-
- return i1 == 0 && l == 3 ? true : (i1 == 1 && l == 4 ? true : (i1 == 2 && l == 2 ? true : i1 == 3 && l == 5));
- }
- }
-
- public void doPhysics(World world, int i, int j, int k, int l) {
- if (!this.d(world, i, j, k)) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, 0);
- world.applyPhysics(i + 1, j, k, this.id);
- world.applyPhysics(i - 1, j, k, this.id);
- world.applyPhysics(i, j, k + 1, this.id);
- world.applyPhysics(i, j, k - 1, this.id);
- world.applyPhysics(i, j - 1, k, this.id);
- world.applyPhysics(i, j + 1, k, this.id);
- } else {
- int i1 = world.getData(i, j, k);
- boolean flag = this.e(world, i, j, k, i1);
-
- if (!flag) {
- boolean flag1 = this.i(world, i, j, k, i1);
- int j1 = (i1 & 12) >> 2;
-
- if (this.c && !flag1 || !this.c && flag1) {
- byte b0 = 0;
-
- if (this.d(world, i, j, k, i1)) {
- b0 = -1;
- }
-
- world.a(i, j, k, this.id, b[j1] * 2, b0);
- }
- }
- }
- }
-
- private boolean i(World world, int i, int j, int k, int l) {
- int i1 = e(l);
-
- switch (i1) {
- case 0:
- return world.isBlockFaceIndirectlyPowered(i, j, k + 1, 3) || world.getTypeId(i, j, k + 1) == Block.REDSTONE_WIRE.id && world.getData(i, j, k + 1) > 0;
-
- case 1:
- return world.isBlockFaceIndirectlyPowered(i - 1, j, k, 4) || world.getTypeId(i - 1, j, k) == Block.REDSTONE_WIRE.id && world.getData(i - 1, j, k) > 0;
-
- case 2:
- return world.isBlockFaceIndirectlyPowered(i, j, k - 1, 2) || world.getTypeId(i, j, k - 1) == Block.REDSTONE_WIRE.id && world.getData(i, j, k - 1) > 0;
-
- case 3:
- return world.isBlockFaceIndirectlyPowered(i + 1, j, k, 5) || world.getTypeId(i + 1, j, k) == Block.REDSTONE_WIRE.id && world.getData(i + 1, j, k) > 0;
-
- default:
- return false;
- }
- }
-
- public boolean e(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- int i1 = e(l);
-
- switch (i1) {
- case 0:
- case 2:
- return iblockaccess.isBlockFacePowered(i - 1, j, k, 4) && c(iblockaccess.getTypeId(i - 1, j, k)) || iblockaccess.isBlockFacePowered(i + 1, j, k, 5) && c(iblockaccess.getTypeId(i + 1, j, k));
-
- case 1:
- case 3:
- return iblockaccess.isBlockFacePowered(i, j, k + 1, 3) && c(iblockaccess.getTypeId(i, j, k + 1)) || iblockaccess.isBlockFacePowered(i, j, k - 1, 2) && c(iblockaccess.getTypeId(i, j, k - 1));
-
- default:
- return false;
- }
- }
-
- public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
- int i1 = world.getData(i, j, k);
- int j1 = (i1 & 12) >> 2;
-
- j1 = j1 + 1 << 2 & 12;
- world.setData(i, j, k, j1 | i1 & 3);
- return true;
- }
-
- public boolean isPowerSource() {
- return true;
- }
-
- public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
- int l = ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4;
-
- world.setData(i, j, k, l);
- boolean flag = this.i(world, i, j, k, l);
-
- if (flag) {
- world.a(i, j, k, this.id, 1);
- }
- }
-
- public void onPlace(World world, int i, int j, int k) {
- world.applyPhysics(i + 1, j, k, this.id);
- world.applyPhysics(i - 1, j, k, this.id);
- world.applyPhysics(i, j, k + 1, this.id);
- world.applyPhysics(i, j, k - 1, this.id);
- world.applyPhysics(i, j - 1, k, this.id);
- world.applyPhysics(i, j + 1, k, this.id);
- }
-
- public void postBreak(World world, int i, int j, int k, int l) {
- if (this.c) {
- world.applyPhysics(i + 1, j, k, this.id);
- world.applyPhysics(i - 1, j, k, this.id);
- world.applyPhysics(i, j, k + 1, this.id);
- world.applyPhysics(i, j, k - 1, this.id);
- world.applyPhysics(i, j - 1, k, this.id);
- world.applyPhysics(i, j + 1, k, this.id);
- }
-
- super.postBreak(world, i, j, k, l);
- }
-
- public boolean c() {
- return false;
- }
-
- public int getDropType(int i, Random random, int j) {
- return Item.DIODE.id;
- }
-
- public static boolean c(int i) {
- return i == Block.DIODE_ON.id || i == Block.DIODE_OFF.id;
- }
-
- public boolean d(World world, int i, int j, int k, int l) {
- int i1 = e(l);
-
- if (c(world.getTypeId(i - Direction.a[i1], j, k - Direction.b[i1]))) {
- int j1 = world.getData(i - Direction.a[i1], j, k - Direction.b[i1]);
- int k1 = e(j1);
-
- return k1 != i1;
- } else {
- return false;
- }
- }
-}
diff --git a/src/main/java/net/minecraft/server/BlockDiodeAbstract.java b/src/main/java/net/minecraft/server/BlockDiodeAbstract.java
new file mode 100644
index 00000000..1ef8144d
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockDiodeAbstract.java
@@ -0,0 +1,261 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
+
+public abstract class BlockDiodeAbstract extends BlockDirectional {
+
+ protected final boolean a;
+
+ protected BlockDiodeAbstract(int i, boolean flag) {
+ super(i, Material.ORIENTABLE);
+ this.a = flag;
+ this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
+ }
+
+ public boolean b() {
+ return false;
+ }
+
+ public boolean canPlace(World world, int i, int j, int k) {
+ return !world.w(i, j - 1, k) ? false : super.canPlace(world, i, j, k);
+ }
+
+ public boolean f(World world, int i, int j, int k) {
+ return !world.w(i, j - 1, k) ? false : super.f(world, i, j, k);
+ }
+
+ public void a(World world, int i, int j, int k, Random random) {
+ int l = world.getData(i, j, k);
+
+ if (!this.e((IBlockAccess) world, i, j, k, l)) {
+ boolean flag = this.d(world, i, j, k, l);
+
+ if (this.a && !flag) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, i, j, k, 15, 0).getNewCurrent() != 0) {
+ return;
+ }
+ // CraftBukkit end
+
+ world.setTypeIdAndData(i, j, k, this.j().id, l, 2);
+ } else if (!this.a) {
+ // CraftBukkit start
+ if (CraftEventFactory.callRedstoneChange(world, i, j, k, 0, 15).getNewCurrent() != 15) {
+ return;
+ }
+ // CraftBukkit end
+
+ world.setTypeIdAndData(i, j, k, this.i().id, l, 2);
+ if (!flag) {
+ world.a(i, j, k, this.i().id, this.h(l), -1);
+ }
+ }
+ }
+ }
+
+ public int d() {
+ return 36;
+ }
+
+ protected boolean c(int i) {
+ return this.a;
+ }
+
+ public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ return this.b(iblockaccess, i, j, k, l);
+ }
+
+ public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ int i1 = iblockaccess.getData(i, j, k);
+
+ if (!this.c(i1)) {
+ return 0;
+ } else {
+ int j1 = j(i1);
+
+ return j1 == 0 && l == 3 ? this.d(iblockaccess, i, j, k, i1) : (j1 == 1 && l == 4 ? this.d(iblockaccess, i, j, k, i1) : (j1 == 2 && l == 2 ? this.d(iblockaccess, i, j, k, i1) : (j1 == 3 && l == 5 ? this.d(iblockaccess, i, j, k, i1) : 0)));
+ }
+ }
+
+ public void doPhysics(World world, int i, int j, int k, int l) {
+ if (!this.f(world, i, j, k)) {
+ this.c(world, i, j, k, world.getData(i, j, k), 0);
+ world.setAir(i, j, k);
+ world.applyPhysics(i + 1, j, k, this.id);
+ world.applyPhysics(i - 1, j, k, this.id);
+ world.applyPhysics(i, j, k + 1, this.id);
+ world.applyPhysics(i, j, k - 1, this.id);
+ world.applyPhysics(i, j - 1, k, this.id);
+ world.applyPhysics(i, j + 1, k, this.id);
+ } else {
+ this.f(world, i, j, k, l);
+ }
+ }
+
+ protected void f(World world, int i, int j, int k, int l) {
+ int i1 = world.getData(i, j, k);
+
+ if (!this.e((IBlockAccess) world, i, j, k, i1)) {
+ boolean flag = this.d(world, i, j, k, i1);
+
+ if ((this.a && !flag || !this.a && flag) && !world.a(i, j, k, this.id)) {
+ byte b0 = -1;
+
+ if (this.h(world, i, j, k, i1)) {
+ b0 = -3;
+ } else if (this.a) {
+ b0 = -2;
+ }
+
+ world.a(i, j, k, this.id, this.i_(i1), b0);
+ }
+ }
+ }
+
+ public boolean e(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ return false;
+ }
+
+ protected boolean d(World world, int i, int j, int k, int l) {
+ return this.e(world, i, j, k, l) > 0;
+ }
+
+ protected int e(World world, int i, int j, int k, int l) {
+ int i1 = j(l);
+ int j1 = i + Direction.a[i1];
+ int k1 = k + Direction.b[i1];
+ int l1 = world.getBlockFacePower(j1, j, k1, Direction.d[i1]);
+
+ return l1 >= 15 ? l1 : Math.max(l1, world.getTypeId(j1, j, k1) == Block.REDSTONE_WIRE.id ? world.getData(j1, j, k1) : 0);
+ }
+
+ protected int f(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ int i1 = j(l);
+
+ switch (i1) {
+ case 0:
+ case 2:
+ return Math.max(this.g(iblockaccess, i - 1, j, k, 4), this.g(iblockaccess, i + 1, j, k, 5));
+
+ case 1:
+ case 3:
+ return Math.max(this.g(iblockaccess, i, j, k + 1, 3), this.g(iblockaccess, i, j, k - 1, 2));
+
+ default:
+ return 0;
+ }
+ }
+
+ protected int g(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ int i1 = iblockaccess.getTypeId(i, j, k);
+
+ return this.e(i1) ? (i1 == Block.REDSTONE_WIRE.id ? iblockaccess.getData(i, j, k) : iblockaccess.getBlockPower(i, j, k, l)) : 0;
+ }
+
+ public boolean isPowerSource() {
+ return true;
+ }
+
+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
+ int l = ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3) + 2) % 4;
+
+ world.setData(i, j, k, l, 3);
+ boolean flag = this.d(world, i, j, k, l);
+
+ if (flag) {
+ world.a(i, j, k, this.id, 1);
+ }
+ }
+
+ public void onPlace(World world, int i, int j, int k) {
+ this.h_(world, i, j, k);
+ }
+
+ protected void h_(World world, int i, int j, int k) {
+ int l = j(world.getData(i, j, k));
+
+ if (l == 1) {
+ world.g(i + 1, j, k, this.id);
+ world.c(i + 1, j, k, this.id, 4);
+ }
+
+ if (l == 3) {
+ world.g(i - 1, j, k, this.id);
+ world.c(i - 1, j, k, this.id, 5);
+ }
+
+ if (l == 2) {
+ world.g(i, j, k + 1, this.id);
+ world.c(i, j, k + 1, this.id, 2);
+ }
+
+ if (l == 0) {
+ world.g(i, j, k - 1, this.id);
+ world.c(i, j, k - 1, this.id, 3);
+ }
+ }
+
+ public void postBreak(World world, int i, int j, int k, int l) {
+ if (this.a) {
+ world.applyPhysics(i + 1, j, k, this.id);
+ world.applyPhysics(i - 1, j, k, this.id);
+ world.applyPhysics(i, j, k + 1, this.id);
+ world.applyPhysics(i, j, k - 1, this.id);
+ world.applyPhysics(i, j - 1, k, this.id);
+ world.applyPhysics(i, j + 1, k, this.id);
+ }
+
+ super.postBreak(world, i, j, k, l);
+ }
+
+ public boolean c() {
+ return false;
+ }
+
+ protected boolean e(int i) {
+ Block block = Block.byId[i];
+
+ return block != null && block.isPowerSource();
+ }
+
+ protected int d(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ return 15;
+ }
+
+ public static boolean f(int i) {
+ return Block.DIODE_OFF.g(i) || Block.REDSTONE_COMPARATOR_OFF.g(i);
+ }
+
+ public boolean g(int i) {
+ return i == this.i().id || i == this.j().id;
+ }
+
+ public boolean h(World world, int i, int j, int k, int l) {
+ int i1 = j(l);
+
+ if (f(world.getTypeId(i - Direction.a[i1], j, k - Direction.b[i1]))) {
+ int j1 = world.getData(i - Direction.a[i1], j, k - Direction.b[i1]);
+ int k1 = j(j1);
+
+ return k1 != i1;
+ } else {
+ return false;
+ }
+ }
+
+ protected int h(int i) {
+ return this.i_(i);
+ }
+
+ protected abstract int i_(int i);
+
+ protected abstract BlockDiodeAbstract i();
+
+ protected abstract BlockDiodeAbstract j();
+
+ public boolean i(int i) {
+ return this.g(i);
+ }
+}
diff --git a/src/main/java/net/minecraft/server/BlockDispenser.java b/src/main/java/net/minecraft/server/BlockDispenser.java
index 5cb21c83..b3fed06d 100644
--- a/src/main/java/net/minecraft/server/BlockDispenser.java
+++ b/src/main/java/net/minecraft/server/BlockDispenser.java
@@ -5,29 +5,24 @@ import java.util.Random;
public class BlockDispenser extends BlockContainer {
public static final IRegistry a = new RegistryDefault(new DispenseBehaviorItem());
+ protected Random b = new Random();
public static boolean eventFired = false; // CraftBukkit
- private Random b = new Random();
protected BlockDispenser(int i) {
super(i, Material.STONE);
- this.textureId = 45;
this.a(CreativeModeTab.d);
}
- public int r_() {
+ public int a(World world) {
return 4;
}
- public int getDropType(int i, Random random, int j) {
- return Block.DISPENSER.id;
- }
-
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
- this.l(world, i, j, k);
+ this.k(world, i, j, k);
}
- private void l(World world, int i, int j, int k) {
+ private void k(World world, int i, int j, int k) {
if (!world.isStatic) {
int l = world.getTypeId(i, j, k - 1);
int i1 = world.getTypeId(i, j, k + 1);
@@ -35,30 +30,26 @@ public class BlockDispenser extends BlockContainer {
int k1 = world.getTypeId(i + 1, j, k);
byte b0 = 3;
- if (Block.q[l] && !Block.q[i1]) {
+ if (Block.s[l] && !Block.s[i1]) {
b0 = 3;
}
- if (Block.q[i1] && !Block.q[l]) {
+ if (Block.s[i1] && !Block.s[l]) {
b0 = 2;
}
- if (Block.q[j1] && !Block.q[k1]) {
+ if (Block.s[j1] && !Block.s[k1]) {
b0 = 5;
}
- if (Block.q[k1] && !Block.q[j1]) {
+ if (Block.s[k1] && !Block.s[j1]) {
b0 = 4;
}
- world.setData(i, j, k, b0);
+ world.setData(i, j, k, b0, 2);
}
}
- public int a(int i) {
- return i == 1 ? this.textureId + 17 : (i == 0 ? this.textureId + 17 : (i == 3 ? this.textureId + 1 : this.textureId));
- }
-
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
if (world.isStatic) {
return true;
@@ -79,13 +70,13 @@ public class BlockDispenser extends BlockContainer {
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) sourceblock.getTileEntity();
if (tileentitydispenser != null) {
- int l = tileentitydispenser.i();
+ int l = tileentitydispenser.j();
if (l < 0) {
world.triggerEffect(1001, i, j, k, 0);
} else {
ItemStack itemstack = tileentitydispenser.getItem(l);
- IDispenseBehavior idispensebehavior = (IDispenseBehavior) a.a(itemstack.getItem());
+ IDispenseBehavior idispensebehavior = this.a(itemstack);
if (idispensebehavior != IDispenseBehavior.a) {
ItemStack itemstack1 = idispensebehavior.a(sourceblock, itemstack);
@@ -97,43 +88,39 @@ public class BlockDispenser extends BlockContainer {
}
}
- public void doPhysics(World world, int i, int j, int k, int l) {
- if (l > 0 && Block.byId[l].isPowerSource()) {
- boolean flag = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k);
+ protected IDispenseBehavior a(ItemStack itemstack) {
+ return (IDispenseBehavior) a.a(itemstack.getItem());
+ }
- if (flag) {
- world.a(i, j, k, this.id, this.r_());
- }
+ public void doPhysics(World world, int i, int j, int k, int l) {
+ boolean flag = world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k);
+ int i1 = world.getData(i, j, k);
+ boolean flag1 = (i1 & 8) != 0;
+
+ if (flag && !flag1) {
+ world.a(i, j, k, this.id, this.a(world));
+ world.setData(i, j, k, i1 | 8, 4);
+ } else if (!flag && flag1) {
+ world.setData(i, j, k, i1 & -9, 4);
}
}
- public void b(World world, int i, int j, int k, Random random) {
- if (!world.isStatic && (world.isBlockIndirectlyPowered(i, j, k) || world.isBlockIndirectlyPowered(i, j + 1, k))) {
+ public void a(World world, int i, int j, int k, Random random) {
+ if (!world.isStatic) {
this.dispense(world, i, j, k);
}
}
- public TileEntity a(World world) {
+ public TileEntity b(World world) {
return new TileEntityDispenser();
}
- public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
- int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3;
-
- if (l == 0) {
- world.setData(i, j, k, 2);
- }
+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
+ int l = BlockPiston.a(world, i, j, k, entityliving);
- if (l == 1) {
- world.setData(i, j, k, 5);
- }
-
- if (l == 2) {
- world.setData(i, j, k, 3);
- }
-
- if (l == 3) {
- world.setData(i, j, k, 4);
+ world.setData(i, j, k, l, 2);
+ if (itemstack.hasName()) {
+ ((TileEntityDispenser) world.getTileEntity(i, j, k)).a(itemstack.getName());
}
}
@@ -178,11 +165,23 @@ public class BlockDispenser extends BlockContainer {
}
public static IPosition a(ISourceBlock isourceblock) {
- EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
+ EnumFacing enumfacing = j_(isourceblock.h());
double d0 = isourceblock.getX() + 0.7D * (double) enumfacing.c();
- double d1 = isourceblock.getY();
+ double d1 = isourceblock.getY() + 0.7D * (double) enumfacing.d();
double d2 = isourceblock.getZ() + 0.7D * (double) enumfacing.e();
return new Position(d0, d1, d2);
}
+
+ public static EnumFacing j_(int i) {
+ return EnumFacing.a(i & 7);
+ }
+
+ public boolean q_() {
+ return true;
+ }
+
+ public int b_(World world, int i, int j, int k, int l) {
+ return Container.b((IInventory) world.getTileEntity(i, j, k));
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockDoor.java b/src/main/java/net/minecraft/server/BlockDoor.java
index 946fa36a..fd28fa02 100644
--- a/src/main/java/net/minecraft/server/BlockDoor.java
+++ b/src/main/java/net/minecraft/server/BlockDoor.java
@@ -6,11 +6,15 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockDoor extends Block {
+ private static final String[] a = new String[] { "doorWood_lower", "doorWood_upper", "doorIron_lower", "doorIron_upper"};
+ private final int b;
+
protected BlockDoor(int i, Material material) {
super(i, material);
- this.textureId = 97;
if (material == Material.ORE) {
- ++this.textureId;
+ this.b = 2;
+ } else {
+ this.b = 0;
}
float f = 0.5F;
@@ -23,8 +27,8 @@ public class BlockDoor extends Block {
return false;
}
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
- int l = this.b_(iblockaccess, i, j, k);
+ public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
+ int l = this.c_(iblockaccess, i, j, k);
return (l & 4) != 0;
}
@@ -37,24 +41,24 @@ public class BlockDoor extends Block {
return 7;
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
- return super.e(world, i, j, k);
+ return super.b(world, i, j, k);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
- this.e(this.b_(iblockaccess, i, j, k));
+ this.d(this.c_(iblockaccess, i, j, k));
}
public int d(IBlockAccess iblockaccess, int i, int j, int k) {
- return this.b_(iblockaccess, i, j, k) & 3;
+ return this.c_(iblockaccess, i, j, k) & 3;
}
- public boolean a_(IBlockAccess iblockaccess, int i, int j, int k) {
- return (this.b_(iblockaccess, i, j, k) & 4) != 0;
+ public boolean b_(IBlockAccess iblockaccess, int i, int j, int k) {
+ return (this.c_(iblockaccess, i, j, k) & 4) != 0;
}
- private void e(int i) {
+ private void d(int i) {
float f = 0.1875F;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F);
@@ -111,16 +115,16 @@ public class BlockDoor extends Block {
if (this.material == Material.ORE) {
return true;
} else {
- int i1 = this.b_(world, i, j, k);
+ int i1 = this.c_(world, i, j, k);
int j1 = i1 & 7;
j1 ^= 4;
if ((i1 & 8) == 0) {
- world.setData(i, j, k, j1);
- world.e(i, j, k, i, j, k);
+ world.setData(i, j, k, j1, 2);
+ world.g(i, j, k, i, j, k);
} else {
- world.setData(i, j - 1, k, j1);
- world.e(i, j - 1, k, i, j, k);
+ world.setData(i, j - 1, k, j1, 2);
+ world.g(i, j - 1, k, i, j, k);
}
world.a(entityhuman, 1003, i, j, k, 0);
@@ -129,7 +133,7 @@ public class BlockDoor extends Block {
}
public void setDoor(World world, int i, int j, int k, boolean flag) {
- int l = this.b_(world, i, j, k);
+ int l = this.c_(world, i, j, k);
boolean flag1 = (l & 4) != 0;
if (flag1 != flag) {
@@ -137,11 +141,11 @@ public class BlockDoor extends Block {
i1 ^= 4;
if ((l & 8) == 0) {
- world.setData(i, j, k, i1);
- world.e(i, j, k, i, j, k);
+ world.setData(i, j, k, i1, 2);
+ world.g(i, j, k, i, j, k);
} else {
- world.setData(i, j - 1, k, i1);
- world.e(i, j - 1, k, i, j, k);
+ world.setData(i, j - 1, k, i1, 2);
+ world.g(i, j - 1, k, i, j, k);
}
world.a((EntityHuman) null, 1003, i, j, k, 0);
@@ -155,15 +159,15 @@ public class BlockDoor extends Block {
boolean flag = false;
if (world.getTypeId(i, j + 1, k) != this.id) {
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
flag = true;
}
- if (!world.v(i, j - 1, k)) {
- world.setTypeId(i, j, k, 0);
+ if (!world.w(i, j - 1, k)) {
+ world.setAir(i, j, k);
flag = true;
if (world.getTypeId(i, j + 1, k) == this.id) {
- world.setTypeId(i, j + 1, k, 0);
+ world.setAir(i, j + 1, k);
}
}
@@ -192,8 +196,9 @@ public class BlockDoor extends Block {
}
} else {
if (world.getTypeId(i, j - 1, k) != this.id) {
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
}
+
else if (l > 0 && l != this.id) { // CraftBukkit
this.doPhysics(world, i, j - 1, k, l);
}
@@ -210,14 +215,14 @@ public class BlockDoor extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
- return j >= 255 ? false : world.v(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
+ return j >= 255 ? false : world.w(i, j - 1, k) && super.canPlace(world, i, j, k) && super.canPlace(world, i, j + 1, k);
}
- public int q_() {
+ public int h() {
return 1;
}
- public int b_(IBlockAccess iblockaccess, int i, int j, int k) {
+ public int c_(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
boolean flag = (l & 8) != 0;
int i1;
@@ -238,7 +243,7 @@ public class BlockDoor extends Block {
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
if (entityhuman.abilities.canInstantlyBuild && (l & 8) != 0 && world.getTypeId(i, j - 1, k) == this.id) {
- world.setTypeId(i, j - 1, k, 0);
+ world.setAir(i, j - 1, k);
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockDragonEgg.java b/src/main/java/net/minecraft/server/BlockDragonEgg.java
index 2c461253..a27a6c07 100644
--- a/src/main/java/net/minecraft/server/BlockDragonEgg.java
+++ b/src/main/java/net/minecraft/server/BlockDragonEgg.java
@@ -6,56 +6,56 @@ import org.bukkit.event.block.BlockFromToEvent; // CraftBukkit
public class BlockDragonEgg extends Block {
- public BlockDragonEgg(int i, int j) {
- super(i, j, Material.DRAGON_EGG);
+ public BlockDragonEgg(int i) {
+ super(i, Material.DRAGON_EGG);
this.a(0.0625F, 0.0F, 0.0625F, 0.9375F, 1.0F, 0.9375F);
}
public void onPlace(World world, int i, int j, int k) {
- world.a(i, j, k, this.id, this.r_());
+ world.a(i, j, k, this.id, this.a(world));
}
public void doPhysics(World world, int i, int j, int k, int l) {
- world.a(i, j, k, this.id, this.r_());
+ world.a(i, j, k, this.id, this.a(world));
}
- public void b(World world, int i, int j, int k, Random random) {
- this.l(world, i, j, k);
+ public void a(World world, int i, int j, int k, Random random) {
+ this.k(world, i, j, k);
}
- private void l(World world, int i, int j, int k) {
+ private void k(World world, int i, int j, int k) {
if (BlockSand.canFall(world, i, j - 1, k) && j >= 0) {
byte b0 = 32;
- if (!BlockSand.instaFall && world.d(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
+ if (!BlockSand.instaFall && world.e(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
// CraftBukkit - added data
EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.id, world.getData(i, j, k));
world.addEntity(entityfallingblock);
} else {
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
while (BlockSand.canFall(world, i, j - 1, k) && j > 0) {
--j;
}
if (j > 0) {
- world.setTypeId(i, j, k, this.id);
+ world.setTypeIdAndData(i, j, k, this.id, 0, 2);
}
}
}
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
- this.n(world, i, j, k);
+ this.m(world, i, j, k);
return true;
}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
- this.n(world, i, j, k);
+ this.m(world, i, j, k);
}
- private void n(World world, int i, int j, int k) {
+ private void m(World world, int i, int j, int k) {
if (world.getTypeId(i, j, k) == this.id) {
for (int l = 0; l < 1000; ++l) {
int i1 = i + world.random.nextInt(16) - world.random.nextInt(16);
@@ -79,8 +79,8 @@ public class BlockDragonEgg extends Block {
// CraftBukkit end
if (!world.isStatic) {
- world.setTypeIdAndData(i1, j1, k1, this.id, world.getData(i, j, k));
- world.setTypeId(i, j, k, 0);
+ world.setTypeIdAndData(i1, j1, k1, this.id, world.getData(i, j, k), 2);
+ world.setAir(i, j, k);
} else {
short short1 = 128;
@@ -103,7 +103,7 @@ public class BlockDragonEgg extends Block {
}
}
- public int r_() {
+ public int a(World world) {
return 5;
}
diff --git a/src/main/java/net/minecraft/server/BlockEnderPortal.java b/src/main/java/net/minecraft/server/BlockEnderPortal.java
index 6a5b2748..2b400236 100644
--- a/src/main/java/net/minecraft/server/BlockEnderPortal.java
+++ b/src/main/java/net/minecraft/server/BlockEnderPortal.java
@@ -10,11 +10,11 @@ public class BlockEnderPortal extends BlockContainer {
public static boolean a = false;
protected BlockEnderPortal(int i, Material material) {
- super(i, 0, material);
+ super(i, material);
this.a(1.0F);
}
- public TileEntity a(World world) {
+ public TileEntity b(World world) {
return new TileEntityEnderPortal();
}
@@ -44,7 +44,7 @@ public class BlockEnderPortal extends BlockContainer {
EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), i, j, k));
world.getServer().getPluginManager().callEvent(event);
// CraftBukkit end
- entity.b(1);
+ entity.c(1);
}
}
@@ -55,7 +55,7 @@ public class BlockEnderPortal extends BlockContainer {
public void onPlace(World world, int i, int j, int k) {
if (!a) {
if (world.worldProvider.dimension != 0) {
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java
index 6d249f13..eb33c84f 100644
--- a/src/main/java/net/minecraft/server/BlockFire.java
+++ b/src/main/java/net/minecraft/server/BlockFire.java
@@ -13,12 +13,12 @@ public class BlockFire extends Block {
private int[] a = new int[256];
private int[] b = new int[256];
- protected BlockFire(int i, int j) {
- super(i, j, Material.FIRE);
+ protected BlockFire(int i) {
+ super(i, Material.FIRE);
this.b(true);
}
- public void t_() {
+ public void s_() {
this.a(Block.WOOD.id, 5, 20);
this.a(Block.WOOD_DOUBLE_STEP.id, 5, 20);
this.a(Block.WOOD_STEP.id, 5, 20);
@@ -41,7 +41,7 @@ public class BlockFire extends Block {
this.b[i] = k;
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
@@ -61,11 +61,11 @@ public class BlockFire extends Block {
return 0;
}
- public int r_() {
+ public int a(World world) {
return 30;
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
if (world.getGameRules().getBoolean("doFireTick")) {
boolean flag = world.getTypeId(i, j - 1, k) == Block.NETHERRACK.id;
@@ -77,24 +77,24 @@ public class BlockFire extends Block {
fireExtinguished(world, i, j, k); // CraftBukkit - invalid place location
}
- if (!flag && world.N() && (world.D(i, j, k) || world.D(i - 1, j, k) || world.D(i + 1, j, k) || world.D(i, j, k - 1) || world.D(i, j, k + 1))) {
+ if (!flag && world.O() && (world.F(i, j, k) || world.F(i - 1, j, k) || world.F(i + 1, j, k) || world.F(i, j, k - 1) || world.F(i, j, k + 1))) {
fireExtinguished(world, i, j, k); // CraftBukkit - extinguished by rain
} else {
int l = world.getData(i, j, k);
if (l < 15) {
- world.setRawData(i, j, k, l + random.nextInt(3) / 2);
+ world.setData(i, j, k, l + random.nextInt(3) / 2, 4);
}
- world.a(i, j, k, this.id, this.r_() + random.nextInt(10));
- if (!flag && !this.l(world, i, j, k)) {
- if (!world.v(i, j - 1, k) || l > 3) {
- world.setTypeId(i, j, k, 0);
+ world.a(i, j, k, this.id, this.a(world) + random.nextInt(10));
+ if (!flag && !this.k(world, i, j, k)) {
+ if (!world.w(i, j - 1, k) || l > 3) {
+ world.setAir(i, j, k);
}
} else if (!flag && !this.d((IBlockAccess) world, i, j - 1, k) && l == 15 && random.nextInt(4) == 0) {
fireExtinguished(world, i, j, k); // CraftBukkit - burn out
} else {
- boolean flag1 = world.E(i, j, k);
+ boolean flag1 = world.G(i, j, k);
byte b0 = 0;
if (flag1) {
@@ -126,7 +126,7 @@ public class BlockFire extends Block {
l1 += (k1 - (j + 1)) * 100;
}
- int i2 = this.n(world, i1, k1, j1);
+ int i2 = this.m(world, i1, k1, j1);
if (i2 > 0) {
int j2 = (i2 + 40 + world.difficulty * 7) / (l + 30);
@@ -135,7 +135,7 @@ public class BlockFire extends Block {
j2 /= 2;
}
- if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.N() || !world.D(i1, k1, j1)) && !world.D(i1 - 1, k1, k) && !world.D(i1 + 1, k1, j1) && !world.D(i1, k1, j1 - 1) && !world.D(i1, k1, j1 + 1)) {
+ if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.O() || !world.F(i1, k1, j1)) && !world.F(i1 - 1, k1, k) && !world.F(i1 + 1, k1, j1) && !world.F(i1, k1, j1 - 1) && !world.F(i1, k1, j1 + 1)) {
int k2 = l + random.nextInt(5) / 4;
if (k2 > 15) {
@@ -197,16 +197,16 @@ public class BlockFire extends Block {
}
// CraftBukkit end
- if (random.nextInt(i1 + 10) < 5 && !world.D(i, j, k)) {
+ if (random.nextInt(i1 + 10) < 5 && !world.F(i, j, k)) {
int k1 = i1 + random.nextInt(5) / 4;
if (k1 > 15) {
k1 = 15;
}
- world.setTypeIdAndData(i, j, k, this.id, k1);
+ world.setTypeIdAndData(i, j, k, this.id, k1, 3);
} else {
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
}
if (flag) {
@@ -215,11 +215,11 @@ public class BlockFire extends Block {
}
}
- private boolean l(World world, int i, int j, int k) {
+ private boolean k(World world, int i, int j, int k) {
return this.d((IBlockAccess) world, i + 1, j, k) ? true : (this.d((IBlockAccess) world, i - 1, j, k) ? true : (this.d((IBlockAccess) world, i, j - 1, k) ? true : (this.d((IBlockAccess) world, i, j + 1, k) ? true : (this.d((IBlockAccess) world, i, j, k - 1) ? true : this.d((IBlockAccess) world, i, j, k + 1)))));
}
- private int n(World world, int i, int j, int k) {
+ private int m(World world, int i, int j, int k) {
byte b0 = 0;
if (!world.isEmpty(i, j, k)) {
@@ -251,21 +251,21 @@ public class BlockFire extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.v(i, j - 1, k) || this.l(world, i, j, k);
+ return world.w(i, j - 1, k) || this.k(world, i, j, k);
}
public void doPhysics(World world, int i, int j, int k, int l) {
- if (!world.v(i, j - 1, k) && !this.l(world, i, j, k)) {
+ if (!world.w(i, j - 1, k) && !this.k(world, i, j, k)) {
fireExtinguished(world, i, j, k); // CraftBukkit - fuel block gone
}
}
public void onPlace(World world, int i, int j, int k) {
- if (world.worldProvider.dimension > 0 || world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.i_(world, i, j, k)) {
- if (!world.v(i, j - 1, k) && !this.l(world, i, j, k)) {
+ if (world.worldProvider.dimension > 0 || world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.n_(world, i, j, k)) {
+ if (!world.w(i, j - 1, k) && !this.k(world, i, j, k)) {
fireExtinguished(world, i, j, k); // CraftBukkit - fuel block broke
} else {
- world.a(i, j, k, this.id, this.r_() + world.random.nextInt(10));
+ world.a(i, j, k, this.id, this.a(world) + world.random.nextInt(10));
}
}
}
@@ -273,7 +273,7 @@ public class BlockFire extends Block {
// CraftBukkit start
private void fireExtinguished(World world, int x, int y, int z) {
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(x, y, z), 0).isCancelled() == false) {
- world.setTypeId(x, y, z, 0);
+ world.setAir(x, y, z);
}
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
index 643422a3..2b5d1f39 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java
@@ -17,25 +17,24 @@ public class BlockFlowing extends BlockFluids {
super(i, material);
}
- private void l(World world, int i, int j, int k) {
+ private void k(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
- world.setRawTypeIdAndData(i, j, k, this.id + 1, l);
- world.e(i, j, k, i, j, k);
+ world.setTypeIdAndData(i, j, k, this.id + 1, l, 2);
}
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
+ public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return this.material != Material.LAVA;
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
org.bukkit.Server server = world.getServer();
org.bukkit.block.Block source = bworld == null ? null : bworld.getBlockAt(i, j, k);
// CraftBukkit end
- int l = this.f_(world, i, j, k);
+ int l = this.k_(world, i, j, k);
byte b0 = 1;
if (this.material == Material.LAVA && !world.worldProvider.e) {
@@ -59,8 +58,8 @@ public class BlockFlowing extends BlockFluids {
i1 = -1;
}
- if (this.f_(world, i, j + 1, k) >= 0) {
- int k1 = this.f_(world, i, j + 1, k);
+ if (this.k_(world, i, j + 1, k) >= 0) {
+ int k1 = this.k_(world, i, j + 1, k);
if (k1 >= 8) {
i1 = k1;
@@ -72,7 +71,7 @@ public class BlockFlowing extends BlockFluids {
if (this.a >= 2 && this.material == Material.WATER) {
if (world.getMaterial(i, j - 1, k).isBuildable()) {
i1 = 0;
- } else if (world.getMaterial(i, j - 1, k) == this.material && world.getData(i, j, k) == 0) {
+ } else if (world.getMaterial(i, j - 1, k) == this.material && world.getData(i, j - 1, k) == 0) {
i1 = 0;
}
}
@@ -84,23 +83,23 @@ public class BlockFlowing extends BlockFluids {
if (i1 == l) {
if (flag) {
- this.l(world, i, j, k);
+ this.k(world, i, j, k);
}
} else {
l = i1;
if (i1 < 0) {
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
} else {
- world.setData(i, j, k, i1);
- world.a(i, j, k, this.id, this.r_());
+ world.setData(i, j, k, i1, 2);
+ world.a(i, j, k, this.id, this.a(world));
world.applyPhysics(i, j, k, this.id);
}
}
} else {
- this.l(world, i, j, k);
+ this.k(world, i, j, k);
}
- if (this.p(world, i, j - 1, k)) {
+ if (this.o(world, i, j - 1, k)) {
// CraftBukkit start - send "down" to the server
BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN);
if (server != null) {
@@ -109,7 +108,7 @@ public class BlockFlowing extends BlockFluids {
if (!event.isCancelled()) {
if (this.material == Material.LAVA && world.getMaterial(i, j - 1, k) == Material.WATER) {
- world.setTypeId(i, j - 1, k, Block.STONE.id);
+ world.setTypeIdUpdate(i, j - 1, k, Block.STONE.id);
this.fizz(world, i, j - 1, k);
return;
}
@@ -121,8 +120,8 @@ public class BlockFlowing extends BlockFluids {
}
}
// CraftBukkit end
- } else if (l >= 0 && (l == 0 || this.o(world, i, j - 1, k))) {
- boolean[] aboolean = this.n(world, i, j, k);
+ } else if (l >= 0 && (l == 0 || this.n(world, i, j - 1, k))) {
+ boolean[] aboolean = this.m(world, i, j, k);
i1 = l + b0;
if (l >= 8) {
@@ -156,7 +155,7 @@ public class BlockFlowing extends BlockFluids {
}
private void flow(World world, int i, int j, int k, int l) {
- if (this.p(world, i, j, k)) {
+ if (this.o(world, i, j, k)) {
int i1 = world.getTypeId(i, j, k);
if (i1 > 0) {
@@ -167,7 +166,7 @@ public class BlockFlowing extends BlockFluids {
}
}
- world.setTypeIdAndData(i, j, k, this.id, l);
+ world.setTypeIdAndData(i, j, k, this.id, l, 3);
}
}
@@ -195,8 +194,8 @@ public class BlockFlowing extends BlockFluids {
++i2;
}
- if (!this.o(world, l1, j, i2) && (world.getMaterial(l1, j, i2) != this.material || world.getData(l1, j, i2) != 0)) {
- if (!this.o(world, l1, j - 1, i2)) {
+ if (!this.n(world, l1, j, i2) && (world.getMaterial(l1, j, i2) != this.material || world.getData(l1, j, i2) != 0)) {
+ if (!this.n(world, l1, j - 1, i2)) {
return l;
}
@@ -214,7 +213,7 @@ public class BlockFlowing extends BlockFluids {
return j1;
}
- private boolean[] n(World world, int i, int j, int k) {
+ private boolean[] m(World world, int i, int j, int k) {
int l;
int i1;
@@ -239,8 +238,8 @@ public class BlockFlowing extends BlockFluids {
++j1;
}
- if (!this.o(world, i1, j, j1) && (world.getMaterial(i1, j, j1) != this.material || world.getData(i1, j, j1) != 0)) {
- if (this.o(world, i1, j - 1, j1)) {
+ if (!this.n(world, i1, j, j1) && (world.getMaterial(i1, j, j1) != this.material || world.getData(i1, j, j1) != 0)) {
+ if (this.n(world, i1, j - 1, j1)) {
this.c[l] = this.d(world, i1, j, j1, 1, l);
} else {
this.c[l] = 0;
@@ -263,7 +262,7 @@ public class BlockFlowing extends BlockFluids {
return this.b;
}
- private boolean o(World world, int i, int j, int k) {
+ private boolean n(World world, int i, int j, int k) {
int l = world.getTypeId(i, j, k);
if (l != Block.WOODEN_DOOR.id && l != Block.IRON_DOOR_BLOCK.id && l != Block.SIGN_POST.id && l != Block.LADDER.id && l != Block.SUGAR_CANE_BLOCK.id) {
@@ -280,7 +279,7 @@ public class BlockFlowing extends BlockFluids {
}
protected int d(World world, int i, int j, int k, int l) {
- int i1 = this.f_(world, i, j, k);
+ int i1 = this.k_(world, i, j, k);
if (i1 < 0) {
return l;
@@ -297,16 +296,16 @@ public class BlockFlowing extends BlockFluids {
}
}
- private boolean p(World world, int i, int j, int k) {
+ private boolean o(World world, int i, int j, int k) {
Material material = world.getMaterial(i, j, k);
- return material == this.material ? false : (material == Material.LAVA ? false : !this.o(world, i, j, k));
+ return material == this.material ? false : (material == Material.LAVA ? false : !this.n(world, i, j, k));
}
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
if (world.getTypeId(i, j, k) == this.id) {
- world.a(i, j, k, this.id, this.r_());
+ world.a(i, j, k, this.id, this.a(world));
}
}
diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java
index 79a007c8..6f9301de 100644
--- a/src/main/java/net/minecraft/server/BlockGrass.java
+++ b/src/main/java/net/minecraft/server/BlockGrass.java
@@ -12,16 +12,11 @@ public class BlockGrass extends Block {
protected BlockGrass(int i) {
super(i, Material.GRASS);
- this.textureId = 3;
this.b(true);
this.a(CreativeModeTab.b);
}
- public int a(int i, int j) {
- return i == 1 ? 0 : (i == 0 ? 2 : 3);
- }
-
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
if (world.getLightLevel(i, j + 1, k) < 4 && Block.lightBlock[world.getTypeId(i, j + 1, k)] > 2) {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/BlockIce.java b/src/main/java/net/minecraft/server/BlockIce.java
index b7215376..e2259706 100644
--- a/src/main/java/net/minecraft/server/BlockIce.java
+++ b/src/main/java/net/minecraft/server/BlockIce.java
@@ -4,8 +4,8 @@ import java.util.Random;
public class BlockIce extends BlockHalfTransparant {
- public BlockIce(int i, int j) {
- super(i, j, Material.ICE, false);
+ public BlockIce(int i) {
+ super(i, "ice", Material.ICE, false);
this.frictionFactor = 0.98F;
this.b(true);
this.a(CreativeModeTab.b);
@@ -14,15 +14,15 @@ public class BlockIce extends BlockHalfTransparant {
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
entityhuman.a(StatisticList.C[this.id], 1);
entityhuman.j(0.025F);
- if (this.s_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
- ItemStack itemstack = this.f_(l);
+ if (this.r_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
+ ItemStack itemstack = this.c_(l);
if (itemstack != null) {
this.b(world, i, j, k, itemstack);
}
} else {
if (world.worldProvider.e) {
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
return;
}
@@ -32,7 +32,7 @@ public class BlockIce extends BlockHalfTransparant {
Material material = world.getMaterial(i, j - 1, k);
if (material.isSolid() || material.isLiquid()) {
- world.setTypeId(i, j, k, Block.WATER.id);
+ world.setTypeIdUpdate(i, j, k, Block.WATER.id);
}
}
}
@@ -41,7 +41,7 @@ public class BlockIce extends BlockHalfTransparant {
return 0;
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11 - Block.lightBlock[this.id]) {
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), Block.STATIONARY_WATER.id).isCancelled()) {
@@ -50,16 +50,16 @@ public class BlockIce extends BlockHalfTransparant {
// CraftBukkit end
if (world.worldProvider.e) {
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
return;
}
this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, Block.STATIONARY_WATER.id);
+ world.setTypeIdUpdate(i, j, k, Block.STATIONARY_WATER.id);
}
}
- public int q_() {
+ public int h() {
return 0;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockJukeBox.java b/src/main/java/net/minecraft/server/BlockJukeBox.java
deleted file mode 100644
index b675141c..00000000
--- a/src/main/java/net/minecraft/server/BlockJukeBox.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package net.minecraft.server;
-
-public class BlockJukeBox extends BlockContainer {
-
- protected BlockJukeBox(int i, int j) {
- super(i, j, Material.WOOD);
- this.a(CreativeModeTab.c);
- }
-
- public int a(int i) {
- return this.textureId + (i == 1 ? 1 : 0);
- }
-
- public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
- if (world.getData(i, j, k) == 0) {
- return false;
- } else {
- this.dropRecord(world, i, j, k);
- return true;
- }
- }
-
- public void a(World world, int i, int j, int k, ItemStack itemstack) {
- if (!world.isStatic) {
- TileEntityRecordPlayer tileentityrecordplayer = (TileEntityRecordPlayer) world.getTileEntity(i, j, k);
-
- if (tileentityrecordplayer != null) {
- tileentityrecordplayer.record = itemstack.cloneItemStack();
- tileentityrecordplayer.record.count = 1; // CraftBukkit - There can be only one
- tileentityrecordplayer.update();
- world.setData(i, j, k, 1);
- }
- }
- }
-
- public void dropRecord(World world, int i, int j, int k) {
- if (!world.isStatic) {
- TileEntityRecordPlayer tileentityrecordplayer = (TileEntityRecordPlayer) world.getTileEntity(i, j, k);
-
- if (tileentityrecordplayer != null) {
- ItemStack itemstack = tileentityrecordplayer.record;
-
- if (itemstack != null) {
- world.triggerEffect(1005, i, j, k, 0);
- world.a((String) null, i, j, k);
- tileentityrecordplayer.record = null;
- tileentityrecordplayer.update();
- world.setData(i, j, k, 0);
- float f = 0.7F;
- double d0 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
- double d1 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.2D + 0.6D;
- double d2 = (double) (world.random.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
- ItemStack itemstack1 = itemstack.cloneItemStack();
- EntityItem entityitem = new EntityItem(world, (double) i + d0, (double) j + d1, (double) k + d2, itemstack1);
-
- entityitem.pickupDelay = 10;
- world.addEntity(entityitem);
- }
- }
- }
- }
-
- public void remove(World world, int i, int j, int k, int l, int i1) {
- this.dropRecord(world, i, j, k);
- super.remove(world, i, j, k, l, i1);
- }
-
- public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
- if (!world.isStatic) {
- super.dropNaturally(world, i, j, k, l, f, 0);
- }
- }
-
- public TileEntity a(World world) {
- return new TileEntityRecordPlayer();
- }
-}
diff --git a/src/main/java/net/minecraft/server/BlockLeaves.java b/src/main/java/net/minecraft/server/BlockLeaves.java
index e06e0675..318c304d 100644
--- a/src/main/java/net/minecraft/server/BlockLeaves.java
+++ b/src/main/java/net/minecraft/server/BlockLeaves.java
@@ -6,13 +6,13 @@ import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
public class BlockLeaves extends BlockTransparant {
- private int cD;
public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle"};
- int[] b;
+ public static final String[][] b = new String[][] { { "leaves", "leaves_spruce", "leaves", "leaves_jungle"}, { "leaves_opaque", "leaves_spruce_opaque", "leaves_opaque", "leaves_jungle_opaque"}};
+ private IIcon[][] cR = new IIcon[2][];
+ int[] c;
- protected BlockLeaves(int i, int j) {
- super(i, j, Material.LEAVES, false);
- this.cD = j;
+ protected BlockLeaves(int i) {
+ super(i, Material.LEAVES, false);
this.b(true);
this.a(CreativeModeTab.c);
}
@@ -21,7 +21,7 @@ public class BlockLeaves extends BlockTransparant {
byte b0 = 1;
int j1 = b0 + 1;
- if (world.d(i - j1, j - j1, k - j1, i + j1, j + j1, k + j1)) {
+ if (world.e(i - j1, j - j1, k - j1, i + j1, j + j1, k + j1)) {
for (int k1 = -b0; k1 <= b0; ++k1) {
for (int l1 = -b0; l1 <= b0; ++l1) {
for (int i2 = -b0; i2 <= b0; ++i2) {
@@ -30,7 +30,7 @@ public class BlockLeaves extends BlockTransparant {
if (j2 == Block.LEAVES.id) {
int k2 = world.getData(i + k1, j + l1, k + i2);
- world.setRawData(i + k1, j + l1, k + i2, k2 | 8);
+ world.setData(i + k1, j + l1, k + i2, k2 | 8, 4);
}
}
}
@@ -38,7 +38,7 @@ public class BlockLeaves extends BlockTransparant {
}
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
int l = world.getData(i, j, k);
@@ -49,13 +49,13 @@ public class BlockLeaves extends BlockTransparant {
int j1 = b1 * b1;
int k1 = b1 / 2;
- if (this.b == null) {
- this.b = new int[b1 * b1 * b1];
+ if (this.c == null) {
+ this.c = new int[b1 * b1 * b1];
}
int l1;
- if (world.d(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
+ if (world.e(i - i1, j - i1, k - i1, i + i1, j + i1, k + i1)) {
int i2;
int j2;
int k2;
@@ -65,11 +65,11 @@ public class BlockLeaves extends BlockTransparant {
for (j2 = -b0; j2 <= b0; ++j2) {
k2 = world.getTypeId(i + l1, j + i2, k + j2);
if (k2 == Block.LOG.id) {
- this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
+ this.c[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = 0;
} else if (k2 == Block.LEAVES.id) {
- this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
+ this.c[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -2;
} else {
- this.b[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
+ this.c[(l1 + k1) * j1 + (i2 + k1) * b1 + j2 + k1] = -1;
}
}
}
@@ -79,29 +79,29 @@ public class BlockLeaves extends BlockTransparant {
for (i2 = -b0; i2 <= b0; ++i2) {
for (j2 = -b0; j2 <= b0; ++j2) {
for (k2 = -b0; k2 <= b0; ++k2) {
- if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) {
- if (this.b[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
- this.b[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
+ if (this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1] == l1 - 1) {
+ if (this.c[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
+ this.c[(i2 + k1 - 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
}
- if (this.b[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
- this.b[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
+ if (this.c[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] == -2) {
+ this.c[(i2 + k1 + 1) * j1 + (j2 + k1) * b1 + k2 + k1] = l1;
}
- if (this.b[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) {
- this.b[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
+ if (this.c[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] == -2) {
+ this.c[(i2 + k1) * j1 + (j2 + k1 - 1) * b1 + k2 + k1] = l1;
}
- if (this.b[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) {
- this.b[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
+ if (this.c[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] == -2) {
+ this.c[(i2 + k1) * j1 + (j2 + k1 + 1) * b1 + k2 + k1] = l1;
}
- if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) {
- this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
+ if (this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] == -2) {
+ this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + (k2 + k1 - 1)] = l1;
}
- if (this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
- this.b[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
+ if (this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] == -2) {
+ this.c[(i2 + k1) * j1 + (j2 + k1) * b1 + k2 + k1 + 1] = l1;
}
}
}
@@ -110,17 +110,17 @@ public class BlockLeaves extends BlockTransparant {
}
}
- l1 = this.b[k1 * j1 + k1 * b1 + k1];
+ l1 = this.c[k1 * j1 + k1 * b1 + k1];
if (l1 >= 0) {
- world.setRawData(i, j, k, l & -9);
+ world.setData(i, j, k, l & -9, 4);
} else {
- this.l(world, i, j, k);
+ this.k(world, i, j, k);
}
}
}
}
- private void l(World world, int i, int j, int k) {
+ private void k(World world, int i, int j, int k) {
// CraftBukkit start
LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(i, j, k));
world.getServer().getPluginManager().callEvent(event);
@@ -131,7 +131,7 @@ public class BlockLeaves extends BlockTransparant {
// CraftBukkit end
this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
}
public int a(Random random) {
@@ -144,26 +144,41 @@ public class BlockLeaves extends BlockTransparant {
public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
if (!world.isStatic) {
- byte b0 = 20;
+ int j1 = 20;
if ((l & 3) == 3) {
- b0 = 40;
+ j1 = 40;
}
- if (world.random.nextInt(b0) == 0) {
- int j1 = this.getDropType(l, world.random, i1);
+ if (i1 > 0) {
+ j1 -= 2 << i1;
+ if (j1 < 10) {
+ j1 = 10;
+ }
+ }
+
+ if (world.random.nextInt(j1) == 0) {
+ int k1 = this.getDropType(l, world.random, i1);
+
+ this.b(world, i, j, k, new ItemStack(k1, 1, this.getDropData(l)));
+ }
- this.b(world, i, j, k, new ItemStack(j1, 1, this.getDropData(l)));
+ j1 = 200;
+ if (i1 > 0) {
+ j1 -= 10 << i1;
+ if (j1 < 40) {
+ j1 = 40;
+ }
}
- if ((l & 3) == 0 && world.random.nextInt(200) == 0) {
+ if ((l & 3) == 0 && world.random.nextInt(j1) == 0) {
this.b(world, i, j, k, new ItemStack(Item.APPLE, 1, 0));
}
}
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
- if (!world.isStatic && entityhuman.bS() != null && entityhuman.bS().id == Item.SHEARS.id) {
+ if (!world.isStatic && entityhuman.cb() != null && entityhuman.cb().id == Item.SHEARS.id) {
entityhuman.a(StatisticList.C[this.id], 1);
this.b(world, i, j, k, new ItemStack(Block.LEAVES.id, 1, l & 3));
} else {
@@ -176,14 +191,10 @@ public class BlockLeaves extends BlockTransparant {
}
public boolean c() {
- return !this.c;
- }
-
- public int a(int i, int j) {
- return (j & 3) == 1 ? this.textureId + 80 : ((j & 3) == 3 ? this.textureId + 144 : this.textureId);
+ return !this.d;
}
- protected ItemStack f_(int i) {
+ protected ItemStack c_(int i) {
return new ItemStack(this.id, 1, i & 3);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockLever.java b/src/main/java/net/minecraft/server/BlockLever.java
index 11489b14..a225d283 100644
--- a/src/main/java/net/minecraft/server/BlockLever.java
+++ b/src/main/java/net/minecraft/server/BlockLever.java
@@ -4,12 +4,12 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockLever extends Block {
- protected BlockLever(int i, int j) {
- super(i, j, Material.ORIENTABLE);
+ protected BlockLever(int i) {
+ super(i, Material.ORIENTABLE);
this.a(CreativeModeTab.d);
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
@@ -26,46 +26,66 @@ public class BlockLever extends Block {
}
public boolean canPlace(World world, int i, int j, int k, int l) {
- return l == 0 && world.t(i, j + 1, k) ? true : (l == 1 && world.v(i, j - 1, k) ? true : (l == 2 && world.t(i, j, k + 1) ? true : (l == 3 && world.t(i, j, k - 1) ? true : (l == 4 && world.t(i + 1, j, k) ? true : l == 5 && world.t(i - 1, j, k)))));
+ return l == 0 && world.u(i, j + 1, k) ? true : (l == 1 && world.w(i, j - 1, k) ? true : (l == 2 && world.u(i, j, k + 1) ? true : (l == 3 && world.u(i, j, k - 1) ? true : (l == 4 && world.u(i + 1, j, k) ? true : l == 5 && world.u(i - 1, j, k)))));
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.t(i - 1, j, k) ? true : (world.t(i + 1, j, k) ? true : (world.t(i, j, k - 1) ? true : (world.t(i, j, k + 1) ? true : (world.v(i, j - 1, k) ? true : world.t(i, j + 1, k)))));
+ return world.u(i - 1, j, k) ? true : (world.u(i + 1, j, k) ? true : (world.u(i, j, k - 1) ? true : (world.u(i, j, k + 1) ? true : (world.w(i, j - 1, k) ? true : world.u(i, j + 1, k)))));
}
public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
int j1 = i1 & 8;
int k1 = i1 & 7;
+ byte b0 = -1;
- k1 = -1;
- if (l == 0 && world.t(i, j + 1, k)) {
- k1 = world.random.nextBoolean() ? 0 : 7;
+ if (l == 0 && world.u(i, j + 1, k)) {
+ b0 = 0;
}
- if (l == 1 && world.v(i, j - 1, k)) {
- k1 = 5 + world.random.nextInt(2);
+ if (l == 1 && world.w(i, j - 1, k)) {
+ b0 = 5;
}
- if (l == 2 && world.t(i, j, k + 1)) {
- k1 = 4;
+ if (l == 2 && world.u(i, j, k + 1)) {
+ b0 = 4;
}
- if (l == 3 && world.t(i, j, k - 1)) {
- k1 = 3;
+ if (l == 3 && world.u(i, j, k - 1)) {
+ b0 = 3;
}
- if (l == 4 && world.t(i + 1, j, k)) {
- k1 = 2;
+ if (l == 4 && world.u(i + 1, j, k)) {
+ b0 = 2;
}
- if (l == 5 && world.t(i - 1, j, k)) {
- k1 = 1;
+ if (l == 5 && world.u(i - 1, j, k)) {
+ b0 = 1;
}
- return k1 + j1;
+ return b0 + j1;
}
- public static int e(int i) {
+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
+ int l = world.getData(i, j, k);
+ int i1 = l & 7;
+ int j1 = l & 8;
+
+ if (i1 == d(1)) {
+ if ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 1) == 0) {
+ world.setData(i, j, k, 5 | j1, 2);
+ } else {
+ world.setData(i, j, k, 6 | j1, 2);
+ }
+ } else if (i1 == d(0)) {
+ if ((MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 1) == 0) {
+ world.setData(i, j, k, 7 | j1, 2);
+ } else {
+ world.setData(i, j, k, 0 | j1, 2);
+ }
+ }
+ }
+
+ public static int d(int i) {
switch (i) {
case 0:
return 0;
@@ -91,53 +111,53 @@ public class BlockLever extends Block {
}
public void doPhysics(World world, int i, int j, int k, int l) {
- if (this.l(world, i, j, k)) {
+ if (this.k(world, i, j, k)) {
int i1 = world.getData(i, j, k) & 7;
boolean flag = false;
- if (!world.t(i - 1, j, k) && i1 == 1) {
+ if (!world.u(i - 1, j, k) && i1 == 1) {
flag = true;
}
- if (!world.t(i + 1, j, k) && i1 == 2) {
+ if (!world.u(i + 1, j, k) && i1 == 2) {
flag = true;
}
- if (!world.t(i, j, k - 1) && i1 == 3) {
+ if (!world.u(i, j, k - 1) && i1 == 3) {
flag = true;
}
- if (!world.t(i, j, k + 1) && i1 == 4) {
+ if (!world.u(i, j, k + 1) && i1 == 4) {
flag = true;
}
- if (!world.v(i, j - 1, k) && i1 == 5) {
+ if (!world.w(i, j - 1, k) && i1 == 5) {
flag = true;
}
- if (!world.v(i, j - 1, k) && i1 == 6) {
+ if (!world.w(i, j - 1, k) && i1 == 6) {
flag = true;
}
- if (!world.t(i, j + 1, k) && i1 == 0) {
+ if (!world.u(i, j + 1, k) && i1 == 0) {
flag = true;
}
- if (!world.t(i, j + 1, k) && i1 == 7) {
+ if (!world.u(i, j + 1, k) && i1 == 7) {
flag = true;
}
if (flag) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
}
}
}
- private boolean l(World world, int i, int j, int k) {
+ private boolean k(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
return false;
} else {
return true;
@@ -167,8 +187,6 @@ public class BlockLever extends Block {
}
}
- public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {}
-
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
if (world.isStatic) {
return true;
@@ -179,8 +197,8 @@ public class BlockLever extends Block {
// CraftBukkit start - Interact Lever
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
- int old = (k1 != 8) ? 1 : 0;
- int current = (k1 == 8) ? 1 : 0;
+ int old = (k1 != 8) ? 15 : 0;
+ int current = (k1 == 8) ? 15 : 0;
BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, old, current);
world.getServer().getPluginManager().callEvent(eventRedstone);
@@ -190,8 +208,7 @@ public class BlockLever extends Block {
}
// CraftBukkit end
- world.setData(i, j, k, j1 + k1);
- world.e(i, j, k, i, j, k);
+ world.setData(i, j, k, j1 + k1, 3);
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "random.click", 0.3F, k1 > 0 ? 0.6F : 0.5F);
world.applyPhysics(i, j, k, this.id);
if (j1 == 1) {
@@ -239,19 +256,19 @@ public class BlockLever extends Block {
super.remove(world, i, j, k, l, i1);
}
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- return (iblockaccess.getData(i, j, k) & 8) > 0;
+ public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ return (iblockaccess.getData(i, j, k) & 8) > 0 ? 15 : 0;
}
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
int i1 = iblockaccess.getData(i, j, k);
if ((i1 & 8) == 0) {
- return false;
+ return 0;
} else {
int j1 = i1 & 7;
- return j1 == 0 && l == 0 ? true : (j1 == 7 && l == 0 ? true : (j1 == 6 && l == 1 ? true : (j1 == 5 && l == 1 ? true : (j1 == 4 && l == 2 ? true : (j1 == 3 && l == 3 ? true : (j1 == 2 && l == 4 ? true : j1 == 1 && l == 5))))));
+ return j1 == 0 && l == 0 ? 15 : (j1 == 7 && l == 0 ? 15 : (j1 == 6 && l == 1 ? 15 : (j1 == 5 && l == 1 ? 15 : (j1 == 4 && l == 2 ? 15 : (j1 == 3 && l == 3 ? 15 : (j1 == 2 && l == 4 ? 15 : (j1 == 1 && l == 5 ? 15 : 0)))))));
}
}
diff --git a/src/main/java/net/minecraft/server/BlockMinecartDetector.java b/src/main/java/net/minecraft/server/BlockMinecartDetector.java
index 93d13625..3469207e 100644
--- a/src/main/java/net/minecraft/server/BlockMinecartDetector.java
+++ b/src/main/java/net/minecraft/server/BlockMinecartDetector.java
@@ -5,14 +5,14 @@ import java.util.Random;
import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
-public class BlockMinecartDetector extends BlockMinecartTrack {
+public class BlockMinecartDetector extends BlockMinecartTrackAbstract {
- public BlockMinecartDetector(int i, int j) {
- super(i, j, true);
+ public BlockMinecartDetector(int i) {
+ super(i, true);
this.b(true);
}
- public int r_() {
+ public int a(World world) {
return 20;
}
@@ -30,7 +30,7 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
}
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
int l = world.getData(i, j, k);
@@ -40,19 +40,19 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
}
}
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- return (iblockaccess.getData(i, j, k) & 8) != 0;
+ public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ return (iblockaccess.getData(i, j, k) & 8) != 0 ? 15 : 0;
}
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- return (iblockaccess.getData(i, j, k) & 8) == 0 ? false : l == 1;
+ public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ return (iblockaccess.getData(i, j, k) & 8) == 0 ? 0 : (l == 1 ? 15 : 0);
}
private void d(World world, int i, int j, int k, int l) {
boolean flag = (l & 8) != 0;
boolean flag1 = false;
float f = 0.125F;
- List list = world.a(EntityMinecart.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f)));
+ List list = world.a(EntityMinecartAbstract.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f)));
if (!list.isEmpty()) {
flag1 = true;
@@ -62,7 +62,7 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
if (flag != flag1) {
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
- BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 1 : 0, flag1 ? 1 : 0);
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, flag ? 15 : 0, flag1 ? 15 : 0);
world.getServer().getPluginManager().callEvent(eventRedstone);
flag1 = eventRedstone.getNewCurrent() > 0;
@@ -70,21 +70,45 @@ public class BlockMinecartDetector extends BlockMinecartTrack {
// CraftBukkit end
if (flag1 && !flag) {
- world.setData(i, j, k, l | 8);
+ world.setData(i, j, k, l | 8, 3);
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
- world.e(i, j, k, i, j, k);
+ world.g(i, j, k, i, j, k);
}
if (!flag1 && flag) {
- world.setData(i, j, k, l & 7);
+ world.setData(i, j, k, l & 7, 3);
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
- world.e(i, j, k, i, j, k);
+ world.g(i, j, k, i, j, k);
}
if (flag1) {
- world.a(i, j, k, this.id, this.r_());
+ world.a(i, j, k, this.id, this.a(world));
}
+
+ world.m(i, j, k, this.id);
+ }
+
+ public void onPlace(World world, int i, int j, int k) {
+ super.onPlace(world, i, j, k);
+ this.d(world, i, j, k, world.getData(i, j, k));
+ }
+
+ public boolean q_() {
+ return true;
+ }
+
+ public int b_(World world, int i, int j, int k, int l) {
+ if ((world.getData(i, j, k) & 8) > 0) {
+ float f = 0.125F;
+ List list = world.a(EntityMinecartAbstract.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) ((float) (j + 1) - f), (double) ((float) (k + 1) - f)), IEntitySelector.b);
+
+ if (list.size() > 0) {
+ return Container.b((IInventory) list.get(0));
+ }
+ }
+
+ return 0;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockMobSpawner.java b/src/main/java/net/minecraft/server/BlockMobSpawner.java
index fdedbad9..614a3d16 100644
--- a/src/main/java/net/minecraft/server/BlockMobSpawner.java
+++ b/src/main/java/net/minecraft/server/BlockMobSpawner.java
@@ -4,11 +4,11 @@ import java.util.Random;
public class BlockMobSpawner extends BlockContainer {
- protected BlockMobSpawner(int i, int j) {
- super(i, j, Material.STONE);
+ protected BlockMobSpawner(int i) {
+ super(i, Material.STONE);
}
- public TileEntity a(World world) {
+ public TileEntity b(World world) {
return new TileEntityMobSpawner();
}
@@ -25,7 +25,7 @@ public class BlockMobSpawner extends BlockContainer {
/* CraftBukkit start - delegate to getExpDrop
int j1 = 15 + world.random.nextInt(15) + world.random.nextInt(15);
- this.f(world, i, j, k, j1);*/
+ this.j(world, i, j, k, j1);*/
}
public int getExpDrop(World world, int data, int enchantmentLevel) {
diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java
index db908749..872ad003 100644
--- a/src/main/java/net/minecraft/server/BlockMushroom.java
+++ b/src/main/java/net/minecraft/server/BlockMushroom.java
@@ -14,15 +14,18 @@ import org.bukkit.event.world.StructureGrowEvent;
public class BlockMushroom extends BlockFlower {
- protected BlockMushroom(int i, int j) {
- super(i, j);
+ private final String a;
+
+ protected BlockMushroom(int i, String s) {
+ super(i);
+ this.a = s;
float f = 0.2F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
this.b(true);
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
final int sourceX = i, sourceY = j, sourceZ = k; // CraftBukkit
if (random.nextInt(25) == 0) {
byte b0 = 4;
@@ -50,7 +53,7 @@ public class BlockMushroom extends BlockFlower {
k1 = k + random.nextInt(3) - 1;
for (int l1 = 0; l1 < 4; ++l1) {
- if (world.isEmpty(i1, j1, k1) && this.d(world, i1, j1, k1)) {
+ if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
i = i1;
j = j1;
k = k1;
@@ -61,7 +64,7 @@ public class BlockMushroom extends BlockFlower {
k1 = k + random.nextInt(3) - 1;
}
- if (world.isEmpty(i1, j1, k1) && this.d(world, i1, j1, k1)) {
+ if (world.isEmpty(i1, j1, k1) && this.f(world, i1, j1, k1)) {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
@@ -79,18 +82,18 @@ public class BlockMushroom extends BlockFlower {
}
public boolean canPlace(World world, int i, int j, int k) {
- return super.canPlace(world, i, j, k) && this.d(world, i, j, k);
+ return super.canPlace(world, i, j, k) && this.f(world, i, j, k);
}
- protected boolean d_(int i) {
- return Block.q[i];
+ protected boolean f_(int i) {
+ return Block.s[i];
}
- public boolean d(World world, int i, int j, int k) {
+ public boolean f(World world, int i, int j, int k) {
if (j >= 0 && j < 256) {
int l = world.getTypeId(i, j - 1, k);
- return l == Block.MYCEL.id || world.l(i, j, k) < 13 && this.d_(l);
+ return l == Block.MYCEL.id || world.m(i, j, k) < 13 && this.f_(l);
} else {
return false;
}
@@ -100,7 +103,7 @@ public class BlockMushroom extends BlockFlower {
public boolean grow(World world, int i, int j, int k, Random random, boolean bonemeal, org.bukkit.entity.Player player, ItemStack itemstack) {
int l = world.getData(i, j, k);
- world.setRawTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
// CraftBukkit start
boolean grown = false;
StructureGrowEvent event = null;
@@ -122,7 +125,7 @@ public class BlockMushroom extends BlockFlower {
}
}
if (!grown || event.isCancelled()) {
- world.setRawTypeIdAndData(i, j, k, this.id, l);
+ world.setTypeIdAndData(i, j, k, this.id, l, 3);
return false;
}
return true;
diff --git a/src/main/java/net/minecraft/server/BlockMycel.java b/src/main/java/net/minecraft/server/BlockMycel.java
index 6dbf49f7..1de8c83e 100644
--- a/src/main/java/net/minecraft/server/BlockMycel.java
+++ b/src/main/java/net/minecraft/server/BlockMycel.java
@@ -12,16 +12,11 @@ public class BlockMycel extends Block {
protected BlockMycel(int i) {
super(i, Material.GRASS);
- this.textureId = 77;
this.b(true);
this.a(CreativeModeTab.b);
}
- public int a(int i, int j) {
- return i == 1 ? 78 : (i == 0 ? 2 : 77);
- }
-
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
if (world.getLightLevel(i, j + 1, k) < 4 && Block.lightBlock[world.getTypeId(i, j + 1, k)] > 2) {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/BlockNetherWart.java b/src/main/java/net/minecraft/server/BlockNetherWart.java
index 22b8d191..1a87122e 100644
--- a/src/main/java/net/minecraft/server/BlockNetherWart.java
+++ b/src/main/java/net/minecraft/server/BlockNetherWart.java
@@ -4,8 +4,10 @@ import java.util.Random;
public class BlockNetherWart extends BlockFlower {
+ private static final String[] a = new String[] { "netherStalk_0", "netherStalk_1", "netherStalk_2"};
+
protected BlockNetherWart(int i) {
- super(i, 226);
+ super(i);
this.b(true);
float f = 0.5F;
@@ -13,26 +15,22 @@ public class BlockNetherWart extends BlockFlower {
this.a((CreativeModeTab) null);
}
- protected boolean d_(int i) {
+ protected boolean f_(int i) {
return i == Block.SOUL_SAND.id;
}
- public boolean d(World world, int i, int j, int k) {
- return this.d_(world.getTypeId(i, j - 1, k));
+ public boolean f(World world, int i, int j, int k) {
+ return this.f_(world.getTypeId(i, j - 1, k));
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
int l = world.getData(i, j, k);
if (l < 3 && random.nextInt(10) == 0) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
}
- super.b(world, i, j, k, random);
- }
-
- public int a(int i, int j) {
- return j >= 3 ? this.textureId + 2 : (j > 0 ? this.textureId + 1 : this.textureId);
+ super.a(world, i, j, k, random);
}
public int d() {
diff --git a/src/main/java/net/minecraft/server/BlockOre.java b/src/main/java/net/minecraft/server/BlockOre.java
index 7448d166..fb1a1427 100644
--- a/src/main/java/net/minecraft/server/BlockOre.java
+++ b/src/main/java/net/minecraft/server/BlockOre.java
@@ -4,13 +4,13 @@ import java.util.Random;
public class BlockOre extends Block {
- public BlockOre(int i, int j) {
- super(i, j, Material.STONE);
+ public BlockOre(int i) {
+ super(i, Material.STONE);
this.a(CreativeModeTab.b);
}
public int getDropType(int i, Random random, int j) {
- return this.id == Block.COAL_ORE.id ? Item.COAL.id : (this.id == Block.DIAMOND_ORE.id ? Item.DIAMOND.id : (this.id == Block.LAPIS_ORE.id ? Item.INK_SACK.id : (this.id == Block.EMERALD_ORE.id ? Item.EMERALD.id : this.id)));
+ return this.id == Block.COAL_ORE.id ? Item.COAL.id : (this.id == Block.DIAMOND_ORE.id ? Item.DIAMOND.id : (this.id == Block.LAPIS_ORE.id ? Item.INK_SACK.id : (this.id == Block.EMERALD_ORE.id ? Item.EMERALD.id : (this.id == Block.QUARTZ_ORE.id ? Item.QUARTZ.id : this.id))));
}
public int a(Random random) {
@@ -45,9 +45,11 @@ public class BlockOre extends Block {
j1 = MathHelper.nextInt(world.random, 3, 7);
} else if (this.id == Block.LAPIS_ORE.id) {
j1 = MathHelper.nextInt(world.random, 2, 5);
+ } else if (this.id == Block.QUARTZ_ORE.id) {
+ j1 = MathHelper.nextInt(world.random, 2, 5);
}
- this.f(world, i, j, k, j1);
+ this.j(world, i, j, k, j1);
} */
}
@@ -63,6 +65,8 @@ public class BlockOre extends Block {
j1 = MathHelper.nextInt(world.random, 3, 7);
} else if (this.id == Block.LAPIS_ORE.id) {
j1 = MathHelper.nextInt(world.random, 2, 5);
+ } else if (this.id == Block.QUARTZ_ORE.id) {
+ j1 = MathHelper.nextInt(world.random, 2, 5);
}
return j1;
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
index 0f1b5e58..cbafd17c 100644
--- a/src/main/java/net/minecraft/server/BlockPiston.java
+++ b/src/main/java/net/minecraft/server/BlockPiston.java
@@ -10,22 +10,16 @@ import org.bukkit.event.block.BlockPistonExtendEvent;
public class BlockPiston extends Block {
- private boolean a;
+ private final boolean a;
- public BlockPiston(int i, int j, boolean flag) {
- super(i, j, Material.PISTON);
+ public BlockPiston(int i, boolean flag) {
+ super(i, Material.PISTON);
this.a = flag;
- this.a(h);
+ this.a(j);
this.c(0.5F);
this.a(CreativeModeTab.d);
}
- public int a(int i, int j) {
- int k = e(j);
-
- return k > 5 ? this.textureId : (i == k ? (!f(j) && this.minX <= 0.0D && this.minY <= 0.0D && this.minZ <= 0.0D && this.maxX >= 1.0D && this.maxY >= 1.0D && this.maxZ >= 1.0D ? this.textureId : 110) : (i == Facing.OPPOSITE_FACING[k] ? 109 : 108));
- }
-
public int d() {
return 16;
}
@@ -38,37 +32,37 @@ public class BlockPiston extends Block {
return false;
}
- public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
- int l = b(world, i, j, k, (EntityHuman) entityliving);
+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
+ int l = a(world, i, j, k, entityliving);
- world.setData(i, j, k, l);
+ world.setData(i, j, k, l, 2);
if (!world.isStatic) {
- this.l(world, i, j, k);
+ this.k(world, i, j, k);
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
if (!world.isStatic) {
- this.l(world, i, j, k);
+ this.k(world, i, j, k);
}
}
public void onPlace(World world, int i, int j, int k) {
if (!world.isStatic && world.getTileEntity(i, j, k) == null) {
- this.l(world, i, j, k);
+ this.k(world, i, j, k);
}
}
- private void l(World world, int i, int j, int k) {
+ private void k(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
- int i1 = e(l);
+ int i1 = d(l);
if (i1 != 7) {
boolean flag = this.d(world, i, j, k, i1);
- if (flag && !f(l)) {
+ if (flag && !e(l)) {
// CraftBukkit start
- int length = i(world, i, j, k, i1);
+ int length = e(world, i, j, k, i1);
if (length >= 0) {
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
BlockPistonExtendEvent event = new BlockPistonExtendEvent(block, length, CraftBlock.notchToBlockFace(i1));
@@ -81,7 +75,7 @@ public class BlockPiston extends Block {
world.playNote(i, j, k, this.id, 0, i1);
}
- } else if (!flag && f(l)) {
+ } else if (!flag && e(l)) {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, CraftBlock.notchToBlockFace(i1));
@@ -92,29 +86,37 @@ public class BlockPiston extends Block {
}
// CraftBukkit end
+ world.setData(i, j, k, i1, 2);
world.playNote(i, j, k, this.id, 1, i1);
}
}
}
private boolean d(World world, int i, int j, int k, int l) {
- return l != 0 && world.isBlockFaceIndirectlyPowered(i, j - 1, k, 0) ? true : (l != 1 && world.isBlockFaceIndirectlyPowered(i, j + 1, k, 1) ? true : (l != 2 && world.isBlockFaceIndirectlyPowered(i, j, k - 1, 2) ? true : (l != 3 && world.isBlockFaceIndirectlyPowered(i, j, k + 1, 3) ? true : (l != 5 && world.isBlockFaceIndirectlyPowered(i + 1, j, k, 5) ? true : (l != 4 && world.isBlockFaceIndirectlyPowered(i - 1, j, k, 4) ? true : (world.isBlockFaceIndirectlyPowered(i, j, k, 0) ? true : (world.isBlockFaceIndirectlyPowered(i, j + 2, k, 1) ? true : (world.isBlockFaceIndirectlyPowered(i, j + 1, k - 1, 2) ? true : (world.isBlockFaceIndirectlyPowered(i, j + 1, k + 1, 3) ? true : (world.isBlockFaceIndirectlyPowered(i - 1, j + 1, k, 4) ? true : world.isBlockFaceIndirectlyPowered(i + 1, j + 1, k, 5)))))))))));
+ return l != 0 && world.isBlockFacePowered(i, j - 1, k, 0) ? true : (l != 1 && world.isBlockFacePowered(i, j + 1, k, 1) ? true : (l != 2 && world.isBlockFacePowered(i, j, k - 1, 2) ? true : (l != 3 && world.isBlockFacePowered(i, j, k + 1, 3) ? true : (l != 5 && world.isBlockFacePowered(i + 1, j, k, 5) ? true : (l != 4 && world.isBlockFacePowered(i - 1, j, k, 4) ? true : (world.isBlockFacePowered(i, j, k, 0) ? true : (world.isBlockFacePowered(i, j + 2, k, 1) ? true : (world.isBlockFacePowered(i, j + 1, k - 1, 2) ? true : (world.isBlockFacePowered(i, j + 1, k + 1, 3) ? true : (world.isBlockFacePowered(i - 1, j + 1, k, 4) ? true : world.isBlockFacePowered(i + 1, j + 1, k, 5)))))))))));
}
- public void b(World world, int i, int j, int k, int l, int i1) {
- if (l == 0) {
- world.setRawData(i, j, k, i1 | 8);
- } else {
- world.setRawData(i, j, k, i1);
+ public boolean b(World world, int i, int j, int k, int l, int i1) {
+ if (!world.isStatic) {
+ boolean flag = this.d(world, i, j, k, i1);
+
+ if (flag && l == 1) {
+ world.setData(i, j, k, i1 | 8, 2);
+ return false;
+ }
+
+ if (!flag && l == 0) {
+ return false;
+ }
}
if (l == 0) {
- if (this.j(world, i, j, k, i1)) {
- world.setData(i, j, k, i1 | 8);
- world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "tile.piston.out", 0.5F, world.random.nextFloat() * 0.25F + 0.6F);
- } else {
- world.setRawData(i, j, k, i1);
+ if (!this.f(world, i, j, k, i1)) {
+ return false;
}
+
+ world.setData(i, j, k, i1 | 8, 2);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "tile.piston.out", 0.5F, world.random.nextFloat() * 0.25F + 0.6F);
} else if (l == 1) {
TileEntity tileentity = world.getTileEntity(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1]);
@@ -122,7 +124,7 @@ public class BlockPiston extends Block {
((TileEntityPiston) tileentity).f();
}
- world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, i1);
+ world.setTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, i1, 3);
world.setTileEntity(i, j, k, BlockPistonMoving.a(this.id, i1, i1, false, true));
if (this.a) {
int j1 = i + Facing.b[i1] * 2;
@@ -130,7 +132,7 @@ public class BlockPiston extends Block {
int l1 = k + Facing.d[i1] * 2;
int i2 = world.getTypeId(j1, k1, l1);
int j2 = world.getData(j1, k1, l1);
- boolean flag = false;
+ boolean flag1 = false;
if (i2 == Block.PISTON_MOVING.id) {
TileEntity tileentity1 = world.getTileEntity(j1, k1, l1);
@@ -142,34 +144,36 @@ public class BlockPiston extends Block {
tileentitypiston.f();
i2 = tileentitypiston.a();
j2 = tileentitypiston.p();
- flag = true;
+ flag1 = true;
}
}
}
- if (!flag && i2 > 0 && a(i2, world, j1, k1, l1, false) && (Block.byId[i2].q_() == 0 || i2 == Block.PISTON.id || i2 == Block.PISTON_STICKY.id)) {
+ if (!flag1 && i2 > 0 && a(i2, world, j1, k1, l1, false) && (Block.byId[i2].h() == 0 || i2 == Block.PISTON.id || i2 == Block.PISTON_STICKY.id)) {
i += Facing.b[i1];
j += Facing.c[i1];
k += Facing.d[i1];
- world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, j2);
+ world.setTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, j2, 3);
world.setTileEntity(i, j, k, BlockPistonMoving.a(i2, j2, i1, false, false));
- world.setTypeId(j1, k1, l1, 0);
- } else if (!flag) {
- world.setTypeId(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1], 0);
+ world.setAir(j1, k1, l1);
+ } else if (!flag1) {
+ world.setAir(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1]);
}
} else {
- world.setTypeId(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1], 0);
+ world.setAir(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1]);
}
world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "tile.piston.in", 0.5F, world.random.nextFloat() * 0.15F + 0.6F);
}
+
+ return true;
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
- if (f(l)) {
- switch (e(l)) {
+ if (e(l)) {
+ switch (d(l)) {
case 0:
this.a(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F);
break;
@@ -198,7 +202,7 @@ public class BlockPiston extends Block {
}
}
- public void f() {
+ public void g() {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
@@ -207,27 +211,27 @@ public class BlockPiston extends Block {
super.a(world, i, j, k, axisalignedbb, list, entity);
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
- return super.e(world, i, j, k);
+ return super.b(world, i, j, k);
}
public boolean b() {
return false;
}
- public static int e(int i) {
+ public static int d(int i) {
if ((i & 7) >= Facing.OPPOSITE_FACING.length) return 7; // CraftBukkit - check for AIOOB on piston data
return i & 7;
}
- public static boolean f(int i) {
+ public static boolean e(int i) {
return (i & 8) != 0;
}
- public static int b(World world, int i, int j, int k, EntityHuman entityhuman) {
- if (MathHelper.abs((float) entityhuman.locX - (float) i) < 2.0F && MathHelper.abs((float) entityhuman.locZ - (float) k) < 2.0F) {
- double d0 = entityhuman.locY + 1.82D - (double) entityhuman.height;
+ public static int a(World world, int i, int j, int k, EntityLiving entityliving) {
+ if (MathHelper.abs((float) entityliving.locX - (float) i) < 2.0F && MathHelper.abs((float) entityliving.locZ - (float) k) < 2.0F) {
+ double d0 = entityliving.locY + 1.82D - (double) entityliving.height;
if (d0 - (double) j > 2.0D) {
return 1;
@@ -238,7 +242,7 @@ public class BlockPiston extends Block {
}
}
- int l = MathHelper.floor((double) (entityhuman.yaw * 4.0F / 360.0F) + 0.5D) & 3;
+ int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 0.5D) & 3;
return l == 0 ? 2 : (l == 1 ? 5 : (l == 2 ? 3 : (l == 3 ? 4 : 0)));
}
@@ -248,27 +252,31 @@ public class BlockPiston extends Block {
return false;
} else {
if (i != Block.PISTON.id && i != Block.PISTON_STICKY.id) {
- if (Block.byId[i].m(world, j, k, l) == -1.0F) {
+ if (Block.byId[i].l(world, j, k, l) == -1.0F) {
return false;
}
- if (Block.byId[i].q_() == 2) {
+ if (Block.byId[i].h() == 2) {
return false;
}
- if (!flag && Block.byId[i].q_() == 1) {
- return false;
+ if (Block.byId[i].h() == 1) {
+ if (!flag) {
+ return false;
+ }
+
+ return true;
}
- } else if (f(world.getData(j, k, l))) {
+ } else if (e(world.getData(j, k, l))) {
return false;
}
- return !(Block.byId[i] instanceof BlockContainer);
+ return !(Block.byId[i] instanceof IContainer);
}
}
// CraftBukkit - boolean -> int return
- private static int i(World world, int i, int j, int k, int l) {
+ private static int e(World world, int i, int j, int k, int l) {
int i1 = i + Facing.b[l];
int j1 = j + Facing.c[l];
int k1 = k + Facing.d[l];
@@ -287,7 +295,7 @@ public class BlockPiston extends Block {
return -1; // CraftBukkit
}
- if (Block.byId[i2].q_() != 1) {
+ if (Block.byId[i2].h() != 1) {
if (l1 == 12) {
return -1; // CraftBukkit
}
@@ -305,7 +313,7 @@ public class BlockPiston extends Block {
}
}
- private boolean j(World world, int i, int j, int k, int l) {
+ private boolean f(World world, int i, int j, int k, int l) {
int i1 = i + Facing.b[l];
int j1 = j + Facing.c[l];
int k1 = k + Facing.d[l];
@@ -325,7 +333,7 @@ public class BlockPiston extends Block {
return false;
}
- if (Block.byId[i2].q_() != 1) {
+ if (Block.byId[i2].h() != 1) {
if (l1 == 12) {
return false;
}
@@ -338,28 +346,51 @@ public class BlockPiston extends Block {
}
Block.byId[i2].c(world, i1, j1, k1, world.getData(i1, j1, k1), 0);
- world.setTypeId(i1, j1, k1, 0);
+ world.setAir(i1, j1, k1);
}
}
- while (i1 != i || j1 != j || k1 != k) {
- l1 = i1 - Facing.b[l];
- i2 = j1 - Facing.c[l];
- int j2 = k1 - Facing.d[l];
- int k2 = world.getTypeId(l1, i2, j2);
- int l2 = world.getData(l1, i2, j2);
-
- if (k2 == this.id && l1 == i && i2 == j && j2 == k) {
- world.setRawTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l | (this.a ? 8 : 0), false);
+ l1 = i1;
+ i2 = j1;
+ int j2 = k1;
+ int k2 = 0;
+
+ int[] aint;
+ int l2;
+ int i3;
+ int j3;
+
+ for (aint = new int[13]; i1 != i || j1 != j || k1 != k; k1 = j3) {
+ l2 = i1 - Facing.b[l];
+ i3 = j1 - Facing.c[l];
+ j3 = k1 - Facing.d[l];
+ int k3 = world.getTypeId(l2, i3, j3);
+ int l3 = world.getData(l2, i3, j3);
+
+ if (k3 == this.id && l2 == i && i3 == j && j3 == k) {
+ world.setTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l | (this.a ? 8 : 0), 4);
world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(Block.PISTON_EXTENSION.id, l | (this.a ? 8 : 0), l, true, false));
} else {
- world.setRawTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l2, false);
- world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(k2, l2, l, true, false));
+ world.setTypeIdAndData(i1, j1, k1, Block.PISTON_MOVING.id, l3, 4);
+ world.setTileEntity(i1, j1, k1, BlockPistonMoving.a(k3, l3, l, true, false));
}
- i1 = l1;
- j1 = i2;
- k1 = j2;
+ aint[k2++] = k3;
+ i1 = l2;
+ j1 = i3;
+ }
+
+ i1 = l1;
+ j1 = i2;
+ k1 = j2;
+
+ for (k2 = 0; i1 != i || j1 != j || k1 != k; k1 = j3) {
+ l2 = i1 - Facing.b[l];
+ i3 = j1 - Facing.c[l];
+ j3 = k1 - Facing.d[l];
+ world.applyPhysics(l2, i3, j3, aint[k2++]);
+ i1 = l2;
+ j1 = i3;
}
return true;
diff --git a/src/main/java/net/minecraft/server/BlockPistonExtension.java b/src/main/java/net/minecraft/server/BlockPistonExtension.java
index b14548a2..b6475f72 100644
--- a/src/main/java/net/minecraft/server/BlockPistonExtension.java
+++ b/src/main/java/net/minecraft/server/BlockPistonExtension.java
@@ -5,18 +5,18 @@ import java.util.Random;
public class BlockPistonExtension extends Block {
- private int a = -1;
+ private IIcon a = null;
- public BlockPistonExtension(int i, int j) {
- super(i, j, Material.PISTON);
- this.a(h);
+ public BlockPistonExtension(int i) {
+ super(i, Material.PISTON);
+ this.a(j);
this.c(0.5F);
}
public void remove(World world, int i, int j, int k, int l, int i1) {
super.remove(world, i, j, k, l, i1);
if ((i1 & 7) >= Facing.OPPOSITE_FACING.length) return; // CraftBukkit - fix a piston AIOOBE issue
- int j1 = Facing.OPPOSITE_FACING[f(i1)];
+ int j1 = Facing.OPPOSITE_FACING[d(i1)];
i += Facing.b[j1];
j += Facing.c[j1];
@@ -25,19 +25,13 @@ public class BlockPistonExtension extends Block {
if (k1 == Block.PISTON.id || k1 == Block.PISTON_STICKY.id) {
i1 = world.getData(i, j, k);
- if (BlockPiston.f(i1)) {
+ if (BlockPiston.e(i1)) {
Block.byId[k1].c(world, i, j, k, i1, 0);
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
}
}
}
- public int a(int i, int j) {
- int k = f(j);
-
- return i == k ? (this.a >= 0 ? this.a : ((j & 8) != 0 ? this.textureId - 1 : this.textureId)) : (k < 6 && i == Facing.OPPOSITE_FACING[k] ? 107 : 108);
- }
-
public int d() {
return 17;
}
@@ -65,7 +59,7 @@ public class BlockPistonExtension extends Block {
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) {
int l = world.getData(i, j, k);
- switch (f(l)) {
+ switch (d(l)) {
case 0:
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
super.a(world, i, j, k, axisalignedbb, list, entity);
@@ -114,7 +108,7 @@ public class BlockPistonExtension extends Block {
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
- switch (f(l)) {
+ switch (d(l)) {
case 0:
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.25F, 1.0F);
break;
@@ -141,18 +135,18 @@ public class BlockPistonExtension extends Block {
}
public void doPhysics(World world, int i, int j, int k, int l) {
- int i1 = f(world.getData(i, j, k));
+ int i1 = d(world.getData(i, j, k));
if ((i1 & 7) >= Facing.OPPOSITE_FACING.length) return; // CraftBukkit - fix a piston AIOOBE issue
int j1 = world.getTypeId(i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1]);
if (j1 != Block.PISTON.id && j1 != Block.PISTON_STICKY.id) {
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
} else {
Block.byId[j1].doPhysics(world, i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1], l);
}
}
- public static int f(int i) {
+ public static int d(int i) {
return i & 7;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockPortal.java b/src/main/java/net/minecraft/server/BlockPortal.java
index 29d13083..e1a91e74 100644
--- a/src/main/java/net/minecraft/server/BlockPortal.java
+++ b/src/main/java/net/minecraft/server/BlockPortal.java
@@ -9,31 +9,31 @@ import org.bukkit.event.world.PortalCreateEvent;
public class BlockPortal extends BlockHalfTransparant {
- public BlockPortal(int i, int j) {
- super(i, j, Material.PORTAL, false);
+ public BlockPortal(int i) {
+ super(i, "portal", Material.PORTAL, false);
this.b(true);
}
- public void b(World world, int i, int j, int k, Random random) {
- super.b(world, i, j, k, random);
+ public void a(World world, int i, int j, int k, Random random) {
+ super.a(world, i, j, k, random);
if (world.worldProvider.d() && random.nextInt(2000) < world.difficulty) {
int l;
- for (l = j; !world.v(i, l, k) && l > 0; --l) {
+ for (l = j; !world.w(i, l, k) && l > 0; --l) {
;
}
- if (l > 0 && !world.t(i, l + 1, k)) {
+ if (l > 0 && !world.u(i, l + 1, k)) {
Entity entity = ItemMonsterEgg.a(world, 57, (double) i + 0.5D, (double) l + 1.1D, (double) k + 0.5D);
if (entity != null) {
- entity.portalCooldown = entity.ab();
+ entity.portalCooldown = entity.aa();
}
}
}
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
@@ -60,7 +60,7 @@ public class BlockPortal extends BlockHalfTransparant {
return false;
}
- public boolean i_(World world, int i, int j, int k) {
+ public boolean n_(World world, int i, int j, int k) {
byte b0 = 0;
byte b1 = 0;
@@ -123,15 +123,12 @@ public class BlockPortal extends BlockHalfTransparant {
}
// CraftBukkit end
- world.suppressPhysics = true;
-
for (l = 0; l < 2; ++l) {
for (i1 = 0; i1 < 3; ++i1) {
- world.setTypeId(i + b0 * l, j + i1, k + b1 * l, Block.PORTAL.id);
+ world.setTypeIdAndData(i + b0 * l, j + i1, k + b1 * l, Block.PORTAL.id, 0, 2);
}
}
- world.suppressPhysics = false;
return true;
}
}
@@ -152,7 +149,7 @@ public class BlockPortal extends BlockHalfTransparant {
}
if (world.getTypeId(i, i1 - 1, k) != Block.OBSIDIAN.id) {
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
} else {
int j1;
@@ -165,14 +162,14 @@ public class BlockPortal extends BlockHalfTransparant {
boolean flag1 = world.getTypeId(i, j, k - 1) == this.id || world.getTypeId(i, j, k + 1) == this.id;
if (flag && flag1) {
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
} else {
if ((world.getTypeId(i + b0, j, k + b1) != Block.OBSIDIAN.id || world.getTypeId(i - b0, j, k - b1) != this.id) && (world.getTypeId(i - b0, j, k - b1) != Block.OBSIDIAN.id || world.getTypeId(i + b0, j, k + b1) != this.id)) {
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
}
}
} else {
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
}
}
}
@@ -188,7 +185,7 @@ public class BlockPortal extends BlockHalfTransparant {
world.getServer().getPluginManager().callEvent(event);
// CraftBukkit end
- entity.aa();
+ entity.Z();
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlate.java b/src/main/java/net/minecraft/server/BlockPressurePlate.java
deleted file mode 100644
index e4dc8754..00000000
--- a/src/main/java/net/minecraft/server/BlockPressurePlate.java
+++ /dev/null
@@ -1,207 +0,0 @@
-package net.minecraft.server;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Random;
-
-// CraftBukkit start
-import org.bukkit.event.block.BlockRedstoneEvent;
-import org.bukkit.event.entity.EntityInteractEvent;
-// CraftBukkit end
-
-public class BlockPressurePlate extends Block {
-
- private EnumMobType a;
-
- protected BlockPressurePlate(int i, int j, EnumMobType enummobtype, Material material) {
- super(i, j, material);
- this.a = enummobtype;
- this.a(CreativeModeTab.d);
- this.b(true);
- float f = 0.0625F;
-
- this.a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
- }
-
- public int r_() {
- return 20;
- }
-
- public AxisAlignedBB e(World world, int i, int j, int k) {
- return null;
- }
-
- public boolean c() {
- return false;
- }
-
- public boolean b() {
- return false;
- }
-
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
- return true;
- }
-
- public boolean canPlace(World world, int i, int j, int k) {
- return world.v(i, j - 1, k) || BlockFence.c(world.getTypeId(i, j - 1, k));
- }
-
- public void doPhysics(World world, int i, int j, int k, int l) {
- boolean flag = false;
-
- if (!world.v(i, j - 1, k) && !BlockFence.c(world.getTypeId(i, j - 1, k))) {
- flag = true;
- }
-
- if (flag) {
- this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, 0);
- }
- }
-
- public void b(World world, int i, int j, int k, Random random) {
- if (!world.isStatic) {
- if (world.getData(i, j, k) != 0) {
- this.l(world, i, j, k);
- }
- }
- }
-
- public void a(World world, int i, int j, int k, Entity entity) {
- if (!world.isStatic) {
- if (world.getData(i, j, k) != 1) {
- this.l(world, i, j, k);
- }
- }
- }
-
- private void l(World world, int i, int j, int k) {
- boolean flag = world.getData(i, j, k) == 1;
- boolean flag1 = false;
- float f = 0.125F;
- List list = null;
-
- if (this.a == EnumMobType.EVERYTHING) {
- list = world.getEntities((Entity) null, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
- }
-
- if (this.a == EnumMobType.MOBS) {
- list = world.a(EntityLiving.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
- }
-
- if (this.a == EnumMobType.PLAYERS) {
- list = world.a(EntityHuman.class, AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f)));
- }
-
- if (!list.isEmpty()) {
- Iterator iterator = list.iterator();
-
- while (iterator.hasNext()) {
- Entity entity = (Entity) iterator.next();
-
- if (!entity.au()) {
- flag1 = true;
- break;
- }
- }
- }
-
- // CraftBukkit start - Interact Pressure Plate
- org.bukkit.World bworld = world.getWorld();
- org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
-
- if (flag != flag1) {
- if (flag1) {
- for (Object object : list) {
- if (object != null) {
- org.bukkit.event.Cancellable cancellable;
-
- if (object instanceof EntityHuman) {
- cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) object, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
- } else if (object instanceof Entity) {
- cancellable = new EntityInteractEvent(((Entity) object).getBukkitEntity(), bworld.getBlockAt(i, j, k));
- manager.callEvent((EntityInteractEvent) cancellable);
- } else {
- continue;
- }
-
- if (cancellable.isCancelled()) {
- return;
- }
- }
- }
- }
-
- BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(i, j, k), flag ? 1 : 0, flag1 ? 1 : 0);
- manager.callEvent(eventRedstone);
-
- flag1 = eventRedstone.getNewCurrent() > 0;
- }
- // CraftBukkit end
-
- if (flag1 && !flag) {
- world.setData(i, j, k, 1);
- world.applyPhysics(i, j, k, this.id);
- world.applyPhysics(i, j - 1, k, this.id);
- world.e(i, j, k, i, j, k);
- world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
- }
-
- if (!flag1 && flag) {
- world.setData(i, j, k, 0);
- world.applyPhysics(i, j, k, this.id);
- world.applyPhysics(i, j - 1, k, this.id);
- world.e(i, j, k, i, j, k);
- world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
- }
-
- if (flag1) {
- world.a(i, j, k, this.id, this.r_());
- }
- }
-
- public void remove(World world, int i, int j, int k, int l, int i1) {
- if (i1 > 0) {
- world.applyPhysics(i, j, k, this.id);
- world.applyPhysics(i, j - 1, k, this.id);
- }
-
- super.remove(world, i, j, k, l, i1);
- }
-
- public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
- boolean flag = iblockaccess.getData(i, j, k) == 1;
- float f = 0.0625F;
-
- if (flag) {
- this.a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
- } else {
- this.a(f, 0.0F, f, 1.0F - f, 0.0625F, 1.0F - f);
- }
- }
-
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- return iblockaccess.getData(i, j, k) > 0;
- }
-
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- return iblockaccess.getData(i, j, k) == 0 ? false : l == 1;
- }
-
- public boolean isPowerSource() {
- return true;
- }
-
- public void f() {
- float f = 0.5F;
- float f1 = 0.125F;
- float f2 = 0.5F;
-
- this.a(0.5F - f, 0.5F - f1, 0.5F - f2, 0.5F + f, 0.5F + f1, 0.5F + f2);
- }
-
- public int q_() {
- return 1;
- }
-}
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java b/src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java
new file mode 100644
index 00000000..23fb1879
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java
@@ -0,0 +1,174 @@
+package net.minecraft.server;
+
+import java.util.Random;
+
+import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
+
+public abstract class BlockPressurePlateAbstract extends Block {
+
+ private String a;
+
+ protected BlockPressurePlateAbstract(int i, String s, Material material) {
+ super(i, material);
+ this.a = s;
+ this.a(CreativeModeTab.d);
+ this.b(true);
+ this.b_(this.d(15));
+ }
+
+ public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
+ this.b_(iblockaccess.getData(i, j, k));
+ }
+
+ protected void b_(int i) {
+ boolean flag = this.c(i) > 0;
+ float f = 0.0625F;
+
+ if (flag) {
+ this.a(f, 0.0F, f, 1.0F - f, 0.03125F, 1.0F - f);
+ } else {
+ this.a(f, 0.0F, f, 1.0F - f, 0.0625F, 1.0F - f);
+ }
+ }
+
+ public int a(World world) {
+ return 20;
+ }
+
+ public AxisAlignedBB b(World world, int i, int j, int k) {
+ return null;
+ }
+
+ public boolean c() {
+ return false;
+ }
+
+ public boolean b() {
+ return false;
+ }
+
+ public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
+ return true;
+ }
+
+ public boolean canPlace(World world, int i, int j, int k) {
+ return world.w(i, j - 1, k) || BlockFence.l_(world.getTypeId(i, j - 1, k));
+ }
+
+ public void doPhysics(World world, int i, int j, int k, int l) {
+ boolean flag = false;
+
+ if (!world.w(i, j - 1, k) && !BlockFence.l_(world.getTypeId(i, j - 1, k))) {
+ flag = true;
+ }
+
+ if (flag) {
+ this.c(world, i, j, k, world.getData(i, j, k), 0);
+ world.setAir(i, j, k);
+ }
+ }
+
+ public void a(World world, int i, int j, int k, Random random) {
+ if (!world.isStatic) {
+ int l = this.c(world.getData(i, j, k));
+
+ if (l > 0) {
+ this.b(world, i, j, k, l);
+ }
+ }
+ }
+
+ public void a(World world, int i, int j, int k, Entity entity) {
+ if (!world.isStatic) {
+ int l = this.c(world.getData(i, j, k));
+
+ if (l == 0) {
+ this.b(world, i, j, k, l);
+ }
+ }
+ }
+
+ protected void b(World world, int i, int j, int k, int l) {
+ int i1 = this.e(world, i, j, k);
+ boolean flag = l > 0;
+ boolean flag1 = i1 > 0;
+
+ // CraftBukkit start - Interact Pressure Plate
+ org.bukkit.World bworld = world.getWorld();
+ org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
+
+ if (flag != flag1) {
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bworld.getBlockAt(i, j, k), l, i1);
+ manager.callEvent(eventRedstone);
+
+ flag1 = eventRedstone.getNewCurrent() > 0;
+ i1 = eventRedstone.getNewCurrent();
+ }
+ // CraftBukkit end
+
+ if (l != i1) {
+ world.setData(i, j, k, this.d(i1), 2);
+ this.b_(world, i, j, k);
+ world.g(i, j, k, i, j, k);
+ }
+
+ if (!flag1 && flag) {
+ world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.5F);
+ } else if (flag1 && !flag) {
+ world.makeSound((double) i + 0.5D, (double) j + 0.1D, (double) k + 0.5D, "random.click", 0.3F, 0.6F);
+ }
+
+ if (flag1) {
+ world.a(i, j, k, this.id, this.a(world));
+ }
+ }
+
+ protected AxisAlignedBB a(int i, int j, int k) {
+ float f = 0.125F;
+
+ return AxisAlignedBB.a().a((double) ((float) i + f), (double) j, (double) ((float) k + f), (double) ((float) (i + 1) - f), (double) j + 0.25D, (double) ((float) (k + 1) - f));
+ }
+
+ public void remove(World world, int i, int j, int k, int l, int i1) {
+ if (this.c(i1) > 0) {
+ this.b_(world, i, j, k);
+ }
+
+ super.remove(world, i, j, k, l, i1);
+ }
+
+ protected void b_(World world, int i, int j, int k) {
+ world.applyPhysics(i, j, k, this.id);
+ world.applyPhysics(i, j - 1, k, this.id);
+ }
+
+ public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ return this.c(iblockaccess.getData(i, j, k));
+ }
+
+ public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ return l == 1 ? this.c(iblockaccess.getData(i, j, k)) : 0;
+ }
+
+ public boolean isPowerSource() {
+ return true;
+ }
+
+ public void g() {
+ float f = 0.5F;
+ float f1 = 0.125F;
+ float f2 = 0.5F;
+
+ this.a(0.5F - f, 0.5F - f1, 0.5F - f2, 0.5F + f, 0.5F + f1, 0.5F + f2);
+ }
+
+ public int h() {
+ return 1;
+ }
+
+ protected abstract int e(World world, int i, int j, int k);
+
+ protected abstract int c(int i);
+
+ protected abstract int d(int i);
+}
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java b/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java
new file mode 100644
index 00000000..ba7b6605
--- /dev/null
+++ b/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java
@@ -0,0 +1,71 @@
+package net.minecraft.server;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
+
+public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
+
+ private EnumMobType a;
+
+ protected BlockPressurePlateBinary(int i, String s, Material material, EnumMobType enummobtype) {
+ super(i, s, material);
+ this.a = enummobtype;
+ }
+
+ protected int d(int i) {
+ return i > 0 ? 1 : 0;
+ }
+
+ protected int c(int i) {
+ return i == 1 ? 15 : 0;
+ }
+
+ protected int e(World world, int i, int j, int k) {
+ List list = null;
+
+ if (this.a == EnumMobType.EVERYTHING) {
+ list = world.getEntities((Entity) null, this.a(i, j, k));
+ }
+
+ if (this.a == EnumMobType.MOBS) {
+ list = world.a(EntityLiving.class, this.a(i, j, k));
+ }
+
+ if (this.a == EnumMobType.PLAYERS) {
+ list = world.a(EntityHuman.class, this.a(i, j, k));
+ }
+
+ if (!list.isEmpty()) {
+ Iterator iterator = list.iterator();
+
+ while (iterator.hasNext()) {
+ Entity entity = (Entity) iterator.next();
+
+ // CraftBukkit start
+ org.bukkit.World bworld = world.getWorld();
+ org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager();
+ org.bukkit.event.Cancellable cancellable;
+
+ if (entity instanceof EntityHuman) {
+ cancellable = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
+ } else {
+ cancellable = new EntityInteractEvent(entity.getBukkitEntity(), bworld.getBlockAt(i, j, k));
+ manager.callEvent((EntityInteractEvent) cancellable);
+ }
+
+ if (cancellable.isCancelled()) {
+ return 0;
+ }
+ // CraftBukkit end
+
+ if (!entity.at()) {
+ return 15;
+ }
+ }
+ }
+
+ return 0;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/BlockPumpkin.java b/src/main/java/net/minecraft/server/BlockPumpkin.java
index f848a079..6f7788c4 100644
--- a/src/main/java/net/minecraft/server/BlockPumpkin.java
+++ b/src/main/java/net/minecraft/server/BlockPumpkin.java
@@ -10,34 +10,13 @@ public class BlockPumpkin extends BlockDirectional {
private boolean a;
- protected BlockPumpkin(int i, int j, boolean flag) {
+ protected BlockPumpkin(int i, boolean flag) {
super(i, Material.PUMPKIN);
- this.textureId = j;
this.b(true);
this.a = flag;
this.a(CreativeModeTab.b);
}
- public int a(int i, int j) {
- if (i == 1) {
- return this.textureId;
- } else if (i == 0) {
- return this.textureId;
- } else {
- int k = this.textureId + 1 + 16;
-
- if (this.a) {
- ++k;
- }
-
- return j == 2 && i == 2 ? k : (j == 3 && i == 5 ? k : (j == 0 && i == 3 ? k : (j == 1 && i == 4 ? k : this.textureId + 16)));
- }
- }
-
- public int a(int i) {
- return i == 1 ? this.textureId : (i == 0 ? this.textureId : (i == 3 ? this.textureId + 1 + 16 : this.textureId + 16));
- }
-
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
if (world.getTypeId(i, j - 1, k) == Block.SNOW_BLOCK.id && world.getTypeId(i, j - 2, k) == Block.SNOW_BLOCK.id) {
@@ -100,13 +79,13 @@ public class BlockPumpkin extends BlockDirectional {
public boolean canPlace(World world, int i, int j, int k) {
int l = world.getTypeId(i, j, k);
- return (l == 0 || Block.byId[l].material.isReplaceable()) && world.v(i, j - 1, k);
+ return (l == 0 || Block.byId[l].material.isReplaceable()) && world.w(i, j - 1, k);
}
- public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 2.5D) & 3;
- world.setData(i, j, k, l);
+ world.setData(i, j, k, l, 2);
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneLamp.java b/src/main/java/net/minecraft/server/BlockRedstoneLamp.java
index 6bdd14aa..e527e7fa 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneLamp.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneLamp.java
@@ -9,11 +9,10 @@ public class BlockRedstoneLamp extends Block {
private final boolean a;
public BlockRedstoneLamp(int i, boolean flag) {
- super(i, 211, Material.BUILDABLE_GLASS);
+ super(i, Material.BUILDABLE_GLASS);
this.a = flag;
if (flag) {
this.a(1.0F);
- ++this.textureId;
}
}
@@ -28,7 +27,7 @@ public class BlockRedstoneLamp extends Block {
}
// CraftBukkit end
- world.setTypeId(i, j, k, Block.REDSTONE_LAMP_ON.id);
+ world.setTypeIdAndData(i, j, k, Block.REDSTONE_LAMP_ON.id, 0, 2);
}
}
}
@@ -44,12 +43,12 @@ public class BlockRedstoneLamp extends Block {
}
// CraftBukkit end
- world.setTypeId(i, j, k, Block.REDSTONE_LAMP_ON.id);
+ world.setTypeIdAndData(i, j, k, Block.REDSTONE_LAMP_ON.id, 0, 2);
}
}
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic && this.a && !world.isBlockIndirectlyPowered(i, j, k)) {
// CraftBukkit start
if (CraftEventFactory.callRedstoneChange(world, i, j, k, 15, 0).getNewCurrent() != 0) {
@@ -57,7 +56,7 @@ public class BlockRedstoneLamp extends Block {
}
// CraftBukkit end
- world.setTypeId(i, j, k, Block.REDSTONE_LAMP_OFF.id);
+ world.setTypeIdAndData(i, j, k, Block.REDSTONE_LAMP_OFF.id, 0, 2);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneOre.java b/src/main/java/net/minecraft/server/BlockRedstoneOre.java
index 2bb94366..4f059d24 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneOre.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneOre.java
@@ -8,8 +8,8 @@ public class BlockRedstoneOre extends Block {
private boolean a;
- public BlockRedstoneOre(int i, int j, boolean flag) {
- super(i, j, Material.STONE);
+ public BlockRedstoneOre(int i, boolean flag) {
+ super(i, Material.STONE);
if (flag) {
this.b(true);
}
@@ -17,12 +17,12 @@ public class BlockRedstoneOre extends Block {
this.a = flag;
}
- public int r_() {
+ public int a(World world) {
return 30;
}
public void attack(World world, int i, int j, int k, EntityHuman entityhuman) {
- this.l(world, i, j, k);
+ this.k(world, i, j, k);
super.attack(world, i, j, k, entityhuman);
}
@@ -31,14 +31,14 @@ public class BlockRedstoneOre extends Block {
if (entity instanceof EntityHuman) {
org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, i, j, k, -1, null);
if (!event.isCancelled()) {
- this.l(world, i, j, k);
+ this.k(world, i, j, k);
super.b(world, i, j, k, entity);
}
} else {
EntityInteractEvent event = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(i, j, k));
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- this.l(world, i, j, k);
+ this.k(world, i, j, k);
super.b(world, i, j, k, entity);
}
}
@@ -46,20 +46,20 @@ public class BlockRedstoneOre extends Block {
}
public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
- this.l(world, i, j, k);
+ this.k(world, i, j, k);
return super.interact(world, i, j, k, entityhuman, l, f, f1, f2);
}
- private void l(World world, int i, int j, int k) {
- this.n(world, i, j, k);
+ private void k(World world, int i, int j, int k) {
+ this.m(world, i, j, k);
if (this.id == Block.REDSTONE_ORE.id) {
- world.setTypeId(i, j, k, Block.GLOWING_REDSTONE_ORE.id);
+ world.setTypeIdUpdate(i, j, k, Block.GLOWING_REDSTONE_ORE.id);
}
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
if (this.id == Block.GLOWING_REDSTONE_ORE.id) {
- world.setTypeId(i, j, k, Block.REDSTONE_ORE.id);
+ world.setTypeIdUpdate(i, j, k, Block.REDSTONE_ORE.id);
}
}
@@ -81,7 +81,7 @@ public class BlockRedstoneOre extends Block {
if (this.getDropType(l, world.random, i1) != this.id) {
int j1 = 1 + world.random.nextInt(5);
- this.f(world, i, j, k, j1);
+ this.j(world, i, j, k, j1);
} */
}
@@ -96,7 +96,7 @@ public class BlockRedstoneOre extends Block {
// CraftBukkit end
}
- private void n(World world, int i, int j, int k) {
+ private void m(World world, int i, int j, int k) {
Random random = world.random;
double d0 = 0.0625D;
@@ -105,27 +105,27 @@ public class BlockRedstoneOre extends Block {
double d2 = (double) ((float) j + random.nextFloat());
double d3 = (double) ((float) k + random.nextFloat());
- if (l == 0 && !world.s(i, j + 1, k)) {
+ if (l == 0 && !world.t(i, j + 1, k)) {
d2 = (double) (j + 1) + d0;
}
- if (l == 1 && !world.s(i, j - 1, k)) {
+ if (l == 1 && !world.t(i, j - 1, k)) {
d2 = (double) (j + 0) - d0;
}
- if (l == 2 && !world.s(i, j, k + 1)) {
+ if (l == 2 && !world.t(i, j, k + 1)) {
d3 = (double) (k + 1) + d0;
}
- if (l == 3 && !world.s(i, j, k - 1)) {
+ if (l == 3 && !world.t(i, j, k - 1)) {
d3 = (double) (k + 0) - d0;
}
- if (l == 4 && !world.s(i + 1, j, k)) {
+ if (l == 4 && !world.t(i + 1, j, k)) {
d1 = (double) (i + 1) + d0;
}
- if (l == 5 && !world.s(i - 1, j, k)) {
+ if (l == 5 && !world.t(i - 1, j, k)) {
d1 = (double) (i + 0) - d0;
}
@@ -135,7 +135,7 @@ public class BlockRedstoneOre extends Block {
}
}
- protected ItemStack f_(int i) {
+ protected ItemStack c_(int i) {
return new ItemStack(Block.REDSTONE_ORE);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
index 4240ade9..3a560e22 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
@@ -13,10 +13,6 @@ public class BlockRedstoneTorch extends BlockTorch {
private boolean isOn = false;
private static Map b = new HashMap();
- public int a(int i, int j) {
- return i == 1 ? Block.REDSTONE_WIRE.a(i, j) : super.a(i, j);
- }
-
private boolean a(World world, int i, int j, int k, boolean flag) {
if (!b.containsKey(world)) {
b.put(world, new ArrayList());
@@ -44,14 +40,14 @@ public class BlockRedstoneTorch extends BlockTorch {
return false;
}
- protected BlockRedstoneTorch(int i, int j, boolean flag) {
- super(i, j);
+ protected BlockRedstoneTorch(int i, boolean flag) {
+ super(i);
this.isOn = flag;
this.b(true);
this.a((CreativeModeTab) null);
}
- public int r_() {
+ public int a(World world) {
return 2;
}
@@ -81,24 +77,24 @@ public class BlockRedstoneTorch extends BlockTorch {
}
}
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
if (!this.isOn) {
- return false;
+ return 0;
} else {
int i1 = iblockaccess.getData(i, j, k);
- return i1 == 5 && l == 1 ? false : (i1 == 3 && l == 3 ? false : (i1 == 4 && l == 2 ? false : (i1 == 1 && l == 5 ? false : i1 != 2 || l != 4)));
+ return i1 == 5 && l == 1 ? 0 : (i1 == 3 && l == 3 ? 0 : (i1 == 4 && l == 2 ? 0 : (i1 == 1 && l == 5 ? 0 : (i1 == 2 && l == 4 ? 0 : 15))));
}
}
- private boolean l(World world, int i, int j, int k) {
+ private boolean m(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
- return l == 5 && world.isBlockFaceIndirectlyPowered(i, j - 1, k, 0) ? true : (l == 3 && world.isBlockFaceIndirectlyPowered(i, j, k - 1, 2) ? true : (l == 4 && world.isBlockFaceIndirectlyPowered(i, j, k + 1, 3) ? true : (l == 1 && world.isBlockFaceIndirectlyPowered(i - 1, j, k, 4) ? true : l == 2 && world.isBlockFaceIndirectlyPowered(i + 1, j, k, 5))));
+ return l == 5 && world.isBlockFacePowered(i, j - 1, k, 0) ? true : (l == 3 && world.isBlockFacePowered(i, j, k - 1, 2) ? true : (l == 4 && world.isBlockFacePowered(i, j, k + 1, 3) ? true : (l == 1 && world.isBlockFacePowered(i - 1, j, k, 4) ? true : l == 2 && world.isBlockFacePowered(i + 1, j, k, 5))));
}
- public void b(World world, int i, int j, int k, Random random) {
- boolean flag = this.l(world, i, j, k);
+ public void a(World world, int i, int j, int k, Random random) {
+ boolean flag = this.m(world, i, j, k);
List list = (List) b.get(world);
while (list != null && !list.isEmpty() && world.getTime() - ((RedstoneUpdateInfo) list.get(0)).d > 60L) {
@@ -125,7 +121,7 @@ public class BlockRedstoneTorch extends BlockTorch {
}
// CraftBukkit end
- world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k));
+ world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_OFF.id, world.getData(i, j, k), 3);
if (this.a(world, i, j, k, true)) {
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
@@ -149,17 +145,22 @@ public class BlockRedstoneTorch extends BlockTorch {
}
// CraftBukkit end
- world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_ON.id, world.getData(i, j, k));
+ world.setTypeIdAndData(i, j, k, Block.REDSTONE_TORCH_ON.id, world.getData(i, j, k), 3);
}
}
public void doPhysics(World world, int i, int j, int k, int l) {
- super.doPhysics(world, i, j, k, l);
- world.a(i, j, k, this.id, this.r_());
+ if (!this.d(world, i, j, k, l)) {
+ boolean flag = this.m(world, i, j, k);
+
+ if (this.isOn && flag || !this.isOn && !flag) {
+ world.a(i, j, k, this.id, this.a(world));
+ }
+ }
}
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- return l == 0 ? this.b(iblockaccess, i, j, k, l) : false;
+ public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ return l == 0 ? this.b(iblockaccess, i, j, k, l) : 0;
}
public int getDropType(int i, Random random, int j) {
@@ -169,4 +170,8 @@ public class BlockRedstoneTorch extends BlockTorch {
public boolean isPowerSource() {
return true;
}
+
+ public boolean i(int i) {
+ return i == Block.REDSTONE_TORCH_OFF.id || i == Block.REDSTONE_TORCH_ON.id;
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
index 024be8be..856df909 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java
@@ -10,18 +10,14 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockRedstoneWire extends Block {
private boolean a = true;
- private Set b = new java.util.LinkedHashSet(); // CraftBukkit - HashSet -> LinkedHashSet
+ private Set b = new HashSet();
- public BlockRedstoneWire(int i, int j) {
- super(i, j, Material.ORIENTABLE);
+ public BlockRedstoneWire(int i) {
+ super(i, Material.ORIENTABLE);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
}
- public int a(int i, int j) {
- return this.textureId;
- }
-
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
@@ -38,10 +34,10 @@ public class BlockRedstoneWire extends Block {
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.v(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.GLOWSTONE.id;
+ return world.w(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.GLOWSTONE.id;
}
- private void l(World world, int i, int j, int k) {
+ private void k(World world, int i, int j, int k) {
this.a(world, i, j, k, i, j, k);
ArrayList arraylist = new ArrayList(this.b);
@@ -56,56 +52,62 @@ public class BlockRedstoneWire extends Block {
private void a(World world, int i, int j, int k, int l, int i1, int j1) {
int k1 = world.getData(i, j, k);
- int l1 = 0;
+ byte b0 = 0;
+ int l1 = this.getPower(world, l, i1, j1, b0);
this.a = false;
- boolean flag = world.isBlockIndirectlyPowered(i, j, k);
+ int i2 = world.getHighestNeighborSignal(i, j, k);
this.a = true;
- int i2;
- int j2;
- int k2;
+ if (i2 > 0 && i2 > l1 - 1) {
+ l1 = i2;
+ }
- if (flag) {
- l1 = 15;
- } else {
- for (i2 = 0; i2 < 4; ++i2) {
- j2 = i;
- k2 = k;
- if (i2 == 0) {
- j2 = i - 1;
- }
+ int j2 = 0;
- if (i2 == 1) {
- ++j2;
- }
+ for (int k2 = 0; k2 < 4; ++k2) {
+ int l2 = i;
+ int i3 = k;
- if (i2 == 2) {
- k2 = k - 1;
- }
+ if (k2 == 0) {
+ l2 = i - 1;
+ }
- if (i2 == 3) {
- ++k2;
- }
+ if (k2 == 1) {
+ ++l2;
+ }
- if (j2 != l || j != i1 || k2 != j1) {
- l1 = this.getPower(world, j2, j, k2, l1);
- }
+ if (k2 == 2) {
+ i3 = k - 1;
+ }
- if (world.t(j2, j, k2) && !world.t(i, j + 1, k)) {
- if (j2 != l || j + 1 != i1 || k2 != j1) {
- l1 = this.getPower(world, j2, j + 1, k2, l1);
- }
- } else if (!world.t(j2, j, k2) && (j2 != l || j - 1 != i1 || k2 != j1)) {
- l1 = this.getPower(world, j2, j - 1, k2, l1);
- }
+ if (k2 == 3) {
+ ++i3;
}
- if (l1 > 0) {
- --l1;
- } else {
- l1 = 0;
+ if (l2 != l || i3 != j1) {
+ j2 = this.getPower(world, l2, j, i3, j2);
}
+
+ if (world.u(l2, j, i3) && !world.u(i, j + 1, k)) {
+ if ((l2 != l || i3 != j1) && j >= i1) {
+ j2 = this.getPower(world, l2, j + 1, i3, j2);
+ }
+ } else if (!world.u(l2, j, i3) && (l2 != l || i3 != j1) && j <= i1) {
+ j2 = this.getPower(world, l2, j - 1, i3, j2);
+ }
+ }
+
+ if (j2 > l1) {
+ l1 = j2 - 1;
+ } else if (l1 > 0) {
+ --l1;
+ } else {
+ l1 = 0;
+ }
+
+ if (i2 > l1 - 1) {
+ l1 = i2;
}
// CraftBukkit start
@@ -118,72 +120,18 @@ public class BlockRedstoneWire extends Block {
// CraftBukkit end
if (k1 != l1) {
- world.suppressPhysics = true;
- world.setData(i, j, k, l1);
- world.e(i, j, k, i, j, k);
- world.suppressPhysics = false;
-
- for (i2 = 0; i2 < 4; ++i2) {
- j2 = i;
- k2 = k;
- int l2 = j - 1;
-
- if (i2 == 0) {
- j2 = i - 1;
- }
-
- if (i2 == 1) {
- ++j2;
- }
-
- if (i2 == 2) {
- k2 = k - 1;
- }
-
- if (i2 == 3) {
- ++k2;
- }
-
- if (world.t(j2, j, k2)) {
- l2 += 2;
- }
-
- boolean flag1 = false;
- int i3 = this.getPower(world, j2, j, k2, -1);
-
- l1 = world.getData(i, j, k);
- if (l1 > 0) {
- --l1;
- }
-
- if (i3 >= 0 && i3 != l1) {
- this.a(world, j2, j, k2, i, j, k);
- }
-
- i3 = this.getPower(world, j2, l2, k2, -1);
- l1 = world.getData(i, j, k);
- if (l1 > 0) {
- --l1;
- }
-
- if (i3 >= 0 && i3 != l1) {
- this.a(world, j2, l2, k2, i, j, k);
- }
- }
-
- if (k1 < l1 || l1 == 0) {
- this.b.add(new ChunkPosition(i, j, k));
- this.b.add(new ChunkPosition(i - 1, j, k));
- this.b.add(new ChunkPosition(i + 1, j, k));
- this.b.add(new ChunkPosition(i, j - 1, k));
- this.b.add(new ChunkPosition(i, j + 1, k));
- this.b.add(new ChunkPosition(i, j, k - 1));
- this.b.add(new ChunkPosition(i, j, k + 1));
- }
+ world.setData(i, j, k, l1, 2);
+ this.b.add(new ChunkPosition(i, j, k));
+ this.b.add(new ChunkPosition(i - 1, j, k));
+ this.b.add(new ChunkPosition(i + 1, j, k));
+ this.b.add(new ChunkPosition(i, j - 1, k));
+ this.b.add(new ChunkPosition(i, j + 1, k));
+ this.b.add(new ChunkPosition(i, j, k - 1));
+ this.b.add(new ChunkPosition(i, j, k + 1));
}
}
- private void n(World world, int i, int j, int k) {
+ private void m(World world, int i, int j, int k) {
if (world.getTypeId(i, j, k) == this.id) {
world.applyPhysics(i, j, k, this.id);
world.applyPhysics(i - 1, j, k, this.id);
@@ -198,35 +146,35 @@ public class BlockRedstoneWire extends Block {
public void onPlace(World world, int i, int j, int k) {
super.onPlace(world, i, j, k);
if (!world.isStatic) {
- this.l(world, i, j, k);
+ this.k(world, i, j, k);
world.applyPhysics(i, j + 1, k, this.id);
world.applyPhysics(i, j - 1, k, this.id);
- this.n(world, i - 1, j, k);
- this.n(world, i + 1, j, k);
- this.n(world, i, j, k - 1);
- this.n(world, i, j, k + 1);
- if (world.t(i - 1, j, k)) {
- this.n(world, i - 1, j + 1, k);
+ this.m(world, i - 1, j, k);
+ this.m(world, i + 1, j, k);
+ this.m(world, i, j, k - 1);
+ this.m(world, i, j, k + 1);
+ if (world.u(i - 1, j, k)) {
+ this.m(world, i - 1, j + 1, k);
} else {
- this.n(world, i - 1, j - 1, k);
+ this.m(world, i - 1, j - 1, k);
}
- if (world.t(i + 1, j, k)) {
- this.n(world, i + 1, j + 1, k);
+ if (world.u(i + 1, j, k)) {
+ this.m(world, i + 1, j + 1, k);
} else {
- this.n(world, i + 1, j - 1, k);
+ this.m(world, i + 1, j - 1, k);
}
- if (world.t(i, j, k - 1)) {
- this.n(world, i, j + 1, k - 1);
+ if (world.u(i, j, k - 1)) {
+ this.m(world, i, j + 1, k - 1);
} else {
- this.n(world, i, j - 1, k - 1);
+ this.m(world, i, j - 1, k - 1);
}
- if (world.t(i, j, k + 1)) {
- this.n(world, i, j + 1, k + 1);
+ if (world.u(i, j, k + 1)) {
+ this.m(world, i, j + 1, k + 1);
} else {
- this.n(world, i, j - 1, k + 1);
+ this.m(world, i, j - 1, k + 1);
}
}
}
@@ -240,33 +188,33 @@ public class BlockRedstoneWire extends Block {
world.applyPhysics(i - 1, j, k, this.id);
world.applyPhysics(i, j, k + 1, this.id);
world.applyPhysics(i, j, k - 1, this.id);
- this.l(world, i, j, k);
- this.n(world, i - 1, j, k);
- this.n(world, i + 1, j, k);
- this.n(world, i, j, k - 1);
- this.n(world, i, j, k + 1);
- if (world.t(i - 1, j, k)) {
- this.n(world, i - 1, j + 1, k);
+ this.k(world, i, j, k);
+ this.m(world, i - 1, j, k);
+ this.m(world, i + 1, j, k);
+ this.m(world, i, j, k - 1);
+ this.m(world, i, j, k + 1);
+ if (world.u(i - 1, j, k)) {
+ this.m(world, i - 1, j + 1, k);
} else {
- this.n(world, i - 1, j - 1, k);
+ this.m(world, i - 1, j - 1, k);
}
- if (world.t(i + 1, j, k)) {
- this.n(world, i + 1, j + 1, k);
+ if (world.u(i + 1, j, k)) {
+ this.m(world, i + 1, j + 1, k);
} else {
- this.n(world, i + 1, j - 1, k);
+ this.m(world, i + 1, j - 1, k);
}
- if (world.t(i, j, k - 1)) {
- this.n(world, i, j + 1, k - 1);
+ if (world.u(i, j, k - 1)) {
+ this.m(world, i, j + 1, k - 1);
} else {
- this.n(world, i, j - 1, k - 1);
+ this.m(world, i, j - 1, k - 1);
}
- if (world.t(i, j, k + 1)) {
- this.n(world, i, j + 1, k + 1);
+ if (world.u(i, j, k + 1)) {
+ this.m(world, i, j + 1, k + 1);
} else {
- this.n(world, i, j - 1, k + 1);
+ this.m(world, i, j - 1, k + 1);
}
}
}
@@ -284,14 +232,13 @@ public class BlockRedstoneWire extends Block {
public void doPhysics(World world, int i, int j, int k, int l) {
if (!world.isStatic) {
- int i1 = world.getData(i, j, k);
boolean flag = this.canPlace(world, i, j, k);
if (flag) {
- this.l(world, i, j, k);
+ this.k(world, i, j, k);
} else {
- this.c(world, i, j, k, i1, 0);
- world.setTypeId(i, j, k, 0);
+ this.c(world, i, j, k, 0, 0);
+ world.setAir(i, j, k);
}
super.doPhysics(world, i, j, k, l);
@@ -302,42 +249,46 @@ public class BlockRedstoneWire extends Block {
return Item.REDSTONE.id;
}
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- return !this.a ? false : this.b(iblockaccess, i, j, k, l);
+ public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ return !this.a ? 0 : this.b(iblockaccess, i, j, k, l);
}
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
if (!this.a) {
- return false;
- } else if (iblockaccess.getData(i, j, k) == 0) {
- return false;
- } else if (l == 1) {
- return true;
+ return 0;
} else {
- boolean flag = g(iblockaccess, i - 1, j, k, 1) || !iblockaccess.t(i - 1, j, k) && g(iblockaccess, i - 1, j - 1, k, -1);
- boolean flag1 = g(iblockaccess, i + 1, j, k, 3) || !iblockaccess.t(i + 1, j, k) && g(iblockaccess, i + 1, j - 1, k, -1);
- boolean flag2 = g(iblockaccess, i, j, k - 1, 2) || !iblockaccess.t(i, j, k - 1) && g(iblockaccess, i, j - 1, k - 1, -1);
- boolean flag3 = g(iblockaccess, i, j, k + 1, 0) || !iblockaccess.t(i, j, k + 1) && g(iblockaccess, i, j - 1, k + 1, -1);
-
- if (!iblockaccess.t(i, j + 1, k)) {
- if (iblockaccess.t(i - 1, j, k) && g(iblockaccess, i - 1, j + 1, k, -1)) {
- flag = true;
- }
+ int i1 = iblockaccess.getData(i, j, k);
- if (iblockaccess.t(i + 1, j, k) && g(iblockaccess, i + 1, j + 1, k, -1)) {
- flag1 = true;
- }
+ if (i1 == 0) {
+ return 0;
+ } else if (l == 1) {
+ return i1;
+ } else {
+ boolean flag = g(iblockaccess, i - 1, j, k, 1) || !iblockaccess.u(i - 1, j, k) && g(iblockaccess, i - 1, j - 1, k, -1);
+ boolean flag1 = g(iblockaccess, i + 1, j, k, 3) || !iblockaccess.u(i + 1, j, k) && g(iblockaccess, i + 1, j - 1, k, -1);
+ boolean flag2 = g(iblockaccess, i, j, k - 1, 2) || !iblockaccess.u(i, j, k - 1) && g(iblockaccess, i, j - 1, k - 1, -1);
+ boolean flag3 = g(iblockaccess, i, j, k + 1, 0) || !iblockaccess.u(i, j, k + 1) && g(iblockaccess, i, j - 1, k + 1, -1);
+
+ if (!iblockaccess.u(i, j + 1, k)) {
+ if (iblockaccess.u(i - 1, j, k) && g(iblockaccess, i - 1, j + 1, k, -1)) {
+ flag = true;
+ }
- if (iblockaccess.t(i, j, k - 1) && g(iblockaccess, i, j + 1, k - 1, -1)) {
- flag2 = true;
- }
+ if (iblockaccess.u(i + 1, j, k) && g(iblockaccess, i + 1, j + 1, k, -1)) {
+ flag1 = true;
+ }
+
+ if (iblockaccess.u(i, j, k - 1) && g(iblockaccess, i, j + 1, k - 1, -1)) {
+ flag2 = true;
+ }
- if (iblockaccess.t(i, j, k + 1) && g(iblockaccess, i, j + 1, k + 1, -1)) {
- flag3 = true;
+ if (iblockaccess.u(i, j, k + 1) && g(iblockaccess, i, j + 1, k + 1, -1)) {
+ flag3 = true;
+ }
}
- }
- return !flag2 && !flag1 && !flag && !flag3 && l >= 2 && l <= 5 ? true : (l == 2 && flag2 && !flag && !flag1 ? true : (l == 3 && flag3 && !flag && !flag1 ? true : (l == 4 && flag && !flag2 && !flag3 ? true : l == 5 && flag1 && !flag2 && !flag3)));
+ return !flag2 && !flag1 && !flag && !flag3 && l >= 2 && l <= 5 ? i1 : (l == 2 && flag2 && !flag && !flag1 ? i1 : (l == 3 && flag3 && !flag && !flag1 ? i1 : (l == 4 && flag && !flag2 && !flag3 ? i1 : (l == 5 && flag1 && !flag2 && !flag3 ? i1 : 0))));
+ }
}
}
@@ -352,7 +303,7 @@ public class BlockRedstoneWire extends Block {
return true;
} else if (i1 == 0) {
return false;
- } else if (i1 != Block.DIODE_OFF.id && i1 != Block.DIODE_ON.id) {
+ } else if (!Block.DIODE_OFF.g(i1)) {
return Block.byId[i1].isPowerSource() && l != -1;
} else {
int j1 = iblockaccess.getData(i, j, k);
diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java
index 399050ab..86578601 100644
--- a/src/main/java/net/minecraft/server/BlockReed.java
+++ b/src/main/java/net/minecraft/server/BlockReed.java
@@ -4,16 +4,15 @@ import java.util.Random;
public class BlockReed extends Block {
- protected BlockReed(int i, int j) {
+ protected BlockReed(int i) {
super(i, Material.PLANT);
- this.textureId = j;
float f = 0.375F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 1.0F, 0.5F + f);
this.b(true);
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
if (world.isEmpty(i, j + 1, k)) {
int l;
@@ -26,9 +25,9 @@ public class BlockReed extends Block {
if (i1 == 15) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j + 1, k, this.id, 0); // CraftBukkit
- world.setData(i, j, k, 0);
+ world.setData(i, j, k, 0, 4);
} else {
- world.setData(i, j, k, i1 + 1);
+ world.setData(i, j, k, i1 + 1, 4);
}
}
}
@@ -41,21 +40,21 @@ public class BlockReed extends Block {
}
public void doPhysics(World world, int i, int j, int k, int l) {
- this.k_(world, i, j, k);
+ this.p_(world, i, j, k);
}
- protected final void k_(World world, int i, int j, int k) {
- if (!this.d(world, i, j, k)) {
+ protected final void p_(World world, int i, int j, int k) {
+ if (!this.f(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
}
}
- public boolean d(World world, int i, int j, int k) {
+ public boolean f(World world, int i, int j, int k) {
return this.canPlace(world, i, j, k);
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
diff --git a/src/main/java/net/minecraft/server/BlockSand.java b/src/main/java/net/minecraft/server/BlockSand.java
deleted file mode 100644
index 44c11484..00000000
--- a/src/main/java/net/minecraft/server/BlockSand.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package net.minecraft.server;
-
-import java.util.Random;
-
-public class BlockSand extends Block {
-
- public static boolean instaFall = false;
-
- public BlockSand(int i, int j) {
- super(i, j, Material.SAND);
- this.a(CreativeModeTab.b);
- }
-
- public BlockSand(int i, int j, Material material) {
- super(i, j, material);
- }
-
- public void onPlace(World world, int i, int j, int k) {
- world.a(i, j, k, this.id, this.r_());
- }
-
- public void doPhysics(World world, int i, int j, int k, int l) {
- world.a(i, j, k, this.id, this.r_());
- }
-
- public void b(World world, int i, int j, int k, Random random) {
- if (!world.isStatic) {
- this.l(world, i, j, k);
- }
- }
-
- private void l(World world, int i, int j, int k) {
- if (canFall(world, i, j - 1, k) && j >= 0) {
- byte b0 = 32;
-
- if (!instaFall && world.d(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
- if (!world.isStatic) {
- EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.id, world.getData(i, j, k));
-
- this.a(entityfallingblock);
- world.addEntity(entityfallingblock);
- }
- } else {
- world.setTypeId(i, j, k, 0);
-
- while (canFall(world, i, j - 1, k) && j > 0) {
- --j;
- }
-
- if (j > 0) {
- world.setTypeId(i, j, k, this.id);
- }
- }
- }
- }
-
- protected void a(EntityFallingBlock entityfallingblock) {}
-
- public int r_() {
- return 5;
- }
-
- public static boolean canFall(World world, int i, int j, int k) {
- int l = world.getTypeId(i, j, k);
-
- if (l == 0) {
- return true;
- } else if (l == Block.FIRE.id) {
- return true;
- } else {
- Material material = Block.byId[l].material;
-
- return material == Material.WATER ? true : material == Material.LAVA;
- }
- }
-
- public void a_(World world, int i, int j, int k, int l) {}
-}
diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java
index 9c94399e..42646300 100644
--- a/src/main/java/net/minecraft/server/BlockSapling.java
+++ b/src/main/java/net/minecraft/server/BlockSapling.java
@@ -12,38 +12,40 @@ import org.bukkit.event.world.StructureGrowEvent;
public class BlockSapling extends BlockFlower {
public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle"};
+ private static final String[] b = new String[] { "sapling", "sapling_spruce", "sapling_birch", "sapling_jungle"};
- protected BlockSapling(int i, int j) {
- super(i, j);
+ protected BlockSapling(int i) {
+ super(i);
float f = 0.4F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
this.a(CreativeModeTab.c);
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
- super.b(world, i, j, k, random);
+ super.a(world, i, j, k, random);
if (world.getLightLevel(i, j + 1, k) >= 9 && random.nextInt(7) == 0) {
- int l = world.getData(i, j, k);
-
- if ((l & 8) == 0) {
- world.setData(i, j, k, l | 8);
- } else {
- this.grow(world, i, j, k, random, false, null, null); // CraftBukkit - added bonemeal, player and itemstack
- }
+ this.grow(world, i, j, k, random, false, null, null); // CraftBukkit - added bonemeal, player and itemstack
}
}
}
- public int a(int i, int j) {
- j &= 3;
- return j == 1 ? 63 : (j == 2 ? 79 : (j == 3 ? 30 : super.a(i, j)));
+ // CraftBukkit - added bonemeal, player and itemstack
+ public void grow(World world, int i, int j, int k, Random random, boolean bonemeal, org.bukkit.entity.Player player, ItemStack itemstack) {
+ int l = world.getData(i, j, k);
+
+ if ((l & 8) == 0) {
+ world.setData(i, j, k, l | 8, 4);
+ } else {
+ this.d(world, i, j, k, random, bonemeal, player, itemstack); // CraftBukkit
+ }
}
// CraftBukkit - added bonemeal, player and itemstack
- public void grow(World world, int i, int j, int k, Random random, boolean bonemeal, org.bukkit.entity.Player player, ItemStack itemstack) {
+ public void d(World world, int i, int j, int k, Random random, boolean bonemeal, org.bukkit.entity.Player player, ItemStack itemstack) {
int l = world.getData(i, j, k) & 3;
+ Object object = null;
int i1 = 0;
int j1 = 0;
boolean flag = false;
@@ -91,12 +93,12 @@ public class BlockSapling extends BlockFlower {
}
if (flag) {
- world.setRawTypeId(i + i1, j, k + j1, 0);
- world.setRawTypeId(i + i1 + 1, j, k + j1, 0);
- world.setRawTypeId(i + i1, j, k + j1 + 1, 0);
- world.setRawTypeId(i + i1 + 1, j, k + j1 + 1, 0);
+ world.setTypeIdAndData(i + i1, j, k + j1, 0, 0, 4);
+ world.setTypeIdAndData(i + i1 + 1, j, k + j1, 0, 0, 4);
+ world.setTypeIdAndData(i + i1, j, k + j1 + 1, 0, 0, 4);
+ world.setTypeIdAndData(i + i1 + 1, j, k + j1 + 1, 0, 0, 4);
} else {
- world.setRawTypeId(i, j, k, 0);
+ world.setTypeIdAndData(i, j, k, 0, 0, 4);
}
grownTree = gen.generate(delegate, random, i + i1, j, k + j1);
@@ -117,12 +119,12 @@ public class BlockSapling extends BlockFlower {
}
if (!grownTree) {
if (flag) {
- world.setRawTypeIdAndData(i + i1, j, k + j1, this.id, l);
- world.setRawTypeIdAndData(i + i1 + 1, j, k + j1, this.id, l);
- world.setRawTypeIdAndData(i + i1, j, k + j1 + 1, this.id, l);
- world.setRawTypeIdAndData(i + i1 + 1, j, k + j1 + 1, this.id, l);
+ world.setTypeIdAndData(i + i1, j, k + j1, this.id, l, 4);
+ world.setTypeIdAndData(i + i1 + 1, j, k + j1, this.id, l, 4);
+ world.setTypeIdAndData(i + i1, j, k + j1 + 1, this.id, l, 4);
+ world.setTypeIdAndData(i + i1 + 1, j, k + j1 + 1, this.id, l, 4);
} else {
- world.setRawTypeIdAndData(i, j, k, this.id, l);
+ world.setTypeIdAndData(i, j, k, this.id, l, 4);
}
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/BlockSign.java b/src/main/java/net/minecraft/server/BlockSign.java
index 5e6ce37e..33dd19c1 100644
--- a/src/main/java/net/minecraft/server/BlockSign.java
+++ b/src/main/java/net/minecraft/server/BlockSign.java
@@ -12,7 +12,6 @@ public class BlockSign extends BlockContainer {
protected BlockSign(int i, Class oclass, boolean flag) {
super(i, Material.WOOD);
this.b = flag;
- this.textureId = 4;
this.a = oclass;
float f = 0.25F;
float f1 = 1.0F;
@@ -20,7 +19,7 @@ public class BlockSign extends BlockContainer {
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f1, 0.5F + f);
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
@@ -60,7 +59,7 @@ public class BlockSign extends BlockContainer {
return false;
}
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
+ public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return true;
}
@@ -68,7 +67,7 @@ public class BlockSign extends BlockContainer {
return false;
}
- public TileEntity a(World world) {
+ public TileEntity b(World world) {
try {
return (TileEntity) this.a.newInstance();
} catch (Exception exception) {
@@ -110,7 +109,7 @@ public class BlockSign extends BlockContainer {
if (flag) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
}
super.doPhysics(world, i, j, k, l);
diff --git a/src/main/java/net/minecraft/server/BlockSkull.java b/src/main/java/net/minecraft/server/BlockSkull.java
index de166a1b..933f49ae 100644
--- a/src/main/java/net/minecraft/server/BlockSkull.java
+++ b/src/main/java/net/minecraft/server/BlockSkull.java
@@ -11,7 +11,6 @@ public class BlockSkull extends BlockContainer {
protected BlockSkull(int i) {
super(i, Material.ORIENTABLE);
- this.textureId = 104;
this.a(0.25F, 0.0F, 0.25F, 0.75F, 0.5F, 0.75F);
}
@@ -53,18 +52,18 @@ public class BlockSkull extends BlockContainer {
}
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
- return super.e(world, i, j, k);
+ return super.b(world, i, j, k);
}
- public void postPlace(World world, int i, int j, int k, EntityLiving entityliving) {
+ public void postPlace(World world, int i, int j, int k, EntityLiving entityliving, ItemStack itemstack) {
int l = MathHelper.floor((double) (entityliving.yaw * 4.0F / 360.0F) + 2.5D) & 3;
- world.setData(i, j, k, l);
+ world.setData(i, j, k, l, 2);
}
- public TileEntity a(World world) {
+ public TileEntity b(World world) {
return new TileEntitySkull();
}
@@ -97,7 +96,7 @@ public class BlockSkull extends BlockContainer {
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
if (entityhuman.abilities.canInstantlyBuild) {
l |= 8;
- world.setData(i, j, k, l);
+ world.setData(i, j, k, l, 4);
}
super.a(world, i, j, k, l, entityhuman);
@@ -128,7 +127,7 @@ public class BlockSkull extends BlockContainer {
}
public void a(World world, int i, int j, int k, TileEntitySkull tileentityskull) {
- if (tileentityskull.getSkullType() == 1 && j >= 2 && world.difficulty > 0) {
+ if (tileentityskull.getSkullType() == 1 && j >= 2 && world.difficulty > 0 && !world.isStatic) {
int l = Block.SOUL_SAND.id;
int i1;
@@ -140,9 +139,9 @@ public class BlockSkull extends BlockContainer {
// CraftBukkit start - use BlockStateListPopulator
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
- world.setRawData(i, j, k + i1, 8);
- world.setRawData(i, j, k + i1 + 1, 8);
- world.setRawData(i, j, k + i1 + 2, 8);
+ world.setData(i, j, k + i1, 8, 2);
+ world.setData(i, j, k + i1 + 1, 8, 2);
+ world.setData(i, j, k + i1 + 2, 8, 2);
blockList.setTypeId(i, j, k + i1, 0);
blockList.setTypeId(i, j, k + i1 + 1, 0);
@@ -155,7 +154,7 @@ public class BlockSkull extends BlockContainer {
if (!world.isStatic) {
entitywither = new EntityWither(world);
entitywither.setPositionRotation((double) i + 0.5D, (double) j - 1.45D, (double) (k + i1) + 1.5D, 90.0F, 0.0F);
- entitywither.ax = 90.0F;
+ entitywither.ay = 90.0F;
entitywither.m();
if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
@@ -177,9 +176,9 @@ public class BlockSkull extends BlockContainer {
// CraftBukkit start - use BlockStateListPopulator
BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld());
- world.setRawData(i + i1, j, k, 8);
- world.setRawData(i + i1 + 1, j, k, 8);
- world.setRawData(i + i1 + 2, j, k, 8);
+ world.setData(i + i1, j, k, 8, 2);
+ world.setData(i + i1 + 1, j, k, 8, 2);
+ world.setData(i + i1 + 2, j, k, 8, 2);
blockList.setTypeId(i + i1, j, k, 0);
blockList.setTypeId(i + i1 + 1, j, k, 0);
diff --git a/src/main/java/net/minecraft/server/BlockSnow.java b/src/main/java/net/minecraft/server/BlockSnow.java
index eacb1485..5b913cb2 100644
--- a/src/main/java/net/minecraft/server/BlockSnow.java
+++ b/src/main/java/net/minecraft/server/BlockSnow.java
@@ -4,17 +4,19 @@ import java.util.Random;
public class BlockSnow extends Block {
- protected BlockSnow(int i, int j) {
- super(i, j, Material.SNOW_LAYER);
+ protected BlockSnow(int i) {
+ super(i, Material.SNOW_LAYER);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
this.b(true);
this.a(CreativeModeTab.c);
+ this.d(0);
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
int l = world.getData(i, j, k) & 7;
+ float f = 0.125F;
- return l >= 3 ? AxisAlignedBB.a().a((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) ((float) j + 0.5F), (double) k + this.maxZ) : null;
+ return AxisAlignedBB.a().a((double) i + this.minX, (double) j + this.minY, (double) k + this.minZ, (double) i + this.maxX, (double) ((float) j + (float) l * f), (double) k + this.maxZ);
}
public boolean c() {
@@ -25,9 +27,17 @@ public class BlockSnow extends Block {
return false;
}
+ public void g() {
+ this.d(0);
+ }
+
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
- int l = iblockaccess.getData(i, j, k) & 7;
- float f = (float) (2 * (1 + l)) / 16.0F;
+ this.d(iblockaccess.getData(i, j, k));
+ }
+
+ protected void d(int i) {
+ int j = i & 7;
+ float f = (float) (2 * (1 + j)) / 16.0F;
this.a(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
}
@@ -35,18 +45,17 @@ public class BlockSnow extends Block {
public boolean canPlace(World world, int i, int j, int k) {
int l = world.getTypeId(i, j - 1, k);
- return l != 0 && (l == Block.LEAVES.id || Block.byId[l].c()) ? world.getMaterial(i, j - 1, k).isSolid() : false;
+ return l == 0 ? false : (l == this.id && (world.getData(i, j - 1, k) & 7) == 7 ? true : (l != Block.LEAVES.id && !Block.byId[l].c() ? false : world.getMaterial(i, j - 1, k).isSolid()));
}
public void doPhysics(World world, int i, int j, int k, int l) {
- this.n(world, i, j, k);
+ this.m(world, i, j, k);
}
- private boolean n(World world, int i, int j, int k) {
+ private boolean m(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setRawTypeId(i, j, k, 0); // CraftBukkit
- world.notify(i, j, k); // CraftBukkit - Notify clients of the reversion
+ world.setAir(i, j, k);
return false;
} else {
return true;
@@ -55,9 +64,10 @@ public class BlockSnow extends Block {
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
int i1 = Item.SNOW_BALL.id;
+ int j1 = l & 7;
- this.b(world, i, j, k, new ItemStack(i1, 1, 0));
- world.setTypeId(i, j, k, 0);
+ this.b(world, i, j, k, new ItemStack(i1, j1 + 1, 0));
+ world.setAir(i, j, k);
entityhuman.a(StatisticList.C[this.id], 1);
}
@@ -69,7 +79,7 @@ public class BlockSnow extends Block {
return 0;
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
if (world.b(EnumSkyBlock.BLOCK, i, j, k) > 11) {
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(i, j, k), 0).isCancelled()) {
@@ -78,7 +88,7 @@ public class BlockSnow extends Block {
// CraftBukkit end
this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockSoil.java b/src/main/java/net/minecraft/server/BlockSoil.java
index 21641570..8da8e112 100644
--- a/src/main/java/net/minecraft/server/BlockSoil.java
+++ b/src/main/java/net/minecraft/server/BlockSoil.java
@@ -11,13 +11,12 @@ public class BlockSoil extends Block {
protected BlockSoil(int i) {
super(i, Material.EARTH);
- this.textureId = 87;
this.b(true);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.9375F, 1.0F);
- this.h(255);
+ this.k(255);
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
return AxisAlignedBB.a().a((double) (i + 0), (double) (j + 0), (double) (k + 0), (double) (i + 1), (double) (j + 1), (double) (k + 1));
}
@@ -29,17 +28,13 @@ public class BlockSoil extends Block {
return false;
}
- public int a(int i, int j) {
- return i == 1 && j > 0 ? this.textureId - 1 : (i == 1 ? this.textureId : 2);
- }
-
- public void b(World world, int i, int j, int k, Random random) {
- if (!this.n(world, i, j, k) && !world.D(i, j + 1, k)) {
+ public void a(World world, int i, int j, int k, Random random) {
+ if (!this.m(world, i, j, k) && !world.F(i, j + 1, k)) {
int l = world.getData(i, j, k);
if (l > 0) {
- world.setData(i, j, k, l - 1);
- } else if (!this.l(world, i, j, k)) {
+ world.setData(i, j, k, l - 1, 2);
+ } else if (!this.k(world, i, j, k)) {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
if (CraftEventFactory.callBlockFadeEvent(block, Block.DIRT.id).isCancelled()) {
@@ -47,10 +42,10 @@ public class BlockSoil extends Block {
}
// CraftBukkit end
- world.setTypeId(i, j, k, Block.DIRT.id);
+ world.setTypeIdUpdate(i, j, k, Block.DIRT.id);
}
} else {
- world.setData(i, j, k, 7);
+ world.setData(i, j, k, 7, 2);
}
}
@@ -74,11 +69,11 @@ public class BlockSoil extends Block {
}
// CraftBukkit end
- world.setTypeId(i, j, k, Block.DIRT.id);
+ world.setTypeIdUpdate(i, j, k, Block.DIRT.id);
}
}
- private boolean l(World world, int i, int j, int k) {
+ private boolean k(World world, int i, int j, int k) {
byte b0 = 0;
for (int l = i - b0; l <= i + b0; ++l) {
@@ -94,7 +89,7 @@ public class BlockSoil extends Block {
return false;
}
- private boolean n(World world, int i, int j, int k) {
+ private boolean m(World world, int i, int j, int k) {
for (int l = i - 4; l <= i + 4; ++l) {
for (int i1 = j; i1 <= j + 1; ++i1) {
for (int j1 = k - 4; j1 <= k + 4; ++j1) {
@@ -113,7 +108,7 @@ public class BlockSoil extends Block {
Material material = world.getMaterial(i, j + 1, k);
if (material.isBuildable()) {
- world.setTypeId(i, j, k, Block.DIRT.id);
+ world.setTypeIdUpdate(i, j, k, Block.DIRT.id);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockStationary.java b/src/main/java/net/minecraft/server/BlockStationary.java
index 25695d3f..cf444680 100644
--- a/src/main/java/net/minecraft/server/BlockStationary.java
+++ b/src/main/java/net/minecraft/server/BlockStationary.java
@@ -17,28 +17,25 @@ public class BlockStationary extends BlockFluids {
}
}
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
+ public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
return this.material != Material.LAVA;
}
public void doPhysics(World world, int i, int j, int k, int l) {
super.doPhysics(world, i, j, k, l);
if (world.getTypeId(i, j, k) == this.id) {
- this.l(world, i, j, k);
+ this.k(world, i, j, k);
}
}
- private void l(World world, int i, int j, int k) {
+ private void k(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
- world.suppressPhysics = true;
- world.setRawTypeIdAndData(i, j, k, this.id - 1, l);
- world.e(i, j, k, i, j, k);
- world.a(i, j, k, this.id - 1, this.r_());
- world.suppressPhysics = false;
+ world.setTypeIdAndData(i, j, k, this.id - 1, l, 2);
+ world.a(i, j, k, this.id - 1, this.a(world));
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
if (this.material == Material.LAVA) {
int l = random.nextInt(3);
@@ -56,7 +53,7 @@ public class BlockStationary extends BlockFluids {
k += random.nextInt(3) - 1;
j1 = world.getTypeId(i, j, k);
if (j1 == 0) {
- if (this.n(world, i - 1, j, k) || this.n(world, i + 1, j, k) || this.n(world, i, j, k - 1) || this.n(world, i, j, k + 1) || this.n(world, i, j - 1, k) || this.n(world, i, j + 1, k)) {
+ if (this.m(world, i - 1, j, k) || this.m(world, i + 1, j, k) || this.m(world, i, j, k - 1) || this.m(world, i, j, k + 1) || this.m(world, i, j - 1, k) || this.m(world, i, j + 1, k)) {
// CraftBukkit start - prevent lava putting something on fire
org.bukkit.block.Block block = bworld.getBlockAt(i, j, k);
if (block.getTypeId() != Block.FIRE.id) {
@@ -66,7 +63,7 @@ public class BlockStationary extends BlockFluids {
}
// CraftBukkit end
- world.setTypeId(i, j, k, Block.FIRE.id);
+ world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
return;
}
} else if (Block.byId[j1].material.isSolid()) {
@@ -81,7 +78,7 @@ public class BlockStationary extends BlockFluids {
for (int k1 = 0; k1 < 3; ++k1) {
i = i1 + random.nextInt(3) - 1;
k = j1 + random.nextInt(3) - 1;
- if (world.isEmpty(i, j + 1, k) && this.n(world, i, j, k)) {
+ if (world.isEmpty(i, j + 1, k) && this.m(world, i, j, k)) {
// CraftBukkit start - prevent lava putting something on fire
org.bukkit.block.Block block = bworld.getBlockAt(i, j + 1, k);
if (block.getTypeId() != Block.FIRE.id) {
@@ -91,14 +88,14 @@ public class BlockStationary extends BlockFluids {
}
// CraftBukkit end
- world.setTypeId(i, j + 1, k, Block.FIRE.id);
+ world.setTypeIdUpdate(i, j + 1, k, Block.FIRE.id);
}
}
}
}
}
- private boolean n(World world, int i, int j, int k) {
+ private boolean m(World world, int i, int j, int k) {
return world.getMaterial(i, j, k).isBurnable();
}
}
diff --git a/src/main/java/net/minecraft/server/BlockStem.java b/src/main/java/net/minecraft/server/BlockStem.java
index ff1b89fa..8339a352 100644
--- a/src/main/java/net/minecraft/server/BlockStem.java
+++ b/src/main/java/net/minecraft/server/BlockStem.java
@@ -6,10 +6,10 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class BlockStem extends BlockFlower {
- private Block blockFruit;
+ private final Block blockFruit;
protected BlockStem(int i, Block block) {
- super(i, 111);
+ super(i);
this.blockFruit = block;
this.b(true);
float f = 0.125F;
@@ -18,21 +18,20 @@ public class BlockStem extends BlockFlower {
this.a((CreativeModeTab) null);
}
- protected boolean d_(int i) {
+ protected boolean f_(int i) {
return i == Block.SOIL.id;
}
- public void b(World world, int i, int j, int k, Random random) {
- super.b(world, i, j, k, random);
+ public void a(World world, int i, int j, int k, Random random) {
+ super.a(world, i, j, k, random);
if (world.getLightLevel(i, j + 1, k) >= 9) {
- float f = this.n(world, i, j, k);
+ float f = this.m(world, i, j, k);
if (random.nextInt((int) (25.0F / f) + 1) == 0) {
int l = world.getData(i, j, k);
if (l < 7) {
- ++l;
- CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, l); // CraftBukkit
+ CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit
} else {
if (world.getTypeId(i - 1, j, k) == this.blockFruit.id) {
return;
@@ -80,11 +79,17 @@ public class BlockStem extends BlockFlower {
}
}
- public void l(World world, int i, int j, int k) {
- world.setData(i, j, k, 7);
+ public void k(World world, int i, int j, int k) {
+ int l = world.getData(i, j, k) + MathHelper.nextInt(world.random, 2, 5);
+
+ if (l > 7) {
+ l = 7;
+ }
+
+ world.setData(i, j, k, l, 2);
}
- private float n(World world, int i, int j, int k) {
+ private float m(World world, int i, int j, int k) {
float f = 1.0F;
int l = world.getTypeId(i, j, k - 1);
int i1 = world.getTypeId(i, j, k + 1);
@@ -125,11 +130,7 @@ public class BlockStem extends BlockFlower {
return f;
}
- public int a(int i, int j) {
- return this.textureId;
- }
-
- public void f() {
+ public void g() {
float f = 0.125F;
this.a(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.25F, 0.5F + f);
diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java
deleted file mode 100644
index c9c0ec0f..00000000
--- a/src/main/java/net/minecraft/server/BlockTNT.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package net.minecraft.server;
-
-import java.util.Random;
-
-public class BlockTNT extends Block {
-
- public BlockTNT(int i, int j) {
- super(i, j, Material.TNT);
- this.a(CreativeModeTab.d);
- }
-
- public int a(int i) {
- return i == 0 ? this.textureId + 2 : (i == 1 ? this.textureId + 1 : this.textureId);
- }
-
- public void onPlace(World world, int i, int j, int k) {
- super.onPlace(world, i, j, k);
- if (!world.suppressPhysics && world.isBlockIndirectlyPowered(i, j, k)) { // CraftBukkit
- this.postBreak(world, i, j, k, 1);
- world.setTypeId(i, j, k, 0);
- }
- }
-
- public void doPhysics(World world, int i, int j, int k, int l) {
- if (l > 0 && Block.byId[l].isPowerSource() && world.isBlockIndirectlyPowered(i, j, k)) {
- this.postBreak(world, i, j, k, 1);
- world.setTypeId(i, j, k, 0);
- }
- }
-
- public int a(Random random) {
- return 1;
- }
-
- public void wasExploded(World world, int i, int j, int k) {
- if (!world.isStatic) {
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F));
-
- entitytntprimed.fuseTicks = world.random.nextInt(entitytntprimed.fuseTicks / 4) + entitytntprimed.fuseTicks / 8;
- world.addEntity(entitytntprimed);
- }
- }
-
- public void postBreak(World world, int i, int j, int k, int l) {
- if (!world.isStatic) {
- if ((l & 1) == 1) {
- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F));
-
- world.addEntity(entitytntprimed);
- world.makeSound(entitytntprimed, "random.fuse", 1.0F, 1.0F);
- }
- }
- }
-
- public boolean interact(World world, int i, int j, int k, EntityHuman entityhuman, int l, float f, float f1, float f2) {
- if (entityhuman.bS() != null && entityhuman.bS().id == Item.FLINT_AND_STEEL.id) {
- this.postBreak(world, i, j, k, 1);
- world.setTypeId(i, j, k, 0);
- return true;
- } else {
- return super.interact(world, i, j, k, entityhuman, l, f, f1, f2);
- }
- }
-
- public void a(World world, int i, int j, int k, Entity entity) {
- if (entity instanceof EntityArrow && !world.isStatic) {
- EntityArrow entityarrow = (EntityArrow) entity;
-
- if (entityarrow.isBurning()) {
- this.postBreak(world, i, j, k, 1);
- world.setTypeId(i, j, k, 0);
- }
- }
- }
-
- public boolean a(Explosion explosion) {
- return false;
- }
-}
diff --git a/src/main/java/net/minecraft/server/BlockTrapdoor.java b/src/main/java/net/minecraft/server/BlockTrapdoor.java
index 7739df08..37e321d5 100644
--- a/src/main/java/net/minecraft/server/BlockTrapdoor.java
+++ b/src/main/java/net/minecraft/server/BlockTrapdoor.java
@@ -6,11 +6,6 @@ public class BlockTrapdoor extends Block {
protected BlockTrapdoor(int i, Material material) {
super(i, material);
- this.textureId = 84;
- if (material == Material.ORE) {
- ++this.textureId;
- }
-
float f = 0.5F;
float f1 = 1.0F;
@@ -26,30 +21,30 @@ public class BlockTrapdoor extends Block {
return false;
}
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k) {
- return !g(iblockaccess.getData(i, j, k));
+ public boolean b(IBlockAccess iblockaccess, int i, int j, int k) {
+ return !f(iblockaccess.getData(i, j, k));
}
public int d() {
return 0;
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
this.updateShape(world, i, j, k);
- return super.e(world, i, j, k);
+ return super.b(world, i, j, k);
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
- this.e(iblockaccess.getData(i, j, k));
+ this.d(iblockaccess.getData(i, j, k));
}
- public void f() {
+ public void g() {
float f = 0.1875F;
this.a(0.0F, 0.5F - f / 2.0F, 0.0F, 1.0F, 0.5F + f / 2.0F, 1.0F);
}
- public void e(int i) {
+ public void d(int i) {
float f = 0.1875F;
if ((i & 8) != 0) {
@@ -58,7 +53,7 @@ public class BlockTrapdoor extends Block {
this.a(0.0F, 0.0F, 0.0F, 1.0F, f, 1.0F);
}
- if (g(i)) {
+ if (f(i)) {
if ((i & 3) == 0) {
this.a(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
}
@@ -85,7 +80,7 @@ public class BlockTrapdoor extends Block {
} else {
int i1 = world.getData(i, j, k);
- world.setData(i, j, k, i1 ^ 4);
+ world.setData(i, j, k, i1 ^ 4, 2);
world.a(entityhuman, 1003, i, j, k, 0);
return true;
}
@@ -96,7 +91,7 @@ public class BlockTrapdoor extends Block {
boolean flag1 = (l & 4) > 0;
if (flag1 != flag) {
- world.setData(i, j, k, l ^ 4);
+ world.setData(i, j, k, l ^ 4, 2);
world.a((EntityHuman) null, 1003, i, j, k, 0);
}
}
@@ -123,8 +118,8 @@ public class BlockTrapdoor extends Block {
--j1;
}
- if (!j(world.getTypeId(j1, j, k1))) {
- world.setTypeId(i, j, k, 0);
+ if (!g(world.getTypeId(j1, j, k1))) {
+ world.setAir(i, j, k);
this.c(world, i, j, k, i1, 0);
}
@@ -200,15 +195,15 @@ public class BlockTrapdoor extends Block {
--i;
}
- return j(world.getTypeId(i, j, k));
+ return g(world.getTypeId(i, j, k));
}
}
- public static boolean g(int i) {
+ public static boolean f(int i) {
return (i & 4) != 0;
}
- private static boolean j(int i) {
+ private static boolean g(int i) {
if (i <= 0) {
return false;
} else {
diff --git a/src/main/java/net/minecraft/server/BlockTripwire.java b/src/main/java/net/minecraft/server/BlockTripwire.java
index dc31e0c2..520b4e3e 100644
--- a/src/main/java/net/minecraft/server/BlockTripwire.java
+++ b/src/main/java/net/minecraft/server/BlockTripwire.java
@@ -9,16 +9,16 @@ import org.bukkit.event.entity.EntityInteractEvent; // CraftBukkit
public class BlockTripwire extends Block {
public BlockTripwire(int i) {
- super(i, 173, Material.ORIENTABLE);
+ super(i, Material.ORIENTABLE);
this.a(0.0F, 0.0F, 0.0F, 1.0F, 0.15625F, 1.0F);
this.b(true);
}
- public int r_() {
+ public int a(World world) {
return 10;
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
@@ -41,11 +41,11 @@ public class BlockTripwire extends Block {
public void doPhysics(World world, int i, int j, int k, int l) {
int i1 = world.getData(i, j, k);
boolean flag = (i1 & 2) == 2;
- boolean flag1 = !world.v(i, j - 1, k);
+ boolean flag1 = !world.w(i, j - 1, k);
if (flag != flag1) {
this.c(world, i, j, k, i1, 0);
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
}
}
@@ -64,9 +64,9 @@ public class BlockTripwire extends Block {
}
public void onPlace(World world, int i, int j, int k) {
- int l = world.v(i, j - 1, k) ? 0 : 2;
+ int l = world.w(i, j - 1, k) ? 0 : 2;
- world.setData(i, j, k, l);
+ world.setData(i, j, k, l, 3);
this.d(world, i, j, k, l);
}
@@ -76,8 +76,8 @@ public class BlockTripwire extends Block {
public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) {
if (!world.isStatic) {
- if (entityhuman.bS() != null && entityhuman.bS().id == Item.SHEARS.id) {
- world.setData(i, j, k, l | 8);
+ if (entityhuman.cb() != null && entityhuman.cb().id == Item.SHEARS.id) {
+ world.setData(i, j, k, l | 8, 4);
}
}
}
@@ -115,20 +115,20 @@ public class BlockTripwire extends Block {
public void a(World world, int i, int j, int k, Entity entity) {
if (!world.isStatic) {
if ((world.getData(i, j, k) & 1) != 1) {
- this.l(world, i, j, k);
+ this.k(world, i, j, k);
}
}
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic) {
if ((world.getData(i, j, k) & 1) == 1) {
- this.l(world, i, j, k);
+ this.k(world, i, j, k);
}
}
}
- private void l(World world, int i, int j, int k) {
+ private void k(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
boolean flag = (l & 1) == 1;
boolean flag1 = false;
@@ -140,7 +140,7 @@ public class BlockTripwire extends Block {
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
- if (!entity.au()) {
+ if (!entity.at()) {
flag1 = true;
break;
}
@@ -184,12 +184,12 @@ public class BlockTripwire extends Block {
}
if (flag1 != flag) {
- world.setData(i, j, k, l);
+ world.setData(i, j, k, l, 3);
this.d(world, i, j, k, l);
}
if (flag1) {
- world.a(i, j, k, this.id, this.r_());
+ world.a(i, j, k, this.id, this.a(world));
}
}
}
diff --git a/src/main/java/net/minecraft/server/BlockTripwireHook.java b/src/main/java/net/minecraft/server/BlockTripwireHook.java
index e18bf43b..5f70c389 100644
--- a/src/main/java/net/minecraft/server/BlockTripwireHook.java
+++ b/src/main/java/net/minecraft/server/BlockTripwireHook.java
@@ -7,12 +7,12 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockTripwireHook extends Block {
public BlockTripwireHook(int i) {
- super(i, 172, Material.ORIENTABLE);
+ super(i, Material.ORIENTABLE);
this.a(CreativeModeTab.d);
this.b(true);
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
@@ -28,34 +28,34 @@ public class BlockTripwireHook extends Block {
return 29;
}
- public int r_() {
+ public int a(World world) {
return 10;
}
public boolean canPlace(World world, int i, int j, int k, int l) {
- return l == 2 && world.t(i, j, k + 1) ? true : (l == 3 && world.t(i, j, k - 1) ? true : (l == 4 && world.t(i + 1, j, k) ? true : l == 5 && world.t(i - 1, j, k)));
+ return l == 2 && world.u(i, j, k + 1) ? true : (l == 3 && world.u(i, j, k - 1) ? true : (l == 4 && world.u(i + 1, j, k) ? true : l == 5 && world.u(i - 1, j, k)));
}
public boolean canPlace(World world, int i, int j, int k) {
- return world.t(i - 1, j, k) ? true : (world.t(i + 1, j, k) ? true : (world.t(i, j, k - 1) ? true : world.t(i, j, k + 1)));
+ return world.u(i - 1, j, k) ? true : (world.u(i + 1, j, k) ? true : (world.u(i, j, k - 1) ? true : world.u(i, j, k + 1)));
}
public int getPlacedData(World world, int i, int j, int k, int l, float f, float f1, float f2, int i1) {
byte b0 = 0;
- if (l == 2 && world.b(i, j, k + 1, true)) {
+ if (l == 2 && world.c(i, j, k + 1, true)) {
b0 = 2;
}
- if (l == 3 && world.b(i, j, k - 1, true)) {
+ if (l == 3 && world.c(i, j, k - 1, true)) {
b0 = 0;
}
- if (l == 4 && world.b(i + 1, j, k, true)) {
+ if (l == 4 && world.c(i + 1, j, k, true)) {
b0 = 1;
}
- if (l == 5 && world.b(i - 1, j, k, true)) {
+ if (l == 5 && world.c(i - 1, j, k, true)) {
b0 = 3;
}
@@ -68,30 +68,30 @@ public class BlockTripwireHook extends Block {
public void doPhysics(World world, int i, int j, int k, int l) {
if (l != this.id) {
- if (this.l(world, i, j, k)) {
+ if (this.k(world, i, j, k)) {
int i1 = world.getData(i, j, k);
int j1 = i1 & 3;
boolean flag = false;
- if (!world.t(i - 1, j, k) && j1 == 3) {
+ if (!world.u(i - 1, j, k) && j1 == 3) {
flag = true;
}
- if (!world.t(i + 1, j, k) && j1 == 1) {
+ if (!world.u(i + 1, j, k) && j1 == 1) {
flag = true;
}
- if (!world.t(i, j, k - 1) && j1 == 0) {
+ if (!world.u(i, j, k - 1) && j1 == 0) {
flag = true;
}
- if (!world.t(i, j, k + 1) && j1 == 2) {
+ if (!world.u(i, j, k + 1) && j1 == 2) {
flag = true;
}
if (flag) {
this.c(world, i, j, k, i1, 0);
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
}
}
}
@@ -103,7 +103,7 @@ public class BlockTripwireHook extends Block {
boolean flag2 = (i1 & 8) == 8;
boolean flag3 = l == Block.TRIPWIRE_SOURCE.id;
boolean flag4 = false;
- boolean flag5 = !world.v(i, j - 1, k);
+ boolean flag5 = !world.w(i, j - 1, k);
int i2 = Direction.a[l1];
int j2 = Direction.b[l1];
int k2 = 0;
@@ -140,7 +140,7 @@ public class BlockTripwireHook extends Block {
flag4 |= flag6 && flag7;
aint[i3] = l3;
if (i3 == j1) {
- world.a(i, j, k, l, this.r_());
+ world.a(i, j, k, l, this.a(world));
flag3 &= flag6;
}
}
@@ -154,7 +154,7 @@ public class BlockTripwireHook extends Block {
l2 = i + i2 * k2;
k3 = k + j2 * k2;
j3 = Direction.f[l1];
- world.setData(l2, j, k3, j3 | i3);
+ world.setData(l2, j, k3, j3 | i3, 3);
this.d(world, l2, j, k3, j3);
this.a(world, l2, j, k3, flag3, flag4, flag1, flag2);
}
@@ -162,7 +162,7 @@ public class BlockTripwireHook extends Block {
// CraftBukkit start
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j, k);
- BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 1, 0);
+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(block, 15, 0);
world.getServer().getPluginManager().callEvent(eventRedstone);
if (eventRedstone.getNewCurrent() > 0) {
@@ -172,7 +172,7 @@ public class BlockTripwireHook extends Block {
this.a(world, i, j, k, flag3, flag4, flag1, flag2);
if (l > 0) {
- world.setData(i, j, k, i1);
+ world.setData(i, j, k, i1, 3);
if (flag) {
this.d(world, i, j, k, l1);
}
@@ -190,13 +190,13 @@ public class BlockTripwireHook extends Block {
l3 &= -5;
}
- world.setData(k3, j, j3, l3);
+ world.setData(k3, j, j3, l3, 3);
}
}
}
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
this.a(world, i, j, k, this.id, world.getData(i, j, k), true, -1, 0);
}
@@ -225,10 +225,10 @@ public class BlockTripwireHook extends Block {
}
}
- private boolean l(World world, int i, int j, int k) {
+ private boolean k(World world, int i, int j, int k) {
if (!this.canPlace(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
return false;
} else {
return true;
@@ -276,19 +276,19 @@ public class BlockTripwireHook extends Block {
super.remove(world, i, j, k, l, i1);
}
- public boolean b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
- return (iblockaccess.getData(i, j, k) & 8) == 8;
+ public int b(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ return (iblockaccess.getData(i, j, k) & 8) == 8 ? 15 : 0;
}
- public boolean c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
+ public int c(IBlockAccess iblockaccess, int i, int j, int k, int l) {
int i1 = iblockaccess.getData(i, j, k);
if ((i1 & 8) != 8) {
- return false;
+ return 0;
} else {
int j1 = i1 & 3;
- return j1 == 2 && l == 2 ? true : (j1 == 0 && l == 3 ? true : (j1 == 1 && l == 4 ? true : j1 == 3 && l == 5));
+ return j1 == 2 && l == 2 ? 15 : (j1 == 0 && l == 3 ? 15 : (j1 == 1 && l == 4 ? 15 : (j1 == 3 && l == 5 ? 15 : 0)));
}
}
diff --git a/src/main/java/net/minecraft/server/BlockVine.java b/src/main/java/net/minecraft/server/BlockVine.java
index 03064def..6dc99f66 100644
--- a/src/main/java/net/minecraft/server/BlockVine.java
+++ b/src/main/java/net/minecraft/server/BlockVine.java
@@ -7,12 +7,12 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class BlockVine extends Block {
public BlockVine(int i) {
- super(i, 143, Material.REPLACEABLE_PLANT);
+ super(i, Material.REPLACEABLE_PLANT);
this.b(true);
this.a(CreativeModeTab.c);
}
- public void f() {
+ public void g() {
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
@@ -78,7 +78,7 @@ public class BlockVine extends Block {
flag = true;
}
- if (!flag && this.e(iblockaccess.getTypeId(i, j + 1, k))) {
+ if (!flag && this.d(iblockaccess.getTypeId(i, j + 1, k))) {
f1 = Math.min(f1, 0.9375F);
f4 = 1.0F;
f = 0.0F;
@@ -90,33 +90,33 @@ public class BlockVine extends Block {
this.a(f, f1, f2, f3, f4, f5);
}
- public AxisAlignedBB e(World world, int i, int j, int k) {
+ public AxisAlignedBB b(World world, int i, int j, int k) {
return null;
}
public boolean canPlace(World world, int i, int j, int k, int l) {
switch (l) {
case 1:
- return this.e(world.getTypeId(i, j + 1, k));
+ return this.d(world.getTypeId(i, j + 1, k));
case 2:
- return this.e(world.getTypeId(i, j, k + 1));
+ return this.d(world.getTypeId(i, j, k + 1));
case 3:
- return this.e(world.getTypeId(i, j, k - 1));
+ return this.d(world.getTypeId(i, j, k - 1));
case 4:
- return this.e(world.getTypeId(i + 1, j, k));
+ return this.d(world.getTypeId(i + 1, j, k));
case 5:
- return this.e(world.getTypeId(i - 1, j, k));
+ return this.d(world.getTypeId(i - 1, j, k));
default:
return false;
}
}
- private boolean e(int i) {
+ private boolean d(int i) {
if (i == 0) {
return false;
} else {
@@ -126,7 +126,7 @@ public class BlockVine extends Block {
}
}
- private boolean l(World world, int i, int j, int k) {
+ private boolean k(World world, int i, int j, int k) {
int l = world.getData(i, j, k);
int i1 = l;
@@ -134,17 +134,17 @@ public class BlockVine extends Block {
for (int j1 = 0; j1 <= 3; ++j1) {
int k1 = 1 << j1;
- if ((l & k1) != 0 && !this.e(world.getTypeId(i + Direction.a[j1], j, k + Direction.b[j1])) && (world.getTypeId(i, j + 1, k) != this.id || (world.getData(i, j + 1, k) & k1) == 0)) {
+ if ((l & k1) != 0 && !this.d(world.getTypeId(i + Direction.a[j1], j, k + Direction.b[j1])) && (world.getTypeId(i, j + 1, k) != this.id || (world.getData(i, j + 1, k) & k1) == 0)) {
i1 &= ~k1;
}
}
}
- if (i1 == 0 && !this.e(world.getTypeId(i, j + 1, k))) {
+ if (i1 == 0 && !this.d(world.getTypeId(i, j + 1, k))) {
return false;
} else {
if (i1 != l) {
- world.setData(i, j, k, i1);
+ world.setData(i, j, k, i1, 2);
}
return true;
@@ -152,13 +152,13 @@ public class BlockVine extends Block {
}
public void doPhysics(World world, int i, int j, int k, int l) {
- if (!world.isStatic && !this.l(world, i, j, k)) {
+ if (!world.isStatic && !this.k(world, i, j, k)) {
this.c(world, i, j, k, world.getData(i, j, k), 0);
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
}
}
- public void b(World world, int i, int j, int k, Random random) {
+ public void a(World world, int i, int j, int k, Random random) {
if (!world.isStatic && world.random.nextInt(4) == 0) {
byte b0 = 4;
int l = 5;
@@ -197,7 +197,7 @@ public class BlockVine extends Block {
l1 = world.random.nextInt(16) & i1;
if (l1 > 0) {
for (i2 = 0; i2 <= 3; ++i2) {
- if (!this.e(world.getTypeId(i + Direction.a[i2], j + 1, k + Direction.b[i2]))) {
+ if (!this.d(world.getTypeId(i + Direction.a[i2], j + 1, k + Direction.b[i2]))) {
l1 &= ~(1 << i2);
}
}
@@ -206,7 +206,7 @@ public class BlockVine extends Block {
// CraftBukkit start - fire BlockSpreadEvent
org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k);
org.bukkit.block.Block block = world.getWorld().getBlockAt(i, j + 1, k);
- CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, i2);
+ CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, l1);
// CraftBukkit end
}
}
@@ -221,25 +221,26 @@ public class BlockVine extends Block {
l1 = world.getTypeId(i + Direction.a[k1], j, k + Direction.b[k1]);
if (l1 != 0 && Block.byId[l1] != null) {
if (Block.byId[l1].material.k() && Block.byId[l1].b()) {
- world.setData(i, j, k, i1 | 1 << k1);
+ world.setData(i, j, k, i1 | 1 << k1, 2);
}
} else {
i2 = k1 + 1 & 3;
j2 = k1 + 3 & 3;
+
// CraftBukkit start - fire BlockSpreadEvent
org.bukkit.block.Block source = world.getWorld().getBlockAt(i, j, k);
org.bukkit.block.Block block = world.getWorld().getBlockAt(i + Direction.a[k1], j, k + Direction.b[k1]);
- if ((i1 & 1 << i2) != 0 && this.e(world.getTypeId(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]))) {
+ if ((i1 & 1 << i2) != 0 && this.d(world.getTypeId(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]))) {
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 1 << i2);
- } else if ((i1 & 1 << j2) != 0 && this.e(world.getTypeId(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]))) {
+ } else if ((i1 & 1 << j2) != 0 && this.d(world.getTypeId(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]))) {
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 1 << j2);
- } else if ((i1 & 1 << i2) != 0 && world.isEmpty(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]) && this.e(world.getTypeId(i + Direction.a[i2], j, k + Direction.b[i2]))) {
+ } else if ((i1 & 1 << i2) != 0 && world.isEmpty(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]) && this.d(world.getTypeId(i + Direction.a[i2], j, k + Direction.b[i2]))) {
block = world.getWorld().getBlockAt(i + Direction.a[k1] + Direction.a[i2], j, k + Direction.b[k1] + Direction.b[i2]);
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 1 << (k1 + 2 & 3));
- } else if ((i1 & 1 << j2) != 0 && world.isEmpty(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]) && this.e(world.getTypeId(i + Direction.a[j2], j, k + Direction.b[j2]))) {
+ } else if ((i1 & 1 << j2) != 0 && world.isEmpty(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]) && this.d(world.getTypeId(i + Direction.a[j2], j, k + Direction.b[j2]))) {
block = world.getWorld().getBlockAt(i + Direction.a[k1] + Direction.a[j2], j, k + Direction.b[k1] + Direction.b[j2]);
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 1 << (k1 + 2 & 3));
- } else if (this.e(world.getTypeId(i + Direction.a[k1], j + 1, k + Direction.b[k1]))) {
+ } else if (this.d(world.getTypeId(i + Direction.a[k1], j + 1, k + Direction.b[k1]))) {
CraftEventFactory.handleBlockSpreadEvent(block, source, this.id, 0);
}
// CraftBukkit end
@@ -259,7 +260,7 @@ public class BlockVine extends Block {
i2 = world.random.nextInt(16) & i1;
j2 = world.getData(i, j - 1, k);
if (j2 != (j2 | i2)) {
- world.setData(i, j - 1, k, j2 | i2);
+ world.setData(i, j - 1, k, j2 | i2, 2);
}
}
}
@@ -299,7 +300,7 @@ public class BlockVine extends Block {
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
- if (!world.isStatic && entityhuman.bS() != null && entityhuman.bS().id == Item.SHEARS.id) {
+ if (!world.isStatic && entityhuman.cb() != null && entityhuman.cb().id == Item.SHEARS.id) {
entityhuman.a(StatisticList.C[this.id], 1);
this.b(world, i, j, k, new ItemStack(Block.VINE, 1, 0));
} else {
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 93c343e1..ce5c73b7 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -159,7 +159,7 @@ public class Chunk {
if (chunksection != null) {
chunksection.c(j, i1 & 15, k, l);
- this.world.o((this.x << 4) + j, i1, (this.z << 4) + k);
+ this.world.p((this.x << 4) + j, i1, (this.z << 4) + k);
}
}
@@ -262,7 +262,7 @@ public class Chunk {
}
if (i1 != l) {
- this.world.g(i + this.x * 16, k + this.z * 16, i1, l);
+ this.world.e(i + this.x * 16, k + this.z * 16, i1, l);
this.heightMap[k << 4 | i] = i1;
int j1 = this.x * 16 + i;
int k1 = this.z * 16 + k;
@@ -277,7 +277,7 @@ public class Chunk {
chunksection = this.sections[l1 >> 4];
if (chunksection != null) {
chunksection.c(i, l1 & 15, k, 15);
- this.world.o((this.x << 4) + i, l1, (this.z << 4) + k);
+ this.world.p((this.x << 4) + i, l1, (this.z << 4) + k);
}
}
} else {
@@ -285,7 +285,7 @@ public class Chunk {
chunksection = this.sections[l1 >> 4];
if (chunksection != null) {
chunksection.c(i, l1 & 15, k, 0);
- this.world.o((this.x << 4) + i, l1, (this.z << 4) + k);
+ this.world.p((this.x << 4) + i, l1, (this.z << 4) + k);
}
}
}
@@ -361,10 +361,6 @@ public class Chunk {
}
}
- public boolean a(int i, int j, int k, int l) {
- return this.a(i, j, k, l, 0);
- }
-
public boolean a(int i, int j, int k, int l, int i1) {
int j1 = k << 4 | i;
@@ -387,7 +383,7 @@ public class Chunk {
return false;
}
- chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !world.worldProvider.f);
+ chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !this.world.worldProvider.f);
flag = j >= k1;
}
@@ -395,15 +391,15 @@ public class Chunk {
int k2 = this.z * 16 + k;
if (l1 != 0 && !this.world.isStatic) {
- Block.byId[l1].h(this.world, j2, j, k2, i2);
+ Block.byId[l1].l(this.world, j2, j, k2, i2);
}
chunksection.a(i, j & 15, k, l);
if (l1 != 0) {
if (!this.world.isStatic) {
Block.byId[l1].remove(this.world, j2, j, k2, l1, i2);
- } else if (Block.byId[l1] instanceof BlockContainer && l1 != l) {
- this.world.r(j2, j, k2);
+ } else if (Block.byId[l1] instanceof IContainer && l1 != l) {
+ this.world.s(j2, j, k2);
}
}
@@ -433,7 +429,7 @@ public class Chunk {
Block.byId[l].onPlace(this.world, j2, j, k2);
}
- if (Block.byId[l] instanceof BlockContainer) {
+ if (Block.byId[l] instanceof IContainer) {
// CraftBukkit start - don't create tile entity if placement failed
if (this.getTypeId(i, j, k) != l) {
return false;
@@ -442,18 +438,18 @@ public class Chunk {
tileentity = this.e(i, j, k);
if (tileentity == null) {
- tileentity = ((BlockContainer) Block.byId[l]).a(this.world);
+ tileentity = ((IContainer) Block.byId[l]).b(this.world);
this.world.setTileEntity(j2, j, k2, tileentity);
}
if (tileentity != null) {
- tileentity.h();
+ tileentity.i();
}
}
- } else if (l1 > 0 && Block.byId[l1] instanceof BlockContainer) {
+ } else if (l1 > 0 && Block.byId[l1] instanceof IContainer) {
tileentity = this.e(i, j, k);
if (tileentity != null) {
- tileentity.h();
+ tileentity.i();
}
}
@@ -478,11 +474,11 @@ public class Chunk {
chunksection.b(i, j & 15, k, l);
int j1 = chunksection.a(i, j & 15, k);
- if (j1 > 0 && Block.byId[j1] instanceof BlockContainer) {
+ if (j1 > 0 && Block.byId[j1] instanceof IContainer) {
TileEntity tileentity = this.e(i, j, k);
if (tileentity != null) {
- tileentity.h();
+ tileentity.i();
tileentity.p = l;
}
}
@@ -502,7 +498,7 @@ public class Chunk {
ChunkSection chunksection = this.sections[j >> 4];
if (chunksection == null) {
- chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !world.worldProvider.f);
+ chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !this.world.worldProvider.f);
this.initLighting();
}
@@ -562,15 +558,15 @@ public class Chunk {
k = this.entitySlices.length - 1;
}
- entity.ah = true;
- entity.ai = this.x;
- entity.aj = k;
- entity.ak = this.z;
+ entity.ai = true;
+ entity.aj = this.x;
+ entity.ak = k;
+ entity.al = this.z;
this.entitySlices[k].add(entity);
}
public void b(Entity entity) {
- this.a(entity, entity.aj);
+ this.a(entity, entity.ak);
}
public void a(Entity entity, int i) {
@@ -596,12 +592,12 @@ public class Chunk {
if (tileentity == null) {
int l = this.getTypeId(i, j, k);
- if (l <= 0 || !Block.byId[l].u()) {
+ if (l <= 0 || !Block.byId[l].t()) {
return null;
}
if (tileentity == null) {
- tileentity = ((BlockContainer) Block.byId[l]).a(this.world);
+ tileentity = ((IContainer) Block.byId[l]).b(this.world);
this.world.setTileEntity(this.x * 16 + i, j, this.z * 16 + k, tileentity);
}
@@ -634,7 +630,11 @@ public class Chunk {
tileentity.x = this.x * 16 + i;
tileentity.y = j;
tileentity.z = this.z * 16 + k;
- if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof BlockContainer) {
+ if (this.getTypeId(i, j, k) != 0 && Block.byId[this.getTypeId(i, j, k)] instanceof IContainer) {
+ if (this.tileEntities.containsKey(chunkposition)) {
+ ((TileEntity) this.tileEntities.get(chunkposition)).w_();
+ }
+
tileentity.s();
this.tileEntities.put(chunkposition, tileentity);
// CraftBukkit start
@@ -700,16 +700,18 @@ public class Chunk {
this.l = true;
}
- public void a(Entity entity, AxisAlignedBB axisalignedbb, List list) {
+ public void a(Entity entity, AxisAlignedBB axisalignedbb, List list, IEntitySelector ientityselector) {
int i = MathHelper.floor((axisalignedbb.b - 2.0D) / 16.0D);
int j = MathHelper.floor((axisalignedbb.e + 2.0D) / 16.0D);
if (i < 0) {
i = 0;
+ j = Math.max(i, j);
}
if (j >= this.entitySlices.length) {
j = this.entitySlices.length - 1;
+ i = Math.min(i, j);
}
for (int k = i; k <= j; ++k) {
@@ -718,14 +720,14 @@ public class Chunk {
for (int l = 0; l < list1.size(); ++l) {
Entity entity1 = (Entity) list1.get(l);
- if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) {
+ if (entity1 != entity && entity1.boundingBox.a(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) {
list.add(entity1);
- Entity[] aentity = entity1.ao();
+ Entity[] aentity = entity1.an();
if (aentity != null) {
for (int i1 = 0; i1 < aentity.length; ++i1) {
entity1 = aentity[i1];
- if (entity1 != entity && entity1.boundingBox.a(axisalignedbb)) {
+ if (entity1 != entity && entity1.boundingBox.a(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) {
list.add(entity1);
}
}
@@ -766,7 +768,7 @@ public class Chunk {
public boolean a(boolean flag) {
if (flag) {
- if (this.m && this.world.getTime() != this.n) {
+ if (this.m && this.world.getTime() != this.n || this.l) {
return true;
}
} else if (this.m && this.world.getTime() >= this.n + 600L) {
@@ -906,30 +908,30 @@ public class Chunk {
if (this.sections[j] == null && (k1 == 0 || k1 == 15 || k == 0 || k == 15 || l == 0 || l == 15) || this.sections[j] != null && this.sections[j].a(k, k1, l) == 0) {
if (Block.lightEmission[this.world.getTypeId(i1, l1 - 1, j1)] > 0) {
- this.world.z(i1, l1 - 1, j1);
+ this.world.A(i1, l1 - 1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1, l1 + 1, j1)] > 0) {
- this.world.z(i1, l1 + 1, j1);
+ this.world.A(i1, l1 + 1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1 - 1, l1, j1)] > 0) {
- this.world.z(i1 - 1, l1, j1);
+ this.world.A(i1 - 1, l1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1 + 1, l1, j1)] > 0) {
- this.world.z(i1 + 1, l1, j1);
+ this.world.A(i1 + 1, l1, j1);
}
if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 - 1)] > 0) {
- this.world.z(i1, l1, j1 - 1);
+ this.world.A(i1, l1, j1 - 1);
}
if (Block.lightEmission[this.world.getTypeId(i1, l1, j1 + 1)] > 0) {
- this.world.z(i1, l1, j1 + 1);
+ this.world.A(i1, l1, j1 + 1);
}
- this.world.z(i1, l1, j1);
+ this.world.A(i1, l1, j1);
}
}
}
diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java
index c0bab0fa..d5887a98 100644
--- a/src/main/java/net/minecraft/server/ChunkProviderServer.java
+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java
@@ -159,8 +159,8 @@ public class ChunkProviderServer implements IChunkProvider {
chunk = chunk == null ? (!this.world.isLoading && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk;
if (chunk == this.emptyChunk) return chunk;
if (i != chunk.x || j != chunk.z) {
- MinecraftServer.log.severe("Chunk (" + chunk.x + ", " + chunk.z + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'");
- MinecraftServer.log.severe(chunk.getClass().getName());
+ this.world.getLogger().severe("Chunk (" + chunk.x + ", " + chunk.z + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'");
+ this.world.getLogger().severe(chunk.getClass().getName());
Throwable ex = new Throwable();
ex.fillInStackTrace();
ex.printStackTrace();
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index 88c33d06..8f37333a 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -85,16 +85,16 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
protected Object[] a(World world, int i, int j, NBTTagCompound nbttagcompound) { // CraftBukkit - return Chunk -> Object[]
if (!nbttagcompound.hasKey("Level")) {
- System.out.println("Chunk file at " + i + "," + j + " is missing level data, skipping");
+ world.getLogger().severe("Chunk file at " + i + "," + j + " is missing level data, skipping");
return null;
} else if (!nbttagcompound.getCompound("Level").hasKey("Sections")) {
- System.out.println("Chunk file at " + i + "," + j + " is missing block data, skipping");
+ world.getLogger().severe("Chunk file at " + i + "," + j + " is missing block data, skipping");
return null;
} else {
Chunk chunk = this.a(world, nbttagcompound.getCompound("Level"));
if (!chunk.a(i, j)) {
- System.out.println("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.x + ", " + chunk.z + ")");
+ world.getLogger().severe("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.x + ", " + chunk.z + ")");
nbttagcompound.getCompound("Level").setInt("xPos", i); // CraftBukkit - .getCompound("Level")
nbttagcompound.getCompound("Level").setInt("zPos", j); // CraftBukkit - .getCompound("Level")
chunk = this.a(world, nbttagcompound.getCompound("Level"));
@@ -112,7 +112,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
public void a(World world, Chunk chunk) {
// CraftBukkit start - "handle" exception
try {
- world.D();
+ world.E();
} catch (ExceptionWorldConflict ex) {
ex.printStackTrace();
}
@@ -236,9 +236,9 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
- chunk.m = true;
nbttagcompound1 = new NBTTagCompound();
- if (entity.c(nbttagcompound1)) {
+ if (entity.d(nbttagcompound1)) {
+ chunk.m = true;
nbttaglist1.add(nbttagcompound1);
}
}
@@ -274,6 +274,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
nbttagcompound2.setInt("y", nextticklistentry.b);
nbttagcompound2.setInt("z", nextticklistentry.c);
nbttagcompound2.setInt("t", (int) (nextticklistentry.e - k));
+ nbttagcompound2.setInt("p", nextticklistentry.f);
nbttaglist3.add(nbttagcompound2);
}
@@ -335,6 +336,18 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
chunk.m = true;
if (entity != null) {
chunk.a(entity);
+ Entity entity1 = entity;
+
+ for (NBTTagCompound nbttagcompound3 = nbttagcompound2; nbttagcompound3.hasKey("Riding"); nbttagcompound3 = nbttagcompound3.getCompound("Riding")) {
+ Entity entity2 = EntityTypes.a(nbttagcompound3.getCompound("Riding"), world);
+
+ if (entity2 != null) {
+ chunk.a(entity2);
+ entity1.mount(entity2);
+ }
+
+ entity1 = entity2;
+ }
}
}
}
@@ -343,8 +356,8 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
if (nbttaglist2 != null) {
for (int i1 = 0; i1 < nbttaglist2.size(); ++i1) {
- NBTTagCompound nbttagcompound3 = (NBTTagCompound) nbttaglist2.get(i1);
- TileEntity tileentity = TileEntity.c(nbttagcompound3);
+ NBTTagCompound nbttagcompound4 = (NBTTagCompound) nbttaglist2.get(i1);
+ TileEntity tileentity = TileEntity.c(nbttagcompound4);
if (tileentity != null) {
chunk.a(tileentity);
@@ -357,9 +370,9 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
if (nbttaglist3 != null) {
for (int j1 = 0; j1 < nbttaglist3.size(); ++j1) {
- NBTTagCompound nbttagcompound4 = (NBTTagCompound) nbttaglist3.get(j1);
+ NBTTagCompound nbttagcompound5 = (NBTTagCompound) nbttaglist3.get(j1);
- world.b(nbttagcompound4.getInt("x"), nbttagcompound4.getInt("y"), nbttagcompound4.getInt("z"), nbttagcompound4.getInt("i"), nbttagcompound4.getInt("t"));
+ world.b(nbttagcompound5.getInt("x"), nbttagcompound5.getInt("y"), nbttagcompound5.getInt("z"), nbttagcompound5.getInt("i"), nbttagcompound5.getInt("t"), nbttagcompound5.getInt("p"));
}
}
}
diff --git a/src/main/java/net/minecraft/server/ConsoleLogFormatter.java b/src/main/java/net/minecraft/server/ConsoleLogFormatter.java
index 6a58493c..60d26d58 100644
--- a/src/main/java/net/minecraft/server/ConsoleLogFormatter.java
+++ b/src/main/java/net/minecraft/server/ConsoleLogFormatter.java
@@ -9,41 +9,32 @@ import java.util.logging.LogRecord;
import java.util.regex.Pattern; // CraftBukkit
-final class ConsoleLogFormatter extends Formatter {
+class ConsoleLogFormatter extends Formatter {
- private SimpleDateFormat a = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- // CraftBukkit start - add color stripping, change constructor to take it
+ private SimpleDateFormat b;
+
+ final ConsoleLogManager a;
+ // CraftBukkit start - add color stripping
private Pattern pattern = Pattern.compile("\\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]");
private boolean strip = false;
+ // CraftBukkit end
- ConsoleLogFormatter(boolean strip) {
- this.strip = strip;
+ private ConsoleLogFormatter(ConsoleLogManager consolelogmanager) {
+ this.a = consolelogmanager;
+ this.b = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ this.strip = MinecraftServer.getServer().options.has("log-strip-color"); // CraftBukkit
}
- // CraftBukkit end
public String format(LogRecord logrecord) {
StringBuilder stringbuilder = new StringBuilder();
- stringbuilder.append(this.a.format(Long.valueOf(logrecord.getMillis())));
- Level level = logrecord.getLevel();
-
- if (level == Level.FINEST) {
- stringbuilder.append(" [FINEST] ");
- } else if (level == Level.FINER) {
- stringbuilder.append(" [FINER] ");
- } else if (level == Level.FINE) {
- stringbuilder.append(" [FINE] ");
- } else if (level == Level.INFO) {
- stringbuilder.append(" [INFO] ");
- } else if (level == Level.WARNING) {
- stringbuilder.append(" [WARNING] ");
- } else if (level == Level.SEVERE) {
- stringbuilder.append(" [SEVERE] ");
- } else { // CraftBukkit
- stringbuilder.append(" [").append(level.getLocalizedName()).append("] ");
+ stringbuilder.append(this.b.format(Long.valueOf(logrecord.getMillis())));
+ if (ConsoleLogManager.a(this.a) != null) {
+ stringbuilder.append(ConsoleLogManager.a(this.a));
}
- stringbuilder.append(formatMessage(logrecord)); // CraftBukkit
+ stringbuilder.append(" [").append(logrecord.getLevel().getName()).append("] ");
+ stringbuilder.append(this.formatMessage(logrecord));
stringbuilder.append('\n');
Throwable throwable = logrecord.getThrown();
@@ -62,4 +53,8 @@ final class ConsoleLogFormatter extends Formatter {
}
// CraftBukkit end
}
+
+ ConsoleLogFormatter(ConsoleLogManager consolelogmanager, EmptyClass3 emptyclass3) {
+ this(consolelogmanager);
+ }
}
diff --git a/src/main/java/net/minecraft/server/ConsoleLogManager.java b/src/main/java/net/minecraft/server/ConsoleLogManager.java
index 3301ec1f..98f9a8b1 100644
--- a/src/main/java/net/minecraft/server/ConsoleLogManager.java
+++ b/src/main/java/net/minecraft/server/ConsoleLogManager.java
@@ -2,24 +2,50 @@ package net.minecraft.server;
import java.util.logging.ConsoleHandler;
import java.util.logging.FileHandler;
+import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.io.File; // CraftBukkit
-public class ConsoleLogManager {
+public class ConsoleLogManager implements IConsoleLogManager {
- public static Logger a = Logger.getLogger("Minecraft");
+ private final Logger a;
+ private final String b;
+ private final String c;
+ private final String d;
public static Logger global = Logger.getLogger(""); // CraftBukkit
- // CraftBukkit - change of method signature!
- public static void init(MinecraftServer server) {
- ConsoleLogFormatter consolelogformatter = new ConsoleLogFormatter(server.options.has("log-strip-color")); // CraftBukkit - pass strip color option
+ public ConsoleLogManager(String s, String s1, String s2) {
+ this.a = Logger.getLogger(s);
+ this.c = s;
+ this.d = s1;
+ this.b = s2;
+ this.b();
+ }
+
+ private void b() {
+ this.a.setUseParentHandlers(false);
+ Handler[] ahandler = this.a.getHandlers();
+ int i = ahandler.length;
+
+ for (int j = 0; j < i; ++j) {
+ Handler handler = ahandler[j];
+
+ this.a.removeHandler(handler);
+ }
+
+ ConsoleLogFormatter consolelogformatter = new ConsoleLogFormatter(this, (EmptyClass3) null);
- a.setUseParentHandlers(false);
// CraftBukkit start
+ MinecraftServer server = MinecraftServer.getServer();
ConsoleHandler consolehandler = new org.bukkit.craftbukkit.util.TerminalConsoleHandler(server.reader);
+ // CraftBukkit end
+ consolehandler.setFormatter(consolelogformatter);
+ this.a.addHandler(consolehandler);
+
+ // CraftBukkit start
for (java.util.logging.Handler handler : global.getHandlers()) {
global.removeHandler(handler);
}
@@ -28,8 +54,6 @@ public class ConsoleLogManager {
global.addHandler(consolehandler);
// CraftBukkit end
- a.addHandler(consolehandler);
-
try {
// CraftBukkit start
String pattern = (String) server.options.valueOf("log-pattern");
@@ -49,26 +73,26 @@ public class ConsoleLogManager {
parentPath = parent.getPath();
}
- int i = 0;
- while (i < parentPath.length()) {
- char ch = parentPath.charAt(i);
+ int j = 0;
+ while (j < parentPath.length()) {
+ char ch = parentPath.charAt(j);
char ch2 = 0;
- if (i + 1 < parentPath.length()) {
- ch2 = Character.toLowerCase(pattern.charAt(i + 1));
+ if (j + 1 < parentPath.length()) {
+ ch2 = Character.toLowerCase(pattern.charAt(j + 1));
}
if (ch == '%') {
if (ch2 == 'h') {
- i += 2;
+ j += 2;
fixedPattern.append(homeDir);
continue;
} else if (ch2 == 't') {
- i += 2;
+ j += 2;
fixedPattern.append(tmpDir);
continue;
} else if (ch2 == '%') {
// Even though we don't care about this we have to skip it to avoid matching %%t
- i += 2;
+ j += 2;
fixedPattern.append("%%");
continue;
} else if (ch2 != 0) {
@@ -77,7 +101,7 @@ public class ConsoleLogManager {
}
fixedPattern.append(ch);
- i++;
+ j++;
}
// Try to create needed parent directories
@@ -93,10 +117,42 @@ public class ConsoleLogManager {
// CraftBukkit end
filehandler.setFormatter(consolelogformatter);
- a.addHandler(filehandler);
+ this.a.addHandler(filehandler);
global.addHandler(filehandler); // CraftBukkit
} catch (Exception exception) {
- a.log(Level.WARNING, "Failed to log to server.log", exception);
+ this.a.log(Level.WARNING, "Failed to log " + this.c + " to " + this.b, exception);
}
}
+
+ public Logger getLogger() {
+ return this.a;
+ }
+
+ public void info(String s) {
+ this.a.log(Level.INFO, s);
+ }
+
+ public void warning(String s) {
+ this.a.log(Level.WARNING, s);
+ }
+
+ public void warning(String s, Object... aobject) {
+ this.a.log(Level.WARNING, s, aobject);
+ }
+
+ public void warning(String s, Throwable throwable) {
+ this.a.log(Level.WARNING, s, throwable);
+ }
+
+ public void severe(String s) {
+ this.a.log(Level.SEVERE, s);
+ }
+
+ public void severe(String s, Throwable throwable) {
+ this.a.log(Level.SEVERE, s, throwable);
+ }
+
+ static String a(ConsoleLogManager consolelogmanager) {
+ return consolelogmanager.d;
+ }
}
diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java
index 9ecefea0..96f28101 100644
--- a/src/main/java/net/minecraft/server/Container.java
+++ b/src/main/java/net/minecraft/server/Container.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
import java.util.ArrayList;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
@@ -16,8 +17,11 @@ public abstract class Container {
public List c = new ArrayList();
public int windowId = 0;
private short a = 0;
+ private int f = -1;
+ private int g = 0;
+ private final Set h = new HashSet();
protected List listeners = new ArrayList();
- private Set f = new HashSet();
+ private Set i = new HashSet();
// CraftBukkit start
public boolean checkReachable = true;
@@ -105,168 +109,276 @@ public abstract class Container {
public ItemStack clickItem(int i, int j, int k, EntityHuman entityhuman) {
ItemStack itemstack = null;
PlayerInventory playerinventory = entityhuman.inventory;
- Slot slot;
- ItemStack itemstack1;
int l;
- ItemStack itemstack2;
-
- if ((k == 0 || k == 1) && (j == 0 || j == 1)) {
- if (i == -999) {
- if (playerinventory.getCarried() != null && i == -999) {
- if (j == 0) {
- entityhuman.drop(playerinventory.getCarried());
- playerinventory.setCarried((ItemStack) null);
- }
+ ItemStack itemstack1;
- if (j == 1) {
- // CraftBukkit start - store a reference
- ItemStack itemstack3 = playerinventory.getCarried();
- if (itemstack3.count > 0) {
- entityhuman.drop(itemstack3.a(1));
- }
+ if (k == 5) {
+ int i1 = this.g;
+
+ this.g = c(j);
+ if ((i1 != 1 || this.g != 2) && i1 != this.g) {
+ this.d();
+ } else if (playerinventory.getCarried() == null) {
+ this.d();
+ } else if (this.g == 0) {
+ this.f = b(j);
+ if (d(this.f)) {
+ this.g = 1;
+ this.h.clear();
+ } else {
+ this.d();
+ }
+ } else if (this.g == 1) {
+ Slot slot = (Slot) this.c.get(i);
- if (itemstack3.count == 0) {
- // CraftBukkit end
- playerinventory.setCarried((ItemStack) null);
- }
- }
+ if (slot != null && a(slot, playerinventory.getCarried(), true) && slot.isAllowed(playerinventory.getCarried()) && playerinventory.getCarried().count > this.h.size() && this.b(slot)) {
+ this.h.add(slot);
}
- } else if (k == 1) {
- slot = (Slot) this.c.get(i);
- if (slot != null && slot.a(entityhuman)) {
- itemstack1 = this.b(entityhuman, i);
- if (itemstack1 != null) {
- int i1 = itemstack1.id;
-
- itemstack = itemstack1.cloneItemStack();
- if (slot != null && slot.getItem() != null && slot.getItem().id == i1) {
- this.a(i, j, true, entityhuman);
+ } else if (this.g == 2) {
+ if (!this.h.isEmpty()) {
+ itemstack1 = playerinventory.getCarried().cloneItemStack();
+ l = playerinventory.getCarried().count;
+ Iterator iterator = this.h.iterator();
+
+ while (iterator.hasNext()) {
+ Slot slot1 = (Slot) iterator.next();
+
+ if (slot1 != null && a(slot1, playerinventory.getCarried(), true) && slot1.isAllowed(playerinventory.getCarried()) && playerinventory.getCarried().count >= this.h.size() && this.b(slot1)) {
+ ItemStack itemstack2 = itemstack1.cloneItemStack();
+ int j1 = slot1.d() ? slot1.getItem().count : 0;
+
+ a(this.h, this.f, itemstack2, j1);
+ if (itemstack2.count > itemstack2.getMaxStackSize()) {
+ itemstack2.count = itemstack2.getMaxStackSize();
+ }
+
+ if (itemstack2.count > slot1.a()) {
+ itemstack2.count = slot1.a();
+ }
+
+ l -= itemstack2.count - j1;
+ slot1.set(itemstack2);
}
}
- }
- } else {
- if (i < 0) {
- return null;
- }
- slot = (Slot) this.c.get(i);
- if (slot != null) {
- itemstack1 = slot.getItem();
- ItemStack itemstack3 = playerinventory.getCarried();
-
- if (itemstack1 != null) {
- itemstack = itemstack1.cloneItemStack();
+ itemstack1.count = l;
+ if (itemstack1.count <= 0) {
+ itemstack1 = null;
}
- if (itemstack1 == null) {
- if (itemstack3 != null && slot.isAllowed(itemstack3)) {
- l = j == 0 ? itemstack3.count : 1;
- if (l > slot.a()) {
- l = slot.a();
- }
+ playerinventory.setCarried(itemstack1);
+ }
- // CraftBukkit start
- if (itemstack3.count >= l) {
- slot.set(itemstack3.a(l));
+ this.d();
+ } else {
+ this.d();
+ }
+ } else if (this.g != 0) {
+ this.d();
+ } else {
+ Slot slot2;
+ int k1;
+ ItemStack itemstack3;
+
+ if ((k == 0 || k == 1) && (j == 0 || j == 1)) {
+ if (i == -999) {
+ if (playerinventory.getCarried() != null && i == -999) {
+ if (j == 0) {
+ entityhuman.drop(playerinventory.getCarried());
+ playerinventory.setCarried((ItemStack) null);
+ }
+
+ if (j == 1) {
+ // CraftBukkit start - store a reference
+ ItemStack itemstack4 = playerinventory.getCarried();
+ if (itemstack4.count > 0) {
+ entityhuman.drop(itemstack4.a(1));
}
- // CraftBukkit end
- if (itemstack3.count == 0) {
+ if (itemstack4.count == 0) {
+ // CraftBukkit end
playerinventory.setCarried((ItemStack) null);
}
}
- } else if (slot.a(entityhuman)) {
- if (itemstack3 == null) {
- l = j == 0 ? itemstack1.count : (itemstack1.count + 1) / 2;
- itemstack2 = slot.a(l);
- playerinventory.setCarried(itemstack2);
- if (itemstack1.count == 0) {
- slot.set((ItemStack) null);
+ }
+ } else if (k == 1) {
+ if (i < 0) {
+ return null;
+ }
+
+ slot2 = (Slot) this.c.get(i);
+ if (slot2 != null && slot2.a(entityhuman)) {
+ itemstack1 = this.b(entityhuman, i);
+ if (itemstack1 != null) {
+ l = itemstack1.id;
+ itemstack = itemstack1.cloneItemStack();
+ if (slot2 != null && slot2.getItem() != null && slot2.getItem().id == l) {
+ this.a(i, j, true, entityhuman);
}
+ }
+ }
+ } else {
+ if (i < 0) {
+ return null;
+ }
- slot.a(entityhuman, playerinventory.getCarried());
- } else if (slot.isAllowed(itemstack3)) {
- if (itemstack1.id == itemstack3.id && itemstack1.getData() == itemstack3.getData() && ItemStack.equals(itemstack1, itemstack3)) {
- l = j == 0 ? itemstack3.count : 1;
- if (l > slot.a() - itemstack1.count) {
- l = slot.a() - itemstack1.count;
+ slot2 = (Slot) this.c.get(i);
+ if (slot2 != null) {
+ itemstack1 = slot2.getItem();
+ ItemStack itemstack4 = playerinventory.getCarried();
+
+ if (itemstack1 != null) {
+ itemstack = itemstack1.cloneItemStack();
+ }
+
+ if (itemstack1 == null) {
+ if (itemstack4 != null && slot2.isAllowed(itemstack4)) {
+ k1 = j == 0 ? itemstack4.count : 1;
+ if (k1 > slot2.a()) {
+ k1 = slot2.a();
}
- if (l > itemstack3.getMaxStackSize() - itemstack1.count) {
- l = itemstack3.getMaxStackSize() - itemstack1.count;
+ // CraftBukkit start
+ if (itemstack4.count >= k1) {
+ slot2.set(itemstack4.a(k1));
}
+ // CraftBukkit end
- itemstack3.a(l);
- if (itemstack3.count == 0) {
+ if (itemstack4.count == 0) {
playerinventory.setCarried((ItemStack) null);
}
-
- itemstack1.count += l;
- } else if (itemstack3.count <= slot.a()) {
- slot.set(itemstack3);
- playerinventory.setCarried(itemstack1);
}
- } else if (itemstack1.id == itemstack3.id && itemstack3.getMaxStackSize() > 1 && (!itemstack1.usesData() || itemstack1.getData() == itemstack3.getData()) && ItemStack.equals(itemstack1, itemstack3)) {
- l = itemstack1.count;
- if (l > 0 && l + itemstack3.count <= itemstack3.getMaxStackSize()) {
- itemstack3.count += l;
- itemstack1 = slot.a(l);
+ } else if (slot2.a(entityhuman)) {
+ if (itemstack4 == null) {
+ k1 = j == 0 ? itemstack1.count : (itemstack1.count + 1) / 2;
+ itemstack3 = slot2.a(k1);
+ playerinventory.setCarried(itemstack3);
if (itemstack1.count == 0) {
- slot.set((ItemStack) null);
+ slot2.set((ItemStack) null);
}
- slot.a(entityhuman, playerinventory.getCarried());
+ slot2.a(entityhuman, playerinventory.getCarried());
+ } else if (slot2.isAllowed(itemstack4)) {
+ if (itemstack1.id == itemstack4.id && itemstack1.getData() == itemstack4.getData() && ItemStack.equals(itemstack1, itemstack4)) {
+ k1 = j == 0 ? itemstack4.count : 1;
+ if (k1 > slot2.a() - itemstack1.count) {
+ k1 = slot2.a() - itemstack1.count;
+ }
+
+ if (k1 > itemstack4.getMaxStackSize() - itemstack1.count) {
+ k1 = itemstack4.getMaxStackSize() - itemstack1.count;
+ }
+
+ itemstack4.a(k1);
+ if (itemstack4.count == 0) {
+ playerinventory.setCarried((ItemStack) null);
+ }
+
+ itemstack1.count += k1;
+ } else if (itemstack4.count <= slot2.a()) {
+ slot2.set(itemstack4);
+ playerinventory.setCarried(itemstack1);
+ }
+ } else if (itemstack1.id == itemstack4.id && itemstack4.getMaxStackSize() > 1 && (!itemstack1.usesData() || itemstack1.getData() == itemstack4.getData()) && ItemStack.equals(itemstack1, itemstack4)) {
+ k1 = itemstack1.count;
+ if (k1 > 0 && k1 + itemstack4.count <= itemstack4.getMaxStackSize()) {
+ itemstack4.count += k1;
+ itemstack1 = slot2.a(k1);
+ if (itemstack1.count == 0) {
+ slot2.set((ItemStack) null);
+ }
+
+ slot2.a(entityhuman, playerinventory.getCarried());
+ }
}
}
+
+ slot2.e();
+ }
+ }
+ } else if (k == 2 && j >= 0 && j < 9) {
+ slot2 = (Slot) this.c.get(i);
+ if (slot2.a(entityhuman)) {
+ itemstack1 = playerinventory.getItem(j);
+ boolean flag = itemstack1 == null || slot2.inventory == playerinventory && slot2.isAllowed(itemstack1);
+
+ k1 = -1;
+ if (!flag) {
+ k1 = playerinventory.j();
+ flag |= k1 > -1;
}
- slot.e();
+ if (slot2.d() && flag) {
+ itemstack3 = slot2.getItem();
+ playerinventory.setItem(j, itemstack3);
+ if ((slot2.inventory != playerinventory || !slot2.isAllowed(itemstack1)) && itemstack1 != null) {
+ if (k1 > -1) {
+ playerinventory.pickup(itemstack1);
+ slot2.a(itemstack3.count);
+ slot2.set((ItemStack) null);
+ slot2.a(entityhuman, itemstack3);
+ }
+ } else {
+ slot2.a(itemstack3.count);
+ slot2.set(itemstack1);
+ slot2.a(entityhuman, itemstack3);
+ }
+ } else if (!slot2.d() && itemstack1 != null && slot2.isAllowed(itemstack1)) {
+ playerinventory.setItem(j, (ItemStack) null);
+ slot2.set(itemstack1);
+ }
}
- }
- } else if (k == 2 && j >= 0 && j < 9) {
- slot = (Slot) this.c.get(i);
- if (slot.a(entityhuman)) {
- itemstack1 = playerinventory.getItem(j);
- boolean flag = itemstack1 == null || slot.inventory == playerinventory && slot.isAllowed(itemstack1);
-
- l = -1;
- if (!flag) {
- l = playerinventory.i();
- flag |= l > -1;
+ } else if (k == 3 && entityhuman.abilities.canInstantlyBuild && playerinventory.getCarried() == null && i >= 0) {
+ slot2 = (Slot) this.c.get(i);
+ if (slot2 != null && slot2.d()) {
+ itemstack1 = slot2.getItem().cloneItemStack();
+ itemstack1.count = itemstack1.getMaxStackSize();
+ playerinventory.setCarried(itemstack1);
+ }
+ } else if (k == 4 && playerinventory.getCarried() == null && i >= 0) {
+ slot2 = (Slot) this.c.get(i);
+ if (slot2 != null && slot2.d()) {
+ itemstack1 = slot2.a(j == 0 ? 1 : slot2.getItem().count);
+ slot2.a(entityhuman, itemstack1);
+ entityhuman.drop(itemstack1);
}
+ } else if (k == 6 && i >= 0) {
+ slot2 = (Slot) this.c.get(i);
+ itemstack1 = playerinventory.getCarried();
+ if (itemstack1 != null && (slot2 == null || !slot2.d() || !slot2.a(entityhuman))) {
+ l = j == 0 ? 0 : this.c.size() - 1;
+ k1 = j == 0 ? 1 : -1;
+
+ for (int l1 = 0; l1 < 2; ++l1) {
+ for (int i2 = l; i2 >= 0 && i2 < this.c.size() && itemstack1.count < itemstack1.getMaxStackSize(); i2 += k1) {
+ Slot slot3 = (Slot) this.c.get(i2);
+
+ if (slot3.d() && a(slot3, itemstack1, true) && slot3.a(entityhuman) && this.a(itemstack1, slot3) && (l1 != 0 || slot3.getItem().count != slot3.getItem().getMaxStackSize())) {
+ int j2 = Math.min(itemstack1.getMaxStackSize() - itemstack1.count, slot3.getItem().count);
+ ItemStack itemstack5 = slot3.a(j2);
+
+ itemstack1.count += j2;
+ if (itemstack5.count <= 0) {
+ slot3.set((ItemStack) null);
+ }
- if (slot.d() && flag) {
- itemstack2 = slot.getItem();
- playerinventory.setItem(j, itemstack2);
- if ((slot.inventory != playerinventory || !slot.isAllowed(itemstack1)) && itemstack1 != null) {
- if (l > -1) {
- playerinventory.pickup(itemstack1);
- slot.a(itemstack2.count);
- slot.set((ItemStack) null);
- slot.a(entityhuman, itemstack2);
+ slot3.a(entityhuman, itemstack5);
+ }
}
- } else {
- slot.a(itemstack2.count);
- slot.set(itemstack1);
- slot.a(entityhuman, itemstack2);
}
- } else if (!slot.d() && itemstack1 != null && slot.isAllowed(itemstack1)) {
- playerinventory.setItem(j, (ItemStack) null);
- slot.set(itemstack1);
}
- }
- } else if (k == 3 && entityhuman.abilities.canInstantlyBuild && playerinventory.getCarried() == null && i >= 0) {
- slot = (Slot) this.c.get(i);
- if (slot != null && slot.d()) {
- itemstack1 = slot.getItem().cloneItemStack();
- itemstack1.count = itemstack1.getMaxStackSize();
- playerinventory.setCarried(itemstack1);
+
+ this.b();
}
}
return itemstack;
}
+ public boolean a(ItemStack itemstack, Slot slot) {
+ return true;
+ }
+
protected void a(int i, int j, boolean flag, EntityHuman entityhuman) {
this.clickItem(i, j, 1, entityhuman);
}
@@ -289,14 +401,14 @@ public abstract class Container {
}
public boolean c(EntityHuman entityhuman) {
- return !this.f.contains(entityhuman);
+ return !this.i.contains(entityhuman);
}
public void a(EntityHuman entityhuman, boolean flag) {
if (flag) {
- this.f.remove(entityhuman);
+ this.i.remove(entityhuman);
} else {
- this.f.add(entityhuman);
+ this.i.add(entityhuman);
}
}
@@ -369,4 +481,71 @@ public abstract class Container {
return flag1;
}
+
+ public static int b(int i) {
+ return i >> 2 & 3;
+ }
+
+ public static int c(int i) {
+ return i & 3;
+ }
+
+ public static boolean d(int i) {
+ return i == 0 || i == 1;
+ }
+
+ protected void d() {
+ this.g = 0;
+ this.h.clear();
+ }
+
+ public static boolean a(Slot slot, ItemStack itemstack, boolean flag) {
+ boolean flag1 = slot == null || !slot.d();
+
+ if (slot != null && slot.d() && itemstack != null && itemstack.doMaterialsMatch(slot.getItem()) && ItemStack.equals(slot.getItem(), itemstack)) {
+ int i = flag ? 0 : itemstack.count;
+
+ flag1 |= slot.getItem().count + i <= itemstack.getMaxStackSize();
+ }
+
+ return flag1;
+ }
+
+ public static void a(Set set, int i, ItemStack itemstack, int j) {
+ switch (i) {
+ case 0:
+ itemstack.count = MathHelper.d((float) itemstack.count / (float) set.size());
+ break;
+
+ case 1:
+ itemstack.count = 1;
+ }
+
+ itemstack.count += j;
+ }
+
+ public boolean b(Slot slot) {
+ return true;
+ }
+
+ public static int b(IInventory iinventory) {
+ if (iinventory == null) {
+ return 0;
+ } else {
+ int i = 0;
+ float f = 0.0F;
+
+ for (int j = 0; j < iinventory.getSize(); ++j) {
+ ItemStack itemstack = iinventory.getItem(j);
+
+ if (itemstack != null) {
+ f += (float) itemstack.count / (float) Math.min(iinventory.getMaxStackSize(), itemstack.getMaxStackSize());
+ ++i;
+ }
+ }
+
+ f /= (float) iinventory.getSize();
+ return MathHelper.d(f * 14.0F) + (i > 0 ? 1 : 0);
+ }
+ }
}
diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java
index 328db44c..fbf76421 100644
--- a/src/main/java/net/minecraft/server/ContainerAnvil.java
+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java
@@ -12,7 +12,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
public class ContainerAnvil extends Container {
private IInventory f = new InventoryCraftResult();
- private IInventory g = new ContainerAnvilInventory(this, "Repair", 2);
+ private IInventory g = new ContainerAnvilInventory(this, "Repair", true, 2);
private World h;
private int i;
private int j;
@@ -53,11 +53,11 @@ public class ContainerAnvil extends Container {
public void a(IInventory iinventory) {
super.a(iinventory);
if (iinventory == this.g) {
- this.d();
+ this.e();
}
}
- public void d() {
+ public void e() {
ItemStack itemstack = this.g.getItem(0);
this.a = 0;
@@ -86,8 +86,8 @@ public class ContainerAnvil extends Container {
if (itemstack2 != null) {
flag = itemstack2.id == Item.ENCHANTED_BOOK.id && Item.ENCHANTED_BOOK.g(itemstack2).size() > 0;
- if (itemstack1.f() && Item.byId[itemstack1.id].a(itemstack, itemstack2)) {
- l = Math.min(itemstack1.i(), itemstack1.k() / 4);
+ if (itemstack1.g() && Item.byId[itemstack1.id].a(itemstack, itemstack2)) {
+ l = Math.min(itemstack1.j(), itemstack1.l() / 4);
if (l <= 0) {
this.f.setItem(0, (ItemStack) null);
this.a = 0;
@@ -95,27 +95,27 @@ public class ContainerAnvil extends Container {
}
for (i1 = 0; l > 0 && i1 < itemstack2.count; ++i1) {
- j1 = itemstack1.i() - l;
+ j1 = itemstack1.j() - l;
itemstack1.setData(j1);
i += Math.max(1, l / 100) + map.size();
- l = Math.min(itemstack1.i(), itemstack1.k() / 4);
+ l = Math.min(itemstack1.j(), itemstack1.l() / 4);
}
this.l = i1;
} else {
- if (!flag && (itemstack1.id != itemstack2.id || !itemstack1.f())) {
+ if (!flag && (itemstack1.id != itemstack2.id || !itemstack1.g())) {
this.f.setItem(0, (ItemStack) null);
this.a = 0;
return;
}
- if (itemstack1.f() && !flag) {
- l = itemstack.k() - itemstack.i();
- i1 = itemstack2.k() - itemstack2.i();
- j1 = i1 + itemstack1.k() * 12 / 100;
+ if (itemstack1.g() && !flag) {
+ l = itemstack.l() - itemstack.j();
+ i1 = itemstack2.l() - itemstack2.j();
+ j1 = i1 + itemstack1.l() * 12 / 100;
int i2 = l + j1;
- k1 = itemstack1.k() - i2;
+ k1 = itemstack1.l() - i2;
if (k1 < 0) {
k1 = 0;
}
@@ -206,10 +206,10 @@ public class ContainerAnvil extends Container {
}
}
- if (this.m != null && !this.m.equalsIgnoreCase(itemstack.r()) && this.m.length() > 0) {
- j = itemstack.f() ? 7 : itemstack.count * 5;
+ if (this.m != null && !this.m.equalsIgnoreCase(itemstack.getName()) && this.m.length() > 0) {
+ j = itemstack.g() ? 7 : itemstack.count * 5;
i += j;
- if (itemstack.s()) {
+ if (itemstack.hasName()) {
k += j / 2;
}
@@ -264,7 +264,7 @@ public class ContainerAnvil extends Container {
}
if (j == i && j > 0 && this.a >= 40) {
- //System.out.println("Naming an item only, cost too high; giving discount to cap cost to 39 levels"); // CraftBukkit -remove debug
+ // this.h.getLogger().info("Naming an item only, cost too high; giving discount to cap cost to 39 levels"); // CraftBukkit - remove debug
this.a = 39;
}
@@ -278,7 +278,7 @@ public class ContainerAnvil extends Container {
i1 = itemstack2.getRepairCost();
}
- if (itemstack1.s()) {
+ if (itemstack1.hasName()) {
i1 -= 9;
}
@@ -363,7 +363,7 @@ public class ContainerAnvil extends Container {
this.getSlot(2).getItem().c(this.m);
}
- this.d();
+ this.e();
}
static IInventory a(ContainerAnvil containeranvil) {
diff --git a/src/main/java/net/minecraft/server/ContainerAnvilInventory.java b/src/main/java/net/minecraft/server/ContainerAnvilInventory.java
index 6a24bca3..465d6c8c 100644
--- a/src/main/java/net/minecraft/server/ContainerAnvilInventory.java
+++ b/src/main/java/net/minecraft/server/ContainerAnvilInventory.java
@@ -40,8 +40,8 @@ public class ContainerAnvilInventory extends InventorySubcontainer { // CraftBuk
}
// CraftBukkit end
- ContainerAnvilInventory(ContainerAnvil containeranvil, String s, int i) {
- super(s, i);
+ ContainerAnvilInventory(ContainerAnvil containeranvil, String s, boolean flag, int i) {
+ super(s, flag, i);
this.a = containeranvil;
this.setMaxStackSize(1); // CraftBukkit
}
@@ -50,4 +50,8 @@ public class ContainerAnvilInventory extends InventorySubcontainer { // CraftBuk
super.update();
this.a.a((IInventory) this);
}
+
+ public boolean b(int i, ItemStack itemstack) {
+ return true;
+ }
}
diff --git a/src/main/java/net/minecraft/server/ContainerBeacon.java b/src/main/java/net/minecraft/server/ContainerBeacon.java
index e0751630..814327cf 100644
--- a/src/main/java/net/minecraft/server/ContainerBeacon.java
+++ b/src/main/java/net/minecraft/server/ContainerBeacon.java
@@ -37,9 +37,9 @@ public class ContainerBeacon extends Container {
this.a(new Slot(playerinventory, i, b0 + i * 18, 58 + short1));
}
- this.g = tileentitybeacon.k();
- this.h = tileentitybeacon.i();
- this.i = tileentitybeacon.j();
+ this.g = tileentitybeacon.l();
+ this.h = tileentitybeacon.j();
+ this.i = tileentitybeacon.k();
}
public void addSlotListener(ICrafting icrafting) {
@@ -53,13 +53,13 @@ public class ContainerBeacon extends Container {
super.b();
}
- public TileEntityBeacon d() {
+ public TileEntityBeacon e() {
return this.a;
}
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
- return this.a.a_(entityhuman);
+ return this.a.a(entityhuman);
}
public ItemStack b(EntityHuman entityhuman, int i) {
diff --git a/src/main/java/net/minecraft/server/ContainerBrewingStand.java b/src/main/java/net/minecraft/server/ContainerBrewingStand.java
index 3411dbbc..b796ffdb 100644
--- a/src/main/java/net/minecraft/server/ContainerBrewingStand.java
+++ b/src/main/java/net/minecraft/server/ContainerBrewingStand.java
@@ -57,7 +57,7 @@ public class ContainerBrewingStand extends Container {
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
- return this.brewingStand.a_(entityhuman);
+ return this.brewingStand.a(entityhuman);
}
public ItemStack b(EntityHuman entityhuman, int i) {
diff --git a/src/main/java/net/minecraft/server/ContainerChest.java b/src/main/java/net/minecraft/server/ContainerChest.java
index b36d9325..1ea3d22f 100644
--- a/src/main/java/net/minecraft/server/ContainerChest.java
+++ b/src/main/java/net/minecraft/server/ContainerChest.java
@@ -64,7 +64,7 @@ public class ContainerChest extends Container {
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
- return this.container.a_(entityhuman);
+ return this.container.a(entityhuman);
}
public ItemStack b(EntityHuman entityhuman, int i) {
@@ -95,10 +95,10 @@ public class ContainerChest extends Container {
public void b(EntityHuman entityhuman) {
super.b(entityhuman);
- this.container.f();
+ this.container.g();
}
- public IInventory d() {
+ public IInventory e() {
return this.container;
}
}
diff --git a/src/main/java/net/minecraft/server/ContainerDispenser.java b/src/main/java/net/minecraft/server/ContainerDispenser.java
index f4c093b0..594477c1 100644
--- a/src/main/java/net/minecraft/server/ContainerDispenser.java
+++ b/src/main/java/net/minecraft/server/ContainerDispenser.java
@@ -42,7 +42,7 @@ public class ContainerDispenser extends Container {
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
- return this.items.a_(entityhuman);
+ return this.items.a(entityhuman);
}
public ItemStack b(EntityHuman entityhuman, int i) {
diff --git a/src/main/java/net/minecraft/server/ContainerEnchantTable.java b/src/main/java/net/minecraft/server/ContainerEnchantTable.java
index 6819a606..02d861e0 100644
--- a/src/main/java/net/minecraft/server/ContainerEnchantTable.java
+++ b/src/main/java/net/minecraft/server/ContainerEnchantTable.java
@@ -17,7 +17,7 @@ import org.bukkit.entity.Player;
public class ContainerEnchantTable extends Container {
// CraftBukkit - make type specific (changed from IInventory)
- public ContainerEnchantTableInventory enchantSlots = new ContainerEnchantTableInventory(this, "Enchant", 1);
+ public ContainerEnchantTableInventory enchantSlots = new ContainerEnchantTableInventory(this, "Enchant", true, 1);
private World world;
private int x;
private int y;
@@ -79,7 +79,7 @@ public class ContainerEnchantTable extends Container {
ItemStack itemstack = iinventory.getItem(0);
int i;
- if (itemstack != null && itemstack.v()) {
+ if (itemstack != null && itemstack.w()) {
this.f = this.l.nextLong();
if (!this.world.isStatic) {
i = 0;
diff --git a/src/main/java/net/minecraft/server/ContainerEnchantTableInventory.java b/src/main/java/net/minecraft/server/ContainerEnchantTableInventory.java
index 0075cb16..c279eb3f 100644
--- a/src/main/java/net/minecraft/server/ContainerEnchantTableInventory.java
+++ b/src/main/java/net/minecraft/server/ContainerEnchantTableInventory.java
@@ -40,8 +40,8 @@ public class ContainerEnchantTableInventory extends InventorySubcontainer { // C
}
// CraftBukkit end
- ContainerEnchantTableInventory(ContainerEnchantTable containerenchanttable, String s, int i) {
- super(s, i);
+ ContainerEnchantTableInventory(ContainerEnchantTable containerenchanttable, String s, boolean flag, int i) {
+ super(s, flag, i);
this.enchantTable = containerenchanttable;
this.setMaxStackSize(1); // CraftBukkit
}
@@ -54,4 +54,8 @@ public class ContainerEnchantTableInventory extends InventorySubcontainer { // C
super.update();
this.enchantTable.a((IInventory) this);
}
+
+ public boolean b(int i, ItemStack itemstack) {
+ return true;
+ }
}
diff --git a/src/main/java/net/minecraft/server/ContainerFurnace.java b/src/main/java/net/minecraft/server/ContainerFurnace.java
index d8f497b1..5b744d9a 100644
--- a/src/main/java/net/minecraft/server/ContainerFurnace.java
+++ b/src/main/java/net/minecraft/server/ContainerFurnace.java
@@ -80,7 +80,7 @@ public class ContainerFurnace extends Container {
public boolean a(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit
- return this.furnace.a_(entityhuman);
+ return this.furnace.a(entityhuman);
}
public ItemStack b(EntityHuman entityhuman, int i) {
diff --git a/src/main/java/net/minecraft/server/ContainerHopper.java b/src/main/java/net/minecraft/server/ContainerHopper.java
new file mode 100644
index 00000000..83b95d13
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ContainerHopper.java
@@ -0,0 +1,85 @@
+package net.minecraft.server;
+
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventory;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+// CraftBukkit end
+
+public class ContainerHopper extends Container {
+
+ private final IInventory a;
+
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity = null;
+ private PlayerInventory player;
+
+ public CraftInventoryView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
+ CraftInventory inventory = new CraftInventory(this.a); // Should be this.hopper
+ bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
+ return bukkitEntity;
+ }
+ // CraftBukkit end
+
+ public ContainerHopper(PlayerInventory playerinventory, IInventory iinventory) {
+ this.a = iinventory;
+ this.player = playerinventory; // CraftBukkit - save player
+ iinventory.startOpen();
+ byte b0 = 51;
+
+ int i;
+
+ for (i = 0; i < iinventory.getSize(); ++i) {
+ this.a(new Slot(iinventory, i, 44 + i * 18, 20));
+ }
+
+ for (i = 0; i < 3; ++i) {
+ for (int j = 0; j < 9; ++j) {
+ this.a(new Slot(playerinventory, j + i * 9 + 9, 8 + j * 18, i * 18 + b0));
+ }
+ }
+
+ for (i = 0; i < 9; ++i) {
+ this.a(new Slot(playerinventory, i, 8 + i * 18, 58 + b0));
+ }
+ }
+
+ public boolean a(EntityHuman entityhuman) {
+ if (!this.checkReachable) return true; // CraftBukkit
+ return this.a.a(entityhuman);
+ }
+
+ public ItemStack b(EntityHuman entityhuman, int i) {
+ ItemStack itemstack = null;
+ Slot slot = (Slot) this.c.get(i);
+
+ if (slot != null && slot.d()) {
+ ItemStack itemstack1 = slot.getItem();
+
+ itemstack = itemstack1.cloneItemStack();
+ if (i < this.a.getSize()) {
+ if (!this.a(itemstack1, this.a.getSize(), this.c.size(), true)) {
+ return null;
+ }
+ } else if (!this.a(itemstack1, 0, this.a.getSize(), false)) {
+ return null;
+ }
+
+ if (itemstack1.count == 0) {
+ slot.set((ItemStack) null);
+ } else {
+ slot.e();
+ }
+ }
+
+ return itemstack;
+ }
+
+ public void b(EntityHuman entityhuman) {
+ super.b(entityhuman);
+ this.a.g();
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ContainerMerchant.java b/src/main/java/net/minecraft/server/ContainerMerchant.java
index 0b97cf8b..2f256780 100644
--- a/src/main/java/net/minecraft/server/ContainerMerchant.java
+++ b/src/main/java/net/minecraft/server/ContainerMerchant.java
@@ -56,11 +56,11 @@ public class ContainerMerchant extends Container {
}
public void a(IInventory iinventory) {
- this.f.g();
+ this.f.h();
super.a(iinventory);
}
- public void b(int i) {
+ public void e(int i) {
this.f.c(i);
}
@@ -112,7 +112,7 @@ public class ContainerMerchant extends Container {
public void b(EntityHuman entityhuman) {
super.b(entityhuman);
- this.merchant.b_((EntityHuman) null);
+ this.merchant.a((EntityHuman) null);
super.b(entityhuman);
if (!this.g.isStatic) {
ItemStack itemstack = this.f.splitWithoutUpdate(0);
diff --git a/src/main/java/net/minecraft/server/ContainerPlayer.java b/src/main/java/net/minecraft/server/ContainerPlayer.java
index 5c850f8b..d230ce76 100644
--- a/src/main/java/net/minecraft/server/ContainerPlayer.java
+++ b/src/main/java/net/minecraft/server/ContainerPlayer.java
@@ -105,8 +105,8 @@ public class ContainerPlayer extends Container {
if (!this.a(itemstack1, 9, 45, false)) {
return null;
}
- } else if (itemstack.getItem() instanceof ItemArmor && !((Slot) this.c.get(5 + ((ItemArmor) itemstack.getItem()).a)).d()) {
- int j = 5 + ((ItemArmor) itemstack.getItem()).a;
+ } else if (itemstack.getItem() instanceof ItemArmor && !((Slot) this.c.get(5 + ((ItemArmor) itemstack.getItem()).b)).d()) {
+ int j = 5 + ((ItemArmor) itemstack.getItem()).b;
if (!this.a(itemstack1, j, j + 1, false)) {
return null;
@@ -139,6 +139,10 @@ public class ContainerPlayer extends Container {
return itemstack;
}
+ public boolean a(ItemStack itemstack, Slot slot) {
+ return slot.inventory != this.resultInventory && super.a(itemstack, slot);
+ }
+
// CraftBukkit start
public CraftInventoryView getBukkitView() {
if (bukkitEntity != null) {
diff --git a/src/main/java/net/minecraft/server/ContainerWorkbench.java b/src/main/java/net/minecraft/server/ContainerWorkbench.java
index eb2fe72a..2436d081 100644
--- a/src/main/java/net/minecraft/server/ContainerWorkbench.java
+++ b/src/main/java/net/minecraft/server/ContainerWorkbench.java
@@ -127,6 +127,10 @@ public class ContainerWorkbench extends Container {
return itemstack;
}
+ public boolean a(ItemStack itemstack, Slot slot) {
+ return slot.inventory != this.resultInventory && super.a(itemstack, slot);
+ }
+
// CraftBukkit start
public CraftInventoryView getBukkitView() {
if (bukkitEntity != null) {
diff --git a/src/main/java/net/minecraft/server/ControllerLook.java b/src/main/java/net/minecraft/server/ControllerLook.java
index bed36954..bd297b38 100644
--- a/src/main/java/net/minecraft/server/ControllerLook.java
+++ b/src/main/java/net/minecraft/server/ControllerLook.java
@@ -53,20 +53,20 @@ public class ControllerLook {
// CraftBukkit end
this.a.pitch = this.a(this.a.pitch, f1, this.c);
- this.a.az = this.a(this.a.az, f, this.b);
+ this.a.aA = this.a(this.a.aA, f, this.b);
} else {
- this.a.az = this.a(this.a.az, this.a.ax, 10.0F);
+ this.a.aA = this.a(this.a.aA, this.a.ax, 10.0F);
}
- float f2 = MathHelper.g(this.a.az - this.a.ax);
+ float f2 = MathHelper.g(this.a.aA - this.a.ay);
if (!this.a.getNavigation().f()) {
if (f2 < -75.0F) {
- this.a.az = this.a.ax - 75.0F;
+ this.a.aA = this.a.ay - 75.0F;
}
if (f2 > 75.0F) {
- this.a.az = this.a.ax + 75.0F;
+ this.a.aA = this.a.ay + 75.0F;
}
}
}
diff --git a/src/main/java/net/minecraft/server/ControllerMove.java b/src/main/java/net/minecraft/server/ControllerMove.java
index 4fbaaffb..1b66c970 100644
--- a/src/main/java/net/minecraft/server/ControllerMove.java
+++ b/src/main/java/net/minecraft/server/ControllerMove.java
@@ -47,7 +47,7 @@ public class ControllerMove {
float f = (float) (org.bukkit.craftbukkit.TrigMath.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
this.a.yaw = this.a(this.a.yaw, f, 30.0F);
- this.a.e(this.e * this.a.bB());
+ this.a.e(this.e * this.a.bE());
if (d2 > 0.0D && d0 * d0 + d1 * d1 < 1.0D) {
this.a.getControllerJump().a();
}
diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java
index e33bc55e..ff81d366 100644
--- a/src/main/java/net/minecraft/server/CraftingManager.java
+++ b/src/main/java/net/minecraft/server/CraftingManager.java
@@ -45,9 +45,11 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Block.NOTE_BLOCK, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.REDSTONE});
this.registerShapedRecipe(new ItemStack(Block.BOOKSHELF, 1), new Object[] { "###", "XXX", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.BOOK});
this.registerShapedRecipe(new ItemStack(Block.SNOW_BLOCK, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.SNOW_BALL});
+ this.registerShapedRecipe(new ItemStack(Block.SNOW, 6), new Object[] { "###", Character.valueOf('#'), Block.SNOW_BLOCK});
this.registerShapedRecipe(new ItemStack(Block.CLAY, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.CLAY_BALL});
this.registerShapedRecipe(new ItemStack(Block.BRICK, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.CLAY_BRICK});
this.registerShapedRecipe(new ItemStack(Block.GLOWSTONE, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.GLOWSTONE_DUST});
+ this.registerShapedRecipe(new ItemStack(Block.QUARTZ_BLOCK, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.QUARTZ});
this.registerShapedRecipe(new ItemStack(Block.WOOL, 1), new Object[] { "##", "##", Character.valueOf('#'), Item.STRING});
this.registerShapedRecipe(new ItemStack(Block.TNT, 1), new Object[] { "X#X", "#X#", "X#X", Character.valueOf('X'), Item.SULPHUR, Character.valueOf('#'), Block.SAND});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 3), new Object[] { "###", Character.valueOf('#'), Block.COBBLESTONE});
@@ -56,6 +58,7 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 4), new Object[] { "###", Character.valueOf('#'), Block.BRICK});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 5), new Object[] { "###", Character.valueOf('#'), Block.SMOOTH_BRICK});
this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 6), new Object[] { "###", Character.valueOf('#'), Block.NETHER_BRICK});
+ this.registerShapedRecipe(new ItemStack(Block.STEP, 6, 7), new Object[] { "###", Character.valueOf('#'), Block.QUARTZ_BLOCK});
this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 0), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 0)});
this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 2), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 2)});
this.registerShapedRecipe(new ItemStack(Block.WOOD_STEP, 6, 1), new Object[] { "###", Character.valueOf('#'), new ItemStack(Block.WOOD, 1, 1)});
@@ -78,6 +81,7 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Item.GLASS_BOTTLE, 3), new Object[] { "# #", " # ", Character.valueOf('#'), Block.GLASS});
this.registerShapedRecipe(new ItemStack(Block.RAILS, 16), new Object[] { "X X", "X#X", "X X", Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('#'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Block.GOLDEN_RAIL, 6), new Object[] { "X X", "X#X", "XRX", Character.valueOf('X'), Item.GOLD_INGOT, Character.valueOf('R'), Item.REDSTONE, Character.valueOf('#'), Item.STICK});
+ this.registerShapedRecipe(new ItemStack(Block.ACTIVATOR_RAIL, 6), new Object[] { "XSX", "X#X", "XSX", Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('#'), Block.REDSTONE_TORCH_ON, Character.valueOf('S'), Item.STICK});
this.registerShapedRecipe(new ItemStack(Block.DETECTOR_RAIL, 6), new Object[] { "X X", "X#X", "XRX", Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('R'), Item.REDSTONE, Character.valueOf('#'), Block.STONE_PLATE});
this.registerShapedRecipe(new ItemStack(Item.MINECART, 1), new Object[] { "# #", "###", Character.valueOf('#'), Item.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Item.CAULDRON, 1), new Object[] { "# #", "# #", "###", Character.valueOf('#'), Item.IRON_INGOT});
@@ -85,6 +89,8 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Block.JACK_O_LANTERN, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.PUMPKIN, Character.valueOf('B'), Block.TORCH});
this.registerShapedRecipe(new ItemStack(Item.STORAGE_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.CHEST, Character.valueOf('B'), Item.MINECART});
this.registerShapedRecipe(new ItemStack(Item.POWERED_MINECART, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.FURNACE, Character.valueOf('B'), Item.MINECART});
+ this.registerShapedRecipe(new ItemStack(Item.MINECART_TNT, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.TNT, Character.valueOf('B'), Item.MINECART});
+ this.registerShapedRecipe(new ItemStack(Item.MINECART_HOPPER, 1), new Object[] { "A", "B", Character.valueOf('A'), Block.HOPPER, Character.valueOf('B'), Item.MINECART});
this.registerShapedRecipe(new ItemStack(Item.BOAT, 1), new Object[] { "# #", "###", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Item.BUCKET, 1), new Object[] { "# #", " # ", Character.valueOf('#'), Item.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Item.FLOWER_POT, 1), new Object[] { "# #", " # ", Character.valueOf('#'), Item.CLAY_BRICK});
@@ -101,6 +107,7 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Block.STONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.SMOOTH_BRICK});
this.registerShapedRecipe(new ItemStack(Block.NETHER_BRICK_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.NETHER_BRICK});
this.registerShapedRecipe(new ItemStack(Block.SANDSTONE_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.SANDSTONE});
+ this.registerShapedRecipe(new ItemStack(Block.QUARTZ_STAIRS, 4), new Object[] { "# ", "## ", "###", Character.valueOf('#'), Block.QUARTZ_BLOCK});
this.registerShapedRecipe(new ItemStack(Item.PAINTING, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Block.WOOL});
this.registerShapedRecipe(new ItemStack(Item.ITEM_FRAME, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.LEATHER});
this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1, 0), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.GOLD_NUGGET, Character.valueOf('X'), Item.APPLE});
@@ -110,6 +117,7 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Block.TRIPWIRE_SOURCE, 2), new Object[] { "I", "S", "#", Character.valueOf('#'), Block.WOOD, Character.valueOf('S'), Item.STICK, Character.valueOf('I'), Item.IRON_INGOT});
this.registerShapedRecipe(new ItemStack(Block.REDSTONE_TORCH_ON, 1), new Object[] { "X", "#", Character.valueOf('#'), Item.STICK, Character.valueOf('X'), Item.REDSTONE});
this.registerShapedRecipe(new ItemStack(Item.DIODE, 1), new Object[] { "#X#", "III", Character.valueOf('#'), Block.REDSTONE_TORCH_ON, Character.valueOf('X'), Item.REDSTONE, Character.valueOf('I'), Block.STONE});
+ this.registerShapedRecipe(new ItemStack(Item.REDSTONE_COMPARATOR, 1), new Object[] { " # ", "#X#", "III", Character.valueOf('#'), Block.REDSTONE_TORCH_ON, Character.valueOf('X'), Item.QUARTZ, Character.valueOf('I'), Block.STONE});
this.registerShapedRecipe(new ItemStack(Item.WATCH, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Item.GOLD_INGOT, Character.valueOf('X'), Item.REDSTONE});
this.registerShapedRecipe(new ItemStack(Item.COMPASS, 1), new Object[] { " # ", "#X#", " # ", Character.valueOf('#'), Item.IRON_INGOT, Character.valueOf('X'), Item.REDSTONE});
this.registerShapedRecipe(new ItemStack(Item.MAP_EMPTY, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.PAPER, Character.valueOf('X'), Item.COMPASS});
@@ -117,7 +125,10 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Block.WOOD_BUTTON, 1), new Object[] { "#", Character.valueOf('#'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.STONE_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Block.STONE});
this.registerShapedRecipe(new ItemStack(Block.WOOD_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Block.WOOD});
+ this.registerShapedRecipe(new ItemStack(Block.IRON_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Item.IRON_INGOT});
+ this.registerShapedRecipe(new ItemStack(Block.GOLD_PLATE, 1), new Object[] { "##", Character.valueOf('#'), Item.GOLD_INGOT});
this.registerShapedRecipe(new ItemStack(Block.DISPENSER, 1), new Object[] { "###", "#X#", "#R#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.BOW, Character.valueOf('R'), Item.REDSTONE});
+ this.registerShapedRecipe(new ItemStack(Block.DROPPER, 1), new Object[] { "###", "# #", "#R#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('R'), Item.REDSTONE});
this.registerShapedRecipe(new ItemStack(Block.PISTON, 1), new Object[] { "TTT", "#X#", "#R#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.IRON_INGOT, Character.valueOf('R'), Item.REDSTONE, Character.valueOf('T'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.PISTON_STICKY, 1), new Object[] { "S", "P", Character.valueOf('S'), Item.SLIME_BALL, Character.valueOf('P'), Block.PISTON});
this.registerShapedRecipe(new ItemStack(Item.BED, 1), new Object[] { "###", "XXX", Character.valueOf('#'), Block.WOOL, Character.valueOf('X'), Block.WOOD});
@@ -126,6 +137,8 @@ public class CraftingManager {
this.registerShapelessRecipe(new ItemStack(Item.EYE_OF_ENDER, 1), new Object[] { Item.ENDER_PEARL, Item.BLAZE_POWDER});
this.registerShapelessRecipe(new ItemStack(Item.FIREBALL, 3), new Object[] { Item.SULPHUR, Item.BLAZE_POWDER, Item.COAL});
this.registerShapelessRecipe(new ItemStack(Item.FIREBALL, 3), new Object[] { Item.SULPHUR, Item.BLAZE_POWDER, new ItemStack(Item.COAL, 1, 1)});
+ this.registerShapedRecipe(new ItemStack(Block.DAYLIGHT_DETECTOR), new Object[] { "GGG", "QQQ", "WWW", Character.valueOf('G'), Block.GLASS, Character.valueOf('Q'), Item.QUARTZ, Character.valueOf('W'), Block.WOOD_STEP});
+ this.registerShapedRecipe(new ItemStack(Block.HOPPER), new Object[] { "I I", "ICI", " I ", Character.valueOf('I'), Item.IRON_INGOT, Character.valueOf('C'), Block.CHEST});
// Collections.sort(this.recipes, new RecipeSorter(this)); // CraftBukkit - moved below
this.sort(); // CraftBukkit - call new sort method
System.out.println(this.recipes.size() + " recipes");
@@ -173,7 +186,7 @@ public class CraftingManager {
if (aobject[i + 1] instanceof Item) {
itemstack1 = new ItemStack((Item) aobject[i + 1]);
} else if (aobject[i + 1] instanceof Block) {
- itemstack1 = new ItemStack((Block) aobject[i + 1], 1, -1);
+ itemstack1 = new ItemStack((Block) aobject[i + 1], 1, 32767);
} else if (aobject[i + 1] instanceof ItemStack) {
itemstack1 = (ItemStack) aobject[i + 1];
}
@@ -247,10 +260,10 @@ public class CraftingManager {
}
}
- if (i == 2 && itemstack.id == itemstack1.id && itemstack.count == 1 && itemstack1.count == 1 && Item.byId[itemstack.id].n()) {
+ if (i == 2 && itemstack.id == itemstack1.id && itemstack.count == 1 && itemstack1.count == 1 && Item.byId[itemstack.id].o()) {
Item item = Item.byId[itemstack.id];
- int k = item.getMaxDurability() - itemstack.i();
- int l = item.getMaxDurability() - itemstack1.i();
+ int k = item.getMaxDurability() - itemstack.j();
+ int l = item.getMaxDurability() - itemstack1.j();
int i1 = k + l + item.getMaxDurability() * 5 / 100;
int j1 = item.getMaxDurability() - i1;
diff --git a/src/main/java/net/minecraft/server/CrashReport.java b/src/main/java/net/minecraft/server/CrashReport.java
index 9b50bb2f..211b7420 100644
--- a/src/main/java/net/minecraft/server/CrashReport.java
+++ b/src/main/java/net/minecraft/server/CrashReport.java
@@ -11,8 +11,6 @@ import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.Callable;
-import java.util.logging.Level;
-import java.util.logging.Logger;
public class CrashReport {
@@ -132,7 +130,7 @@ public class CrashReport {
return stringbuilder.toString();
}
- public boolean a(File file1) {
+ public boolean a(File file1, IConsoleLogManager iconsolelogmanager) {
if (this.e != null) {
return false;
} else {
@@ -148,7 +146,7 @@ public class CrashReport {
this.e = file1;
return true;
} catch (Throwable throwable) {
- Logger.getLogger("Minecraft").log(Level.SEVERE, "Could not save crash report to " + file1, throwable);
+ iconsolelogmanager.severe("Could not save crash report to " + file1, throwable);
return false;
}
}
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index bd0377ae..f985c055 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -8,10 +8,10 @@ import java.util.Collections;
import java.util.List;
import java.util.Random;
import java.util.concurrent.Callable;
-import java.util.logging.Level;
// CraftBukkit start
import java.io.PrintStream;
+import java.util.logging.Level;
import org.bukkit.craftbukkit.LoggerOutputStream;
import org.bukkit.event.server.ServerCommandEvent;
@@ -19,7 +19,8 @@ import org.bukkit.event.server.ServerCommandEvent;
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
- private final List l = Collections.synchronizedList(new ArrayList());
+ private final List k = Collections.synchronizedList(new ArrayList());
+ private final IConsoleLogManager l;
private RemoteStatusListener m;
private RemoteControlListener n;
public PropertyManager propertyManager; // CraftBukkit - private -> public
@@ -32,6 +33,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
public DedicatedServer(joptsimple.OptionSet options) {
super(options);
// CraftBukkit end
+ this.l = new ConsoleLogManager("Minecraft-Server", (String) null, (String) null); // CraftBukkit - null last argument
new ThreadSleepForever(this);
}
@@ -40,20 +42,19 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
threadcommandreader.setDaemon(true);
threadcommandreader.start();
- ConsoleLogManager.init(this); // CraftBukkit
// CraftBukkit start
- System.setOut(new PrintStream(new LoggerOutputStream(log, Level.INFO), true));
- System.setErr(new PrintStream(new LoggerOutputStream(log, Level.SEVERE), true));
+ System.setOut(new PrintStream(new LoggerOutputStream(this.getLogger().getLogger(), Level.INFO), true));
+ System.setErr(new PrintStream(new LoggerOutputStream(this.getLogger().getLogger(), Level.SEVERE), true));
// CraftBukkit end
- log.info("Starting minecraft server version 1.4.7");
+ this.getLogger().info("Starting minecraft server version 1.5");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
- log.warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
+ this.getLogger().warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}
- log.info("Loading properties");
- this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support
+ this.getLogger().info("Loading properties");
+ this.propertyManager = new PropertyManager(this.options, this.getLogger()); // CraftBukkit - CLI argument support
if (this.I()) {
this.d("127.0.0.1");
} else {
@@ -77,7 +78,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
int i = this.propertyManager.getInt("gamemode", EnumGamemode.SURVIVAL.a());
this.q = WorldSettings.a(i);
- log.info("Default game type: " + this.q);
+ this.getLogger().info("Default game type: " + this.q);
InetAddress inetaddress = null;
if (this.getServerIp().length() > 0) {
@@ -88,26 +89,26 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.setPort(this.propertyManager.getInt("server-port", 25565));
}
- log.info("Generating keypair");
+ this.getLogger().info("Generating keypair");
this.a(MinecraftEncryption.b());
- log.info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.G());
+ this.getLogger().info("Starting Minecraft server on " + (this.getServerIp().length() == 0 ? "*" : this.getServerIp()) + ":" + this.G());
try {
this.r = new DedicatedServerConnection(this, inetaddress, this.G());
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
- log.warning("**** FAILED TO BIND TO PORT!");
- log.log(Level.WARNING, "The exception was: " + ioexception.toString());
- log.warning("Perhaps a server is already running on that port?");
+ this.getLogger().warning("**** FAILED TO BIND TO PORT!");
+ this.getLogger().warning("The exception was: {0}", new Object[] { ioexception.toString()});
+ this.getLogger().warning("Perhaps a server is already running on that port?");
return false;
}
this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit
if (!this.getOnlineMode()) {
- log.warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
- log.warning("The server will make no attempt to authenticate usernames. Beware.");
- log.warning("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
- log.warning("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
+ this.getLogger().warning("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!");
+ this.getLogger().warning("The server will make no attempt to authenticate usernames. Beware.");
+ this.getLogger().warning("While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.");
+ this.getLogger().warning("To change this, set \"online-mode\" to \"true\" in the server.properties file.");
}
// this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit - moved up
@@ -145,20 +146,20 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.d((this.getMaxBuildHeight() + 8) / 16 * 16);
this.d(MathHelper.a(this.getMaxBuildHeight(), 64, 256));
this.propertyManager.a("max-build-height", Integer.valueOf(this.getMaxBuildHeight()));
- log.info("Preparing level \"" + this.J() + "\"");
+ this.getLogger().info("Preparing level \"" + this.J() + "\"");
this.a(this.J(), this.J(), k, worldtype, s2);
long i1 = System.nanoTime() - j;
String s3 = String.format("%.3fs", new Object[] { Double.valueOf((double) i1 / 1.0E9D)});
- log.info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
+ this.getLogger().info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
if (this.propertyManager.getBoolean("enable-query", false)) {
- log.info("Starting GS4 status listener");
+ this.getLogger().info("Starting GS4 status listener");
this.m = new RemoteStatusListener(this);
this.m.a();
}
if (this.propertyManager.getBoolean("enable-rcon", false)) {
- log.info("Starting remote control listener");
+ this.getLogger().info("Starting remote control listener");
this.n = new RemoteControlListener(this);
this.n.a();
this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit
@@ -166,7 +167,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
// CraftBukkit start
if (this.server.getBukkitSpawnRadius() > -1) {
- log.info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you.");
+ this.getLogger().info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you.");
this.propertyManager.properties.remove("spawn-protection");
this.propertyManager.getInt("spawn-protection", this.server.getBukkitSpawnRadius());
this.server.removeBukkitSpawnRadius();
@@ -199,7 +200,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
protected void a(CrashReport crashreport) {
while (this.isRunning()) {
- this.al();
+ this.am();
try {
Thread.sleep(10L);
@@ -220,9 +221,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
System.exit(0);
}
- public void r() {
+ public void r() { // CraftBukkit - protected -> public
super.r();
- this.al();
+ this.am();
}
public boolean getAllowNether() {
@@ -234,8 +235,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public void a(MojangStatisticsGenerator mojangstatisticsgenerator) {
- mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.am().getHasWhitelist()));
- mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.am().getWhitelisted().size()));
+ mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.an().getHasWhitelist()));
+ mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.an().getWhitelisted().size()));
super.a(mojangstatisticsgenerator);
}
@@ -244,12 +245,12 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public void issueCommand(String s, ICommandListener icommandlistener) {
- this.l.add(new ServerCommand(s, icommandlistener));
+ this.k.add(new ServerCommand(s, icommandlistener));
}
- public void al() {
- while (!this.l.isEmpty()) {
- ServerCommand servercommand = (ServerCommand) this.l.remove(0);
+ public void am() {
+ while (!this.k.isEmpty()) {
+ ServerCommand servercommand = (ServerCommand) this.k.remove(0);
// CraftBukkit start - ServerCommand for preprocessing
ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command);
@@ -266,7 +267,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return true;
}
- public DedicatedPlayerList am() {
+ public DedicatedPlayerList an() {
return (DedicatedPlayerList) super.getPlayerList();
}
@@ -300,7 +301,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return file1 != null ? file1.getAbsolutePath() : "No settings file";
}
- public void an() {
+ public void ao() {
ServerGUI.a(this);
this.s = true;
}
@@ -321,7 +322,30 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return this.propertyManager.getInt("spawn-protection", super.getSpawnProtection());
}
+ public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
+ if (world.worldProvider.dimension != 0) {
+ return false;
+ } else if (this.an().getOPs().isEmpty()) {
+ return false;
+ } else if (this.an().isOp(entityhuman.name)) {
+ return false;
+ } else if (this.getSpawnProtection() <= 0) {
+ return false;
+ } else {
+ ChunkCoordinates chunkcoordinates = world.getSpawn();
+ int l = MathHelper.a(i - chunkcoordinates.x);
+ int i1 = MathHelper.a(k - chunkcoordinates.z);
+ int j1 = Math.max(l, i1);
+
+ return j1 <= this.getSpawnProtection();
+ }
+ }
+
+ public IConsoleLogManager getLogger() {
+ return this.l;
+ }
+
public PlayerList getPlayerList() {
- return this.am();
+ return this.an();
}
}
diff --git a/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java b/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java
index 25e2ac1d..5be8dc2b 100644
--- a/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java
+++ b/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java
@@ -8,47 +8,44 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
public class DedicatedServerConnectionThread extends Thread {
- private static Logger a = Logger.getLogger("Minecraft");
- private final List b = Collections.synchronizedList(new ArrayList());
- private final HashMap c = new HashMap();
- private int d = 0;
- private final ServerSocket e;
- private ServerConnection f;
- private final InetAddress g;
- private final int h;
+ private final List a = Collections.synchronizedList(new ArrayList());
+ private final HashMap b = new HashMap();
+ private int c = 0;
+ private final ServerSocket d;
+ private ServerConnection e;
+ private final InetAddress f;
+ private final int g;
long connectionThrottle; // CraftBukkit
public DedicatedServerConnectionThread(ServerConnection serverconnection, InetAddress inetaddress, int i) throws IOException { // CraftBukkit - added throws
super("Listen thread");
- this.f = serverconnection;
- this.h = i;
- this.e = new ServerSocket(i, 0, inetaddress);
- this.g = inetaddress == null ? this.e.getInetAddress() : inetaddress;
- this.e.setPerformancePreferences(0, 2, 1);
+ this.e = serverconnection;
+ this.g = i;
+ this.d = new ServerSocket(i, 0, inetaddress);
+ this.f = inetaddress == null ? this.d.getInetAddress() : inetaddress;
+ this.d.setPerformancePreferences(0, 2, 1);
}
public void a() {
- List list = this.b;
+ List list = this.a;
- synchronized (this.b) {
- for (int i = 0; i < this.b.size(); ++i) {
- PendingConnection pendingconnection = (PendingConnection) this.b.get(i);
+ synchronized (this.a) {
+ for (int i = 0; i < this.a.size(); ++i) {
+ PendingConnection pendingconnection = (PendingConnection) this.a.get(i);
try {
pendingconnection.c();
} catch (Exception exception) {
pendingconnection.disconnect("Internal server error");
- a.log(Level.WARNING, "Failed to handle packet for " + pendingconnection.getName() + ": " + exception, exception);
+ this.e.d().getLogger().warning("Failed to handle packet for " + pendingconnection.getName() + ": " + exception, (Throwable) exception);
}
- if (pendingconnection.c) {
- this.b.remove(i--);
+ if (pendingconnection.b) {
+ this.a.remove(i--);
}
pendingconnection.networkManager.a();
@@ -57,51 +54,51 @@ public class DedicatedServerConnectionThread extends Thread {
}
public void run() {
- while (this.f.b) {
+ while (this.e.a) {
try {
- Socket socket = this.e.accept();
+ Socket socket = this.d.accept();
InetAddress inetaddress = socket.getInetAddress();
long i = System.currentTimeMillis();
- HashMap hashmap = this.c;
+ HashMap hashmap = this.b;
// CraftBukkit start
- if (((MinecraftServer) this.f.d()).server == null) {
+ if (((MinecraftServer) this.e.d()).server == null) {
socket.close();
continue;
}
- connectionThrottle = ((MinecraftServer) this.f.d()).server.getConnectionThrottle();
+ connectionThrottle = ((MinecraftServer) this.e.d()).server.getConnectionThrottle();
// CraftBukkit end
- synchronized (this.c) {
- if (this.c.containsKey(inetaddress) && !b(inetaddress) && i - ((Long) this.c.get(inetaddress)).longValue() < connectionThrottle) {
- this.c.put(inetaddress, Long.valueOf(i));
+ synchronized (this.b) {
+ if (this.b.containsKey(inetaddress) && !b(inetaddress) && i - ((Long) this.b.get(inetaddress)).longValue() < connectionThrottle) {
+ this.b.put(inetaddress, Long.valueOf(i));
socket.close();
continue;
}
- this.c.put(inetaddress, Long.valueOf(i));
+ this.b.put(inetaddress, Long.valueOf(i));
}
- PendingConnection pendingconnection = new PendingConnection(this.f.d(), socket, "Connection #" + this.d++);
+ PendingConnection pendingconnection = new PendingConnection(this.e.d(), socket, "Connection #" + this.c++);
this.a(pendingconnection);
} catch (IOException ioexception) {
- a.warning("DSCT: " + ioexception.getMessage()); // CraftBukkit
+ this.e.d().getLogger().warning("DSCT: " + ioexception.getMessage()); // CraftBukkit
}
}
- System.out.println("Closing listening thread");
+ this.e.d().getLogger().info("Closing listening thread");
}
private void a(PendingConnection pendingconnection) {
if (pendingconnection == null) {
throw new IllegalArgumentException("Got null pendingconnection!");
} else {
- List list = this.b;
+ List list = this.a;
- synchronized (this.b) {
- this.b.add(pendingconnection);
+ synchronized (this.a) {
+ this.a.add(pendingconnection);
}
}
}
@@ -112,17 +109,17 @@ public class DedicatedServerConnectionThread extends Thread {
public void a(InetAddress inetaddress) {
if (inetaddress != null) {
- HashMap hashmap = this.c;
+ HashMap hashmap = this.b;
- synchronized (this.c) {
- this.c.remove(inetaddress);
+ synchronized (this.b) {
+ this.b.remove(inetaddress);
}
}
}
public void b() {
try {
- this.e.close();
+ this.d.close();
} catch (Throwable throwable) {
;
}
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorBoat.java b/src/main/java/net/minecraft/server/DispenseBehaviorBoat.java
index 2840aa3e..8e3a8615 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorBoat.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorBoat.java
@@ -5,25 +5,20 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.block.BlockDispenseEvent;
// CraftBukkit end
-public class DispenseBehaviorBoat extends DispenseBehaviorItem {
+final class DispenseBehaviorBoat extends DispenseBehaviorItem {
- private final DispenseBehaviorItem c;
+ private final DispenseBehaviorItem b = new DispenseBehaviorItem();
- final MinecraftServer b;
-
- public DispenseBehaviorBoat(MinecraftServer minecraftserver) {
- this.b = minecraftserver;
- this.c = new DispenseBehaviorItem();
- }
+ DispenseBehaviorBoat() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
World world = isourceblock.k();
double d0 = isourceblock.getX() + (double) ((float) enumfacing.c() * 1.125F);
- double d1 = isourceblock.getY();
+ double d1 = isourceblock.getY() + (double) ((float) enumfacing.d() * 1.125F);
double d2 = isourceblock.getZ() + (double) ((float) enumfacing.e() * 1.125F);
int i = isourceblock.getBlockX() + enumfacing.c();
- int j = isourceblock.getBlockY();
+ int j = isourceblock.getBlockY() + enumfacing.d();
int k = isourceblock.getBlockZ() + enumfacing.e();
Material material = world.getMaterial(i, j, k);
double d3;
@@ -32,7 +27,7 @@ public class DispenseBehaviorBoat extends DispenseBehaviorItem {
d3 = 1.0D;
} else {
if (!Material.AIR.equals(material) || !Material.WATER.equals(world.getMaterial(i, j - 1, k))) {
- return this.c.a(isourceblock, itemstack);
+ return this.b.a(isourceblock, itemstack);
}
d3 = 0.0D;
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java b/src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java
index b381e223..8f7e09b2 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java
@@ -5,22 +5,17 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.block.BlockDispenseEvent;
// CraftBukkit end
-public class DispenseBehaviorEmptyBucket extends DispenseBehaviorItem {
+final class DispenseBehaviorEmptyBucket extends DispenseBehaviorItem {
- private final DispenseBehaviorItem c;
+ private final DispenseBehaviorItem b = new DispenseBehaviorItem();
- final MinecraftServer b;
-
- public DispenseBehaviorEmptyBucket(MinecraftServer minecraftserver) {
- this.b = minecraftserver;
- this.c = new DispenseBehaviorItem();
- }
+ DispenseBehaviorEmptyBucket() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
World world = isourceblock.k();
int i = isourceblock.getBlockX() + enumfacing.c();
- int j = isourceblock.getBlockY();
+ int j = isourceblock.getBlockY() + enumfacing.d();
int k = isourceblock.getBlockZ() + enumfacing.e();
Material material = world.getMaterial(i, j, k);
int l = world.getData(i, j, k);
@@ -60,12 +55,12 @@ public class DispenseBehaviorEmptyBucket extends DispenseBehaviorItem {
}
// CraftBukkit end
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
if (--itemstack.count == 0) {
itemstack.id = item.id;
itemstack.count = 1;
} else if (((TileEntityDispenser) isourceblock.getTileEntity()).addItem(new ItemStack(item)) < 0) {
- this.c.a(isourceblock, new ItemStack(item));
+ this.b.a(isourceblock, new ItemStack(item));
}
return itemstack;
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java b/src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java
index 309c1e62..5caf0bde 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java
@@ -5,23 +5,18 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.block.BlockDispenseEvent;
// CraftBukkit end
-public class DispenseBehaviorFilledBucket extends DispenseBehaviorItem {
+final class DispenseBehaviorFilledBucket extends DispenseBehaviorItem {
- private final DispenseBehaviorItem c;
+ private final DispenseBehaviorItem b = new DispenseBehaviorItem();
- final MinecraftServer b;
-
- public DispenseBehaviorFilledBucket(MinecraftServer minecraftserver) {
- this.b = minecraftserver;
- this.c = new DispenseBehaviorItem();
- }
+ DispenseBehaviorFilledBucket() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
ItemBucket itembucket = (ItemBucket) itemstack.getItem();
int i = isourceblock.getBlockX();
int j = isourceblock.getBlockY();
int k = isourceblock.getBlockZ();
- EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
// CraftBukkit start
World world = isourceblock.k();
@@ -61,13 +56,13 @@ public class DispenseBehaviorFilledBucket extends DispenseBehaviorItem {
itemstack.id = item.id;
itemstack.count = 1;
} else if (((TileEntityDispenser) isourceblock.getTileEntity()).addItem(new ItemStack(item)) < 0) {
- this.c.a(isourceblock, new ItemStack(item));
+ this.b.a(isourceblock, new ItemStack(item));
}
// CraftBukkit end
return itemstack;
} else {
- return this.c.a(isourceblock, itemstack);
+ return this.b.a(isourceblock, itemstack);
}
}
}
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java b/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java
index 9eb4ca2b..1cb73aac 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java
@@ -7,24 +7,20 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.block.BlockDispenseEvent;
// CraftBukkit end
-public class DispenseBehaviorFireball extends DispenseBehaviorItem {
+final class DispenseBehaviorFireball extends DispenseBehaviorItem {
- final MinecraftServer b;
-
- public DispenseBehaviorFireball(MinecraftServer minecraftserver) {
- this.b = minecraftserver;
- }
+ DispenseBehaviorFireball() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
IPosition iposition = BlockDispenser.a(isourceblock);
double d0 = iposition.getX() + (double) ((float) enumfacing.c() * 0.3F);
- double d1 = iposition.getY();
+ double d1 = iposition.getY() + (double) ((float) enumfacing.c() * 0.3F);
double d2 = iposition.getZ() + (double) ((float) enumfacing.e() * 0.3F);
World world = isourceblock.k();
Random random = world.random;
double d3 = random.nextGaussian() * 0.05D + (double) enumfacing.c();
- double d4 = random.nextGaussian() * 0.05D;
+ double d4 = random.nextGaussian() * 0.05D + (double) enumfacing.d();
double d5 = random.nextGaussian() * 0.05D + (double) enumfacing.e();
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorFireworks.java b/src/main/java/net/minecraft/server/DispenseBehaviorFireworks.java
index 039d5152..6141b441 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorFireworks.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorFireworks.java
@@ -5,16 +5,12 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.block.BlockDispenseEvent;
// CraftBukkit end
-public class DispenseBehaviorFireworks extends DispenseBehaviorItem {
+final class DispenseBehaviorFireworks extends DispenseBehaviorItem {
- final MinecraftServer b;
-
- public DispenseBehaviorFireworks(MinecraftServer minecraftserver) {
- this.b = minecraftserver;
- }
+ DispenseBehaviorFireworks() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
double d0 = isourceblock.getX() + (double) enumfacing.c();
double d1 = (double) ((float) isourceblock.getBlockY() + 0.2F);
double d2 = isourceblock.getZ() + (double) enumfacing.e();
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorItem.java b/src/main/java/net/minecraft/server/DispenseBehaviorItem.java
index 42e08a23..c3a9f36d 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorItem.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorItem.java
@@ -13,12 +13,12 @@ public class DispenseBehaviorItem implements IDispenseBehavior {
ItemStack itemstack1 = this.b(isourceblock, itemstack);
this.a(isourceblock);
- this.a(isourceblock, EnumFacing.a(isourceblock.h()));
+ this.a(isourceblock, BlockDispenser.j_(isourceblock.h()));
return itemstack1;
}
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
IPosition iposition = BlockDispenser.a(isourceblock);
ItemStack itemstack1 = itemstack.a(1);
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorMinecart.java b/src/main/java/net/minecraft/server/DispenseBehaviorMinecart.java
index 2da34d37..2a7b4ad3 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorMinecart.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorMinecart.java
@@ -5,34 +5,29 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.block.BlockDispenseEvent;
// CraftBukkit end
-public class DispenseBehaviorMinecart extends DispenseBehaviorItem {
+final class DispenseBehaviorMinecart extends DispenseBehaviorItem {
- private final DispenseBehaviorItem c;
+ private final DispenseBehaviorItem b = new DispenseBehaviorItem();
- final MinecraftServer b;
-
- public DispenseBehaviorMinecart(MinecraftServer minecraftserver) {
- this.b = minecraftserver;
- this.c = new DispenseBehaviorItem();
- }
+ DispenseBehaviorMinecart() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
World world = isourceblock.k();
double d0 = isourceblock.getX() + (double) ((float) enumfacing.c() * 1.125F);
- double d1 = isourceblock.getY();
+ double d1 = isourceblock.getY() + (double) ((float) enumfacing.d() * 1.125F);
double d2 = isourceblock.getZ() + (double) ((float) enumfacing.e() * 1.125F);
int i = isourceblock.getBlockX() + enumfacing.c();
- int j = isourceblock.getBlockY();
+ int j = isourceblock.getBlockY() + enumfacing.d();
int k = isourceblock.getBlockZ() + enumfacing.e();
int l = world.getTypeId(i, j, k);
double d3;
- if (BlockMinecartTrack.e(l)) {
+ if (BlockMinecartTrackAbstract.d_(l)) {
d3 = 0.0D;
} else {
- if (l != 0 || !BlockMinecartTrack.e(world.getTypeId(i, j - 1, k))) {
- return this.c.a(isourceblock, itemstack);
+ if (l != 0 || !BlockMinecartTrackAbstract.d_(world.getTypeId(i, j - 1, k))) {
+ return this.b.a(isourceblock, itemstack);
}
d3 = -1.0D;
@@ -65,10 +60,10 @@ public class DispenseBehaviorMinecart extends DispenseBehaviorItem {
}
itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
- EntityMinecart entityminecart = new EntityMinecart(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), ((ItemMinecart) itemstack1.getItem()).a);
+ EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), ((ItemMinecart) itemstack1.getItem()).a);
// CraftBukkit end
- world.addEntity(entityminecart);
+ world.addEntity(entityminecartabstract);
// itemstack.a(1); // CraftBukkit - handled during event processing
return itemstack;
}
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java b/src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java
index e5a011bc..a29b550e 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java
@@ -5,16 +5,12 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.event.block.BlockDispenseEvent;
// CraftBukkit end
-public class DispenseBehaviorMonsterEgg extends DispenseBehaviorItem {
+final class DispenseBehaviorMonsterEgg extends DispenseBehaviorItem {
- final MinecraftServer b;
-
- public DispenseBehaviorMonsterEgg(MinecraftServer minecraftserver) {
- this.b = minecraftserver;
- }
+ DispenseBehaviorMonsterEgg() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
double d0 = isourceblock.getX() + (double) enumfacing.c();
double d1 = (double) ((float) isourceblock.getBlockY() + 0.2F);
double d2 = isourceblock.getZ() + (double) enumfacing.e();
@@ -47,7 +43,13 @@ public class DispenseBehaviorMonsterEgg extends DispenseBehaviorItem {
}
itemstack1 = CraftItemStack.asNMSCopy(event.getItem());
- ItemMonsterEgg.a(isourceblock.k(), itemstack1.getData(), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
+
+ Entity entity = ItemMonsterEgg.a(isourceblock.k(), itemstack.getData(), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ());
+
+ if (entity instanceof EntityLiving && itemstack.hasName()) {
+ ((EntityLiving) entity).setCustomName(itemstack.getName());
+ }
+
// itemstack.a(1); // Handled during event processing
// CraftBukkit end
return itemstack;
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java b/src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java
index 984b1fc0..916ce148 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java
@@ -12,7 +12,7 @@ public abstract class DispenseBehaviorProjectile extends DispenseBehaviorItem {
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
World world = isourceblock.k();
IPosition iposition = BlockDispenser.a(isourceblock);
- EnumFacing enumfacing = EnumFacing.a(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
IProjectile iprojectile = this.a(world, iposition);
// CraftBukkit start
@@ -20,7 +20,7 @@ public abstract class DispenseBehaviorProjectile extends DispenseBehaviorItem {
org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockX(), isourceblock.getBlockY(), isourceblock.getBlockZ());
CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1);
- BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) enumfacing.c(), 0.10000000149011612D, (double) enumfacing.e()));
+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector((double) enumfacing.c(), (double) ((float) enumfacing.d() + 0.1F), (double) enumfacing.e()));
if (!BlockDispenser.eventFired) {
world.getServer().getPluginManager().callEvent(event);
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 71707ed1..b9667a0e 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2,11 +2,10 @@ package net.minecraft.server;
import java.util.List;
import java.util.Random;
+import java.util.UUID;
import java.util.concurrent.Callable;
// CraftBukkit start
-import java.util.UUID;
-
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Server;
@@ -46,6 +45,7 @@ public abstract class Entity {
public boolean m;
public Entity passenger;
public Entity vehicle;
+ public boolean p;
public World world;
public double lastX;
public double lastY;
@@ -63,52 +63,52 @@ public abstract class Entity {
public final AxisAlignedBB boundingBox;
public boolean onGround;
public boolean positionChanged;
- public boolean G;
public boolean H;
+ public boolean I;
public boolean velocityChanged;
- protected boolean J;
- public boolean K;
+ protected boolean K;
+ public boolean L;
public boolean dead;
public float height;
public float width;
public float length;
- public float P;
public float Q;
public float R;
+ public float S;
public float fallDistance;
private int c;
- public double T;
public double U;
public double V;
- public float W;
+ public double W;
public float X;
- public boolean Y;
- public float Z;
+ public float Y;
+ public boolean Z;
+ public float aa;
protected Random random;
public int ticksLived;
public int maxFireTicks;
public int fireTicks; // CraftBukkit - private -> public
- protected boolean ad;
+ protected boolean ae;
public int noDamageTicks;
private boolean justCreated;
protected boolean fireProof;
protected DataWatcher datawatcher;
private double f;
private double g;
- public boolean ah;
- public int ai;
+ public boolean ai;
public int aj;
public int ak;
- public boolean al;
+ public int al;
public boolean am;
+ public boolean an;
public int portalCooldown;
- protected boolean ao;
- protected int ap;
+ protected boolean ap;
+ protected int aq;
public int dimension;
- protected int ar;
+ protected int as;
private boolean invulnerable;
- public EnumEntitySize as;
- public UUID uniqueId = UUID.randomUUID(); // CraftBukkit
+ public UUID uniqueID; // CraftBukkit - private -> public
+ public EnumEntitySize at;
public boolean valid = false; // CraftBukkit
public Entity(World world) {
@@ -117,35 +117,36 @@ public abstract class Entity {
this.m = false;
this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
this.onGround = false;
- this.H = false;
+ this.I = false;
this.velocityChanged = false;
- this.K = true;
+ this.L = true;
this.dead = false;
this.height = 0.0F;
this.width = 0.6F;
this.length = 1.8F;
- this.P = 0.0F;
this.Q = 0.0F;
this.R = 0.0F;
+ this.S = 0.0F;
this.fallDistance = 0.0F;
this.c = 1;
- this.W = 0.0F;
this.X = 0.0F;
- this.Y = false;
- this.Z = 0.0F;
+ this.Y = 0.0F;
+ this.Z = false;
+ this.aa = 0.0F;
this.random = new Random();
this.ticksLived = 0;
this.maxFireTicks = 1;
this.fireTicks = 0;
- this.ad = false;
+ this.ae = false;
this.noDamageTicks = 0;
this.justCreated = true;
this.fireProof = false;
this.datawatcher = new DataWatcher();
- this.ah = false;
- this.ar = 0;
+ this.ai = false;
+ this.as = 0;
this.invulnerable = false;
- this.as = EnumEntitySize.SIZE_2;
+ this.uniqueID = UUID.randomUUID();
+ this.at = EnumEntitySize.SIZE_2;
this.world = world;
this.setPosition(0.0D, 0.0D, 0.0D);
if (world != null) {
@@ -176,22 +177,28 @@ public abstract class Entity {
}
protected void a(float f, float f1) {
- this.width = f;
- this.length = f1;
+ if (f != this.width || f1 != this.length) {
+ this.width = f;
+ this.length = f1;
+ this.boundingBox.d = this.boundingBox.a + (double) this.width;
+ this.boundingBox.f = this.boundingBox.c + (double) this.width;
+ this.boundingBox.e = this.boundingBox.b + (double) this.length;
+ }
+
float f2 = f % 2.0F;
if ((double) f2 < 0.375D) {
- this.as = EnumEntitySize.SIZE_1;
+ this.at = EnumEntitySize.SIZE_1;
} else if ((double) f2 < 0.75D) {
- this.as = EnumEntitySize.SIZE_2;
+ this.at = EnumEntitySize.SIZE_2;
} else if ((double) f2 < 1.0D) {
- this.as = EnumEntitySize.SIZE_3;
+ this.at = EnumEntitySize.SIZE_3;
} else if ((double) f2 < 1.375D) {
- this.as = EnumEntitySize.SIZE_4;
+ this.at = EnumEntitySize.SIZE_4;
} else if ((double) f2 < 1.75D) {
- this.as = EnumEntitySize.SIZE_5;
+ this.at = EnumEntitySize.SIZE_5;
} else {
- this.as = EnumEntitySize.SIZE_6;
+ this.at = EnumEntitySize.SIZE_6;
}
}
@@ -203,7 +210,7 @@ public abstract class Entity {
if ((f == Float.POSITIVE_INFINITY) || (f == Float.NEGATIVE_INFINITY)) {
if (this instanceof EntityPlayer) {
- System.err.println(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid yaw");
+ this.world.getServer().getLogger().warning(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid yaw");
((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope");
}
f = 0;
@@ -216,7 +223,7 @@ public abstract class Entity {
if ((f1 == Float.POSITIVE_INFINITY) || (f1 == Float.NEGATIVE_INFINITY)) {
if (this instanceof EntityPlayer) {
- System.err.println(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid pitch");
+ this.world.getServer().getLogger().warning(((CraftPlayer) this.getBukkitEntity()).getName() + " was caught trying to crash the server with an invalid pitch");
((CraftPlayer) this.getBukkitEntity()).kickPlayer("Nope");
}
f1 = 0;
@@ -234,20 +241,20 @@ public abstract class Entity {
float f = this.width / 2.0F;
float f1 = this.length;
- this.boundingBox.b(d0 - (double) f, d1 - (double) this.height + (double) this.W, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.W + (double) f1, d2 + (double) f);
+ this.boundingBox.b(d0 - (double) f, d1 - (double) this.height + (double) this.X, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.X + (double) f1, d2 + (double) f);
}
- public void j_() {
- this.y();
+ public void l_() {
+ this.x();
}
- public void y() {
+ public void x() {
this.world.methodProfiler.a("entityBaseTick");
if (this.vehicle != null && this.vehicle.dead) {
this.vehicle = null;
}
- this.P = this.Q;
+ this.Q = this.R;
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
@@ -259,12 +266,12 @@ public abstract class Entity {
this.world.methodProfiler.a("portal");
MinecraftServer minecraftserver = ((WorldServer) this.world).getMinecraftServer();
- i = this.z();
- if (this.ao) {
+ i = this.y();
+ if (this.ap) {
if (true || minecraftserver.getAllowNether()) { // CraftBukkit
- if (this.vehicle == null && this.ap++ >= i) {
- this.ap = i;
- this.portalCooldown = this.ab();
+ if (this.vehicle == null && this.aq++ >= i) {
+ this.aq = i;
+ this.portalCooldown = this.aa();
byte b0;
if (this.world.worldProvider.dimension == -1) {
@@ -273,18 +280,18 @@ public abstract class Entity {
b0 = -1;
}
- this.b(b0);
+ this.c(b0);
}
- this.ao = false;
+ this.ap = false;
}
} else {
- if (this.ap > 0) {
- this.ap -= 4;
+ if (this.aq > 0) {
+ this.aq -= 4;
}
- if (this.ap < 0) {
- this.ap = 0;
+ if (this.aq < 0) {
+ this.aq = 0;
}
}
@@ -295,7 +302,7 @@ public abstract class Entity {
this.world.methodProfiler.b();
}
- if (this.isSprinting() && !this.H()) {
+ if (this.isSprinting() && !this.G()) {
int j = MathHelper.floor(this.locX);
i = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
@@ -307,7 +314,7 @@ public abstract class Entity {
}
}
- this.I();
+ this.H();
if (this.world.isStatic) {
this.fireTicks = 0;
} else if (this.fireTicks > 0) {
@@ -337,13 +344,13 @@ public abstract class Entity {
}
}
- if (this.J()) {
- this.A();
+ if (this.I()) {
+ this.z();
this.fallDistance *= 0.5F;
}
if (this.locY < -64.0D) {
- this.C();
+ this.B();
}
if (!this.world.isStatic) {
@@ -355,11 +362,11 @@ public abstract class Entity {
this.world.methodProfiler.b();
}
- public int z() {
+ public int y() {
return 0;
}
- protected void A() {
+ protected void z() {
if (!this.fireProof) {
// CraftBukkit start - fallen in lava TODO: this event spams!
if (this instanceof EntityLiving) {
@@ -411,7 +418,7 @@ public abstract class Entity {
this.fireTicks = 0;
}
- protected void C() {
+ protected void B() {
this.die();
}
@@ -423,20 +430,20 @@ public abstract class Entity {
}
public void move(double d0, double d1, double d2) {
- if (this.Y) {
+ if (this.Z) {
this.boundingBox.d(d0, d1, d2);
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
- this.locY = this.boundingBox.b + (double) this.height - (double) this.W;
+ this.locY = this.boundingBox.b + (double) this.height - (double) this.X;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
} else {
this.world.methodProfiler.a("move");
- this.W *= 0.4F;
+ this.X *= 0.4F;
double d3 = this.locX;
double d4 = this.locY;
double d5 = this.locZ;
- if (this.J) {
- this.J = false;
+ if (this.K) {
+ this.K = false;
d0 *= 0.25D;
d1 *= 0.05000000074505806D;
d2 *= 0.25D;
@@ -503,7 +510,7 @@ public abstract class Entity {
}
this.boundingBox.d(0.0D, d1, 0.0D);
- if (!this.K && d7 != d1) {
+ if (!this.L && d7 != d1) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -518,7 +525,7 @@ public abstract class Entity {
}
this.boundingBox.d(d0, 0.0D, 0.0D);
- if (!this.K && d6 != d0) {
+ if (!this.L && d6 != d0) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -529,7 +536,7 @@ public abstract class Entity {
}
this.boundingBox.d(0.0D, 0.0D, d2);
- if (!this.K && d8 != d2) {
+ if (!this.L && d8 != d2) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -540,12 +547,12 @@ public abstract class Entity {
double d12;
int k;
- if (this.X > 0.0F && flag1 && (flag || this.W < 0.05F) && (d6 != d0 || d8 != d2)) {
+ if (this.Y > 0.0F && flag1 && (flag || this.X < 0.05F) && (d6 != d0 || d8 != d2)) {
d10 = d0;
d11 = d1;
d12 = d2;
d0 = d6;
- d1 = (double) this.X;
+ d1 = (double) this.Y;
d2 = d8;
AxisAlignedBB axisalignedbb1 = this.boundingBox.clone();
@@ -557,7 +564,7 @@ public abstract class Entity {
}
this.boundingBox.d(0.0D, d1, 0.0D);
- if (!this.K && d7 != d1) {
+ if (!this.L && d7 != d1) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -568,7 +575,7 @@ public abstract class Entity {
}
this.boundingBox.d(d0, 0.0D, 0.0D);
- if (!this.K && d6 != d0) {
+ if (!this.L && d6 != d0) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
@@ -579,18 +586,18 @@ public abstract class Entity {
}
this.boundingBox.d(0.0D, 0.0D, d2);
- if (!this.K && d8 != d2) {
+ if (!this.L && d8 != d2) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
}
- if (!this.K && d7 != d1) {
+ if (!this.L && d7 != d1) {
d2 = 0.0D;
d1 = 0.0D;
d0 = 0.0D;
} else {
- d1 = (double) (-this.X);
+ d1 = (double) (-this.Y);
for (k = 0; k < list.size(); ++k) {
d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
@@ -604,24 +611,18 @@ public abstract class Entity {
d1 = d11;
d2 = d12;
this.boundingBox.c(axisalignedbb1);
- } else {
- double d13 = this.boundingBox.b - (double) ((int) this.boundingBox.b);
-
- if (d13 > 0.0D) {
- this.W = (float) ((double) this.W + d13 + 0.01D);
- }
}
}
this.world.methodProfiler.b();
this.world.methodProfiler.a("rest");
this.locX = (this.boundingBox.a + this.boundingBox.d) / 2.0D;
- this.locY = this.boundingBox.b + (double) this.height - (double) this.W;
+ this.locY = this.boundingBox.b + (double) this.height - (double) this.X;
this.locZ = (this.boundingBox.c + this.boundingBox.f) / 2.0D;
this.positionChanged = d6 != d0 || d8 != d2;
- this.G = d7 != d1;
+ this.H = d7 != d1;
this.onGround = d7 != d1 && d7 < 0.0D;
- this.H = this.positionChanged || this.G;
+ this.I = this.positionChanged || this.H;
this.a(d1, this.onGround);
if (d6 != d0) {
this.motX = 0.0D;
@@ -678,11 +679,11 @@ public abstract class Entity {
d11 = 0.0D;
}
- this.Q = (float) ((double) this.Q + (double) MathHelper.sqrt(d10 * d10 + d12 * d12) * 0.6D);
- this.R = (float) ((double) this.R + (double) MathHelper.sqrt(d10 * d10 + d11 * d11 + d12 * d12) * 0.6D);
- if (this.R > (float) this.c && j1 > 0) {
- this.c = (int) this.R + 1;
- if (this.H()) {
+ this.R = (float) ((double) this.R + (double) MathHelper.sqrt(d10 * d10 + d12 * d12) * 0.6D);
+ this.S = (float) ((double) this.S + (double) MathHelper.sqrt(d10 * d10 + d11 * d11 + d12 * d12) * 0.6D);
+ if (this.S > (float) this.c && j1 > 0) {
+ this.c = (int) this.S + 1;
+ if (this.G()) {
float f = MathHelper.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.35F;
if (f > 1.0F) {
@@ -697,8 +698,8 @@ public abstract class Entity {
}
}
- this.D();
- boolean flag2 = this.G();
+ this.C();
+ boolean flag2 = this.F();
if (this.world.e(this.boundingBox.shrink(0.001D, 0.001D, 0.001D))) {
this.burn(1);
@@ -730,7 +731,7 @@ public abstract class Entity {
}
}
- protected void D() {
+ protected void C() {
int i = MathHelper.floor(this.boundingBox.a + 0.001D);
int j = MathHelper.floor(this.boundingBox.b + 0.001D);
int k = MathHelper.floor(this.boundingBox.c + 0.001D);
@@ -738,7 +739,7 @@ public abstract class Entity {
int i1 = MathHelper.floor(this.boundingBox.e - 0.001D);
int j1 = MathHelper.floor(this.boundingBox.f - 0.001D);
- if (this.world.d(i, j, k, l, i1, j1)) {
+ if (this.world.e(i, j, k, l, i1, j1)) {
for (int k1 = i; k1 <= l; ++k1) {
for (int l1 = j; l1 <= i1; ++l1) {
for (int i2 = k; i2 <= j1; ++i2) {
@@ -783,7 +784,7 @@ public abstract class Entity {
}
}
- public AxisAlignedBB E() {
+ public AxisAlignedBB D() {
return null;
}
@@ -817,17 +818,17 @@ public abstract class Entity {
}
}
- public boolean G() {
- return this.ad || this.world.D(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) || this.world.D(MathHelper.floor(this.locX), MathHelper.floor(this.locY + (double) this.length), MathHelper.floor(this.locZ));
+ public boolean F() {
+ return this.ae || this.world.F(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) || this.world.F(MathHelper.floor(this.locX), MathHelper.floor(this.locY + (double) this.length), MathHelper.floor(this.locZ));
}
- public boolean H() {
- return this.ad;
+ public boolean G() {
+ return this.ae;
}
- public boolean I() {
+ public boolean H() {
if (this.world.a(this.boundingBox.grow(0.0D, -0.4000000059604645D, 0.0D).shrink(0.001D, 0.001D, 0.001D), Material.WATER, this)) {
- if (!this.ad && !this.justCreated) {
+ if (!this.ae && !this.justCreated) {
float f = MathHelper.sqrt(this.motX * this.motX * 0.20000000298023224D + this.motY * this.motY + this.motZ * this.motZ * 0.20000000298023224D) * 0.2F;
if (f > 1.0F) {
@@ -855,13 +856,13 @@ public abstract class Entity {
}
this.fallDistance = 0.0F;
- this.ad = true;
+ this.ae = true;
this.fireTicks = 0;
} else {
- this.ad = false;
+ this.ae = false;
}
- return this.ad;
+ return this.ae;
}
public boolean a(Material material) {
@@ -872,7 +873,7 @@ public abstract class Entity {
int l = this.world.getTypeId(i, j, k);
if (l != 0 && Block.byId[l].material == material) {
- float f = BlockFluids.e(this.world.getData(i, j, k)) - 0.11111111F;
+ float f = BlockFluids.d(this.world.getData(i, j, k)) - 0.11111111F;
float f1 = (float) (j + 1) - f;
return d0 < (double) f1;
@@ -885,7 +886,7 @@ public abstract class Entity {
return 0.0F;
}
- public boolean J() {
+ public boolean I() {
return this.world.a(this.boundingBox.grow(-0.10000000149011612D, -0.4000000059604645D, -0.10000000149011612D), Material.LAVA);
}
@@ -917,7 +918,7 @@ public abstract class Entity {
double d0 = (this.boundingBox.e - this.boundingBox.b) * 0.66D;
int k = MathHelper.floor(this.locY - (double) this.height + d0);
- return this.world.p(i, k, j);
+ return this.world.q(i, k, j);
} else {
return 0.0F;
}
@@ -941,7 +942,7 @@ public abstract class Entity {
this.lastZ = this.locZ = d2;
this.lastYaw = this.yaw = f;
this.lastPitch = this.pitch = f1;
- this.W = 0.0F;
+ this.X = 0.0F;
double d3 = (double) (this.lastYaw - f);
if (d3 < -180.0D) {
@@ -957,9 +958,9 @@ public abstract class Entity {
}
public void setPositionRotation(double d0, double d1, double d2, float f, float f1) {
- this.T = this.lastX = this.locX = d0;
- this.U = this.lastY = this.locY = d1 + (double) this.height;
- this.V = this.lastZ = this.locZ = d2;
+ this.U = this.lastX = this.locX = d0;
+ this.V = this.lastY = this.locY = d1 + (double) this.height;
+ this.W = this.lastZ = this.locZ = d2;
this.yaw = f;
this.pitch = f1;
this.setPosition(this.locX, this.locY, this.locZ);
@@ -997,7 +998,7 @@ public abstract class Entity {
return d0 * d0 + d1 * d1 + d2 * d2;
}
- public void c_(EntityHuman entityhuman) {}
+ public void b_(EntityHuman entityhuman) {}
public void collide(Entity entity) {
if (entity.passenger != this && entity.vehicle != this) {
@@ -1019,8 +1020,8 @@ public abstract class Entity {
d1 *= d3;
d0 *= 0.05000000074505806D;
d1 *= 0.05000000074505806D;
- d0 *= (double) (1.0F - this.Z);
- d1 *= (double) (1.0F - this.Z);
+ d0 *= (double) (1.0F - this.aa);
+ d1 *= (double) (1.0F - this.aa);
this.g(-d0, 0.0D, -d1);
entity.g(d0, 0.0D, d1);
}
@@ -1031,10 +1032,10 @@ public abstract class Entity {
this.motX += d0;
this.motY += d1;
this.motZ += d2;
- this.am = true;
+ this.an = true;
}
- protected void K() {
+ protected void J() {
this.velocityChanged = true;
}
@@ -1042,36 +1043,48 @@ public abstract class Entity {
if (this.isInvulnerable()) {
return false;
} else {
- this.K();
+ this.J();
return false;
}
}
- public boolean L() {
+ public boolean K() {
return false;
}
- public boolean M() {
+ public boolean L() {
return false;
}
public void c(Entity entity, int i) {}
public boolean c(NBTTagCompound nbttagcompound) {
- String s = this.Q();
+ String s = this.P();
if (!this.dead && s != null) {
nbttagcompound.setString("id", s);
- this.d(nbttagcompound);
+ this.e(nbttagcompound);
return true;
} else {
return false;
}
}
- public void d(NBTTagCompound nbttagcompound) {
+ public boolean d(NBTTagCompound nbttagcompound) {
+ String s = this.P();
+
+ if (!this.dead && s != null && this.passenger == null) {
+ nbttagcompound.setString("id", s);
+ this.e(nbttagcompound);
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public void e(NBTTagCompound nbttagcompound) {
try {
- nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.W, this.locZ}));
+ nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.X, this.locZ}));
nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ}));
// CraftBukkit start - checking for NaN pitch/yaw and resetting to zero
@@ -1093,14 +1106,21 @@ public abstract class Entity {
nbttagcompound.setInt("Dimension", this.dimension);
nbttagcompound.setBoolean("Invulnerable", this.invulnerable);
nbttagcompound.setInt("PortalCooldown", this.portalCooldown);
+ nbttagcompound.setLong("UUIDMost", this.uniqueID.getMostSignificantBits());
+ nbttagcompound.setLong("UUIDLeast", this.uniqueID.getLeastSignificantBits());
// CraftBukkit start
nbttagcompound.setLong("WorldUUIDLeast", this.world.getDataManager().getUUID().getLeastSignificantBits());
nbttagcompound.setLong("WorldUUIDMost", this.world.getDataManager().getUUID().getMostSignificantBits());
- nbttagcompound.setLong("UUIDLeast", this.uniqueId.getLeastSignificantBits());
- nbttagcompound.setLong("UUIDMost", this.uniqueId.getMostSignificantBits());
nbttagcompound.setInt("Bukkit.updateLevel", CURRENT_LEVEL);
// CraftBukkit end
this.b(nbttagcompound);
+ if (this.vehicle != null) {
+ NBTTagCompound nbttagcompound1 = new NBTTagCompound("Riding");
+
+ if (this.vehicle.c(nbttagcompound1)) {
+ nbttagcompound.set("Riding", nbttagcompound1);
+ }
+ }
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being saved");
@@ -1110,7 +1130,7 @@ public abstract class Entity {
}
}
- public void e(NBTTagCompound nbttagcompound) {
+ public void f(NBTTagCompound nbttagcompound) {
try {
NBTTagList nbttaglist = nbttagcompound.getList("Pos");
NBTTagList nbttaglist1 = nbttagcompound.getList("Motion");
@@ -1133,9 +1153,9 @@ public abstract class Entity {
}
// CraftBukkit end */
- this.lastX = this.T = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data;
- this.lastY = this.U = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data;
- this.lastZ = this.V = this.locZ = ((NBTTagDouble) nbttaglist.get(2)).data;
+ this.lastX = this.U = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data;
+ this.lastY = this.V = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data;
+ this.lastZ = this.W = this.locZ = ((NBTTagDouble) nbttaglist.get(2)).data;
this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.get(0)).data;
this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.get(1)).data;
this.fallDistance = nbttagcompound.getFloat("FallDistance");
@@ -1145,17 +1165,11 @@ public abstract class Entity {
this.dimension = nbttagcompound.getInt("Dimension");
this.invulnerable = nbttagcompound.getBoolean("Invulnerable");
this.portalCooldown = nbttagcompound.getInt("PortalCooldown");
- this.setPosition(this.locX, this.locY, this.locZ);
-
- // CraftBukkit start
- long least = nbttagcompound.getLong("UUIDLeast");
- long most = nbttagcompound.getLong("UUIDMost");
-
- if (least != 0L && most != 0L) {
- this.uniqueId = new UUID(most, least);
+ if (nbttagcompound.hasKey("UUIDMost") && nbttagcompound.hasKey("UUIDLeast")) {
+ this.uniqueID = new UUID(nbttagcompound.getLong("UUIDMost"), nbttagcompound.getLong("UUIDLeast"));
}
- // CraftBukkit end
+ this.setPosition(this.locX, this.locY, this.locZ);
this.b(this.yaw, this.pitch);
this.a(nbttagcompound);
@@ -1222,7 +1236,7 @@ public abstract class Entity {
}
}
- protected final String Q() {
+ protected final String P() {
return EntityTypes.b(this);
}
@@ -1287,7 +1301,7 @@ public abstract class Entity {
int k = MathHelper.floor(this.locY + (double) this.getHeadHeight() + (double) f1);
int l = MathHelper.floor(this.locZ + (double) f2);
- if (this.world.t(j, k, l)) {
+ if (this.world.u(j, k, l)) {
return true;
}
}
@@ -1295,7 +1309,7 @@ public abstract class Entity {
return false;
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
return false;
}
@@ -1303,16 +1317,16 @@ public abstract class Entity {
return null;
}
- public void U() {
+ public void T() {
if (this.vehicle.dead) {
this.vehicle = null;
} else {
this.motX = 0.0D;
this.motY = 0.0D;
this.motZ = 0.0D;
- this.j_();
+ this.l_();
if (this.vehicle != null) {
- this.vehicle.V();
+ this.vehicle.U();
this.g += (double) (this.vehicle.yaw - this.vehicle.lastYaw);
for (this.f += (double) (this.vehicle.pitch - this.vehicle.lastPitch); this.g >= 180.0D; this.g -= 360.0D) {
@@ -1359,21 +1373,23 @@ public abstract class Entity {
}
}
- public void V() {
- if (!(this.passenger instanceof EntityHuman) || !((EntityHuman) this.passenger).bV()) {
- this.passenger.T = this.T;
- this.passenger.U = this.U + this.X() + this.passenger.W();
- this.passenger.V = this.V;
- }
+ public void U() {
+ if (this.passenger != null) {
+ if (!(this.passenger instanceof EntityHuman) || !((EntityHuman) this.passenger).ce()) {
+ this.passenger.U = this.U;
+ this.passenger.V = this.V + this.W() + this.passenger.V();
+ this.passenger.W = this.W;
+ }
- this.passenger.setPosition(this.locX, this.locY + this.X() + this.passenger.W(), this.locZ);
+ this.passenger.setPosition(this.locX, this.locY + this.W() + this.passenger.V(), this.locZ);
+ }
}
- public double W() {
+ public double V() {
return (double) this.height;
}
- public double X() {
+ public double W() {
return (double) this.length * 0.75D;
}
@@ -1414,17 +1430,6 @@ public abstract class Entity {
}
this.vehicle = null;
- } else if (this.vehicle == entity) {
- // CraftBukkit start
- if ((this.bukkitEntity instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) {
- VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
- pluginManager.callEvent(event);
- }
- // CraftBukkit end
-
- this.h(entity);
- this.vehicle.passenger = null;
- this.vehicle = null;
} else {
// CraftBukkit start
if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle)) {
@@ -1441,19 +1446,21 @@ public abstract class Entity {
this.vehicle.passenger = null;
}
- if (entity.passenger != null) {
- entity.passenger.vehicle = null;
- }
-
this.vehicle = entity;
entity.passenger = this;
}
}
public void h(Entity entity) {
- double d0 = entity.locX;
- double d1 = entity.boundingBox.b + (double) entity.length;
- double d2 = entity.locZ;
+ double d0 = this.locX;
+ double d1 = this.locY;
+ double d2 = this.locZ;
+
+ if (entity != null) {
+ d0 = entity.locX;
+ d1 = entity.boundingBox.b + (double) entity.length;
+ d2 = entity.locZ;
+ }
for (double d3 = -1.5D; d3 < 2.0D; ++d3) {
for (double d4 = -1.5D; d4 < 2.0D; ++d4) {
@@ -1463,12 +1470,12 @@ public abstract class Entity {
AxisAlignedBB axisalignedbb = this.boundingBox.c(d3, 1.0D, d4);
if (this.world.a(axisalignedbb).isEmpty()) {
- if (this.world.v(i, (int) this.locY, j)) {
+ if (this.world.w(i, (int) this.locY, j)) {
this.setPositionRotation(this.locX + d3, this.locY + 1.0D, this.locZ + d4, this.yaw, this.pitch);
return;
}
- if (this.world.v(i, (int) this.locY - 1, j) || this.world.getMaterial(i, (int) this.locY - 1, j) == Material.WATER) {
+ if (this.world.w(i, (int) this.locY - 1, j) || this.world.getMaterial(i, (int) this.locY - 1, j) == Material.WATER) {
d0 = this.locX + d3;
d1 = this.locY + 1.0D;
d2 = this.locZ + d4;
@@ -1481,30 +1488,30 @@ public abstract class Entity {
this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
}
- public float Y() {
+ public float X() {
return 0.1F;
}
- public Vec3D Z() {
+ public Vec3D Y() {
return null;
}
- public void aa() {
+ public void Z() {
if (this.portalCooldown > 0) {
- this.portalCooldown = this.ab();
+ this.portalCooldown = this.aa();
} else {
double d0 = this.lastX - this.locX;
double d1 = this.lastZ - this.locZ;
- if (!this.world.isStatic && !this.ao) {
- this.ar = Direction.a(d0, d1);
+ if (!this.world.isStatic && !this.ap) {
+ this.as = Direction.a(d0, d1);
}
- this.ao = true;
+ this.ap = true;
}
}
- public int ab() {
+ public int aa() {
return 900;
}
@@ -1515,15 +1522,15 @@ public abstract class Entity {
public void setEquipment(int i, ItemStack itemstack) {}
public boolean isBurning() {
- return this.fireTicks > 0 || this.e(0);
+ return this.fireTicks > 0 || this.f(0);
}
- public boolean ag() {
- return this.vehicle != null || this.e(2);
+ public boolean af() {
+ return this.vehicle != null || this.f(2);
}
public boolean isSneaking() {
- return this.e(1);
+ return this.f(1);
}
public void setSneaking(boolean flag) {
@@ -1531,7 +1538,7 @@ public abstract class Entity {
}
public boolean isSprinting() {
- return this.e(3);
+ return this.f(3);
}
public void setSprinting(boolean flag) {
@@ -1539,18 +1546,18 @@ public abstract class Entity {
}
public boolean isInvisible() {
- return this.e(5);
+ return this.f(5);
}
public void setInvisible(boolean flag) {
this.a(5, flag);
}
- public void d(boolean flag) {
+ public void e(boolean flag) {
this.a(4, flag);
}
- protected boolean e(int i) {
+ protected boolean f(int i) {
return (this.datawatcher.getByte(0) & 1 << i) != 0;
}
@@ -1621,15 +1628,15 @@ public abstract class Entity {
double d5 = d2 - (double) k;
List list = this.world.a(this.boundingBox);
- if (list.isEmpty() && !this.world.u(i, j, k)) {
+ if (list.isEmpty() && !this.world.v(i, j, k)) {
return false;
} else {
- boolean flag = !this.world.u(i - 1, j, k);
- boolean flag1 = !this.world.u(i + 1, j, k);
- boolean flag2 = !this.world.u(i, j - 1, k);
- boolean flag3 = !this.world.u(i, j + 1, k);
- boolean flag4 = !this.world.u(i, j, k - 1);
- boolean flag5 = !this.world.u(i, j, k + 1);
+ boolean flag = !this.world.v(i - 1, j, k);
+ boolean flag1 = !this.world.v(i + 1, j, k);
+ boolean flag2 = !this.world.v(i, j - 1, k);
+ boolean flag3 = !this.world.v(i, j + 1, k);
+ boolean flag4 = !this.world.v(i, j, k - 1);
+ boolean flag5 = !this.world.v(i, j, k + 1);
byte b0 = 3;
double d6 = 9999.0D;
@@ -1688,8 +1695,8 @@ public abstract class Entity {
}
}
- public void am() {
- this.J = true;
+ public void al() {
+ this.K = true;
this.fallDistance = 0.0F;
}
@@ -1703,7 +1710,7 @@ public abstract class Entity {
return LocaleI18n.get("entity." + s + ".name");
}
- public Entity[] ao() {
+ public Entity[] an() {
return null;
}
@@ -1711,11 +1718,11 @@ public abstract class Entity {
return this == entity;
}
- public float ap() {
+ public float ao() {
return 0.0F;
}
- public boolean aq() {
+ public boolean ap() {
return true;
}
@@ -1738,13 +1745,13 @@ public abstract class Entity {
public void a(Entity entity, boolean flag) {
NBTTagCompound nbttagcompound = new NBTTagCompound();
- entity.d(nbttagcompound);
- this.e(nbttagcompound);
+ entity.e(nbttagcompound);
+ this.f(nbttagcompound);
this.portalCooldown = entity.portalCooldown;
- this.ar = entity.ar;
+ this.as = entity.as;
}
- public void b(int i) {
+ public void c(int i) {
if (!this.world.isStatic && !this.dead) {
this.world.methodProfiler.a("changeDimension");
MinecraftServer minecraftserver = MinecraftServer.getServer();
@@ -1814,28 +1821,40 @@ public abstract class Entity {
}
}
- public float a(Explosion explosion, Block block, int i, int j, int k) {
+ public float a(Explosion explosion, World world, int i, int j, int k, Block block) {
return block.a(this);
}
- public int as() {
+ public boolean a(Explosion explosion, World world, int i, int j, int k, int l, float f) {
+ return true;
+ }
+
+ public int ar() {
return 3;
}
- public int at() {
- return this.ar;
+ public int as() {
+ return this.as;
}
- public boolean au() {
+ public boolean at() {
return false;
}
public void a(CrashReportSystemDetails crashreportsystemdetails) {
crashreportsystemdetails.a("Entity Type", (Callable) (new CrashReportEntityType(this)));
crashreportsystemdetails.a("Entity ID", Integer.valueOf(this.id));
- crashreportsystemdetails.a("Name", this.getLocalizedName());
- crashreportsystemdetails.a("Exact location", String.format("%.2f, %.2f, %.2f", new Object[] { Double.valueOf(this.locX), Double.valueOf(this.locY), Double.valueOf(this.locZ)}));
- crashreportsystemdetails.a("Block location", CrashReportSystemDetails.a(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)));
- crashreportsystemdetails.a("Momentum", String.format("%.2f, %.2f, %.2f", new Object[] { Double.valueOf(this.motX), Double.valueOf(this.motY), Double.valueOf(this.motZ)}));
+ crashreportsystemdetails.a("Entity Name", (Callable) (new CrashReportEntityName(this)));
+ crashreportsystemdetails.a("Entity\'s Exact location", String.format("%.2f, %.2f, %.2f", new Object[] { Double.valueOf(this.locX), Double.valueOf(this.locY), Double.valueOf(this.locZ)}));
+ crashreportsystemdetails.a("Entity\'s Block location", CrashReportSystemDetails.a(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)));
+ crashreportsystemdetails.a("Entity\'s Momentum", String.format("%.2f, %.2f, %.2f", new Object[] { Double.valueOf(this.motX), Double.valueOf(this.motY), Double.valueOf(this.motZ)}));
+ }
+
+ public boolean aw() {
+ return true;
+ }
+
+ public String getScoreboardDisplayName() {
+ return this.getLocalizedName();
}
}
diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java
index 845a9023..fdc9167a 100644
--- a/src/main/java/net/minecraft/server/EntityAgeable.java
+++ b/src/main/java/net/minecraft/server/EntityAgeable.java
@@ -1,6 +1,9 @@
package net.minecraft.server;
public abstract class EntityAgeable extends EntityCreature {
+
+ private float d = -1.0F;
+ private float e;
public boolean ageLocked = false; // CraftBukkit
public EntityAgeable(World world) {
@@ -9,7 +12,7 @@ public abstract class EntityAgeable extends EntityCreature {
public abstract EntityAgeable createChild(EntityAgeable entityageable);
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.MONSTER_EGG.id && !this.world.isStatic) {
@@ -22,9 +25,13 @@ public abstract class EntityAgeable extends EntityCreature {
entityageable.setAge(-24000);
entityageable.setPositionRotation(this.locX, this.locY, this.locZ, 0.0F, 0.0F);
this.world.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
+ if (itemstack.hasName()) {
+ entityageable.setCustomName(itemstack.getName());
+ }
+
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
- if (itemstack.count == 0) { // CraftBukkit - allow less than 0 stacks as "infinit"
+ if (itemstack.count == 0) { // CraftBukkit - allow less than 0 stacks as "infinite"
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
}
}
@@ -32,7 +39,7 @@ public abstract class EntityAgeable extends EntityCreature {
}
}
- return super.a(entityhuman);
+ return super.a_(entityhuman);
}
protected void a() {
@@ -46,6 +53,7 @@ public abstract class EntityAgeable extends EntityCreature {
public void setAge(int i) {
this.datawatcher.watch(12, Integer.valueOf(i));
+ this.a(this.isBaby());
}
public void b(NBTTagCompound nbttagcompound) {
@@ -62,19 +70,40 @@ public abstract class EntityAgeable extends EntityCreature {
public void c() {
super.c();
- int i = this.getAge();
-
- if (ageLocked) return; // CraftBukkit
- if (i < 0) {
- ++i;
- this.setAge(i);
- } else if (i > 0) {
- --i;
- this.setAge(i);
+ if (this.world.isStatic || this.ageLocked) { // CraftBukkit
+ this.a(this.isBaby());
+ } else {
+ int i = this.getAge();
+
+ if (i < 0) {
+ ++i;
+ this.setAge(i);
+ } else if (i > 0) {
+ --i;
+ this.setAge(i);
+ }
}
}
public boolean isBaby() {
return this.getAge() < 0;
}
+
+ public void a(boolean flag) {
+ this.j(flag ? 0.5F : 1.0F);
+ }
+
+ protected final void a(float f, float f1) {
+ boolean flag = this.d > 0.0F;
+
+ this.d = f;
+ this.e = f1;
+ if (!flag) {
+ this.j(1.0F);
+ }
+ }
+
+ private void j(float f) {
+ super.a(this.d * f, this.e * f);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index 916b9dc9..4b473647 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -21,9 +21,9 @@ public class EntityArrow extends Entity implements IProjectile {
public int shake = 0;
public Entity shooter;
private int j;
- private int at = 0;
+ private int au = 0;
private double damage = 2.0D;
- private int av;
+ private int aw;
public EntityArrow(World world) {
super(world);
@@ -49,7 +49,7 @@ public class EntityArrow extends Entity implements IProjectile {
this.locY = entityliving.locY + (double) entityliving.getHeadHeight() - 0.10000000149011612D;
double d0 = entityliving1.locX - entityliving.locX;
- double d1 = entityliving1.locY + (double) entityliving1.getHeadHeight() - 0.699999988079071D - this.locY;
+ double d1 = entityliving1.boundingBox.b + (double) (entityliving1.length / 3.0F) - this.locY;
double d2 = entityliving1.locZ - entityliving.locZ;
double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
@@ -98,9 +98,9 @@ public class EntityArrow extends Entity implements IProjectile {
d0 /= (double) f2;
d1 /= (double) f2;
d2 /= (double) f2;
- d0 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
- d1 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
- d2 += this.random.nextGaussian() * 0.007499999832361937D * (double) f1;
+ d0 += this.random.nextGaussian() * (double) (this.random.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) f1;
+ d1 += this.random.nextGaussian() * (double) (this.random.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) f1;
+ d2 += this.random.nextGaussian() * (double) (this.random.nextBoolean() ? -1 : 1) * 0.007499999832361937D * (double) f1;
d0 *= (double) f;
d1 *= (double) f;
d2 *= (double) f;
@@ -114,8 +114,8 @@ public class EntityArrow extends Entity implements IProjectile {
this.j = 0;
}
- public void j_() {
- super.j_();
+ public void l_() {
+ super.l_();
if (this.lastPitch == 0.0F && this.lastYaw == 0.0F) {
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
@@ -127,7 +127,7 @@ public class EntityArrow extends Entity implements IProjectile {
if (i > 0) {
Block.byId[i].updateShape(this.world, this.d, this.e, this.f);
- AxisAlignedBB axisalignedbb = Block.byId[i].e(this.world, this.d, this.e, this.f);
+ AxisAlignedBB axisalignedbb = Block.byId[i].b(this.world, this.d, this.e, this.f);
if (axisalignedbb != null && axisalignedbb.a(this.world.getVec3DPool().create(this.locX, this.locY, this.locZ))) {
this.inGround = true;
@@ -153,10 +153,10 @@ public class EntityArrow extends Entity implements IProjectile {
this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.j = 0;
- this.at = 0;
+ this.au = 0;
}
} else {
- ++this.at;
+ ++this.au;
Vec3D vec3d = this.world.getVec3DPool().create(this.locX, this.locY, this.locZ);
Vec3D vec3d1 = this.world.getVec3DPool().create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
MovingObjectPosition movingobjectposition = this.world.rayTrace(vec3d, vec3d1, false, true);
@@ -177,7 +177,7 @@ public class EntityArrow extends Entity implements IProjectile {
for (l = 0; l < list.size(); ++l) {
Entity entity1 = (Entity) list.get(l);
- if (entity1.L() && (entity1 != this.shooter || this.at >= 5)) {
+ if (entity1.K() && (entity1 != this.shooter || this.au >= 5)) {
f1 = 0.3F;
AxisAlignedBB axisalignedbb1 = entity1.boundingBox.grow((double) f1, (double) f1, (double) f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1);
@@ -197,6 +197,14 @@ public class EntityArrow extends Entity implements IProjectile {
movingobjectposition = new MovingObjectPosition(entity);
}
+ if (movingobjectposition != null && movingobjectposition.entity != null && movingobjectposition.entity instanceof EntityHuman) {
+ EntityHuman entityhuman = (EntityHuman) movingobjectposition.entity;
+
+ if (entityhuman.abilities.isInvulnerable || this.shooter instanceof EntityHuman && !((EntityHuman) this.shooter).a(entityhuman)) {
+ movingobjectposition = null;
+ }
+ }
+
float f2;
float f3;
@@ -206,6 +214,7 @@ public class EntityArrow extends Entity implements IProjectile {
ProjectileHitEvent phe = new ProjectileHitEvent(projectile);
this.world.getServer().getPluginManager().callEvent(phe);
// CraftBukkit end
+
if (movingobjectposition.entity != null) {
f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
int i1 = MathHelper.f((double) f2 * this.damage);
@@ -224,7 +233,7 @@ public class EntityArrow extends Entity implements IProjectile {
// CraftBukkit start - moved damage call
if (movingobjectposition.entity.damageEntity(damagesource, i1)) {
- if (this.isBurning() && !(movingobjectposition.entity instanceof EntityEnderman) && (!(movingobjectposition.entity instanceof EntityPlayer) || !(this.shooter instanceof EntityPlayer) || this.world.pvpMode)) { // CraftBukkit - abide by pvp setting if destination is a player.
+ if (this.isBurning() && !(movingobjectposition.entity instanceof EntityEnderman) && (!(movingobjectposition.entity instanceof EntityPlayer) || !(this.shooter instanceof EntityPlayer) || this.world.pvpMode)) { // CraftBukkit - abide by pvp setting if destination is a player
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5);
org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
@@ -239,14 +248,13 @@ public class EntityArrow extends Entity implements IProjectile {
EntityLiving entityliving = (EntityLiving) movingobjectposition.entity;
if (!this.world.isStatic) {
- entityliving.r(entityliving.bJ() + 1);
+ entityliving.r(entityliving.bM() + 1);
}
- if (this.av > 0) {
+ if (this.aw > 0) {
f3 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
-
if (f3 > 0.0F) {
- movingobjectposition.entity.g(this.motX * (double) this.av * 0.6000000238418579D / (double) f3, 0.1D, this.motZ * (double) this.av * 0.6000000238418579D / (double) f3);
+ movingobjectposition.entity.g(this.motX * (double) this.aw * 0.6000000238418579D / (double) f3, 0.1D, this.motZ * (double) this.aw * 0.6000000238418579D / (double) f3);
}
}
@@ -269,7 +277,7 @@ public class EntityArrow extends Entity implements IProjectile {
this.motZ *= -0.10000000149011612D;
this.yaw += 180.0F;
this.lastYaw += 180.0F;
- this.at = 0;
+ this.au = 0;
}
} else {
this.d = movingobjectposition.b;
@@ -287,9 +295,9 @@ public class EntityArrow extends Entity implements IProjectile {
this.makeSound("random.bowhit", 1.0F, 1.2F / (this.random.nextFloat() * 0.2F + 0.9F));
this.inGround = true;
this.shake = 7;
- this.e(false);
+ this.a(false);
if (this.g != 0) {
- Block.byId[this.g].a(this.world, this.d, this.e, this.f, this);
+ Block.byId[this.g].a(this.world, this.d, this.e, this.f, (Entity) this);
}
}
}
@@ -327,7 +335,7 @@ public class EntityArrow extends Entity implements IProjectile {
float f4 = 0.99F;
f1 = 0.05F;
- if (this.H()) {
+ if (this.G()) {
for (int j1 = 0; j1 < 4; ++j1) {
f3 = 0.25F;
this.world.addParticle("bubble", this.locX - this.motX * (double) f3, this.locY - this.motY * (double) f3, this.locZ - this.motZ * (double) f3, this.motX, this.motY, this.motZ);
@@ -341,7 +349,7 @@ public class EntityArrow extends Entity implements IProjectile {
this.motZ *= (double) f4;
this.motY -= (double) f1;
this.setPosition(this.locX, this.locY, this.locZ);
- this.D();
+ this.C();
}
}
@@ -376,7 +384,7 @@ public class EntityArrow extends Entity implements IProjectile {
}
}
- public void c_(EntityHuman entityhuman) {
+ public void b_(EntityHuman entityhuman) {
if (!this.world.isStatic && this.inGround && this.shake <= 0) {
// CraftBukkit start
ItemStack itemstack = new ItemStack(Item.ARROW);
@@ -420,14 +428,14 @@ public class EntityArrow extends Entity implements IProjectile {
}
public void a(int i) {
- this.av = i;
+ this.aw = i;
}
- public boolean aq() {
+ public boolean ap() {
return false;
}
- public void e(boolean flag) {
+ public void a(boolean flag) {
byte b0 = this.datawatcher.getByte(16);
if (flag) {
diff --git a/src/main/java/net/minecraft/server/EntityBlaze.java b/src/main/java/net/minecraft/server/EntityBlaze.java
index 74739a21..8c72066f 100644
--- a/src/main/java/net/minecraft/server/EntityBlaze.java
+++ b/src/main/java/net/minecraft/server/EntityBlaze.java
@@ -10,7 +10,7 @@ public class EntityBlaze extends EntityMonster {
super(world);
this.texture = "/mob/fire.png";
this.fireProof = true;
- this.bd = 10;
+ this.be = 10;
}
public int getMaxHealth() {
@@ -22,15 +22,15 @@ public class EntityBlaze extends EntityMonster {
this.datawatcher.a(16, new Byte((byte) 0));
}
- protected String aY() {
+ protected String bb() {
return "mob.blaze.breathe";
}
- protected String aZ() {
+ protected String bc() {
return "mob.blaze.hit";
}
- protected String ba() {
+ protected String bd() {
return "mob.blaze.death";
}
@@ -40,7 +40,7 @@ public class EntityBlaze extends EntityMonster {
public void c() {
if (!this.world.isStatic) {
- if (this.G()) {
+ if (this.F()) {
this.damageEntity(DamageSource.DROWN, 1);
}
@@ -83,13 +83,13 @@ public class EntityBlaze extends EntityMonster {
++this.f;
if (this.f == 1) {
this.attackTicks = 60;
- this.f(true);
+ this.a(true);
} else if (this.f <= 4) {
this.attackTicks = 6;
} else {
this.attackTicks = 100;
this.f = 0;
- this.f(false);
+ this.a(false);
}
if (this.f > 1) {
@@ -140,7 +140,7 @@ public class EntityBlaze extends EntityMonster {
return (this.datawatcher.getByte(16) & 1) != 0;
}
- public void f(boolean flag) {
+ public void a(boolean flag) {
byte b0 = this.datawatcher.getByte(16);
if (flag) {
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java
index 8fce5597..827b3a0f 100644
--- a/src/main/java/net/minecraft/server/EntityBoat.java
+++ b/src/main/java/net/minecraft/server/EntityBoat.java
@@ -66,11 +66,11 @@ public class EntityBoat extends Entity {
return entity.boundingBox;
}
- public AxisAlignedBB E() {
+ public AxisAlignedBB D() {
return this.boundingBox;
}
- public boolean M() {
+ public boolean L() {
return true;
}
@@ -87,7 +87,7 @@ public class EntityBoat extends Entity {
this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
}
- public double X() {
+ public double W() {
return (double) this.length * 0.0D - 0.30000001192092896D;
}
@@ -109,14 +109,12 @@ public class EntityBoat extends Entity {
// CraftBukkit end
this.h(-this.h());
- this.g(10);
+ this.b(10);
this.setDamage(this.getDamage() + i * 10);
- this.K();
- if (damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild) {
- this.setDamage(100);
- }
+ this.J();
+ boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
- if (this.getDamage() > 40) {
+ if (flag || this.getDamage() > 40) {
// CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
this.world.getServer().getPluginManager().callEvent(destroyEvent);
@@ -131,7 +129,10 @@ public class EntityBoat extends Entity {
this.passenger.mount(this);
}
- this.a(Item.BOAT.id, 1, 0.0F);
+ if (!flag) {
+ this.a(Item.BOAT.id, 1, 0.0F);
+ }
+
this.die();
}
@@ -141,11 +142,11 @@ public class EntityBoat extends Entity {
}
}
- public boolean L() {
+ public boolean K() {
return !this.dead;
}
- public void j_() {
+ public void l_() {
// CraftBukkit start
double prevX = this.locX;
double prevY = this.locY;
@@ -154,9 +155,9 @@ public class EntityBoat extends Entity {
float prevPitch = this.pitch;
// CraftBukkit end
- super.j_();
+ super.l_();
if (this.g() > 0) {
- this.g(this.g() - 1);
+ this.b(this.g() - 1);
}
if (this.getDamage() > 0) {
@@ -363,7 +364,7 @@ public class EntityBoat extends Entity {
for (l = 0; l < list.size(); ++l) {
Entity entity = (Entity) list.get(l);
- if (entity != this.passenger && entity.M() && entity instanceof EntityBoat) {
+ if (entity != this.passenger && entity.L() && entity instanceof EntityBoat) {
entity.collide(this);
}
}
@@ -376,13 +377,11 @@ public class EntityBoat extends Entity {
for (int k1 = 0; k1 < 2; ++k1) {
int l1 = MathHelper.floor(this.locY) + k1;
int i2 = this.world.getTypeId(i1, l1, j1);
- int j2 = this.world.getData(i1, l1, j1);
if (i2 == Block.SNOW.id) {
- this.world.setTypeId(i1, l1, j1, 0);
+ this.world.setAir(i1, l1, j1);
} else if (i2 == Block.WATER_LILY.id) {
- Block.WATER_LILY.dropNaturally(this.world, i1, l1, j1, j2, 0.3F, 0);
- this.world.setTypeId(i1, l1, j1, 0);
+ this.world.setAir(i1, l1, j1, true);
}
}
}
@@ -395,12 +394,12 @@ public class EntityBoat extends Entity {
}
}
- public void V() {
+ public void U() {
if (this.passenger != null) {
double d0 = Math.cos((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
double d1 = Math.sin((double) this.yaw * 3.141592653589793D / 180.0D) * 0.4D;
- this.passenger.setPosition(this.locX + d0, this.locY + this.X() + this.passenger.W(), this.locZ + d1);
+ this.passenger.setPosition(this.locX + d0, this.locY + this.W() + this.passenger.V(), this.locZ + d1);
}
}
@@ -408,7 +407,7 @@ public class EntityBoat extends Entity {
protected void a(NBTTagCompound nbttagcompound) {}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) {
return true;
} else {
@@ -428,7 +427,7 @@ public class EntityBoat extends Entity {
return this.datawatcher.getInt(19);
}
- public void g(int i) {
+ public void b(int i) {
this.datawatcher.watch(17, Integer.valueOf(i));
}
diff --git a/src/main/java/net/minecraft/server/EntityChicken.java b/src/main/java/net/minecraft/server/EntityChicken.java
index 2390261b..c5cf2d29 100644
--- a/src/main/java/net/minecraft/server/EntityChicken.java
+++ b/src/main/java/net/minecraft/server/EntityChicken.java
@@ -27,7 +27,7 @@ public class EntityChicken extends EntityAnimal {
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
}
- public boolean be() {
+ public boolean bh() {
return true;
}
@@ -67,15 +67,15 @@ public class EntityChicken extends EntityAnimal {
protected void a(float f) {}
- protected String aY() {
+ protected String bb() {
return "mob.chicken.say";
}
- protected String aZ() {
+ protected String bc() {
return "mob.chicken.hurt";
}
- protected String ba() {
+ protected String bd() {
return "mob.chicken.hurt";
}
diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java
index 3bbdb2fa..96105121 100644
--- a/src/main/java/net/minecraft/server/EntityCow.java
+++ b/src/main/java/net/minecraft/server/EntityCow.java
@@ -22,7 +22,7 @@ public class EntityCow extends EntityAnimal {
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
}
- public boolean be() {
+ public boolean bh() {
return true;
}
@@ -30,15 +30,15 @@ public class EntityCow extends EntityAnimal {
return 10;
}
- protected String aY() {
+ protected String bb() {
return "mob.cow.say";
}
- protected String aZ() {
+ protected String bc() {
return "mob.cow.hurt";
}
- protected String ba() {
+ protected String bd() {
return "mob.cow.hurt";
}
@@ -46,7 +46,7 @@ public class EntityCow extends EntityAnimal {
this.makeSound("mob.cow.step", 0.15F, 1.0F);
}
- protected float aX() {
+ protected float ba() {
return 0.4F;
}
@@ -75,7 +75,7 @@ public class EntityCow extends EntityAnimal {
// CraftBukkit end
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.BUCKET.id) {
@@ -96,7 +96,7 @@ public class EntityCow extends EntityAnimal {
return true;
} else {
- return super.a(entityhuman);
+ return super.a_(entityhuman);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java
index 45ee98a2..4d91a461 100644
--- a/src/main/java/net/minecraft/server/EntityCreature.java
+++ b/src/main/java/net/minecraft/server/EntityCreature.java
@@ -20,7 +20,7 @@ public abstract class EntityCreature extends EntityLiving {
return false;
}
- protected void bn() {
+ protected void bq() {
this.world.methodProfiler.a("ai");
if (this.c > 0) {
--this.c;
@@ -73,13 +73,13 @@ public abstract class EntityCreature extends EntityLiving {
this.world.methodProfiler.b();
if (!this.b && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
this.pathEntity = this.world.findPath(this, this.target, f, true, false, false, true);
- } else if (!this.b && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.c > 0) && this.bB < 100) {
+ } else if (!this.b && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.c > 0) && this.bC < 100) {
this.i();
}
int i = MathHelper.floor(this.boundingBox.b + 0.5D);
- boolean flag = this.H();
- boolean flag1 = this.J();
+ boolean flag = this.G();
+ boolean flag1 = this.I();
this.pitch = 0.0F;
if (this.pathEntity != null && this.random.nextInt(100) != 0) {
@@ -97,7 +97,7 @@ public abstract class EntityCreature extends EntityLiving {
}
}
- this.bF = false;
+ this.bG = false;
if (vec3d != null) {
double d1 = vec3d.c - this.locX;
double d2 = vec3d.e - this.locZ;
@@ -106,7 +106,7 @@ public abstract class EntityCreature extends EntityLiving {
float f2 = (float) (org.bukkit.craftbukkit.TrigMath.atan2(d2, d1) * 180.0D / 3.1415927410125732D) - 90.0F;
float f3 = MathHelper.g(f2 - this.yaw);
- this.bD = this.bH;
+ this.bE = this.bI;
if (f3 > 30.0F) {
f3 = 30.0F;
}
@@ -123,12 +123,12 @@ public abstract class EntityCreature extends EntityLiving {
this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F;
f3 = (f4 - this.yaw + 90.0F) * 3.1415927F / 180.0F;
- this.bC = -MathHelper.sin(f3) * this.bD * 1.0F;
- this.bD = MathHelper.cos(f3) * this.bD * 1.0F;
+ this.bD = -MathHelper.sin(f3) * this.bE * 1.0F;
+ this.bE = MathHelper.cos(f3) * this.bE * 1.0F;
}
if (d3 > 0.0D) {
- this.bF = true;
+ this.bG = true;
}
}
@@ -137,16 +137,16 @@ public abstract class EntityCreature extends EntityLiving {
}
if (this.positionChanged && !this.k()) {
- this.bF = true;
+ this.bG = true;
}
if (this.random.nextFloat() < 0.8F && (flag || flag1)) {
- this.bF = true;
+ this.bG = true;
}
this.world.methodProfiler.b();
} else {
- super.bn();
+ super.bq();
this.pathEntity = null;
}
}
@@ -215,10 +215,10 @@ public abstract class EntityCreature extends EntityLiving {
this.target = entity;
}
- public float bB() {
- float f = super.bB();
+ public float bE() {
+ float f = super.bE();
- if (this.c > 0 && !this.be()) {
+ if (this.c > 0 && !this.bh()) {
f *= 2.0F;
}
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index 1f64c1f6..091b8059 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -27,11 +27,11 @@ public class EntityCreeper extends EntityMonster {
this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false));
}
- public boolean be() {
+ public boolean bh() {
return true;
}
- public int as() {
+ public int ar() {
return this.getGoalTarget() == null ? 3 : 3 + (this.health - 1);
}
@@ -75,7 +75,7 @@ public class EntityCreeper extends EntityMonster {
}
}
- public void j_() {
+ public void l_() {
if (this.isAlive()) {
this.d = this.fuseTicks;
int i = this.o();
@@ -109,14 +109,14 @@ public class EntityCreeper extends EntityMonster {
}
}
- super.j_();
+ super.l_();
}
- protected String aZ() {
+ protected String bc() {
return "mob.creeper.say";
}
- protected String ba() {
+ protected String bd() {
return "mob.creeper.death";
}
diff --git a/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java b/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java
index 940da7e9..19121530 100644
--- a/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java
+++ b/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java
@@ -9,16 +9,21 @@ public class EntityDamageSourceIndirect extends EntityDamageSource {
this.owner = entity1;
}
- public Entity f() {
- return this.r;
+ public Entity h() {
+ return this.p;
}
public Entity getEntity() {
return this.owner;
}
- public String getLocalizedDeathMessage(EntityHuman entityhuman) {
- return LocaleI18n.get("death." + this.translationIndex, new Object[] { entityhuman.name, this.owner == null ? this.r.getLocalizedName() : this.owner.getLocalizedName()});
+ public String getLocalizedDeathMessage(EntityLiving entityliving) {
+ String s = this.owner == null ? this.p.getScoreboardDisplayName() : this.owner.getScoreboardDisplayName();
+ ItemStack itemstack = this.owner instanceof EntityLiving ? ((EntityLiving) this.owner).bG() : null;
+ String s1 = "death.attack." + this.translationIndex;
+ String s2 = s1 + ".item";
+
+ return itemstack != null && itemstack.hasName() && LocaleI18n.b(s2) ? LocaleI18n.get(s2, new Object[] { entityliving.getScoreboardDisplayName(), s, itemstack.getName()}) : LocaleI18n.get(s1, new Object[] { entityliving.getScoreboardDisplayName(), s});
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/EntityEnderCrystal.java b/src/main/java/net/minecraft/server/EntityEnderCrystal.java
index f3395b44..c0155a65 100644
--- a/src/main/java/net/minecraft/server/EntityEnderCrystal.java
+++ b/src/main/java/net/minecraft/server/EntityEnderCrystal.java
@@ -22,7 +22,7 @@ public class EntityEnderCrystal extends Entity {
this.datawatcher.a(8, Integer.valueOf(this.b));
}
- public void j_() {
+ public void l_() {
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
@@ -33,7 +33,7 @@ public class EntityEnderCrystal extends Entity {
int k = MathHelper.floor(this.locZ);
if (this.world.getTypeId(i, j, k) != Block.FIRE.id) {
- this.world.setTypeId(i, j, k, Block.FIRE.id);
+ this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
}
}
@@ -41,7 +41,7 @@ public class EntityEnderCrystal extends Entity {
protected void a(NBTTagCompound nbttagcompound) {}
- public boolean L() {
+ public boolean K() {
return true;
}
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index ffbc15a8..7019a1a2 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -25,27 +25,27 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
public EntityComplexPart h;
public EntityComplexPart i;
public EntityComplexPart j;
- public EntityComplexPart bJ;
public EntityComplexPart bK;
public EntityComplexPart bL;
- public float bM = 0.0F;
+ public EntityComplexPart bM;
public float bN = 0.0F;
- public boolean bO = false;
+ public float bO = 0.0F;
public boolean bP = false;
- private Entity bS;
- public int bQ = 0;
- public EntityEnderCrystal bR = null;
+ public boolean bQ = false;
+ private Entity bT;
+ public int bR = 0;
+ public EntityEnderCrystal bS = null;
public EntityEnderDragon(World world) {
super(world);
- this.children = new EntityComplexPart[] { this.g = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.h = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.i = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.j = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bJ = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bK = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bL = new EntityComplexPart(this, "wing", 4.0F, 4.0F)};
+ this.children = new EntityComplexPart[] { this.g = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.h = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.i = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.j = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bK = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bL = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bM = new EntityComplexPart(this, "wing", 4.0F, 4.0F)};
this.setHealth(this.getMaxHealth());
this.texture = "/mob/enderdragon/ender.png";
this.a(16.0F, 8.0F);
- this.Y = true;
+ this.Z = true;
this.fireProof = true;
this.b = 100.0D;
- this.al = true;
+ this.am = true;
}
public int getMaxHealth() {
@@ -57,7 +57,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.datawatcher.a(16, new Integer(this.getMaxHealth()));
}
- public double[] a(int i, float f) {
+ public double[] b(int i, float f) {
if (this.health <= 0) {
f = 0.0F;
}
@@ -84,14 +84,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
if (!this.world.isStatic) {
this.datawatcher.watch(16, Integer.valueOf(this.getScaledHealth())); // CraftBukkit - this.health -> this.getScaledHealth()
} else {
- f = MathHelper.cos(this.bN * 3.1415927F * 2.0F);
- f1 = MathHelper.cos(this.bM * 3.1415927F * 2.0F);
+ f = MathHelper.cos(this.bO * 3.1415927F * 2.0F);
+ f1 = MathHelper.cos(this.bN * 3.1415927F * 2.0F);
if (f1 <= -0.3F && f >= -0.3F) {
this.world.a(this.locX, this.locY, this.locZ, "mob.enderdragon.wings", 5.0F, 0.8F + this.random.nextFloat() * 0.3F, false);
}
}
- this.bM = this.bN;
+ this.bN = this.bO;
float f2;
if (this.health <= 0) {
@@ -103,10 +103,10 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.h();
f = 0.2F / (MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 10.0F + 1.0F);
f *= (float) Math.pow(2.0D, this.motY);
- if (this.bP) {
- this.bN += f * 0.5F;
+ if (this.bQ) {
+ this.bO += f * 0.5F;
} else {
- this.bN += f;
+ this.bO += f;
}
this.yaw = MathHelper.g(this.yaw);
@@ -130,14 +130,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
float f3;
if (this.world.isStatic) {
- if (this.bt > 0) {
- d0 = this.locX + (this.bt - this.locX) / (double) this.bt;
- d1 = this.locY + (this.bu - this.locY) / (double) this.bt;
- d2 = this.locZ + (this.bv - this.locZ) / (double) this.bt;
- d3 = MathHelper.g(this.bw - (double) this.yaw);
- this.yaw = (float) ((double) this.yaw + d3 / (double) this.bt);
- this.pitch = (float) ((double) this.pitch + (this.bx - (double) this.pitch) / (double) this.bt);
- --this.bt;
+ if (this.bu > 0) {
+ d0 = this.locX + (this.bv - this.locX) / (double) this.bu;
+ d1 = this.locY + (this.bw - this.locY) / (double) this.bu;
+ d2 = this.locZ + (this.bx - this.locZ) / (double) this.bu;
+ d3 = MathHelper.g(this.by - (double) this.yaw);
+ this.yaw = (float) ((double) this.yaw + d3 / (double) this.bu);
+ this.pitch = (float) ((double) this.pitch + (this.bz - (double) this.pitch) / (double) this.bu);
+ --this.bu;
this.setPosition(d0, d1, d2);
this.b(this.yaw, this.pitch);
}
@@ -146,9 +146,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
d1 = this.b - this.locY;
d2 = this.c - this.locZ;
d3 = d0 * d0 + d1 * d1 + d2 * d2;
- if (this.bS != null) {
- this.a = this.bS.locX;
- this.c = this.bS.locZ;
+ if (this.bT != null) {
+ this.a = this.bT.locX;
+ this.c = this.bT.locZ;
double d4 = this.a - this.locX;
double d5 = this.c - this.locZ;
double d6 = Math.sqrt(d4 * d4 + d5 * d5);
@@ -158,13 +158,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
d7 = 10.0D;
}
- this.b = this.bS.boundingBox.b + d7;
+ this.b = this.bT.boundingBox.b + d7;
} else {
this.a += this.random.nextGaussian() * 2.0D;
this.c += this.random.nextGaussian() * 2.0D;
}
- if (this.bO || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.G) {
+ if (this.bP || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.H) {
this.i();
}
@@ -199,7 +199,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
f4 = 0.0F;
}
- this.bE *= 0.8F;
+ this.bF *= 0.8F;
float f5 = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0F + 1.0F;
double d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ) * 1.0D + 1.0D;
@@ -207,13 +207,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
d10 = 40.0D;
}
- this.bE = (float) ((double) this.bE + d9 * (0.699999988079071D / d10 / (double) f5));
- this.yaw += this.bE * 0.1F;
+ this.bF = (float) ((double) this.bF + d9 * (0.699999988079071D / d10 / (double) f5));
+ this.yaw += this.bF * 0.1F;
float f6 = (float) (2.0D / (d10 + 1.0D));
float f7 = 0.06F;
this.a(0.0F, -1.0F, f7 * (f4 * f6 + (1.0F - f6)));
- if (this.bP) {
+ if (this.bQ) {
this.move(this.motX * 0.800000011920929D, this.motY * 0.800000011920929D, this.motZ * 0.800000011920929D);
} else {
this.move(this.motX, this.motY, this.motZ);
@@ -228,43 +228,43 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.motY *= 0.9100000262260437D;
}
- this.ax = this.yaw;
+ this.ay = this.yaw;
this.g.width = this.g.length = 3.0F;
this.i.width = this.i.length = 2.0F;
this.j.width = this.j.length = 2.0F;
- this.bJ.width = this.bJ.length = 2.0F;
+ this.bK.width = this.bK.length = 2.0F;
this.h.length = 3.0F;
this.h.width = 5.0F;
- this.bK.length = 2.0F;
- this.bK.width = 4.0F;
- this.bL.length = 3.0F;
+ this.bL.length = 2.0F;
this.bL.width = 4.0F;
- f1 = (float) (this.a(5, 1.0F)[1] - this.a(10, 1.0F)[1]) * 10.0F / 180.0F * 3.1415927F;
+ this.bM.length = 3.0F;
+ this.bM.width = 4.0F;
+ f1 = (float) (this.b(5, 1.0F)[1] - this.b(10, 1.0F)[1]) * 10.0F / 180.0F * 3.1415927F;
f2 = MathHelper.cos(f1);
float f9 = -MathHelper.sin(f1);
float f10 = this.yaw * 3.1415927F / 180.0F;
float f11 = MathHelper.sin(f10);
float f12 = MathHelper.cos(f10);
- this.h.j_();
+ this.h.l_();
this.h.setPositionRotation(this.locX + (double) (f11 * 0.5F), this.locY, this.locZ - (double) (f12 * 0.5F), 0.0F, 0.0F);
- this.bK.j_();
- this.bK.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
- this.bL.j_();
- this.bL.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F);
+ this.bL.l_();
+ this.bL.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
+ this.bM.l_();
+ this.bM.setPositionRotation(this.locX - (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ - (double) (f11 * 4.5F), 0.0F, 0.0F);
if (!this.world.isStatic && this.hurtTicks == 0) {
- this.a(this.world.getEntities(this, this.bK.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
this.a(this.world.getEntities(this, this.bL.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
+ this.a(this.world.getEntities(this, this.bM.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
this.b(this.world.getEntities(this, this.g.boundingBox.grow(1.0D, 1.0D, 1.0D)));
}
- double[] adouble = this.a(5, 1.0F);
- double[] adouble1 = this.a(0, 1.0F);
+ double[] adouble = this.b(5, 1.0F);
+ double[] adouble1 = this.b(0, 1.0F);
- f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bE * 0.01F);
- float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bE * 0.01F);
+ f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bF * 0.01F);
+ float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bF * 0.01F);
- this.g.j_();
+ this.g.l_();
this.g.setPositionRotation(this.locX + (double) (f3 * 5.5F * f2), this.locY + (adouble1[1] - adouble[1]) * 1.0D + (double) (f9 * 5.5F), this.locZ - (double) (f13 * 5.5F * f2), 0.0F, 0.0F);
for (int j = 0; j < 3; ++j) {
@@ -279,41 +279,41 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
if (j == 2) {
- entitycomplexpart = this.bJ;
+ entitycomplexpart = this.bK;
}
- double[] adouble2 = this.a(12 + j * 2, 1.0F);
+ double[] adouble2 = this.b(12 + j * 2, 1.0F);
float f14 = this.yaw * 3.1415927F / 180.0F + this.b(adouble2[0] - adouble[0]) * 3.1415927F / 180.0F * 1.0F;
float f15 = MathHelper.sin(f14);
float f16 = MathHelper.cos(f14);
float f17 = 1.5F;
float f18 = (float) (j + 1) * 2.0F;
- entitycomplexpart.j_();
+ entitycomplexpart.l_();
entitycomplexpart.setPositionRotation(this.locX - (double) ((f11 * f17 + f15 * f18) * f2), this.locY + (adouble2[1] - adouble[1]) * 1.0D - (double) ((f18 + f17) * f9) + 1.5D, this.locZ + (double) ((f12 * f17 + f16 * f18) * f2), 0.0F, 0.0F);
}
if (!this.world.isStatic) {
- this.bO = this.a(this.g.boundingBox) | this.a(this.h.boundingBox);
+ this.bQ = this.a(this.g.boundingBox) | this.a(this.h.boundingBox);
}
}
}
private void h() {
- if (this.bR != null) {
- if (this.bR.dead) {
+ if (this.bS != null) {
+ if (this.bS.dead) {
if (!this.world.isStatic) {
- this.a(this.g, DamageSource.EXPLOSION, 10);
+ this.a(this.g, DamageSource.explosion((Explosion) null), 10);
}
- this.bR = null;
+ this.bS = null;
} else if (this.ticksLived % 10 == 0 && this.health < this.maxHealth) { // CraftBukkit - this.getMaxHealth() -> this.maxHealth
// CraftBukkit start
EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- this.health += event.getAmount();
+ this.setHealth(this.getHealth() + event.getAmount());
}
// CraftBukkit end
}
@@ -336,7 +336,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
}
- this.bR = entityendercrystal;
+ this.bS = entityendercrystal;
}
}
@@ -382,9 +382,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
private void i() {
- this.bO = false;
+ this.bP = false;
if (this.random.nextInt(2) == 0 && !this.world.players.isEmpty()) {
- this.bS = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
+ this.bT = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
} else {
boolean flag = false;
@@ -401,7 +401,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
flag = d0 * d0 + d1 * d1 + d2 * d2 > 100.0D;
} while (!flag);
- this.bS = null;
+ this.bT = null;
}
}
@@ -431,9 +431,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
if (j2 != 0) {
if (j2 != Block.OBSIDIAN.id && j2 != Block.WHITESTONE.id && j2 != Block.BEDROCK.id) {
- flag1 = true;
// CraftBukkit start - add blocks to list rather than destroying them
- // this.world.setTypeId(k1, l1, i2, 0);
+ // flag1 = this.world.setAir(k1, l1, i2) || flag1;
+ flag1 = true;
destroyedBlocks.add(craftWorld.getBlockAt(k1, l1, i2));
// CraftBukkit end
} else {
@@ -482,8 +482,8 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.a = this.locX + (double) (f1 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
this.b = this.locY + (double) (this.random.nextFloat() * 3.0F) + 1.0D;
this.c = this.locZ - (double) (f2 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
- this.bS = null;
- if (damagesource.getEntity() instanceof EntityHuman || damagesource == DamageSource.EXPLOSION) {
+ this.bT = null;
+ if (damagesource.getEntity() instanceof EntityHuman || damagesource.c()) {
this.dealDamage(damagesource, i);
}
@@ -498,9 +498,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
return super.damageEntity(damagesource, i);
}
- protected void aP() {
- ++this.bQ;
- if (this.bQ >= 180 && this.bQ <= 200) {
+ protected void aS() {
+ ++this.bR;
+ if (this.bR >= 180 && this.bR <= 200) {
float f = (this.random.nextFloat() - 0.5F) * 8.0F;
float f1 = (this.random.nextFloat() - 0.5F) * 4.0F;
float f2 = (this.random.nextFloat() - 0.5F) * 8.0F;
@@ -512,7 +512,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
int j;
if (!this.world.isStatic) {
- if (this.bQ > 150 && this.bQ % 5 == 0) {
+ if (this.bR > 150 && this.bR % 5 == 0) {
i = expToDrop / 12; // CraftBukkit - drop experience as dragon falls from sky. use experience drop from death event. This is now set in getExpReward()
while (i > 0) {
@@ -522,14 +522,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
}
- if (this.bQ == 1) {
- this.world.e(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
+ if (this.bR == 1) {
+ this.world.d(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
}
this.move(0.0D, 0.10000000149011612D, 0.0D);
- this.ax = this.yaw += 20.0F;
- if (this.bQ == 200 && !this.world.isStatic) {
+ this.ay = this.yaw += 20.0F;
+ if (this.bR == 200 && !this.world.isStatic) {
i = expToDrop - 10 * (expToDrop / 12); // CraftBukkit - drop the remaining experience
while (i > 0) {
@@ -609,13 +609,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
BlockEnderPortal.a = false;
}
- protected void bk() {}
+ protected void bn() {}
- public Entity[] ao() {
+ public Entity[] an() {
return this.children;
}
- public boolean L() {
+ public boolean K() {
return false;
}
@@ -623,15 +623,15 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
return this.world;
}
- protected String aY() {
+ protected String bb() {
return "mob.enderdragon.growl";
}
- protected String aZ() {
+ protected String bc() {
return "mob.enderdragon.hit";
}
- protected float aX() {
+ protected float ba() {
return 5.0F;
}
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index 15b5516b..87d73455 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -15,9 +15,9 @@ public class EntityEnderman extends EntityMonster {
public EntityEnderman(World world) {
super(world);
this.texture = "/mob/enderman.png";
- this.bH = 0.2F;
+ this.bI = 0.2F;
this.a(0.6F, 2.9F);
- this.X = 1.0F;
+ this.Y = 1.0F;
}
public int getMaxHealth() {
@@ -47,14 +47,14 @@ public class EntityEnderman extends EntityMonster {
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 64.0D);
if (entityhuman != null) {
- if (this.d(entityhuman)) {
+ if (this.e(entityhuman)) {
if (this.f == 0) {
this.world.makeSound(entityhuman, "mob.endermen.stare", 1.0F, 1.0F);
}
if (this.f++ == 5) {
this.f = 0;
- this.f(true);
+ this.a(true);
return entityhuman;
}
} else {
@@ -65,7 +65,7 @@ public class EntityEnderman extends EntityMonster {
return null;
}
- private boolean d(EntityHuman entityhuman) {
+ private boolean e(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.armor[3];
if (itemstack != null && itemstack.id == Block.PUMPKIN.id) {
@@ -83,11 +83,11 @@ public class EntityEnderman extends EntityMonster {
}
public void c() {
- if (this.G()) {
+ if (this.F()) {
this.damageEntity(DamageSource.DROWN, 1);
}
- this.bH = this.target != null ? 6.5F : 0.3F;
+ this.bI = this.target != null ? 6.5F : 0.3F;
int i;
if (!this.world.isStatic && this.world.getGameRules().getBoolean("mobGriefing")) {
@@ -106,7 +106,7 @@ public class EntityEnderman extends EntityMonster {
if (!CraftEventFactory.callEntityChangeBlockEvent(this, this.world.getWorld().getBlockAt(i, j, k), org.bukkit.Material.AIR).isCancelled()) {
this.setCarriedId(this.world.getTypeId(i, j, k));
this.setCarriedData(this.world.getData(i, j, k));
- this.world.setTypeId(i, j, k, 0);
+ this.world.setTypeIdUpdate(i, j, k, 0);
}
// CraftBukkit end
}
@@ -121,7 +121,7 @@ public class EntityEnderman extends EntityMonster {
if (l == 0 && i1 > 0 && Block.byId[i1].b()) {
// CraftBukkit start - place event
if (!CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, this.getCarriedId(), this.getCarriedData()).isCancelled()) {
- this.world.setTypeIdAndData(i, j, k, this.getCarriedId(), this.getCarriedData());
+ this.world.setTypeIdAndData(i, j, k, this.getCarriedId(), this.getCarriedData(), 3);
this.setCarriedId(0);
}
// CraftBukkit end
@@ -136,29 +136,29 @@ public class EntityEnderman extends EntityMonster {
if (this.world.u() && !this.world.isStatic) {
float f = this.c(1.0F);
- if (f > 0.5F && this.world.k(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
+ if (f > 0.5F && this.world.l(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) {
this.target = null;
- this.f(false);
+ this.a(false);
this.m();
}
}
- if (this.G() || this.isBurning()) {
+ if (this.F() || this.isBurning()) {
this.target = null;
- this.f(false);
+ this.a(false);
this.m();
}
- this.bF = false;
+ this.bG = false;
if (this.target != null) {
this.a(this.target, 100.0F, 100.0F);
}
if (!this.world.isStatic && this.isAlive()) {
if (this.target != null) {
- if (this.target instanceof EntityHuman && this.d((EntityHuman) this.target)) {
- this.bC = this.bD = 0.0F;
- this.bH = 0.0F;
+ if (this.target instanceof EntityHuman && this.e((EntityHuman) this.target)) {
+ this.bD = this.bE = 0.0F;
+ this.bI = 0.0F;
if (this.target.e((Entity) this) < 16.0D) {
this.m();
}
@@ -168,7 +168,7 @@ public class EntityEnderman extends EntityMonster {
this.e = 0;
}
} else {
- this.f(false);
+ this.a(false);
this.e = 0;
}
}
@@ -265,15 +265,15 @@ public class EntityEnderman extends EntityMonster {
}
}
- protected String aY() {
+ protected String bb() {
return this.q() ? "mob.endermen.scream" : "mob.endermen.idle";
}
- protected String aZ() {
+ protected String bc() {
return "mob.endermen.hit";
}
- protected String ba() {
+ protected String bd() {
return "mob.endermen.death";
}
@@ -318,7 +318,7 @@ public class EntityEnderman extends EntityMonster {
if (this.isInvulnerable()) {
return false;
} else {
- this.f(true);
+ this.a(true);
if (damagesource instanceof EntityDamageSourceIndirect) {
for (int j = 0; j < 64; ++j) {
if (this.m()) {
@@ -337,7 +337,7 @@ public class EntityEnderman extends EntityMonster {
return this.datawatcher.getByte(18) > 0;
}
- public void f(boolean flag) {
+ public void a(boolean flag) {
this.datawatcher.watch(18, Byte.valueOf((byte) (flag ? 1 : 0)));
}
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index f5fc9cde..e76e0f94 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -39,8 +39,8 @@ public class EntityExperienceOrb extends Entity {
protected void a() {}
- public void j_() {
- super.j_();
+ public void l_() {
+ super.l_();
if (this.c > 0) {
--this.c;
}
@@ -114,7 +114,7 @@ public class EntityExperienceOrb extends Entity {
}
}
- public boolean I() {
+ public boolean H() {
return this.world.a(this.boundingBox, Material.WATER, (Entity) this);
}
@@ -126,7 +126,7 @@ public class EntityExperienceOrb extends Entity {
if (this.isInvulnerable()) {
return false;
} else {
- this.K();
+ this.J();
this.d -= i;
if (this.d <= 0) {
this.die();
@@ -148,10 +148,10 @@ public class EntityExperienceOrb extends Entity {
this.value = nbttagcompound.getShort("Value");
}
- public void c_(EntityHuman entityhuman) {
+ public void b_(EntityHuman entityhuman) {
if (!this.world.isStatic) {
- if (this.c == 0 && entityhuman.bS == 0) {
- entityhuman.bS = 2;
+ if (this.c == 0 && entityhuman.bT == 0) {
+ entityhuman.bT = 2;
this.makeSound("random.orb", 0.1F, 0.5F * ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.8F));
entityhuman.receive(this, 1);
entityhuman.giveExp(CraftEventFactory.callPlayerExpChangeEvent(entityhuman, this.value).getAmount()); // CraftBukkit - this.value to event.getAmount()
@@ -187,7 +187,7 @@ public class EntityExperienceOrb extends Entity {
return i >= 2477 ? 2477 : (i >= 1237 ? 1237 : (i >= 617 ? 617 : (i >= 307 ? 307 : (i >= 149 ? 149 : (i >= 73 ? 73 : (i >= 37 ? 37 : (i >= 17 ? 17 : (i >= 7 ? 7 : (i >= 3 ? 3 : 1)))))))));
}
- public boolean aq() {
+ public boolean ap() {
return false;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index ea440dcb..96120d87 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -14,20 +14,21 @@ public class EntityFallingBlock extends Entity {
public int data;
public int c;
public boolean dropItem;
- private boolean e;
+ private boolean f;
private boolean hurtEntities;
private int fallHurtMax;
private float fallHurtAmount;
- private NBTTagCompound tileEntityData; // CraftBukkit
+ public NBTTagCompound tileEntityData;
public EntityFallingBlock(World world) {
super(world);
this.c = 0;
this.dropItem = true;
- this.e = false;
+ this.f = false;
this.hurtEntities = false;
this.fallHurtMax = 40;
this.fallHurtAmount = 2.0F;
+ this.tileEntityData = null;
}
public EntityFallingBlock(World world, double d0, double d1, double d2, int i) {
@@ -38,10 +39,11 @@ public class EntityFallingBlock extends Entity {
super(world);
this.c = 0;
this.dropItem = true;
- this.e = false;
+ this.f = false;
this.hurtEntities = false;
this.fallHurtMax = 40;
this.fallHurtAmount = 2.0F;
+ this.tileEntityData = null;
this.id = i;
this.data = j;
this.m = true;
@@ -62,11 +64,11 @@ public class EntityFallingBlock extends Entity {
protected void a() {}
- public boolean L() {
+ public boolean K() {
return !this.dead;
}
- public void j_() {
+ public void l_() {
if (this.id == 0) {
this.die();
} else {
@@ -91,18 +93,7 @@ public class EntityFallingBlock extends Entity {
return;
}
- // CraftBukkit start - Store the block tile entity with this entity
- TileEntity tile = this.world.getTileEntity(i, j, k);
- if (tile != null) {
- tileEntityData = new NBTTagCompound();
- // Save the data
- tile.b(tileEntityData);
- // Remove the existing tile entity
- this.world.r(i, j, k);
- }
- // CraftBukkit end
-
- this.world.setTypeId(i, j, k, 0);
+ this.world.setAir(i, j, k);
}
if (this.onGround) {
@@ -112,20 +103,39 @@ public class EntityFallingBlock extends Entity {
if (this.world.getTypeId(i, j, k) != Block.PISTON_MOVING.id) {
this.die();
// CraftBukkit start
- if (!this.e && this.world.mayPlace(this.id, i, j, k, true, 1, (Entity) null) && !BlockSand.canFall(this.world, i, j - 1, k) /* mimic the false conditions of setTypeIdAndData */ && i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000 && j > 0 && j < 256 && !(this.world.getTypeId(i, j, k) == this.id && this.world.getData(i, j, k) == this.data)) {
+ if (!this.f && this.world.mayPlace(this.id, i, j, k, true, 1, (Entity) null, (ItemStack) null) && !BlockSand.canFall(this.world, i, j - 1, k) /* mimic the false conditions of setTypeIdAndData */ && i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000 && j > 0 && j < 256 && !(this.world.getTypeId(i, j, k) == this.id && this.world.getData(i, j, k) == this.data)) {
if (CraftEventFactory.callEntityChangeBlockEvent(this, i, j, k, this.id, this.data).isCancelled()) {
return;
}
- this.world.setTypeIdAndData(i, j, k, this.id, this.data);
-
- if (this.tileEntityData != null) {
- this.world.setTileEntity(i, j, k, TileEntity.c(this.tileEntityData));
- }
+ this.world.setTypeIdAndData(i, j, k, this.id, this.data, 3);
// CraftBukkit end
+
if (Block.byId[this.id] instanceof BlockSand) {
((BlockSand) Block.byId[this.id]).a_(this.world, i, j, k, this.data);
}
- } else if (this.dropItem && !this.e) {
+
+ if (this.tileEntityData != null && Block.byId[this.id] instanceof IContainer) {
+ TileEntity tileentity = this.world.getTileEntity(i, j, k);
+
+ if (tileentity != null) {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+
+ tileentity.b(nbttagcompound);
+ Iterator iterator = this.tileEntityData.c().iterator();
+
+ while (iterator.hasNext()) {
+ NBTBase nbtbase = (NBTBase) iterator.next();
+
+ if (!nbtbase.getName().equals("x") && !nbtbase.getName().equals("y") && !nbtbase.getName().equals("z")) {
+ nbttagcompound.set(nbtbase.getName(), nbtbase.clone());
+ }
+ }
+
+ tileentity.a(nbttagcompound);
+ tileentity.update();
+ }
+ }
+ } else if (this.dropItem && !this.f) {
this.a(new ItemStack(this.id, 1, Block.byId[this.id].getDropData(this.data)), 0.0F);
}
}
@@ -170,7 +180,7 @@ public class EntityFallingBlock extends Entity {
++j;
if (j > 2) {
- this.e = true;
+ this.f = true;
} else {
this.data = k | j << 2;
}
@@ -181,21 +191,25 @@ public class EntityFallingBlock extends Entity {
protected void b(NBTTagCompound nbttagcompound) {
nbttagcompound.setByte("Tile", (byte) this.id);
+ nbttagcompound.setInt("TileID", this.id);
nbttagcompound.setByte("Data", (byte) this.data);
nbttagcompound.setByte("Time", (byte) this.c);
nbttagcompound.setBoolean("DropItem", this.dropItem);
nbttagcompound.setBoolean("HurtEntities", this.hurtEntities);
nbttagcompound.setFloat("FallHurtAmount", this.fallHurtAmount);
nbttagcompound.setInt("FallHurtMax", this.fallHurtMax);
- // CraftBukkit start - store the tile data
if (this.tileEntityData != null) {
- nbttagcompound.set("Bukkit.tileData", this.tileEntityData.clone());
+ nbttagcompound.setCompound("TileEntityData", this.tileEntityData);
}
- // CraftBukkit end
}
protected void a(NBTTagCompound nbttagcompound) {
- this.id = nbttagcompound.getByte("Tile") & 255;
+ if (nbttagcompound.hasKey("TileID")) {
+ this.id = nbttagcompound.getInt("TileID");
+ } else {
+ this.id = nbttagcompound.getByte("Tile") & 255;
+ }
+
this.data = nbttagcompound.getByte("Data") & 255;
this.c = nbttagcompound.getByte("Time") & 255;
if (nbttagcompound.hasKey("HurtEntities")) {
@@ -206,22 +220,26 @@ public class EntityFallingBlock extends Entity {
this.hurtEntities = true;
}
- // CraftBukkit start - load tileData
+ if (nbttagcompound.hasKey("DropItem")) {
+ this.dropItem = nbttagcompound.getBoolean("DropItem");
+ }
+
+ if (nbttagcompound.hasKey("TileEntityData")) {
+ this.tileEntityData = nbttagcompound.getCompound("TileEntityData");
+ }
+
+ // CraftBukkit start - backward compatibility, remove in 1.6
if (nbttagcompound.hasKey("Bukkit.tileData")) {
this.tileEntityData = (NBTTagCompound) nbttagcompound.getCompound("Bukkit.tileData").clone();
}
// CraftBukkit end
- if (nbttagcompound.hasKey("DropItem")) {
- this.dropItem = nbttagcompound.getBoolean("DropItem");
- }
-
if (this.id == 0) {
this.id = Block.SAND.id;
}
}
- public void e(boolean flag) {
+ public void a(boolean flag) {
this.hurtEntities = flag;
}
diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java
index 107abcad..4a19b1d6 100644
--- a/src/main/java/net/minecraft/server/EntityFireball.java
+++ b/src/main/java/net/minecraft/server/EntityFireball.java
@@ -13,7 +13,7 @@ public abstract class EntityFireball extends Entity {
private boolean i = false;
public EntityLiving shooter;
private int j;
- private int at = 0;
+ private int au = 0;
public double dirX;
public double dirY;
public double dirZ;
@@ -63,11 +63,11 @@ public abstract class EntityFireball extends Entity {
this.dirZ = d2 / d3 * 0.1D;
}
- public void j_() {
+ public void l_() {
if (!this.world.isStatic && (this.shooter != null && this.shooter.dead || !this.world.isLoaded((int) this.locX, (int) this.locY, (int) this.locZ))) {
this.die();
} else {
- super.j_();
+ super.l_();
this.setOnFire(1);
if (this.i) {
int i = this.world.getTypeId(this.e, this.f, this.g);
@@ -86,9 +86,9 @@ public abstract class EntityFireball extends Entity {
this.motY *= (double) (this.random.nextFloat() * 0.2F);
this.motZ *= (double) (this.random.nextFloat() * 0.2F);
this.j = 0;
- this.at = 0;
+ this.au = 0;
} else {
- ++this.at;
+ ++this.au;
}
Vec3D vec3d = this.world.getVec3DPool().create(this.locX, this.locY, this.locZ);
@@ -108,7 +108,7 @@ public abstract class EntityFireball extends Entity {
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
- if (entity1.L() && (!entity1.i(this.shooter) || this.at >= 25)) {
+ if (entity1.K() && (!entity1.i(this.shooter) || this.au >= 25)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@@ -166,7 +166,7 @@ public abstract class EntityFireball extends Entity {
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f2 = this.c();
- if (this.H()) {
+ if (this.G()) {
for (int k = 0; k < 4; ++k) {
float f3 = 0.25F;
@@ -222,11 +222,11 @@ public abstract class EntityFireball extends Entity {
}
}
- public boolean L() {
+ public boolean K() {
return true;
}
- public float Y() {
+ public float X() {
return 1.0F;
}
@@ -234,9 +234,9 @@ public abstract class EntityFireball extends Entity {
if (this.isInvulnerable()) {
return false;
} else {
- this.K();
+ this.J();
if (damagesource.getEntity() != null) {
- Vec3D vec3d = damagesource.getEntity().Z();
+ Vec3D vec3d = damagesource.getEntity().Y();
if (vec3d != null) {
this.motX = vec3d.c;
diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java
index 64454f5b..6856e5b5 100644
--- a/src/main/java/net/minecraft/server/EntityFireworks.java
+++ b/src/main/java/net/minecraft/server/EntityFireworks.java
@@ -38,11 +38,11 @@ public class EntityFireworks extends Entity {
this.expectedLifespan = 10 * i + this.random.nextInt(6) + this.random.nextInt(7);
}
- public void j_() {
- this.T = this.locX;
- this.U = this.locY;
- this.V = this.locZ;
- super.j_();
+ public void l_() {
+ this.U = this.locX;
+ this.V = this.locY;
+ this.W = this.locZ;
+ super.l_();
this.motX *= 1.15D;
this.motZ *= 1.15D;
this.motY += 0.04D;
@@ -115,7 +115,7 @@ public class EntityFireworks extends Entity {
return super.c(f);
}
- public boolean aq() {
+ public boolean ap() {
return false;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index 4e722876..a37ac26d 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -18,24 +18,24 @@ public class EntityFishingHook extends Entity {
public EntityHuman owner;
private int i;
private int j = 0;
- private int at = 0;
+ private int au = 0;
public Entity hooked = null;
- private int au;
- private double av;
+ private int av;
private double aw;
private double ax;
private double ay;
private double az;
+ private double aA;
public EntityFishingHook(World world) {
super(world);
this.a(0.25F, 0.25F);
- this.al = true;
+ this.am = true;
}
public EntityFishingHook(World world, EntityHuman entityhuman) {
super(world);
- this.al = true;
+ this.am = true;
this.owner = entityhuman;
this.owner.hookedFish = this;
this.a(0.25F, 0.25F);
@@ -77,22 +77,22 @@ public class EntityFishingHook extends Entity {
this.i = 0;
}
- public void j_() {
- super.j_();
- if (this.au > 0) {
- double d0 = this.locX + (this.av - this.locX) / (double) this.au;
- double d1 = this.locY + (this.aw - this.locY) / (double) this.au;
- double d2 = this.locZ + (this.ax - this.locZ) / (double) this.au;
- double d3 = MathHelper.g(this.ay - (double) this.yaw);
-
- this.yaw = (float) ((double) this.yaw + d3 / (double) this.au);
- this.pitch = (float) ((double) this.pitch + (this.az - (double) this.pitch) / (double) this.au);
- --this.au;
+ public void l_() {
+ super.l_();
+ if (this.av > 0) {
+ double d0 = this.locX + (this.aw - this.locX) / (double) this.av;
+ double d1 = this.locY + (this.ax - this.locY) / (double) this.av;
+ double d2 = this.locZ + (this.ay - this.locZ) / (double) this.av;
+ double d3 = MathHelper.g(this.az - (double) this.yaw);
+
+ this.yaw = (float) ((double) this.yaw + d3 / (double) this.av);
+ this.pitch = (float) ((double) this.pitch + (this.aA - (double) this.pitch) / (double) this.av);
+ --this.av;
this.setPosition(d0, d1, d2);
this.b(this.yaw, this.pitch);
} else {
if (!this.world.isStatic) {
- ItemStack itemstack = this.owner.bS();
+ ItemStack itemstack = this.owner.cb();
if (this.owner.dead || !this.owner.isAlive() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.e(this.owner) > 1024.0D) {
this.die();
@@ -157,7 +157,7 @@ public class EntityFishingHook extends Entity {
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
- if (entity1.L() && (entity1 != this.owner || this.j >= 5)) {
+ if (entity1.K() && (entity1 != this.owner || this.j >= 5)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@@ -230,17 +230,17 @@ public class EntityFishingHook extends Entity {
}
if (d6 > 0.0D) {
- if (this.at > 0) {
- --this.at;
+ if (this.au > 0) {
+ --this.au;
} else {
short short1 = 500;
- if (this.world.D(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) {
+ if (this.world.F(MathHelper.floor(this.locX), MathHelper.floor(this.locY) + 1, MathHelper.floor(this.locZ))) {
short1 = 300;
}
if (this.random.nextInt(short1) == 0) {
- this.at = this.random.nextInt(30) + 10;
+ this.au = this.random.nextInt(30) + 10;
this.motY -= 0.20000000298023224D;
this.makeSound("random.splash", 0.25F, 1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.4F);
float f3 = (float) MathHelper.floor(this.boundingBox.b);
@@ -264,7 +264,7 @@ public class EntityFishingHook extends Entity {
}
}
- if (this.at > 0) {
+ if (this.au > 0) {
this.motY -= (double) (this.random.nextFloat() * this.random.nextFloat() * this.random.nextFloat()) * 0.2D;
}
@@ -329,7 +329,7 @@ public class EntityFishingHook extends Entity {
this.hooked.motY += d1 * d4 + (double) MathHelper.sqrt(d3) * 0.08D;
this.hooked.motZ += d2 * d4;
b0 = 3;
- } else if (this.at > 0) {
+ } else if (this.au > 0) {
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.RAW_FISH));
// CraftBukkit start
PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH);
diff --git a/src/main/java/net/minecraft/server/EntityGhast.java b/src/main/java/net/minecraft/server/EntityGhast.java
index beed7862..f18a9246 100644
--- a/src/main/java/net/minecraft/server/EntityGhast.java
+++ b/src/main/java/net/minecraft/server/EntityGhast.java
@@ -23,13 +23,13 @@ public class EntityGhast extends EntityFlying implements IMonster {
this.texture = "/mob/ghast.png";
this.a(4.0F, 4.0F);
this.fireProof = true;
- this.bd = 5;
+ this.be = 5;
}
public boolean damageEntity(DamageSource damagesource, int i) {
if (this.isInvulnerable()) {
return false;
- } else if ("fireball".equals(damagesource.l()) && damagesource.getEntity() instanceof EntityHuman) {
+ } else if ("fireball".equals(damagesource.n()) && damagesource.getEntity() instanceof EntityHuman) {
super.damageEntity(damagesource, 1000);
((EntityHuman) damagesource.getEntity()).a((Statistic) AchievementList.y);
return true;
@@ -47,19 +47,19 @@ public class EntityGhast extends EntityFlying implements IMonster {
return 10;
}
- public void j_() {
- super.j_();
+ public void l_() {
+ super.l_();
byte b0 = this.datawatcher.getByte(16);
this.texture = b0 == 1 ? "/mob/ghast_fire.png" : "/mob/ghast.png";
}
- protected void bn() {
+ protected void bq() {
if (!this.world.isStatic && this.world.difficulty == 0) {
this.die();
}
- this.bk();
+ this.bn();
this.f = this.g;
double d0 = this.c - this.locX;
double d1 = this.d - this.locY;
@@ -130,7 +130,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
double d6 = this.target.boundingBox.b + (double) (this.target.length / 2.0F) - (this.locY + (double) (this.length / 2.0F));
double d7 = this.target.locZ - this.locZ;
- this.ax = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
+ this.ay = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
if (this.n(this.target)) {
if (this.g == 10) {
this.world.a((EntityHuman) null, 1007, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
@@ -156,7 +156,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
--this.g;
}
} else {
- this.ax = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
+ this.ay = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
if (this.g > 0) {
--this.g;
}
@@ -188,15 +188,15 @@ public class EntityGhast extends EntityFlying implements IMonster {
return true;
}
- protected String aY() {
+ protected String bb() {
return "mob.ghast.moan";
}
- protected String aZ() {
+ protected String bc() {
return "mob.ghast.scream";
}
- protected String ba() {
+ protected String bd() {
return "mob.ghast.death";
}
@@ -225,7 +225,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
// CraftBukkit end
}
- protected float aX() {
+ protected float ba() {
return 10.0F;
}
@@ -233,7 +233,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
return this.random.nextInt(20) == 0 && super.canSpawn() && this.world.difficulty > 0;
}
- public int bv() {
+ public int by() {
return 1;
}
diff --git a/src/main/java/net/minecraft/server/EntityHanging.java b/src/main/java/net/minecraft/server/EntityHanging.java
index 8cc80b97..c35a88a6 100644
--- a/src/main/java/net/minecraft/server/EntityHanging.java
+++ b/src/main/java/net/minecraft/server/EntityHanging.java
@@ -75,33 +75,33 @@ public abstract class EntityHanging extends Entity {
}
if (i == 2) {
- f3 -= this.g(this.d());
+ f3 -= this.b(this.d());
}
if (i == 1) {
- f5 += this.g(this.d());
+ f5 += this.b(this.d());
}
if (i == 0) {
- f3 += this.g(this.d());
+ f3 += this.b(this.d());
}
if (i == 3) {
- f5 -= this.g(this.d());
+ f5 -= this.b(this.d());
}
- f4 += this.g(this.g());
+ f4 += this.b(this.g());
this.setPosition((double) f3, (double) f4, (double) f5);
float f7 = -0.03125F;
this.boundingBox.b((double) (f3 - f - f7), (double) (f4 - f1 - f7), (double) (f5 - f2 - f7), (double) (f3 + f + f7), (double) (f4 + f1 + f7), (double) (f5 + f2 + f7));
}
- private float g(int i) {
+ private float b(int i) {
return i == 32 ? 0.5F : (i == 64 ? 0.5F : 0.0F);
}
- public void j_() {
+ public void l_() {
if (this.e++ == 100 && !this.world.isStatic) {
this.e = 0;
if (!this.dead && !this.survives()) {
@@ -199,7 +199,7 @@ public abstract class EntityHanging extends Entity {
}
}
- public boolean L() {
+ public boolean K() {
return true;
}
@@ -222,7 +222,7 @@ public abstract class EntityHanging extends Entity {
// Fire old painting event until it can be removed
paintingEvent = new org.bukkit.event.painting.PaintingBreakByEntityEvent((Painting) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity());
}
- } else if (damagesource == DamageSource.EXPLOSION || damagesource == DamageSource.EXPLOSION2) {
+ } else if (damagesource.c()) {
event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.EXPLOSION);
}
@@ -239,7 +239,7 @@ public abstract class EntityHanging extends Entity {
// CraftBukkit end
this.die();
- this.K();
+ this.J();
EntityHuman entityhuman = null;
if (damagesource.getEntity() instanceof EntityHuman) {
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index ce0715b5..bfcb6ce7 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -22,18 +23,18 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public Container defaultContainer;
public Container activeContainer;
protected FoodMetaData foodData = new FoodMetaData();
- protected int bN = 0;
- public byte bO = 0;
- public float bP;
+ protected int bO = 0;
+ public byte bP = 0;
public float bQ;
+ public float bR;
public String name;
- public int bS = 0;
- public double bT;
+ public int bT = 0;
public double bU;
public double bV;
public double bW;
public double bX;
public double bY;
+ public double bZ;
// CraftBukkit start
public boolean sleeping; // protected -> public
public boolean fauxSleeping;
@@ -45,10 +46,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
// CraftBukkit end
- public ChunkCoordinates ca;
+ public ChunkCoordinates cb;
public int sleepTicks; // CraftBukkit - private -> public
- public float cb;
public float cc;
+ public float cd;
private ChunkCoordinates c;
private boolean d;
private ChunkCoordinates e;
@@ -59,8 +60,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public float exp;
private ItemStack f;
private int g;
- protected float ch = 0.1F;
- protected float ci = 0.02F;
+ protected float ci = 0.1F;
+ protected float cj = 0.02F;
private int h = 0;
public EntityFishingHook hookedFish = null;
@@ -72,8 +73,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
ChunkCoordinates chunkcoordinates = world.getSpawn();
this.setPositionRotation((double) chunkcoordinates.x + 0.5D, (double) (chunkcoordinates.y + 1), (double) chunkcoordinates.z + 0.5D, 0.0F, 0.0F);
- this.aJ = "humanoid";
- this.aI = 180.0F;
+ this.aK = "humanoid";
+ this.aJ = 180.0F;
this.maxFireTicks = 20;
this.texture = "/mob/char.png";
}
@@ -89,31 +90,31 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.datawatcher.a(18, Integer.valueOf(0));
}
- public boolean bM() {
+ public boolean bV() {
return this.f != null;
}
- public void bO() {
+ public void bX() {
if (this.f != null) {
this.f.b(this.world, this, this.g);
}
- this.bP();
+ this.bY();
}
- public void bP() {
+ public void bY() {
this.f = null;
this.g = 0;
if (!this.world.isStatic) {
- this.d(false);
+ this.e(false);
}
}
- public boolean bh() {
- return this.bM() && Item.byId[this.f.id].b_(this.f) == EnumAnimation.d;
+ public boolean bk() {
+ return this.bV() && Item.byId[this.f.id].b_(this.f) == EnumAnimation.BLOCK;
}
- public void j_() {
+ public void l_() {
if (this.f != null) {
ItemStack itemstack = this.inventory.getItemInHand();
@@ -123,15 +124,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (--this.g == 0 && !this.world.isStatic) {
- this.n();
+ this.m();
}
} else {
- this.bP();
+ this.bY();
}
}
- if (this.bS > 0) {
- --this.bS;
+ if (this.bT > 0) {
+ --this.bT;
}
if (this.isSleeping()) {
@@ -141,7 +142,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (!this.world.isStatic) {
- if (!this.j()) {
+ if (!this.i()) {
this.a(true, true, false);
} else if (this.world.u()) {
this.a(false, true, true);
@@ -154,7 +155,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- super.j_();
+ super.l_();
if (!this.world.isStatic && this.activeContainer != null && !this.activeContainer.a(this)) {
this.closeInventory();
this.activeContainer = this.defaultContainer;
@@ -164,41 +165,41 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.extinguish();
}
- this.bT = this.bW;
this.bU = this.bX;
this.bV = this.bY;
- double d0 = this.locX - this.bW;
- double d1 = this.locY - this.bX;
- double d2 = this.locZ - this.bY;
+ this.bW = this.bZ;
+ double d0 = this.locX - this.bX;
+ double d1 = this.locY - this.bY;
+ double d2 = this.locZ - this.bZ;
double d3 = 10.0D;
if (d0 > d3) {
- this.bT = this.bW = this.locX;
+ this.bU = this.bX = this.locX;
}
if (d2 > d3) {
- this.bV = this.bY = this.locZ;
+ this.bW = this.bZ = this.locZ;
}
if (d1 > d3) {
- this.bU = this.bX = this.locY;
+ this.bV = this.bY = this.locY;
}
if (d0 < -d3) {
- this.bT = this.bW = this.locX;
+ this.bU = this.bX = this.locX;
}
if (d2 < -d3) {
- this.bV = this.bY = this.locZ;
+ this.bW = this.bZ = this.locZ;
}
if (d1 < -d3) {
- this.bU = this.bX = this.locY;
+ this.bV = this.bY = this.locY;
}
- this.bW += d0 * 0.25D;
- this.bY += d2 * 0.25D;
- this.bX += d1 * 0.25D;
+ this.bX += d0 * 0.25D;
+ this.bZ += d2 * 0.25D;
+ this.bY += d1 * 0.25D;
this.a(StatisticList.k, 1);
if (this.vehicle == null) {
this.e = null;
@@ -209,11 +210,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- public int z() {
+ public int y() {
return this.abilities.isInvulnerable ? 0 : 80;
}
- public int ab() {
+ public int aa() {
return 10;
}
@@ -222,11 +223,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
protected void c(ItemStack itemstack, int i) {
- if (itemstack.n() == EnumAnimation.c) {
+ if (itemstack.o() == EnumAnimation.DRINK) {
this.makeSound("random.drink", 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F);
}
- if (itemstack.n() == EnumAnimation.b) {
+ if (itemstack.o() == EnumAnimation.EAT) {
for (int j = 0; j < i; ++j) {
Vec3D vec3d = this.world.getVec3DPool().create(((double) this.random.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
@@ -244,7 +245,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- protected void n() {
+ protected void m() {
if (this.f != null) {
this.c(this.f, 16);
int i = this.f.count;
@@ -283,11 +284,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- this.bP();
+ this.bY();
}
}
- protected boolean bg() {
+ protected boolean bj() {
return this.getHealth() <= 0 || this.isSleeping();
}
@@ -296,31 +297,50 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.activeContainer = this.defaultContainer;
}
- public void U() {
+ public void mount(Entity entity) {
+ // CraftBukkit start - mirror Entity mount changes
+ this.setPassengerOf(entity);
+ }
+
+ public void setPassengerOf(Entity entity) {
+ // CraftBukkit end
+ if (this.vehicle == entity) {
+ this.h(entity);
+ if (this.vehicle != null) {
+ this.vehicle.passenger = null;
+ }
+
+ this.vehicle = null;
+ } else {
+ super.setPassengerOf(entity); // CraftBukkit - call new parent
+ }
+ }
+
+ public void T() {
double d0 = this.locX;
double d1 = this.locY;
double d2 = this.locZ;
float f = this.yaw;
float f1 = this.pitch;
- super.U();
- this.bP = this.bQ;
- this.bQ = 0.0F;
+ super.T();
+ this.bQ = this.bR;
+ this.bR = 0.0F;
this.k(this.locX - d0, this.locY - d1, this.locZ - d2);
if (this.vehicle instanceof EntityPig) {
this.pitch = f1;
this.yaw = f;
- this.ax = ((EntityPig) this.vehicle).ax;
+ this.ay = ((EntityPig) this.vehicle).ay;
}
}
- protected void bn() {
- this.bo();
+ protected void bq() {
+ this.br();
}
public void c() {
- if (this.bN > 0) {
- --this.bN;
+ if (this.bO > 0) {
+ --this.bO;
}
// CraftBukkit - this.getMaxHealth() -> this.maxHealth
@@ -329,14 +349,14 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.heal(1, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.REGEN);
}
- this.inventory.j();
- this.bP = this.bQ;
+ this.inventory.k();
+ this.bQ = this.bR;
super.c();
- this.aN = this.abilities.b();
- this.aO = this.ci;
+ this.aO = this.abilities.b();
+ this.aP = this.cj;
if (this.isSprinting()) {
- this.aN = (float) ((double) this.aN + (double) this.abilities.b() * 0.3D);
- this.aO = (float) ((double) this.aO + (double) this.ci * 0.3D);
+ this.aO = (float) ((double) this.aO + (double) this.abilities.b() * 0.3D);
+ this.aP = (float) ((double) this.aP + (double) this.cj * 0.3D);
}
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
@@ -355,8 +375,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
f1 = 0.0F;
}
- this.bQ += (f - this.bQ) * 0.4F;
- this.bb += (f1 - this.bb) * 0.8F;
+ this.bR += (f - this.bR) * 0.4F;
+ this.bc += (f1 - this.bc) * 0.8F;
if (this.getHealth() > 0) {
List list = this.world.getEntities(this, this.boundingBox.grow(1.0D, 0.5D, 1.0D));
@@ -373,7 +393,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
private void r(Entity entity) {
- entity.c_(this);
+ entity.b_(this);
}
public int getScore() {
@@ -400,12 +420,12 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (!this.world.getGameRules().getBoolean("keepInventory")) {
- this.inventory.l();
+ this.inventory.m();
}
if (damagesource != null) {
- this.motX = (double) (-MathHelper.cos((this.aX + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
- this.motZ = (double) (-MathHelper.sin((this.aX + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
+ this.motX = (double) (-MathHelper.cos((this.aY + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
+ this.motZ = (double) (-MathHelper.sin((this.aY + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
} else {
this.motX = this.motZ = 0.0D;
}
@@ -416,14 +436,26 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void c(Entity entity, int i) {
this.addScore(i);
+ Collection collection = this.getScoreboard().a(IObjective.e);
+
if (entity instanceof EntityHuman) {
this.a(StatisticList.A, 1);
+ collection.addAll(this.getScoreboard().a(IObjective.d));
} else {
this.a(StatisticList.z, 1);
}
+
+ Iterator iterator = collection.iterator();
+
+ while (iterator.hasNext()) {
+ ScoreboardObjective scoreboardobjective = (ScoreboardObjective) iterator.next();
+ ScoreboardScore scoreboardscore = this.getScoreboard().a(this.getLocalizedName(), scoreboardobjective);
+
+ scoreboardscore.a();
+ }
}
- public EntityItem f(boolean flag) {
+ public EntityItem a(boolean flag) {
return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && this.inventory.getItemInHand() != null ? this.inventory.getItemInHand().count : 1), false);
}
@@ -484,18 +516,21 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.world.addEntity(entityitem);
}
- public float a(Block block) {
+ public float a(Block block, boolean flag) {
float f = this.inventory.a(block);
- int i = EnchantmentManager.getDigSpeedEnchantmentLevel(this);
- ItemStack itemstack = this.inventory.getItemInHand();
- if (i > 0 && itemstack != null) {
- float f1 = (float) (i * i + 1);
+ if (f > 1.0F) {
+ int i = EnchantmentManager.getDigSpeedEnchantmentLevel(this);
+ ItemStack itemstack = this.inventory.getItemInHand();
- if (!itemstack.b(block) && f <= 1.0F) {
- f += f1 * 0.08F;
- } else {
- f += f1;
+ if (i > 0 && itemstack != null) {
+ float f1 = (float) (i * i + 1);
+
+ if (!itemstack.b(block) && f <= 1.0F) {
+ f += f1 * 0.08F;
+ } else {
+ f += f1;
+ }
}
}
@@ -518,7 +553,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return f;
}
- public boolean b(Block block) {
+ public boolean a(Block block) {
return this.inventory.b(block);
}
@@ -535,7 +570,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.expTotal = nbttagcompound.getInt("XpTotal");
this.setScore(nbttagcompound.getInt("Score"));
if (this.sleeping) {
- this.ca = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
+ this.cb = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
this.a(true, true, false);
}
@@ -580,12 +615,16 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.foodData.b(nbttagcompound);
this.abilities.a(nbttagcompound);
- nbttagcompound.set("EnderItems", this.enderChest.g());
+ nbttagcompound.set("EnderItems", this.enderChest.h());
}
public void openContainer(IInventory iinventory) {}
- public void startEnchanting(int i, int j, int k) {}
+ public void openHopper(TileEntityHopper tileentityhopper) {}
+
+ public void openMinecartHopper(EntityMinecartHopper entityminecarthopper) {}
+
+ public void startEnchanting(int i, int j, int k, String s) {}
public void openAnvil(int i, int j, int k) {}
@@ -605,7 +644,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
} else if (this.abilities.isInvulnerable && !damagesource.ignoresInvulnerability()) {
return false;
} else {
- this.bB = 0;
+ this.bC = 0;
if (this.getHealth() <= 0) {
return false;
} else {
@@ -613,7 +652,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.a(true, true, false);
}
- if (damagesource.n()) {
+ if (damagesource.p()) {
if (this.world.difficulty == 0) {
return false; // CraftBukkit - i = 0 -> return false
}
@@ -647,32 +686,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- protected int c(DamageSource damagesource, int i) {
- int j = super.c(damagesource, i);
-
- if (j <= 0) {
- return 0;
- } else {
- int k = EnchantmentManager.a(this.inventory.armor, damagesource);
-
- if (k > 20) {
- k = 20;
- }
-
- if (k > 0 && k <= 20) {
- int l = 25 - k;
- int i1 = j * l + this.aT;
-
- j = i1 / 25;
- this.aT = i1 % 25;
- }
-
- return j;
- }
- }
+ public boolean a(EntityHuman entityhuman) {
+ ScoreboardTeam scoreboardteam = this.getScoreboardTeam();
+ ScoreboardTeam scoreboardteam1 = entityhuman.getScoreboardTeam();
- protected boolean h() {
- return false;
+ return scoreboardteam != scoreboardteam1 ? true : (scoreboardteam != null ? scoreboardteam.g() : true);
}
protected void a(EntityLiving entityliving, boolean flag) {
@@ -685,7 +703,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- if (!(entityliving instanceof EntityHuman) || this.h()) {
+ if (!(entityliving instanceof EntityHuman) || this.a((EntityHuman) entityliving)) {
List list = this.world.a(EntityWolf.class, AxisAlignedBB.a().a(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).grow(16.0D, 4.0D, 16.0D));
Iterator iterator = list.iterator();
@@ -705,11 +723,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.inventory.g(i);
}
- public int aW() {
- return this.inventory.k();
+ public int aZ() {
+ return this.inventory.l();
}
- public float bR() {
+ public float ca() {
int i = 0;
ItemStack[] aitemstack = this.inventory.armor;
int j = aitemstack.length;
@@ -727,14 +745,17 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
protected void d(DamageSource damagesource, int i) {
if (!this.isInvulnerable()) {
- if (!damagesource.ignoresArmor() && this.bh()) {
+ if (!damagesource.ignoresArmor() && this.bk()) {
i = 1 + i >> 1;
}
i = this.b(damagesource, i);
i = this.c(damagesource, i);
- this.j(damagesource.d());
- this.health -= i;
+ this.j(damagesource.f());
+ int j = this.getHealth();
+
+ this.setHealth(this.getHealth() - i);
+ this.bt.a(damagesource, j, i);
}
}
@@ -748,15 +769,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void openBeacon(TileEntityBeacon tileentitybeacon) {}
- public void openTrade(IMerchant imerchant) {}
+ public void openTrade(IMerchant imerchant, String s) {}
public void d(ItemStack itemstack) {}
public boolean p(Entity entity) {
- if (entity.a(this)) {
+ if (entity.a_(this)) {
return true;
} else {
- ItemStack itemstack = this.bS();
+ ItemStack itemstack = this.cb();
if (itemstack != null && entity instanceof EntityLiving) {
if (this.abilities.canInstantlyBuild) {
@@ -766,7 +787,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (itemstack.a((EntityLiving) entity)) {
// CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0 && !this.abilities.canInstantlyBuild) {
- this.bT();
+ this.cc();
}
return true;
@@ -777,20 +798,20 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- public ItemStack bS() {
+ public ItemStack cb() {
return this.inventory.getItemInHand();
}
- public void bT() {
+ public void cc() {
this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null);
}
- public double W() {
+ public double V() {
return (double) (this.height - 0.5F);
}
public void attack(Entity entity) {
- if (entity.aq()) {
+ if (entity.ap()) {
if (!entity.j(this)) {
int i = this.inventory.a(entity);
@@ -815,9 +836,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (i > 0 || k > 0) {
- boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.g_() && !this.H() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
+ boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.g_() && !this.G() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
- if (flag) {
+ if (flag && i > 0) {
i += this.random.nextInt(i / 2 + 2);
}
@@ -867,13 +888,22 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- ItemStack itemstack = this.bS();
+ ItemStack itemstack = this.cb();
+ Object object = entity;
- if (itemstack != null && entity instanceof EntityLiving) {
- itemstack.a((EntityLiving) entity, this);
+ if (entity instanceof EntityComplexPart) {
+ IComplex icomplex = ((EntityComplexPart) entity).owner;
+
+ if (icomplex != null && icomplex instanceof EntityLiving) {
+ object = (EntityLiving) icomplex;
+ }
+ }
+
+ if (itemstack != null && object instanceof EntityLiving) {
+ itemstack.a((EntityLiving) object, this);
// CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0) {
- this.bT();
+ this.cc();
}
}
@@ -919,7 +949,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return !this.sleeping && super.inBlock();
}
- public boolean bV() {
+ public boolean ce() {
return false;
}
@@ -968,7 +998,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.height = 0.2F;
if (this.world.isLoaded(i, j, k)) {
int l = this.world.getData(i, j, k);
- int i1 = BlockBed.e(l);
+ int i1 = BlockBed.j(l);
float f = 0.5F;
float f1 = 0.5F;
@@ -997,7 +1027,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.sleeping = true;
this.sleepTicks = 0;
- this.ca = new ChunkCoordinates(i, j, k);
+ this.cb = new ChunkCoordinates(i, j, k);
this.motX = this.motZ = this.motY = 0.0D;
if (!this.world.isStatic) {
this.world.everyoneSleeping();
@@ -1007,31 +1037,31 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
private void x(int i) {
- this.cb = 0.0F;
this.cc = 0.0F;
+ this.cd = 0.0F;
switch (i) {
case 0:
- this.cc = -1.8F;
+ this.cd = -1.8F;
break;
case 1:
- this.cb = 1.8F;
+ this.cc = 1.8F;
break;
case 2:
- this.cc = 1.8F;
+ this.cd = 1.8F;
break;
case 3:
- this.cb = -1.8F;
+ this.cc = -1.8F;
}
}
public void a(boolean flag, boolean flag1, boolean flag2) {
this.a(0.6F, 1.8F);
this.e_();
- ChunkCoordinates chunkcoordinates = this.ca;
- ChunkCoordinates chunkcoordinates1 = this.ca;
+ ChunkCoordinates chunkcoordinates = this.cb;
+ ChunkCoordinates chunkcoordinates1 = this.cb;
if (chunkcoordinates != null && this.world.getTypeId(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z) == Block.BED.id) {
BlockBed.a(this.world, chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, false);
@@ -1071,16 +1101,16 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (flag2) {
- this.setRespawnPosition(this.ca, false);
+ this.setRespawnPosition(this.cb, false);
}
}
- private boolean j() {
- return this.world.getTypeId(this.ca.x, this.ca.y, this.ca.z) == Block.BED.id;
+ private boolean i() {
+ return this.world.getTypeId(this.cb.x, this.cb.y, this.cb.z) == Block.BED.id;
}
public static ChunkCoordinates getBed(World world, ChunkCoordinates chunkcoordinates, boolean flag) {
- IChunkProvider ichunkprovider = world.I();
+ IChunkProvider ichunkprovider = world.J();
ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z - 3 >> 4);
ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z - 3 >> 4);
@@ -1146,8 +1176,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void a(Statistic statistic, int i) {}
- protected void bi() {
- super.bi();
+ protected void bl() {
+ super.bl();
this.a(StatisticList.u, 1);
if (this.isSprinting()) {
this.j(0.8F);
@@ -1163,12 +1193,12 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (this.abilities.isFlying && this.vehicle == null) {
double d3 = this.motY;
- float f2 = this.aO;
+ float f2 = this.aP;
- this.aO = this.abilities.a();
+ this.aP = this.abilities.a();
super.e(f, f1);
this.motY = d3 * 0.6D;
- this.aO = f2;
+ this.aP = f2;
} else {
super.e(f, f1);
}
@@ -1186,7 +1216,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.a(StatisticList.q, i);
this.j(0.015F * (float) i * 0.01F);
}
- } else if (this.H()) {
+ } else if (this.G()) {
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.m, i);
@@ -1220,7 +1250,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
int i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
- if (this.vehicle instanceof EntityMinecart) {
+ if (this.vehicle instanceof EntityMinecartAbstract) {
this.a(StatisticList.r, i);
if (this.e == null) {
this.e = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
@@ -1252,9 +1282,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- public void am() {
+ public void al() {
if (!this.abilities.isFlying) {
- super.am();
+ super.al();
}
}
@@ -1262,9 +1292,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return this.inventory.f(i);
}
- protected void bE() {}
+ protected void bH() {}
- protected void bF() {}
+ protected void bI() {}
public void giveExp(int i) {
this.addScore(i);
@@ -1314,11 +1344,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return this.foodData;
}
- public boolean g(boolean flag) {
+ public boolean i(boolean flag) {
return (flag || this.foodData.c()) && !this.abilities.isInvulnerable;
}
- public boolean cd() {
+ public boolean cm() {
return this.getHealth() > 0 && this.getHealth() < this.maxHealth; // CraftBukkit - this.getMaxHealth() -> this.maxHealth
}
@@ -1327,12 +1357,12 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.f = itemstack;
this.g = i;
if (!this.world.isStatic) {
- this.d(true);
+ this.e(true);
}
}
}
- public boolean f(int i, int j, int k) {
+ public boolean e(int i, int j, int k) {
if (this.abilities.mayBuild) {
return true;
} else {
@@ -1345,8 +1375,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return true;
}
- if (this.bS() != null) {
- ItemStack itemstack = this.bS();
+ if (this.cb() != null) {
+ ItemStack itemstack = this.cb();
if (itemstack.b(block) || itemstack.a(block) > 1.0F) {
return true;
@@ -1359,7 +1389,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
public boolean a(int i, int j, int k, int l, ItemStack itemstack) {
- return this.abilities.mayBuild ? true : (itemstack != null ? itemstack.x() : false);
+ return this.abilities.mayBuild ? true : (itemstack != null ? itemstack.y() : false);
}
protected int getExpValue(EntityHuman entityhuman) {
@@ -1380,6 +1410,16 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return this.name;
}
+ public boolean getCustomNameVisible() {
+ return super.getCustomNameVisible();
+ }
+
+ /* CraftBukkit start - we use canPickUpLoot on players, can't have this
+ public boolean bS() {
+ return false;
+ }
+ // CraftBukkit end */
+
public void copyTo(EntityHuman entityhuman, boolean flag) {
if (flag) {
this.inventory.b(entityhuman.inventory);
@@ -1389,7 +1429,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.expTotal = entityhuman.expTotal;
this.exp = entityhuman.exp;
this.setScore(entityhuman.getScore());
- this.ar = entityhuman.ar;
+ this.as = entityhuman.as;
} else if (this.world.getGameRules().getBoolean("keepInventory")) {
this.inventory.b(entityhuman.inventory);
this.expLevel = entityhuman.expLevel;
@@ -1429,7 +1469,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1];
}
- public ItemStack bD() {
+ public ItemStack bG() {
return this.inventory.getItemInHand();
}
@@ -1440,4 +1480,20 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public ItemStack[] getEquipment() {
return this.inventory.armor;
}
+
+ public boolean aw() {
+ return !this.abilities.isFlying;
+ }
+
+ public Scoreboard getScoreboard() {
+ return this.world.getScoreboard();
+ }
+
+ public ScoreboardTeam getScoreboardTeam() {
+ return this.getScoreboard().i(this.name);
+ }
+
+ public String getScoreboardDisplayName() {
+ return ScoreboardTeam.a(this.getScoreboardTeam(), this.name);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java
index c0655dfb..d2c5857e 100644
--- a/src/main/java/net/minecraft/server/EntityIronGolem.java
+++ b/src/main/java/net/minecraft/server/EntityIronGolem.java
@@ -32,16 +32,16 @@ public class EntityIronGolem extends EntityGolem {
this.datawatcher.a(16, Byte.valueOf((byte) 0));
}
- public boolean be() {
+ public boolean bh() {
return true;
}
- protected void bm() {
+ protected void bp() {
if (--this.e <= 0) {
this.e = 70 + this.random.nextInt(50);
this.d = this.world.villages.getClosestVillage(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 32);
if (this.d == null) {
- this.aL();
+ this.aO();
} else {
ChunkCoordinates chunkcoordinates = this.d.getCenter();
@@ -49,19 +49,19 @@ public class EntityIronGolem extends EntityGolem {
}
}
- super.bm();
+ super.bp();
}
public int getMaxHealth() {
return 100;
}
- protected int g(int i) {
+ protected int h(int i) {
return i;
}
protected void o(Entity entity) {
- if (entity instanceof IMonster && this.aB().nextInt(20) == 0) {
+ if (entity instanceof IMonster && this.aE().nextInt(20) == 0) {
this.setGoalTarget((EntityLiving) entity);
}
@@ -121,20 +121,20 @@ public class EntityIronGolem extends EntityGolem {
return this.d;
}
- public void f(boolean flag) {
+ public void a(boolean flag) {
this.g = flag ? 400 : 0;
this.world.broadcastEntityEffect(this, (byte) 11);
}
- protected String aY() {
+ protected String bb() {
return "none";
}
- protected String aZ() {
+ protected String bc() {
return "mob.irongolem.hit";
}
- protected String ba() {
+ protected String bd() {
return "mob.irongolem.death";
}
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index b8b6d52e..ee775bf7 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -53,8 +53,8 @@ public class EntityItem extends Entity {
this.getDataWatcher().a(10, 5);
}
- public void j_() {
- super.j_();
+ public void l_() {
+ super.l_();
// CraftBukkit start
int currentTick = (int) (System.currentTimeMillis() / 50);
this.pickupDelay -= (currentTick - this.lastTick);
@@ -65,7 +65,7 @@ public class EntityItem extends Entity {
this.lastY = this.locY;
this.lastZ = this.locZ;
this.motY -= 0.03999999910593033D;
- this.Y = this.i(this.locX, (this.boundingBox.b + this.boundingBox.e) / 2.0D, this.locZ);
+ this.Z = this.i(this.locX, (this.boundingBox.b + this.boundingBox.e) / 2.0D, this.locZ);
this.move(this.motX, this.motY, this.motZ);
boolean flag = (int) this.lastX != (int) this.locX || (int) this.lastY != (int) this.locY || (int) this.lastZ != (int) this.locZ;
@@ -135,7 +135,7 @@ public class EntityItem extends Entity {
return false;
} else if (itemstack1.hasTag() && !itemstack1.getTag().equals(itemstack.getTag())) {
return false;
- } else if (itemstack1.getItem().l() && itemstack1.getData() != itemstack.getData()) {
+ } else if (itemstack1.getItem().m() && itemstack1.getData() != itemstack.getData()) {
return false;
} else if (itemstack1.count < itemstack.count) {
return entityitem.a(this);
@@ -158,7 +158,7 @@ public class EntityItem extends Entity {
this.age = 4800;
}
- public boolean I() {
+ public boolean H() {
return this.world.a(this.boundingBox, Material.WATER, (Entity) this);
}
@@ -169,10 +169,10 @@ public class EntityItem extends Entity {
public boolean damageEntity(DamageSource damagesource, int i) {
if (this.isInvulnerable()) {
return false;
- } else if (this.getItemStack() != null && this.getItemStack().id == Item.NETHER_STAR.id && damagesource == DamageSource.EXPLOSION) {
+ } else if (this.getItemStack() != null && this.getItemStack().id == Item.NETHER_STAR.id && damagesource.c()) {
return false;
} else {
- this.K();
+ this.J();
this.d -= i;
if (this.d <= 0) {
this.die();
@@ -212,7 +212,7 @@ public class EntityItem extends Entity {
}
}
- public void c_(EntityHuman entityhuman) {
+ public void b_(EntityHuman entityhuman) {
if (!this.world.isStatic) {
ItemStack itemstack = this.getItemStack();
int i = itemstack.count;
@@ -267,12 +267,12 @@ public class EntityItem extends Entity {
return LocaleI18n.get("item." + this.getItemStack().a());
}
- public boolean aq() {
+ public boolean ap() {
return false;
}
- public void b(int i) {
- super.b(i);
+ public void c(int i) {
+ super.c(i);
if (!this.world.isStatic) {
this.g();
}
@@ -282,7 +282,10 @@ public class EntityItem extends Entity {
ItemStack itemstack = this.getDataWatcher().getItemStack(10);
if (itemstack == null) {
- System.out.println("Item entity " + this.id + " has no item?!");
+ if (this.world != null) {
+ this.world.getLogger().severe("Item entity " + this.id + " has no item?!");
+ }
+
return new ItemStack(Block.STONE);
} else {
return itemstack;
diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java
index 606ae347..638615d4 100644
--- a/src/main/java/net/minecraft/server/EntityLightning.java
+++ b/src/main/java/net/minecraft/server/EntityLightning.java
@@ -45,7 +45,7 @@ public class EntityLightning extends EntityWeather {
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- world.setTypeId(i, j, k, Block.FIRE.id);
+ world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
}
// CraftBukkit end
}
@@ -61,7 +61,7 @@ public class EntityLightning extends EntityWeather {
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- world.setTypeId(j, k, l, Block.FIRE.id);
+ world.setTypeIdUpdate(j, k, l, Block.FIRE.id);
}
// CraftBukkit end
}
@@ -69,8 +69,8 @@ public class EntityLightning extends EntityWeather {
}
}
- public void j_() {
- super.j_();
+ public void l_() {
+ super.l_();
if (this.lifeTicks == 2) {
this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F);
this.world.makeSound(this.locX, this.locY, this.locZ, "random.explode", 2.0F, 0.5F + this.random.nextFloat() * 0.2F);
@@ -96,7 +96,7 @@ public class EntityLightning extends EntityWeather {
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- this.world.setTypeId(i, j, k, Block.FIRE.id);
+ this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
}
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 7d2e633b..ae180c24 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -15,57 +15,57 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
public abstract class EntityLiving extends Entity {
- private static final float[] b = new float[] { 0.0F, 0.0F, 0.05F, 0.1F};
- private static final float[] c = new float[] { 0.0F, 0.0F, 0.05F, 0.2F};
+ private static final float[] b = new float[] { 0.0F, 0.0F, 0.1F, 0.2F};
+ private static final float[] c = new float[] { 0.0F, 0.0F, 0.25F, 0.5F};
private static final float[] d = new float[] { 0.0F, 0.0F, 0.05F, 0.02F};
- public static final float[] at = new float[] { 0.0F, 0.1F, 0.15F, 0.45F};
+ public static final float[] au = new float[] { 0.0F, 0.1F, 0.15F, 0.45F};
public int maxNoDamageTicks = 20;
- public float av;
public float aw;
- public float ax = 0.0F;
+ public float ax;
public float ay = 0.0F;
public float az = 0.0F;
public float aA = 0.0F;
- protected float aB;
+ public float aB = 0.0F;
protected float aC;
protected float aD;
protected float aE;
- protected boolean aF = true;
+ protected float aF;
+ protected boolean aG = true;
protected String texture = "/mob/char.png";
- protected boolean aH = true;
- protected float aI = 0.0F;
- protected String aJ = null;
- protected float aK = 1.0F;
- protected int aL = 0;
- protected float aM = 0.0F;
- public float aN = 0.1F;
- public float aO = 0.02F;
- public float aP;
+ protected boolean aI = true;
+ protected float aJ = 0.0F;
+ protected String aK = null;
+ protected float aL = 1.0F;
+ protected int aM = 0;
+ protected float aN = 0.0F;
+ public float aO = 0.1F;
+ public float aP = 0.02F;
public float aQ;
+ public float aR;
protected int health = this.getMaxHealth();
- public int aS;
- protected int aT;
- public int aU;
+ public int aT;
+ protected int aU;
+ public int aV;
public int hurtTicks;
- public int aW;
- public float aX = 0.0F;
+ public int aX;
+ public float aY = 0.0F;
public int deathTicks = 0;
public int attackTicks = 0;
- public float ba;
public float bb;
- protected boolean bc = false;
- protected int bd;
- public int be = -1;
- public float bf = (float) (Math.random() * 0.8999999761581421D + 0.10000000149011612D);
- public float bg;
+ public float bc;
+ protected boolean bd = false;
+ protected int be;
+ public int bf = -1;
+ public float bg = (float) (Math.random() * 0.8999999761581421D + 0.10000000149011612D);
public float bh;
public float bi;
+ public float bj;
public EntityHuman killer = null; // CraftBukkit - protected -> public
protected int lastDamageByPlayerTime = 0;
public EntityLiving lastDamager = null; // CraftBukkit - private -> public
private int f = 0;
private EntityLiving g = null;
- public int bl = 0;
+ public int bm = 0;
public HashMap effects = new HashMap(); // CraftBukkit - protected -> public
public boolean updateEffects = true; // CraftBukkit - private -> public
private int i;
@@ -77,35 +77,36 @@ public abstract class EntityLiving extends Entity {
protected final PathfinderGoalSelector goalSelector;
protected final PathfinderGoalSelector targetSelector;
private EntityLiving goalTarget;
- private EntitySenses bO;
- private float bP;
- private ChunkCoordinates bQ = new ChunkCoordinates(0, 0, 0);
- private float bR = -1.0F;
+ private EntitySenses bP;
+ private float bQ;
+ private ChunkCoordinates bR = new ChunkCoordinates(0, 0, 0);
+ private float bS = -1.0F;
private ItemStack[] equipment = new ItemStack[5];
public float[] dropChances = new float[5]; // CraftBukkit - protected -> public
- private ItemStack[] bT = new ItemStack[5];
- public boolean bq = false;
- public int br = 0;
+ private ItemStack[] bU = new ItemStack[5];
+ public boolean br = false;
+ public int bs = 0;
public boolean canPickUpLoot = false; // CraftBukkit - protected -> public
public boolean persistent = !this.isTypeNotPersistent(); // CraftBukkit - private -> public, change value
- protected int bt;
- protected double bu;
+ protected final CombatTracker bt = new CombatTracker(this);
+ protected int bu;
protected double bv;
protected double bw;
protected double bx;
protected double by;
- float bz = 0.0F;
+ protected double bz;
+ float bA = 0.0F;
public int lastDamage = 0; // CraftBukkit - protected -> public
- protected int bB = 0;
- protected float bC;
+ protected int bC = 0;
protected float bD;
protected float bE;
- protected boolean bF = false;
- protected float bG = 0.0F;
- protected float bH = 0.7F;
- private int bV = 0;
- private Entity bW;
- protected int bI = 0;
+ protected float bF;
+ protected boolean bG = false;
+ protected float bH = 0.0F;
+ protected float bI = 0.7F;
+ private int bX = 0;
+ private Entity bY;
+ protected int bJ = 0;
// CraftBukkit start
public int expToDrop = 0;
public int maxAirTicks = 300;
@@ -121,19 +122,23 @@ public abstract class EntityLiving extends Entity {
this.moveController = new ControllerMove(this);
this.jumpController = new ControllerJump(this);
this.senses = new EntityAIBodyControl(this);
- this.navigation = new Navigation(this, world, 16.0F);
- this.bO = new EntitySenses(this);
- this.aw = (float) (Math.random() + 1.0D) * 0.01F;
+ this.navigation = new Navigation(this, world, (float) this.ay());
+ this.bP = new EntitySenses(this);
+ this.ax = (float) (Math.random() + 1.0D) * 0.01F;
this.setPosition(this.locX, this.locY, this.locZ);
- this.av = (float) Math.random() * 12398.0F;
+ this.aw = (float) Math.random() * 12398.0F;
this.yaw = (float) (Math.random() * 3.1415927410125732D * 2.0D);
- this.az = this.yaw;
+ this.aA = this.yaw;
for (int i = 0; i < this.dropChances.length; ++i) {
- this.dropChances[i] = 0.05F;
+ this.dropChances[i] = 0.085F;
}
- this.X = 0.5F;
+ this.Y = 0.5F;
+ }
+
+ protected int ay() {
+ return 16;
}
public ControllerLook getControllerLook() {
@@ -152,19 +157,19 @@ public abstract class EntityLiving extends Entity {
return this.navigation;
}
- public EntitySenses aA() {
- return this.bO;
+ public EntitySenses aD() {
+ return this.bP;
}
- public Random aB() {
+ public Random aE() {
return this.random;
}
- public EntityLiving aC() {
+ public EntityLiving aF() {
return this.lastDamager;
}
- public EntityLiving aD() {
+ public EntityLiving aG() {
return this.g;
}
@@ -174,20 +179,20 @@ public abstract class EntityLiving extends Entity {
}
}
- public int aE() {
- return this.bB;
+ public int aH() {
+ return this.bC;
}
- public float ap() {
- return this.az;
+ public float ao() {
+ return this.aA;
}
- public float aF() {
- return this.bP;
+ public float aI() {
+ return this.bQ;
}
public void e(float f) {
- this.bP = f;
+ this.bQ = f;
this.f(f);
}
@@ -208,11 +213,11 @@ public abstract class EntityLiving extends Entity {
return EntityCreeper.class != oclass && EntityGhast.class != oclass;
}
- public void aH() {}
+ public void aK() {}
protected void a(double d0, boolean flag) {
- if (!this.H()) {
- this.I();
+ if (!this.G()) {
+ this.H();
}
if (flag && this.fallDistance > 0.0F) {
@@ -237,55 +242,57 @@ public abstract class EntityLiving extends Entity {
super.a(d0, flag);
}
- public boolean aI() {
- return this.e(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
+ public boolean aL() {
+ return this.d(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
}
- public boolean e(int i, int j, int k) {
- return this.bR == -1.0F ? true : this.bQ.e(i, j, k) < this.bR * this.bR;
+ public boolean d(int i, int j, int k) {
+ return this.bS == -1.0F ? true : this.bR.e(i, j, k) < this.bS * this.bS;
}
public void b(int i, int j, int k, int l) {
- this.bQ.b(i, j, k);
- this.bR = (float) l;
+ this.bR.b(i, j, k);
+ this.bS = (float) l;
}
- public ChunkCoordinates aJ() {
- return this.bQ;
+ public ChunkCoordinates aM() {
+ return this.bR;
}
- public float aK() {
- return this.bR;
+ public float aN() {
+ return this.bS;
}
- public void aL() {
- this.bR = -1.0F;
+ public void aO() {
+ this.bS = -1.0F;
}
- public boolean aM() {
- return this.bR != -1.0F;
+ public boolean aP() {
+ return this.bS != -1.0F;
}
public void c(EntityLiving entityliving) {
this.lastDamager = entityliving;
- this.f = this.lastDamager != null ? 60 : 0;
+ this.f = this.lastDamager != null ? 100 : 0;
}
protected void a() {
this.datawatcher.a(8, Integer.valueOf(this.i));
this.datawatcher.a(9, Byte.valueOf((byte) 0));
this.datawatcher.a(10, Byte.valueOf((byte) 0));
+ this.datawatcher.a(6, Byte.valueOf((byte) 0));
+ this.datawatcher.a(5, "");
}
public boolean n(Entity entity) {
return this.world.a(this.world.getVec3DPool().create(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ), this.world.getVec3DPool().create(entity.locX, entity.locY + (double) entity.getHeadHeight(), entity.locZ)) == null;
}
- public boolean L() {
+ public boolean K() {
return !this.dead;
}
- public boolean M() {
+ public boolean L() {
return !this.dead;
}
@@ -293,25 +300,25 @@ public abstract class EntityLiving extends Entity {
return this.length * 0.85F;
}
- public int aN() {
+ public int aQ() {
return 80;
}
- public void aO() {
- String s = this.aY();
+ public void aR() {
+ String s = this.bb();
if (s != null) {
- this.makeSound(s, this.aX(), this.aV());
+ this.makeSound(s, this.ba(), this.aY());
}
}
- public void y() {
- this.aP = this.aQ;
- super.y();
+ public void x() {
+ this.aQ = this.aR;
+ super.x();
this.world.methodProfiler.a("mobBaseTick");
- if (this.isAlive() && this.random.nextInt(1000) < this.aU++) {
- this.aU = -this.aN();
- this.aO();
+ if (this.isAlive() && this.random.nextInt(1000) < this.aV++) {
+ this.aV = -this.aQ();
+ this.aR();
}
// CraftBukkit start
@@ -323,8 +330,8 @@ public abstract class EntityLiving extends Entity {
event.getEntity().setLastDamageCause(event);
this.damageEntity(DamageSource.STUCK, event.getDamage());
}
- // CraftBukkit end
}
+ // CraftBukkit end
if (this.isFireproof() || this.world.isStatic) {
this.extinguish();
@@ -332,8 +339,8 @@ public abstract class EntityLiving extends Entity {
boolean flag = this instanceof EntityHuman && ((EntityHuman) this).abilities.isInvulnerable;
- if (this.isAlive() && this.a(Material.WATER) && !this.bc() && !this.effects.containsKey(Integer.valueOf(MobEffectList.WATER_BREATHING.id)) && !flag) {
- this.setAirTicks(this.g(this.getAirTicks()));
+ if (this.isAlive() && this.a(Material.WATER) && !this.bf() && !this.effects.containsKey(Integer.valueOf(MobEffectList.WATER_BREATHING.id)) && !flag) {
+ this.setAirTicks(this.h(this.getAirTicks()));
if (this.getAirTicks() == -20) {
this.setAirTicks(0);
@@ -365,7 +372,7 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit end
}
- this.ba = this.bb;
+ this.bb = this.bc;
if (this.attackTicks > 0) {
--this.attackTicks;
}
@@ -379,7 +386,7 @@ public abstract class EntityLiving extends Entity {
}
if (this.health <= 0) {
- this.aP();
+ this.aS();
}
if (this.lastDamageByPlayerTime > 0) {
@@ -402,10 +409,10 @@ public abstract class EntityLiving extends Entity {
}
}
- this.bx();
- this.aE = this.aD;
- this.ay = this.ax;
- this.aA = this.az;
+ this.bA();
+ this.aF = this.aE;
+ this.az = this.ay;
+ this.aB = this.aA;
this.lastYaw = this.yaw;
this.lastPitch = this.pitch;
this.world.methodProfiler.b();
@@ -414,7 +421,7 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit start
public int getExpReward() {
int exp = this.getExpValue(this.killer);
-
+
if (!this.world.isStatic && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && !this.isBaby()) {
return exp;
} else {
@@ -431,7 +438,7 @@ public abstract class EntityLiving extends Entity {
}
// CraftBukkit end
- protected void aP() {
+ protected void aS() {
++this.deathTicks;
if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
int i;
@@ -459,15 +466,15 @@ public abstract class EntityLiving extends Entity {
}
}
- protected int g(int i) {
+ protected int h(int i) {
int j = EnchantmentManager.getOxygenEnchantmentLevel(this);
return j > 0 && this.random.nextInt(j + 1) > 0 ? i : i - 1;
}
protected int getExpValue(EntityHuman entityhuman) {
- if (this.bd > 0) {
- int i = this.bd;
+ if (this.be > 0) {
+ int i = this.be;
ItemStack[] aitemstack = this.getEquipment();
for (int j = 0; j < aitemstack.length; ++j) {
@@ -478,7 +485,7 @@ public abstract class EntityLiving extends Entity {
return i;
} else {
- return this.bd;
+ return this.be;
}
}
@@ -486,7 +493,7 @@ public abstract class EntityLiving extends Entity {
return false;
}
- public void aR() {
+ public void aU() {
for (int i = 0; i < 20; ++i) {
double d0 = this.random.nextGaussian() * 0.02D;
double d1 = this.random.nextGaussian() * 0.02D;
@@ -497,35 +504,35 @@ public abstract class EntityLiving extends Entity {
}
}
- public void U() {
- super.U();
- this.aB = this.aC;
- this.aC = 0.0F;
+ public void T() {
+ super.T();
+ this.aC = this.aD;
+ this.aD = 0.0F;
this.fallDistance = 0.0F;
}
- public void j_() {
- super.j_();
+ public void l_() {
+ super.l_();
if (!this.world.isStatic) {
int i;
for (i = 0; i < 5; ++i) {
ItemStack itemstack = this.getEquipment(i);
- if (!ItemStack.matches(itemstack, this.bT[i])) {
+ if (!ItemStack.matches(itemstack, this.bU[i])) {
((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet5EntityEquipment(this.id, i, itemstack)));
- this.bT[i] = itemstack == null ? null : itemstack.cloneItemStack();
+ this.bU[i] = itemstack == null ? null : itemstack.cloneItemStack();
}
}
- i = this.bJ();
+ i = this.bM();
if (i > 0) {
- if (this.bl <= 0) {
- this.bl = 20 * (30 - i);
+ if (this.bm <= 0) {
+ this.bm = 20 * (30 - i);
}
- --this.bl;
- if (this.bl <= 0) {
+ --this.bm;
+ if (this.bm <= 0) {
this.r(i - 1);
}
}
@@ -535,10 +542,10 @@ public abstract class EntityLiving extends Entity {
double d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
float f = (float) (d0 * d0 + d1 * d1);
- float f1 = this.ax;
+ float f1 = this.ay;
float f2 = 0.0F;
- this.aB = this.aC;
+ this.aC = this.aD;
float f3 = 0.0F;
if (f > 0.0025000002F) {
@@ -548,7 +555,7 @@ public abstract class EntityLiving extends Entity {
f1 = (float) org.bukkit.craftbukkit.TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F;
}
- if (this.aQ > 0.0F) {
+ if (this.aR > 0.0F) {
f1 = this.yaw;
}
@@ -556,15 +563,15 @@ public abstract class EntityLiving extends Entity {
f3 = 0.0F;
}
- this.aC += (f3 - this.aC) * 0.3F;
+ this.aD += (f3 - this.aD) * 0.3F;
this.world.methodProfiler.a("headTurn");
- if (this.be()) {
+ if (this.bh()) {
this.senses.a();
} else {
- float f4 = MathHelper.g(f1 - this.ax);
+ float f4 = MathHelper.g(f1 - this.ay);
- this.ax += f4 * 0.3F;
- float f5 = MathHelper.g(this.yaw - this.ax);
+ this.ay += f4 * 0.3F;
+ float f5 = MathHelper.g(this.yaw - this.ay);
boolean flag = f5 < -90.0F || f5 >= 90.0F;
if (f5 < -75.0F) {
@@ -575,9 +582,9 @@ public abstract class EntityLiving extends Entity {
f5 = 75.0F;
}
- this.ax = this.yaw - f5;
+ this.ay = this.yaw - f5;
if (f5 * f5 > 2500.0F) {
- this.ax += f5 * 0.2F;
+ this.ay += f5 * 0.2F;
}
if (flag) {
@@ -596,12 +603,12 @@ public abstract class EntityLiving extends Entity {
this.lastYaw += 360.0F;
}
- while (this.ax - this.ay < -180.0F) {
- this.ay -= 360.0F;
+ while (this.ay - this.az < -180.0F) {
+ this.az -= 360.0F;
}
- while (this.ax - this.ay >= 180.0F) {
- this.ay += 360.0F;
+ while (this.ay - this.az >= 180.0F) {
+ this.az += 360.0F;
}
while (this.pitch - this.lastPitch < -180.0F) {
@@ -612,16 +619,16 @@ public abstract class EntityLiving extends Entity {
this.lastPitch += 360.0F;
}
- while (this.az - this.aA < -180.0F) {
- this.aA -= 360.0F;
+ while (this.aA - this.aB < -180.0F) {
+ this.aB -= 360.0F;
}
- while (this.az - this.aA >= 180.0F) {
- this.aA += 360.0F;
+ while (this.aA - this.aB >= 180.0F) {
+ this.aB += 360.0F;
}
this.world.methodProfiler.b();
- this.aD += f2;
+ this.aE += f2;
}
// CraftBukkit start - delegate so we can handle providing a reason for health being regained
@@ -667,10 +674,10 @@ public abstract class EntityLiving extends Entity {
} else if (this.world.isStatic) {
return false;
} else {
- this.bB = 0;
+ this.bC = 0;
if (this.health <= 0) {
return false;
- } else if (damagesource.k() && this.hasEffect(MobEffectList.FIRE_RESISTANCE)) {
+ } else if (damagesource.m() && this.hasEffect(MobEffectList.FIRE_RESISTANCE)) {
return false;
} else {
if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && this.getEquipment(4) != null) {
@@ -678,7 +685,7 @@ public abstract class EntityLiving extends Entity {
i = (int) ((float) i * 0.75F);
}
- this.bh = 1.5F;
+ this.bi = 1.5F;
boolean flag = true;
// CraftBukkit start
@@ -701,13 +708,13 @@ public abstract class EntityLiving extends Entity {
flag = false;
} else {
this.lastDamage = i;
- this.aS = this.health;
+ this.aT = this.health;
this.noDamageTicks = this.maxNoDamageTicks;
this.d(damagesource, i);
- this.hurtTicks = this.aW = 10;
+ this.hurtTicks = this.aX = 10;
}
- this.aX = 0.0F;
+ this.aY = 0.0F;
Entity entity = damagesource.getEntity();
if (entity != null) {
@@ -716,13 +723,13 @@ public abstract class EntityLiving extends Entity {
}
if (entity instanceof EntityHuman) {
- this.lastDamageByPlayerTime = 60;
+ this.lastDamageByPlayerTime = 100;
this.killer = (EntityHuman) entity;
} else if (entity instanceof EntityWolf) {
EntityWolf entitywolf = (EntityWolf) entity;
if (entitywolf.isTamed()) {
- this.lastDamageByPlayerTime = 60;
+ this.lastDamageByPlayerTime = 100;
this.killer = null;
}
}
@@ -730,8 +737,8 @@ public abstract class EntityLiving extends Entity {
if (flag) {
this.world.broadcastEntityEffect(this, (byte) 2);
- if (damagesource != DamageSource.DROWN && damagesource != DamageSource.EXPLOSION2) {
- this.K();
+ if (damagesource != DamageSource.DROWN) {
+ this.J();
}
if (entity != null) {
@@ -743,21 +750,21 @@ public abstract class EntityLiving extends Entity {
d0 = (Math.random() - Math.random()) * 0.01D;
}
- this.aX = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw;
+ this.aY = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw;
this.a(entity, i, d0, d1);
} else {
- this.aX = (float) ((int) (Math.random() * 2.0D) * 180);
+ this.aY = (float) ((int) (Math.random() * 2.0D) * 180);
}
}
if (this.health <= 0) {
if (flag) {
- this.makeSound(this.ba(), this.aX(), this.aV());
+ this.makeSound(this.bd(), this.ba(), this.aY());
}
this.die(damagesource);
} else if (flag) {
- this.makeSound(this.aZ(), this.aX(), this.aV());
+ this.makeSound(this.bc(), this.ba(), this.aY());
}
return true;
@@ -765,11 +772,11 @@ public abstract class EntityLiving extends Entity {
}
}
- protected float aV() {
+ protected float aY() {
return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F;
}
- public int aW() {
+ public int aZ() {
int i = 0;
ItemStack[] aitemstack = this.getEquipment();
int j = aitemstack.length;
@@ -778,7 +785,7 @@ public abstract class EntityLiving extends Entity {
ItemStack itemstack = aitemstack[k];
if (itemstack != null && itemstack.getItem() instanceof ItemArmor) {
- int l = ((ItemArmor) itemstack.getItem()).b;
+ int l = ((ItemArmor) itemstack.getItem()).c;
i += l;
}
@@ -791,56 +798,78 @@ public abstract class EntityLiving extends Entity {
protected int b(DamageSource damagesource, int i) {
if (!damagesource.ignoresArmor()) {
- int j = 25 - this.aW();
- int k = i * j + this.aT;
+ int j = 25 - this.aZ();
+ int k = i * j + this.aU;
this.k(i);
i = k / 25;
- this.aT = k % 25;
+ this.aU = k % 25;
}
return i;
}
protected int c(DamageSource damagesource, int i) {
- if (this.hasEffect(MobEffectList.RESISTANCE)) {
- int j = (this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5;
- int k = 25 - j;
- int l = i * k + this.aT;
+ int j;
+ int k;
+ int l;
+ if (this.hasEffect(MobEffectList.RESISTANCE)) {
+ j = (this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5;
+ k = 25 - j;
+ l = i * k + this.aU;
i = l / 25;
- this.aT = l % 25;
+ this.aU = l % 25;
}
- return i;
+ if (i <= 0) {
+ return 0;
+ } else {
+ j = EnchantmentManager.a(this.getEquipment(), damagesource);
+ if (j > 20) {
+ j = 20;
+ }
+
+ if (j > 0 && j <= 20) {
+ k = 25 - j;
+ l = i * k + this.aU;
+ i = l / 25;
+ this.aU = l % 25;
+ }
+
+ return i;
+ }
}
protected void d(DamageSource damagesource, int i) {
if (!this.isInvulnerable()) {
i = this.b(damagesource, i);
i = this.c(damagesource, i);
+ int j = this.getHealth();
+
this.health -= i;
+ this.bt.a(damagesource, j, i);
}
}
- protected float aX() {
+ protected float ba() {
return 1.0F;
}
- protected String aY() {
+ protected String bb() {
return null;
}
- protected String aZ() {
+ protected String bc() {
return "damage.hit";
}
- protected String ba() {
+ protected String bd() {
return "damage.hit";
}
public void a(Entity entity, int i, double d0, double d1) {
- this.am = true;
+ this.an = true;
float f = MathHelper.sqrt(d0 * d0 + d1 * d1);
float f1 = 0.4F;
@@ -857,16 +886,17 @@ public abstract class EntityLiving extends Entity {
public void die(DamageSource damagesource) {
Entity entity = damagesource.getEntity();
+ EntityLiving entityliving = this.bN();
- if (this.aL >= 0 && entity != null) {
- entity.c(this, this.aL);
+ if (this.aM >= 0 && entityliving != null) {
+ entityliving.c(this, this.aM);
}
if (entity != null) {
entity.a(this);
}
- this.bc = true;
+ this.bd = true;
if (!this.world.isStatic) {
int i = 0;
@@ -971,9 +1001,9 @@ public abstract class EntityLiving extends Entity {
public void e(float f, float f1) {
double d0;
- if (this.H() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) {
+ if (this.G() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) {
d0 = this.locY;
- this.a(f, f1, this.be() ? 0.04F : 0.02F);
+ this.a(f, f1, this.bh() ? 0.04F : 0.02F);
this.move(this.motX, this.motY, this.motZ);
this.motX *= 0.800000011920929D;
this.motY *= 0.800000011920929D;
@@ -982,7 +1012,7 @@ public abstract class EntityLiving extends Entity {
if (this.positionChanged && this.c(this.motX, this.motY + 0.6000000238418579D - this.locY + d0, this.motZ)) {
this.motY = 0.30000001192092896D;
}
- } else if (this.J() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) {
+ } else if (this.I() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) {
d0 = this.locY;
this.a(f, f1, 0.02F);
this.move(this.motX, this.motY, this.motZ);
@@ -1009,15 +1039,15 @@ public abstract class EntityLiving extends Entity {
float f4;
if (this.onGround) {
- if (this.be()) {
- f4 = this.aF();
+ if (this.bh()) {
+ f4 = this.aI();
} else {
- f4 = this.aN;
+ f4 = this.aO;
}
f4 *= f3;
} else {
- f4 = this.aO;
+ f4 = this.aP;
}
this.a(f, f1, f4);
@@ -1082,7 +1112,7 @@ public abstract class EntityLiving extends Entity {
this.motZ *= (double) f2;
}
- this.bg = this.bh;
+ this.bh = this.bi;
d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
float f6 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F;
@@ -1091,8 +1121,8 @@ public abstract class EntityLiving extends Entity {
f6 = 1.0F;
}
- this.bh += (f6 - this.bh) * 0.4F;
- this.bi += this.bh;
+ this.bi += (f6 - this.bi) * 0.4F;
+ this.bj += this.bi;
}
public boolean g_() {
@@ -1113,7 +1143,7 @@ public abstract class EntityLiving extends Entity {
nbttagcompound.setShort("HurtTime", (short) this.hurtTicks);
nbttagcompound.setShort("DeathTime", (short) this.deathTicks);
nbttagcompound.setShort("AttackTime", (short) this.attackTicks);
- nbttagcompound.setBoolean("CanPickUpLoot", this.canPickUpLoot);
+ nbttagcompound.setBoolean("CanPickUpLoot", this.bS());
nbttagcompound.setBoolean("PersistenceRequired", this.persistent);
NBTTagList nbttaglist = new NBTTagList();
@@ -1150,6 +1180,8 @@ public abstract class EntityLiving extends Entity {
}
nbttagcompound.set("DropChances", nbttaglist1);
+ nbttagcompound.setString("CustomName", this.getCustomName());
+ nbttagcompound.setBoolean("CustomNameVisible", this.getCustomNameVisible());
nbttagcompound.setInt("Bukkit.MaxHealth", this.maxHealth); // CraftBukkit
}
@@ -1161,8 +1193,7 @@ public abstract class EntityLiving extends Entity {
}
if (!nbttagcompound.hasKey("Health")) {
- this.health = this.maxHealth; // this.getMaxHealth() -> this.maxHealth
- // CraftBukkit
+ this.health = this.maxHealth; // CraftBukkit - this.getMaxHealth() -> this.maxHealth
}
this.hurtTicks = nbttagcompound.getShort("HurtTime");
@@ -1180,6 +1211,11 @@ public abstract class EntityLiving extends Entity {
}
// CraftBukkit end
+ if (nbttagcompound.hasKey("CustomName") && nbttagcompound.getString("CustomName").length() > 0) {
+ this.setCustomName(nbttagcompound.getString("CustomName"));
+ }
+
+ this.setCustomNameVisible(nbttagcompound.getBoolean("CustomNameVisible"));
NBTTagList nbttaglist;
int i;
@@ -1215,35 +1251,35 @@ public abstract class EntityLiving extends Entity {
return !this.dead && this.health > 0;
}
- public boolean bc() {
+ public boolean bf() {
return false;
}
public void f(float f) {
- this.bD = f;
+ this.bE = f;
}
- public void e(boolean flag) {
- this.bF = flag;
+ public void f(boolean flag) {
+ this.bG = flag;
}
public void c() {
- if (this.bV > 0) {
- --this.bV;
+ if (this.bX > 0) {
+ --this.bX;
}
- if (this.bt > 0) {
- double d0 = this.locX + (this.bu - this.locX) / (double) this.bt;
- double d1 = this.locY + (this.bv - this.locY) / (double) this.bt;
- double d2 = this.locZ + (this.bw - this.locZ) / (double) this.bt;
- double d3 = MathHelper.g(this.bx - (double) this.yaw);
+ if (this.bu > 0) {
+ double d0 = this.locX + (this.bv - this.locX) / (double) this.bu;
+ double d1 = this.locY + (this.bw - this.locY) / (double) this.bu;
+ double d2 = this.locZ + (this.bx - this.locZ) / (double) this.bu;
+ double d3 = MathHelper.g(this.by - (double) this.yaw);
- this.yaw = (float) ((double) this.yaw + d3 / (double) this.bt);
- this.pitch = (float) ((double) this.pitch + (this.by - (double) this.pitch) / (double) this.bt);
- --this.bt;
+ this.yaw = (float) ((double) this.yaw + d3 / (double) this.bu);
+ this.pitch = (float) ((double) this.pitch + (this.bz - (double) this.pitch) / (double) this.bu);
+ --this.bu;
this.setPosition(d0, d1, d2);
this.b(this.yaw, this.pitch);
- } else if (!this.bf()) {
+ } else if (!this.bi()) {
this.motX *= 0.98D;
this.motY *= 0.98D;
this.motZ *= 0.98D;
@@ -1262,59 +1298,59 @@ public abstract class EntityLiving extends Entity {
}
this.world.methodProfiler.a("ai");
- if (this.bg()) {
- this.bF = false;
- this.bC = 0.0F;
+ if (this.bj()) {
+ this.bG = false;
this.bD = 0.0F;
this.bE = 0.0F;
- } else if (this.bf()) {
- if (this.be()) {
+ this.bF = 0.0F;
+ } else if (this.bi()) {
+ if (this.bh()) {
this.world.methodProfiler.a("newAi");
- this.bl();
+ this.bo();
this.world.methodProfiler.b();
} else {
this.world.methodProfiler.a("oldAi");
- this.bn();
+ this.bq();
this.world.methodProfiler.b();
- this.az = this.yaw;
+ this.aA = this.yaw;
}
}
this.world.methodProfiler.b();
this.world.methodProfiler.a("jump");
- if (this.bF) {
- if (!this.H() && !this.J()) {
- if (this.onGround && this.bV == 0) {
- this.bi();
- this.bV = 10;
+ if (this.bG) {
+ if (!this.G() && !this.I()) {
+ if (this.onGround && this.bX == 0) {
+ this.bl();
+ this.bX = 10;
}
} else {
this.motY += 0.03999999910593033D;
}
} else {
- this.bV = 0;
+ this.bX = 0;
}
this.world.methodProfiler.b();
this.world.methodProfiler.a("travel");
- this.bC *= 0.98F;
this.bD *= 0.98F;
- this.bE *= 0.9F;
- float f = this.aN;
+ this.bE *= 0.98F;
+ this.bF *= 0.9F;
+ float f = this.aO;
- this.aN *= this.bB();
- this.e(this.bC, this.bD);
- this.aN = f;
+ this.aO *= this.bE();
+ this.e(this.bD, this.bE);
+ this.aO = f;
this.world.methodProfiler.b();
this.world.methodProfiler.a("push");
if (!this.world.isStatic) {
- this.bd();
+ this.bg();
}
this.world.methodProfiler.b();
this.world.methodProfiler.a("looting");
// CraftBukkit - Don't run mob pickup code on players
- if (!this.world.isStatic && !(this instanceof EntityPlayer) && this.canPickUpLoot && !this.bc && this.world.getGameRules().getBoolean("mobGriefing")) {
+ if (!this.world.isStatic && !(this instanceof EntityPlayer) && this.bS() && !this.bd && this.world.getGameRules().getBoolean("mobGriefing")) {
List list = this.world.a(EntityItem.class, this.boundingBox.grow(1.0D, 0.0D, 1.0D));
Iterator iterator = list.iterator();
@@ -1351,10 +1387,10 @@ public abstract class EntityLiving extends Entity {
ItemArmor itemarmor = (ItemArmor) itemstack.getItem();
ItemArmor itemarmor1 = (ItemArmor) itemstack1.getItem();
- if (itemarmor.b == itemarmor1.b) {
+ if (itemarmor.c == itemarmor1.c) {
flag = itemstack.getData() > itemstack1.getData() || itemstack.hasTag() && !itemstack1.hasTag();
} else {
- flag = itemarmor.b > itemarmor1.b;
+ flag = itemarmor.c > itemarmor1.c;
}
} else {
flag = false;
@@ -1380,14 +1416,14 @@ public abstract class EntityLiving extends Entity {
this.world.methodProfiler.b();
}
- protected void bd() {
+ protected void bg() {
List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
if (list != null && !list.isEmpty()) {
for (int i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
- if (entity.M()) {
+ if (entity.L()) {
this.o(entity);
}
}
@@ -1398,23 +1434,23 @@ public abstract class EntityLiving extends Entity {
entity.collide(this);
}
- protected boolean be() {
+ protected boolean bh() {
return false;
}
- protected boolean bf() {
+ protected boolean bi() {
return !this.world.isStatic;
}
- protected boolean bg() {
+ protected boolean bj() {
return this.health <= 0;
}
- public boolean bh() {
+ public boolean bk() {
return false;
}
- protected void bi() {
+ protected void bl() {
this.motY = 0.41999998688697815D;
if (this.hasEffect(MobEffectList.JUMP)) {
this.motY += (double) ((float) (this.getEffect(MobEffectList.JUMP).getAmplifier() + 1) * 0.1F);
@@ -1427,14 +1463,14 @@ public abstract class EntityLiving extends Entity {
this.motZ += (double) (MathHelper.cos(f) * 0.2F);
}
- this.am = true;
+ this.an = true;
}
protected boolean isTypeNotPersistent() {
return true;
}
- protected void bk() {
+ protected void bn() {
if (!this.persistent) {
EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
@@ -1444,30 +1480,30 @@ public abstract class EntityLiving extends Entity {
double d2 = entityhuman.locZ - this.locZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
- if (d3 > 16384.0D) { // CraftBukkit - remove this.bj() check
+ if (d3 > 16384.0D) { // CraftBukkit - remove isTypeNotPersistent() check
this.die();
}
- if (this.bB > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove this.bj() check
+ if (this.bC > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check
this.die();
} else if (d3 < 1024.0D) {
- this.bB = 0;
+ this.bC = 0;
}
}
// CraftBukkit start
} else {
- this.bB = 0;
+ this.bC = 0;
}
// CraftBukkit end
}
- protected void bl() {
- ++this.bB;
+ protected void bo() {
+ ++this.bC;
this.world.methodProfiler.a("checkDespawn");
- this.bk();
+ this.bn();
this.world.methodProfiler.b();
this.world.methodProfiler.a("sensing");
- this.bO.a();
+ this.bP.a();
this.world.methodProfiler.b();
this.world.methodProfiler.a("targetSelector");
this.targetSelector.a();
@@ -1479,7 +1515,7 @@ public abstract class EntityLiving extends Entity {
this.navigation.e();
this.world.methodProfiler.b();
this.world.methodProfiler.a("mob tick");
- this.bm();
+ this.bp();
this.world.methodProfiler.b();
this.world.methodProfiler.a("controls");
this.world.methodProfiler.a("move");
@@ -1492,65 +1528,65 @@ public abstract class EntityLiving extends Entity {
this.world.methodProfiler.b();
}
- protected void bm() {}
+ protected void bp() {}
- protected void bn() {
- ++this.bB;
- this.bk();
- this.bC = 0.0F;
+ protected void bq() {
+ ++this.bC;
+ this.bn();
this.bD = 0.0F;
+ this.bE = 0.0F;
float f = 8.0F;
if (this.random.nextFloat() < 0.02F) {
EntityHuman entityhuman = this.world.findNearbyPlayer(this, (double) f);
if (entityhuman != null) {
- this.bW = entityhuman;
- this.bI = 10 + this.random.nextInt(20);
+ this.bY = entityhuman;
+ this.bJ = 10 + this.random.nextInt(20);
} else {
- this.bE = (this.random.nextFloat() - 0.5F) * 20.0F;
+ this.bF = (this.random.nextFloat() - 0.5F) * 20.0F;
}
}
- if (this.bW != null) {
- this.a(this.bW, 10.0F, (float) this.bp());
- if (this.bI-- <= 0 || this.bW.dead || this.bW.e((Entity) this) > (double) (f * f)) {
- this.bW = null;
+ if (this.bY != null) {
+ this.a(this.bY, 10.0F, (float) this.bs());
+ if (this.bJ-- <= 0 || this.bY.dead || this.bY.e((Entity) this) > (double) (f * f)) {
+ this.bY = null;
}
} else {
if (this.random.nextFloat() < 0.05F) {
- this.bE = (this.random.nextFloat() - 0.5F) * 20.0F;
+ this.bF = (this.random.nextFloat() - 0.5F) * 20.0F;
}
- this.yaw += this.bE;
- this.pitch = this.bG;
+ this.yaw += this.bF;
+ this.pitch = this.bH;
}
- boolean flag = this.H();
- boolean flag1 = this.J();
+ boolean flag = this.G();
+ boolean flag1 = this.I();
if (flag || flag1) {
- this.bF = this.random.nextFloat() < 0.8F;
+ this.bG = this.random.nextFloat() < 0.8F;
}
}
- protected void bo() {
+ protected void br() {
int i = this.h();
- if (this.bq) {
- ++this.br;
- if (this.br >= i) {
- this.br = 0;
- this.bq = false;
+ if (this.br) {
+ ++this.bs;
+ if (this.bs >= i) {
+ this.bs = 0;
+ this.br = false;
}
} else {
- this.br = 0;
+ this.bs = 0;
}
- this.aQ = (float) this.br / (float) i;
+ this.aR = (float) this.bs / (float) i;
}
- public int bp() {
+ public int bs() {
return 40;
}
@@ -1562,7 +1598,7 @@ public abstract class EntityLiving extends Entity {
if (entity instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) entity;
- d2 = this.locY + (double) this.getHeadHeight() - (entityliving.locY + (double) entityliving.getHeadHeight());
+ d2 = entityliving.locY + (double) entityliving.getHeadHeight() - (this.locY + (double) this.getHeadHeight());
} else {
d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.getHeadHeight());
}
@@ -1571,7 +1607,7 @@ public abstract class EntityLiving extends Entity {
float f2 = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
float f3 = (float) (-(Math.atan2(d2, d3) * 180.0D / 3.1415927410125732D));
- this.pitch = -this.b(this.pitch, f3, f1);
+ this.pitch = this.b(this.pitch, f3, f1);
this.yaw = this.b(this.yaw, f2, f);
}
@@ -1593,7 +1629,7 @@ public abstract class EntityLiving extends Entity {
return this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
}
- protected void C() {
+ protected void B() {
// CraftBukkit start
EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(null, this.getBukkitEntity(), EntityDamageEvent.DamageCause.VOID, 4);
this.world.getServer().getPluginManager().callEvent(event);
@@ -1607,7 +1643,7 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit end
}
- public Vec3D Z() {
+ public Vec3D Y() {
return this.i(1.0F);
}
@@ -1635,7 +1671,7 @@ public abstract class EntityLiving extends Entity {
}
}
- public int bv() {
+ public int by() {
return 4;
}
@@ -1643,7 +1679,7 @@ public abstract class EntityLiving extends Entity {
return false;
}
- protected void bx() {
+ protected void bA() {
Iterator iterator = this.effects.keySet().iterator();
while (iterator.hasNext()) {
@@ -1705,7 +1741,7 @@ public abstract class EntityLiving extends Entity {
}
}
- public void by() {
+ public void bB() {
Iterator iterator = this.effects.keySet().iterator();
while (iterator.hasNext()) {
@@ -1759,7 +1795,7 @@ public abstract class EntityLiving extends Entity {
return true;
}
- public boolean bA() {
+ public boolean bD() {
return this.getMonsterType() == EnumMonsterType.UNDEAD;
}
@@ -1783,7 +1819,7 @@ public abstract class EntityLiving extends Entity {
this.updateEffects = true;
}
- public float bB() {
+ public float bE() {
float f = 1.0F;
if (this.hasEffect(MobEffectList.FASTER_MOVEMENT)) {
@@ -1794,6 +1830,10 @@ public abstract class EntityLiving extends Entity {
f *= 1.0F - 0.15F * (float) (this.getEffect(MobEffectList.SLOWER_MOVEMENT).getAmplifier() + 1);
}
+ if (f < 0.0F) {
+ f = 0.0F;
+ }
+
return f;
}
@@ -1826,7 +1866,7 @@ public abstract class EntityLiving extends Entity {
}
}
- public int as() {
+ public int ar() {
if (this.getGoalTarget() == null) {
return 3;
} else {
@@ -1841,7 +1881,7 @@ public abstract class EntityLiving extends Entity {
}
}
- public ItemStack bD() {
+ public ItemStack bG() {
return this.equipment[0];
}
@@ -1867,9 +1907,9 @@ public abstract class EntityLiving extends Entity {
boolean flag1 = this.dropChances[j] > 1.0F;
if (itemstack != null && (flag || flag1) && this.random.nextFloat() - (float) i * 0.01F < this.dropChances[j]) {
- if (!flag1 && itemstack.f()) {
- int k = Math.max(itemstack.k() - 25, 1);
- int l = itemstack.k() - this.random.nextInt(this.random.nextInt(k) + 1);
+ if (!flag1 && itemstack.g()) {
+ int k = Math.max(itemstack.l() - 25, 1);
+ int l = itemstack.l() - this.random.nextInt(this.random.nextInt(k) + 1);
if (l > k) {
l = k;
@@ -1887,20 +1927,20 @@ public abstract class EntityLiving extends Entity {
}
}
- protected void bE() {
+ protected void bH() {
if (this.random.nextFloat() < d[this.world.difficulty]) {
int i = this.random.nextInt(2);
float f = this.world.difficulty == 3 ? 0.1F : 0.25F;
- if (this.random.nextFloat() < 0.1F) {
+ if (this.random.nextFloat() < 0.095F) {
++i;
}
- if (this.random.nextFloat() < 0.1F) {
+ if (this.random.nextFloat() < 0.095F) {
++i;
}
- if (this.random.nextFloat() < 0.1F) {
+ if (this.random.nextFloat() < 0.095F) {
++i;
}
@@ -1943,7 +1983,7 @@ public abstract class EntityLiving extends Entity {
public static int b(ItemStack itemstack) {
if (itemstack.id != Block.PUMPKIN.id && itemstack.id != Item.SKULL.id) {
if (itemstack.getItem() instanceof ItemArmor) {
- switch (((ItemArmor) itemstack.getItem()).a) {
+ switch (((ItemArmor) itemstack.getItem()).b) {
case 0:
return 4;
@@ -2023,9 +2063,9 @@ public abstract class EntityLiving extends Entity {
}
}
- protected void bF() {
- if (this.bD() != null && this.random.nextFloat() < b[this.world.difficulty]) {
- EnchantmentManager.a(this.random, this.bD(), 5 + this.world.difficulty * this.random.nextInt(6));
+ protected void bI() {
+ if (this.bG() != null && this.random.nextFloat() < b[this.world.difficulty]) {
+ EnchantmentManager.a(this.random, this.bG(), 5 + this.world.difficulty * this.random.nextInt(6));
}
for (int i = 0; i < 4; ++i) {
@@ -2037,31 +2077,71 @@ public abstract class EntityLiving extends Entity {
}
}
- public void bG() {}
+ public void bJ() {}
private int h() {
return this.hasEffect(MobEffectList.FASTER_DIG) ? 6 - (1 + this.getEffect(MobEffectList.FASTER_DIG).getAmplifier()) * 1 : (this.hasEffect(MobEffectList.SLOWER_DIG) ? 6 + (1 + this.getEffect(MobEffectList.SLOWER_DIG).getAmplifier()) * 2 : 6);
}
- public void bH() {
- if (!this.bq || this.br >= this.h() / 2 || this.br < 0) {
- this.br = -1;
- this.bq = true;
+ public void bK() {
+ if (!this.br || this.bs >= this.h() / 2 || this.bs < 0) {
+ this.bs = -1;
+ this.br = true;
if (this.world instanceof WorldServer) {
((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet18ArmAnimation(this, 1)));
}
}
}
- public boolean bI() {
+ public boolean bL() {
return false;
}
- public final int bJ() {
+ public final int bM() {
return this.datawatcher.getByte(10);
}
public final void r(int i) {
this.datawatcher.watch(10, Byte.valueOf((byte) i));
}
+
+ public EntityLiving bN() {
+ return (EntityLiving) (this.bt.c() != null ? this.bt.c() : (this.killer != null ? this.killer : (this.lastDamager != null ? this.lastDamager : null)));
+ }
+
+ public String getLocalizedName() {
+ return this.hasCustomName() ? this.getCustomName() : super.getLocalizedName();
+ }
+
+ public void setCustomName(String s) {
+ this.datawatcher.watch(5, s);
+ }
+
+ public String getCustomName() {
+ return this.datawatcher.getString(5);
+ }
+
+ public boolean hasCustomName() {
+ return this.datawatcher.getString(5).length() > 0;
+ }
+
+ public void setCustomNameVisible(boolean flag) {
+ this.datawatcher.watch(6, Byte.valueOf((byte) (flag ? 1 : 0)));
+ }
+
+ public boolean getCustomNameVisible() {
+ return this.datawatcher.getByte(6) == 1;
+ }
+
+ public void a(int i, float f) {
+ this.dropChances[i] = f;
+ }
+
+ public boolean bS() {
+ return this.canPickUpLoot;
+ }
+
+ public void h(boolean flag) {
+ this.canPickUpLoot = flag;
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityMagmaCube.java b/src/main/java/net/minecraft/server/EntityMagmaCube.java
index a6053926..b63d42e0 100644
--- a/src/main/java/net/minecraft/server/EntityMagmaCube.java
+++ b/src/main/java/net/minecraft/server/EntityMagmaCube.java
@@ -6,14 +6,14 @@ public class EntityMagmaCube extends EntitySlime {
super(world);
this.texture = "/mob/lava.png";
this.fireProof = true;
- this.aN = 0.2F;
+ this.aO = 0.2F;
}
public boolean canSpawn() {
return this.world.difficulty > 0 && this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
}
- public int aW() {
+ public int aZ() {
return this.getSize() * 3;
}
@@ -66,9 +66,9 @@ public class EntityMagmaCube extends EntitySlime {
this.b *= 0.9F;
}
- protected void bi() {
+ protected void bl() {
this.motY = (double) (0.42F + (float) this.getSize() * 0.1F);
- this.am = true;
+ this.an = true;
}
protected void a(float f) {}
@@ -81,11 +81,11 @@ public class EntityMagmaCube extends EntitySlime {
return super.m() + 2;
}
- protected String aZ() {
+ protected String bc() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
- protected String ba() {
+ protected String bd() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
@@ -93,7 +93,7 @@ public class EntityMagmaCube extends EntitySlime {
return this.getSize() > 1 ? "mob.magmacube.big" : "mob.magmacube.small";
}
- public boolean J() {
+ public boolean I() {
return false;
}
diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java
deleted file mode 100644
index cabc3ce6..00000000
--- a/src/main/java/net/minecraft/server/EntityMinecart.java
+++ /dev/null
@@ -1,1050 +0,0 @@
-package net.minecraft.server;
-
-import java.util.List;
-
-// CraftBukkit start
-import org.bukkit.Location;
-import org.bukkit.entity.HumanEntity;
-import org.bukkit.entity.Vehicle;
-import org.bukkit.event.vehicle.VehicleDamageEvent;
-import org.bukkit.event.vehicle.VehicleDestroyEvent;
-import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
-import org.bukkit.util.Vector;
-import org.bukkit.inventory.InventoryHolder;
-import org.bukkit.craftbukkit.entity.CraftHumanEntity;
-// CraftBukkit end
-
-public class EntityMinecart extends Entity implements IInventory {
-
- private ItemStack[] items;
- private int e;
- private boolean f;
- public int type;
- public double b;
- public double c;
- private final IUpdatePlayerListBox g;
- private boolean h;
- private static final int[][][] matrix = new int[][][] { { { 0, 0, -1}, { 0, 0, 1}}, { { -1, 0, 0}, { 1, 0, 0}}, { { -1, -1, 0}, { 1, 0, 0}}, { { -1, 0, 0}, { 1, -1, 0}}, { { 0, 0, -1}, { 0, -1, 1}}, { { 0, -1, -1}, { 0, 0, 1}}, { { 0, 0, 1}, { 1, 0, 0}}, { { 0, 0, 1}, { -1, 0, 0}}, { { 0, 0, -1}, { -1, 0, 0}}, { { 0, 0, -1}, { 1, 0, 0}}};
- private int j;
- private double at;
- private double au;
- private double av;
- private double aw;
- private double ax;
-
- // CraftBukkit start
- public boolean slowWhenEmpty = true;
- private double derailedX = 0.5;
- private double derailedY = 0.5;
- private double derailedZ = 0.5;
- private double flyingX = 0.95;
- private double flyingY = 0.95;
- private double flyingZ = 0.95;
- public double maxSpeed = 0.4D;
- public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
- private int maxStack = MAX_STACK;
-
- public ItemStack[] getContents() {
- return this.items;
- }
-
- public void onOpen(CraftHumanEntity who) {
- transaction.add(who);
- }
-
- public void onClose(CraftHumanEntity who) {
- transaction.remove(who);
- }
-
- public List<HumanEntity> getViewers() {
- return transaction;
- }
-
- public InventoryHolder getOwner() {
- org.bukkit.entity.Entity cart = getBukkitEntity();
- if(cart instanceof InventoryHolder) return (InventoryHolder) cart;
- return null;
- }
-
- public void setMaxStackSize(int size) {
- maxStack = size;
- }
- // CraftBukkit end
-
- public EntityMinecart(World world) {
- super(world);
- this.items = new ItemStack[27]; // CraftBukkit
- this.e = 0;
- this.f = false;
- this.h = true;
- this.m = true;
- this.a(0.98F, 0.7F);
- this.height = this.length / 2.0F;
- this.g = world != null ? world.a(this) : null;
- }
-
- protected boolean f_() {
- return false;
- }
-
- protected void a() {
- this.datawatcher.a(16, new Byte((byte) 0));
- this.datawatcher.a(17, new Integer(0));
- this.datawatcher.a(18, new Integer(1));
- this.datawatcher.a(19, new Integer(0));
- }
-
- public AxisAlignedBB g(Entity entity) {
- return entity.M() ? entity.boundingBox : null;
- }
-
- public AxisAlignedBB E() {
- return null;
- }
-
- public boolean M() {
- return true;
- }
-
- public EntityMinecart(World world, double d0, double d1, double d2, int i) {
- this(world);
- this.setPosition(d0, d1 + (double) this.height, d2);
- this.motX = 0.0D;
- this.motY = 0.0D;
- this.motZ = 0.0D;
- this.lastX = d0;
- this.lastY = d1;
- this.lastZ = d2;
- this.type = i;
-
- this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
- }
-
- public double X() {
- return (double) this.length * 0.0D - 0.30000001192092896D;
- }
-
- public boolean damageEntity(DamageSource damagesource, int i) {
- if (this.isInvulnerable()) {
- return false;
- } else {
- if (!this.world.isStatic && !this.dead) {
- // CraftBukkit start
- Vehicle vehicle = (Vehicle) this.getBukkitEntity();
- org.bukkit.entity.Entity passenger = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
-
- VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, i);
- this.world.getServer().getPluginManager().callEvent(event);
-
- if (event.isCancelled()) {
- return true;
- }
-
- i = event.getDamage();
- // CraftBukkit end
-
- this.i(-this.k());
- this.h(10);
- this.K();
- this.setDamage(this.getDamage() + i * 10);
- if (damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild) {
- this.setDamage(100);
- }
-
- if (this.getDamage() > 40) {
- if (this.passenger != null) {
- this.passenger.mount(this);
- }
-
- // CraftBukkit start
- VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
- this.world.getServer().getPluginManager().callEvent(destroyEvent);
-
- if (destroyEvent.isCancelled()) {
- this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
- return true;
- }
- // CraftBukkit end
-
- this.die();
- this.a(Item.MINECART.id, 1, 0.0F);
- if (this.type == 1) {
- EntityMinecart entityminecart = this;
-
- for (int j = 0; j < entityminecart.getSize(); ++j) {
- ItemStack itemstack = entityminecart.getItem(j);
-
- if (itemstack != null) {
- float f = this.random.nextFloat() * 0.8F + 0.1F;
- float f1 = this.random.nextFloat() * 0.8F + 0.1F;
- float f2 = this.random.nextFloat() * 0.8F + 0.1F;
-
- while (itemstack.count > 0) {
- int k = this.random.nextInt(21) + 10;
-
- if (k > itemstack.count) {
- k = itemstack.count;
- }
-
- itemstack.count -= k;
- // CraftBukkit - include enchantments in the new itemstack
- EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, org.bukkit.craftbukkit.inventory.CraftItemStack.copyNMSStack(itemstack, k));
- float f3 = 0.05F;
-
- entityitem.motX = (double) ((float) this.random.nextGaussian() * f3);
- entityitem.motY = (double) ((float) this.random.nextGaussian() * f3 + 0.2F);
- entityitem.motZ = (double) ((float) this.random.nextGaussian() * f3);
- this.world.addEntity(entityitem);
- }
- }
- }
-
- this.a(Block.CHEST.id, 1, 0.0F);
- } else if (this.type == 2) {
- this.a(Block.FURNACE.id, 1, 0.0F);
- }
- }
-
- return true;
- } else {
- return true;
- }
- }
- }
-
- public boolean L() {
- return !this.dead;
- }
-
- public void die() {
- if (this.h) {
- for (int i = 0; i < this.getSize(); ++i) {
- ItemStack itemstack = this.getItem(i);
-
- if (itemstack != null) {
- float f = this.random.nextFloat() * 0.8F + 0.1F;
- float f1 = this.random.nextFloat() * 0.8F + 0.1F;
- float f2 = this.random.nextFloat() * 0.8F + 0.1F;
-
- while (itemstack.count > 0) {
- int j = this.random.nextInt(21) + 10;
-
- if (j > itemstack.count) {
- j = itemstack.count;
- }
-
- itemstack.count -= j;
- EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, j, itemstack.getData()));
-
- if (itemstack.hasTag()) {
- entityitem.getItemStack().setTag((NBTTagCompound) itemstack.getTag().clone());
- }
-
- float f3 = 0.05F;
-
- entityitem.motX = (double) ((float) this.random.nextGaussian() * f3);
- entityitem.motY = (double) ((float) this.random.nextGaussian() * f3 + 0.2F);
- entityitem.motZ = (double) ((float) this.random.nextGaussian() * f3);
- this.world.addEntity(entityitem);
- }
- }
- }
- }
-
- super.die();
- if (this.g != null) {
- this.g.a();
- }
- }
-
- public void b(int i) {
- this.h = false;
- super.b(i);
- }
-
- public void j_() {
- // CraftBukkit start
- double prevX = this.locX;
- double prevY = this.locY;
- double prevZ = this.locZ;
- float prevYaw = this.yaw;
- float prevPitch = this.pitch;
- // CraftBukkit end
-
- if (this.g != null) {
- this.g.a();
- }
-
- if (this.j() > 0) {
- this.h(this.j() - 1);
- }
-
- if (this.getDamage() > 0) {
- this.setDamage(this.getDamage() - 1);
- }
-
- if (this.locY < -64.0D) {
- this.C();
- }
-
- if (this.h() && this.random.nextInt(4) == 0) {
- this.world.addParticle("largesmoke", this.locX, this.locY + 0.8D, this.locZ, 0.0D, 0.0D, 0.0D);
- }
-
- int i;
-
- if (!this.world.isStatic && this.world instanceof WorldServer) {
- this.world.methodProfiler.a("portal");
- MinecraftServer minecraftserver = ((WorldServer) this.world).getMinecraftServer();
-
- i = this.z();
- if (this.ao) {
- if (true || minecraftserver.getAllowNether()) { // CraftBukkit - multi-world should still allow teleport even if default vanilla nether disabled
- if (this.vehicle == null && this.ap++ >= i) {
- this.ap = i;
- this.portalCooldown = this.ab();
- byte b0;
-
- if (this.world.worldProvider.dimension == -1) {
- b0 = 0;
- } else {
- b0 = -1;
- }
-
- this.b(b0);
- }
-
- this.ao = false;
- }
- } else {
- if (this.ap > 0) {
- this.ap -= 4;
- }
-
- if (this.ap < 0) {
- this.ap = 0;
- }
- }
-
- if (this.portalCooldown > 0) {
- --this.portalCooldown;
- }
-
- this.world.methodProfiler.b();
- }
-
- if (this.world.isStatic) {
- if (this.j > 0) {
- double d0 = this.locX + (this.at - this.locX) / (double) this.j;
- double d1 = this.locY + (this.au - this.locY) / (double) this.j;
- double d2 = this.locZ + (this.av - this.locZ) / (double) this.j;
- double d3 = MathHelper.g(this.aw - (double) this.yaw);
-
- this.yaw = (float) ((double) this.yaw + d3 / (double) this.j);
- this.pitch = (float) ((double) this.pitch + (this.ax - (double) this.pitch) / (double) this.j);
- --this.j;
- this.setPosition(d0, d1, d2);
- this.b(this.yaw, this.pitch);
- } else {
- this.setPosition(this.locX, this.locY, this.locZ);
- this.b(this.yaw, this.pitch);
- }
- } else {
- this.lastX = this.locX;
- this.lastY = this.locY;
- this.lastZ = this.locZ;
- this.motY -= 0.03999999910593033D;
- int j = MathHelper.floor(this.locX);
- i = MathHelper.floor(this.locY);
- int k = MathHelper.floor(this.locZ);
-
- if (BlockMinecartTrack.e_(this.world, j, i - 1, k)) {
- --i;
- }
-
- // CraftBukkit
- double d4 = this.maxSpeed;
- double d5 = 0.0078125D;
- int l = this.world.getTypeId(j, i, k);
-
- if (BlockMinecartTrack.e(l)) {
- this.fallDistance = 0.0F;
- Vec3D vec3d = this.a(this.locX, this.locY, this.locZ);
- int i1 = this.world.getData(j, i, k);
-
- this.locY = (double) i;
- boolean flag = false;
- boolean flag1 = false;
-
- if (l == Block.GOLDEN_RAIL.id) {
- flag = (i1 & 8) != 0;
- flag1 = !flag;
- }
-
- if (((BlockMinecartTrack) Block.byId[l]).p()) {
- i1 &= 7;
- }
-
- if (i1 >= 2 && i1 <= 5) {
- this.locY = (double) (i + 1);
- }
-
- if (i1 == 2) {
- this.motX -= d5;
- }
-
- if (i1 == 3) {
- this.motX += d5;
- }
-
- if (i1 == 4) {
- this.motZ += d5;
- }
-
- if (i1 == 5) {
- this.motZ -= d5;
- }
-
- int[][] aint = matrix[i1];
- double d6 = (double) (aint[1][0] - aint[0][0]);
- double d7 = (double) (aint[1][2] - aint[0][2]);
- double d8 = Math.sqrt(d6 * d6 + d7 * d7);
- double d9 = this.motX * d6 + this.motZ * d7;
-
- if (d9 < 0.0D) {
- d6 = -d6;
- d7 = -d7;
- }
-
- double d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
-
- this.motX = d10 * d6 / d8;
- this.motZ = d10 * d7 / d8;
- double d11;
- double d12;
-
- if (this.passenger != null) {
- d12 = this.passenger.motX * this.passenger.motX + this.passenger.motZ * this.passenger.motZ;
- d11 = this.motX * this.motX + this.motZ * this.motZ;
- if (d12 > 1.0E-4D && d11 < 0.01D) {
- this.motX += this.passenger.motX * 0.1D;
- this.motZ += this.passenger.motZ * 0.1D;
- flag1 = false;
- }
- }
-
- if (flag1) {
- d12 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
- if (d12 < 0.03D) {
- this.motX *= 0.0D;
- this.motY *= 0.0D;
- this.motZ *= 0.0D;
- } else {
- this.motX *= 0.5D;
- this.motY *= 0.0D;
- this.motZ *= 0.5D;
- }
- }
-
- d12 = 0.0D;
- d11 = (double) j + 0.5D + (double) aint[0][0] * 0.5D;
- double d13 = (double) k + 0.5D + (double) aint[0][2] * 0.5D;
- double d14 = (double) j + 0.5D + (double) aint[1][0] * 0.5D;
- double d15 = (double) k + 0.5D + (double) aint[1][2] * 0.5D;
-
- d6 = d14 - d11;
- d7 = d15 - d13;
- double d16;
- double d17;
-
- if (d6 == 0.0D) {
- this.locX = (double) j + 0.5D;
- d12 = this.locZ - (double) k;
- } else if (d7 == 0.0D) {
- this.locZ = (double) k + 0.5D;
- d12 = this.locX - (double) j;
- } else {
- d16 = this.locX - d11;
- d17 = this.locZ - d13;
- d12 = (d16 * d6 + d17 * d7) * 2.0D;
- }
-
- this.locX = d11 + d6 * d12;
- this.locZ = d13 + d7 * d12;
- this.setPosition(this.locX, this.locY + (double) this.height, this.locZ);
- d16 = this.motX;
- d17 = this.motZ;
- if (this.passenger != null) {
- d16 *= 0.75D;
- d17 *= 0.75D;
- }
-
- if (d16 < -d4) {
- d16 = -d4;
- }
-
- if (d16 > d4) {
- d16 = d4;
- }
-
- if (d17 < -d4) {
- d17 = -d4;
- }
-
- if (d17 > d4) {
- d17 = d4;
- }
-
- this.move(d16, 0.0D, d17);
- if (aint[0][1] != 0 && MathHelper.floor(this.locX) - j == aint[0][0] && MathHelper.floor(this.locZ) - k == aint[0][2]) {
- this.setPosition(this.locX, this.locY + (double) aint[0][1], this.locZ);
- } else if (aint[1][1] != 0 && MathHelper.floor(this.locX) - j == aint[1][0] && MathHelper.floor(this.locZ) - k == aint[1][2]) {
- this.setPosition(this.locX, this.locY + (double) aint[1][1], this.locZ);
- }
-
- // CraftBukkit
- if (this.passenger != null || !this.slowWhenEmpty) {
- this.motX *= 0.996999979019165D;
- this.motY *= 0.0D;
- this.motZ *= 0.996999979019165D;
- } else {
- if (this.type == 2) {
- double d18 = this.b * this.b + this.c * this.c;
-
- if (d18 > 1.0E-4D) {
- d18 = (double) MathHelper.sqrt(d18);
- this.b /= d18;
- this.c /= d18;
- double d19 = 0.04D;
-
- this.motX *= 0.800000011920929D;
- this.motY *= 0.0D;
- this.motZ *= 0.800000011920929D;
- this.motX += this.b * d19;
- this.motZ += this.c * d19;
- } else {
- this.motX *= 0.8999999761581421D;
- this.motY *= 0.0D;
- this.motZ *= 0.8999999761581421D;
- }
- }
-
- this.motX *= 0.9599999785423279D;
- this.motY *= 0.0D;
- this.motZ *= 0.9599999785423279D;
- }
-
- Vec3D vec3d1 = this.a(this.locX, this.locY, this.locZ);
-
- if (vec3d1 != null && vec3d != null) {
- double d20 = (vec3d.d - vec3d1.d) * 0.05D;
-
- d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
- if (d10 > 0.0D) {
- this.motX = this.motX / d10 * (d10 + d20);
- this.motZ = this.motZ / d10 * (d10 + d20);
- }
-
- this.setPosition(this.locX, vec3d1.d, this.locZ);
- }
-
- int j1 = MathHelper.floor(this.locX);
- int k1 = MathHelper.floor(this.locZ);
-
- if (j1 != j || k1 != k) {
- d10 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
- this.motX = d10 * (double) (j1 - j);
- this.motZ = d10 * (double) (k1 - k);
- }
-
- double d21;
-
- if (this.type == 2) {
- d21 = this.b * this.b + this.c * this.c;
- if (d21 > 1.0E-4D && this.motX * this.motX + this.motZ * this.motZ > 0.001D) {
- d21 = (double) MathHelper.sqrt(d21);
- this.b /= d21;
- this.c /= d21;
- if (this.b * this.motX + this.c * this.motZ < 0.0D) {
- this.b = 0.0D;
- this.c = 0.0D;
- } else {
- this.b = this.motX;
- this.c = this.motZ;
- }
- }
- }
-
- if (flag) {
- d21 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
- if (d21 > 0.01D) {
- double d22 = 0.06D;
-
- this.motX += this.motX / d21 * d22;
- this.motZ += this.motZ / d21 * d22;
- } else if (i1 == 1) {
- if (this.world.t(j - 1, i, k)) {
- this.motX = 0.02D;
- } else if (this.world.t(j + 1, i, k)) {
- this.motX = -0.02D;
- }
- } else if (i1 == 0) {
- if (this.world.t(j, i, k - 1)) {
- this.motZ = 0.02D;
- } else if (this.world.t(j, i, k + 1)) {
- this.motZ = -0.02D;
- }
- }
- }
- } else {
- if (this.motX < -d4) {
- this.motX = -d4;
- }
-
- if (this.motX > d4) {
- this.motX = d4;
- }
-
- if (this.motZ < -d4) {
- this.motZ = -d4;
- }
-
- if (this.motZ > d4) {
- this.motZ = d4;
- }
-
- if (this.onGround) {
- // CraftBukkit start
- this.motX *= this.derailedX;
- this.motY *= this.derailedY;
- this.motZ *= this.derailedZ;
- // CraftBukkit end
- }
-
- this.move(this.motX, this.motY, this.motZ);
- if (!this.onGround) {
- // CraftBukkit start
- this.motX *= this.flyingX;
- this.motY *= this.flyingY;
- this.motZ *= this.flyingZ;
- // CraftBukkit end
- }
- }
-
- this.D();
- this.pitch = 0.0F;
- double d23 = this.lastX - this.locX;
- double d24 = this.lastZ - this.locZ;
-
- if (d23 * d23 + d24 * d24 > 0.001D) {
- this.yaw = (float) (Math.atan2(d24, d23) * 180.0D / 3.141592653589793D);
- if (this.f) {
- this.yaw += 180.0F;
- }
- }
-
- double d25 = (double) MathHelper.g(this.yaw - this.lastYaw);
-
- if (d25 < -170.0D || d25 >= 170.0D) {
- this.yaw += 180.0F;
- this.f = !this.f;
- }
-
- this.b(this.yaw, this.pitch);
-
- // CraftBukkit start
- org.bukkit.World bworld = this.world.getWorld();
- Location from = new Location(bworld, prevX, prevY, prevZ, prevYaw, prevPitch);
- Location to = new Location(bworld, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
- Vehicle vehicle = (Vehicle) this.getBukkitEntity();
-
- this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle));
-
- if (!from.equals(to)) {
- this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleMoveEvent(vehicle, from, to));
- }
- // CraftBukkit end
-
- List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
-
- if (list != null && !list.isEmpty()) {
- for (int l1 = 0; l1 < list.size(); ++l1) {
- Entity entity = (Entity) list.get(l1);
-
- if (entity != this.passenger && entity.M() && entity instanceof EntityMinecart) {
- entity.collide(this);
- }
- }
- }
-
- if (this.passenger != null && this.passenger.dead) {
- if (this.passenger.vehicle == this) {
- this.passenger.vehicle = null;
- }
-
- this.passenger = null;
- }
-
- if (this.e > 0) {
- --this.e;
- }
-
- if (this.e <= 0) {
- this.b = this.c = 0.0D;
- }
-
- this.e(this.e > 0);
- }
- }
-
- public Vec3D a(double d0, double d1, double d2) {
- int i = MathHelper.floor(d0);
- int j = MathHelper.floor(d1);
- int k = MathHelper.floor(d2);
-
- if (BlockMinecartTrack.e_(this.world, i, j - 1, k)) {
- --j;
- }
-
- int l = this.world.getTypeId(i, j, k);
-
- if (BlockMinecartTrack.e(l)) {
- int i1 = this.world.getData(i, j, k);
-
- d1 = (double) j;
- if (((BlockMinecartTrack) Block.byId[l]).p()) {
- i1 &= 7;
- }
-
- if (i1 >= 2 && i1 <= 5) {
- d1 = (double) (j + 1);
- }
-
- int[][] aint = matrix[i1];
- double d3 = 0.0D;
- double d4 = (double) i + 0.5D + (double) aint[0][0] * 0.5D;
- double d5 = (double) j + 0.5D + (double) aint[0][1] * 0.5D;
- double d6 = (double) k + 0.5D + (double) aint[0][2] * 0.5D;
- double d7 = (double) i + 0.5D + (double) aint[1][0] * 0.5D;
- double d8 = (double) j + 0.5D + (double) aint[1][1] * 0.5D;
- double d9 = (double) k + 0.5D + (double) aint[1][2] * 0.5D;
- double d10 = d7 - d4;
- double d11 = (d8 - d5) * 2.0D;
- double d12 = d9 - d6;
-
- if (d10 == 0.0D) {
- d0 = (double) i + 0.5D;
- d3 = d2 - (double) k;
- } else if (d12 == 0.0D) {
- d2 = (double) k + 0.5D;
- d3 = d0 - (double) i;
- } else {
- double d13 = d0 - d4;
- double d14 = d2 - d6;
-
- d3 = (d13 * d10 + d14 * d12) * 2.0D;
- }
-
- d0 = d4 + d10 * d3;
- d1 = d5 + d11 * d3;
- d2 = d6 + d12 * d3;
- if (d11 < 0.0D) {
- ++d1;
- }
-
- if (d11 > 0.0D) {
- d1 += 0.5D;
- }
-
- return this.world.getVec3DPool().create(d0, d1, d2);
- } else {
- return null;
- }
- }
-
- protected void b(NBTTagCompound nbttagcompound) {
- nbttagcompound.setInt("Type", this.type);
- if (this.type == 2) {
- nbttagcompound.setDouble("PushX", this.b);
- nbttagcompound.setDouble("PushZ", this.c);
- nbttagcompound.setShort("Fuel", (short) this.e);
- } else if (this.type == 1) {
- NBTTagList nbttaglist = new NBTTagList();
-
- for (int i = 0; i < this.items.length; ++i) {
- if (this.items[i] != null) {
- NBTTagCompound nbttagcompound1 = new NBTTagCompound();
-
- nbttagcompound1.setByte("Slot", (byte) i);
- this.items[i].save(nbttagcompound1);
- nbttaglist.add(nbttagcompound1);
- }
- }
-
- nbttagcompound.set("Items", nbttaglist);
- }
- }
-
- protected void a(NBTTagCompound nbttagcompound) {
- this.type = nbttagcompound.getInt("Type");
- if (this.type == 2) {
- this.b = nbttagcompound.getDouble("PushX");
- this.c = nbttagcompound.getDouble("PushZ");
- this.e = nbttagcompound.getShort("Fuel");
- } else if (this.type == 1) {
- NBTTagList nbttaglist = nbttagcompound.getList("Items");
-
- this.items = new ItemStack[this.getSize()];
-
- for (int i = 0; i < nbttaglist.size(); ++i) {
- NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
- int j = nbttagcompound1.getByte("Slot") & 255;
-
- if (j >= 0 && j < this.items.length) {
- this.items[j] = ItemStack.createStack(nbttagcompound1);
- }
- }
- }
- }
-
- public void collide(Entity entity) {
- if (!this.world.isStatic) {
- if (entity != this.passenger) {
- // CraftBukkit start
- Vehicle vehicle = (Vehicle) this.getBukkitEntity();
- org.bukkit.entity.Entity hitEntity = (entity == null) ? null : entity.getBukkitEntity();
-
- VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, hitEntity);
- this.world.getServer().getPluginManager().callEvent(collisionEvent);
-
- if (collisionEvent.isCancelled()) {
- return;
- }
- // CraftBukkit end
-
- if (entity instanceof EntityLiving && !(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && this.type == 0 && this.motX * this.motX + this.motZ * this.motZ > 0.01D && this.passenger == null && entity.vehicle == null) {
- entity.mount(this);
- }
-
- double d0 = entity.locX - this.locX;
- double d1 = entity.locZ - this.locZ;
- double d2 = d0 * d0 + d1 * d1;
-
- // CraftBukkit - collision
- if (d2 >= 9.999999747378752E-5D && !collisionEvent.isCollisionCancelled()) {
- d2 = (double) MathHelper.sqrt(d2);
- d0 /= d2;
- d1 /= d2;
- double d3 = 1.0D / d2;
-
- if (d3 > 1.0D) {
- d3 = 1.0D;
- }
-
- d0 *= d3;
- d1 *= d3;
- d0 *= 0.10000000149011612D;
- d1 *= 0.10000000149011612D;
- d0 *= (double) (1.0F - this.Z);
- d1 *= (double) (1.0F - this.Z);
- d0 *= 0.5D;
- d1 *= 0.5D;
- if (entity instanceof EntityMinecart) {
- double d4 = entity.locX - this.locX;
- double d5 = entity.locZ - this.locZ;
- Vec3D vec3d = this.world.getVec3DPool().create(d4, 0.0D, d5).a();
- Vec3D vec3d1 = this.world.getVec3DPool().create((double) MathHelper.cos(this.yaw * 3.1415927F / 180.0F), 0.0D, (double) MathHelper.sin(this.yaw * 3.1415927F / 180.0F)).a();
- double d6 = Math.abs(vec3d.b(vec3d1));
-
- if (d6 < 0.800000011920929D) {
- return;
- }
-
- double d7 = entity.motX + this.motX;
- double d8 = entity.motZ + this.motZ;
-
- if (((EntityMinecart) entity).type == 2 && this.type != 2) {
- this.motX *= 0.20000000298023224D;
- this.motZ *= 0.20000000298023224D;
- this.g(entity.motX - d0, 0.0D, entity.motZ - d1);
- entity.motX *= 0.949999988079071D;
- entity.motZ *= 0.949999988079071D;
- } else if (((EntityMinecart) entity).type != 2 && this.type == 2) {
- entity.motX *= 0.20000000298023224D;
- entity.motZ *= 0.20000000298023224D;
- entity.g(this.motX + d0, 0.0D, this.motZ + d1);
- this.motX *= 0.949999988079071D;
- this.motZ *= 0.949999988079071D;
- } else {
- d7 /= 2.0D;
- d8 /= 2.0D;
- this.motX *= 0.20000000298023224D;
- this.motZ *= 0.20000000298023224D;
- this.g(d7 - d0, 0.0D, d8 - d1);
- entity.motX *= 0.20000000298023224D;
- entity.motZ *= 0.20000000298023224D;
- entity.g(d7 + d0, 0.0D, d8 + d1);
- }
- } else {
- this.g(-d0, 0.0D, -d1);
- entity.g(d0 / 4.0D, 0.0D, d1 / 4.0D);
- }
- }
- }
- }
- }
-
- public int getSize() {
- return 27;
- }
-
- public ItemStack getItem(int i) {
- return this.items[i];
- }
-
- public ItemStack splitStack(int i, int j) {
- if (this.items[i] != null) {
- ItemStack itemstack;
-
- if (this.items[i].count <= j) {
- itemstack = this.items[i];
- this.items[i] = null;
- return itemstack;
- } else {
- itemstack = this.items[i].a(j);
- if (this.items[i].count == 0) {
- this.items[i] = null;
- }
-
- return itemstack;
- }
- } else {
- return null;
- }
- }
-
- public ItemStack splitWithoutUpdate(int i) {
- if (this.items[i] != null) {
- ItemStack itemstack = this.items[i];
-
- this.items[i] = null;
- return itemstack;
- } else {
- return null;
- }
- }
-
- public void setItem(int i, ItemStack itemstack) {
- this.items[i] = itemstack;
- if (itemstack != null && itemstack.count > this.getMaxStackSize()) {
- itemstack.count = this.getMaxStackSize();
- }
- }
-
- public String getName() {
- return "container.minecart";
- }
-
- public int getMaxStackSize() {
- return maxStack; // CraftBukkit
- }
-
- public void update() {}
-
- public boolean a(EntityHuman entityhuman) {
- if (this.type == 0) {
- if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) {
- return true;
- }
-
- if (!this.world.isStatic) {
- entityhuman.mount(this);
- }
- } else if (this.type == 1) {
- if (!this.world.isStatic) {
- entityhuman.openContainer(this);
- }
- } else if (this.type == 2) {
- ItemStack itemstack = entityhuman.inventory.getItemInHand();
-
- if (itemstack != null && itemstack.id == Item.COAL.id) {
- if (--itemstack.count == 0) {
- entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
- }
-
- this.e += 3600;
- }
-
- this.b = this.locX - entityhuman.locX;
- this.c = this.locZ - entityhuman.locZ;
- }
-
- return true;
- }
-
- public boolean a_(EntityHuman entityhuman) {
- return this.dead ? false : entityhuman.e(this) <= 64.0D;
- }
-
- protected boolean h() {
- return (this.datawatcher.getByte(16) & 1) != 0;
- }
-
- protected void e(boolean flag) {
- if (flag) {
- this.datawatcher.watch(16, Byte.valueOf((byte) (this.datawatcher.getByte(16) | 1)));
- } else {
- this.datawatcher.watch(16, Byte.valueOf((byte) (this.datawatcher.getByte(16) & -2)));
- }
- }
-
- public void startOpen() {}
-
- public void f() {}
-
- public void setDamage(int i) {
- this.datawatcher.watch(19, Integer.valueOf(i));
- }
-
- public int getDamage() {
- return this.datawatcher.getInt(19);
- }
-
- public void h(int i) {
- this.datawatcher.watch(17, Integer.valueOf(i));
- }
-
- public int j() {
- return this.datawatcher.getInt(17);
- }
-
- public void i(int i) {
- this.datawatcher.watch(18, Integer.valueOf(i));
- }
-
- public int k() {
- return this.datawatcher.getInt(18);
- }
-
- // CraftBukkit start - methods for getting and setting flying and derailed velocity modifiers
- public Vector getFlyingVelocityMod() {
- return new Vector(flyingX, flyingY, flyingZ);
- }
-
- public void setFlyingVelocityMod(Vector flying) {
- flyingX = flying.getX();
- flyingY = flying.getY();
- flyingZ = flying.getZ();
- }
-
- public Vector getDerailedVelocityMod() {
- return new Vector(derailedX, derailedY, derailedZ);
- }
-
- public void setDerailedVelocityMod(Vector derailed) {
- derailedX = derailed.getX();
- derailedY = derailed.getY();
- derailedZ = derailed.getZ();
- }
- // CraftBukkit end
-}
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
new file mode 100644
index 00000000..ad54c7ac
--- /dev/null
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
@@ -0,0 +1,888 @@
+package net.minecraft.server;
+
+import java.util.List;
+
+// CraftBukkit start
+import org.bukkit.Location;
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.entity.Vehicle;
+import org.bukkit.event.vehicle.VehicleDamageEvent;
+import org.bukkit.event.vehicle.VehicleDestroyEvent;
+import org.bukkit.event.vehicle.VehicleEntityCollisionEvent;
+import org.bukkit.util.Vector;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+// CraftBukkit end
+
+public abstract class EntityMinecartAbstract extends Entity {
+
+ private boolean a;
+ private final IUpdatePlayerListBox b;
+ private String c;
+ private static final int[][][] matrix = new int[][][] { { { 0, 0, -1}, { 0, 0, 1}}, { { -1, 0, 0}, { 1, 0, 0}}, { { -1, -1, 0}, { 1, 0, 0}}, { { -1, 0, 0}, { 1, -1, 0}}, { { 0, 0, -1}, { 0, -1, 1}}, { { 0, -1, -1}, { 0, 0, 1}}, { { 0, 0, 1}, { 1, 0, 0}}, { { 0, 0, 1}, { -1, 0, 0}}, { { 0, 0, -1}, { -1, 0, 0}}, { { 0, 0, -1}, { 1, 0, 0}}};
+ private int e;
+ private double f;
+ private double g;
+ private double h;
+ private double i;
+ private double j;
+
+ // CraftBukkit start
+ public boolean slowWhenEmpty = true;
+ private double derailedX = 0.5;
+ private double derailedY = 0.5;
+ private double derailedZ = 0.5;
+ private double flyingX = 0.95;
+ private double flyingY = 0.95;
+ private double flyingZ = 0.95;
+ public double maxSpeed = 0.4D;
+ // CraftBukkit end
+
+ public EntityMinecartAbstract(World world) {
+ super(world);
+ this.a = false;
+ this.m = true;
+ this.a(0.98F, 0.7F);
+ this.height = this.length / 2.0F;
+ this.b = world != null ? world.a(this) : null;
+ }
+
+ public static EntityMinecartAbstract a(World world, double d0, double d1, double d2, int i) {
+ switch (i) {
+ case 1:
+ return new EntityMinecartChest(world, d0, d1, d2);
+
+ case 2:
+ return new EntityMinecartFurnace(world, d0, d1, d2);
+
+ case 3:
+ return new EntityMinecartTNT(world, d0, d1, d2);
+
+ case 4:
+ return new EntityMinecartMobSpawner(world, d0, d1, d2);
+
+ case 5:
+ return new EntityMinecartHopper(world, d0, d1, d2);
+
+ default:
+ return new EntityMinecartRideable(world, d0, d1, d2);
+ }
+ }
+
+ protected boolean f_() {
+ return false;
+ }
+
+ protected void a() {
+ this.datawatcher.a(17, new Integer(0));
+ this.datawatcher.a(18, new Integer(1));
+ this.datawatcher.a(19, new Integer(0));
+ this.datawatcher.a(20, new Integer(0));
+ this.datawatcher.a(21, new Integer(6));
+ this.datawatcher.a(22, Byte.valueOf((byte) 0));
+ }
+
+ public AxisAlignedBB g(Entity entity) {
+ return entity.L() ? entity.boundingBox : null;
+ }
+
+ public AxisAlignedBB D() {
+ return null;
+ }
+
+ public boolean L() {
+ return true;
+ }
+
+ public EntityMinecartAbstract(World world, double d0, double d1, double d2) {
+ this(world);
+ this.setPosition(d0, d1 + (double) this.height, d2);
+ this.motX = 0.0D;
+ this.motY = 0.0D;
+ this.motZ = 0.0D;
+ this.lastX = d0;
+ this.lastY = d1;
+ this.lastZ = d2;
+
+ this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit
+ }
+
+ public double W() {
+ return (double) this.length * 0.0D - 0.30000001192092896D;
+ }
+
+ public boolean damageEntity(DamageSource damagesource, int i) {
+ if (!this.world.isStatic && !this.dead) {
+ if (this.isInvulnerable()) {
+ return false;
+ } else {
+ // CraftBukkit start
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+ org.bukkit.entity.Entity passenger = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
+
+ VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, i);
+ this.world.getServer().getPluginManager().callEvent(event);
+
+ if (event.isCancelled()) {
+ return true;
+ }
+
+ i = event.getDamage();
+ // CraftBukkit end
+
+ this.j(-this.k());
+ this.i(10);
+ this.J();
+ this.setDamage(this.getDamage() + i * 10);
+ boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
+
+ if (flag || this.getDamage() > 40) {
+ if (this.passenger != null) {
+ this.passenger.mount(this);
+ }
+
+ // CraftBukkit start
+ VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, passenger);
+ this.world.getServer().getPluginManager().callEvent(destroyEvent);
+
+ if (destroyEvent.isCancelled()) {
+ this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
+ return true;
+ }
+ // CraftBukkit end
+
+ if (flag && !this.c()) {
+ this.die();
+ } else {
+ this.a(damagesource);
+ }
+ }
+
+ return true;
+ }
+ } else {
+ return true;
+ }
+ }
+
+ public void a(DamageSource damagesource) {
+ this.die();
+ ItemStack itemstack = new ItemStack(Item.MINECART, 1);
+
+ if (this.c != null) {
+ itemstack.c(this.c);
+ }
+
+ this.a(itemstack, 0.0F);
+ }
+
+ public boolean K() {
+ return !this.dead;
+ }
+
+ public void die() {
+ super.die();
+ if (this.b != null) {
+ this.b.a();
+ }
+ }
+
+ public void l_() {
+ // CraftBukkit start
+ double prevX = this.locX;
+ double prevY = this.locY;
+ double prevZ = this.locZ;
+ float prevYaw = this.yaw;
+ float prevPitch = this.pitch;
+ // CraftBukkit end
+
+ if (this.b != null) {
+ this.b.a();
+ }
+
+ if (this.j() > 0) {
+ this.i(this.j() - 1);
+ }
+
+ if (this.getDamage() > 0) {
+ this.setDamage(this.getDamage() - 1);
+ }
+
+ if (this.locY < -64.0D) {
+ this.B();
+ }
+
+ int i;
+
+ if (!this.world.isStatic && this.world instanceof WorldServer) {
+ this.world.methodProfiler.a("portal");
+ MinecraftServer minecraftserver = ((WorldServer) this.world).getMinecraftServer();
+
+ i = this.y();
+ if (this.ap) {
+ if (true || minecraftserver.getAllowNether()) { // CraftBukkit - multi-world should still allow teleport even if default vanilla nether disabled
+ if (this.vehicle == null && this.aq++ >= i) {
+ this.aq = i;
+ this.portalCooldown = this.aa();
+ byte b0;
+
+ if (this.world.worldProvider.dimension == -1) {
+ b0 = 0;
+ } else {
+ b0 = -1;
+ }
+
+ this.c(b0);
+ }
+
+ this.ap = false;
+ }
+ } else {
+ if (this.aq > 0) {
+ this.aq -= 4;
+ }
+
+ if (this.aq < 0) {
+ this.aq = 0;
+ }
+ }
+
+ if (this.portalCooldown > 0) {
+ --this.portalCooldown;
+ }
+
+ this.world.methodProfiler.b();
+ }
+
+ if (this.world.isStatic) {
+ if (this.e > 0) {
+ double d0 = this.locX + (this.f - this.locX) / (double) this.e;
+ double d1 = this.locY + (this.g - this.locY) / (double) this.e;
+ double d2 = this.locZ + (this.h - this.locZ) / (double) this.e;
+ double d3 = MathHelper.g(this.i - (double) this.yaw);
+
+ this.yaw = (float) ((double) this.yaw + d3 / (double) this.e);
+ this.pitch = (float) ((double) this.pitch + (this.j - (double) this.pitch) / (double) this.e);
+ --this.e;
+ this.setPosition(d0, d1, d2);
+ this.b(this.yaw, this.pitch);
+ } else {
+ this.setPosition(this.locX, this.locY, this.locZ);
+ this.b(this.yaw, this.pitch);
+ }
+ } else {
+ this.lastX = this.locX;
+ this.lastY = this.locY;
+ this.lastZ = this.locZ;
+ this.motY -= 0.03999999910593033D;
+ int j = MathHelper.floor(this.locX);
+
+ i = MathHelper.floor(this.locY);
+ int k = MathHelper.floor(this.locZ);
+
+ if (BlockMinecartTrackAbstract.d_(this.world, j, i - 1, k)) {
+ --i;
+ }
+
+ double d4 = this.maxSpeed; // CraftBukkit
+ double d5 = 0.0078125D;
+ int l = this.world.getTypeId(j, i, k);
+
+ if (BlockMinecartTrackAbstract.d_(l)) {
+ int i1 = this.world.getData(j, i, k);
+
+ this.a(j, i, k, d4, d5, l, i1);
+ if (l == Block.ACTIVATOR_RAIL.id) {
+ this.a(j, i, k, (i1 & 8) != 0);
+ }
+ } else {
+ this.b(d4);
+ }
+
+ this.C();
+ this.pitch = 0.0F;
+ double d6 = this.lastX - this.locX;
+ double d7 = this.lastZ - this.locZ;
+
+ if (d6 * d6 + d7 * d7 > 0.001D) {
+ this.yaw = (float) (Math.atan2(d7, d6) * 180.0D / 3.141592653589793D);
+ if (this.a) {
+ this.yaw += 180.0F;
+ }
+ }
+
+ double d8 = (double) MathHelper.g(this.yaw - this.lastYaw);
+
+ if (d8 < -170.0D || d8 >= 170.0D) {
+ this.yaw += 180.0F;
+ this.a = !this.a;
+ }
+
+ this.b(this.yaw, this.pitch);
+
+ // CraftBukkit start
+ org.bukkit.World bworld = this.world.getWorld();
+ Location from = new Location(bworld, prevX, prevY, prevZ, prevYaw, prevPitch);
+ Location to = new Location(bworld, this.locX, this.locY, this.locZ, this.yaw, this.pitch);
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+
+ this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleUpdateEvent(vehicle));
+
+ if (!from.equals(to)) {
+ this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleMoveEvent(vehicle, from, to));
+ }
+ // CraftBukkit end
+
+ List list = this.world.getEntities(this, this.boundingBox.grow(0.20000000298023224D, 0.0D, 0.20000000298023224D));
+
+ if (list != null && !list.isEmpty()) {
+ for (int j1 = 0; j1 < list.size(); ++j1) {
+ Entity entity = (Entity) list.get(j1);
+
+ if (entity != this.passenger && entity.L() && entity instanceof EntityMinecartAbstract) {
+ entity.collide(this);
+ }
+ }
+ }
+
+ if (this.passenger != null && this.passenger.dead) {
+ if (this.passenger.vehicle == this) {
+ this.passenger.vehicle = null;
+ }
+
+ this.passenger = null;
+ }
+ }
+ }
+
+ public void a(int i, int j, int k, boolean flag) {}
+
+ protected void b(double d0) {
+ if (this.motX < -d0) {
+ this.motX = -d0;
+ }
+
+ if (this.motX > d0) {
+ this.motX = d0;
+ }
+
+ if (this.motZ < -d0) {
+ this.motZ = -d0;
+ }
+
+ if (this.motZ > d0) {
+ this.motZ = d0;
+ }
+
+ if (this.onGround) {
+ // CraftBukkit start
+ this.motX *= this.derailedX;
+ this.motY *= this.derailedY;
+ this.motZ *= this.derailedZ;
+ // CraftBukkit end
+ }
+
+ this.move(this.motX, this.motY, this.motZ);
+ if (!this.onGround) {
+ // CraftBukkit start
+ this.motX *= this.flyingX;
+ this.motY *= this.flyingY;
+ this.motZ *= this.flyingZ;
+ // CraftBukkit end
+ }
+ }
+
+ protected void a(int i, int j, int k, double d0, double d1, int l, int i1) {
+ this.fallDistance = 0.0F;
+ Vec3D vec3d = this.a(this.locX, this.locY, this.locZ);
+
+ this.locY = (double) j;
+ boolean flag = false;
+ boolean flag1 = false;
+
+ if (l == Block.GOLDEN_RAIL.id) {
+ flag = (i1 & 8) != 0;
+ flag1 = !flag;
+ }
+
+ if (((BlockMinecartTrackAbstract) Block.byId[l]).e()) {
+ i1 &= 7;
+ }
+
+ if (i1 >= 2 && i1 <= 5) {
+ this.locY = (double) (j + 1);
+ }
+
+ if (i1 == 2) {
+ this.motX -= d1;
+ }
+
+ if (i1 == 3) {
+ this.motX += d1;
+ }
+
+ if (i1 == 4) {
+ this.motZ += d1;
+ }
+
+ if (i1 == 5) {
+ this.motZ -= d1;
+ }
+
+ int[][] aint = matrix[i1];
+ double d2 = (double) (aint[1][0] - aint[0][0]);
+ double d3 = (double) (aint[1][2] - aint[0][2]);
+ double d4 = Math.sqrt(d2 * d2 + d3 * d3);
+ double d5 = this.motX * d2 + this.motZ * d3;
+
+ if (d5 < 0.0D) {
+ d2 = -d2;
+ d3 = -d3;
+ }
+
+ double d6 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
+
+ if (d6 > 2.0D) {
+ d6 = 2.0D;
+ }
+
+ this.motX = d6 * d2 / d4;
+ this.motZ = d6 * d3 / d4;
+ double d7;
+ double d8;
+
+ if (this.passenger != null) {
+ d7 = this.passenger.motX * this.passenger.motX + this.passenger.motZ * this.passenger.motZ;
+ d8 = this.motX * this.motX + this.motZ * this.motZ;
+ if (d7 > 1.0E-4D && d8 < 0.01D) {
+ this.motX += this.passenger.motX * 0.1D;
+ this.motZ += this.passenger.motZ * 0.1D;
+ flag1 = false;
+ }
+ }
+
+ if (flag1) {
+ d7 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
+ if (d7 < 0.03D) {
+ this.motX *= 0.0D;
+ this.motY *= 0.0D;
+ this.motZ *= 0.0D;
+ } else {
+ this.motX *= 0.5D;
+ this.motY *= 0.0D;
+ this.motZ *= 0.5D;
+ }
+ }
+
+ d7 = 0.0D;
+ d8 = (double) i + 0.5D + (double) aint[0][0] * 0.5D;
+ double d9 = (double) k + 0.5D + (double) aint[0][2] * 0.5D;
+ double d10 = (double) i + 0.5D + (double) aint[1][0] * 0.5D;
+ double d11 = (double) k + 0.5D + (double) aint[1][2] * 0.5D;
+
+ d2 = d10 - d8;
+ d3 = d11 - d9;
+ double d12;
+ double d13;
+
+ if (d2 == 0.0D) {
+ this.locX = (double) i + 0.5D;
+ d7 = this.locZ - (double) k;
+ } else if (d3 == 0.0D) {
+ this.locZ = (double) k + 0.5D;
+ d7 = this.locX - (double) i;
+ } else {
+ d12 = this.locX - d8;
+ d13 = this.locZ - d9;
+ d7 = (d12 * d2 + d13 * d3) * 2.0D;
+ }
+
+ this.locX = d8 + d2 * d7;
+ this.locZ = d9 + d3 * d7;
+ this.setPosition(this.locX, this.locY + (double) this.height, this.locZ);
+ d12 = this.motX;
+ d13 = this.motZ;
+ if (this.passenger != null) {
+ d12 *= 0.75D;
+ d13 *= 0.75D;
+ }
+
+ if (d12 < -d0) {
+ d12 = -d0;
+ }
+
+ if (d12 > d0) {
+ d12 = d0;
+ }
+
+ if (d13 < -d0) {
+ d13 = -d0;
+ }
+
+ if (d13 > d0) {
+ d13 = d0;
+ }
+
+ this.move(d12, 0.0D, d13);
+ if (aint[0][1] != 0 && MathHelper.floor(this.locX) - i == aint[0][0] && MathHelper.floor(this.locZ) - k == aint[0][2]) {
+ this.setPosition(this.locX, this.locY + (double) aint[0][1], this.locZ);
+ } else if (aint[1][1] != 0 && MathHelper.floor(this.locX) - i == aint[1][0] && MathHelper.floor(this.locZ) - k == aint[1][2]) {
+ this.setPosition(this.locX, this.locY + (double) aint[1][1], this.locZ);
+ }
+
+ this.h();
+ Vec3D vec3d1 = this.a(this.locX, this.locY, this.locZ);
+
+ if (vec3d1 != null && vec3d != null) {
+ double d14 = (vec3d.d - vec3d1.d) * 0.05D;
+
+ d6 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
+ if (d6 > 0.0D) {
+ this.motX = this.motX / d6 * (d6 + d14);
+ this.motZ = this.motZ / d6 * (d6 + d14);
+ }
+
+ this.setPosition(this.locX, vec3d1.d, this.locZ);
+ }
+
+ int j1 = MathHelper.floor(this.locX);
+ int k1 = MathHelper.floor(this.locZ);
+
+ if (j1 != i || k1 != k) {
+ d6 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
+ this.motX = d6 * (double) (j1 - i);
+ this.motZ = d6 * (double) (k1 - k);
+ }
+
+ if (flag) {
+ double d15 = Math.sqrt(this.motX * this.motX + this.motZ * this.motZ);
+
+ if (d15 > 0.01D) {
+ double d16 = 0.06D;
+
+ this.motX += this.motX / d15 * d16;
+ this.motZ += this.motZ / d15 * d16;
+ } else if (i1 == 1) {
+ if (this.world.u(i - 1, j, k)) {
+ this.motX = 0.02D;
+ } else if (this.world.u(i + 1, j, k)) {
+ this.motX = -0.02D;
+ }
+ } else if (i1 == 0) {
+ if (this.world.u(i, j, k - 1)) {
+ this.motZ = 0.02D;
+ } else if (this.world.u(i, j, k + 1)) {
+ this.motZ = -0.02D;
+ }
+ }
+ }
+ }
+
+ protected void h() {
+ if (this.passenger != null || !this.slowWhenEmpty) { // CraftBukkit
+ this.motX *= 0.996999979019165D;
+ this.motY *= 0.0D;
+ this.motZ *= 0.996999979019165D;
+ } else {
+ this.motX *= 0.9599999785423279D;
+ this.motY *= 0.0D;
+ this.motZ *= 0.9599999785423279D;
+ }
+ }
+
+ public Vec3D a(double d0, double d1, double d2) {
+ int i = MathHelper.floor(d0);
+ int j = MathHelper.floor(d1);
+ int k = MathHelper.floor(d2);
+
+ if (BlockMinecartTrackAbstract.d_(this.world, i, j - 1, k)) {
+ --j;
+ }
+
+ int l = this.world.getTypeId(i, j, k);
+
+ if (BlockMinecartTrackAbstract.d_(l)) {
+ int i1 = this.world.getData(i, j, k);
+
+ d1 = (double) j;
+ if (((BlockMinecartTrackAbstract) Block.byId[l]).e()) {
+ i1 &= 7;
+ }
+
+ if (i1 >= 2 && i1 <= 5) {
+ d1 = (double) (j + 1);
+ }
+
+ int[][] aint = matrix[i1];
+ double d3 = 0.0D;
+ double d4 = (double) i + 0.5D + (double) aint[0][0] * 0.5D;
+ double d5 = (double) j + 0.5D + (double) aint[0][1] * 0.5D;
+ double d6 = (double) k + 0.5D + (double) aint[0][2] * 0.5D;
+ double d7 = (double) i + 0.5D + (double) aint[1][0] * 0.5D;
+ double d8 = (double) j + 0.5D + (double) aint[1][1] * 0.5D;
+ double d9 = (double) k + 0.5D + (double) aint[1][2] * 0.5D;
+ double d10 = d7 - d4;
+ double d11 = (d8 - d5) * 2.0D;
+ double d12 = d9 - d6;
+
+ if (d10 == 0.0D) {
+ d0 = (double) i + 0.5D;
+ d3 = d2 - (double) k;
+ } else if (d12 == 0.0D) {
+ d2 = (double) k + 0.5D;
+ d3 = d0 - (double) i;
+ } else {
+ double d13 = d0 - d4;
+ double d14 = d2 - d6;
+
+ d3 = (d13 * d10 + d14 * d12) * 2.0D;
+ }
+
+ d0 = d4 + d10 * d3;
+ d1 = d5 + d11 * d3;
+ d2 = d6 + d12 * d3;
+ if (d11 < 0.0D) {
+ ++d1;
+ }
+
+ if (d11 > 0.0D) {
+ d1 += 0.5D;
+ }
+
+ return this.world.getVec3DPool().create(d0, d1, d2);
+ } else {
+ return null;
+ }
+ }
+
+ protected void a(NBTTagCompound nbttagcompound) {
+ if (nbttagcompound.getBoolean("CustomDisplayTile")) {
+ this.k(nbttagcompound.getInt("DisplayTile"));
+ this.l(nbttagcompound.getInt("DisplayData"));
+ this.m(nbttagcompound.getInt("DisplayOffset"));
+ }
+
+ if (nbttagcompound.hasKey("CustomName") && nbttagcompound.getString("CustomName").length() > 0) {
+ this.c = nbttagcompound.getString("CustomName");
+ }
+ }
+
+ protected void b(NBTTagCompound nbttagcompound) {
+ if (this.s()) {
+ nbttagcompound.setBoolean("CustomDisplayTile", true);
+ nbttagcompound.setInt("DisplayTile", this.m() == null ? 0 : this.m().id);
+ nbttagcompound.setInt("DisplayData", this.o());
+ nbttagcompound.setInt("DisplayOffset", this.q());
+ }
+
+ if (this.c != null && this.c.length() > 0) {
+ nbttagcompound.setString("CustomName", this.c);
+ }
+ }
+
+ public void collide(Entity entity) {
+ if (!this.world.isStatic) {
+ if (entity != this.passenger) {
+ // CraftBukkit start
+ Vehicle vehicle = (Vehicle) this.getBukkitEntity();
+ org.bukkit.entity.Entity hitEntity = (entity == null) ? null : entity.getBukkitEntity();
+
+ VehicleEntityCollisionEvent collisionEvent = new VehicleEntityCollisionEvent(vehicle, hitEntity);
+ this.world.getServer().getPluginManager().callEvent(collisionEvent);
+
+ if (collisionEvent.isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
+
+ if (entity instanceof EntityLiving && !(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && this.getType() == 0 && this.motX * this.motX + this.motZ * this.motZ > 0.01D && this.passenger == null && entity.vehicle == null) {
+ entity.mount(this);
+ }
+
+ double d0 = entity.locX - this.locX;
+ double d1 = entity.locZ - this.locZ;
+ double d2 = d0 * d0 + d1 * d1;
+
+ // CraftBukkit - collision
+ if (d2 >= 9.999999747378752E-5D && !collisionEvent.isCollisionCancelled()) {
+ d2 = (double) MathHelper.sqrt(d2);
+ d0 /= d2;
+ d1 /= d2;
+ double d3 = 1.0D / d2;
+
+ if (d3 > 1.0D) {
+ d3 = 1.0D;
+ }
+
+ d0 *= d3;
+ d1 *= d3;
+ d0 *= 0.10000000149011612D;
+ d1 *= 0.10000000149011612D;
+ d0 *= (double) (1.0F - this.aa);
+ d1 *= (double) (1.0F - this.aa);
+ d0 *= 0.5D;
+ d1 *= 0.5D;
+ if (entity instanceof EntityMinecartAbstract) {
+ double d4 = entity.locX - this.locX;
+ double d5 = entity.locZ - this.locZ;
+ Vec3D vec3d = this.world.getVec3DPool().create(d4, 0.0D, d5).a();
+ Vec3D vec3d1 = this.world.getVec3DPool().create((double) MathHelper.cos(this.yaw * 3.1415927F / 180.0F), 0.0D, (double) MathHelper.sin(this.yaw * 3.1415927F / 180.0F)).a();
+ double d6 = Math.abs(vec3d.b(vec3d1));
+
+ if (d6 < 0.800000011920929D) {
+ return;
+ }
+
+ double d7 = entity.motX + this.motX;
+ double d8 = entity.motZ + this.motZ;
+
+ if (((EntityMinecartAbstract) entity).getType() == 2 && this.getType() != 2) {
+ this.motX *= 0.20000000298023224D;
+ this.motZ *= 0.20000000298023224D;
+ this.g(entity.motX - d0, 0.0D, entity.motZ - d1);
+ entity.motX *= 0.949999988079071D;
+ entity.motZ *= 0.949999988079071D;
+ } else if (((EntityMinecartAbstract) entity).getType() != 2 && this.getType() == 2) {
+ entity.motX *= 0.20000000298023224D;
+ entity.motZ *= 0.20000000298023224D;
+ entity.g(this.motX + d0, 0.0D, this.motZ + d1);
+ this.motX *= 0.949999988079071D;
+ this.motZ *= 0.949999988079071D;
+ } else {
+ d7 /= 2.0D;
+ d8 /= 2.0D;
+ this.motX *= 0.20000000298023224D;
+ this.motZ *= 0.20000000298023224D;
+ this.g(d7 - d0, 0.0D, d8 - d1);
+ entity.motX *= 0.20000000298023224D;
+ entity.motZ *= 0.20000000298023224D;
+ entity.g(d7 + d0, 0.0D, d8 + d1);
+ }
+ } else {
+ this.g(-d0, 0.0D, -d1);
+ entity.g(d0 / 4.0D, 0.0D, d1 / 4.0D);
+ }
+ }
+ }
+ }
+ }
+
+ public void setDamage(int i) {
+ this.datawatcher.watch(19, Integer.valueOf(i));
+ }
+
+ public int getDamage() {
+ return this.datawatcher.getInt(19);
+ }
+
+ public void i(int i) {
+ this.datawatcher.watch(17, Integer.valueOf(i));
+ }
+
+ public int j() {
+ return this.datawatcher.getInt(17);
+ }
+
+ public void j(int i) {
+ this.datawatcher.watch(18, Integer.valueOf(i));
+ }
+
+ public int k() {
+ return this.datawatcher.getInt(18);
+ }
+
+ public abstract int getType();
+
+ public Block m() {
+ if (!this.s()) {
+ return this.n();
+ } else {
+ int i = this.getDataWatcher().getInt(20) & '\uffff';
+
+ return i > 0 && i < Block.byId.length ? Block.byId[i] : null;
+ }
+ }
+
+ public Block n() {
+ return null;
+ }
+
+ public int o() {
+ return !this.s() ? this.p() : this.getDataWatcher().getInt(20) >> 16;
+ }
+
+ public int p() {
+ return 0;
+ }
+
+ public int q() {
+ return !this.s() ? this.r() : this.getDataWatcher().getInt(21);
+ }
+
+ public int r() {
+ return 6;
+ }
+
+ public void k(int i) {
+ this.getDataWatcher().watch(20, Integer.valueOf(i & '\uffff' | this.o() << 16));
+ this.a(true);
+ }
+
+ public void l(int i) {
+ Block block = this.m();
+ int j = block == null ? 0 : block.id;
+
+ this.getDataWatcher().watch(20, Integer.valueOf(j & '\uffff' | i << 16));
+ this.a(true);
+ }
+
+ public void m(int i) {
+ this.getDataWatcher().watch(21, Integer.valueOf(i));
+ this.a(true);
+ }
+
+ public boolean s() {
+ return this.getDataWatcher().getByte(22) == 1;
+ }
+
+ public void a(boolean flag) {
+ this.getDataWatcher().watch(22, Byte.valueOf((byte) (flag ? 1 : 0)));
+ }
+
+ public void a(String s) {
+ this.c = s;
+ }
+
+ public String getLocalizedName() {
+ return this.c != null ? this.c : super.getLocalizedName();
+ }
+
+ public boolean c() {
+ return this.c != null;
+ }
+
+ public String t() {
+ return this.c;
+ }
+
+ // CraftBukkit start - methods for getting and setting flying and derailed velocity modifiers
+ public Vector getFlyingVelocityMod() {
+ return new Vector(flyingX, flyingY, flyingZ);
+ }
+
+ public void setFlyingVelocityMod(Vector flying) {
+ flyingX = flying.getX();
+ flyingY = flying.getY();
+ flyingZ = flying.getZ();
+ }
+
+ public Vector getDerailedVelocityMod() {
+ return new Vector(derailedX, derailedY, derailedZ);
+ }
+
+ public void setDerailedVelocityMod(Vector derailed) {
+ derailedX = derailed.getX();
+ derailedY = derailed.getY();
+ derailedZ = derailed.getZ();
+ }
+ // CraftBukkit end
+}
diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
new file mode 100644
index 00000000..e7398f8d
--- /dev/null
+++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
@@ -0,0 +1,236 @@
+package net.minecraft.server;
+
+// CraftBukkit start
+import java.util.List;
+
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
+
+public abstract class EntityMinecartContainer extends EntityMinecartAbstract implements IInventory {
+
+ private ItemStack[] items = new ItemStack[36];
+ private boolean b = true;
+
+ // CraftBukkit start
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ private int maxStack = MAX_STACK;
+
+ public ItemStack[] getContents() {
+ return this.items;
+ }
+
+ public void onOpen(CraftHumanEntity who) {
+ transaction.add(who);
+ }
+
+ public void onClose(CraftHumanEntity who) {
+ transaction.remove(who);
+ }
+
+ public List<HumanEntity> getViewers() {
+ return transaction;
+ }
+
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ }
+ // CraftBukkit end
+
+ public EntityMinecartContainer(World world) {
+ super(world);
+ }
+
+ public EntityMinecartContainer(World world, double d0, double d1, double d2) {
+ super(world, d0, d1, d2);
+ }
+
+ public void a(DamageSource damagesource) {
+ super.a(damagesource);
+
+ for (int i = 0; i < this.getSize(); ++i) {
+ ItemStack itemstack = this.getItem(i);
+
+ if (itemstack != null) {
+ float f = this.random.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.random.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.random.nextFloat() * 0.8F + 0.1F;
+
+ while (itemstack.count > 0) {
+ int j = this.random.nextInt(21) + 10;
+
+ if (j > itemstack.count) {
+ j = itemstack.count;
+ }
+
+ itemstack.count -= j;
+ EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, j, itemstack.getData()));
+ float f3 = 0.05F;
+
+ entityitem.motX = (double) ((float) this.random.nextGaussian() * f3);
+ entityitem.motY = (double) ((float) this.random.nextGaussian() * f3 + 0.2F);
+ entityitem.motZ = (double) ((float) this.random.nextGaussian() * f3);
+ this.world.addEntity(entityitem);
+ }
+ }
+ }
+ }
+
+ public ItemStack getItem(int i) {
+ return this.items[i];
+ }
+
+ public ItemStack splitStack(int i, int j) {
+ if (this.items[i] != null) {
+ ItemStack itemstack;
+
+ if (this.items[i].count <= j) {
+ itemstack = this.items[i];
+ this.items[i] = null;
+ return itemstack;
+ } else {
+ itemstack = this.items[i].a(j);
+ if (this.items[i].count == 0) {
+ this.items[i] = null;
+ }
+
+ return itemstack;
+ }
+ } else {
+ return null;
+ }
+ }
+
+ public ItemStack splitWithoutUpdate(int i) {
+ if (this.items[i] != null) {
+ ItemStack itemstack = this.items[i];
+
+ this.items[i] = null;
+ return itemstack;
+ } else {
+ return null;
+ }
+ }
+
+ public void setItem(int i, ItemStack itemstack) {
+ this.items[i] = itemstack;
+ if (itemstack != null && itemstack.count > this.getMaxStackSize()) {
+ itemstack.count = this.getMaxStackSize();
+ }
+ }
+
+ public void update() {}
+
+ public boolean a(EntityHuman entityhuman) {
+ return this.dead ? false : entityhuman.e(this) <= 64.0D;
+ }
+
+ public void startOpen() {}
+
+ public void g() {}
+
+ public boolean b(int i, ItemStack itemstack) {
+ return true;
+ }
+
+ public String getName() {
+ return this.c() ? this.t() : "container.minecart";
+ }
+
+ public int getMaxStackSize() {
+ return 64;
+ }
+
+ public void c(int i) {
+ this.b = false;
+ super.c(i);
+ }
+
+ public void die() {
+ if (this.b) {
+ for (int i = 0; i < this.getSize(); ++i) {
+ ItemStack itemstack = this.getItem(i);
+
+ if (itemstack != null) {
+ float f = this.random.nextFloat() * 0.8F + 0.1F;
+ float f1 = this.random.nextFloat() * 0.8F + 0.1F;
+ float f2 = this.random.nextFloat() * 0.8F + 0.1F;
+
+ while (itemstack.count > 0) {
+ int j = this.random.nextInt(21) + 10;
+
+ if (j > itemstack.count) {
+ j = itemstack.count;
+ }
+
+ itemstack.count -= j;
+ EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, j, itemstack.getData()));
+
+ if (itemstack.hasTag()) {
+ entityitem.getItemStack().setTag((NBTTagCompound) itemstack.getTag().clone());
+ }
+
+ float f3 = 0.05F;
+
+ entityitem.motX = (double) ((float) this.random.nextGaussian() * f3);
+ entityitem.motY = (double) ((float) this.random.nextGaussian() * f3 + 0.2F);
+ entityitem.motZ = (double) ((float) this.random.nextGaussian() * f3);
+ this.world.addEntity(entityitem);
+ }
+ }
+ }
+ }
+
+ super.die();
+ }
+
+ protected void b(NBTTagCompound nbttagcompound) {
+ super.b(nbttagcompound);
+ NBTTagList nbttaglist = new NBTTagList();
+
+ for (int i = 0; i < this.items.length; ++i) {
+ if (this.items[i] != null) {
+ NBTTagCompound nbttagcompound1 = new NBTTagCompound();
+
+ nbttagcompound1.setByte("Slot", (byte) i);
+ this.items[i].save(nbttagcompound1);
+ nbttaglist.add(nbttagcompound1);
+ }
+ }
+
+ nbttagcompound.set("Items", nbttaglist);
+ }
+
+ protected void a(NBTTagCompound nbttagcompound) {
+ super.a(nbttagcompound);
+ NBTTagList nbttaglist = nbttagcompound.getList("Items");
+
+ this.items = new ItemStack[this.getSize()];
+
+ for (int i = 0; i < nbttaglist.size(); ++i) {
+ NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
+ int j = nbttagcompound1.getByte("Slot") & 255;
+
+ if (j >= 0 && j < this.items.length) {
+ this.items[j] = ItemStack.createStack(nbttagcompound1);
+ }
+ }
+ }
+
+ public boolean a_(EntityHuman entityhuman) {
+ if (!this.world.isStatic) {
+ entityhuman.openContainer(this);
+ }
+
+ return true;
+ }
+
+ protected void h() {
+ int i = 15 - Container.b((IInventory) this);
+ float f = 0.98F + (float) i * 0.001F;
+
+ this.motX *= (double) f;
+ this.motY *= 0.0D;
+ this.motZ *= (double) f;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java
index 2b39bbf6..ecace082 100644
--- a/src/main/java/net/minecraft/server/EntityMonster.java
+++ b/src/main/java/net/minecraft/server/EntityMonster.java
@@ -6,22 +6,22 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
public EntityMonster(World world) {
super(world);
- this.bd = 5;
+ this.be = 5;
}
public void c() {
- this.bo();
+ this.br();
float f = this.c(1.0F);
if (f > 0.5F) {
- this.bB += 2;
+ this.bC += 2;
}
super.c();
}
- public void j_() {
- super.j_();
+ public void l_() {
+ super.l_();
if (!this.world.isStatic && this.world.difficulty == 0) {
this.die();
}
@@ -116,7 +116,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
public float a(int i, int j, int k) {
- return 0.5F - this.world.p(i, j, k);
+ return 0.5F - this.world.q(i, j, k);
}
protected boolean i_() {
@@ -129,7 +129,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
} else {
int l = this.world.getLightLevel(i, j, k);
- if (this.world.M()) {
+ if (this.world.N()) {
int i1 = this.world.j;
this.world.j = 10;
diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java
index 29fdc834..3f22c9fc 100644
--- a/src/main/java/net/minecraft/server/EntityMushroomCow.java
+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java
@@ -10,7 +10,7 @@ public class EntityMushroomCow extends EntityCow {
this.a(0.9F, 1.3F);
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.BOWL.id && this.getAge() >= 0) {
@@ -42,7 +42,7 @@ public class EntityMushroomCow extends EntityCow {
entitycow.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
entitycow.setHealth(this.getHealth());
- entitycow.ax = this.ax;
+ entitycow.ay = this.ay;
this.world.addEntity(entitycow);
for (int i = 0; i < 5; ++i) {
@@ -52,7 +52,7 @@ public class EntityMushroomCow extends EntityCow {
return true;
} else {
- return super.a(entityhuman);
+ return super.a_(entityhuman);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java
index 68b08ae7..48d311f1 100644
--- a/src/main/java/net/minecraft/server/EntityOcelot.java
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java
@@ -28,7 +28,7 @@ public class EntityOcelot extends EntityTameableAnimal {
this.datawatcher.a(18, Byte.valueOf((byte) 0));
}
- public void bm() {
+ public void bp() {
if (this.getControllerMove().a()) {
float f = this.getControllerMove().b();
@@ -52,7 +52,7 @@ public class EntityOcelot extends EntityTameableAnimal {
return !this.isTamed();
}
- public boolean be() {
+ public boolean bh() {
return true;
}
@@ -72,19 +72,19 @@ public class EntityOcelot extends EntityTameableAnimal {
this.setCatType(nbttagcompound.getInt("CatType"));
}
- protected String aY() {
+ protected String bb() {
return this.isTamed() ? (this.r() ? "mob.cat.purr" : (this.random.nextInt(4) == 0 ? "mob.cat.purreow" : "mob.cat.meow")) : "";
}
- protected String aZ() {
+ protected String bc() {
return "mob.cat.hitt";
}
- protected String ba() {
+ protected String bd() {
return "mob.cat.hitt";
}
- protected float aX() {
+ protected float ba() {
return 0.4F;
}
@@ -109,7 +109,7 @@ public class EntityOcelot extends EntityTameableAnimal {
org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this); // CraftBukkit - Call EntityDeathEvent
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (this.isTamed()) {
@@ -131,11 +131,11 @@ public class EntityOcelot extends EntityTameableAnimal {
this.setTamed(true);
this.setCatType(1 + this.world.random.nextInt(3));
this.setOwnerName(entityhuman.name);
- this.f(true);
+ this.i(true);
this.d.setSitting(true);
this.world.broadcastEntityEffect(this, (byte) 7);
} else {
- this.f(false);
+ this.i(false);
this.world.broadcastEntityEffect(this, (byte) 6);
}
}
@@ -143,7 +143,7 @@ public class EntityOcelot extends EntityTameableAnimal {
return true;
}
- return super.a(entityhuman);
+ return super.a_(entityhuman);
}
public EntityOcelot b(EntityAgeable entityageable) {
@@ -209,10 +209,10 @@ public class EntityOcelot extends EntityTameableAnimal {
}
public String getLocalizedName() {
- return this.isTamed() ? "entity.Cat.name" : super.getLocalizedName();
+ return this.hasCustomName() ? this.getCustomName() : (this.isTamed() ? "entity.Cat.name" : super.getLocalizedName());
}
- public void bG() {
+ public void bJ() {
if (this.world.random.nextInt(7) == 0) {
for (int i = 0; i < 2; ++i) {
EntityOcelot entityocelot = new EntityOcelot(this.world);
diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java
index c1ee3638..e9fe7cff 100644
--- a/src/main/java/net/minecraft/server/EntityPig.java
+++ b/src/main/java/net/minecraft/server/EntityPig.java
@@ -25,7 +25,7 @@ public class EntityPig extends EntityAnimal {
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
}
- public boolean be() {
+ public boolean bh() {
return true;
}
@@ -33,12 +33,12 @@ public class EntityPig extends EntityAnimal {
return 10;
}
- protected void bl() {
- super.bl();
+ protected void bo() {
+ super.bo();
}
- public boolean bI() {
- ItemStack itemstack = ((EntityHuman) this.passenger).bD();
+ public boolean bL() {
+ ItemStack itemstack = ((EntityHuman) this.passenger).bG();
return itemstack != null && itemstack.id == Item.CARROT_STICK.id;
}
@@ -58,15 +58,15 @@ public class EntityPig extends EntityAnimal {
this.setSaddle(nbttagcompound.getBoolean("Saddle"));
}
- protected String aY() {
+ protected String bb() {
return "mob.pig.say";
}
- protected String aZ() {
+ protected String bc() {
return "mob.pig.say";
}
- protected String ba() {
+ protected String bd() {
return "mob.pig.death";
}
@@ -74,8 +74,8 @@ public class EntityPig extends EntityAnimal {
this.makeSound("mob.pig.step", 0.15F, 1.0F);
}
- public boolean a(EntityHuman entityhuman) {
- if (super.a(entityhuman)) {
+ public boolean a_(EntityHuman entityhuman) {
+ if (super.a_(entityhuman)) {
return true;
} else if (this.hasSaddle() && !this.world.isStatic && (this.passenger == null || this.passenger == entityhuman)) {
entityhuman.mount(this);
diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java
index 3a07b622..b6262158 100644
--- a/src/main/java/net/minecraft/server/EntityPigZombie.java
+++ b/src/main/java/net/minecraft/server/EntityPigZombie.java
@@ -15,21 +15,21 @@ public class EntityPigZombie extends EntityZombie {
public EntityPigZombie(World world) {
super(world);
this.texture = "/mob/pigzombie.png";
- this.bH = 0.5F;
+ this.bI = 0.5F;
this.fireProof = true;
}
- protected boolean be() {
+ protected boolean bh() {
return false;
}
- public void j_() {
- this.bH = this.target != null ? 0.95F : 0.5F;
+ public void l_() {
+ this.bI = this.target != null ? 0.95F : 0.5F;
if (this.soundDelay > 0 && --this.soundDelay == 0) {
- this.makeSound("mob.zombiepig.zpigangry", this.aX() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
+ this.makeSound("mob.zombiepig.zpigangry", this.ba() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
}
- super.j_();
+ super.l_();
}
public boolean canSpawn() {
@@ -99,15 +99,15 @@ public class EntityPigZombie extends EntityZombie {
this.soundDelay = this.random.nextInt(40);
}
- protected String aY() {
+ protected String bb() {
return "mob.zombiepig.zpig";
}
- protected String aZ() {
+ protected String bc() {
return "mob.zombiepig.zpighurt";
}
- protected String ba() {
+ protected String bd() {
return "mob.zombiepig.zpigdeath";
}
@@ -142,7 +142,7 @@ public class EntityPigZombie extends EntityZombie {
// CraftBukkit end
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
return false;
}
@@ -155,17 +155,17 @@ public class EntityPigZombie extends EntityZombie {
return Item.ROTTEN_FLESH.id;
}
- protected void bE() {
+ protected void bH() {
this.setEquipment(0, new ItemStack(Item.GOLD_SWORD));
}
- public void bG() {
- super.bG();
+ public void bJ() {
+ super.bJ();
this.setVillager(false);
}
public int c(Entity entity) {
- ItemStack itemstack = this.bD();
+ ItemStack itemstack = this.bG();
int i = 5;
if (itemstack != null) {
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 8d61ca63..52fd5612 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -4,6 +4,8 @@ import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -28,14 +30,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public double e;
public final List chunkCoordIntPairQueue = new LinkedList();
public final List removeQueue = new LinkedList();
- private int cl = -99999999;
private int cm = -99999999;
- private boolean cn = true;
+ private int cn = -99999999;
+ private boolean co = true;
public int lastSentExp = -99999999; // CraftBukkit - private -> public
public int invulnerableTicks = 60; // CraftBukkit - private -> public
- private int cq = 0;
private int cr = 0;
- private boolean cs = true;
+ private int cs = 0;
+ private boolean ct = true;
private int containerCounter = 0;
public boolean h;
public int ping;
@@ -54,7 +56,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
super(world);
playerinteractmanager.player = this;
this.playerInteractManager = playerinteractmanager;
- this.cq = minecraftserver.getPlayerList().o();
+ this.cr = minecraftserver.getPlayerList().o();
ChunkCoordinates chunkcoordinates = world.getSpawn();
int i = chunkcoordinates.x;
int j = chunkcoordinates.z;
@@ -68,14 +70,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
k = world.i(i, j);
}
- this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
this.server = minecraftserver;
- this.X = 0.0F;
+ this.Y = 0.0F;
this.name = s;
this.height = 0.0F;
- this.displayName = this.name; // CraftBukkit
- this.listName = this.name; // CraftBukkit
- this.canPickUpLoot = true; // CraftBukkit
+ this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
+
+ while (!world.getCubes(this, this.boundingBox).isEmpty()) {
+ this.setPosition(this.locX, this.locY + 1.0D, this.locZ);
+ }
+
+ // CraftBukkit start
+ this.displayName = this.name;
+ this.listName = this.name;
+ this.canPickUpLoot = true;
+ // CraftBukkit end
}
public void a(NBTTagCompound nbttagcompound) {
@@ -134,7 +143,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return 1.62F;
}
- public void j_() {
+ public void l_() {
this.playerInteractManager.a();
--this.invulnerableTicks;
this.activeContainer.b();
@@ -170,7 +179,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (!arraylist.isEmpty()) {
this.playerConnection.sendPacket(new Packet56MapChunkBulk(arraylist));
-
Iterator iterator2 = arraylist1.iterator();
while (iterator2.hasNext()) {
@@ -184,50 +192,70 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
while (iterator2.hasNext()) {
Chunk chunk = (Chunk) iterator2.next();
- this.p().getTracker().a(this, chunk);
+ this.o().getTracker().a(this, chunk);
}
}
}
}
+ public void setHealth(int i) {
+ super.setHealth(i);
+ Collection collection = this.getScoreboard().a(IObjective.f);
+ Iterator iterator = collection.iterator();
+
+ while (iterator.hasNext()) {
+ ScoreboardObjective scoreboardobjective = (ScoreboardObjective) iterator.next();
+
+ this.getScoreboard().a(this.getLocalizedName(), scoreboardobjective).a(Arrays.asList(new EntityHuman[] { this}));
+ }
+ }
+
public void g() {
- super.j_();
+ try {
+ super.l_();
- for (int i = 0; i < this.inventory.getSize(); ++i) {
- ItemStack itemstack = this.inventory.getItem(i);
+ for (int i = 0; i < this.inventory.getSize(); ++i) {
+ ItemStack itemstack = this.inventory.getItem(i);
- if (itemstack != null && Item.byId[itemstack.id].f() && this.playerConnection.lowPriorityCount() <= 5) {
- Packet packet = ((ItemWorldMapBase) Item.byId[itemstack.id]).c(itemstack, this.world, this);
+ if (itemstack != null && Item.byId[itemstack.id].f() && this.playerConnection.lowPriorityCount() <= 5) {
+ Packet packet = ((ItemWorldMapBase) Item.byId[itemstack.id]).c(itemstack, this.world, this);
- if (packet != null) {
- this.playerConnection.sendPacket(packet);
+ if (packet != null) {
+ this.playerConnection.sendPacket(packet);
+ }
}
}
- }
- if (this.getHealth() != this.cl || this.cm != this.foodData.a() || this.foodData.e() == 0.0F != this.cn) {
- // CraftBukkit - this.getHealth() -> this.getScaledHealth()
- this.playerConnection.sendPacket(new Packet8UpdateHealth(this.getScaledHealth(), this.foodData.a(), this.foodData.e()));
- this.cl = this.getHealth();
- this.cm = this.foodData.a();
- this.cn = this.foodData.e() == 0.0F;
- }
+ if (this.getHealth() != this.cm || this.cn != this.foodData.a() || this.foodData.e() == 0.0F != this.co) {
+ // CraftBukkit - this.getHealth() -> this.getScaledHealth()
+ this.playerConnection.sendPacket(new Packet8UpdateHealth(this.getScaledHealth(), this.foodData.a(), this.foodData.e()));
+ this.cm = this.getHealth();
+ this.cn = this.foodData.a();
+ this.co = this.foodData.e() == 0.0F;
+ }
- if (this.expTotal != this.lastSentExp) {
- this.lastSentExp = this.expTotal;
- this.playerConnection.sendPacket(new Packet43SetExperience(this.exp, this.expTotal, this.expLevel));
- }
+ if (this.expTotal != this.lastSentExp) {
+ this.lastSentExp = this.expTotal;
+ this.playerConnection.sendPacket(new Packet43SetExperience(this.exp, this.expTotal, this.expLevel));
+ }
- // CraftBukkit start
- if (this.oldLevel == -1) {
- this.oldLevel = this.expLevel;
- }
+ // CraftBukkit start
+ if (this.oldLevel == -1) {
+ this.oldLevel = this.expLevel;
+ }
+
+ if (this.oldLevel != this.expLevel) {
+ CraftEventFactory.callPlayerLevelChangeEvent(this.world.getServer().getPlayer((EntityPlayer) this), this.oldLevel, this.expLevel);
+ this.oldLevel = this.expLevel;
+ }
+ // CraftBukkit end
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Ticking player");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked");
- if (this.oldLevel != this.expLevel) {
- CraftEventFactory.callPlayerLevelChangeEvent(this.world.getServer().getPlayer((EntityPlayer) this), this.oldLevel, this.expLevel);
- this.oldLevel = this.expLevel;
+ this.a(crashreportsystemdetails);
+ throw new ReportedException(crashreport);
}
- // CraftBukkit end
}
public void die(DamageSource damagesource) {
@@ -253,7 +281,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, damagesource.getLocalizedDeathMessage(this));
+ org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, this.bt.b());
String deathMessage = event.getDeathMessage();
@@ -273,10 +301,23 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
this.closeInventory();
-
- // Update effects on player death
- this.updateEffects = true;
// CraftBukkit end
+
+ Collection collection = this.world.getScoreboard().a(IObjective.c);
+ Iterator iterator = collection.iterator();
+
+ while (iterator.hasNext()) {
+ ScoreboardObjective scoreboardobjective = (ScoreboardObjective) iterator.next();
+ ScoreboardScore scoreboardscore = this.getScoreboard().a(this.getLocalizedName(), scoreboardobjective);
+
+ scoreboardscore.a();
+ }
+
+ EntityLiving entityliving = this.bN();
+
+ if (entityliving != null) {
+ entityliving.c(this, this.aM);
+ }
}
public boolean damageEntity(DamageSource damagesource, int i) {
@@ -289,18 +330,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (!flag && this.invulnerableTicks > 0 && damagesource != DamageSource.OUT_OF_WORLD) {
return false;
} else {
- // CraftBukkit - this.server.getPvP() -> this.world.pvpMode
- if (!this.world.pvpMode && damagesource instanceof EntityDamageSource) {
+ if (damagesource instanceof EntityDamageSource) {
Entity entity = damagesource.getEntity();
- if (entity instanceof EntityHuman) {
+ if (entity instanceof EntityHuman && !this.a((EntityHuman) entity)) {
return false;
}
if (entity instanceof EntityArrow) {
EntityArrow entityarrow = (EntityArrow) entity;
- if (entityarrow.shooter instanceof EntityHuman) {
+ if (entityarrow.shooter instanceof EntityHuman && !this.a((EntityHuman) entityarrow.shooter)) {
return false;
}
}
@@ -311,11 +351,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- protected boolean h() {
- return this.server.getPvP();
+ public boolean a(EntityHuman entityhuman) {
+ // CraftBukkit - this.server.getPvP() -> this.world.pvpMode
+ return !this.world.pvpMode ? false : super.a(entityhuman);
}
- public void b(int i) {
+ public void c(int i) {
if (this.dimension == 1 && i == 1) {
this.a((Statistic) AchievementList.C);
this.world.kill(this);
@@ -329,7 +370,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
ChunkCoordinates chunkcoordinates = this.server.getWorldServer(i).getDimensionSpawn();
if (chunkcoordinates != null) {
- this.netServerHandler.a((double) chunkcoordinates.x, (double) chunkcoordinates.y, (double) chunkcoordinates.z, 0.0F, 0.0F);
+ this.playerConnection.a((double) chunkcoordinates.x, (double) chunkcoordinates.y, (double) chunkcoordinates.z, 0.0F, 0.0F);
}
i = 1;
@@ -344,8 +385,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.server.getPlayerList().changeDimension(this, i, cause);
// CraftBukkit end
this.lastSentExp = -1;
- this.cl = -1;
this.cm = -1;
+ this.cn = -1;
}
}
@@ -370,7 +411,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (enumbedresult == EnumBedResult.OK) {
Packet17EntityLocationAction packet17entitylocationaction = new Packet17EntityLocationAction(this, 0, i, j, k);
- this.p().getTracker().a((Entity) this, (Packet) packet17entitylocationaction);
+ this.o().getTracker().a((Entity) this, (Packet) packet17entitylocationaction);
this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
this.playerConnection.sendPacket(packet17entitylocationaction);
}
@@ -382,7 +423,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (this.fauxSleeping && !this.sleeping) return; // CraftBukkit - Can't leave bed if not in one!
if (this.isSleeping()) {
- this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 3));
+ this.o().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 3));
}
super.a(flag, flag1, flag2);
@@ -425,20 +466,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 1, "Crafting", 9));
+ this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 1, "Crafting", 9, true));
this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
}
- public void startEnchanting(int i, int j, int k) {
+ public void startEnchanting(int i, int j, int k, String s) {
// CraftBukkit start - inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerEnchantTable(this.inventory, this.world, i, j, k));
if(container == null) return;
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 4, "Enchanting", 9));
+ this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 4, s == null ? "" : s, 9, s != null));
this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
@@ -451,8 +492,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 8, "Repairing", 9));
- this.activeContainer = container; // CraftBukkit - use container we passed to event
+ this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 8, "Repairing", 9, true));
+ this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
}
@@ -468,8 +509,34 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 0, iinventory.getName(), iinventory.getSize()));
- this.activeContainer = container; // CraftBukkit - Use container passed to event
+ this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 0, iinventory.getName(), iinventory.getSize(), iinventory.c()));
+ this.activeContainer = container; // CraftBukkit - Use container we passed to event
+ this.activeContainer.windowId = this.containerCounter;
+ this.activeContainer.addSlotListener(this);
+ }
+
+ public void openHopper(TileEntityHopper tileentityhopper) {
+ // CraftBukkit start - inventory open hook
+ Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, tileentityhopper));
+ if(container == null) return;
+ // CraftBukkit end
+
+ this.nextContainerCounter();
+ this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 9, tileentityhopper.getName(), tileentityhopper.getSize(), tileentityhopper.c()));
+ this.activeContainer = container; // CraftBukkit - Use container we passed to event
+ this.activeContainer.windowId = this.containerCounter;
+ this.activeContainer.addSlotListener(this);
+ }
+
+ public void openMinecartHopper(EntityMinecartHopper entityminecarthopper) {
+ // CraftBukkit start - inventory open hook
+ Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHopper(this.inventory, entityminecarthopper));
+ if(container == null) return;
+ // CraftBukkit end
+
+ this.nextContainerCounter();
+ this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 9, entityminecarthopper.getName(), entityminecarthopper.getSize(), entityminecarthopper.c()));
+ this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
}
@@ -481,8 +548,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
- this.activeContainer = container; // CraftBukkit - Use container passed to event
+ this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 2, tileentityfurnace.getName(), tileentityfurnace.getSize(), tileentityfurnace.c()));
+ this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
}
@@ -494,8 +561,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 3, tileentitydispenser.getName(), tileentitydispenser.getSize()));
- this.activeContainer = container; // CraftBukkit - Use container passed to event
+ this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, tileentitydispenser instanceof TileEntityDropper ? 10 : 3, tileentitydispenser.getName(), tileentitydispenser.getSize(), tileentitydispenser.c()));
+ this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
}
@@ -507,8 +574,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 5, tileentitybrewingstand.getName(), tileentitybrewingstand.getSize()));
- this.activeContainer = container; // CraftBukkit - Use container passed to event
+ this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 5, tileentitybrewingstand.getName(), tileentitybrewingstand.getSize(), tileentitybrewingstand.c()));
+ this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
}
@@ -520,25 +587,25 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
this.nextContainerCounter();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 7, tileentitybeacon.getName(), tileentitybeacon.getSize()));
- this.activeContainer = container; // CraftBukkit - Use container passed to event
+ this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 7, tileentitybeacon.getName(), tileentitybeacon.getSize(), tileentitybeacon.c()));
+ this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
}
- public void openTrade(IMerchant imerchant) {
+ public void openTrade(IMerchant imerchant, String s) {
// CraftBukkit start - inventory open hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerMerchant(this.inventory, imerchant, this.world));
if(container == null) return;
// CraftBukkit end
this.nextContainerCounter();
- this.activeContainer = container; // CraftBukkit - Use container passed to event
+ this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.containerCounter;
this.activeContainer.addSlotListener(this);
InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).getMerchantInventory();
- this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 6, inventorymerchant.getName(), inventorymerchant.getSize()));
+ this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 6, s == null ? "" : s, inventorymerchant.getSize(), s != null));
MerchantRecipeList merchantrecipelist = imerchant.getOffers(this);
if (merchantrecipelist != null) {
@@ -583,7 +650,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void closeInventory() {
this.playerConnection.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId));
- this.k();
+ this.j();
}
public void broadcastCarriedItem() {
@@ -592,8 +659,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- public void k() {
- this.activeContainer.b(this);
+ public void j() {
+ this.activeContainer.b((EntityHuman) this);
this.activeContainer = this.defaultContainer;
}
@@ -610,11 +677,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- public void l() {
- if (this.vehicle != null) {
- this.mount(this.vehicle);
- }
-
+ public void k() {
if (this.passenger != null) {
this.passenger.mount(this);
}
@@ -625,34 +688,34 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void triggerHealthUpdate() {
- this.cl = -99999999;
+ this.cm = -99999999;
this.lastSentExp = -1; // CraftBukkit - Added to reset
}
public void b(String s) {
LocaleLanguage localelanguage = LocaleLanguage.a();
- String s1 = localelanguage.b(s);
+ String s1 = localelanguage.a(s);
this.playerConnection.sendPacket(new Packet3Chat(s1));
}
- protected void n() {
+ protected void m() {
this.playerConnection.sendPacket(new Packet38EntityStatus(this.id, (byte) 9));
- super.n();
+ super.m();
}
public void a(ItemStack itemstack, int i) {
super.a(itemstack, i);
- if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().b_(itemstack) == EnumAnimation.b) {
- this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 5));
+ if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().b_(itemstack) == EnumAnimation.EAT) {
+ this.o().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 5));
}
}
public void copyTo(EntityHuman entityhuman, boolean flag) {
super.copyTo(entityhuman, flag);
this.lastSentExp = -1;
- this.cl = -1;
this.cm = -1;
+ this.cn = -1;
this.removeQueue.addAll(((EntityPlayer) entityhuman).removeQueue);
}
@@ -676,11 +739,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void b(Entity entity) {
- this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 6));
+ this.o().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 6));
}
public void c(Entity entity) {
- this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 7));
+ this.o().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 7));
}
public void updateAbilities() {
@@ -689,7 +752,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- public WorldServer p() {
+ public WorldServer o() {
return (WorldServer) this.world;
}
@@ -706,7 +769,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return "seed".equals(s) && !this.server.T() ? true : (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) ? this.server.getPlayerList().isOp(this.name) : true);
}
- public String q() {
+ public String p() {
String s = this.playerConnection.networkManager.getSocketAddress().toString();
s = s.substring(s.indexOf("/") + 1);
@@ -716,17 +779,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(Packet204LocaleAndViewDistance packet204localeandviewdistance) {
if (this.locale.b().containsKey(packet204localeandviewdistance.d())) {
- this.locale.a(packet204localeandviewdistance.d());
+ this.locale.a(packet204localeandviewdistance.d(), false);
}
int i = 256 >> packet204localeandviewdistance.f();
if (i > 3 && i < 15) {
- this.cq = i;
+ this.cr = i;
}
- this.cr = packet204localeandviewdistance.g();
- this.cs = packet204localeandviewdistance.h();
+ this.cs = packet204localeandviewdistance.g();
+ this.ct = packet204localeandviewdistance.h();
if (this.server.I() && this.server.H().equals(this.name)) {
this.server.c(packet204localeandviewdistance.i());
}
@@ -739,7 +802,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public int getChatFlags() {
- return this.cr;
+ return this.cs;
}
public void a(String s, int i) {
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
index 7e8122dd..85ca93d3 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
@@ -80,11 +80,11 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
this.i = 0;
}
- public void j_() {
- this.T = this.locX;
- this.U = this.locY;
- this.V = this.locZ;
- super.j_();
+ public void l_() {
+ this.U = this.locX;
+ this.V = this.locY;
+ this.W = this.locZ;
+ super.l_();
if (this.shake > 0) {
--this.shake;
}
@@ -130,7 +130,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
- if (entity1.L() && (entity1 != entityliving || this.j >= 5)) {
+ if (entity1.K() && (entity1 != entityliving || this.j >= 5)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.grow((double) f, (double) f, (double) f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
@@ -153,7 +153,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
if (movingobjectposition != null) {
if (movingobjectposition.type == EnumMovingObjectType.TILE && this.world.getTypeId(movingobjectposition.b, movingobjectposition.c, movingobjectposition.d) == Block.PORTAL.id) {
- this.aa();
+ this.Z();
} else {
this.a(movingobjectposition);
// CraftBukkit start
@@ -193,7 +193,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
float f2 = 0.99F;
float f3 = this.g();
- if (this.H()) {
+ if (this.G()) {
for (int k = 0; k < 4; ++k) {
float f4 = 0.25F;
diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java
index 5ad86c0d..77f69075 100644
--- a/src/main/java/net/minecraft/server/EntitySheep.java
+++ b/src/main/java/net/minecraft/server/EntitySheep.java
@@ -35,13 +35,13 @@ public class EntitySheep extends EntityAnimal {
this.e.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event
}
- protected boolean be() {
+ protected boolean bh() {
return true;
}
- protected void bl() {
+ protected void bo() {
this.f = this.g.f();
- super.bl();
+ super.bo();
}
public void c() {
@@ -77,7 +77,7 @@ public class EntitySheep extends EntityAnimal {
return Block.WOOL.id;
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (itemstack != null && itemstack.id == Item.SHEARS.id && !this.isSheared() && !this.isBaby()) {
@@ -107,7 +107,7 @@ public class EntitySheep extends EntityAnimal {
this.makeSound("mob.sheep.shear", 1.0F, 1.0F);
}
- return super.a(entityhuman);
+ return super.a_(entityhuman);
}
public void b(NBTTagCompound nbttagcompound) {
@@ -122,15 +122,15 @@ public class EntitySheep extends EntityAnimal {
this.setColor(nbttagcompound.getByte("Color"));
}
- protected String aY() {
+ protected String bb() {
return "mob.sheep.say";
}
- protected String aZ() {
+ protected String bc() {
return "mob.sheep.say";
}
- protected String ba() {
+ protected String bd() {
return "mob.sheep.say";
}
@@ -177,7 +177,7 @@ public class EntitySheep extends EntityAnimal {
return entitysheep1;
}
- public void aH() {
+ public void aK() {
// CraftBukkit start
SheepRegrowWoolEvent event = new SheepRegrowWoolEvent((org.bukkit.entity.Sheep) this.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(event);
@@ -198,7 +198,7 @@ public class EntitySheep extends EntityAnimal {
}
}
- public void bG() {
+ public void bJ() {
this.setColor(a(this.world.random));
}
diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java
index 7b524cda..4ea06d0a 100644
--- a/src/main/java/net/minecraft/server/EntitySilverfish.java
+++ b/src/main/java/net/minecraft/server/EntitySilverfish.java
@@ -10,7 +10,7 @@ public class EntitySilverfish extends EntityMonster {
super(world);
this.texture = "/mob/silverfish.png";
this.a(0.3F, 0.7F);
- this.bH = 0.6F;
+ this.bI = 0.6F;
}
public int getMaxHealth() {
@@ -27,15 +27,15 @@ public class EntitySilverfish extends EntityMonster {
return this.world.findNearbyVulnerablePlayer(this, d0);
}
- protected String aY() {
+ protected String bb() {
return "mob.silverfish.say";
}
- protected String aZ() {
+ protected String bc() {
return "mob.silverfish.hit";
}
- protected String ba() {
+ protected String bd() {
return "mob.silverfish.kill";
}
@@ -66,13 +66,13 @@ public class EntitySilverfish extends EntityMonster {
return 0;
}
- public void j_() {
- this.ax = this.yaw;
- super.j_();
+ public void l_() {
+ this.ay = this.yaw;
+ super.l_();
}
- protected void bn() {
- super.bn();
+ protected void bq() {
+ super.bq();
if (!this.world.isStatic) {
int i;
int j;
@@ -99,8 +99,7 @@ public class EntitySilverfish extends EntityMonster {
}
// CraftBukkit end
- this.world.triggerEffect(2001, i + i1, j + l, k + j1, Block.MONSTER_EGGS.id + (this.world.getData(i + i1, j + l, k + j1) << 12));
- this.world.setTypeId(i + i1, j + l, k + j1, 0);
+ this.world.setAir(i + i1, j + l, k + j1, false);
Block.MONSTER_EGGS.postBreak(this.world, i + i1, j + l, k + j1, 0);
if (this.random.nextBoolean()) {
flag = true;
@@ -120,15 +119,15 @@ public class EntitySilverfish extends EntityMonster {
int l1 = this.random.nextInt(6);
l = this.world.getTypeId(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1]);
- if (BlockMonsterEggs.e(l)) {
+ if (BlockMonsterEggs.d(l)) {
// CraftBukkit start
- if (CraftEventFactory.callEntityChangeBlockEvent(this, i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Block.MONSTER_EGGS.id, BlockMonsterEggs.f(l)).isCancelled()) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Block.MONSTER_EGGS.id, BlockMonsterEggs.e(l)).isCancelled()) {
return;
}
// CraftBukkit end
- this.world.setTypeIdAndData(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Block.MONSTER_EGGS.id, BlockMonsterEggs.f(l));
- this.aR();
+ this.world.setTypeIdAndData(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1], Block.MONSTER_EGGS.id, BlockMonsterEggs.e(l), 3);
+ this.aU();
this.die();
} else {
this.i();
diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java
index 4ea580be..a69323bf 100644
--- a/src/main/java/net/minecraft/server/EntitySkeleton.java
+++ b/src/main/java/net/minecraft/server/EntitySkeleton.java
@@ -12,11 +12,11 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
public EntitySkeleton(World world) {
super(world);
this.texture = "/mob/skeleton.png";
- this.bH = 0.25F;
+ this.bI = 0.25F;
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(2, new PathfinderGoalRestrictSun(this));
- this.goalSelector.a(3, new PathfinderGoalFleeSun(this, this.bH));
- this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bH));
+ this.goalSelector.a(3, new PathfinderGoalFleeSun(this, this.bI));
+ this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bI));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(6, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
@@ -31,7 +31,7 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
this.datawatcher.a(13, new Byte((byte) 0));
}
- public boolean be() {
+ public boolean bh() {
return true;
}
@@ -39,15 +39,15 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
return 20;
}
- protected String aY() {
+ protected String bb() {
return "mob.skeleton.say";
}
- protected String aZ() {
+ protected String bc() {
return "mob.skeleton.hurt";
}
- protected String ba() {
+ protected String bd() {
return "mob.skeleton.death";
}
@@ -69,7 +69,7 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
public int c(Entity entity) {
if (this.getSkeletonType() == 1) {
- ItemStack itemstack = this.bD();
+ ItemStack itemstack = this.bG();
int i = 4;
if (itemstack != null) {
@@ -90,14 +90,14 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
if (this.world.u() && !this.world.isStatic) {
float f = this.c(1.0F);
- if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.k(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
+ if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.l(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
boolean flag = true;
ItemStack itemstack = this.getEquipment(4);
if (itemstack != null) {
- if (itemstack.f()) {
- itemstack.setData(itemstack.i() + this.random.nextInt(2));
- if (itemstack.i() >= itemstack.k()) {
+ if (itemstack.g()) {
+ itemstack.setData(itemstack.j() + this.random.nextInt(2));
+ if (itemstack.j() >= itemstack.l()) {
this.a(itemstack);
this.setEquipment(4, (ItemStack) null);
}
@@ -119,12 +119,16 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
}
}
+ if (this.world.isStatic && this.getSkeletonType() == 1) {
+ this.a(0.72F, 2.34F);
+ }
+
super.c();
}
public void die(DamageSource damagesource) {
super.die(damagesource);
- if (damagesource.f() instanceof EntityArrow && damagesource.getEntity() instanceof EntityHuman) {
+ if (damagesource.h() instanceof EntityArrow && damagesource.getEntity() instanceof EntityHuman) {
EntityHuman entityhuman = (EntityHuman) damagesource.getEntity();
double d0 = entityhuman.locX - this.locX;
double d1 = entityhuman.locZ - this.locZ;
@@ -185,25 +189,25 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
return null;
}
- protected void bE() {
- super.bD();
+ protected void bH() {
+ super.bH();
this.setEquipment(0, new ItemStack(Item.BOW));
}
- public void bG() {
- if (this.world.worldProvider instanceof WorldProviderHell && this.aB().nextInt(5) > 0) {
+ public void bJ() {
+ if (this.world.worldProvider instanceof WorldProviderHell && this.aE().nextInt(5) > 0) {
this.goalSelector.a(4, this.e);
this.setSkeletonType(1);
this.setEquipment(0, new ItemStack(Item.STONE_SWORD));
} else {
this.goalSelector.a(4, this.d);
- this.bE();
- this.bF();
+ this.bH();
+ this.bI();
}
- this.canPickUpLoot = this.random.nextFloat() < at[this.world.difficulty];
+ this.h(this.random.nextFloat() < au[this.world.difficulty]);
if (this.getEquipment(4) == null) {
- Calendar calendar = this.world.T();
+ Calendar calendar = this.world.U();
if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.random.nextFloat() < 0.25F) {
this.setEquipment(4, new ItemStack(this.random.nextFloat() < 0.1F ? Block.JACK_O_LANTERN : Block.PUMPKIN));
@@ -215,7 +219,7 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
public void m() {
this.goalSelector.a((PathfinderGoal) this.e);
this.goalSelector.a((PathfinderGoal) this.d);
- ItemStack itemstack = this.bD();
+ ItemStack itemstack = this.bG();
if (itemstack != null && itemstack.id == Item.BOW.id) {
this.goalSelector.a(4, this.d);
@@ -224,11 +228,12 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
}
}
- public void d(EntityLiving entityliving) {
- EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, 12.0F);
- int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.bD());
- int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.bD());
+ public void a(EntityLiving entityliving, float f) {
+ EntityArrow entityarrow = new EntityArrow(this.world, this, entityliving, 1.6F, (float) (14 - this.world.difficulty * 4));
+ int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.bG());
+ int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.bG());
+ entityarrow.b((double) (f * 2.0F) + this.random.nextGaussian() * 0.25D + (double) ((float) this.world.difficulty * 0.11F));
if (i > 0) {
entityarrow.b(entityarrow.c() + (double) i * 0.5D + 0.5D);
}
@@ -237,11 +242,11 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
entityarrow.a(j);
}
- if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bD()) > 0 || this.getSkeletonType() == 1) {
+ if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bG()) > 0 || this.getSkeletonType() == 1) {
entityarrow.setOnFire(100);
}
- this.makeSound("random.bow", 1.0F, 1.0F / (this.aB().nextFloat() * 0.4F + 0.8F));
+ this.makeSound("random.bow", 1.0F, 1.0F / (this.aE().nextFloat() * 0.4F + 0.8F));
this.world.addEntity(entityarrow);
}
@@ -253,7 +258,7 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
this.datawatcher.watch(13, Byte.valueOf((byte) i));
this.fireProof = i == 1;
if (i == 1) {
- this.a(0.72F, 2.16F);
+ this.a(0.72F, 2.34F);
} else {
this.a(0.6F, 1.8F);
}
diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java
index 8be72498..011c5ee8 100644
--- a/src/main/java/net/minecraft/server/EntitySlime.java
+++ b/src/main/java/net/minecraft/server/EntitySlime.java
@@ -4,6 +4,7 @@ import org.bukkit.event.entity.SlimeSplitEvent; // CraftBukkit
public class EntitySlime extends EntityLiving implements IMonster {
+ private static final float[] e = new float[] { 1.0F, 0.75F, 0.5F, 0.25F, 0.0F, 0.25F, 0.5F, 0.75F};
public float b;
public float c;
public float d;
@@ -36,7 +37,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
}
this.setHealth(this.maxHealth);
// CraftBukkit end
- this.bd = i;
+ this.be = i;
}
public int getMaxHealth() {
@@ -67,7 +68,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
- public void j_() {
+ public void l_() {
if (!this.world.isStatic && this.world.difficulty == 0 && this.getSize() > 0) {
this.dead = true;
}
@@ -76,7 +77,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.d = this.c;
boolean flag = this.onGround;
- super.j_();
+ super.l_();
int i;
if (this.onGround && !flag) {
@@ -92,7 +93,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
}
if (this.o()) {
- this.makeSound(this.n(), this.aX(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
+ this.makeSound(this.n(), this.ba(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
}
this.b = -0.5F;
@@ -107,8 +108,8 @@ public class EntitySlime extends EntityLiving implements IMonster {
}
}
- protected void bn() {
- this.bk();
+ protected void bq() {
+ this.bn();
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D); // CraftBukkit TODO: EntityTargetEvent
if (entityhuman != null) {
@@ -121,17 +122,17 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.jumpDelay /= 3;
}
- this.bF = true;
+ this.bG = true;
if (this.q()) {
- this.makeSound(this.n(), this.aX(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
+ this.makeSound(this.n(), this.ba(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
}
- this.bC = 1.0F - this.random.nextFloat() * 2.0F;
- this.bD = (float) (1 * this.getSize());
+ this.bD = 1.0F - this.random.nextFloat() * 2.0F;
+ this.bE = (float) (1 * this.getSize());
} else {
- this.bF = false;
+ this.bG = false;
if (this.onGround) {
- this.bC = this.bD = 0.0F;
+ this.bD = this.bE = 0.0F;
}
}
}
@@ -180,7 +181,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
super.die();
}
- public void c_(EntityHuman entityhuman) {
+ public void b_(EntityHuman entityhuman) {
if (this.l()) {
int i = this.getSize();
@@ -198,11 +199,11 @@ public class EntitySlime extends EntityLiving implements IMonster {
return this.getSize();
}
- protected String aZ() {
+ protected String bc() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
- protected String ba() {
+ protected String bd() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
@@ -217,7 +218,9 @@ public class EntitySlime extends EntityLiving implements IMonster {
return false;
} else {
if (this.getSize() == 1 || this.world.difficulty > 0) {
- if (this.world.getBiome(MathHelper.floor(this.locX), MathHelper.floor(this.locZ)) == BiomeBase.SWAMPLAND && this.locY > 50.0D && this.locY < 70.0D && this.world.getLightLevel(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) <= this.random.nextInt(8)) {
+ BiomeBase biomebase = this.world.getBiome(MathHelper.floor(this.locX), MathHelper.floor(this.locZ));
+
+ if (biomebase == BiomeBase.SWAMPLAND && this.locY > 50.0D && this.locY < 70.0D && this.random.nextFloat() < 0.5F && this.random.nextFloat() < e[this.world.v()] && this.world.getLightLevel(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) <= this.random.nextInt(8)) {
return super.canSpawn();
}
@@ -230,11 +233,11 @@ public class EntitySlime extends EntityLiving implements IMonster {
}
}
- protected float aX() {
+ protected float ba() {
return 0.4F * (float) this.getSize();
}
- public int bp() {
+ public int bs() {
return 0;
}
diff --git a/src/main/java/net/minecraft/server/EntitySmallFireball.java b/src/main/java/net/minecraft/server/EntitySmallFireball.java
index a1265bfc..a7e7915b 100644
--- a/src/main/java/net/minecraft/server/EntitySmallFireball.java
+++ b/src/main/java/net/minecraft/server/EntitySmallFireball.java
@@ -72,7 +72,7 @@ public class EntitySmallFireball extends EntityFireball {
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- this.world.setTypeId(i, j, k, Block.FIRE.id);
+ this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
}
// CraftBukkit end
}
@@ -82,7 +82,7 @@ public class EntitySmallFireball extends EntityFireball {
}
}
- public boolean L() {
+ public boolean K() {
return false;
}
diff --git a/src/main/java/net/minecraft/server/EntitySnowman.java b/src/main/java/net/minecraft/server/EntitySnowman.java
index 5da1e6c6..fd88beab 100644
--- a/src/main/java/net/minecraft/server/EntitySnowman.java
+++ b/src/main/java/net/minecraft/server/EntitySnowman.java
@@ -19,7 +19,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget(this, EntityLiving.class, 16.0F, 0, true, false, IMonster.a));
}
- public boolean be() {
+ public boolean bh() {
return true;
}
@@ -29,7 +29,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
public void c() {
super.c();
- if (this.G()) {
+ if (this.F()) {
// CraftBukkit start
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.DROWNING, 1);
this.world.getServer().getPluginManager().callEvent(event);
@@ -94,15 +94,15 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
// CraftBukkit end
}
- public void d(EntityLiving entityliving) {
+ public void a(EntityLiving entityliving, float f) {
EntitySnowball entitysnowball = new EntitySnowball(this.world, this);
double d0 = entityliving.locX - this.locX;
double d1 = entityliving.locY + (double) entityliving.getHeadHeight() - 1.100000023841858D - entitysnowball.locY;
double d2 = entityliving.locZ - this.locZ;
- float f = MathHelper.sqrt(d0 * d0 + d2 * d2) * 0.2F;
+ float f1 = MathHelper.sqrt(d0 * d0 + d2 * d2) * 0.2F;
- entitysnowball.shoot(d0, d1 + (double) f, d2, 1.6F, 12.0F);
- this.makeSound("random.bow", 1.0F, 1.0F / (this.aB().nextFloat() * 0.4F + 0.8F));
+ entitysnowball.shoot(d0, d1 + (double) f1, d2, 1.6F, 12.0F);
+ this.makeSound("random.bow", 1.0F, 1.0F / (this.aE().nextFloat() * 0.4F + 0.8F));
this.world.addEntity(entitysnowball);
}
}
diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java
index 9b466d49..7761d717 100644
--- a/src/main/java/net/minecraft/server/EntitySpider.java
+++ b/src/main/java/net/minecraft/server/EntitySpider.java
@@ -8,7 +8,7 @@ public class EntitySpider extends EntityMonster {
super(world);
this.texture = "/mob/spider.png";
this.a(1.4F, 0.9F);
- this.bH = 0.8F;
+ this.bI = 0.8F;
}
protected void a() {
@@ -16,10 +16,10 @@ public class EntitySpider extends EntityMonster {
this.datawatcher.a(16, new Byte((byte) 0));
}
- public void j_() {
- super.j_();
+ public void l_() {
+ super.l_();
if (!this.world.isStatic) {
- this.f(this.positionChanged);
+ this.a(this.positionChanged);
}
}
@@ -27,7 +27,7 @@ public class EntitySpider extends EntityMonster {
return 16;
}
- public double X() {
+ public double W() {
return (double) this.length * 0.75D - 0.5D;
}
@@ -43,15 +43,15 @@ public class EntitySpider extends EntityMonster {
}
}
- protected String aY() {
+ protected String bb() {
return "mob.spider.say";
}
- protected String aZ() {
+ protected String bc() {
return "mob.spider.say";
}
- protected String ba() {
+ protected String bd() {
return "mob.spider.death";
}
@@ -123,7 +123,7 @@ public class EntitySpider extends EntityMonster {
return this.o();
}
- public void am() {}
+ public void al() {}
public EnumMonsterType getMonsterType() {
return EnumMonsterType.ARTHROPOD;
@@ -137,7 +137,7 @@ public class EntitySpider extends EntityMonster {
return (this.datawatcher.getByte(16) & 1) != 0;
}
- public void f(boolean flag) {
+ public void a(boolean flag) {
byte b0 = this.datawatcher.getByte(16);
if (flag) {
@@ -149,12 +149,12 @@ public class EntitySpider extends EntityMonster {
this.datawatcher.watch(16, Byte.valueOf(b0));
}
- public void bG() {
+ public void bJ() {
if (this.world.random.nextInt(100) == 0) {
EntitySkeleton entityskeleton = new EntitySkeleton(this.world);
entityskeleton.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F);
- entityskeleton.bG();
+ entityskeleton.bJ();
this.world.addEntity(entityskeleton);
entityskeleton.mount(this);
}
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
index 961d83a4..30259de3 100644
--- a/src/main/java/net/minecraft/server/EntitySquid.java
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
@@ -11,38 +11,38 @@ public class EntitySquid extends EntityWaterAnimal {
public float h = 0.0F;
public float i = 0.0F;
public float j = 0.0F;
- public float bJ = 0.0F;
- private float bK = 0.0F;
+ public float bK = 0.0F;
private float bL = 0.0F;
private float bM = 0.0F;
private float bN = 0.0F;
private float bO = 0.0F;
private float bP = 0.0F;
+ private float bQ = 0.0F;
public EntitySquid(World world) {
super(world);
this.texture = "/mob/squid.png";
this.a(0.95F, 0.95F);
- this.bL = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
+ this.bM = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}
public int getMaxHealth() {
return 10;
}
- protected String aY() {
+ protected String bb() {
return null;
}
- protected String aZ() {
+ protected String bc() {
return null;
}
- protected String ba() {
+ protected String bd() {
return null;
}
- protected float aX() {
+ protected float ba() {
return 0.4F;
}
@@ -63,7 +63,7 @@ public class EntitySquid extends EntityWaterAnimal {
// CraftBukkit end
}
- public boolean H() {
+ public boolean G() {
return this.world.a(this.boundingBox.grow(0.0D, -0.6000000238418579D, 0.0D), Material.WATER, (Entity) this);
}
@@ -72,44 +72,44 @@ public class EntitySquid extends EntityWaterAnimal {
this.e = this.d;
this.g = this.f;
this.i = this.h;
- this.bJ = this.j;
- this.h += this.bL;
+ this.bK = this.j;
+ this.h += this.bM;
if (this.h > 6.2831855F) {
this.h -= 6.2831855F;
if (this.random.nextInt(10) == 0) {
- this.bL = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
+ this.bM = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}
}
- if (this.H()) {
+ if (this.G()) {
float f;
if (this.h < 3.1415927F) {
f = this.h / 3.1415927F;
this.j = MathHelper.sin(f * f * 3.1415927F) * 3.1415927F * 0.25F;
if ((double) f > 0.75D) {
- this.bK = 1.0F;
- this.bM = 1.0F;
+ this.bL = 1.0F;
+ this.bN = 1.0F;
} else {
- this.bM *= 0.8F;
+ this.bN *= 0.8F;
}
} else {
this.j = 0.0F;
- this.bK *= 0.9F;
- this.bM *= 0.99F;
+ this.bL *= 0.9F;
+ this.bN *= 0.99F;
}
if (!this.world.isStatic) {
- this.motX = (double) (this.bN * this.bK);
- this.motY = (double) (this.bO * this.bK);
- this.motZ = (double) (this.bP * this.bK);
+ this.motX = (double) (this.bO * this.bL);
+ this.motY = (double) (this.bP * this.bL);
+ this.motZ = (double) (this.bQ * this.bL);
}
f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
// CraftBukkit - Math -> TrigMath
- this.ax += (-((float) TrigMath.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.ax) * 0.1F;
- this.yaw = this.ax;
- this.f += 3.1415927F * this.bM * 1.5F;
+ this.ay += (-((float) TrigMath.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.ay) * 0.1F;
+ this.yaw = this.ay;
+ this.f += 3.1415927F * this.bN * 1.5F;
// CraftBukkit - Math -> TrigMath
this.d += (-((float) TrigMath.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.d) * 0.1F;
} else {
@@ -129,19 +129,19 @@ public class EntitySquid extends EntityWaterAnimal {
this.move(this.motX, this.motY, this.motZ);
}
- protected void bn() {
- ++this.bB;
- if (this.bB > 100) {
- this.bN = this.bO = this.bP = 0.0F;
- } else if (this.random.nextInt(50) == 0 || !this.ad || this.bN == 0.0F && this.bO == 0.0F && this.bP == 0.0F) {
+ protected void bq() {
+ ++this.bC;
+ if (this.bC > 100) {
+ this.bO = this.bP = this.bQ = 0.0F;
+ } else if (this.random.nextInt(50) == 0 || !this.ae || this.bO == 0.0F && this.bP == 0.0F && this.bQ == 0.0F) {
float f = this.random.nextFloat() * 3.1415927F * 2.0F;
- this.bN = MathHelper.cos(f) * 0.2F;
- this.bO = -0.1F + this.random.nextFloat() * 0.2F;
- this.bP = MathHelper.sin(f) * 0.2F;
+ this.bO = MathHelper.cos(f) * 0.2F;
+ this.bP = -0.1F + this.random.nextFloat() * 0.2F;
+ this.bQ = MathHelper.sin(f) * 0.2F;
}
- this.bk();
+ this.bn();
}
public boolean canSpawn() {
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 8db94ffe..41139997 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -5,6 +5,7 @@ import org.bukkit.event.entity.ExplosionPrimeEvent; // CraftBukkit
public class EntityTNTPrimed extends Entity {
public int fuseTicks;
+ private EntityLiving source;
public float yield = 4; // CraftBukkit
public boolean isIncendiary = false; // CraftBukkit
@@ -16,7 +17,7 @@ public class EntityTNTPrimed extends Entity {
this.height = this.length / 2.0F;
}
- public EntityTNTPrimed(World world, double d0, double d1, double d2) {
+ public EntityTNTPrimed(World world, double d0, double d1, double d2, EntityLiving entityliving) {
this(world);
this.setPosition(d0, d1, d2);
float f = (float) (Math.random() * 3.1415927410125732D * 2.0D);
@@ -28,6 +29,7 @@ public class EntityTNTPrimed extends Entity {
this.lastX = d0;
this.lastY = d1;
this.lastZ = d2;
+ this.source = entityliving;
}
protected void a() {}
@@ -36,11 +38,11 @@ public class EntityTNTPrimed extends Entity {
return false;
}
- public boolean L() {
+ public boolean K() {
return !this.dead;
}
- public void j_() {
+ public void l_() {
this.lastX = this.locX;
this.lastY = this.locY;
this.lastZ = this.locZ;
@@ -90,4 +92,8 @@ public class EntityTNTPrimed extends Entity {
protected void a(NBTTagCompound nbttagcompound) {
this.fuseTicks = nbttagcompound.getByte("Fuse");
}
+
+ public EntityLiving getSource() {
+ return this.source;
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java
index d2d6ff0d..cfcd647a 100644
--- a/src/main/java/net/minecraft/server/EntityTracker.java
+++ b/src/main/java/net/minecraft/server/EntityTracker.java
@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
+import java.util.concurrent.Callable;
public class EntityTracker {
@@ -55,7 +56,7 @@ public class EntityTracker {
this.addEntity(entity, 64, 10, true);
} else if (entity instanceof EntityItem) {
this.addEntity(entity, 64, 20, true);
- } else if (entity instanceof EntityMinecart) {
+ } else if (entity instanceof EntityMinecartAbstract) {
this.addEntity(entity, 80, 3, true);
} else if (entity instanceof EntityBoat) {
this.addEntity(entity, 80, 3, true);
@@ -94,15 +95,24 @@ public class EntityTracker {
i = this.d;
}
- if (this.trackedEntities.b(entity.id)) {
- // CraftBukkit - removed exception throw as tracking an already tracked entity theoretically shouldn't cause any issues.
- // throw new IllegalStateException("Entity is already tracked!");
- } else {
- EntityTrackerEntry entitytrackerentry = new EntityTrackerEntry(entity, i, j, flag);
+ try {
+ if (this.trackedEntities.b(entity.id)) {
+ throw new IllegalStateException("Entity is already tracked!");
+ } else {
+ EntityTrackerEntry entitytrackerentry = new EntityTrackerEntry(entity, i, j, flag);
- this.b.add(entitytrackerentry);
- this.trackedEntities.a(entity.id, entitytrackerentry);
- entitytrackerentry.scanPlayers(this.world.players);
+ this.b.add(entitytrackerentry);
+ this.trackedEntities.a(entity.id, entitytrackerentry);
+ entitytrackerentry.scanPlayers(this.world.players);
+ }
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Adding entity to track");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity To Track");
+
+ crashreportsystemdetails.a("Tracking range", (i + " blocks"));
+ crashreportsystemdetails.a("Update interval", (Callable) (new CrashReportEntityTrackerUpdateInterval(this, j)));
+ entity.a(crashreportsystemdetails);
+ throw new ReportedException(crashreport);
}
}
@@ -190,7 +200,7 @@ public class EntityTracker {
while (iterator.hasNext()) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
- if (entitytrackerentry.tracker != entityplayer && entitytrackerentry.tracker.ai == chunk.x && entitytrackerentry.tracker.ak == chunk.z) {
+ if (entitytrackerentry.tracker != entityplayer && entitytrackerentry.tracker.aj == chunk.x && entitytrackerentry.tracker.al == chunk.z) {
entitytrackerentry.updatePlayer(entityplayer);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index a026c4ce..4948f23d 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -46,7 +46,7 @@ public class EntityTrackerEntry {
this.zLoc = MathHelper.floor(entity.locZ * 32.0D);
this.yRot = MathHelper.d(entity.yaw * 256.0F / 360.0F);
this.xRot = MathHelper.d(entity.pitch * 256.0F / 360.0F);
- this.i = MathHelper.d(entity.ap() * 256.0F / 360.0F);
+ this.i = MathHelper.d(entity.ao() * 256.0F / 360.0F);
}
public boolean equals(Object object) {
@@ -68,7 +68,7 @@ public class EntityTrackerEntry {
this.scanPlayers(list);
}
- if (this.v != this.tracker.vehicle) {
+ if (this.v != this.tracker.vehicle || this.tracker.vehicle != null && this.m % 60 == 0) {
this.v = this.tracker.vehicle;
this.broadcast(new Packet39AttachEntity(this.tracker, this.tracker.vehicle));
}
@@ -101,15 +101,15 @@ public class EntityTrackerEntry {
if (i9.a()) {
this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, i9, false));
}
- } else if (this.m++ % this.c == 0 || this.tracker.am) {
+ } else if (this.m % this.c == 0 || this.tracker.an || this.tracker.getDataWatcher().a()) {
int i;
int j;
if (this.tracker.vehicle == null) {
++this.u;
- i = this.tracker.as.a(this.tracker.locX);
+ i = this.tracker.at.a(this.tracker.locX);
j = MathHelper.floor(this.tracker.locY * 32.0D);
- int k = this.tracker.as.a(this.tracker.locZ);
+ int k = this.tracker.at.a(this.tracker.locZ);
int l = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F);
int i1 = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F);
int j1 = i - this.xLoc;
@@ -200,9 +200,9 @@ public class EntityTrackerEntry {
this.xRot = j;
}
- this.xLoc = this.tracker.as.a(this.tracker.locX);
+ this.xLoc = this.tracker.at.a(this.tracker.locX);
this.yLoc = MathHelper.floor(this.tracker.locY * 32.0D);
- this.zLoc = this.tracker.as.a(this.tracker.locZ);
+ this.zLoc = this.tracker.at.a(this.tracker.locZ);
DataWatcher datawatcher2 = this.tracker.getDataWatcher();
if (datawatcher2.a()) {
@@ -212,15 +212,16 @@ public class EntityTrackerEntry {
this.w = true;
}
- i = MathHelper.d(this.tracker.ap() * 256.0F / 360.0F);
+ i = MathHelper.d(this.tracker.ao() * 256.0F / 360.0F);
if (Math.abs(i - this.i) >= 4) {
this.broadcast(new Packet35EntityHeadRotation(this.tracker.id, (byte) i));
this.i = i;
}
- this.tracker.am = false;
+ this.tracker.an = false;
}
+ ++this.m;
if (this.tracker.velocityChanged) {
// CraftBukkit start - create PlayerVelocity event
boolean cancelled = false;
@@ -288,7 +289,7 @@ public class EntityTrackerEntry {
double d1 = entityplayer.locZ - (double) (this.zLoc / 32);
if (d0 >= (double) (-this.b) && d0 <= (double) this.b && d1 >= (double) (-this.b) && d1 <= (double) this.b) {
- if (!this.trackedPlayers.contains(entityplayer) && this.d(entityplayer)) {
+ if (!this.trackedPlayers.contains(entityplayer) && (this.d(entityplayer) || this.tracker.p)) {
// CraftBukkit start
if (this.tracker instanceof EntityPlayer) {
Player player = ((EntityPlayer) this.tracker).getBukkitEntity();
@@ -338,7 +339,7 @@ public class EntityTrackerEntry {
}
// CraftBukkit start - Fix for nonsensical head yaw
- this.i = MathHelper.d(this.tracker.ap() * 256.0F / 360.0F); // tracker.am() should be getHeadRotation
+ this.i = MathHelper.d(this.tracker.ao() * 256.0F / 360.0F); // tracker.ao() should be getHeadRotation
this.broadcast(new Packet35EntityHeadRotation(this.tracker.id, (byte) i));
// CraftBukkit end
@@ -361,7 +362,7 @@ public class EntityTrackerEntry {
}
private boolean d(EntityPlayer entityplayer) {
- return entityplayer.p().getPlayerChunkMap().a(entityplayer, this.tracker.ai, this.tracker.ak);
+ return entityplayer.o().getPlayerChunkMap().a(entityplayer, this.tracker.aj, this.tracker.al);
}
public void scanPlayers(List list) {
@@ -373,7 +374,7 @@ public class EntityTrackerEntry {
private Packet b() {
if (this.tracker.dead) {
// CraftBukkit start - remove useless error spam, just return
- // System.out.println("Fetching addPacket for removed entity");
+ // this.tracker.world.getLogger().warning("Fetching addPacket for removed entity");
return null;
// CraftBukkit end
}
@@ -382,101 +383,87 @@ public class EntityTrackerEntry {
return new Packet23VehicleSpawn(this.tracker, 2, 1);
} else if (this.tracker instanceof EntityPlayer) {
return new Packet20NamedEntitySpawn((EntityHuman) this.tracker);
- } else {
- if (this.tracker instanceof EntityMinecart) {
- EntityMinecart entityminecart = (EntityMinecart) this.tracker;
-
- if (entityminecart.type == 0) {
- return new Packet23VehicleSpawn(this.tracker, 10);
- }
-
- if (entityminecart.type == 1) {
- return new Packet23VehicleSpawn(this.tracker, 11);
- }
-
- if (entityminecart.type == 2) {
- return new Packet23VehicleSpawn(this.tracker, 12);
- }
- }
-
- if (this.tracker instanceof EntityBoat) {
- return new Packet23VehicleSpawn(this.tracker, 1);
- } else if (!(this.tracker instanceof IAnimal) && !(this.tracker instanceof EntityEnderDragon)) {
- if (this.tracker instanceof EntityFishingHook) {
- EntityHuman entityhuman = ((EntityFishingHook) this.tracker).owner;
-
- return new Packet23VehicleSpawn(this.tracker, 90, entityhuman != null ? entityhuman.id : this.tracker.id);
- } else if (this.tracker instanceof EntityArrow) {
- Entity entity = ((EntityArrow) this.tracker).shooter;
-
- return new Packet23VehicleSpawn(this.tracker, 60, entity != null ? entity.id : this.tracker.id);
- } else if (this.tracker instanceof EntitySnowball) {
- return new Packet23VehicleSpawn(this.tracker, 61);
- } else if (this.tracker instanceof EntityPotion) {
- return new Packet23VehicleSpawn(this.tracker, 73, ((EntityPotion) this.tracker).getPotionValue());
- } else if (this.tracker instanceof EntityThrownExpBottle) {
- return new Packet23VehicleSpawn(this.tracker, 75);
- } else if (this.tracker instanceof EntityEnderPearl) {
- return new Packet23VehicleSpawn(this.tracker, 65);
- } else if (this.tracker instanceof EntityEnderSignal) {
- return new Packet23VehicleSpawn(this.tracker, 72);
- } else if (this.tracker instanceof EntityFireworks) {
- return new Packet23VehicleSpawn(this.tracker, 76);
- } else {
- Packet23VehicleSpawn packet23vehiclespawn;
-
- if (this.tracker instanceof EntityFireball) {
- EntityFireball entityfireball = (EntityFireball) this.tracker;
+ } else if (this.tracker instanceof EntityMinecartAbstract) {
+ EntityMinecartAbstract entityminecartabstract = (EntityMinecartAbstract) this.tracker;
+
+ return new Packet23VehicleSpawn(this.tracker, 10, entityminecartabstract.getType());
+ } else if (this.tracker instanceof EntityBoat) {
+ return new Packet23VehicleSpawn(this.tracker, 1);
+ } else if (!(this.tracker instanceof IAnimal) && !(this.tracker instanceof EntityEnderDragon)) {
+ if (this.tracker instanceof EntityFishingHook) {
+ EntityHuman entityhuman = ((EntityFishingHook) this.tracker).owner;
+
+ return new Packet23VehicleSpawn(this.tracker, 90, entityhuman != null ? entityhuman.id : this.tracker.id);
+ } else if (this.tracker instanceof EntityArrow) {
+ Entity entity = ((EntityArrow) this.tracker).shooter;
+
+ return new Packet23VehicleSpawn(this.tracker, 60, entity != null ? entity.id : this.tracker.id);
+ } else if (this.tracker instanceof EntitySnowball) {
+ return new Packet23VehicleSpawn(this.tracker, 61);
+ } else if (this.tracker instanceof EntityPotion) {
+ return new Packet23VehicleSpawn(this.tracker, 73, ((EntityPotion) this.tracker).getPotionValue());
+ } else if (this.tracker instanceof EntityThrownExpBottle) {
+ return new Packet23VehicleSpawn(this.tracker, 75);
+ } else if (this.tracker instanceof EntityEnderPearl) {
+ return new Packet23VehicleSpawn(this.tracker, 65);
+ } else if (this.tracker instanceof EntityEnderSignal) {
+ return new Packet23VehicleSpawn(this.tracker, 72);
+ } else if (this.tracker instanceof EntityFireworks) {
+ return new Packet23VehicleSpawn(this.tracker, 76);
+ } else {
+ Packet23VehicleSpawn packet23vehiclespawn;
- packet23vehiclespawn = null;
- byte b0 = 63;
+ if (this.tracker instanceof EntityFireball) {
+ EntityFireball entityfireball = (EntityFireball) this.tracker;
- if (this.tracker instanceof EntitySmallFireball) {
- b0 = 64;
- } else if (this.tracker instanceof EntityWitherSkull) {
- b0 = 66;
- }
+ packet23vehiclespawn = null;
+ byte b0 = 63;
- if (entityfireball.shooter != null) {
- packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, b0, ((EntityFireball) this.tracker).shooter.id);
- } else {
- packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, b0, 0);
- }
+ if (this.tracker instanceof EntitySmallFireball) {
+ b0 = 64;
+ } else if (this.tracker instanceof EntityWitherSkull) {
+ b0 = 66;
+ }
- packet23vehiclespawn.e = (int) (entityfireball.dirX * 8000.0D);
- packet23vehiclespawn.f = (int) (entityfireball.dirY * 8000.0D);
- packet23vehiclespawn.g = (int) (entityfireball.dirZ * 8000.0D);
- return packet23vehiclespawn;
- } else if (this.tracker instanceof EntityEgg) {
- return new Packet23VehicleSpawn(this.tracker, 62);
- } else if (this.tracker instanceof EntityTNTPrimed) {
- return new Packet23VehicleSpawn(this.tracker, 50);
- } else if (this.tracker instanceof EntityEnderCrystal) {
- return new Packet23VehicleSpawn(this.tracker, 51);
- } else if (this.tracker instanceof EntityFallingBlock) {
- EntityFallingBlock entityfallingblock = (EntityFallingBlock) this.tracker;
-
- return new Packet23VehicleSpawn(this.tracker, 70, entityfallingblock.id | entityfallingblock.data << 16);
- } else if (this.tracker instanceof EntityPainting) {
- return new Packet25EntityPainting((EntityPainting) this.tracker);
- } else if (this.tracker instanceof EntityItemFrame) {
- EntityItemFrame entityitemframe = (EntityItemFrame) this.tracker;
-
- packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 71, entityitemframe.direction);
- packet23vehiclespawn.b = MathHelper.d((float) (entityitemframe.x * 32));
- packet23vehiclespawn.c = MathHelper.d((float) (entityitemframe.y * 32));
- packet23vehiclespawn.d = MathHelper.d((float) (entityitemframe.z * 32));
- return packet23vehiclespawn;
- } else if (this.tracker instanceof EntityExperienceOrb) {
- return new Packet26AddExpOrb((EntityExperienceOrb) this.tracker);
+ if (entityfireball.shooter != null) {
+ packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, b0, ((EntityFireball) this.tracker).shooter.id);
} else {
- throw new IllegalArgumentException("Don\'t know how to add " + this.tracker.getClass() + "!");
+ packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, b0, 0);
}
+
+ packet23vehiclespawn.e = (int) (entityfireball.dirX * 8000.0D);
+ packet23vehiclespawn.f = (int) (entityfireball.dirY * 8000.0D);
+ packet23vehiclespawn.g = (int) (entityfireball.dirZ * 8000.0D);
+ return packet23vehiclespawn;
+ } else if (this.tracker instanceof EntityEgg) {
+ return new Packet23VehicleSpawn(this.tracker, 62);
+ } else if (this.tracker instanceof EntityTNTPrimed) {
+ return new Packet23VehicleSpawn(this.tracker, 50);
+ } else if (this.tracker instanceof EntityEnderCrystal) {
+ return new Packet23VehicleSpawn(this.tracker, 51);
+ } else if (this.tracker instanceof EntityFallingBlock) {
+ EntityFallingBlock entityfallingblock = (EntityFallingBlock) this.tracker;
+
+ return new Packet23VehicleSpawn(this.tracker, 70, entityfallingblock.id | entityfallingblock.data << 16);
+ } else if (this.tracker instanceof EntityPainting) {
+ return new Packet25EntityPainting((EntityPainting) this.tracker);
+ } else if (this.tracker instanceof EntityItemFrame) {
+ EntityItemFrame entityitemframe = (EntityItemFrame) this.tracker;
+
+ packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 71, entityitemframe.direction);
+ packet23vehiclespawn.b = MathHelper.d((float) (entityitemframe.x * 32));
+ packet23vehiclespawn.c = MathHelper.d((float) (entityitemframe.y * 32));
+ packet23vehiclespawn.d = MathHelper.d((float) (entityitemframe.z * 32));
+ return packet23vehiclespawn;
+ } else if (this.tracker instanceof EntityExperienceOrb) {
+ return new Packet26AddExpOrb((EntityExperienceOrb) this.tracker);
+ } else {
+ throw new IllegalArgumentException("Don\'t know how to add " + this.tracker.getClass() + "!");
}
- } else {
- this.i = MathHelper.d(this.tracker.ap() * 256.0F / 360.0F);
- return new Packet24MobSpawn((EntityLiving) this.tracker);
}
+ } else {
+ this.i = MathHelper.d(this.tracker.ao() * 256.0F / 360.0F);
+ return new Packet24MobSpawn((EntityLiving) this.tracker);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java
index daa9845e..e44d7bee 100644
--- a/src/main/java/net/minecraft/server/EntityWitch.java
+++ b/src/main/java/net/minecraft/server/EntityWitch.java
@@ -11,10 +11,10 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
public EntityWitch(World world) {
super(world);
this.texture = "/mob/villager/witch.png";
- this.bH = 0.25F;
+ this.bI = 0.25F;
this.goalSelector.a(1, new PathfinderGoalFloat(this));
- this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, this.bH, 60, 10.0F));
- this.goalSelector.a(2, new PathfinderGoalRandomStroll(this, this.bH));
+ this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, this.bI, 60, 10.0F));
+ this.goalSelector.a(2, new PathfinderGoalRandomStroll(this, this.bI));
this.goalSelector.a(3, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(3, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
@@ -26,19 +26,19 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
this.getDataWatcher().a(21, Byte.valueOf((byte) 0));
}
- protected String aY() {
+ protected String bb() {
return "mob.witch.idle";
}
- protected String aZ() {
+ protected String bc() {
return "mob.witch.hurt";
}
- protected String ba() {
+ protected String bd() {
return "mob.witch.death";
}
- public void f(boolean flag) {
+ public void a(boolean flag) {
this.getDataWatcher().watch(21, Byte.valueOf((byte) (flag ? 1 : 0)));
}
@@ -50,7 +50,7 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
return 26;
}
- public boolean be() {
+ public boolean bh() {
return true;
}
@@ -58,8 +58,8 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
if (!this.world.isStatic) {
if (this.m()) {
if (this.e-- <= 0) {
- this.f(false);
- ItemStack itemstack = this.bD();
+ this.a(false);
+ ItemStack itemstack = this.bG();
this.setEquipment(0, (ItemStack) null);
if (itemstack != null && itemstack.id == Item.POTION.id) {
@@ -91,8 +91,8 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
if (short1 > -1) {
this.setEquipment(0, new ItemStack(Item.POTION, 1, short1));
- this.e = this.bD().m();
- this.f(true);
+ this.e = this.bG().n();
+ this.a(true);
}
}
@@ -110,15 +110,15 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
i = 0;
}
- if (damagesource.o()) {
+ if (damagesource.q()) {
i = (int) ((double) i * 0.15D);
}
return i;
}
- public float bB() {
- float f = super.bB();
+ public float bE() {
+ float f = super.bE();
if (this.m()) {
f *= 0.75F;
@@ -148,7 +148,7 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
// CraftBukkit end
}
- public void d(EntityLiving entityliving) {
+ public void a(EntityLiving entityliving, float f) {
if (!this.m()) {
EntityPotion entitypotion = new EntityPotion(this.world, this, 32732);
@@ -156,17 +156,17 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
double d0 = entityliving.locX + entityliving.motX - this.locX;
double d1 = entityliving.locY + (double) entityliving.getHeadHeight() - 1.100000023841858D - this.locY;
double d2 = entityliving.locZ + entityliving.motZ - this.locZ;
- float f = MathHelper.sqrt(d0 * d0 + d2 * d2);
+ float f1 = MathHelper.sqrt(d0 * d0 + d2 * d2);
- if (f >= 8.0F && !entityliving.hasEffect(MobEffectList.SLOWER_MOVEMENT)) {
+ if (f1 >= 8.0F && !entityliving.hasEffect(MobEffectList.SLOWER_MOVEMENT)) {
entitypotion.setPotionValue(32698);
} else if (entityliving.getHealth() >= 8 && !entityliving.hasEffect(MobEffectList.POISON)) {
entitypotion.setPotionValue(32660);
- } else if (f <= 3.0F && !entityliving.hasEffect(MobEffectList.WEAKNESS) && this.random.nextFloat() < 0.25F) {
+ } else if (f1 <= 3.0F && !entityliving.hasEffect(MobEffectList.WEAKNESS) && this.random.nextFloat() < 0.25F) {
entitypotion.setPotionValue(32696);
}
- entitypotion.shoot(d0, d1 + (double) (f * 0.2F), d2, 0.75F, 8.0F);
+ entitypotion.shoot(d0, d1 + (double) (f1 * 0.2F), d2, 0.75F, 8.0F);
this.world.addEntity(entitypotion);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
index 2dc6e98f..1790a44d 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
@@ -16,7 +16,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
private int[] h = new int[2];
private int[] i = new int[2];
private int j;
- private static final IEntitySelector bJ = new EntitySelectorNotUndead();
+ private static final IEntitySelector bK = new EntitySelectorNotUndead();
public EntityWither(World world) {
super(world);
@@ -24,16 +24,16 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.texture = "/mob/wither.png";
this.a(0.9F, 4.0F);
this.fireProof = true;
- this.bH = 0.6F;
+ this.bI = 0.6F;
this.getNavigation().e(true);
this.goalSelector.a(0, new PathfinderGoalFloat(this));
- this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, this.bH, 40, 20.0F));
- this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bH));
+ this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, this.bI, 40, 20.0F));
+ this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bI));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
- this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityLiving.class, 30.0F, 0, false, false, bJ));
- this.bd = 50;
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityLiving.class, 30.0F, 0, false, false, bK));
+ this.be = 50;
}
protected void a() {
@@ -56,15 +56,15 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.datawatcher.watch(16, Integer.valueOf(this.health));
}
- protected String aY() {
+ protected String bb() {
return "mob.wither.idle";
}
- protected String aZ() {
+ protected String bc() {
return "mob.wither.hurt";
}
- protected String ba() {
+ protected String bd() {
return "mob.wither.death";
}
@@ -139,7 +139,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.d[i] = this.b(this.d[i], f1, 40.0F);
this.e[i] = this.b(this.e[i], f, 10.0F);
} else {
- this.e[i] = this.b(this.e[i], this.ax, 10.0F);
+ this.e[i] = this.b(this.e[i], this.ay, 10.0F);
}
}
@@ -163,7 +163,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
}
- protected void bl() {
+ protected void bo() {
int i;
if (this.n() > 0) {
@@ -178,7 +178,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
// CraftBukkit end
- this.world.e(1013, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
+ this.world.d(1013, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
this.t(i);
@@ -186,7 +186,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.heal(10, EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit
}
} else {
- super.bl();
+ super.bo();
int j;
@@ -222,7 +222,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.c(i, 0);
}
} else {
- List list = this.world.a(EntityLiving.class, this.boundingBox.grow(20.0D, 8.0D, 20.0D), bJ);
+ List list = this.world.a(EntityLiving.class, this.boundingBox.grow(20.0D, 8.0D, 20.0D), bK);
for (int i1 = 0; i1 < 10 && !list.isEmpty(); ++i1) {
EntityLiving entityliving = (EntityLiving) list.get(this.random.nextInt(list.size()));
@@ -267,18 +267,13 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
int i3 = this.world.getTypeId(j2, k2, l2);
if (i3 > 0 && i3 != Block.BEDROCK.id && i3 != Block.ENDER_PORTAL.id && i3 != Block.ENDER_PORTAL_FRAME.id) {
- int j3 = this.world.getData(j2, k2, l2);
-
// CraftBukkit start
if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this, j2, k2, l2, 0, 0).isCancelled()) {
continue;
}
// CraftBukkit end
- this.world.triggerEffect(2001, j2, k2, l2, i3 + (j3 << 12));
- Block.byId[i3].c(this.world, j2, k2, l2, j3, 0);
- this.world.setTypeId(j2, k2, l2, 0);
- flag = true;
+ flag = this.world.setAir(j2, k2, l2, true) || flag;
}
}
}
@@ -301,9 +296,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.setHealth(this.getMaxHealth() / 3);
}
- public void am() {}
+ public void al() {}
- public int aW() {
+ public int aZ() {
return 4;
}
@@ -311,7 +306,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
if (i <= 0) {
return this.locX;
} else {
- float f = (this.ax + (float) (180 * (i - 1))) / 180.0F * 3.1415927F;
+ float f = (this.ay + (float) (180 * (i - 1))) / 180.0F * 3.1415927F;
float f1 = MathHelper.cos(f);
return this.locX + (double) f1 * 1.3D;
@@ -326,7 +321,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
if (i <= 0) {
return this.locZ;
} else {
- float f = (this.ax + (float) (180 * (i - 1))) / 180.0F * 3.1415927F;
+ float f = (this.ay + (float) (180 * (i - 1))) / 180.0F * 3.1415927F;
float f1 = MathHelper.sin(f);
return this.locZ + (double) f1 * 1.3D;
@@ -362,7 +357,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
EntityWitherSkull entitywitherskull = new EntityWitherSkull(this.world, this, d6, d7, d8);
if (flag) {
- entitywitherskull.e(true);
+ entitywitherskull.a(true);
}
entitywitherskull.locY = d4;
@@ -371,7 +366,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.world.addEntity(entitywitherskull);
}
- public void d(EntityLiving entityliving) {
+ public void a(EntityLiving entityliving, float f) {
this.a(0, entityliving);
}
@@ -386,7 +381,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
Entity entity;
if (this.o()) {
- entity = damagesource.f();
+ entity = damagesource.h();
if (entity instanceof EntityArrow) {
return false;
}
@@ -417,11 +412,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
// CraftBukkit end
}
- protected void bk() {
- this.bB = 0;
+ protected void bn() {
+ this.bC = 0;
}
- public boolean L() {
+ public boolean K() {
return !this.dead;
}
@@ -433,7 +428,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
public void addEffect(MobEffect mobeffect) {}
- protected boolean be() {
+ protected boolean bh() {
return true;
}
@@ -464,4 +459,8 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
public EnumMonsterType getMonsterType() {
return EnumMonsterType.UNDEAD;
}
+
+ public void mount(Entity entity) {
+ this.vehicle = null;
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityWitherSkull.java b/src/main/java/net/minecraft/server/EntityWitherSkull.java
index a1fcdb1d..2afb9761 100644
--- a/src/main/java/net/minecraft/server/EntityWitherSkull.java
+++ b/src/main/java/net/minecraft/server/EntityWitherSkull.java
@@ -25,8 +25,8 @@ public class EntityWitherSkull extends EntityFireball {
return false;
}
- public float a(Explosion explosion, Block block, int i, int j, int k) {
- float f = super.a(explosion, block, i, j, k);
+ public float a(Explosion explosion, World world, int i, int j, int k, Block block) {
+ float f = super.a(explosion, world, i, j, k, block);
if (this.d() && block != Block.BEDROCK && block != Block.ENDER_PORTAL && block != Block.ENDER_PORTAL_FRAME) {
f = Math.min(0.8F, f);
@@ -76,7 +76,7 @@ public class EntityWitherSkull extends EntityFireball {
}
}
- public boolean L() {
+ public boolean K() {
return false;
}
@@ -92,7 +92,7 @@ public class EntityWitherSkull extends EntityFireball {
return this.datawatcher.getByte(10) == 1;
}
- public void e(boolean flag) {
+ public void a(boolean flag) {
this.datawatcher.watch(10, Byte.valueOf((byte) (flag ? 1 : 0)));
}
}
diff --git a/src/main/java/net/minecraft/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java
index d413d8e8..15808442 100644
--- a/src/main/java/net/minecraft/server/EntityWolf.java
+++ b/src/main/java/net/minecraft/server/EntityWolf.java
@@ -13,15 +13,15 @@ public class EntityWolf extends EntityTameableAnimal {
super(world);
this.texture = "/mob/wolf.png";
this.a(0.6F, 0.8F);
- this.bH = 0.3F;
+ this.bI = 0.3F;
this.getNavigation().a(true);
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(2, this.d);
this.goalSelector.a(3, new PathfinderGoalLeapAtTarget(this, 0.4F));
- this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, this.bH, true));
- this.goalSelector.a(5, new PathfinderGoalFollowOwner(this, this.bH, 10.0F, 2.0F));
- this.goalSelector.a(6, new PathfinderGoalBreed(this, this.bH));
- this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, this.bH));
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, this.bI, true));
+ this.goalSelector.a(5, new PathfinderGoalFollowOwner(this, this.bI, 10.0F, 2.0F));
+ this.goalSelector.a(6, new PathfinderGoalBreed(this, this.bI));
+ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, this.bI));
this.goalSelector.a(8, new PathfinderGoalBeg(this, 8.0F));
this.goalSelector.a(9, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(9, new PathfinderGoalRandomLookaround(this));
@@ -31,7 +31,7 @@ public class EntityWolf extends EntityTameableAnimal {
this.targetSelector.a(4, new PathfinderGoalRandomTargetNonTamed(this, EntitySheep.class, 16.0F, 200, false));
}
- public boolean be() {
+ public boolean bh() {
return true;
}
@@ -42,7 +42,7 @@ public class EntityWolf extends EntityTameableAnimal {
}
}
- protected void bm() {
+ protected void bp() {
this.datawatcher.watch(18, Integer.valueOf(this.getScaledHealth())); // CraftBukkit - this.getHealth() -> this.getScaledHealth()
}
@@ -54,7 +54,7 @@ public class EntityWolf extends EntityTameableAnimal {
super.a();
this.datawatcher.a(18, new Integer(this.getHealth()));
this.datawatcher.a(19, new Byte((byte) 0));
- this.datawatcher.a(20, new Byte((byte) BlockCloth.e_(1)));
+ this.datawatcher.a(20, new Byte((byte) BlockCloth.g_(1)));
}
protected void a(int i, int j, int k, int l) {
@@ -80,20 +80,20 @@ public class EntityWolf extends EntityTameableAnimal {
return this.isAngry() && !this.isTamed();
}
- protected String aY() {
+ protected String bb() {
// CraftBukkit - getInt(18) < 10 -> < this.maxHealth / 2
return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.isTamed() && this.datawatcher.getInt(18) < this.maxHealth / 2 ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark");
}
- protected String aZ() {
+ protected String bc() {
return "mob.wolf.hurt";
}
- protected String ba() {
+ protected String bd() {
return "mob.wolf.death";
}
- protected float aX() {
+ protected float ba() {
return 0.4F;
}
@@ -111,27 +111,27 @@ public class EntityWolf extends EntityTameableAnimal {
}
}
- public void j_() {
- super.j_();
+ public void l_() {
+ super.l_();
this.f = this.e;
- if (this.bM()) {
+ if (this.bW()) {
this.e += (1.0F - this.e) * 0.4F;
} else {
this.e += (0.0F - this.e) * 0.4F;
}
- if (this.bM()) {
- this.bI = 10;
+ if (this.bW()) {
+ this.bJ = 10;
}
- if (this.G()) {
+ if (this.F()) {
this.g = true;
this.h = false;
this.i = 0.0F;
this.j = 0.0F;
} else if ((this.g || this.h) && this.h) {
if (this.i == 0.0F) {
- this.makeSound("mob.wolf.shake", this.aX(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.makeSound("mob.wolf.shake", this.ba(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
this.j = this.i;
@@ -161,8 +161,8 @@ public class EntityWolf extends EntityTameableAnimal {
return this.length * 0.8F;
}
- public int bp() {
- return this.isSitting() ? 20 : super.bp();
+ public int bs() {
+ return this.isSitting() ? 20 : super.bs();
}
public boolean damageEntity(DamageSource damagesource, int i) {
@@ -186,7 +186,7 @@ public class EntityWolf extends EntityTameableAnimal {
return entity.damageEntity(DamageSource.mobAttack(this), i);
}
- public boolean a(EntityHuman entityhuman) {
+ public boolean a_(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (this.isTamed()) {
@@ -207,7 +207,7 @@ public class EntityWolf extends EntityTameableAnimal {
return true;
}
} else if (itemstack.id == Item.INK_SACK.id) {
- int i = BlockCloth.e_(itemstack.getData());
+ int i = BlockCloth.g_(itemstack.getData());
if (i != this.getCollarColor()) {
this.setCollarColor(i);
@@ -222,7 +222,7 @@ public class EntityWolf extends EntityTameableAnimal {
if (entityhuman.name.equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.c(itemstack)) {
this.d.setSitting(!this.isSitting());
- this.bF = false;
+ this.bG = false;
this.setPathEntity((PathEntity) null);
}
} else if (itemstack != null && itemstack.id == Item.BONE.id && !this.isAngry()) {
@@ -249,10 +249,10 @@ public class EntityWolf extends EntityTameableAnimal {
this.setHealth(this.maxHealth);
// CraftBukkit end
this.setOwnerName(entityhuman.name);
- this.f(true);
+ this.i(true);
this.world.broadcastEntityEffect(this, (byte) 7);
} else {
- this.f(false);
+ this.i(false);
this.world.broadcastEntityEffect(this, (byte) 6);
}
}
@@ -260,14 +260,14 @@ public class EntityWolf extends EntityTameableAnimal {
return true;
}
- return super.a(entityhuman);
+ return super.a_(entityhuman);
}
public boolean c(ItemStack itemstack) {
return itemstack == null ? false : (!(Item.byId[itemstack.id] instanceof ItemFood) ? false : ((ItemFood) Item.byId[itemstack.id]).i());
}
- public int bv() {
+ public int by() {
return 8;
}
@@ -305,7 +305,7 @@ public class EntityWolf extends EntityTameableAnimal {
return entitywolf;
}
- public void j(boolean flag) {
+ public void m(boolean flag) {
byte b0 = this.datawatcher.getByte(19);
if (flag) {
@@ -329,7 +329,7 @@ public class EntityWolf extends EntityTameableAnimal {
}
}
- public boolean bM() {
+ public boolean bW() {
return this.datawatcher.getByte(19) == 1;
}
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index 87a63e13..da478d74 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -11,24 +11,28 @@ public class EntityZombie extends EntityMonster {
public EntityZombie(World world) {
super(world);
this.texture = "/mob/zombie.png";
- this.bH = 0.23F;
+ this.bI = 0.23F;
this.getNavigation().b(true);
this.goalSelector.a(0, new PathfinderGoalFloat(this));
this.goalSelector.a(1, new PathfinderGoalBreakDoor(this));
- this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, this.bH, false));
- this.goalSelector.a(3, new PathfinderGoalMeleeAttack(this, EntityVillager.class, this.bH, true));
- this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, this.bH));
- this.goalSelector.a(5, new PathfinderGoalMoveThroughVillage(this, this.bH, false));
- this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, this.bH));
+ this.goalSelector.a(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, this.bI, false));
+ this.goalSelector.a(3, new PathfinderGoalMeleeAttack(this, EntityVillager.class, this.bI, true));
+ this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, this.bI));
+ this.goalSelector.a(5, new PathfinderGoalMoveThroughVillage(this, this.bI, false));
+ this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, this.bI));
this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
- this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, false));
+ this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, true));
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 16.0F, 0, true));
this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, 16.0F, 0, false));
}
- public float bB() {
- return super.bB() * (this.isBaby() ? 1.5F : 1.0F);
+ protected int ay() {
+ return 40;
+ }
+
+ public float bE() {
+ return super.bE() * (this.isBaby() ? 1.5F : 1.0F);
}
protected void a() {
@@ -42,8 +46,8 @@ public class EntityZombie extends EntityMonster {
return 20;
}
- public int aW() {
- int i = super.aW() + 2;
+ public int aZ() {
+ int i = super.aZ() + 2;
if (i > 20) {
i = 20;
@@ -52,7 +56,7 @@ public class EntityZombie extends EntityMonster {
return i;
}
- protected boolean be() {
+ protected boolean bh() {
return true;
}
@@ -76,14 +80,14 @@ public class EntityZombie extends EntityMonster {
if (this.world.u() && !this.world.isStatic && !this.isBaby()) {
float f = this.c(1.0F);
- if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.k(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
+ if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.l(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) {
boolean flag = true;
ItemStack itemstack = this.getEquipment(4);
if (itemstack != null) {
- if (itemstack.f()) {
- itemstack.setData(itemstack.i() + this.random.nextInt(2));
- if (itemstack.i() >= itemstack.k()) {
+ if (itemstack.g()) {
+ itemstack.setData(itemstack.j() + this.random.nextInt(2));
+ if (itemstack.j() >= itemstack.l()) {
this.a(itemstack);
this.setEquipment(4, (ItemStack) null);
}
@@ -108,7 +112,7 @@ public class EntityZombie extends EntityMonster {
super.c();
}
- public void j_() {
+ public void l_() {
if (!this.world.isStatic && this.o()) {
int i = this.q();
@@ -118,12 +122,23 @@ public class EntityZombie extends EntityMonster {
}
}
- super.j_();
+ super.l_();
+ }
+
+ public boolean m(Entity entity) {
+ boolean flag = super.m(entity);
+
+ if (flag && this.bG() == null && this.isBurning() && this.random.nextFloat() < (float) this.world.difficulty * 0.3F) {
+ entity.setOnFire(2 * this.world.difficulty);
+ }
+
+ return flag;
}
public int c(Entity entity) {
- ItemStack itemstack = this.bD();
- int i = 4;
+ ItemStack itemstack = this.bG();
+ float f = (float) (this.getMaxHealth() - this.getHealth()) / (float) this.getMaxHealth();
+ int i = 3 + MathHelper.d(f * 4.0F);
if (itemstack != null) {
i += itemstack.a((Entity) this);
@@ -132,15 +147,15 @@ public class EntityZombie extends EntityMonster {
return i;
}
- protected String aY() {
+ protected String bb() {
return "mob.zombie.say";
}
- protected String aZ() {
+ protected String bc() {
return "mob.zombie.hurt";
}
- protected String ba() {
+ protected String bd() {
return "mob.zombie.death";
}
@@ -171,8 +186,8 @@ public class EntityZombie extends EntityMonster {
}
// CraftBukkit end
- protected void bE() {
- super.bE();
+ protected void bH() {
+ super.bH();
if (this.random.nextFloat() < (this.world.difficulty == 3 ? 0.05F : 0.01F)) {
int i = this.random.nextInt(3);
@@ -223,7 +238,7 @@ public class EntityZombie extends EntityMonster {
entityzombie.k(entityliving);
this.world.kill(entityliving);
- entityzombie.bG();
+ entityzombie.bJ();
entityzombie.setVillager(true);
if (entityliving.isBaby()) {
entityzombie.setBaby(true);
@@ -234,16 +249,16 @@ public class EntityZombie extends EntityMonster {
}
}
- public void bG() {
- this.canPickUpLoot = this.random.nextFloat() < at[this.world.difficulty];
+ public void bJ() {
+ this.h(this.random.nextFloat() < au[this.world.difficulty]);
if (this.world.random.nextFloat() < 0.05F) {
this.setVillager(true);
}
- this.bE();
- this.bF();
+ this.bH();
+ this.bI();
if (this.getEquipment(4) == null) {
- Calendar calendar = this.world.T();
+ Calendar calendar = this.world.U();
if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.random.nextFloat() < 0.25F) {
this.setEquipment(4, new ItemStack(this.random.nextFloat() < 0.1F ? Block.JACK_O_LANTERN : Block.PUMPKIN));
@@ -252,8 +267,8 @@ public class EntityZombie extends EntityMonster {
}
}
- public boolean a(EntityHuman entityhuman) {
- ItemStack itemstack = entityhuman.bS();
+ public boolean a_(EntityHuman entityhuman) {
+ ItemStack itemstack = entityhuman.cb();
if (itemstack != null && itemstack.getItem() == Item.GOLDEN_APPLE && itemstack.getData() == 0 && this.isVillager() && this.hasEffect(MobEffectList.WEAKNESS)) {
if (!entityhuman.abilities.canInstantlyBuild) {
@@ -290,7 +305,7 @@ public class EntityZombie extends EntityMonster {
EntityVillager entityvillager = new EntityVillager(this.world);
entityvillager.k(this);
- entityvillager.bG();
+ entityvillager.bJ();
entityvillager.q();
if (this.isBaby()) {
entityvillager.setAge(-24000);
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index ba2f88f0..aa3ae585 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -85,12 +85,12 @@ public class Explosion {
if (k1 > 0) {
Block block = Block.byId[k1];
- float f3 = this.source != null ? this.source.a(this, block, l, i1, j1) : block.a(this.source);
+ float f3 = this.source != null ? this.source.a(this, this.world, l, i1, j1, block) : block.a(this.source);
f1 -= (f3 + 0.3F) * f2;
}
- if (f1 > 0.0F && i1 < 256 && i1 >= 0) { // CraftBukkit - don't wrap explosions
+ if (f1 > 0.0F && (this.source == null || this.source.a(this, this.world, l, i1, j1, k1, f1)) && i1 < 256 && i1 >= 0) { // CraftBukkit - don't wrap explosions
hashset.add(new ChunkPosition(l, i1, j1));
}
@@ -143,7 +143,7 @@ public class Explosion {
if (!event.isCancelled()) {
damagee.setLastDamageCause(event);
- entity.damageEntity(DamageSource.EXPLOSION, event.getDamage());
+ entity.damageEntity(DamageSource.explosion(this), event.getDamage());
double d11 = EnchantmentProtection.a(entity, d10);
entity.motX += d0 * d11;
@@ -168,7 +168,7 @@ public class Explosion {
if (!event.isCancelled()) {
entity.getBukkitEntity().setLastDamageCause(event);
- entity.damageEntity(DamageSource.EXPLOSION, event.getDamage());
+ entity.damageEntity(DamageSource.explosion(this), event.getDamage());
entity.motX += d0 * d10;
entity.motY += d1 * d10;
@@ -272,11 +272,8 @@ public class Explosion {
block.dropNaturally(this.world, i, j, k, this.world.getData(i, j, k), event.getYield(), 0);
}
- if (this.world.setRawTypeIdAndData(i, j, k, 0, 0, this.world.isStatic)) {
- this.world.applyPhysics(i, j, k, 0);
- }
-
- block.wasExploded(this.world, i, j, k);
+ this.world.setTypeIdAndData(i, j, k, 0, 0, 3);
+ block.wasExploded(this.world, i, j, k, this);
}
}
}
@@ -292,8 +289,8 @@ public class Explosion {
l = this.world.getTypeId(i, j, k);
int i1 = this.world.getTypeId(i, j - 1, k);
- if (l == 0 && Block.q[i1] && this.j.nextInt(3) == 0) {
- this.world.setTypeId(i, j, k, Block.FIRE.id);
+ if (l == 0 && Block.s[i1] && this.j.nextInt(3) == 0) {
+ this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
}
}
}
@@ -302,4 +299,8 @@ public class Explosion {
public Map b() {
return this.l;
}
+
+ public EntityLiving c() {
+ return this.source == null ? null : (this.source instanceof EntityTNTPrimed ? ((EntityTNTPrimed) this.source).getSource() : (this.source instanceof EntityLiving ? (EntityLiving) this.source : null));
+ }
}
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java
index c311f57e..40bf6dec 100644
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
@@ -44,7 +44,7 @@ public class FoodMetaData {
}
}
- if (this.foodLevel >= 18 && entityhuman.cd()) {
+ if (this.foodLevel >= 18 && entityhuman.cm()) {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
// CraftBukkit - added RegainReason
diff --git a/src/main/java/net/minecraft/server/IDataManager.java b/src/main/java/net/minecraft/server/IDataManager.java
index a91d244a..5580893c 100644
--- a/src/main/java/net/minecraft/server/IDataManager.java
+++ b/src/main/java/net/minecraft/server/IDataManager.java
@@ -14,7 +14,7 @@ public interface IDataManager {
void saveWorldData(WorldData worlddata);
- PlayerFileData getPlayerFileData();
+ IPlayerFileData getPlayerFileData();
void a();
diff --git a/src/main/java/net/minecraft/server/IInventory.java b/src/main/java/net/minecraft/server/IInventory.java
index 3d336296..c77ce997 100644
--- a/src/main/java/net/minecraft/server/IInventory.java
+++ b/src/main/java/net/minecraft/server/IInventory.java
@@ -16,15 +16,19 @@ public interface IInventory {
String getName();
+ boolean c();
+
int getMaxStackSize();
void update();
- boolean a_(EntityHuman entityhuman);
+ boolean a(EntityHuman entityhuman);
void startOpen();
- void f();
+ void g();
+
+ boolean b(int i, ItemStack itemstack);
// CraftBukkit start
ItemStack[] getContents();
diff --git a/src/main/java/net/minecraft/server/InventoryCraftResult.java b/src/main/java/net/minecraft/server/InventoryCraftResult.java
index a2494017..9e254d8d 100644
--- a/src/main/java/net/minecraft/server/InventoryCraftResult.java
+++ b/src/main/java/net/minecraft/server/InventoryCraftResult.java
@@ -46,6 +46,10 @@ public class InventoryCraftResult implements IInventory {
return "Result";
}
+ public boolean c() {
+ return false;
+ }
+
public ItemStack splitStack(int i, int j) {
if (this.items[0] != null) {
ItemStack itemstack = this.items[0];
@@ -78,11 +82,15 @@ public class InventoryCraftResult implements IInventory {
public void update() {}
- public boolean a_(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
return true;
}
public void startOpen() {}
- public void f() {}
+ public void g() {}
+
+ public boolean b(int i, ItemStack itemstack) {
+ return true;
+ }
}
diff --git a/src/main/java/net/minecraft/server/InventoryCrafting.java b/src/main/java/net/minecraft/server/InventoryCrafting.java
index c840cde4..6e8ea2f8 100644
--- a/src/main/java/net/minecraft/server/InventoryCrafting.java
+++ b/src/main/java/net/minecraft/server/InventoryCrafting.java
@@ -86,6 +86,10 @@ public class InventoryCrafting implements IInventory {
return "container.crafting";
}
+ public boolean c() {
+ return false;
+ }
+
public ItemStack splitWithoutUpdate(int i) {
if (this.items[i] != null) {
ItemStack itemstack = this.items[i];
@@ -131,11 +135,15 @@ public class InventoryCrafting implements IInventory {
public void update() {}
- public boolean a_(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
return true;
}
public void startOpen() {}
- public void f() {}
+ public void g() {}
+
+ public boolean b(int i, ItemStack itemstack) {
+ return true;
+ }
}
diff --git a/src/main/java/net/minecraft/server/InventoryEnderChest.java b/src/main/java/net/minecraft/server/InventoryEnderChest.java
index 4e379cd7..221f9765 100644
--- a/src/main/java/net/minecraft/server/InventoryEnderChest.java
+++ b/src/main/java/net/minecraft/server/InventoryEnderChest.java
@@ -45,7 +45,7 @@ public class InventoryEnderChest extends InventorySubcontainer {
// CraftBukkit end
public InventoryEnderChest() {
- super("container.enderchest", 27);
+ super("container.enderchest", false, 27);
}
public void a(TileEntityEnderChest tileentityenderchest) {
@@ -69,7 +69,7 @@ public class InventoryEnderChest extends InventorySubcontainer {
}
}
- public NBTTagList g() {
+ public NBTTagList h() {
NBTTagList nbttaglist = new NBTTagList("EnderItems");
for (int i = 0; i < this.getSize(); ++i) {
@@ -87,8 +87,8 @@ public class InventoryEnderChest extends InventorySubcontainer {
return nbttaglist;
}
- public boolean a_(EntityHuman entityhuman) {
- return this.a != null && !this.a.a(entityhuman) ? false : super.a_(entityhuman);
+ public boolean a(EntityHuman entityhuman) {
+ return this.a != null && !this.a.a(entityhuman) ? false : super.a(entityhuman);
}
public void startOpen() {
@@ -99,12 +99,16 @@ public class InventoryEnderChest extends InventorySubcontainer {
super.startOpen();
}
- public void f() {
+ public void g() {
if (this.a != null) {
this.a.b();
}
- super.f();
+ super.g();
this.a = null;
}
+
+ public boolean b(int i, ItemStack itemstack) {
+ return true;
+ }
}
diff --git a/src/main/java/net/minecraft/server/InventoryLargeChest.java b/src/main/java/net/minecraft/server/InventoryLargeChest.java
index a13a5642..3eee4b8f 100644
--- a/src/main/java/net/minecraft/server/InventoryLargeChest.java
+++ b/src/main/java/net/minecraft/server/InventoryLargeChest.java
@@ -73,7 +73,11 @@ public class InventoryLargeChest implements IInventory {
}
public String getName() {
- return this.a;
+ return this.left.c() ? this.left.getName() : (this.right.c() ? this.right.getName() : this.a);
+ }
+
+ public boolean c() {
+ return this.left.c() || this.right.c();
}
public ItemStack getItem(int i) {
@@ -105,8 +109,8 @@ public class InventoryLargeChest implements IInventory {
this.right.update();
}
- public boolean a_(EntityHuman entityhuman) {
- return this.left.a_(entityhuman) && this.right.a_(entityhuman);
+ public boolean a(EntityHuman entityhuman) {
+ return this.left.a(entityhuman) && this.right.a(entityhuman);
}
public void startOpen() {
@@ -114,8 +118,12 @@ public class InventoryLargeChest implements IInventory {
this.right.startOpen();
}
- public void f() {
- this.left.f();
- this.right.f();
+ public void g() {
+ this.left.g();
+ this.right.g();
+ }
+
+ public boolean b(int i, ItemStack itemstack) {
+ return true;
}
}
diff --git a/src/main/java/net/minecraft/server/InventoryMerchant.java b/src/main/java/net/minecraft/server/InventoryMerchant.java
index 99726746..d89bcb30 100644
--- a/src/main/java/net/minecraft/server/InventoryMerchant.java
+++ b/src/main/java/net/minecraft/server/InventoryMerchant.java
@@ -68,7 +68,7 @@ public class InventoryMerchant implements IInventory {
itemstack = this.itemsInSlots[i];
this.itemsInSlots[i] = null;
if (this.d(i)) {
- this.g();
+ this.h();
}
return itemstack;
@@ -79,7 +79,7 @@ public class InventoryMerchant implements IInventory {
}
if (this.d(i)) {
- this.g();
+ this.h();
}
return itemstack;
@@ -111,7 +111,7 @@ public class InventoryMerchant implements IInventory {
}
if (this.d(i)) {
- this.g();
+ this.h();
}
}
@@ -119,23 +119,31 @@ public class InventoryMerchant implements IInventory {
return "mob.villager";
}
+ public boolean c() {
+ return false;
+ }
+
public int getMaxStackSize() {
return maxStack; // CraftBukkit
}
- public boolean a_(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
return this.merchant.m_() == entityhuman;
}
public void startOpen() {}
- public void f() {}
+ public void g() {}
+
+ public boolean b(int i, ItemStack itemstack) {
+ return true;
+ }
public void update() {
- this.g();
+ this.h();
}
- public void g() {
+ public void h() {
this.recipe = null;
ItemStack itemstack = this.itemsInSlots[0];
ItemStack itemstack1 = this.itemsInSlots[1];
@@ -177,6 +185,6 @@ public class InventoryMerchant implements IInventory {
public void c(int i) {
this.e = i;
- this.g();
+ this.h();
}
}
diff --git a/src/main/java/net/minecraft/server/InventorySubcontainer.java b/src/main/java/net/minecraft/server/InventorySubcontainer.java
index 94218a7e..c288380c 100644
--- a/src/main/java/net/minecraft/server/InventorySubcontainer.java
+++ b/src/main/java/net/minecraft/server/InventorySubcontainer.java
@@ -8,9 +8,11 @@ public abstract class InventorySubcontainer implements IInventory { // CraftBukk
private int b;
protected ItemStack[] items; // CraftBukkit - protected
private List d;
+ private boolean e;
- public InventorySubcontainer(String s, int i) {
+ public InventorySubcontainer(String s, boolean flag, int i) {
this.a = s;
+ this.e = flag;
this.b = i;
this.items = new ItemStack[i];
}
@@ -70,6 +72,10 @@ public abstract class InventorySubcontainer implements IInventory { // CraftBukk
return this.a;
}
+ public boolean c() {
+ return this.e;
+ }
+
public int getMaxStackSize() {
return 64;
}
@@ -82,11 +88,15 @@ public abstract class InventorySubcontainer implements IInventory { // CraftBukk
}
}
- public boolean a_(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
return true;
}
public void startOpen() {}
- public void f() {}
+ public void g() {}
+
+ public boolean b(int i, ItemStack itemstack) {
+ return true;
+ }
}
diff --git a/src/main/java/net/minecraft/server/ItemBed.java b/src/main/java/net/minecraft/server/ItemBed.java
index 15207f62..311fa730 100644
--- a/src/main/java/net/minecraft/server/ItemBed.java
+++ b/src/main/java/net/minecraft/server/ItemBed.java
@@ -37,16 +37,16 @@ public class ItemBed extends Item {
}
if (entityhuman.a(i, j, k, l, itemstack) && entityhuman.a(i + b0, j, k + b1, l, itemstack)) {
- if (world.isEmpty(i, j, k) && world.isEmpty(i + b0, j, k + b1) && world.v(i, j - 1, k) && world.v(i + b0, j - 1, k + b1)) {
+ if (world.isEmpty(i, j, k) && world.isEmpty(i + b0, j, k + b1) && world.w(i, j - 1, k) && world.v(i + b0, j - 1, k + b1)) {
// CraftBukkit start
- // world.setTypeIdAndData(i, j, k, blockbed.id, i1);
+ // world.setTypeIdAndData(i, j, k, blockbed.id, i1, 3);
if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, blockbed.id, i1, clickedX, clickedY, clickedZ)) {
return false;
}
// CraftBukkit end
if (world.getTypeId(i, j, k) == blockbed.id) {
- world.setTypeIdAndData(i + b0, j, k + b1, blockbed.id, i1 + 8);
+ world.setTypeIdAndData(i + b0, j, k + b1, blockbed.id, i1 + 8, 3);
}
--itemstack.count;
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index 95974764..c2d19482 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -7,7 +7,6 @@ public class ItemBlock extends Item {
public ItemBlock(int i) {
super(i);
this.id = i + 256;
- this.c(Block.byId[i + 256].a(2));
}
public int g() {
@@ -18,7 +17,7 @@ public class ItemBlock extends Item {
final int clickedX = i, clickedY = j, clickedZ = k;
int i1 = world.getTypeId(i, j, k);
- if (i1 == Block.SNOW.id) {
+ if (i1 == Block.SNOW.id && (world.getData(i, j, k) & 7) < 1) {
l = 1;
} else if (i1 != Block.VINE.id && i1 != Block.LONG_GRASS.id && i1 != Block.DEAD_BUSH.id) {
if (l == 0) {
@@ -52,16 +51,16 @@ public class ItemBlock extends Item {
return false;
} else if (j == 255 && Block.byId[this.id].material.isBuildable()) {
return false;
- } else if (world.mayPlace(this.id, i, j, k, false, l, entityhuman)) {
+ } else if (world.mayPlace(this.id, i, j, k, false, l, entityhuman, itemstack)) {
Block block = Block.byId[this.id];
int j1 = this.filterData(itemstack.getData());
int k1 = Block.byId[this.id].getPlacedData(world, i, j, k, l, f, f1, f2, j1);
// CraftBukkit start - redirect to common function handler
/*
- if (world.setTypeIdAndData(i, j, k, this.id, k1)) {
+ if (world.setTypeIdAndData(i, j, k, this.id, k1, 3)) {
if (world.getTypeId(i, j, k) == this.id) {
- Block.byId[this.id].postPlace(world, i, j, k, entityhuman);
+ Block.byId[this.id].postPlace(world, i, j, k, entityhuman, itemstack);
Block.byId[this.id].postPlace(world, i, j, k, k1);
}
@@ -80,19 +79,16 @@ public class ItemBlock extends Item {
static boolean processBlockPlace(final World world, final EntityHuman entityhuman, final ItemStack itemstack, final int x, final int y, final int z, final int id, final int data, final int clickedX, final int clickedY, final int clickedZ) {
org.bukkit.block.BlockState blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(world, x, y, z);
- world.suppressPhysics = true;
world.callingPlaceEvent = true;
- world.setRawTypeIdAndData(x, y, z, id, data);
+ world.setTypeIdAndData(x, y, z, id, data, 3);
org.bukkit.event.block.BlockPlaceEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockstate, clickedX, clickedY, clickedZ);
if (event.isCancelled() || !event.canBuild()) {
blockstate.update(true);
- world.suppressPhysics = false;
world.callingPlaceEvent = false;
return false;
}
- world.suppressPhysics = false;
world.callingPlaceEvent = false;
int newId = world.getTypeId(x, y, z);
@@ -107,7 +103,7 @@ public class ItemBlock extends Item {
// Skulls don't get block data applied to them
if (block != null && block != Block.SKULL) {
- block.postPlace(world, x, y, z, entityhuman);
+ block.postPlace(world, x, y, z, entityhuman, itemstack);
block.postPlace(world, x, y, z, newData);
world.makeSound((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
diff --git a/src/main/java/net/minecraft/server/ItemBoat.java b/src/main/java/net/minecraft/server/ItemBoat.java
index cb9b38d5..494c4d31 100644
--- a/src/main/java/net/minecraft/server/ItemBoat.java
+++ b/src/main/java/net/minecraft/server/ItemBoat.java
@@ -41,8 +41,8 @@ public class ItemBoat extends Item {
for (i = 0; i < list.size(); ++i) {
Entity entity = (Entity) list.get(i);
- if (entity.L()) {
- float f10 = entity.Y();
+ if (entity.K()) {
+ float f10 = entity.X();
AxisAlignedBB axisalignedbb = entity.boundingBox.grow((double) f10, (double) f10, (double) f10);
if (axisalignedbb.a(vec3d)) {
diff --git a/src/main/java/net/minecraft/server/ItemBow.java b/src/main/java/net/minecraft/server/ItemBow.java
index f62ec9a7..ad34840d 100644
--- a/src/main/java/net/minecraft/server/ItemBow.java
+++ b/src/main/java/net/minecraft/server/ItemBow.java
@@ -2,6 +2,8 @@ package net.minecraft.server;
public class ItemBow extends Item {
+ public static final String[] a = new String[] { "bow_pull_0", "bow_pull_1", "bow_pull_2"};
+
public ItemBow(int i) {
super(i);
this.maxStackSize = 1;
@@ -28,7 +30,7 @@ public class ItemBow extends Item {
EntityArrow entityarrow = new EntityArrow(world, entityhuman, f * 2.0F);
if (f == 1.0F) {
- entityarrow.e(true);
+ entityarrow.a(true);
}
int k = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, itemstack);
@@ -60,7 +62,7 @@ public class ItemBow extends Item {
// CraftBukkit end
itemstack.damage(1, entityhuman);
- world.makeSound(entityhuman, "random.bow", 1.0F, 1.0F / (d.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
+ world.makeSound(entityhuman, "random.bow", 1.0F, 1.0F / (e.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
if (flag) {
entityarrow.fromPlayer = 2;
} else {
@@ -79,7 +81,7 @@ public class ItemBow extends Item {
}
public EnumAnimation b_(ItemStack itemstack) {
- return EnumAnimation.e;
+ return EnumAnimation.BOW;
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java
index 9a1ee774..ecab05b2 100644
--- a/src/main/java/net/minecraft/server/ItemBucket.java
+++ b/src/main/java/net/minecraft/server/ItemBucket.java
@@ -51,7 +51,7 @@ public class ItemBucket extends Item {
return itemstack;
}
// CraftBukkit end
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
if (entityhuman.abilities.canInstantlyBuild) {
return itemstack;
}
@@ -76,7 +76,7 @@ public class ItemBucket extends Item {
return itemstack;
}
// CraftBukkit end
- world.setTypeId(i, j, k, 0);
+ world.setAir(i, j, k);
if (entityhuman.abilities.canInstantlyBuild) {
return itemstack;
}
@@ -177,7 +177,7 @@ public class ItemBucket extends Item {
world.addParticle("largesmoke", (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D);
}
} else {
- world.setTypeIdAndData(i, j, k, this.a, 0);
+ world.setTypeIdAndData(i, j, k, this.a, 0, 3);
}
return true;
diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java
index ea19a3ab..438a69ad 100644
--- a/src/main/java/net/minecraft/server/ItemDoor.java
+++ b/src/main/java/net/minecraft/server/ItemDoor.java
@@ -72,8 +72,8 @@ public class ItemDoor extends Item {
b0 = 1;
}
- int i1 = (world.t(i - b0, j, k - b1) ? 1 : 0) + (world.t(i - b0, j + 1, k - b1) ? 1 : 0);
- int j1 = (world.t(i + b0, j, k + b1) ? 1 : 0) + (world.t(i + b0, j + 1, k + b1) ? 1 : 0);
+ int i1 = (world.u(i - b0, j, k - b1) ? 1 : 0) + (world.u(i - b0, j + 1, k - b1) ? 1 : 0);
+ int j1 = (world.u(i + b0, j, k + b1) ? 1 : 0) + (world.u(i + b0, j + 1, k + b1) ? 1 : 0);
boolean flag = world.getTypeId(i - b0, j, k - b1) == block.id || world.getTypeId(i - b0, j + 1, k - b1) == block.id;
boolean flag1 = world.getTypeId(i + b0, j, k + b1) == block.id || world.getTypeId(i + b0, j + 1, k + b1) == block.id;
boolean flag2 = false;
@@ -84,7 +84,6 @@ public class ItemDoor extends Item {
flag2 = true;
}
- world.suppressPhysics = true;
// CraftBukkit start
if (entityhuman != null) {
if(!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, block.id, l, clickedX, clickedY, clickedZ)) {
@@ -96,14 +95,11 @@ public class ItemDoor extends Item {
((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet53BlockChange(i, j + 1, k, world));
return true;
}
-
- world.suppressPhysics = true;
} else {
- world.setTypeIdAndData(i, j, k, block.id, l);
+ world.setTypeIdAndData(i, j, k, block.id, l, 2);
}
// CraftBukkit end
- world.setTypeIdAndData(i, j + 1, k, block.id, 8 | (flag2 ? 1 : 0));
- world.suppressPhysics = false;
+ world.setTypeIdAndData(i, j + 1, k, block.id, 8 | (flag2 ? 1 : 0), 2);
world.applyPhysics(i, j, k, block.id);
world.applyPhysics(i, j + 1, k, block.id);
return true; // CraftBukkit
diff --git a/src/main/java/net/minecraft/server/ItemDye.java b/src/main/java/net/minecraft/server/ItemDye.java
index b93421af..6e05654e 100644
--- a/src/main/java/net/minecraft/server/ItemDye.java
+++ b/src/main/java/net/minecraft/server/ItemDye.java
@@ -8,7 +8,8 @@ import org.bukkit.event.entity.SheepDyeWoolEvent;
public class ItemDye extends Item {
public static final String[] a = new String[] { "black", "red", "green", "brown", "blue", "purple", "cyan", "silver", "gray", "pink", "lime", "yellow", "lightBlue", "magenta", "orange", "white"};
- public static final int[] b = new int[] { 1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320};
+ public static final String[] b = new String[] { "dyePowder_black", "dyePowder_red", "dyePowder_green", "dyePowder_brown", "dyePowder_blue", "dyePowder_purple", "dyePowder_cyan", "dyePowder_silver", "dyePowder_gray", "dyePowder_pink", "dyePowder_lime", "dyePowder_yellow", "dyePowder_lightBlue", "dyePowder_magenta", "dyePowder_orange", "dyePowder_white"};
+ public static final int[] c = new int[] { 1973019, 11743532, 3887386, 5320730, 2437522, 8073150, 2651799, 11250603, 4408131, 14188952, 4312372, 14602026, 6719955, 12801229, 15435844, 15790320};
public ItemDye(int i) {
super(i);
@@ -27,112 +28,19 @@ public class ItemDye extends Item {
if (!entityhuman.a(i, j, k, l, itemstack)) {
return false;
} else {
- int i1;
- int j1;
- int k1;
-
if (itemstack.getData() == 15) {
- i1 = world.getTypeId(i, j, k);
- if (i1 == Block.SAPLING.id) {
+ if (a(itemstack, world, i, j, k, entityhuman)) {
if (!world.isStatic) {
- // CraftBukkit start
- Player player = (entityhuman instanceof EntityPlayer) ? (Player) entityhuman.getBukkitEntity() : null;
- ((BlockSapling) Block.SAPLING).grow(world, i, j, k, world.random, true, player, itemstack);
- //--itemstack.count; - called later if the bonemeal attempt was succesful
- // CraftBukkit end
- }
-
- return true;
- }
-
- if (i1 == Block.BROWN_MUSHROOM.id || i1 == Block.RED_MUSHROOM.id) {
- // CraftBukkit start
- if (!world.isStatic) {
- Player player = (entityhuman instanceof EntityPlayer) ? (Player) entityhuman.getBukkitEntity() : null;
- ((BlockMushroom) Block.byId[i1]).grow(world, i, j, k, world.random, true, player, itemstack);
- //--itemstack.count; - called later if the bonemeal attempt was succesful
- // CraftBukkit end
- }
-
- return true;
- }
-
- if (i1 == Block.MELON_STEM.id || i1 == Block.PUMPKIN_STEM.id) {
- if (world.getData(i, j, k) == 7) {
- return false;
- }
-
- if (!world.isStatic) {
- ((BlockStem) Block.byId[i1]).l(world, i, j, k);
- --itemstack.count;
- }
-
- return true;
- }
-
- if (i1 > 0 && Block.byId[i1] instanceof BlockCrops) {
- if (world.getData(i, j, k) == 7) {
- return false;
- }
-
- if (!world.isStatic) {
- ((BlockCrops) Block.byId[i1]).c_(world, i, j, k);
- --itemstack.count;
- }
-
- return true;
- }
-
- if (i1 == Block.COCOA.id) {
- if (!world.isStatic) {
- world.setData(i, j, k, 8 | BlockDirectional.e(world.getData(i, j, k)));
- --itemstack.count;
- }
-
- return true;
- }
-
- if (i1 == Block.GRASS.id) {
- if (!world.isStatic) {
- --itemstack.count;
-
- label133:
- for (j1 = 0; j1 < 128; ++j1) {
- k1 = i;
- int l1 = j + 1;
- int i2 = k;
-
- for (int j2 = 0; j2 < j1 / 16; ++j2) {
- k1 += d.nextInt(3) - 1;
- l1 += (d.nextInt(3) - 1) * d.nextInt(3) / 2;
- i2 += d.nextInt(3) - 1;
- if (world.getTypeId(k1, l1 - 1, i2) != Block.GRASS.id || world.t(k1, l1, i2)) {
- continue label133;
- }
- }
-
- if (world.getTypeId(k1, l1, i2) == 0) {
- if (d.nextInt(10) != 0) {
- if (Block.LONG_GRASS.d(world, k1, l1, i2)) {
- world.setTypeIdAndData(k1, l1, i2, Block.LONG_GRASS.id, 1);
- }
- } else if (d.nextInt(3) != 0) {
- if (Block.YELLOW_FLOWER.d(world, k1, l1, i2)) {
- world.setTypeId(k1, l1, i2, Block.YELLOW_FLOWER.id);
- }
- } else if (Block.RED_ROSE.d(world, k1, l1, i2)) {
- world.setTypeId(k1, l1, i2, Block.RED_ROSE.id);
- }
- }
- }
+ world.triggerEffect(2005, i, j, k, 0);
}
return true;
}
} else if (itemstack.getData() == 3) {
- i1 = world.getTypeId(i, j, k);
- j1 = world.getData(i, j, k);
- if (i1 == Block.LOG.id && BlockLog.e(j1) == 3) {
+ int i1 = world.getTypeId(i, j, k);
+ int j1 = world.getData(i, j, k);
+
+ if (i1 == Block.LOG.id && BlockLog.d(j1) == 3) {
if (l == 0) {
return false;
}
@@ -158,8 +66,8 @@ public class ItemDye extends Item {
}
if (world.isEmpty(i, j, k)) {
- k1 = Block.byId[Block.COCOA.id].getPlacedData(world, i, j, k, l, f, f1, f2, 0);
- world.setTypeIdAndData(i, j, k, Block.COCOA.id, k1);
+ int k1 = Block.byId[Block.COCOA.id].getPlacedData(world, i, j, k, l, f, f1, f2, 0);
+ world.setTypeIdAndData(i, j, k, Block.COCOA.id, k1, 2);
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
}
@@ -173,10 +81,131 @@ public class ItemDye extends Item {
}
}
+ // CraftBukkit start
+ public static boolean a(ItemStack itemstack, World world, int i, int j, int k) {
+ return a(itemstack, world, i, j, k, null);
+ }
+
+ public static boolean a(ItemStack itemstack, World world, int i, int j, int k, EntityHuman entityhuman) {
+ // CraftBukkit end
+ int l = world.getTypeId(i, j, k);
+
+ if (l == Block.SAPLING.id) {
+ if (!world.isStatic) {
+ if ((double) world.random.nextFloat() < 0.45D) {
+ // CraftBukkit start
+ Player player = (entityhuman instanceof EntityPlayer) ? (Player) entityhuman.getBukkitEntity() : null;
+ ((BlockSapling) Block.SAPLING).grow(world, i, j, k, world.random, true, player, itemstack);
+ }
+
+ // --itemstack.count; - called later if the bonemeal attempt was succesful
+ // CraftBukkit end
+ }
+
+ return true;
+ } else if (l != Block.BROWN_MUSHROOM.id && l != Block.RED_MUSHROOM.id) {
+ if (l != Block.MELON_STEM.id && l != Block.PUMPKIN_STEM.id) {
+ if (l > 0 && Block.byId[l] instanceof BlockCrops) {
+ if (world.getData(i, j, k) == 7) {
+ return false;
+ } else {
+ if (!world.isStatic) {
+ ((BlockCrops) Block.byId[l]).e_(world, i, j, k);
+ --itemstack.count;
+ }
+
+ return true;
+ }
+ } else {
+ int i1;
+ int j1;
+ int k1;
+
+ if (l == Block.COCOA.id) {
+ i1 = world.getData(i, j, k);
+ j1 = BlockDirectional.j(i1);
+ k1 = BlockCocoa.c(i1);
+ if (k1 >= 2) {
+ return false;
+ } else {
+ if (!world.isStatic) {
+ ++k1;
+ world.setData(i, j, k, k1 << 2 | j1, 2);
+ --itemstack.count;
+ }
+
+ return true;
+ }
+ } else if (l != Block.GRASS.id) {
+ return false;
+ } else {
+ if (!world.isStatic) {
+ --itemstack.count;
+
+ label102:
+ for (i1 = 0; i1 < 128; ++i1) {
+ j1 = i;
+ k1 = j + 1;
+ int l1 = k;
+
+ for (int i2 = 0; i2 < i1 / 16; ++i2) {
+ j1 += e.nextInt(3) - 1;
+ k1 += (e.nextInt(3) - 1) * e.nextInt(3) / 2;
+ l1 += e.nextInt(3) - 1;
+ if (world.getTypeId(j1, k1 - 1, l1) != Block.GRASS.id || world.u(j1, k1, l1)) {
+ continue label102;
+ }
+ }
+
+ if (world.getTypeId(j1, k1, l1) == 0) {
+ if (e.nextInt(10) != 0) {
+ if (Block.LONG_GRASS.f(world, j1, k1, l1)) {
+ world.setTypeIdAndData(j1, k1, l1, Block.LONG_GRASS.id, 1, 3);
+ }
+ } else if (e.nextInt(3) != 0) {
+ if (Block.YELLOW_FLOWER.f(world, j1, k1, l1)) {
+ world.setTypeIdUpdate(j1, k1, l1, Block.YELLOW_FLOWER.id);
+ }
+ } else if (Block.RED_ROSE.f(world, j1, k1, l1)) {
+ world.setTypeIdUpdate(j1, k1, l1, Block.RED_ROSE.id);
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+ }
+ } else if (world.getData(i, j, k) == 7) {
+ return false;
+ } else {
+ if (!world.isStatic) {
+ ((BlockStem) Block.byId[l]).k(world, i, j, k);
+ --itemstack.count;
+ }
+
+ return true;
+ }
+ } else {
+ if (!world.isStatic) {
+ if ((double) world.random.nextFloat() < 0.4D) {
+ // CraftBukkit start - validate
+ Player player = (entityhuman instanceof EntityPlayer) ? (Player) entityhuman.getBukkitEntity() : null;
+ ((BlockMushroom) Block.byId[l]).grow(world, i, j, k, world.random, true, player, itemstack);
+ }
+
+ //--itemstack.count; - called later if the bonemeal attempt was succesful
+ // CraftBukkit end
+ }
+
+ return true;
+ }
+ }
+
public boolean a(ItemStack itemstack, EntityLiving entityliving) {
if (entityliving instanceof EntitySheep) {
EntitySheep entitysheep = (EntitySheep) entityliving;
- int i = BlockCloth.e_(itemstack.getData());
+ int i = BlockCloth.g_(itemstack.getData());
if (!entitysheep.isSheared() && entitysheep.getColor() != i) {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/ItemFireball.java b/src/main/java/net/minecraft/server/ItemFireball.java
index 6705127e..decf0216 100644
--- a/src/main/java/net/minecraft/server/ItemFireball.java
+++ b/src/main/java/net/minecraft/server/ItemFireball.java
@@ -61,8 +61,8 @@ public class ItemFireball extends Item {
}
// CraftBukkit end
- world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, d.nextFloat() * 0.4F + 0.8F);
- world.setTypeId(i, j, k, Block.FIRE.id);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, e.nextFloat() * 0.4F + 0.8F);
+ world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
}
if (!entityhuman.abilities.canInstantlyBuild) {
diff --git a/src/main/java/net/minecraft/server/ItemFishingRod.java b/src/main/java/net/minecraft/server/ItemFishingRod.java
index 88a756d7..eb91ce57 100644
--- a/src/main/java/net/minecraft/server/ItemFishingRod.java
+++ b/src/main/java/net/minecraft/server/ItemFishingRod.java
@@ -16,7 +16,7 @@ public class ItemFishingRod extends Item {
int i = entityhuman.hookedFish.c();
itemstack.damage(i, entityhuman);
- entityhuman.bH();
+ entityhuman.bK();
} else {
// CraftBukkit start
PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, PlayerFishEvent.State.FISHING);
@@ -27,12 +27,12 @@ public class ItemFishingRod extends Item {
}
// CraftBukkit end
- world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (d.nextFloat() * 0.4F + 0.8F));
+ world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (e.nextFloat() * 0.4F + 0.8F));
if (!world.isStatic) {
world.addEntity(new EntityFishingHook(world, entityhuman));
}
- entityhuman.bH();
+ entityhuman.bK();
}
return itemstack;
diff --git a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
index c12b297b..88b28cb3 100644
--- a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
+++ b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
@@ -63,8 +63,8 @@ public class ItemFlintAndSteel extends Item {
CraftBlockState blockState = CraftBlockState.getBlockState(world, i, j, k);
// CraftBukkit end
- world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, d.nextFloat() * 0.4F + 0.8F);
- world.setTypeId(i, j, k, Block.FIRE.id);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, e.nextFloat() * 0.4F + 0.8F);
+ world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
// CraftBukkit start
org.bukkit.event.block.BlockPlaceEvent placeEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPlaceEvent(world, entityhuman, blockState, clickedX, clickedY, clickedZ);
diff --git a/src/main/java/net/minecraft/server/ItemFood.java b/src/main/java/net/minecraft/server/ItemFood.java
index 28fbe430..409addf8 100644
--- a/src/main/java/net/minecraft/server/ItemFood.java
+++ b/src/main/java/net/minecraft/server/ItemFood.java
@@ -5,18 +5,18 @@ public class ItemFood extends Item {
public final int a;
private final int b;
private final float c;
- private final boolean co;
- private boolean cp;
- private int cq;
- private int cr;
- private int cs;
- private float ct;
+ private final boolean d;
+ private boolean cu;
+ private int cv;
+ private int cw;
+ private int cx;
+ private float cy;
public ItemFood(int i, int j, float f, boolean flag) {
super(i);
this.a = 32;
this.b = j;
- this.co = flag;
+ this.d = flag;
this.c = f;
this.a(CreativeModeTab.h);
}
@@ -45,8 +45,8 @@ public class ItemFood extends Item {
}
protected void c(ItemStack itemstack, World world, EntityHuman entityhuman) {
- if (!world.isStatic && this.cq > 0 && world.random.nextFloat() < this.ct) {
- entityhuman.addEffect(new MobEffect(this.cq, this.cr * 20, this.cs));
+ if (!world.isStatic && this.cv > 0 && world.random.nextFloat() < this.cy) {
+ entityhuman.addEffect(new MobEffect(this.cv, this.cw * 20, this.cx));
}
}
@@ -55,11 +55,11 @@ public class ItemFood extends Item {
}
public EnumAnimation b_(ItemStack itemstack) {
- return EnumAnimation.b;
+ return EnumAnimation.EAT;
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
- if (entityhuman.g(this.cp)) {
+ if (entityhuman.i(this.cu)) {
entityhuman.a(itemstack, this.c_(itemstack));
}
@@ -75,19 +75,19 @@ public class ItemFood extends Item {
}
public boolean i() {
- return this.co;
+ return this.d;
}
public ItemFood a(int i, int j, int k, float f) {
- this.cq = i;
- this.cr = j;
- this.cs = k;
- this.ct = f;
+ this.cv = i;
+ this.cw = j;
+ this.cx = k;
+ this.cy = f;
return this;
}
public ItemFood j() {
- this.cp = true;
+ this.cu = true;
return this;
}
}
diff --git a/src/main/java/net/minecraft/server/ItemHoe.java b/src/main/java/net/minecraft/server/ItemHoe.java
index f64db5c2..aa96737e 100644
--- a/src/main/java/net/minecraft/server/ItemHoe.java
+++ b/src/main/java/net/minecraft/server/ItemHoe.java
@@ -30,7 +30,7 @@ public class ItemHoe extends Item {
return true;
} else {
// CraftBukkit start - Hoes - blockface -1 for 'SELF'
- // world.setTypeId(i, j, k, block.id);
+ // world.setTypeIdUpdate(i, j, k, block.id);
if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, block.id, 0, clickedX, clickedY, clickedZ)) {
return false;
}
diff --git a/src/main/java/net/minecraft/server/ItemMinecart.java b/src/main/java/net/minecraft/server/ItemMinecart.java
index cd06b9b7..b4320456 100644
--- a/src/main/java/net/minecraft/server/ItemMinecart.java
+++ b/src/main/java/net/minecraft/server/ItemMinecart.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
public class ItemMinecart extends Item {
+ private static final IDispenseBehavior b = new DispenseBehaviorMinecart();
public int a;
public ItemMinecart(int i, int j) {
@@ -9,12 +10,13 @@ public class ItemMinecart extends Item {
this.maxStackSize = 1;
this.a = j;
this.a(CreativeModeTab.e);
+ BlockDispenser.a.a(this, b);
}
public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
int i1 = world.getTypeId(i, j, k);
- if (BlockMinecartTrack.e(i1)) {
+ if (BlockMinecartTrack.d_(i1)) {
if (!world.isStatic) {
// CraftBukkit start - Minecarts
org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, i, j, k, l, itemstack);
@@ -24,7 +26,13 @@ public class ItemMinecart extends Item {
}
// CraftBukkit end
- world.addEntity(new EntityMinecart(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.a));
+ EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.a);
+
+ if (itemstack.hasName()) {
+ entityminecartabstract.a(itemstack.getName());
+ }
+
+ world.addEntity(entityminecartabstract);
}
--itemstack.count;
diff --git a/src/main/java/net/minecraft/server/ItemMonsterEgg.java b/src/main/java/net/minecraft/server/ItemMonsterEgg.java
index ead857e4..a1fe7039 100644
--- a/src/main/java/net/minecraft/server/ItemMonsterEgg.java
+++ b/src/main/java/net/minecraft/server/ItemMonsterEgg.java
@@ -34,8 +34,16 @@ public class ItemMonsterEgg extends Item {
d0 = 0.5D;
}
- if (a(world, itemstack.getData(), (double) i + 0.5D, (double) j + d0, (double) k + 0.5D) != null && !entityhuman.abilities.canInstantlyBuild) {
- --itemstack.count;
+ Entity entity = a(world, itemstack.getData(), (double) i + 0.5D, (double) j + d0, (double) k + 0.5D);
+
+ if (entity != null) {
+ if (entity instanceof EntityLiving && itemstack.hasName()) {
+ ((EntityLiving) entity).setCustomName(itemstack.getName());
+ }
+
+ if (!entityhuman.abilities.canInstantlyBuild) {
+ --itemstack.count;
+ }
}
return true;
@@ -54,11 +62,11 @@ public class ItemMonsterEgg extends Item {
EntityLiving entityliving = (EntityLiving) entity;
entity.setPositionRotation(d0, d1, d2, MathHelper.g(world.random.nextFloat() * 360.0F), 0.0F);
- entityliving.az = entityliving.yaw;
- entityliving.ax = entityliving.yaw;
- entityliving.bG();
+ entityliving.aA = entityliving.yaw;
+ entityliving.ay = entityliving.yaw;
+ entityliving.bJ();
world.addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
- entityliving.aO();
+ entityliving.aR();
}
}
diff --git a/src/main/java/net/minecraft/server/ItemRedstone.java b/src/main/java/net/minecraft/server/ItemRedstone.java
index dee5f0d1..ad43b412 100644
--- a/src/main/java/net/minecraft/server/ItemRedstone.java
+++ b/src/main/java/net/minecraft/server/ItemRedstone.java
@@ -45,7 +45,7 @@ public class ItemRedstone extends Item {
if (Block.REDSTONE_WIRE.canPlace(world, i, j, k)) {
// CraftBukkit start
// --itemstack.count;
- // world.setTypeId(i, j, k, Block.REDSTONE_WIRE.id);
+ // world.setTypeIdUpdate(i, j, k, Block.REDSTONE_WIRE.id);
if (!ItemBlock.processBlockPlace(world, entityhuman, itemstack, i, j, k, Block.REDSTONE_WIRE.id, 0, clickedX, clickedY, clickedZ)) {
return false;
}
diff --git a/src/main/java/net/minecraft/server/ItemReed.java b/src/main/java/net/minecraft/server/ItemReed.java
index ab8164c7..156218d8 100644
--- a/src/main/java/net/minecraft/server/ItemReed.java
+++ b/src/main/java/net/minecraft/server/ItemReed.java
@@ -13,7 +13,7 @@ public class ItemReed extends Item {
final int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
int i1 = world.getTypeId(i, j, k);
- if (i1 == Block.SNOW.id) {
+ if (i1 == Block.SNOW.id && (world.getData(i, j, k) & 7) < 1) {
l = 1;
} else if (i1 != Block.VINE.id && i1 != Block.LONG_GRASS.id && i1 != Block.DEAD_BUSH.id) {
if (l == 0) {
@@ -46,16 +46,16 @@ public class ItemReed extends Item {
} else if (itemstack.count == 0) {
return false;
} else {
- if (world.mayPlace(this.id, i, j, k, false, l, (Entity) null)) {
+ if (world.mayPlace(this.id, i, j, k, false, l, (Entity) null, itemstack)) {
Block block = Block.byId[this.id];
int j1 = block.getPlacedData(world, i, j, k, l, f, f1, f2, 0);
// CraftBukkit start - redirect to common handler
ItemBlock.processBlockPlace(world, entityhuman, itemstack, i, j, k, this.id, j1, clickedX, clickedY, clickedZ);
/*
- if (world.setTypeIdAndData(i, j, k, this.id, j1)) {
+ if (world.setTypeIdAndData(i, j, k, this.id, j1, 3)) {
if (world.getTypeId(i, j, k) == this.id) {
- Block.byId[this.id].postPlace(world, i, j, k, entityhuman);
+ Block.byId[this.id].postPlace(world, i, j, k, entityhuman, itemstack);
Block.byId[this.id].postPlace(world, i, j, k, j1);
}
diff --git a/src/main/java/net/minecraft/server/ItemSeedFood.java b/src/main/java/net/minecraft/server/ItemSeedFood.java
index e14f407b..7fc09d86 100644
--- a/src/main/java/net/minecraft/server/ItemSeedFood.java
+++ b/src/main/java/net/minecraft/server/ItemSeedFood.java
@@ -20,7 +20,7 @@ public class ItemSeedFood extends ItemFood {
if (i1 == this.c && world.isEmpty(i, j + 1, k)) {
// CraftBukkit start
- // world.setTypeId(i, j + 1, k, this.b);
+ // world.setTypeIdUpdate(i, j + 1, k, this.b);
if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j + 1, k, this.b, 0, clickedX, clickedY, clickedZ)) {
return false;
}
diff --git a/src/main/java/net/minecraft/server/ItemSeeds.java b/src/main/java/net/minecraft/server/ItemSeeds.java
index 258613e0..8042681c 100644
--- a/src/main/java/net/minecraft/server/ItemSeeds.java
+++ b/src/main/java/net/minecraft/server/ItemSeeds.java
@@ -21,7 +21,7 @@ public class ItemSeeds extends Item {
if (i1 == this.b && world.isEmpty(i, j + 1, k)) {
// CraftBukkit start - seeds
- // world.setTypeId(i, j + 1, k, this.id);
+ // world.setTypeIdUpdate(i, j + 1, k, this.id);
if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j + 1, k, this.id, 0, clickedX, clickedY, clickedZ)) {
return false;
}
diff --git a/src/main/java/net/minecraft/server/ItemSign.java b/src/main/java/net/minecraft/server/ItemSign.java
index 6fa75a3e..7a4c32d5 100644
--- a/src/main/java/net/minecraft/server/ItemSign.java
+++ b/src/main/java/net/minecraft/server/ItemSign.java
@@ -45,11 +45,11 @@ public class ItemSign extends Item {
if (l == 1) {
int i1 = MathHelper.floor((double) ((entityhuman.yaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
- // world.setTypeIdAndData(i, j, k, Block.SIGN_POST.id, i1);
+ // world.setTypeIdAndData(i, j, k, Block.SIGN_POST.id, i1, 2);
block = Block.SIGN_POST;
l = i1;
} else {
- // world.setTypeIdAndData(i, j, k, Block.WALL_SIGN.id, l);
+ // world.setTypeIdAndData(i, j, k, Block.WALL_SIGN.id, l, 2);
block = Block.WALL_SIGN;
}
if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, block.id, l, clickedX, clickedY, clickedZ)) {
diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java
index bd2fe456..96092722 100644
--- a/src/main/java/net/minecraft/server/ItemSkull.java
+++ b/src/main/java/net/minecraft/server/ItemSkull.java
@@ -2,8 +2,8 @@ package net.minecraft.server;
public class ItemSkull extends Item {
- private static final String[] a = new String[] { "skeleton", "wither", "zombie", "char", "creeper"};
- private static final int[] b = new int[] { 224, 225, 226, 227, 228};
+ private static final String[] b = new String[] { "skeleton", "wither", "zombie", "char", "creeper"};
+ public static final String[] a = new String[] { "skull_skeleton", "skull_wither", "skull_zombie", "skull_char", "skull_creeper"};
public ItemSkull(int i) {
super(i);
@@ -45,7 +45,7 @@ public class ItemSkull extends Item {
return false;
} else {
// CraftBukkit start - handle in ItemBlock
- // world.setTypeIdAndData(i, j, k, Block.SKULL.id, l);
+ // world.setTypeIdAndData(i, j, k, Block.SKULL.id, l, 2);
if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, Block.SKULL.id, l, clickedX, clickedY, clickedZ)) {
return false;
}
@@ -84,11 +84,11 @@ public class ItemSkull extends Item {
public String d(ItemStack itemstack) {
int i = itemstack.getData();
- if (i < 0 || i >= a.length) {
+ if (i < 0 || i >= b.length) {
i = 0;
}
- return super.getName() + "." + a[i];
+ return super.getName() + "." + b[i];
}
public String l(ItemStack itemstack) {
diff --git a/src/main/java/net/minecraft/server/ItemSnow.java b/src/main/java/net/minecraft/server/ItemSnow.java
new file mode 100644
index 00000000..06cd5ca6
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ItemSnow.java
@@ -0,0 +1,36 @@
+package net.minecraft.server;
+
+public class ItemSnow extends ItemBlockWithAuxData {
+
+ public ItemSnow(int i, Block block) {
+ super(i, block);
+ }
+
+ public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
+ final int clickedX = i, clickedY = j, clickedZ = k;
+ if (itemstack.count == 0) {
+ return false;
+ } else if (!entityhuman.a(i, j, k, l, itemstack)) {
+ return false;
+ } else {
+ int i1 = world.getTypeId(i, j, k);
+
+ if (i1 == Block.SNOW.id) {
+ Block block = Block.byId[this.g()];
+ int j1 = world.getData(i, j, k);
+ int k1 = j1 & 7;
+
+ // CraftBukkit start
+ // if (k1 <= 6 && world.b(block.b(world, i, j, k)) && world.setData(i, j, k, k1 + 1 | j1 & -8, 2)) {
+ if (k1 <= 6 && world.b(block.b(world, i, j, k)) && processBlockPlace(world, entityhuman, itemstack, i, j, k, Block.SNOW.id, k1 + 1 | j1 & -8, clickedX, clickedY, clickedZ)) {
+ // CraftBukkit end
+ world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
+ --itemstack.count;
+ return true;
+ }
+ }
+
+ return super.interactWith(itemstack, entityhuman, world, i, j, k, l, f, f1, f2);
+ }
+ }
+}
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 8f0a5ad2..cd6dd070 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import java.util.Random;
+
public final class ItemStack {
public int count;
@@ -39,6 +41,9 @@ public final class ItemStack {
this.id = i;
this.count = j;
this.setData(k); // CraftBukkit
+ if (this.damage < 0) {
+ this.damage = 0;
+ }
}
public static ItemStack createStack(NBTTagCompound nbttagcompound) {
@@ -105,6 +110,10 @@ public final class ItemStack {
this.id = nbttagcompound.getShort("id");
this.count = nbttagcompound.getByte("Count");
this.damage = nbttagcompound.getShort("Damage");
+ if (this.damage < 0) {
+ this.damage = 0;
+ }
+
if (nbttagcompound.hasKey("tag")) {
// CraftBukkit - clear name from compound and make defensive copy as this data may be coming from the save thread
this.tag = (NBTTagCompound) nbttagcompound.getCompound("tag").clone().setName("");
@@ -116,22 +125,22 @@ public final class ItemStack {
}
public boolean isStackable() {
- return this.getMaxStackSize() > 1 && (!this.f() || !this.h());
+ return this.getMaxStackSize() > 1 && (!this.g() || !this.i());
}
- public boolean f() {
+ public boolean g() {
return Item.byId[this.id].getMaxDurability() > 0;
}
public boolean usesData() {
- return Item.byId[this.id].l();
+ return Item.byId[this.id].m();
}
- public boolean h() {
- return this.f() && this.damage > 0;
+ public boolean i() {
+ return this.g() && this.damage > 0;
}
- public int i() {
+ public int j() {
return this.damage;
}
@@ -140,53 +149,63 @@ public final class ItemStack {
}
public void setData(int i) {
- this.damage = (this.id > 0) && (this.id < 256) && (this.id != Block.ANVIL.id) ? Item.byId[this.id].filterData(i) : i; // CraftBukkit
+ this.damage = i;
+ if (this.damage < 0) {
+ this.damage = 0;
+ }
}
- public int k() {
+ public int l() {
return Item.byId[this.id].getMaxDurability();
}
- public void damage(int i, EntityLiving entityliving) {
- if (this.f()) {
- if (i > 0 && entityliving instanceof EntityHuman) {
+ public boolean isDamaged(int i, Random random) {
+ if (!this.g()) {
+ return false;
+ } else {
+ if (i > 0) {
int j = EnchantmentManager.getEnchantmentLevel(Enchantment.DURABILITY.id, this);
int k = 0;
for (int l = 0; j > 0 && l < i; ++l) {
- if (EnchantmentDurability.a(this, j, entityliving.world.random)) {
+ if (EnchantmentDurability.a(this, j, random)) {
++k;
}
}
i -= k;
if (i <= 0) {
- return;
+ return false;
}
}
- if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) {
- this.damage += i;
- }
+ this.damage += i;
+ return this.damage > this.l();
+ }
+ }
- if (this.damage > this.k()) {
- entityliving.a(this);
- if (entityliving instanceof EntityHuman) {
- ((EntityHuman) entityliving).a(StatisticList.F[this.id], 1);
- }
+ public void damage(int i, EntityLiving entityliving) {
+ if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) {
+ if (this.g()) {
+ if (this.isDamaged(i, entityliving.aE())) {
+ entityliving.a(this);
+ if (entityliving instanceof EntityHuman) {
+ ((EntityHuman) entityliving).a(StatisticList.F[this.id], 1);
+ }
- --this.count;
- if (this.count < 0) {
- this.count = 0;
- }
+ --this.count;
+ if (this.count < 0) {
+ this.count = 0;
+ }
- // CraftBukkit start - Check for item breaking
- if (this.count == 0 && entityliving instanceof EntityHuman) {
- org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent((EntityHuman) entityliving, this);
- }
- // CraftBukkit end
+ // CraftBukkit start - Check for item breaking
+ if (this.count == 0 && entityliving instanceof EntityHuman) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent((EntityHuman) entityliving, this);
+ }
+ // CraftBukkit end
- this.damage = 0;
+ this.damage = 0;
+ }
}
}
}
@@ -270,11 +289,11 @@ public final class ItemStack {
Item.byId[this.id].d(this, world, entityhuman);
}
- public int m() {
+ public int n() {
return this.getItem().c_(this);
}
- public EnumAnimation n() {
+ public EnumAnimation o() {
return this.getItem().b_(this);
}
@@ -298,7 +317,7 @@ public final class ItemStack {
this.tag = nbttagcompound;
}
- public String r() {
+ public String getName() {
String s = this.getItem().l(this);
if (this.tag != null && this.tag.hasKey("display")) {
@@ -314,7 +333,7 @@ public final class ItemStack {
public void c(String s) {
if (this.tag == null) {
- this.tag = new NBTTagCompound();
+ this.tag = new NBTTagCompound("tag");
}
if (!this.tag.hasKey("display")) {
@@ -324,11 +343,11 @@ public final class ItemStack {
this.tag.getCompound("display").setString("Name", s);
}
- public boolean s() {
+ public boolean hasName() {
return this.tag == null ? false : (!this.tag.hasKey("display") ? false : this.tag.getCompound("display").hasKey("Name"));
}
- public boolean v() {
+ public boolean w() {
return !this.getItem().d_(this) ? false : !this.hasEnchantments();
}
@@ -361,11 +380,11 @@ public final class ItemStack {
this.tag.set(s, nbtbase);
}
- public boolean x() {
- return this.getItem().x();
+ public boolean y() {
+ return this.getItem().y();
}
- public boolean y() {
+ public boolean z() {
return this.f != null;
}
@@ -373,7 +392,7 @@ public final class ItemStack {
this.f = entityitemframe;
}
- public EntityItemFrame z() {
+ public EntityItemFrame A() {
return this.f;
}
@@ -383,7 +402,7 @@ public final class ItemStack {
public void setRepairCost(int i) {
if (!this.hasTag()) {
- this.tag = new NBTTagCompound();
+ this.tag = new NBTTagCompound("tag");
}
this.tag.setInt("RepairCost", i);
diff --git a/src/main/java/net/minecraft/server/ItemStep.java b/src/main/java/net/minecraft/server/ItemStep.java
index 6c51282f..67af6d68 100644
--- a/src/main/java/net/minecraft/server/ItemStep.java
+++ b/src/main/java/net/minecraft/server/ItemStep.java
@@ -20,7 +20,7 @@ public class ItemStep extends ItemBlock {
}
public String d(ItemStack itemstack) {
- return this.b.d(itemstack.getData());
+ return this.b.c(itemstack.getData());
}
public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l, float f, float f1, float f2) {
@@ -39,7 +39,8 @@ public class ItemStep extends ItemBlock {
if ((l == 1 && !flag || l == 0 && flag) && i1 == this.b.id && k1 == itemstack.getData()) {
// CraftBukkit start - world.setTypeIdAndData -> processBlockPlace()
- if (world.b(this.c.e(world, i, j, k)) && processBlockPlace(world, entityhuman, null, i, j, k, this.c.id, k1, clickedX, clickedY, clickedZ)) {
+ // if (world.b(this.c.b(world, i, j, k)) && world.setTypeIdAndData(i, j, k, this.c.id, k1, 3)) {
+ if (world.b(this.c.b(world, i, j, k)) && processBlockPlace(world, entityhuman, null, i, j, k, this.c.id, k1, clickedX, clickedY, clickedZ)) {
// world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.c.stepSound.getPlaceSound(), (this.c.stepSound.getVolume1() + 1.0F) / 2.0F, this.c.stepSound.getVolume2() * 0.8F);
// CraftBukkit end
--itemstack.count;
@@ -83,7 +84,8 @@ public class ItemStep extends ItemBlock {
if (i1 == this.b.id && k1 == itemstack.getData()) {
// CraftBukkit start - world.setTypeIdAndData -> processBlockPlace()
- if (world.b(this.c.e(world, i, j, k)) && processBlockPlace(world, entityhuman, null, i, j, k, this.c.id, k1, clickedX, clickedY, clickedZ)) {
+ // if (world.b(this.c.b(world, i, j, k)) && world.setTypeIdAndData(i, j, k, this.c.id, k1, 3)) {
+ if (world.b(this.c.b(world, i, j, k)) && processBlockPlace(world, entityhuman, null, i, j, k, this.c.id, k1, clickedX, clickedY, clickedZ)) {
// world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F, this.c.stepSound.getPlaceSound(), (this.c.stepSound.getVolume1() + 1.0F) / 2.0F, this.c.stepSound.getVolume2() * 0.8F);
// CraftBukkit end
--itemstack.count;
diff --git a/src/main/java/net/minecraft/server/ItemWaterLily.java b/src/main/java/net/minecraft/server/ItemWaterLily.java
index 07c57082..bcee9b81 100644
--- a/src/main/java/net/minecraft/server/ItemWaterLily.java
+++ b/src/main/java/net/minecraft/server/ItemWaterLily.java
@@ -28,7 +28,7 @@ public class ItemWaterLily extends ItemWithAuxData {
if (world.getMaterial(i, j, k) == Material.WATER && world.getData(i, j, k) == 0 && world.isEmpty(i, j + 1, k)) {
// CraftBukkit start - waterlily
- // world.setTypeId(i, j + 1, k, Block.WATER_LILY.id);
+ // world.setTypeIdUpdate(i, j + 1, k, Block.WATER_LILY.id);
if (!processBlockPlace(world, entityhuman, null, i, j + 1, k, Block.WATER_LILY.id, 0, clickedX, clickedY, clickedZ)) {
return itemstack;
}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4bdf8aaa..d3f3f86e 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -28,51 +28,50 @@ import org.bukkit.event.world.WorldSaveEvent;
public abstract class MinecraftServer implements ICommandListener, Runnable, IMojangStatistics {
- public static Logger log = Logger.getLogger("Minecraft");
- private static MinecraftServer l = null;
+ private static MinecraftServer k = null;
public Convertable convertable; // CraftBukkit - private final -> public
- private final MojangStatisticsGenerator n = new MojangStatisticsGenerator("server", this);
+ private final MojangStatisticsGenerator m = new MojangStatisticsGenerator("server", this);
public File universe; // CraftBukkit - private final -> public
- private final List p = new ArrayList();
- private final ICommandHandler q;
+ private final List o = new ArrayList();
+ private final ICommandHandler p;
public final MethodProfiler methodProfiler = new MethodProfiler();
private String serverIp;
- private int s = -1;
- // public WorldServer[] worldServer; // CraftBukkit - removed!
- private PlayerList t;
+ private int r = -1;
+ public WorldServer[] worldServer;
+ private PlayerList s;
private boolean isRunning = true;
private boolean isStopped = false;
private int ticks = 0;
- public String d;
- public int e;
+ public String c;
+ public int d;
private boolean onlineMode;
private boolean spawnAnimals;
private boolean spawnNPCs;
private boolean pvpMode;
private boolean allowFlight;
private String motd;
- private int D;
+ private int C;
+ private long D;
private long E;
private long F;
private long G;
- private long H;
+ public final long[] e = new long[100];
public final long[] f = new long[100];
public final long[] g = new long[100];
public final long[] h = new long[100];
public final long[] i = new long[100];
- public final long[] j = new long[100];
- public long[][] k;
- private KeyPair I;
+ public long[][] j;
+ private KeyPair H;
+ private String I;
private String J;
- private String K;
private boolean demoMode;
+ private boolean M;
private boolean N;
- private boolean O;
- private String P = "";
- private boolean Q = false;
- private long R;
- private String S;
- private boolean T;
+ private String O = "";
+ private boolean P = false;
+ private long Q;
+ private String R;
+ private boolean S;
// CraftBukkit start
public List<WorldServer> worlds = new ArrayList<WorldServer>();
@@ -88,11 +87,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
// CraftBukkit end
public MinecraftServer(OptionSet options) { // CraftBukkit - signature file -> OptionSet
- l = this;
+ k = this;
// this.universe = file1; // CraftBukkit
- this.q = new CommandDispatcher();
+ this.p = new CommandDispatcher();
// this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved to DedicatedServer.init
- this.al();
+ this.am();
// CraftBukkit start
this.options = options;
@@ -119,46 +118,29 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
public abstract PropertyManager getPropertyManager();
// CraftBukkit end
- private void al() {
- BlockDispenser.a.a(Item.ARROW, new DispenseBehaviorArrow(this));
- BlockDispenser.a.a(Item.EGG, new DispenseBehaviorEgg(this));
- BlockDispenser.a.a(Item.SNOW_BALL, new DispenseBehaviorSnowBall(this));
- BlockDispenser.a.a(Item.EXP_BOTTLE, new DispenseBehaviorExpBottle(this));
- BlockDispenser.a.a(Item.POTION, new DispenseBehaviorPotion(this));
- BlockDispenser.a.a(Item.MONSTER_EGG, new DispenseBehaviorMonsterEgg(this));
- BlockDispenser.a.a(Item.FIREWORKS, new DispenseBehaviorFireworks(this));
- BlockDispenser.a.a(Item.FIREBALL, new DispenseBehaviorFireball(this));
- DispenseBehaviorMinecart dispensebehaviorminecart = new DispenseBehaviorMinecart(this);
-
- BlockDispenser.a.a(Item.MINECART, dispensebehaviorminecart);
- BlockDispenser.a.a(Item.STORAGE_MINECART, dispensebehaviorminecart);
- BlockDispenser.a.a(Item.POWERED_MINECART, dispensebehaviorminecart);
- BlockDispenser.a.a(Item.BOAT, new DispenseBehaviorBoat(this));
- DispenseBehaviorFilledBucket dispensebehaviorfilledbucket = new DispenseBehaviorFilledBucket(this);
-
- BlockDispenser.a.a(Item.LAVA_BUCKET, dispensebehaviorfilledbucket);
- BlockDispenser.a.a(Item.WATER_BUCKET, dispensebehaviorfilledbucket);
- BlockDispenser.a.a(Item.BUCKET, new DispenseBehaviorEmptyBucket(this));
+ private void am() {
+ DispenserRegistry.a();
}
protected abstract boolean init() throws java.net.UnknownHostException; // CraftBukkit - throws UnknownHostException
protected void b(String s) {
if (this.getConvertable().isConvertable(s)) {
- log.info("Converting map!");
+ this.getLogger().info("Converting map!");
this.c("menu.convertingLevel");
this.getConvertable().convert(s, new ConvertProgressUpdater(this));
}
}
protected synchronized void c(String s) {
- this.S = s;
+ this.R = s;
}
protected void a(String s, String s1, long i, WorldType worldtype, String s2) {
this.b(s);
this.c("menu.loadingLevel");
- // CraftBukkit - removed world and ticktime arrays
+ this.worldServer = new WorldServer[3];
+ // CraftBukkit - removed ticktime arrays
IDataManager idatamanager = this.convertable.a(s, true);
WorldData worlddata = idatamanager.getWorldData();
// CraftBukkit start - removed worldsettings
@@ -194,10 +176,10 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
if (j == 0) {
if (this.M()) { // Strip out DEMO?
// CraftBukkit
- world = new DemoWorldServer(this, new ServerNBTManager(server.getWorldContainer(), s1, true), s1, dimension, this.methodProfiler);
+ world = new DemoWorldServer(this, new ServerNBTManager(server.getWorldContainer(), s1, true), s1, dimension, this.methodProfiler, this.getLogger());
} else {
// CraftBukkit
- world = new WorldServer(this, new ServerNBTManager(server.getWorldContainer(), s1, true), s1, dimension, worldsettings, this.methodProfiler, Environment.getEnvironment(dimension), gen);
+ world = new WorldServer(this, new ServerNBTManager(server.getWorldContainer(), s1, true), s1, dimension, worldsettings, this.methodProfiler, this.getLogger(), Environment.getEnvironment(dimension), gen);
}
} else {
String dim = "DIM" + dimension;
@@ -206,6 +188,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
File oldWorld = new File(new File(s), dim);
if ((!newWorld.isDirectory()) && (oldWorld.isDirectory())) {
+ final IConsoleLogManager log = this.getLogger();
log.info("---- Migration of old " + worldType + " folder required ----");
log.info("Unfortunately due to the way that Minecraft implemented multiworld support in 1.6, Bukkit requires that you move your " + worldType + " folder to a new location in order to operate correctly.");
log.info("We will move this folder for you, but it will mean that you need to move it back should you wish to stop using Bukkit in the future.");
@@ -237,7 +220,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.c(name);
// CraftBukkit
- world = new SecondaryWorldServer(this, new ServerNBTManager(server.getWorldContainer(), name, true), name, dimension, worldsettings, this.worlds.get(0), this.methodProfiler, Environment.getEnvironment(dimension), gen);
+ world = new SecondaryWorldServer(this, new ServerNBTManager(server.getWorldContainer(), name, true), name, dimension, worldsettings, this.worlds.get(0), this.methodProfiler, this.getLogger(), Environment.getEnvironment(dimension), gen);
}
if (gen != null) {
@@ -251,7 +234,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
world.getWorldData().setGameType(this.getGamemode());
}
this.worlds.add(world);
- this.t.setPlayerFileData(this.worlds.toArray(new WorldServer[this.worlds.size()]));
+ this.s.setPlayerFileData(this.worlds.toArray(new WorldServer[this.worlds.size()]));
// CraftBukkit end
}
@@ -260,8 +243,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
protected void e() {
- short short1 = 196;
- long i = System.currentTimeMillis();
+ long i = System.currentTimeMillis(); // CraftBukkit - current time
this.c("menu.generatingTerrain");
byte b0 = 0;
@@ -269,15 +251,15 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
// CraftBukkit start
for (int j = 0; j < this.worlds.size(); ++j) {
WorldServer worldserver = this.worlds.get(j);
- log.info("Preparing start region for level " + j + " (Seed: " + worldserver.getSeed() + ")");
+ this.getLogger().info("Preparing start region for level " + j + " (Seed: " + worldserver.getSeed() + ")");
if (!worldserver.getWorld().getKeepSpawnInMemory()) {
continue;
}
- // CraftBukkit end
+
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
- for (int k = -short1; k <= short1 && this.isRunning(); k += 16) {
- for (int l = -short1; l <= short1 && this.isRunning(); l += 16) {
+ for (int k = -192; k <= 192 && this.isRunning(); k += 16) {
+ for (int l = -192; l <= 192 && this.isRunning(); l += 16) {
long i1 = System.currentTimeMillis();
if (i1 < i) {
@@ -285,8 +267,8 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
if (i1 > i + 1000L) {
- int j1 = (short1 * 2 + 1) * (short1 * 2 + 1);
- int k1 = (k + short1) * (short1 * 2 + 1) + l + 1;
+ int j1 = (192 * 2 + 1) * (192 * 2 + 1);
+ int k1 = (k + 192) * (192 * 2 + 1) + l + 1;
this.a_("Preparing spawn area", k1 * 100 / j1);
i = i1;
@@ -296,7 +278,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
}
}
-
+ // CraftBukkit end
this.j();
}
@@ -309,27 +291,27 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
public abstract boolean isHardcore();
protected void a_(String s, int i) {
- this.d = s;
- this.e = i;
- log.info(s + ": " + i + "%");
+ this.c = s;
+ this.d = i;
+ this.getLogger().info(s + ": " + i + "%");
}
protected void j() {
- this.d = null;
- this.e = 0;
+ this.c = null;
+ this.d = 0;
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD); // CraftBukkit
}
protected void saveChunks(boolean flag) throws ExceptionWorldConflict { // CraftBukkit - added throws
- if (!this.O) {
+ if (!this.N) {
// CraftBukkit start
for (int j = 0; j < this.worlds.size(); ++j) {
WorldServer worldserver = this.worlds.get(j);
if (worldserver != null) {
if (!flag) {
- log.info("Saving chunks for level \'" + worldserver.getWorldData().getName() + "\'/" + worldserver.worldProvider.getName());
+ this.getLogger().info("Saving chunks for level \'" + worldserver.getWorldData().getName() + "\'/" + worldserver.worldProvider.getName());
}
worldserver.save(true, (IProgressUpdate) null);
@@ -344,8 +326,8 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public void stop() throws ExceptionWorldConflict { // CraftBukkit - added throws
- if (!this.O) {
- log.info("Stopping server");
+ if (!this.N) {
+ this.getLogger().info("Stopping server");
// CraftBukkit start
if (this.server != null) {
this.server.disablePlugins();
@@ -356,13 +338,13 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.ae().a();
}
- if (this.t != null) {
- log.info("Saving players");
- this.t.savePlayers();
- this.t.r();
+ if (this.s != null) {
+ this.getLogger().info("Saving players");
+ this.s.savePlayers();
+ this.s.r();
}
- log.info("Saving worlds");
+ this.getLogger().info("Saving worlds");
this.saveChunks(false);
/* CraftBukkit start - handled in saveChunks
@@ -372,8 +354,8 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
worldserver.saveLevel();
}
// CraftBukkit end */
- if (this.n != null && this.n.d()) {
- this.n.e();
+ if (this.m != null && this.m.d()) {
+ this.m.e();
}
}
}
@@ -399,19 +381,19 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
if (this.init()) {
long i = System.currentTimeMillis();
- for (long j = 0L; this.isRunning; this.Q = true) {
+ for (long j = 0L; this.isRunning; this.P = true) {
long k = System.currentTimeMillis();
long l = k - i;
- if (l > 2000L && i - this.R >= 15000L) {
+ if (l > 2000L && i - this.Q >= 15000L) {
if (this.server.getWarnOnOverload()) // CraftBukkit - Added option to suppress warning messages
- log.warning("Can\'t keep up! Did the system time change, or is the server overloaded?");
+ this.getLogger().warning("Can\'t keep up! Did the system time change, or is the server overloaded?");
l = 2000L;
- this.R = i;
+ this.Q = i;
}
if (l < 0L) {
- log.warning("Time ran backwards! Did the system time change?");
+ this.getLogger().warning("Time ran backwards! Did the system time change?");
l = 0L;
}
@@ -435,7 +417,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
} catch (Throwable throwable) {
throwable.printStackTrace();
- log.log(Level.SEVERE, "Encountered an unexpected exception " + throwable.getClass().getSimpleName(), throwable);
+ this.getLogger().severe("Encountered an unexpected exception " + throwable.getClass().getSimpleName(), throwable);
CrashReport crashreport = null;
if (throwable instanceof ReportedException) {
@@ -446,10 +428,10 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
File file1 = new File(new File(this.o(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt");
- if (crashreport.a(file1)) {
- log.severe("This crash report has been saved to: " + file1.getAbsolutePath());
+ if (crashreport.a(file1, this.getLogger())) {
+ this.getLogger().severe("This crash report has been saved to: " + file1.getAbsolutePath());
} else {
- log.severe("We were unable to save this crash report to disk.");
+ this.getLogger().severe("We were unable to save this crash report to disk.");
}
this.a(crashreport);
@@ -484,8 +466,8 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
AxisAlignedBB.a().a();
++this.ticks;
- if (this.T) {
- this.T = false;
+ if (this.S) {
+ this.S = false;
this.methodProfiler.a = true;
this.methodProfiler.a();
}
@@ -494,29 +476,29 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.r();
if ((this.autosavePeriod > 0) && ((this.ticks % this.autosavePeriod) == 0)) { // CraftBukkit
this.methodProfiler.a("save");
- this.t.savePlayers();
+ this.s.savePlayers();
this.saveChunks(true);
this.methodProfiler.b();
}
this.methodProfiler.a("tallying");
- this.j[this.ticks % 100] = System.nanoTime() - i;
- this.f[this.ticks % 100] = Packet.p - this.E;
- this.E = Packet.p;
- this.g[this.ticks % 100] = Packet.q - this.F;
- this.F = Packet.q;
- this.h[this.ticks % 100] = Packet.n - this.G;
- this.G = Packet.n;
- this.i[this.ticks % 100] = Packet.o - this.H;
- this.H = Packet.o;
+ this.i[this.ticks % 100] = System.nanoTime() - i;
+ this.e[this.ticks % 100] = Packet.q - this.D;
+ this.D = Packet.q;
+ this.f[this.ticks % 100] = Packet.r - this.E;
+ this.E = Packet.r;
+ this.g[this.ticks % 100] = Packet.o - this.F;
+ this.F = Packet.o;
+ this.h[this.ticks % 100] = Packet.p - this.G;
+ this.G = Packet.p;
this.methodProfiler.b();
this.methodProfiler.a("snooper");
- if (!this.n.d() && this.ticks > 100) {
- this.n.a();
+ if (!this.m.d() && this.ticks > 100) {
+ this.m.a();
}
if (this.ticks % 6000 == 0) {
- this.n.b();
+ this.m.b();
}
this.methodProfiler.b();
@@ -559,7 +541,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
/* Drop global time updates
if (this.ticks % 20 == 0) {
this.methodProfiler.a("timeSync");
- this.t.a(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime()), worldserver.worldProvider.dimension);
+ this.s.a(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime()), worldserver.worldProvider.dimension);
this.methodProfiler.b();
}
// CraftBukkit end */
@@ -591,17 +573,17 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.methodProfiler.b();
// } // CraftBukkit
- // this.k[i][this.ticks % 100] = System.nanoTime() - j; // CraftBukkit
+ // this.j[i][this.ticks % 100] = System.nanoTime() - j; // CraftBukkit
}
this.methodProfiler.c("connection");
this.ae().b();
this.methodProfiler.c("players");
- this.t.tick();
+ this.s.tick();
this.methodProfiler.c("tickables");
- for (i = 0; i < this.p.size(); ++i) {
- ((IUpdatePlayerListBox) this.p.get(i)).a();
+ for (i = 0; i < this.o.size(); ++i) {
+ ((IUpdatePlayerListBox) this.o.get(i)).a();
}
this.methodProfiler.b();
@@ -612,11 +594,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public void a(IUpdatePlayerListBox iupdateplayerlistbox) {
- this.p.add(iupdateplayerlistbox);
+ this.o.add(iupdateplayerlistbox);
}
public static void main(final OptionSet options) { // CraftBukkit - replaces main(String[] astring)
StatisticList.a();
+ IConsoleLogManager iconsolelogmanager = null;
try {
/* CraftBukkit start - replace everything
@@ -668,6 +651,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
DedicatedServer dedicatedserver = new DedicatedServer(options);
+ iconsolelogmanager = dedicatedserver.getLogger();
if (options.has("port")) {
int port = (Integer) options.valueOf("port");
if (port > 0) {
@@ -705,7 +689,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
if (flag) {
- dedicatedserver.an();
+ dedicatedserver.ao();
}
*/
@@ -713,7 +697,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
// Runtime.getRuntime().addShutdownHook(new ThreadShutdown(dedicatedserver));
// CraftBukkit end
} catch (Exception exception) {
- log.log(Level.SEVERE, "Failed to start the minecraft server", exception);
+ if (iconsolelogmanager != null) {
+ iconsolelogmanager.severe("Failed to start the minecraft server", exception);
+ } else {
+ Logger.getAnonymousLogger().log(Level.SEVERE, "Failed to start the minecraft server", exception);
+ }
}
}
@@ -726,11 +714,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public void info(String s) {
- log.info(s);
+ this.getLogger().info(s);
}
public void warning(String s) {
- log.warning(s);
+ this.getLogger().warning(s);
}
public WorldServer getWorldServer(int i) {
@@ -750,7 +738,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public int v() {
- return this.s;
+ return this.r;
}
public String w() {
@@ -758,19 +746,19 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public String getVersion() {
- return "1.4.7";
+ return "1.5";
}
public int y() {
- return this.t.getPlayerCount();
+ return this.s.getPlayerCount();
}
public int z() {
- return this.t.getMaxPlayers();
+ return this.s.getMaxPlayers();
}
public String[] getPlayers() {
- return this.t.d();
+ return this.s.d();
}
public String getPlugins() {
@@ -811,7 +799,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
MinecraftServer.this.server.getPluginManager().callEvent(event);
// Event changes end
ServerCommand servercommand = new ServerCommand(event.getCommand(), RemoteControlCommandListener.instance);
- // this.q.a(RemoteControlCommandListener.instance, s);
+ // this.p.a(RemoteControlCommandListener.instance, s);
MinecraftServer.this.server.dispatchServerCommand(MinecraftServer.this.remoteConsole, servercommand); // CraftBukkit
return RemoteControlCommandListener.instance.d();
}};
@@ -832,12 +820,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public void i(String s) {
- log.log(Level.SEVERE, s);
+ this.getLogger().severe(s);
}
public void j(String s) {
if (this.isDebugging()) {
- log.log(Level.INFO, s);
+ this.getLogger().info(s);
}
}
@@ -851,7 +839,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
crashreport.g().a("Vec3 Pool Size", (Callable) (new CrashReportVec3DPoolSize(this)));
}
- if (this.t != null) {
+ if (this.s != null) {
crashreport.g().a("Player Count", (Callable) (new CrashReportPlayerCount(this)));
}
@@ -866,7 +854,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
if (s.startsWith("/")) {
s = s.substring(1);
boolean flag = !s.contains(" ");
- List list = this.q.b(icommandlistener, s);
+ List list = this.p.b(icommandlistener, s);
if (list != null) {
Iterator iterator = list.iterator();
@@ -886,7 +874,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
} else {
String[] astring = s.split(" ", -1);
String s2 = astring[astring.length - 1];
- String[] astring1 = this.t.d();
+ String[] astring1 = this.s.d();
int i = astring1.length;
for (int j = 0; j < i; ++j) {
@@ -905,7 +893,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public static MinecraftServer getServer() {
- return l;
+ return k;
}
public String getName() {
@@ -913,7 +901,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public void sendMessage(String s) {
- log.info(StripColor.a(s));
+ this.getLogger().info(StripColor.a(s));
}
public boolean a(int i, String s) {
@@ -925,43 +913,43 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public ICommandHandler getCommandHandler() {
- return this.q;
+ return this.p;
}
public KeyPair F() {
- return this.I;
+ return this.H;
}
public int G() {
- return this.s;
+ return this.r;
}
public void setPort(int i) {
- this.s = i;
+ this.r = i;
}
public String H() {
- return this.J;
+ return this.I;
}
public void k(String s) {
- this.J = s;
+ this.I = s;
}
public boolean I() {
- return this.J != null;
+ return this.I != null;
}
public String J() {
- return this.K;
+ return this.J;
}
public void l(String s) {
- this.K = s;
+ this.J = s;
}
public void a(KeyPair keypair) {
- this.I = keypair;
+ this.H = keypair;
}
public void c(int i) {
@@ -998,7 +986,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public void c(boolean flag) {
- this.N = flag;
+ this.M = flag;
}
public Convertable getConvertable() {
@@ -1006,7 +994,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public void P() {
- this.O = true;
+ this.N = true;
this.getConvertable().d();
// CraftBukkit start - This needs review, what does it do? (it's new)
@@ -1024,11 +1012,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public String getTexturePack() {
- return this.P;
+ return this.O;
}
public void setTexturePack(String s) {
- this.P = s;
+ this.O = s;
}
public void a(MojangStatisticsGenerator mojangstatisticsgenerator) {
@@ -1036,14 +1024,14 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(0));
mojangstatisticsgenerator.a("players_current", Integer.valueOf(this.y()));
mojangstatisticsgenerator.a("players_max", Integer.valueOf(this.z()));
- mojangstatisticsgenerator.a("players_seen", Integer.valueOf(this.t.getSeenPlayers().length));
+ mojangstatisticsgenerator.a("players_seen", Integer.valueOf(this.s.getSeenPlayers().length));
mojangstatisticsgenerator.a("uses_auth", Boolean.valueOf(this.onlineMode));
mojangstatisticsgenerator.a("gui_state", this.ag() ? "enabled" : "disabled");
- mojangstatisticsgenerator.a("avg_tick_ms", Integer.valueOf((int) (MathHelper.a(this.j) * 1.0E-6D)));
- mojangstatisticsgenerator.a("avg_sent_packet_count", Integer.valueOf((int) MathHelper.a(this.f)));
- mojangstatisticsgenerator.a("avg_sent_packet_size", Integer.valueOf((int) MathHelper.a(this.g)));
- mojangstatisticsgenerator.a("avg_rec_packet_count", Integer.valueOf((int) MathHelper.a(this.h)));
- mojangstatisticsgenerator.a("avg_rec_packet_size", Integer.valueOf((int) MathHelper.a(this.i)));
+ mojangstatisticsgenerator.a("avg_tick_ms", Integer.valueOf((int) (MathHelper.a(this.i) * 1.0E-6D)));
+ mojangstatisticsgenerator.a("avg_sent_packet_count", Integer.valueOf((int) MathHelper.a(this.e)));
+ mojangstatisticsgenerator.a("avg_sent_packet_size", Integer.valueOf((int) MathHelper.a(this.f)));
+ mojangstatisticsgenerator.a("avg_rec_packet_count", Integer.valueOf((int) MathHelper.a(this.g)));
+ mojangstatisticsgenerator.a("avg_rec_packet_size", Integer.valueOf((int) MathHelper.a(this.h)));
int i = 0;
// CraftBukkit start
@@ -1059,8 +1047,8 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
mojangstatisticsgenerator.a("world[" + i + "][hardcore]", Boolean.valueOf(worlddata.isHardcore()));
mojangstatisticsgenerator.a("world[" + i + "][generator_name]", worlddata.getType().name());
mojangstatisticsgenerator.a("world[" + i + "][generator_version]", Integer.valueOf(worlddata.getType().getVersion()));
- mojangstatisticsgenerator.a("world[" + i + "][height]", Integer.valueOf(this.D));
- mojangstatisticsgenerator.a("world[" + i + "][chunks_loaded]", Integer.valueOf(worldserver.I().getLoadedChunks()));
+ mojangstatisticsgenerator.a("world[" + i + "][height]", Integer.valueOf(this.C));
+ mojangstatisticsgenerator.a("world[" + i + "][chunks_loaded]", Integer.valueOf(worldserver.J().getLoadedChunks()));
++i;
// } // CraftBukkit
}
@@ -1136,11 +1124,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public int getMaxBuildHeight() {
- return this.D;
+ return this.C;
}
public void d(int i) {
- this.D = i;
+ this.C = i;
}
public boolean isStopped() {
@@ -1148,11 +1136,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public PlayerList getPlayerList() {
- return this.t;
+ return this.s;
}
public void a(PlayerList playerlist) {
- this.t = playerlist;
+ this.s = playerlist;
}
public void a(EnumGamemode enumgamemode) {
@@ -1176,7 +1164,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public void ai() {
- this.T = true;
+ this.S = true;
}
public ChunkCoordinates b() {
@@ -1187,7 +1175,13 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
return 16;
}
+ public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
+ return false;
+ }
+
+ public abstract IConsoleLogManager getLogger();
+
public static PlayerList a(MinecraftServer minecraftserver) {
- return minecraftserver.t;
+ return minecraftserver.s;
}
}
diff --git a/src/main/java/net/minecraft/server/MobEffectList.java b/src/main/java/net/minecraft/server/MobEffectList.java
index 86696498..f325bef1 100644
--- a/src/main/java/net/minecraft/server/MobEffectList.java
+++ b/src/main/java/net/minecraft/server/MobEffectList.java
@@ -98,8 +98,8 @@ public class MobEffectList {
// CraftBukkit end
} else if (this.id == HUNGER.id && entityliving instanceof EntityHuman) {
((EntityHuman) entityliving).j(0.025F * (float) (i + 1));
- } else if ((this.id != HEAL.id || entityliving.bA()) && (this.id != HARM.id || !entityliving.bA())) {
- if (this.id == HARM.id && !entityliving.bA() || this.id == HEAL.id && entityliving.bA()) {
+ } else if ((this.id != HEAL.id || entityliving.bD()) && (this.id != HARM.id || !entityliving.bD())) {
+ if (this.id == HARM.id && !entityliving.bD() || this.id == HEAL.id && entityliving.bD()) {
// CraftBukkit start
EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent(null, entityliving, EntityDamageEvent.DamageCause.MAGIC, 6 << i);
@@ -122,8 +122,8 @@ public class MobEffectList {
// CraftBukkit end
int j;
- if ((this.id != HEAL.id || entityliving1.bA()) && (this.id != HARM.id || !entityliving1.bA())) {
- if (this.id == HARM.id && !entityliving1.bA() || this.id == HEAL.id && entityliving1.bA()) {
+ if ((this.id != HEAL.id || entityliving1.bD()) && (this.id != HARM.id || !entityliving1.bD())) {
+ if (this.id == HARM.id && !entityliving1.bD() || this.id == HEAL.id && entityliving1.bD()) {
j = (int) (d0 * (double) (6 << i) + 0.5D);
if (entityliving == null) {
entityliving1.damageEntity(DamageSource.MAGIC, j);
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
new file mode 100644
index 00000000..4ba4735c
--- /dev/null
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -0,0 +1,281 @@
+package net.minecraft.server;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.bukkit.event.entity.CreatureSpawnEvent; // CraftBukkit
+
+public abstract class MobSpawnerAbstract {
+
+ public int spawnDelay = 20;
+ private String mobName = "Pig";
+ private List mobs = null;
+ private TileEntityMobSpawnerData spawnData = null;
+ public double c;
+ public double d = 0.0D;
+ private int minSpawnDelay = 200;
+ private int maxSpawnDelay = 800;
+ private int spawnCount = 4;
+ private Entity j;
+ private int maxNearbyEntities = 6;
+ private int requiredPlayerRange = 16;
+ private int spawnRange = 4;
+
+ public MobSpawnerAbstract() {}
+
+ public String getMobName() {
+ if (this.i() == null) {
+ if (this.mobName.equals("Minecart")) {
+ this.mobName = "MinecartRideable";
+ }
+
+ return this.mobName;
+ } else {
+ return this.i().c;
+ }
+ }
+
+ public void a(String s) {
+ this.mobName = s;
+ }
+
+ public boolean f() {
+ return this.a().findNearbyPlayer((double) this.b() + 0.5D, (double) this.c() + 0.5D, (double) this.d() + 0.5D, (double) this.requiredPlayerRange) != null;
+ }
+
+ public void g() {
+ if (this.f()) {
+ double d0;
+
+ if (this.a().isStatic) {
+ double d1 = (double) ((float) this.b() + this.a().random.nextFloat());
+ double d2 = (double) ((float) this.c() + this.a().random.nextFloat());
+
+ d0 = (double) ((float) this.d() + this.a().random.nextFloat());
+ this.a().addParticle("smoke", d1, d2, d0, 0.0D, 0.0D, 0.0D);
+ this.a().addParticle("flame", d1, d2, d0, 0.0D, 0.0D, 0.0D);
+ if (this.spawnDelay > 0) {
+ --this.spawnDelay;
+ }
+
+ this.d = this.c;
+ this.c = (this.c + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D;
+ } else {
+ if (this.spawnDelay == -1) {
+ this.j();
+ }
+
+ if (this.spawnDelay > 0) {
+ --this.spawnDelay;
+ return;
+ }
+
+ boolean flag = false;
+
+ for (int i = 0; i < this.spawnCount; ++i) {
+ Entity entity = EntityTypes.createEntityByName(this.getMobName(), this.a());
+
+ if (entity == null) {
+ return;
+ }
+
+ int j = this.a().a(entity.getClass(), AxisAlignedBB.a().a((double) this.b(), (double) this.c(), (double) this.d(), (double) (this.b() + 1), (double) (this.c() + 1), (double) (this.d() + 1)).grow((double) (this.spawnRange * 2), 4.0D, (double) (this.spawnRange * 2))).size();
+
+ if (j >= this.maxNearbyEntities) {
+ this.j();
+ return;
+ }
+
+ d0 = (double) this.b() + (this.a().random.nextDouble() - this.a().random.nextDouble()) * (double) this.spawnRange;
+ double d3 = (double) (this.c() + this.a().random.nextInt(3) - 1);
+ double d4 = (double) this.d() + (this.a().random.nextDouble() - this.a().random.nextDouble()) * (double) this.spawnRange;
+ EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving) entity : null;
+
+ entity.setPositionRotation(d0, d3, d4, this.a().random.nextFloat() * 360.0F, 0.0F);
+ if (entityliving == null || entityliving.canSpawn()) {
+ this.a(entity);
+ this.a().triggerEffect(2004, this.b(), this.c(), this.d(), 0);
+ if (entityliving != null) {
+ entityliving.aU();
+ }
+
+ flag = true;
+ }
+ }
+
+ if (flag) {
+ this.j();
+ }
+ }
+ }
+ }
+
+ public Entity a(Entity entity) {
+ if (this.i() != null) {
+ NBTTagCompound nbttagcompound = new NBTTagCompound();
+
+ entity.d(nbttagcompound);
+ Iterator iterator = this.i().b.c().iterator();
+
+ while (iterator.hasNext()) {
+ NBTBase nbtbase = (NBTBase) iterator.next();
+
+ nbttagcompound.set(nbtbase.getName(), nbtbase.clone());
+ }
+
+ entity.f(nbttagcompound);
+ if (entity.world != null) {
+ entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
+ }
+
+ NBTTagCompound nbttagcompound1;
+
+ for (Entity entity1 = entity; nbttagcompound.hasKey("Riding"); nbttagcompound = nbttagcompound1) {
+ nbttagcompound1 = nbttagcompound.getCompound("Riding");
+ Entity entity2 = EntityTypes.createEntityByName(nbttagcompound1.getString("id"), this.a());
+
+ if (entity2 != null) {
+ NBTTagCompound nbttagcompound2 = new NBTTagCompound();
+
+ entity2.d(nbttagcompound2);
+ Iterator iterator1 = nbttagcompound1.c().iterator();
+
+ while (iterator1.hasNext()) {
+ NBTBase nbtbase1 = (NBTBase) iterator1.next();
+
+ nbttagcompound2.set(nbtbase1.getName(), nbtbase1.clone());
+ }
+
+ entity2.f(nbttagcompound2);
+ entity2.setPositionRotation(entity1.locX, entity1.locY, entity1.locZ, entity1.yaw, entity1.pitch);
+ this.a().addEntity(entity2, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit);
+ entity1.mount(entity2);
+ }
+
+ entity1 = entity2;
+ }
+ } else if (entity instanceof EntityLiving && entity.world != null) {
+ ((EntityLiving) entity).bJ();
+ this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit);
+ }
+
+ return entity;
+ }
+
+ private void j() {
+ if (this.maxSpawnDelay <= this.minSpawnDelay) {
+ this.spawnDelay = this.minSpawnDelay;
+ } else {
+ int i = this.maxSpawnDelay - this.minSpawnDelay;
+
+ this.spawnDelay = this.minSpawnDelay + this.a().random.nextInt(i);
+ }
+
+ if (this.mobs != null && this.mobs.size() > 0) {
+ this.a((TileEntityMobSpawnerData) WeightedRandom.a(this.a().random, (Collection) this.mobs));
+ }
+
+ this.a(1);
+ }
+
+ public void a(NBTTagCompound nbttagcompound) {
+ this.mobName = nbttagcompound.getString("EntityId");
+ this.spawnDelay = nbttagcompound.getShort("Delay");
+ if (nbttagcompound.hasKey("SpawnPotentials")) {
+ this.mobs = new ArrayList();
+ NBTTagList nbttaglist = nbttagcompound.getList("SpawnPotentials");
+
+ for (int i = 0; i < nbttaglist.size(); ++i) {
+ this.mobs.add(new TileEntityMobSpawnerData(this, (NBTTagCompound) nbttaglist.get(i)));
+ }
+ } else {
+ this.mobs = null;
+ }
+
+ if (nbttagcompound.hasKey("SpawnData")) {
+ this.a(new TileEntityMobSpawnerData(this, nbttagcompound.getCompound("SpawnData"), this.mobName));
+ } else {
+ this.a((TileEntityMobSpawnerData) null);
+ }
+
+ if (nbttagcompound.hasKey("MinSpawnDelay")) {
+ this.minSpawnDelay = nbttagcompound.getShort("MinSpawnDelay");
+ this.maxSpawnDelay = nbttagcompound.getShort("MaxSpawnDelay");
+ this.spawnCount = nbttagcompound.getShort("SpawnCount");
+ }
+
+ if (nbttagcompound.hasKey("MaxNearbyEntities")) {
+ this.maxNearbyEntities = nbttagcompound.getShort("MaxNearbyEntities");
+ this.requiredPlayerRange = nbttagcompound.getShort("RequiredPlayerRange");
+ }
+
+ if (nbttagcompound.hasKey("SpawnRange")) {
+ this.spawnRange = nbttagcompound.getShort("SpawnRange");
+ }
+
+ if (this.a() != null && this.a().isStatic) {
+ this.j = null;
+ }
+ }
+
+ public void b(NBTTagCompound nbttagcompound) {
+ nbttagcompound.setString("EntityId", this.getMobName());
+ nbttagcompound.setShort("Delay", (short) this.spawnDelay);
+ nbttagcompound.setShort("MinSpawnDelay", (short) this.minSpawnDelay);
+ nbttagcompound.setShort("MaxSpawnDelay", (short) this.maxSpawnDelay);
+ nbttagcompound.setShort("SpawnCount", (short) this.spawnCount);
+ nbttagcompound.setShort("MaxNearbyEntities", (short) this.maxNearbyEntities);
+ nbttagcompound.setShort("RequiredPlayerRange", (short) this.requiredPlayerRange);
+ nbttagcompound.setShort("SpawnRange", (short) this.spawnRange);
+ if (this.i() != null) {
+ nbttagcompound.setCompound("SpawnData", (NBTTagCompound) this.i().b.clone());
+ }
+
+ if (this.i() != null || this.mobs != null && this.mobs.size() > 0) {
+ NBTTagList nbttaglist = new NBTTagList();
+
+ if (this.mobs != null && this.mobs.size() > 0) {
+ Iterator iterator = this.mobs.iterator();
+
+ while (iterator.hasNext()) {
+ TileEntityMobSpawnerData tileentitymobspawnerdata = (TileEntityMobSpawnerData) iterator.next();
+
+ nbttaglist.add(tileentitymobspawnerdata.a());
+ }
+ } else {
+ nbttaglist.add(this.i().a());
+ }
+
+ nbttagcompound.set("SpawnPotentials", nbttaglist);
+ }
+ }
+
+ public boolean b(int i) {
+ if (i == 1 && this.a().isStatic) {
+ this.spawnDelay = this.minSpawnDelay;
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public TileEntityMobSpawnerData i() {
+ return this.spawnData;
+ }
+
+ public void a(TileEntityMobSpawnerData tileentitymobspawnerdata) {
+ this.spawnData = tileentitymobspawnerdata;
+ }
+
+ public abstract void a(int i);
+
+ public abstract World a();
+
+ public abstract int b();
+
+ public abstract int c();
+
+ public abstract int d();
+}
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 7c64e9bb..1862863c 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -21,37 +21,39 @@ public class NetworkManager implements INetworkManager {
public static AtomicInteger a = new AtomicInteger();
public static AtomicInteger b = new AtomicInteger();
- private Object h = new Object();
+ private final Object h = new Object();
+ private final IConsoleLogManager i;
public Socket socket; // CraftBukkit - private -> public
- private final SocketAddress j;
+ private final SocketAddress k;
private volatile DataInputStream input;
private volatile DataOutputStream output;
- private volatile boolean m = true;
- private volatile boolean n = false;
+ private volatile boolean n = true;
+ private volatile boolean o = false;
private java.util.Queue inboundQueue = new java.util.concurrent.ConcurrentLinkedQueue(); // CraftBukkit - Concurrent linked queue
private List highPriorityQueue = Collections.synchronizedList(new ArrayList());
private List lowPriorityQueue = Collections.synchronizedList(new ArrayList());
private Connection connection;
- private boolean s = false;
- private Thread t;
+ private boolean t = false;
private Thread u;
- private String v = "";
- private Object[] w;
- private int x = 0;
+ private Thread v;
+ private String w = "";
+ private Object[] x;
private int y = 0;
+ private int z = 0;
public static int[] c = new int[256];
public static int[] d = new int[256];
public int e = 0;
boolean f = false;
boolean g = false;
- private SecretKey z = null;
- private PrivateKey A = null;
+ private SecretKey A = null;
+ private PrivateKey B = null;
private int lowPriorityQueueDelay = 50;
- public NetworkManager(Socket socket, String s, Connection connection, PrivateKey privatekey) throws IOException { // CraftBukkit - throws IOException
- this.A = privatekey;
+ public NetworkManager(IConsoleLogManager iconsolelogmanager, Socket socket, String s, Connection connection, PrivateKey privatekey) throws IOException { // CraftBukkit - throws IOException
+ this.B = privatekey;
this.socket = socket;
- this.j = socket.getRemoteSocketAddress();
+ this.i = iconsolelogmanager;
+ this.k = socket.getRemoteSocketAddress();
this.connection = connection;
try {
@@ -63,10 +65,10 @@ public class NetworkManager implements INetworkManager {
this.input = new DataInputStream(socket.getInputStream());
this.output = new DataOutputStream(new BufferedOutputStream(socket.getOutputStream(), 5120));
- this.u = new NetworkReaderThread(this, s + " read thread");
- this.t = new NetworkWriterThread(this, s + " write thread");
+ this.v = new NetworkReaderThread(this, s + " read thread");
+ this.u = new NetworkWriterThread(this, s + " write thread");
+ this.v.start();
this.u.start();
- this.t.start();
}
public void a(Connection connection) {
@@ -74,11 +76,11 @@ public class NetworkManager implements INetworkManager {
}
public void queue(Packet packet) {
- if (!this.s) {
+ if (!this.t) {
Object object = this.h;
synchronized (this.h) {
- this.y += packet.a() + 1;
+ this.z += packet.a() + 1;
this.highPriorityQueue.add(packet);
}
}
@@ -98,14 +100,14 @@ public class NetworkManager implements INetworkManager {
Packet.a(packet, this.output);
if (packet instanceof Packet252KeyResponse && !this.g) {
if (!this.connection.a()) {
- this.z = ((Packet252KeyResponse) packet).d();
+ this.A = ((Packet252KeyResponse) packet).d();
}
this.k();
}
aint = d;
- i = packet.k();
+ i = packet.n();
aint[i] += packet.a() + 1;
flag = true;
}
@@ -117,7 +119,7 @@ public class NetworkManager implements INetworkManager {
if (packet != null) {
Packet.a(packet, this.output);
aint = d;
- i = packet.k();
+ i = packet.n();
aint[i] += packet.a() + 1;
this.lowPriorityQueueDelay = 0;
flag = true;
@@ -126,7 +128,7 @@ public class NetworkManager implements INetworkManager {
return flag;
} catch (Exception exception) {
- if (!this.n) {
+ if (!this.o) {
this.a(exception);
}
@@ -142,7 +144,7 @@ public class NetworkManager implements INetworkManager {
synchronized (this.h) {
while (!list.isEmpty() && packet == null) {
packet = (Packet) list.remove(0);
- this.y -= packet.a() + 1;
+ this.z -= packet.a() + 1;
if (this.a(packet, flag)) {
packet = null;
}
@@ -167,19 +169,19 @@ public class NetworkManager implements INetworkManager {
}
packet1 = (Packet) iterator.next();
- } while (packet1.k() != packet.k());
+ } while (packet1.n() != packet.n());
return packet.a(packet1);
}
}
public void a() {
- if (this.u != null) {
- this.u.interrupt();
+ if (this.v != null) {
+ this.v.interrupt();
}
- if (this.t != null) {
- this.t.interrupt();
+ if (this.u != null) {
+ this.u.interrupt();
}
}
@@ -187,24 +189,24 @@ public class NetworkManager implements INetworkManager {
boolean flag = false;
try {
- Packet packet = Packet.a(this.input, this.connection.a(), this.socket);
+ Packet packet = Packet.a(this.i, this.input, this.connection.a(), this.socket);
if (packet != null) {
if (packet instanceof Packet252KeyResponse && !this.f) {
if (this.connection.a()) {
- this.z = ((Packet252KeyResponse) packet).a(this.A);
+ this.A = ((Packet252KeyResponse) packet).a(this.B);
}
this.j();
}
int[] aint = c;
- int i = packet.k();
+ int i = packet.n();
aint[i] += packet.a() + 1;
- if (!this.s) {
+ if (!this.t) {
if (packet.a_() && this.connection.b()) {
- this.x = 0;
+ this.y = 0;
packet.handle(this.connection);
} else {
this.inboundQueue.add(packet);
@@ -218,7 +220,7 @@ public class NetworkManager implements INetworkManager {
return flag;
} catch (Exception exception) {
- if (!this.n) {
+ if (!this.o) {
this.a(exception);
}
@@ -232,11 +234,11 @@ public class NetworkManager implements INetworkManager {
}
public void a(String s, Object... aobject) {
- if (this.m) {
- this.n = true;
- this.v = s;
- this.w = aobject;
- this.m = false;
+ if (this.n) {
+ this.o = true;
+ this.w = s;
+ this.x = aobject;
+ this.n = false;
(new NetworkMasterThread(this)).start();
try {
@@ -264,16 +266,16 @@ public class NetworkManager implements INetworkManager {
}
public void b() {
- if (this.y > 2097152) {
+ if (this.z > 2097152) {
this.a("disconnect.overflow", new Object[0]);
}
if (this.inboundQueue.isEmpty()) {
- if (this.x++ == 1200) {
+ if (this.y++ == 1200) {
this.a("disconnect.timeout", new Object[0]);
}
} else {
- this.x = 0;
+ this.y = 0;
}
int i = 1000;
@@ -282,7 +284,7 @@ public class NetworkManager implements INetworkManager {
Packet packet = (Packet) this.inboundQueue.poll(); // CraftBukkit - remove -> poll
// CraftBukkit start
- if (this.connection instanceof PendingConnection ? ((PendingConnection) this.connection).c : ((PlayerConnection) this.connection).disconnected) {
+ if (this.connection instanceof PendingConnection ? ((PendingConnection) this.connection).b : ((PlayerConnection) this.connection).disconnected) {
continue;
}
// CraftBukkit end
@@ -291,20 +293,20 @@ public class NetworkManager implements INetworkManager {
}
this.a();
- if (this.n && this.inboundQueue.isEmpty()) {
- this.connection.a(this.v, this.w);
+ if (this.o && this.inboundQueue.isEmpty()) {
+ this.connection.a(this.w, this.x);
}
}
public SocketAddress getSocketAddress() {
- return this.j;
+ return this.k;
}
public void d() {
- if (!this.s) {
+ if (!this.t) {
this.a();
- this.s = true;
- this.u.interrupt();
+ this.t = true;
+ this.v.interrupt();
(new NetworkMonitorThread(this)).start();
}
}
@@ -313,13 +315,13 @@ public class NetworkManager implements INetworkManager {
this.f = true;
InputStream inputstream = this.socket.getInputStream();
- this.input = new DataInputStream(MinecraftEncryption.a(this.z, inputstream));
+ this.input = new DataInputStream(MinecraftEncryption.a(this.A, inputstream));
}
private void k() throws IOException { // CraftBukkit - throws IOException
this.output.flush();
this.g = true;
- BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(MinecraftEncryption.a(this.z, this.socket.getOutputStream()), 5120);
+ BufferedOutputStream bufferedoutputstream = new BufferedOutputStream(MinecraftEncryption.a(this.A, this.socket.getOutputStream()), 5120);
this.output = new DataOutputStream(bufferedoutputstream);
}
@@ -333,11 +335,11 @@ public class NetworkManager implements INetworkManager {
}
static boolean a(NetworkManager networkmanager) {
- return networkmanager.m;
+ return networkmanager.n;
}
static boolean b(NetworkManager networkmanager) {
- return networkmanager.s;
+ return networkmanager.t;
}
static boolean c(NetworkManager networkmanager) {
@@ -353,7 +355,7 @@ public class NetworkManager implements INetworkManager {
}
static boolean f(NetworkManager networkmanager) {
- return networkmanager.n;
+ return networkmanager.o;
}
static void a(NetworkManager networkmanager, Exception exception) {
@@ -361,10 +363,10 @@ public class NetworkManager implements INetworkManager {
}
static Thread g(NetworkManager networkmanager) {
- return networkmanager.u;
+ return networkmanager.v;
}
static Thread h(NetworkManager networkmanager) {
- return networkmanager.t;
+ return networkmanager.u;
}
}
diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java
index 7472d441..c4212e83 100644
--- a/src/main/java/net/minecraft/server/Packet.java
+++ b/src/main/java/net/minecraft/server/Packet.java
@@ -16,11 +16,12 @@ public abstract class Packet {
private static Map a = new HashMap();
private static Set b = new HashSet();
private static Set c = new HashSet();
+ protected IConsoleLogManager m;
public final long timestamp = System.currentTimeMillis();
- public static long n;
public static long o;
public static long p;
public static long q;
+ public static long r;
public boolean lowPriority = false;
// CraftBukkit start - calculate packet ID once - used a bunch of times
private int packetID;
@@ -48,14 +49,14 @@ public abstract class Packet {
}
}
- public static Packet d(int i) {
+ public static Packet a(IConsoleLogManager iconsolelogmanager, int i) {
try {
Class oclass = (Class) l.get(i);
return oclass == null ? null : (Packet) oclass.newInstance();
} catch (Exception exception) {
exception.printStackTrace();
- System.out.println("Skipping packet with id " + i);
+ iconsolelogmanager.severe("Skipping packet with id " + i);
return null;
}
}
@@ -73,16 +74,16 @@ public abstract class Packet {
} else {
byte[] abyte = new byte[short1];
- datainputstream.read(abyte);
+ datainputstream.readFully(abyte);
return abyte;
}
}
- public final int k() {
+ public final int n() {
return packetID; // ((Integer) a.get(this.getClass())).intValue(); // CraftBukkit
}
- public static Packet a(DataInputStream datainputstream, boolean flag, Socket socket) throws IOException { // CraftBukkit - throws IOException
+ public static Packet a(IConsoleLogManager iconsolelogmanager, DataInputStream datainputstream, boolean flag, Socket socket) throws IOException { // CraftBukkit - throws IOException
boolean flag1 = false;
Packet packet = null;
int i = socket.getSoTimeout();
@@ -99,46 +100,46 @@ public abstract class Packet {
throw new IOException("Bad packet id " + j);
}
- packet = d(j);
+ packet = a(iconsolelogmanager, j);
if (packet == null) {
throw new IOException("Bad packet id " + j);
}
+ packet.m = iconsolelogmanager;
if (packet instanceof Packet254GetInfo) {
socket.setSoTimeout(1500);
}
packet.a(datainputstream);
- ++n;
- o += (long) packet.a();
+ ++o;
+ p += (long) packet.a();
} catch (EOFException eofexception) {
- System.out.println("Reached end of stream");
+ iconsolelogmanager.severe("Reached end of stream");
return null;
}
// CraftBukkit start
catch (java.net.SocketTimeoutException exception) {
- System.out.println("Read timed out");
+ iconsolelogmanager.severe("Read timed out");
return null;
} catch (java.net.SocketException exception) {
- System.out.println("Connection reset");
+ iconsolelogmanager.severe("Connection reset");
return null;
}
// CraftBukkit end
-
PacketCounter.a(j, (long) packet.a());
- ++n;
- o += (long) packet.a();
+ ++o;
+ p += (long) packet.a();
socket.setSoTimeout(i);
return packet;
}
public static void a(Packet packet, DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
- dataoutputstream.write(packet.k());
+ dataoutputstream.write(packet.n());
packet.a(dataoutputstream);
- ++p;
- q += (long) packet.a();
+ ++q;
+ r += (long) packet.a();
}
public static void a(String s, DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
@@ -218,7 +219,7 @@ public abstract class Packet {
dataoutputstream.writeShort(itemstack.getData());
NBTTagCompound nbttagcompound = null;
- if (itemstack.getItem().n() || itemstack.getItem().q()) {
+ if (itemstack.getItem().o() || itemstack.getItem().r()) {
nbttagcompound = itemstack.tag;
}
@@ -300,6 +301,7 @@ public abstract class Packet {
a(60, true, false, Packet60Explosion.class);
a(61, true, false, Packet61WorldEvent.class);
a(62, true, false, Packet62NamedSoundEffect.class);
+ a(63, true, false, Packet63WorldParticles.class);
a(70, true, false, Packet70Bed.class);
a(71, true, false, Packet71Weather.class);
a(100, true, false, Packet100OpenWindow.class);
@@ -320,6 +322,10 @@ public abstract class Packet {
a(203, true, true, Packet203TabComplete.class);
a(204, false, true, Packet204LocaleAndViewDistance.class);
a(205, false, true, Packet205ClientCommand.class);
+ a(206, true, false, Packet206SetScoreboardObjective.class);
+ a(207, true, false, Packet207SetScoreboardScore.class);
+ a(208, true, false, Packet208SetScoreboardDisplayObjective.class);
+ a(209, true, false, Packet209SetScoreboardTeam.class);
a(250, true, true, Packet250CustomPayload.class);
a(252, true, true, Packet252KeyResponse.class);
a(253, true, false, Packet253KeyRequest.class);
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java b/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java
index fe9132d7..685af68e 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java
@@ -7,13 +7,21 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal {
private final EntityLiving a;
private final IRangedEntity b;
private EntityLiving c;
- private int d = 0;
+ private int d;
private float e;
- private int f = 0;
+ private int f;
private int g;
- private float h;
+ private int h;
+ private float i;
+ private float j;
public PathfinderGoalArrowAttack(IRangedEntity irangedentity, float f, int i, float f1) {
+ this(irangedentity, f, i, i, f1);
+ }
+
+ public PathfinderGoalArrowAttack(IRangedEntity irangedentity, float f, int i, int j, float f1) {
+ this.d = -1;
+ this.f = 0;
if (!(irangedentity instanceof EntityLiving)) {
throw new IllegalArgumentException("ArrowAttackGoal requires Mob implements RangedAttackMob");
} else {
@@ -21,8 +29,9 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal {
this.a = (EntityLiving) irangedentity;
this.e = f;
this.g = i;
- this.h = f1 * f1;
- this.d = i / 2;
+ this.h = j;
+ this.i = f1;
+ this.j = f1 * f1;
this.a(3);
}
}
@@ -49,12 +58,12 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal {
// CraftBukkit end
this.c = null;
this.f = 0;
- this.d = this.g / 2;
+ this.d = -1;
}
public void e() {
double d0 = this.a.e(this.c.locX, this.c.boundingBox.b, this.c.locZ);
- boolean flag = this.a.aA().canSee(this.c);
+ boolean flag = this.a.aD().canSee(this.c);
if (flag) {
++this.f;
@@ -62,19 +71,36 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal {
this.f = 0;
}
- if (d0 <= (double) this.h && this.f >= 20) {
+ if (d0 <= (double) this.j && this.f >= 20) {
this.a.getNavigation().g();
} else {
this.a.getNavigation().a(this.c, this.e);
}
this.a.getControllerLook().a(this.c, 30.0F, 30.0F);
- this.d = Math.max(this.d - 1, 0);
- if (this.d <= 0) {
- if (d0 <= (double) this.h && flag) {
- this.b.d(this.c);
- this.d = this.g;
+ float f;
+
+ if (--this.d == 0) {
+ if (d0 > (double) this.j || !flag) {
+ return;
+ }
+
+ f = MathHelper.sqrt(d0) / this.i;
+ float f1 = f;
+
+ if (f < 0.1F) {
+ f1 = 0.1F;
}
+
+ if (f1 > 1.0F) {
+ f1 = 1.0F;
+ }
+
+ this.b.a(this.c, f1);
+ this.d = MathHelper.d(f * (float) (this.h - this.g) + (float) this.g);
+ } else if (this.d < 0) {
+ f = MathHelper.sqrt(d0) / this.i;
+ this.d = MathHelper.d(f * (float) (this.h - this.g) + (float) this.g);
}
}
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java b/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java
index c4efd2b8..86b194ce 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java
@@ -10,7 +10,7 @@ public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract {
}
public boolean a() {
- return !super.a() ? false : (!this.a.world.getGameRules().getBoolean("mobGriefing") ? false : !this.e.a_(this.a.world, this.b, this.c, this.d));
+ return !super.a() ? false : (!this.a.world.getGameRules().getBoolean("mobGriefing") ? false : !this.e.b_(this.a.world, this.b, this.c, this.d));
}
public void c() {
@@ -21,17 +21,17 @@ public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract {
public boolean b() {
double d0 = this.a.e((double) this.b, (double) this.c, (double) this.d);
- return this.i <= 240 && !this.e.a_(this.a.world, this.b, this.c, this.d) && d0 < 4.0D;
+ return this.i <= 240 && !this.e.b_(this.a.world, this.b, this.c, this.d) && d0 < 4.0D;
}
public void d() {
super.d();
- this.a.world.g(this.a.id, this.b, this.c, this.d, -1);
+ this.a.world.f(this.a.id, this.b, this.c, this.d, -1);
}
public void e() {
super.e();
- if (this.a.aB().nextInt(20) == 0) {
+ if (this.a.aE().nextInt(20) == 0) {
this.a.world.triggerEffect(1010, this.b, this.c, this.d, 0);
}
@@ -39,7 +39,7 @@ public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract {
int i = (int) ((float) this.i / 240.0F * 10.0F);
if (i != this.j) {
- this.a.world.g(this.a.id, this.b, this.c, this.d, i);
+ this.a.world.f(this.a.id, this.b, this.c, this.d, i);
this.j = i;
}
@@ -51,7 +51,7 @@ public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract {
}
// CraftBukkit end
- this.a.world.setTypeId(this.b, this.c, this.d, 0);
+ this.a.world.setAir(this.b, this.c, this.d);
this.a.world.triggerEffect(1012, this.b, this.c, this.d, 0);
this.a.world.triggerEffect(2001, this.b, this.c, this.d, this.e.id);
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
index a2c57a62..ca544f36 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
@@ -38,10 +38,10 @@ public class PathfinderGoalBreed extends PathfinderGoal {
}
public void e() {
- this.d.getControllerLook().a(this.e, 10.0F, (float) this.d.bp());
+ this.d.getControllerLook().a(this.e, 10.0F, (float) this.d.bs());
this.d.getNavigation().a((EntityLiving) this.e, this.c);
++this.b;
- if (this.b == 60) {
+ if (this.b >= 60 && this.d.e(this.e) < 9.0D) {
this.g();
}
}
@@ -49,17 +49,18 @@ public class PathfinderGoalBreed extends PathfinderGoal {
private EntityAnimal f() {
float f = 8.0F;
List list = this.a.a(this.d.getClass(), this.d.boundingBox.grow((double) f, (double) f, (double) f));
+ double d0 = Double.MAX_VALUE;
+ EntityAnimal entityanimal = null;
Iterator iterator = list.iterator();
- EntityAnimal entityanimal;
+ while (iterator.hasNext()) {
+ EntityAnimal entityanimal1 = (EntityAnimal) iterator.next();
- do {
- if (!iterator.hasNext()) {
- return null;
+ if (this.d.mate(entityanimal1) && this.d.e(entityanimal1) < d0) {
+ entityanimal = entityanimal1;
+ d0 = this.d.e(entityanimal1);
}
-
- entityanimal = (EntityAnimal) iterator.next();
- } while (!this.d.mate(entityanimal));
+ }
return entityanimal;
}
@@ -75,7 +76,7 @@ public class PathfinderGoalBreed extends PathfinderGoal {
entityageable.setAge(-24000);
entityageable.setPositionRotation(this.d.locX, this.d.locY, this.d.locZ, 0.0F, 0.0F);
this.a.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
- Random random = this.d.aB();
+ Random random = this.d.aE();
for (int i = 0; i < 7; ++i) {
double d0 = random.nextGaussian() * 0.02D;
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java b/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java
index 68ad1063..1feced1a 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java
@@ -18,7 +18,7 @@ public class PathfinderGoalEatTile extends PathfinderGoal {
}
public boolean a() {
- if (this.b.aB().nextInt(this.b.isBaby() ? 50 : 1000) != 0) {
+ if (this.b.aE().nextInt(this.b.isBaby() ? 50 : 1000) != 0) {
return false;
} else {
int i = MathHelper.floor(this.b.locX);
@@ -57,17 +57,16 @@ public class PathfinderGoalEatTile extends PathfinderGoal {
if (this.c.getTypeId(i, j, k) == Block.LONG_GRASS.id) {
// CraftBukkit start
if (!CraftEventFactory.callEntityChangeBlockEvent(this.b.getBukkitEntity(), this.b.world.getWorld().getBlockAt(i, j, k), Material.AIR).isCancelled()) {
- this.c.triggerEffect(2001, i, j, k, Block.LONG_GRASS.id + 4096);
- this.c.setTypeId(i, j, k, 0);
- this.b.aH();
+ this.c.setAir(i, j, k, false);
+ this.b.aK();
}
// CraftBukkit end
} else if (this.c.getTypeId(i, j - 1, k) == Block.GRASS.id) {
// CraftBukkit start
if (!CraftEventFactory.callEntityChangeBlockEvent(this.b.getBukkitEntity(), this.b.world.getWorld().getBlockAt(i, j - 1, k), Material.DIRT).isCancelled()) {
this.c.triggerEffect(2001, i, j - 1, k, Block.GRASS.id);
- this.c.setTypeId(i, j - 1, k, Block.DIRT.id);
- this.b.aH();
+ this.c.setTypeIdAndData(i, j - 1, k, Block.DIRT.id, 0, 2);
+ this.b.aK();
}
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
index 016fe877..7ccb12d6 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
@@ -45,7 +45,7 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal {
public boolean b() {
EntityLiving entityliving = this.b.getGoalTarget();
- return entityliving == null ? false : (!this.c.isAlive() ? false : (!this.f ? !this.b.getNavigation().f() : this.b.e(MathHelper.floor(this.c.locX), MathHelper.floor(this.c.locY), MathHelper.floor(this.c.locZ))));
+ return entityliving == null ? false : (!this.c.isAlive() ? false : (!this.f ? !this.b.getNavigation().f() : this.b.d(MathHelper.floor(this.c.locX), MathHelper.floor(this.c.locY), MathHelper.floor(this.c.locZ))));
}
public void c() {
@@ -65,8 +65,8 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal {
public void e() {
this.b.getControllerLook().a(this.c, 30.0F, 30.0F);
- if ((this.f || this.b.aA().canSee(this.c)) && --this.i <= 0) {
- this.i = 4 + this.b.aB().nextInt(7);
+ if ((this.f || this.b.aD().canSee(this.c)) && --this.i <= 0) {
+ this.i = 4 + this.b.aE().nextInt(7);
this.b.getNavigation().a(this.c, this.e);
}
@@ -76,8 +76,8 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal {
if (this.b.e(this.c.locX, this.c.boundingBox.b, this.c.locZ) <= d0) {
if (this.d <= 0) {
this.d = 20;
- if (this.b.bD() != null) {
- this.b.bH();
+ if (this.b.bG() != null) {
+ this.b.bK();
}
this.b.m(this.c);
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSit.java b/src/main/java/net/minecraft/server/PathfinderGoalSit.java
index a7c32bdd..031005ed 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalSit.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSit.java
@@ -13,14 +13,14 @@ public class PathfinderGoalSit extends PathfinderGoal {
public boolean a() {
if (!this.a.isTamed()) {
return this.b && this.a.getGoalTarget() == null; // CraftBukkit - Allow sitting for wild animals
- } else if (this.a.H()) {
+ } else if (this.a.G()) {
return false;
} else if (!this.a.onGround) {
return false;
} else {
EntityLiving entityliving = this.a.getOwner();
- return entityliving == null ? true : (this.a.e(entityliving) < 144.0D && entityliving.aC() != null ? false : this.b);
+ return entityliving == null ? true : (this.a.e(entityliving) < 144.0D && entityliving.aF() != null ? false : this.b);
}
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java
index c65f3dd7..1b0340f9 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java
@@ -37,7 +37,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
return false;
} else {
if (this.f) {
- if (this.d.aA().canSee(entityliving)) {
+ if (this.d.aD().canSee(entityliving)) {
this.g = 0;
} else if (++this.g > 60) {
return false;
@@ -80,9 +80,9 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
return false;
}
- if (!this.d.e(MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) {
+ if (!this.d.d(MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) {
return false;
- } else if (this.f && !this.d.aA().canSee(entityliving)) {
+ } else if (this.f && !this.d.aD().canSee(entityliving)) {
return false;
} else {
if (this.a) {
@@ -134,7 +134,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
}
private boolean a(EntityLiving entityliving) {
- this.c = 10 + this.d.aB().nextInt(5);
+ this.c = 10 + this.d.aE().nextInt(5);
PathEntity pathentity = this.d.getNavigation().a(entityliving);
if (pathentity == null) {
diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java
index 8413a152..5f4bcf2a 100644
--- a/src/main/java/net/minecraft/server/PendingConnection.java
+++ b/src/main/java/net/minecraft/server/PendingConnection.java
@@ -14,23 +14,22 @@ import javax.crypto.SecretKey;
public class PendingConnection extends Connection {
- private byte[] d;
- public static Logger logger = Logger.getLogger("Minecraft");
private static Random random = new Random();
- public NetworkManager networkManager;
- public boolean c = false;
- private MinecraftServer server;
- private int g = 0;
- private String h = null;
- private volatile boolean i = false;
+ private byte[] d;
+ private final MinecraftServer server;
+ public final NetworkManager networkManager;
+ public boolean b = false;
+ private int f = 0;
+ private String g = null;
+ private volatile boolean h = false;
private String loginKey = Long.toString(random.nextLong(), 16); // CraftBukkit - Security fix
- private boolean k = false;
- private SecretKey l = null;
+ private boolean j = false;
+ private SecretKey k = null;
public String hostname = ""; // CraftBukkit - add field
public PendingConnection(MinecraftServer minecraftserver, Socket socket, String s) throws java.io.IOException { // CraftBukkit - throws IOException
this.server = minecraftserver;
- this.networkManager = new NetworkManager(socket, s, this, minecraftserver.F().getPrivate());
+ this.networkManager = new NetworkManager(minecraftserver.getLogger(), socket, s, this, minecraftserver.F().getPrivate());
this.networkManager.e = 0;
}
@@ -41,11 +40,11 @@ public class PendingConnection extends Connection {
// CraftBukkit end
public void c() {
- if (this.i) {
+ if (this.h) {
this.d();
}
- if (this.g++ == 600) {
+ if (this.f++ == 600) {
this.disconnect("Took too long to log in");
} else {
this.networkManager.b();
@@ -54,10 +53,10 @@ public class PendingConnection extends Connection {
public void disconnect(String s) {
try {
- logger.info("Disconnecting " + this.getName() + ": " + s);
+ this.server.getLogger().info("Disconnecting " + this.getName() + ": " + s);
this.networkManager.queue(new Packet255KickDisconnect(s));
this.networkManager.d();
- this.c = true;
+ this.b = true;
} catch (Exception exception) {
exception.printStackTrace();
}
@@ -67,14 +66,14 @@ public class PendingConnection extends Connection {
// CraftBukkit start
this.hostname = packet2handshake.c == null ? "" : packet2handshake.c + ':' + packet2handshake.d;
// CraftBukkit end
- this.h = packet2handshake.f();
- if (!this.h.equals(StripColor.a(this.h))) {
+ this.g = packet2handshake.f();
+ if (!this.g.equals(StripColor.a(this.g))) {
this.disconnect("Invalid username!");
} else {
PublicKey publickey = this.server.F().getPublic();
- if (packet2handshake.d() != 51) {
- if (packet2handshake.d() > 51) {
+ if (packet2handshake.d() != 60) {
+ if (packet2handshake.d() > 60) {
this.disconnect("Outdated server!");
} else {
this.disconnect("Outdated client!");
@@ -91,7 +90,7 @@ public class PendingConnection extends Connection {
public void a(Packet252KeyResponse packet252keyresponse) {
PrivateKey privatekey = this.server.F().getPrivate();
- this.l = packet252keyresponse.a(privatekey);
+ this.k = packet252keyresponse.a(privatekey);
if (!Arrays.equals(this.d, packet252keyresponse.b(privatekey))) {
this.disconnect("Invalid client reply");
}
@@ -102,14 +101,14 @@ public class PendingConnection extends Connection {
public void a(Packet205ClientCommand packet205clientcommand) {
if (packet205clientcommand.a == 0) {
if (this.server.getOnlineMode()) {
- if (this.k) {
+ if (this.j) {
this.disconnect("Duplicate login");
return;
}
- this.k = true;
+ this.j = true;
(new ThreadLoginVerifier(this, server.server)).start(); // CraftBukkit - add CraftServer
} else {
- this.i = true;
+ this.h = true;
}
}
}
@@ -118,7 +117,7 @@ public class PendingConnection extends Connection {
public void d() {
// CraftBukkit start
- EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.h, this.hostname);
+ EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.g, this.hostname);
if (s == null) {
return;
@@ -131,12 +130,12 @@ public class PendingConnection extends Connection {
}
}
- this.c = true;
+ this.b = true;
}
public void a(String s, Object[] aobject) {
- logger.info(this.getName() + " lost connection");
- this.c = true;
+ this.server.getLogger().info(this.getName() + " lost connection");
+ this.b = true;
}
public void a(Packet254GetInfo packet254getinfo) {
@@ -149,7 +148,7 @@ public class PendingConnection extends Connection {
if (packet254getinfo.a == 1) {
// CraftBukkit start - fix decompile issues, don't create a list from an array
- Object[] list = new Object[] { 1, 51, this.server.getVersion(), pingEvent.getMotd(), playerlist.getPlayerCount(), pingEvent.getMaxPlayers() };
+ Object[] list = new Object[] { 1, 60, this.server.getVersion(), pingEvent.getMotd(), playerlist.getPlayerCount(), pingEvent.getMaxPlayers() };
for (Object object : list) {
if (s == null) {
@@ -178,7 +177,7 @@ public class PendingConnection extends Connection {
((DedicatedServerConnection) this.server.ae()).a(inetaddress);
}
- this.c = true;
+ this.b = true;
} catch (Exception exception) {
exception.printStackTrace();
}
@@ -189,7 +188,7 @@ public class PendingConnection extends Connection {
}
public String getName() {
- return this.h != null ? this.h + " [" + this.networkManager.getSocketAddress().toString() + "]" : this.networkManager.getSocketAddress().toString();
+ return this.g != null ? this.g + " [" + this.networkManager.getSocketAddress().toString() + "]" : this.networkManager.getSocketAddress().toString();
}
public boolean a() {
@@ -205,14 +204,14 @@ public class PendingConnection extends Connection {
}
static SecretKey c(PendingConnection pendingconnection) {
- return pendingconnection.l;
+ return pendingconnection.k;
}
static String d(PendingConnection pendingconnection) {
- return pendingconnection.h;
+ return pendingconnection.g;
}
static boolean a(PendingConnection pendingconnection, boolean flag) {
- return pendingconnection.i = flag;
+ return pendingconnection.h = flag;
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 65ec70ad..aeca924f 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -6,7 +6,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Random;
-import java.util.logging.Logger;
+import java.util.concurrent.Callable;
// CraftBukkit start
import java.io.UnsupportedEncodingException;
@@ -49,25 +49,25 @@ import org.bukkit.inventory.InventoryView;
// CraftBukkit end
public class PlayerConnection extends Connection {
- public static Logger logger = Logger.getLogger("Minecraft");
- public INetworkManager networkManager;
+
+ public final INetworkManager networkManager;
+ private final MinecraftServer minecraftServer;
public boolean disconnected = false;
- private MinecraftServer minecraftServer;
public EntityPlayer player;
+ private int e;
private int f;
- private int g;
- private boolean h;
- private int i;
- private long j;
- private static Random k = new Random();
- private long l;
+ private boolean g;
+ private int h;
+ private long i;
+ private static Random j = new Random();
+ private long k;
private volatile int chatThrottle = 0; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); // CraftBukkit - multithreaded field
private int x = 0;
private double y;
private double z;
- private double q;
+ private double p;
public boolean checkMovement = true; // CraftBukkit - private -> public
- private IntHashMap s = new IntHashMap();
+ private IntHashMap r = new IntHashMap();
public PlayerConnection(MinecraftServer minecraftserver, INetworkManager inetworkmanager, EntityPlayer entityplayer) {
this.minecraftServer = minecraftserver;
@@ -107,16 +107,16 @@ public class PlayerConnection extends Connection {
// CraftBukkit end
public void d() {
- this.h = false;
- ++this.f;
+ this.g = false;
+ ++this.e;
this.minecraftServer.methodProfiler.a("packetflow");
this.networkManager.b();
this.minecraftServer.methodProfiler.c("keepAlive");
- if ((long) this.f - this.l > 20L) {
- this.l = (long) this.f;
- this.j = System.nanoTime() / 1000000L;
- this.i = k.nextInt();
- this.sendPacket(new Packet0KeepAlive(this.i));
+ if ((long) this.e - this.k > 20L) {
+ this.k = (long) this.e;
+ this.i = System.nanoTime() / 1000000L;
+ this.h = j.nextInt();
+ this.sendPacket(new Packet0KeepAlive(this.h));
}
// CraftBukkit start
@@ -139,7 +139,7 @@ public class PlayerConnection extends Connection {
public void disconnect(String s) {
if (!this.disconnected) {
// CraftBukkit start
- String leaveMessage = "\u00A7e" + this.player.name + " left the game.";
+ String leaveMessage = EnumChatFormat.YELLOW + this.player.name + " left the game.";
PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage);
@@ -155,7 +155,7 @@ public class PlayerConnection extends Connection {
s = event.getReason();
// CraftBukkit end
- this.player.l();
+ this.player.k();
this.sendPacket(new Packet255KickDisconnect(s));
this.networkManager.d();
@@ -174,13 +174,13 @@ public class PlayerConnection extends Connection {
public void a(Packet10Flying packet10flying) {
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
- this.h = true;
+ this.g = true;
if (!this.player.viewingCredits) {
double d0;
if (!this.checkMovement) {
d0 = packet10flying.y - this.z;
- if (packet10flying.x == this.y && d0 * d0 < 0.01D && packet10flying.z == this.q) {
+ if (packet10flying.x == this.y && d0 * d0 < 0.01D && packet10flying.z == this.p) {
this.checkMovement = true;
}
}
@@ -260,7 +260,7 @@ public class PlayerConnection extends Connection {
float f = this.player.yaw;
float f1 = this.player.pitch;
- this.player.vehicle.V();
+ this.player.vehicle.U();
d1 = this.player.locX;
d2 = this.player.locY;
d3 = this.player.locZ;
@@ -294,20 +294,20 @@ public class PlayerConnection extends Connection {
}
if (this.player.vehicle != null) {
- this.player.vehicle.V();
+ this.player.vehicle.U();
}
this.minecraftServer.getPlayerList().d(this.player);
this.y = this.player.locX;
this.z = this.player.locY;
- this.q = this.player.locZ;
+ this.p = this.player.locZ;
worldserver.playerJoinedWorld(this.player);
return;
}
if (this.player.isSleeping()) {
this.player.g();
- this.player.setLocation(this.y, this.z, this.q, this.player.yaw, this.player.pitch);
+ this.player.setLocation(this.y, this.z, this.p, this.player.yaw, this.player.pitch);
worldserver.playerJoinedWorld(this.player);
return;
}
@@ -315,7 +315,7 @@ public class PlayerConnection extends Connection {
d0 = this.player.locY;
this.y = this.player.locX;
this.z = this.player.locY;
- this.q = this.player.locZ;
+ this.p = this.player.locZ;
d1 = this.player.locX;
d2 = this.player.locY;
d3 = this.player.locZ;
@@ -333,13 +333,13 @@ public class PlayerConnection extends Connection {
d4 = packet10flying.stance - packet10flying.y;
if (!this.player.isSleeping() && (d4 > 1.65D || d4 < 0.1D)) {
this.disconnect("Illegal stance");
- logger.warning(this.player.name + " had an illegal stance: " + d4);
+ this.minecraftServer.getLogger().warning(this.player.name + " had an illegal stance: " + d4);
return;
}
if (Math.abs(packet10flying.x) > 3.2E7D || Math.abs(packet10flying.z) > 3.2E7D) {
// CraftBukkit - teleport to previous position instead of kicking, players get stuck
- this.a(this.y, this.z, this.q, this.player.yaw, this.player.pitch);
+ this.a(this.y, this.z, this.p, this.player.yaw, this.player.pitch);
return;
}
}
@@ -350,8 +350,8 @@ public class PlayerConnection extends Connection {
}
this.player.g();
- this.player.W = 0.0F;
- this.player.setLocation(this.y, this.z, this.q, f2, f3);
+ this.player.X = 0.0F;
+ this.player.setLocation(this.y, this.z, this.p, f2, f3);
if (!this.checkMovement) {
return;
}
@@ -367,8 +367,8 @@ public class PlayerConnection extends Connection {
double d11 = d8 * d8 + d9 * d9 + d10 * d10;
if (d11 > 100.0D && this.checkMovement && (!this.minecraftServer.I() || !this.minecraftServer.H().equals(this.player.name))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports
- logger.warning(this.player.name + " moved too quickly! " + d4 + "," + d6 + "," + d7 + " (" + d8 + ", " + d9 + ", " + d10 + ")");
- this.a(this.y, this.z, this.q, this.player.yaw, this.player.pitch);
+ this.minecraftServer.getLogger().warning(this.player.name + " moved too quickly! " + d4 + "," + d6 + "," + d7 + " (" + d8 + ", " + d9 + ", " + d10 + ")");
+ this.a(this.y, this.z, this.p, this.player.yaw, this.player.pitch);
return;
}
@@ -396,14 +396,14 @@ public class PlayerConnection extends Connection {
if (d11 > 0.0625D && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) {
flag1 = true;
- logger.warning(this.player.name + " moved wrongly!");
+ this.minecraftServer.getLogger().warning(this.player.name + " moved wrongly!");
}
this.player.setLocation(d1, d2, d3, f2, f3);
boolean flag2 = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).isEmpty();
if (flag && (flag1 || !flag2) && !this.player.isSleeping()) {
- this.a(this.y, this.z, this.q, f2, f3);
+ this.a(this.y, this.z, this.p, f2, f3);
return;
}
@@ -411,15 +411,15 @@ public class PlayerConnection extends Connection {
if (!this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly && !worldserver.c(axisalignedbb)) { // CraftBukkit - check abilities instead of creative mode
if (d12 >= -0.03125D) {
- ++this.g;
- if (this.g > 80) {
- logger.warning(this.player.name + " was kicked for floating too long!");
+ ++this.f;
+ if (this.f > 80) {
+ this.minecraftServer.getLogger().warning(this.player.name + " was kicked for floating too long!");
this.disconnect("Flying is not enabled on this server");
return;
}
}
} else {
- this.g = 0;
+ this.f = 0;
}
this.player.onGround = packet10flying.g;
@@ -474,7 +474,7 @@ public class PlayerConnection extends Connection {
this.checkMovement = false;
this.y = d0;
this.z = d1;
- this.q = d2;
+ this.p = d2;
this.player.setLocation(d0, d1, d2, f, f1);
this.player.playerConnection.sendPacket(new Packet13PlayerLookMove(d0, d1 + 1.6200000047683716D, d1, d2, f, f1, false));
}
@@ -494,84 +494,74 @@ public class PlayerConnection extends Connection {
// Else we increment the drop count and check the amount.
this.dropCount++;
if (this.dropCount >= 20) {
- logger.warning(this.player.name + " dropped their items too quickly!");
+ this.minecraftServer.getLogger().warning(this.player.name + " dropped their items too quickly!");
this.disconnect("You dropped your items too quickly (Hacking?)");
return;
}
}
// CraftBukkit end
- this.player.f(false);
+ this.player.a(false);
} else if (packet14blockdig.e == 3) {
- this.player.f(true);
+ this.player.a(true);
} else if (packet14blockdig.e == 5) {
- this.player.bO();
+ this.player.bX();
} else {
- int i = this.minecraftServer.getSpawnProtection();
- boolean flag = worldserver.worldProvider.dimension != 0 || this.minecraftServer.getPlayerList().getOPs().isEmpty() || this.minecraftServer.getPlayerList().isOp(this.player.name) || i <= 0 || this.minecraftServer.I();
- boolean flag1 = false;
+ boolean flag = false;
if (packet14blockdig.e == 0) {
- flag1 = true;
+ flag = true;
}
if (packet14blockdig.e == 1) {
- flag1 = true;
+ flag = true;
}
if (packet14blockdig.e == 2) {
- flag1 = true;
+ flag = true;
}
- int j = packet14blockdig.a;
- int k = packet14blockdig.b;
- int l = packet14blockdig.c;
+ int i = packet14blockdig.a;
+ int j = packet14blockdig.b;
+ int k = packet14blockdig.c;
- if (flag1) {
- double d0 = this.player.locX - ((double) j + 0.5D);
- double d1 = this.player.locY - ((double) k + 0.5D) + 1.5D;
- double d2 = this.player.locZ - ((double) l + 0.5D);
+ if (flag) {
+ double d0 = this.player.locX - ((double) i + 0.5D);
+ double d1 = this.player.locY - ((double) j + 0.5D) + 1.5D;
+ double d2 = this.player.locZ - ((double) k + 0.5D);
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (d3 > 36.0D) {
return;
}
- if (k >= this.minecraftServer.getMaxBuildHeight()) {
+ if (j >= this.minecraftServer.getMaxBuildHeight()) {
return;
}
}
- ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
- int i1 = MathHelper.a(j - chunkcoordinates.x);
- int j1 = MathHelper.a(l - chunkcoordinates.z);
-
- if (i1 > j1) {
- j1 = i1;
- }
-
if (packet14blockdig.e == 0) {
// CraftBukkit start
- if (j1 < this.server.getSpawnRadius() && !flag) {
- CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, j, k, l, i1, this.player.inventory.getItemInHand());
- this.player.playerConnection.sendPacket(new Packet53BlockChange(j, k, l, worldserver));
+ if (!this.minecraftServer.a(worldserver, i, j, k, this.player)) {
+ this.player.playerInteractManager.dig(i, j, k, packet14blockdig.face);
+ } else {
+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, i, j, k, packet14blockdig.face, this.player.inventory.getItemInHand());
+ this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
// Update any tile entity data for this block
- TileEntity tileentity = worldserver.getTileEntity(j, k, l);
+ TileEntity tileentity = worldserver.getTileEntity(i, j, k);
if (tileentity != null) {
this.player.playerConnection.sendPacket(tileentity.getUpdatePacket());
}
// CraftBukkit end
- } else {
- this.player.playerInteractManager.dig(j, k, l, packet14blockdig.face);
}
} else if (packet14blockdig.e == 2) {
- this.player.playerInteractManager.a(j, k, l);
- if (worldserver.getTypeId(j, k, l) != 0) {
- this.player.playerConnection.sendPacket(new Packet53BlockChange(j, k, l, worldserver));
+ this.player.playerInteractManager.a(i, j, k);
+ if (worldserver.getTypeId(i, j, k) != 0) {
+ this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
}
} else if (packet14blockdig.e == 1) {
- this.player.playerInteractManager.c(j, k, l);
- if (worldserver.getTypeId(j, k, l) != 0) {
- this.player.playerConnection.sendPacket(new Packet53BlockChange(j, k, l, worldserver));
+ this.player.playerInteractManager.c(i, j, k);
+ if (worldserver.getTypeId(i, j, k) != 0) {
+ this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, worldserver));
}
}
}
@@ -614,8 +604,6 @@ public class PlayerConnection extends Connection {
int j = packet15place.f();
int k = packet15place.g();
int l = packet15place.getFace();
- int i1 = this.minecraftServer.getSpawnProtection();
- boolean flag1 = worldserver.worldProvider.dimension != 0 || this.minecraftServer.getPlayerList().getOPs().isEmpty() || this.minecraftServer.getPlayerList().isOp(this.player.name) || i1 <= 0 || this.minecraftServer.I();
if (packet15place.getFace() == 255) {
if (itemstack == null) {
@@ -635,27 +623,17 @@ public class PlayerConnection extends Connection {
always = (itemstack.count != itemstackAmount);
// CraftBukkit end
} else if (packet15place.f() >= this.minecraftServer.getMaxBuildHeight() - 1 && (packet15place.getFace() == 1 || packet15place.f() >= this.minecraftServer.getMaxBuildHeight())) {
- this.player.playerConnection.sendPacket(new Packet3Chat("\u00A77Height limit for building is " + this.minecraftServer.getMaxBuildHeight()));
+ this.player.playerConnection.sendPacket(new Packet3Chat("" + EnumChatFormat.GRAY + "Height limit for building is " + this.minecraftServer.getMaxBuildHeight()));
flag = true;
} else {
- ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
- int j1 = MathHelper.a(i - chunkcoordinates.x);
- int k1 = MathHelper.a(k - chunkcoordinates.z);
-
- if (j1 > k1) {
- k1 = j1;
- }
-
// CraftBukkit start - Check if we can actually do something over this large a distance
Location eyeLoc = this.getPlayer().getEyeLocation();
if (Math.pow(eyeLoc.getX() - i, 2) + Math.pow(eyeLoc.getY() - j, 2) + Math.pow(eyeLoc.getZ() - k, 2) > PLACE_DISTANCE_SQUARED) {
return;
}
- flag1 = true; // spawn protection moved to ItemBlock!!!
- if (j1 > i1 || flag1) {
- // CraftBukkit end
- this.player.playerInteractManager.interact(this.player, worldserver, itemstack, i, j, k, l, packet15place.j(), packet15place.l(), packet15place.m());
- }
+
+ this.player.playerInteractManager.interact(this.player, worldserver, itemstack, i, j, k, l, packet15place.j(), packet15place.k(), packet15place.l());
+ // CraftBukkit end
flag = true;
}
@@ -695,7 +673,7 @@ public class PlayerConnection extends Connection {
itemstack = null;
}
- if (itemstack == null || itemstack.m() == 0) {
+ if (itemstack == null || itemstack.n() == 0) {
this.player.h = true;
this.player.inventory.items[this.player.inventory.itemInHandIndex] = ItemStack.b(this.player.inventory.items[this.player.inventory.itemInHandIndex]);
Slot slot = this.player.activeContainer.a((IInventory) this.player.inventory, this.player.inventory.itemInHandIndex);
@@ -712,7 +690,7 @@ public class PlayerConnection extends Connection {
public void a(String s, Object[] aobject) {
if (this.disconnected) return; // CraftBukkit - rarely it would send a disconnect line twice
- logger.info(this.player.name + " lost connection: " + s);
+ this.minecraftServer.getLogger().info(this.player.name + " lost connection: " + s);
// CraftBukkit start - we need to handle custom quit messages
String quitMessage = this.minecraftServer.getPlayerList().disconnect(this.player);
if ((quitMessage != null) && (quitMessage.length() > 0)) {
@@ -721,14 +699,14 @@ public class PlayerConnection extends Connection {
// CraftBukkit end
this.disconnected = true;
if (this.minecraftServer.I() && this.player.name.equals(this.minecraftServer.H())) {
- logger.info("Stopping singleplayer server as player logged out");
+ this.minecraftServer.getLogger().info("Stopping singleplayer server as player logged out");
this.minecraftServer.safeShutdown();
}
}
public void onUnhandledPacket(Packet packet) {
if (this.disconnected) return; // CraftBukkit
- logger.warning(this.getClass() + " wasn\'t prepared to deal with a " + packet.getClass());
+ this.minecraftServer.getLogger().warning(this.getClass() + " wasn\'t prepared to deal with a " + packet.getClass());
this.disconnect("Protocol error, unexpected packet");
}
@@ -763,7 +741,16 @@ public class PlayerConnection extends Connection {
}
// CraftBukkit end
- this.networkManager.queue(packet);
+ try {
+ this.networkManager.queue(packet);
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Sending packet");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Packet being sent");
+
+ crashreportsystemdetails.a("Packet ID", (Callable) (new CrashReportConnectionPacketID(this, packet)));
+ crashreportsystemdetails.a("Packet class", (Callable) (new CrashReportConnectionPacketClass(this, packet)));
+ throw new ReportedException(crashreport);
+ }
}
public void a(Packet16BlockItemSwitch packet16blockitemswitch) {
@@ -777,7 +764,7 @@ public class PlayerConnection extends Connection {
this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex;
} else {
- logger.warning(this.player.name + " tried to set an invalid carried item");
+ this.minecraftServer.getLogger().warning(this.player.name + " tried to set an invalid carried item");
this.disconnect("Nope!"); // CraftBukkit
}
}
@@ -885,7 +872,7 @@ public class PlayerConnection extends Connection {
public void chat(String s, boolean async) {
if (!this.player.dead) {
if (s.length() == 0) {
- logger.warning(this.player.name + " tried to send an empty message");
+ this.minecraftServer.getLogger().warning(this.player.name + " tried to send an empty message");
return;
}
@@ -976,13 +963,13 @@ public class PlayerConnection extends Connection {
}
try {
- logger.info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); // CraftBukkit
+ this.minecraftServer.getLogger().info(event.getPlayer().getName() + " issued server command: " + event.getMessage()); // CraftBukkit
if (this.server.dispatchCommand(event.getPlayer(), event.getMessage().substring(1))) {
return;
}
} catch (org.bukkit.command.CommandException ex) {
player.sendMessage(org.bukkit.ChatColor.RED + "An internal error occurred while attempting to perform this command");
- Logger.getLogger(PlayerConnection.class.getName()).log(Level.SEVERE, null, ex);
+ java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(Level.SEVERE, null, ex);
return;
}
// CraftBukkit end
@@ -1026,7 +1013,7 @@ public class PlayerConnection extends Connection {
if (event.isCancelled()) return;
// CraftBukkit end
- this.player.bH();
+ this.player.bK();
}
}
@@ -1128,7 +1115,7 @@ public class PlayerConnection extends Connection {
if (packet205clientcommand.a == 1) {
if (this.player.viewingCredits) {
this.minecraftServer.getPlayerList().changeDimension(this.player, 0, TeleportCause.END_PORTAL); // CraftBukkit - reroute logic through custom portal management
- } else if (this.player.p().getWorldData().isHardcore()) {
+ } else if (this.player.o().getWorldData().isHardcore()) {
if (this.minecraftServer.I() && this.player.name.equals(this.minecraftServer.H())) {
this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!");
this.minecraftServer.P();
@@ -1164,7 +1151,7 @@ public class PlayerConnection extends Connection {
this.player.activeContainer.transferTo(this.player.defaultContainer, getPlayer());
// CraftBukkit end
- this.player.k();
+ this.player.j();
}
public void a(Packet102WindowClick packet102windowclick) {
@@ -1224,7 +1211,7 @@ public class PlayerConnection extends Connection {
this.player.broadcastCarriedItem();
this.player.h = false;
} else {
- this.s.a(this.player.activeContainer.windowId, Short.valueOf(packet102windowclick.d));
+ this.r.a(this.player.activeContainer.windowId, Short.valueOf(packet102windowclick.d));
this.player.playerConnection.sendPacket(new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, false));
this.player.activeContainer.a(this.player, false);
ArrayList arraylist = new ArrayList();
@@ -1318,7 +1305,7 @@ public class PlayerConnection extends Connection {
public void a(Packet106Transaction packet106transaction) {
if (this.player.dead) return; // CraftBukkit
- Short oshort = (Short) this.s.get(this.player.activeContainer.windowId);
+ Short oshort = (Short) this.r.get(this.player.activeContainer.windowId);
if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.windowId == packet106transaction.a && !this.player.activeContainer.c(this.player)) {
this.player.activeContainer.a(this.player, true);
@@ -1394,8 +1381,8 @@ public class PlayerConnection extends Connection {
}
public void a(Packet0KeepAlive packet0keepalive) {
- if (packet0keepalive.a == this.i) {
- int i = (int) (System.nanoTime() / 1000000L - this.j);
+ if (packet0keepalive.a == this.h) {
+ int i = (int) (System.nanoTime() / 1000000L - this.i);
this.player.ping = (this.player.ping * 3 + i) / 4;
}
@@ -1464,7 +1451,7 @@ public class PlayerConnection extends Connection {
}
} catch (Exception exception) {
// CraftBukkit start
- logger.log(Level.WARNING, this.player.name + " sent invalid MC|BEdit data", exception);
+ this.minecraftServer.getLogger().warning(this.player.name + " sent invalid MC|BEdit data", exception);
this.disconnect("Invalid book data!");
// CraftBukkit end
}
@@ -1485,7 +1472,7 @@ public class PlayerConnection extends Connection {
}
} catch (Exception exception1) {
// CraftBukkit start
- logger.log(Level.WARNING, this.player.name + " sent invalid MC|BSign data", exception1);
+ this.minecraftServer.getLogger().warning(this.player.name + " sent invalid MC|BSign data", exception1);
this.disconnect("Invalid book data!");
// CraftBukkit end
}
@@ -1499,11 +1486,11 @@ public class PlayerConnection extends Connection {
Container container = this.player.activeContainer;
if (container instanceof ContainerMerchant) {
- ((ContainerMerchant) container).b(i);
+ ((ContainerMerchant) container).e(i);
}
} catch (Exception exception2) {
// CraftBukkit start
- logger.log(Level.WARNING, this.player.name + " sent invalid MC|TrSel data", exception2);
+ this.minecraftServer.getLogger().warning(this.player.name + " sent invalid MC|TrSel data", exception2);
this.disconnect("Invalid trade data!");
// CraftBukkit end
}
@@ -1529,7 +1516,7 @@ public class PlayerConnection extends Connection {
}
} catch (Exception exception3) {
// CraftBukkit start
- logger.log(Level.WARNING, this.player.name + " sent invalid MC|AdvCdm data", exception3);
+ this.minecraftServer.getLogger().warning(this.player.name + " sent invalid MC|AdvCdm data", exception3);
this.disconnect("Invalid CommandBlock data!");
// CraftBukkit end
}
@@ -1547,7 +1534,7 @@ public class PlayerConnection extends Connection {
if (slot.d()) {
slot.a(1);
- TileEntityBeacon tileentitybeacon = containerbeacon.d();
+ TileEntityBeacon tileentitybeacon = containerbeacon.e();
tileentitybeacon.d(i);
tileentitybeacon.e(j);
@@ -1555,7 +1542,7 @@ public class PlayerConnection extends Connection {
}
} catch (Exception exception4) {
// CraftBukkit start
- logger.log(Level.WARNING, this.player.name + " sent invalid MC|Beacon data", exception4);
+ this.minecraftServer.getLogger().warning(this.player.name + " sent invalid MC|Beacon data", exception4);
this.disconnect("Invalid beacon data!");
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java
index 5faee122..92e68be2 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -78,7 +78,7 @@ public class PlayerInteractManager {
f = block.getDamage(this.player, this.player.world, this.k, this.l, this.m) * (float) (i + 1);
j = (int) (f * 10.0F);
if (j != this.o) {
- this.world.g(this.player.id, this.k, this.l, this.m, j);
+ this.world.f(this.player.id, this.k, this.l, this.m, j);
this.o = j;
}
@@ -92,7 +92,7 @@ public class PlayerInteractManager {
Block block1 = Block.byId[i];
if (block1 == null) {
- this.world.g(this.player.id, this.f, this.g, this.h, -1);
+ this.world.f(this.player.id, this.f, this.g, this.h, -1);
this.o = -1;
this.d = false;
} else {
@@ -101,7 +101,7 @@ public class PlayerInteractManager {
f = block1.getDamage(this.player, this.player.world, this.f, this.g, this.h) * (float) (l + 1);
j = (int) (f * 10.0F);
if (j != this.o) {
- this.world.g(this.player.id, this.f, this.g, this.h, j);
+ this.world.f(this.player.id, this.f, this.g, this.h, j);
this.o = j;
}
}
@@ -113,7 +113,7 @@ public class PlayerInteractManager {
// CraftBukkit
PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, i, j, k, l, this.player.inventory.getItemInHand());
- if (!this.gamemode.isAdventure() || this.player.f(i, j, k)) {
+ if (!this.gamemode.isAdventure() || this.player.e(i, j, k)) {
// CraftBukkit start
if (event.isCancelled()) {
// Let the client know the block still exists
@@ -131,7 +131,7 @@ public class PlayerInteractManager {
this.breakBlock(i, j, k);
}
} else {
- this.world.douseFire(this.player, i, j, k, l);
+ this.world.douseFire((EntityHuman) null, i, j, k, l);
this.lastDigTick = this.currentTick;
float f = 1.0F;
int i1 = this.world.getTypeId(i, j, k);
@@ -186,7 +186,7 @@ public class PlayerInteractManager {
this.h = k;
int j1 = (int) (f * 10.0F);
- this.world.g(this.player.id, i, j, k, j1);
+ this.world.f(this.player.id, i, j, k, j1);
this.o = j1;
}
}
@@ -205,7 +205,7 @@ public class PlayerInteractManager {
if (f >= 0.7F) {
this.d = false;
- this.world.g(this.player.id, i, j, k, -1);
+ this.world.f(this.player.id, i, j, k, -1);
this.breakBlock(i, j, k);
} else if (!this.j) {
this.d = false;
@@ -225,7 +225,7 @@ public class PlayerInteractManager {
public void c(int i, int j, int k) {
this.d = false;
- this.world.g(this.player.id, this.f, this.g, this.h, -1);
+ this.world.f(this.player.id, this.f, this.g, this.h, -1);
}
private boolean d(int i, int j, int k) {
@@ -236,7 +236,7 @@ public class PlayerInteractManager {
block.a(this.world, i, j, k, l, this.player);
}
- boolean flag = this.world.setTypeId(i, j, k, 0);
+ boolean flag = this.world.setAir(i, j, k);
if (block != null && flag) {
block.postBreak(this.world, i, j, k, l);
@@ -264,14 +264,14 @@ public class PlayerInteractManager {
event = new BlockBreakEvent(block, this.player.getBukkitEntity());
// Adventure mode pre-cancel
- event.setCancelled(this.gamemode.isAdventure() && !this.player.f(i, j, k));
+ event.setCancelled(this.gamemode.isAdventure() && !this.player.e(i, j, k));
// Calculate default block experience
Block nmsBlock = Block.byId[block.getTypeId()];
- if (nmsBlock != null && !event.isCancelled() && !this.isCreative() && this.player.b(nmsBlock)) {
+ if (nmsBlock != null && !event.isCancelled() && !this.isCreative() && this.player.a(nmsBlock)) {
// Copied from Block.a(world, entityhuman, int, int, int, int)
- if (!(nmsBlock.s_() && EnchantmentManager.hasSilkTouchEnchantment(this.player))) {
+ if (!(nmsBlock.r_() && EnchantmentManager.hasSilkTouchEnchantment(this.player))) {
int data = block.getData();
int bonusLevel = EnchantmentManager.getBonusBlockLootEnchantmentLevel(this.player);
@@ -314,13 +314,13 @@ public class PlayerInteractManager {
if (this.isCreative()) {
this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
} else {
- ItemStack itemstack = this.player.bS();
- boolean flag1 = this.player.b(Block.byId[l]);
+ ItemStack itemstack = this.player.cb();
+ boolean flag1 = this.player.a(Block.byId[l]);
if (itemstack != null) {
itemstack.a(this.world, l, i, j, k, this.player);
if (itemstack.count == 0) {
- this.player.bT();
+ this.player.cc();
}
}
@@ -331,7 +331,7 @@ public class PlayerInteractManager {
// CraftBukkit start - drop event experience
if (flag && event != null) {
- Block.byId[l].f(this.world, i, j, k, event.getExpToDrop());
+ Block.byId[l].j(this.world, i, j, k, event.getExpToDrop());
}
// CraftBukkit end
@@ -344,13 +344,13 @@ public class PlayerInteractManager {
int j = itemstack.getData();
ItemStack itemstack1 = itemstack.a(world, entityhuman);
- if (itemstack1 == itemstack && (itemstack1 == null || itemstack1.count == i && itemstack1.m() <= 0 && itemstack1.getData() == j)) {
+ if (itemstack1 == itemstack && (itemstack1 == null || itemstack1.count == i && itemstack1.n() <= 0 && itemstack1.getData() == j)) {
return false;
} else {
entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = itemstack1;
if (this.isCreative()) {
itemstack1.count = i;
- if (itemstack1.f()) {
+ if (itemstack1.g()) {
itemstack1.setData(j);
}
}
@@ -359,7 +359,7 @@ public class PlayerInteractManager {
entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = null;
}
- if (!entityhuman.bM()) {
+ if (!entityhuman.bV()) {
((EntityPlayer) entityhuman).updateInventory(entityhuman.defaultContainer);
}
diff --git a/src/main/java/net/minecraft/server/PlayerInventory.java b/src/main/java/net/minecraft/server/PlayerInventory.java
index f40b1e98..63da3ad4 100644
--- a/src/main/java/net/minecraft/server/PlayerInventory.java
+++ b/src/main/java/net/minecraft/server/PlayerInventory.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import java.util.concurrent.Callable;
+
// CraftBukkit start
import java.util.List;
@@ -97,7 +99,7 @@ public class PlayerInventory implements IInventory {
}
// CraftBukkit end
- public int i() {
+ public int j() {
for (int i = 0; i < this.items.length; ++i) {
if (this.items[i] == null) {
return i;
@@ -138,7 +140,7 @@ public class PlayerInventory implements IInventory {
int k;
if (itemstack.getMaxStackSize() == 1) {
- k = this.i();
+ k = this.j();
if (k < 0) {
return j;
} else {
@@ -151,7 +153,7 @@ public class PlayerInventory implements IInventory {
} else {
k = this.firstPartial(itemstack);
if (k < 0) {
- k = this.i();
+ k = this.j();
}
if (k < 0) {
@@ -186,7 +188,7 @@ public class PlayerInventory implements IInventory {
}
}
- public void j() {
+ public void k() {
for (int i = 0; i < this.items.length; ++i) {
if (this.items[i] != null) {
this.items[i].a(this.player.world, this.player, i, this.itemInHandIndex == i);
@@ -215,32 +217,46 @@ public class PlayerInventory implements IInventory {
}
public boolean pickup(ItemStack itemstack) {
- int i;
-
- if (itemstack.h()) {
- i = this.i();
- if (i >= 0) {
- this.items[i] = ItemStack.b(itemstack);
- this.items[i].b = 5;
- itemstack.count = 0;
- return true;
- } else if (this.player.abilities.canInstantlyBuild) {
- itemstack.count = 0;
- return true;
- } else {
- return false;
- }
+ if (itemstack == null) {
+ return false;
} else {
- do {
- i = itemstack.count;
- itemstack.count = this.e(itemstack);
- } while (itemstack.count > 0 && itemstack.count < i);
-
- if (itemstack.count == i && this.player.abilities.canInstantlyBuild) {
- itemstack.count = 0;
- return true;
- } else {
- return itemstack.count < i;
+ try {
+ int i;
+
+ if (itemstack.i()) {
+ i = this.j();
+ if (i >= 0) {
+ this.items[i] = ItemStack.b(itemstack);
+ this.items[i].b = 5;
+ itemstack.count = 0;
+ return true;
+ } else if (this.player.abilities.canInstantlyBuild) {
+ itemstack.count = 0;
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ do {
+ i = itemstack.count;
+ itemstack.count = this.e(itemstack);
+ } while (itemstack.count > 0 && itemstack.count < i);
+
+ if (itemstack.count == i && this.player.abilities.canInstantlyBuild) {
+ itemstack.count = 0;
+ return true;
+ } else {
+ return itemstack.count < i;
+ }
+ }
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Adding item to inventory");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Item being added");
+
+ crashreportsystemdetails.a("Item ID", Integer.valueOf(itemstack.id));
+ crashreportsystemdetails.a("Item data", Integer.valueOf(itemstack.getData()));
+ crashreportsystemdetails.a("Item name", (Callable) (new CrashReportItemName(this, itemstack)));
+ throw new ReportedException(crashreport);
}
}
}
@@ -377,6 +393,10 @@ public class PlayerInventory implements IInventory {
return "container.inventory";
}
+ public boolean c() {
+ return false;
+ }
+
public int getMaxStackSize() {
return maxStack;
}
@@ -401,12 +421,12 @@ public class PlayerInventory implements IInventory {
return this.armor[i];
}
- public int k() {
+ public int l() {
int i = 0;
for (int j = 0; j < this.armor.length; ++j) {
if (this.armor[j] != null && this.armor[j].getItem() instanceof ItemArmor) {
- int k = ((ItemArmor) this.armor[j].getItem()).b;
+ int k = ((ItemArmor) this.armor[j].getItem()).c;
i += k;
}
@@ -431,7 +451,7 @@ public class PlayerInventory implements IInventory {
}
}
- public void l() {
+ public void m() {
int i;
for (i = 0; i < this.items.length; ++i) {
@@ -466,7 +486,7 @@ public class PlayerInventory implements IInventory {
return this.g;
}
- public boolean a_(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
return this.player.dead ? false : entityhuman.e(this.player) <= 64.0D;
}
@@ -490,7 +510,11 @@ public class PlayerInventory implements IInventory {
public void startOpen() {}
- public void f() {}
+ public void g() {}
+
+ public boolean b(int i, ItemStack itemstack) {
+ return true;
+ }
public void b(PlayerInventory playerinventory) {
int i;
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index e857612a..585595d2 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -8,8 +8,9 @@ import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
-import java.util.logging.Logger;
+import java.util.Map.Entry;
// CraftBukkit start
import org.bukkit.Location;
@@ -32,21 +33,20 @@ import org.bukkit.Bukkit;
public abstract class PlayerList {
- private static final SimpleDateFormat e = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
- public static final Logger a = Logger.getLogger("Minecraft");
+ private static final SimpleDateFormat d = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
private final MinecraftServer server;
public final List players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety
private final BanList banByName = new BanList(new File("banned-players.txt"));
private final BanList banByIP = new BanList(new File("banned-ips.txt"));
private Set operators = new HashSet();
private Set whitelist = new java.util.LinkedHashSet(); // CraftBukkit - HashSet -> LinkedHashSet
- public PlayerFileData playerFileData; // CraftBukkit - private -> public
+ public IPlayerFileData playerFileData; // CraftBukkit - private -> public
public boolean hasWhitelist; // CraftBukkit - private -> public
protected int maxPlayers;
- protected int d;
- private EnumGamemode m;
- private boolean n;
- private int o = 0;
+ protected int c;
+ private EnumGamemode l;
+ private boolean m;
+ private int n = 0;
// CraftBukkit start
private CraftServer cserver;
@@ -64,7 +64,8 @@ public abstract class PlayerList {
}
public void a(INetworkManager inetworkmanager, EntityPlayer entityplayer) {
- this.a(entityplayer);
+ NBTTagCompound nbttagcompound = this.a(entityplayer);
+
entityplayer.spawnIn(this.server.getWorldServer(entityplayer.dimension));
entityplayer.playerInteractManager.a((WorldServer) entityplayer.world);
String s = "local";
@@ -74,7 +75,7 @@ public abstract class PlayerList {
}
// CraftBukkit - add world and location to 'logged in' message.
- a.info(entityplayer.name + "[" + s + "] logged in with entity id " + entityplayer.id + " at ([" + entityplayer.world.worldData.getName() + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
+ this.server.getLogger().info(entityplayer.name + "[" + s + "] logged in with entity id " + entityplayer.id + " at ([" + entityplayer.world.worldData.getName() + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")");
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
@@ -93,8 +94,9 @@ public abstract class PlayerList {
playerconnection.sendPacket(new Packet6SpawnPosition(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z));
playerconnection.sendPacket(new Packet202Abilities(entityplayer.abilities));
playerconnection.sendPacket(new Packet16BlockItemSwitch(entityplayer.inventory.itemInHandIndex));
+ this.a((ScoreboardServer) worldserver.getScoreboard(), entityplayer);
this.b(entityplayer, worldserver);
- // this.sendAll(new Packet3Chat("\u00A7e" + entityplayer.name + " joined the game.")); // CraftBukkit - handled in event
+ // this.sendAll(new Packet3Chat(EnumChatFormat.YELLOW + entityplayer.getScoreboardDisplayName() + EnumChatFormat.YELLOW + " joined the game.")); // CraftBukkit - handled in event
this.c(entityplayer);
playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
this.server.ae().a(playerconnection);
@@ -112,6 +114,44 @@ public abstract class PlayerList {
}
entityplayer.syncInventory();
+ if (nbttagcompound != null && nbttagcompound.hasKey("Riding")) {
+ Entity entity = EntityTypes.a(nbttagcompound.getCompound("Riding"), worldserver);
+
+ if (entity != null) {
+ entity.p = true;
+ worldserver.addEntity(entity);
+ entityplayer.mount(entity);
+ entity.p = false;
+ }
+ }
+ }
+
+ protected void a(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) {
+ HashSet hashset = new HashSet();
+ Iterator iterator = scoreboardserver.g().iterator();
+
+ while (iterator.hasNext()) {
+ ScoreboardTeam scoreboardteam = (ScoreboardTeam) iterator.next();
+
+ entityplayer.playerConnection.sendPacket(new Packet209SetScoreboardTeam(scoreboardteam, 0));
+ }
+
+ for (int i = 0; i < 3; ++i) {
+ ScoreboardObjective scoreboardobjective = scoreboardserver.a(i);
+
+ if (scoreboardobjective != null && !hashset.contains(scoreboardobjective)) {
+ List list = scoreboardserver.d(scoreboardobjective);
+ Iterator iterator1 = list.iterator();
+
+ while (iterator1.hasNext()) {
+ Packet packet = (Packet) iterator1.next();
+
+ entityplayer.playerConnection.sendPacket(packet);
+ }
+
+ hashset.add(scoreboardobjective);
+ }
+ }
}
public void setPlayerFileData(WorldServer[] aworldserver) {
@@ -120,7 +160,7 @@ public abstract class PlayerList {
}
public void a(EntityPlayer entityplayer, WorldServer worldserver) {
- WorldServer worldserver1 = entityplayer.p();
+ WorldServer worldserver1 = entityplayer.o();
if (worldserver != null) {
worldserver.getPlayerChunkMap().removePlayer(entityplayer);
@@ -134,14 +174,19 @@ public abstract class PlayerList {
return PlayerChunkMap.getFurthestViewableBlock(this.o());
}
- public void a(EntityPlayer entityplayer) {
+ public NBTTagCompound a(EntityPlayer entityplayer) {
NBTTagCompound nbttagcompound = this.server.worlds.get(0).getWorldData().i(); // CraftBukkit
+ NBTTagCompound nbttagcompound1;
if (entityplayer.getName().equals(this.server.H()) && nbttagcompound != null) {
- entityplayer.e(nbttagcompound);
+ entityplayer.f(nbttagcompound);
+ nbttagcompound1 = nbttagcompound;
+ System.out.println("loading single player");
} else {
- this.playerFileData.load(entityplayer);
+ nbttagcompound1 = this.playerFileData.load(entityplayer);
}
+
+ return nbttagcompound1;
}
protected void b(EntityPlayer entityplayer) {
@@ -198,7 +243,7 @@ public abstract class PlayerList {
}
public void d(EntityPlayer entityplayer) {
- entityplayer.p().getPlayerChunkMap().movePlayer(entityplayer);
+ entityplayer.o().getPlayerChunkMap().movePlayer(entityplayer);
}
public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - return string
@@ -211,7 +256,12 @@ public abstract class PlayerList {
// CraftBukkit end
this.b(entityplayer);
- WorldServer worldserver = entityplayer.p();
+ WorldServer worldserver = entityplayer.o();
+
+ if (entityplayer.vehicle != null) {
+ worldserver.kill(entityplayer.vehicle);
+ System.out.println("removing player mount");
+ }
worldserver.kill(entityplayer);
worldserver.getPlayerChunkMap().removePlayer(entityplayer);
@@ -248,7 +298,7 @@ public abstract class PlayerList {
String s1 = "You are banned from this server!\nReason: " + banentry.getReason();
if (banentry.getExpires() != null) {
- s1 = s1 + "\nYour ban will be removed on " + e.format(banentry.getExpires());
+ s1 = s1 + "\nYour ban will be removed on " + d.format(banentry.getExpires());
}
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s1);
@@ -264,7 +314,7 @@ public abstract class PlayerList {
String s3 = "Your IP address is banned from this server!\nReason: " + banentry1.getReason();
if (banentry1.getExpires() != null) {
- s3 = s3 + "\nYour ban will be removed on " + e.format(banentry1.getExpires());
+ s3 = s3 + "\nYour ban will be removed on " + d.format(banentry1.getExpires());
}
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, s3);
@@ -327,9 +377,9 @@ public abstract class PlayerList {
public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i, boolean flag, Location location, boolean avoidSuffocation) {
// CraftBukkit end
- entityplayer.p().getTracker().untrackPlayer(entityplayer);
- // entityplayer.p().getTracker().untrackEntity(entityplayer); // CraftBukkit
- entityplayer.p().getPlayerChunkMap().removePlayer(entityplayer);
+ entityplayer.o().getTracker().untrackPlayer(entityplayer);
+ // entityplayer.o().getTracker().untrackEntity(entityplayer); // CraftBukkit
+ entityplayer.o().getPlayerChunkMap().removePlayer(entityplayer);
this.players.remove(entityplayer);
this.server.getWorldServer(entityplayer.dimension).removeEntity(entityplayer);
ChunkCoordinates chunkcoordinates = entityplayer.getBed();
@@ -411,6 +461,7 @@ public abstract class PlayerList {
}
// entityplayer1.syncInventory();
// CraftBukkit end
+ entityplayer1.setHealth(entityplayer1.getHealth());
// CraftBukkit start - don't fire on respawn
if (fromWorld != location.getWorld()) {
@@ -651,13 +702,13 @@ public abstract class PlayerList {
}
public void tick() {
- if (++this.o > 600) {
- this.o = 0;
+ if (++this.n > 600) {
+ this.n = 0;
}
/* CraftBukkit start - remove updating of lag to players -- it spams way to much on big servers.
- if (this.o < this.players.size()) {
- EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.o);
+ if (this.n < this.players.size()) {
+ EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.n);
this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, entityplayer.ping));
}
@@ -741,7 +792,7 @@ public abstract class PlayerList {
public boolean isOp(String s) {
// CraftBukkit
- return this.operators.contains(s.trim().toLowerCase()) || this.server.I() && this.server.worlds.get(0).getWorldData().allowCommands() && this.server.H().equalsIgnoreCase(s) || this.n;
+ return this.operators.contains(s.trim().toLowerCase()) || this.server.I() && this.server.worlds.get(0).getWorldData().allowCommands() && this.server.H().equalsIgnoreCase(s) || this.m;
}
public EntityPlayer f(String s) {
@@ -760,7 +811,7 @@ public abstract class PlayerList {
return entityplayer;
}
- public List a(ChunkCoordinates chunkcoordinates, int i, int j, int k, int l, int i1, int j1) {
+ public List a(ChunkCoordinates chunkcoordinates, int i, int j, int k, int l, int i1, int j1, Map map, String s, String s1) {
if (this.players.isEmpty()) {
return null;
} else {
@@ -773,6 +824,32 @@ public abstract class PlayerList {
for (int i2 = 0; i2 < this.players.size(); ++i2) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(i2);
+ boolean flag1;
+
+ if (s != null) {
+ flag1 = s.startsWith("!");
+ if (flag1) {
+ s = s.substring(1);
+ }
+
+ if (flag1 == s.equalsIgnoreCase(entityplayer.getLocalizedName())) {
+ continue;
+ }
+ }
+
+ if (s1 != null) {
+ flag1 = s1.startsWith("!");
+ if (flag1) {
+ s1 = s1.substring(1);
+ }
+
+ ScoreboardTeam scoreboardteam = entityplayer.getScoreboardTeam();
+ String s2 = scoreboardteam == null ? "" : scoreboardteam.b();
+
+ if (flag1 == s1.equalsIgnoreCase(s2)) {
+ continue;
+ }
+ }
if (chunkcoordinates != null && (i > 0 || j > 0)) {
float f = chunkcoordinates.e(entityplayer.b());
@@ -782,7 +859,7 @@ public abstract class PlayerList {
}
}
- if ((l == EnumGamemode.NONE.a() || l == entityplayer.playerInteractManager.getGameMode().a()) && (i1 <= 0 || entityplayer.expLevel >= i1) && entityplayer.expLevel <= j1) {
+ if (this.a((EntityHuman) entityplayer, map) && (l == EnumGamemode.NONE.a() || l == entityplayer.playerInteractManager.getGameMode().a()) && (i1 <= 0 || entityplayer.expLevel >= i1) && entityplayer.expLevel <= j1) {
((List) object).add(entityplayer);
}
}
@@ -803,6 +880,49 @@ public abstract class PlayerList {
}
}
+ private boolean a(EntityHuman entityhuman, Map map) {
+ if (map != null && map.size() != 0) {
+ Iterator iterator = map.entrySet().iterator();
+
+ Entry entry;
+ boolean flag;
+ int i;
+
+ do {
+ if (!iterator.hasNext()) {
+ return true;
+ }
+
+ entry = (Entry) iterator.next();
+ String s = (String) entry.getKey();
+
+ flag = false;
+ if (s.endsWith("_min") && s.length() > 4) {
+ flag = true;
+ s = s.substring(0, s.length() - 4);
+ }
+
+ Scoreboard scoreboard = entityhuman.getScoreboard();
+ ScoreboardObjective scoreboardobjective = scoreboard.b(s);
+
+ if (scoreboardobjective == null) {
+ return false;
+ }
+
+ ScoreboardScore scoreboardscore = entityhuman.getScoreboard().a(entityhuman.getLocalizedName(), scoreboardobjective);
+
+ i = scoreboardscore.c();
+ if (i < ((Integer) entry.getValue()).intValue() && flag) {
+ return false;
+ }
+ } while (i <= ((Integer) entry.getValue()).intValue() || flag);
+
+ return false;
+ } else {
+ return true;
+ }
+ }
+
public void sendPacketNearby(double d0, double d1, double d2, double d3, int i, Packet packet) {
this.sendPacketNearby((EntityHuman) null, d0, d1, d2, d3, i, packet);
}
@@ -854,7 +974,7 @@ public abstract class PlayerList {
public void b(EntityPlayer entityplayer, WorldServer worldserver) {
entityplayer.playerConnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime()));
- if (worldserver.N()) {
+ if (worldserver.O()) {
entityplayer.playerConnection.sendPacket(new Packet70Bed(1, 0));
}
}
@@ -892,7 +1012,7 @@ public abstract class PlayerList {
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
- if (entityplayer.q().equals(s)) {
+ if (entityplayer.p().equals(s)) {
arraylist.add(entityplayer);
}
}
@@ -901,7 +1021,7 @@ public abstract class PlayerList {
}
public int o() {
- return this.d;
+ return this.c;
}
public MinecraftServer getServer() {
@@ -915,8 +1035,8 @@ public abstract class PlayerList {
private void a(EntityPlayer entityplayer, EntityPlayer entityplayer1, World world) {
if (entityplayer1 != null) {
entityplayer.playerInteractManager.setGameMode(entityplayer1.playerInteractManager.getGameMode());
- } else if (this.m != null) {
- entityplayer.playerInteractManager.setGameMode(this.m);
+ } else if (this.l != null) {
+ entityplayer.playerInteractManager.setGameMode(this.l);
}
entityplayer.playerInteractManager.b(world.getWorldData().getGameType());
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index cb5a0ada..5eafb576 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -54,7 +54,7 @@ public class PortalTravelAgent {
int i2 = k + i1 * b1 - l * b0;
boolean flag = j1 < 0;
- this.a.setTypeId(k1, l1, i2, flag ? Block.OBSIDIAN.id : 0);
+ this.a.setTypeIdUpdate(k1, l1, i2, flag ? Block.OBSIDIAN.id : 0);
}
}
}
@@ -140,7 +140,7 @@ public class PortalTravelAgent {
for (int l1 = i1 - short1; l1 <= i1 + short1; ++l1) {
double d6 = (double) l1 + 0.5D - z; // CraftBukkit
- for (int i2 = this.a.P() - 1; i2 >= 0; --i2) {
+ for (int i2 = this.a.Q() - 1; i2 >= 0; --i2) {
if (this.a.getTypeId(k1, i2, l1) == Block.PORTAL.id) {
while (this.a.getTypeId(k1, i2 - 1, l1) == Block.PORTAL.id) {
--i2;
@@ -215,7 +215,7 @@ public class PortalTravelAgent {
j2 = 1;
}
- int k2 = entity.at();
+ int k2 = entity.as();
if (j2 > -1) {
int l2 = Direction.h[j2];
@@ -364,7 +364,7 @@ public class PortalTravelAgent {
d2 = (double) j2 + 0.5D - z; // CraftBukkit
label274:
- for (k2 = this.a.P() - 1; k2 >= 0; --k2) {
+ for (k2 = this.a.Q() - 1; k2 >= 0; --k2) {
if (this.a.isEmpty(i2, k2, j2)) {
while (k2 > 0 && this.a.isEmpty(i2, k2 - 1, j2)) {
--k2;
@@ -415,7 +415,7 @@ public class PortalTravelAgent {
d2 = (double) j2 + 0.5D - z; // CraftBukkit
label222:
- for (k2 = this.a.P() - 1; k2 >= 0; --k2) {
+ for (k2 = this.a.Q() - 1; k2 >= 0; --k2) {
if (this.a.isEmpty(i2, k2, j2)) {
while (k2 > 0 && this.a.isEmpty(i2, k2 - 1, j2)) {
--k2;
@@ -471,8 +471,8 @@ public class PortalTravelAgent {
i1 = 70;
}
- if (i1 > this.a.P() - 10) {
- i1 = this.a.P() - 10;
+ if (i1 > this.a.Q() - 10) {
+ i1 = this.a.Q() - 10;
}
j5 = i1;
@@ -484,27 +484,23 @@ public class PortalTravelAgent {
j3 = j5 + l2;
i4 = j2 + (i3 - 1) * l5 - k2 * k5;
flag = l2 < 0;
- this.a.setTypeId(k3, j3, i4, flag ? Block.OBSIDIAN.id : 0);
+ this.a.setTypeIdUpdate(k3, j3, i4, flag ? Block.OBSIDIAN.id : 0);
}
}
}
}
for (k2 = 0; k2 < 4; ++k2) {
- this.a.suppressPhysics = true;
-
for (i3 = 0; i3 < 4; ++i3) {
for (l2 = -1; l2 < 4; ++l2) {
k3 = i5 + (i3 - 1) * k5;
j3 = j5 + l2;
i4 = j2 + (i3 - 1) * l5;
flag = i3 == 0 || i3 == 3 || l2 == -1 || l2 == 3;
- this.a.setTypeId(k3, j3, i4, flag ? Block.OBSIDIAN.id : Block.PORTAL.id);
+ this.a.setTypeIdAndData(k3, j3, i4, flag ? Block.OBSIDIAN.id : Block.PORTAL.id, 0, 2);
}
}
- this.a.suppressPhysics = false;
-
for (i3 = 0; i3 < 4; ++i3) {
for (l2 = -1; l2 < 4; ++l2) {
k3 = i5 + (i3 - 1) * k5;
diff --git a/src/main/java/net/minecraft/server/PropertyManager.java b/src/main/java/net/minecraft/server/PropertyManager.java
index 8c0ef999..03aa2190 100644
--- a/src/main/java/net/minecraft/server/PropertyManager.java
+++ b/src/main/java/net/minecraft/server/PropertyManager.java
@@ -12,12 +12,13 @@ import joptsimple.OptionSet; // CraftBukkit
public class PropertyManager {
- public static Logger a = Logger.getLogger("Minecraft");
- public Properties properties = new Properties(); // CraftBukkit - private -> public
- private File c;
+ public final Properties properties = new Properties(); // CraftBukkit - private -> public
+ private final IConsoleLogManager loggingAgent;
+ private final File c;
- public PropertyManager(File file1) {
+ public PropertyManager(File file1, IConsoleLogManager iconsolelogmanager) {
this.c = file1;
+ this.loggingAgent = iconsolelogmanager;
if (file1.exists()) {
FileInputStream fileinputstream = null;
@@ -25,7 +26,7 @@ public class PropertyManager {
fileinputstream = new FileInputStream(file1);
this.properties.load(fileinputstream);
} catch (Exception exception) {
- a.log(Level.WARNING, "Failed to load " + file1, exception);
+ iconsolelogmanager.warning("Failed to load " + file1, exception);
this.a();
} finally {
if (fileinputstream != null) {
@@ -37,7 +38,7 @@ public class PropertyManager {
}
}
} else {
- a.log(Level.WARNING, file1 + " does not exist");
+ iconsolelogmanager.warning(file1 + " does not exist");
this.a();
}
}
@@ -45,8 +46,8 @@ public class PropertyManager {
// CraftBukkit start
private OptionSet options = null;
- public PropertyManager(final OptionSet options) {
- this((File) options.valueOf("config"));
+ public PropertyManager(final OptionSet options, IConsoleLogManager iconsolelogmanager) {
+ this((File) options.valueOf("config"), iconsolelogmanager);
this.options = options;
}
@@ -61,7 +62,7 @@ public class PropertyManager {
// CraftBukkit end
public void a() {
- a.log(Level.INFO, "Generating new properties file");
+ this.loggingAgent.info("Generating new properties file");
this.savePropertiesFile();
}
@@ -77,7 +78,7 @@ public class PropertyManager {
fileoutputstream = new FileOutputStream(this.c);
this.properties.store(fileoutputstream, "Minecraft server properties");
} catch (Exception exception) {
- a.log(Level.WARNING, "Failed to save " + this.c, exception);
+ this.loggingAgent.warning("Failed to save " + this.c, exception);
this.a();
} finally {
if (fileoutputstream != null) {
diff --git a/src/main/java/net/minecraft/server/RecipeArmorDye.java b/src/main/java/net/minecraft/server/RecipeArmorDye.java
index 3735aa7a..0b89265a 100644
--- a/src/main/java/net/minecraft/server/RecipeArmorDye.java
+++ b/src/main/java/net/minecraft/server/RecipeArmorDye.java
@@ -63,6 +63,7 @@ public class RecipeArmorDye extends ShapelessRecipes implements IRecipe { // Cra
}
itemstack = itemstack1.cloneItemStack();
+ itemstack.count = 1;
if (itemarmor.a(itemstack1)) {
l = itemarmor.b(itemstack);
f = (float) (l >> 16 & 255) / 255.0F;
@@ -80,7 +81,7 @@ public class RecipeArmorDye extends ShapelessRecipes implements IRecipe { // Cra
return null;
}
- float[] afloat = EntitySheep.d[BlockCloth.e_(itemstack1.getData())];
+ float[] afloat = EntitySheep.d[BlockCloth.g_(itemstack1.getData())];
int j1 = (int) (afloat[0] * 255.0F);
int k1 = (int) (afloat[1] * 255.0F);
diff --git a/src/main/java/net/minecraft/server/RecipeFireworks.java b/src/main/java/net/minecraft/server/RecipeFireworks.java
index abed268e..43caa905 100644
--- a/src/main/java/net/minecraft/server/RecipeFireworks.java
+++ b/src/main/java/net/minecraft/server/RecipeFireworks.java
@@ -92,7 +92,7 @@ public class RecipeFireworks extends ShapelessRecipes implements IRecipe { // Cr
if (itemstack2 != null) {
if (itemstack2.id == Item.INK_SACK.id) {
- arraylist.add(Integer.valueOf(ItemDye.b[itemstack2.getData()]));
+ arraylist.add(Integer.valueOf(ItemDye.c[itemstack2.getData()]));
} else if (itemstack2.id == Item.GLOWSTONE_DUST.id) {
nbttagcompound1.setBoolean("Flicker", true);
} else if (itemstack2.id == Item.DIAMOND.id) {
@@ -128,7 +128,7 @@ public class RecipeFireworks extends ShapelessRecipes implements IRecipe { // Cr
if (itemstack3 != null) {
if (itemstack3.id == Item.INK_SACK.id) {
- arraylist1.add(Integer.valueOf(ItemDye.b[itemstack3.getData()]));
+ arraylist1.add(Integer.valueOf(ItemDye.c[itemstack3.getData()]));
} else if (itemstack3.id == Item.FIREWORKS_CHARGE.id) {
this.a = itemstack3.cloneItemStack();
this.a.count = 1;
diff --git a/src/main/java/net/minecraft/server/RecipeMapClone.java b/src/main/java/net/minecraft/server/RecipeMapClone.java
index 7224c7af..97539ecd 100644
--- a/src/main/java/net/minecraft/server/RecipeMapClone.java
+++ b/src/main/java/net/minecraft/server/RecipeMapClone.java
@@ -62,8 +62,8 @@ public class RecipeMapClone extends ShapelessRecipes implements IRecipe { // Cra
if (itemstack != null && i >= 1) {
ItemStack itemstack2 = new ItemStack(Item.MAP, i + 1, itemstack.getData());
- if (itemstack.s()) {
- itemstack2.c(itemstack.r());
+ if (itemstack.hasName()) {
+ itemstack2.c(itemstack.getName());
}
return itemstack2;
diff --git a/src/main/java/net/minecraft/server/RecipesFurnace.java b/src/main/java/net/minecraft/server/RecipesFurnace.java
index 7abc4612..fe56cde5 100644
--- a/src/main/java/net/minecraft/server/RecipesFurnace.java
+++ b/src/main/java/net/minecraft/server/RecipesFurnace.java
@@ -28,9 +28,11 @@ public class RecipesFurnace {
this.registerRecipe(Block.LOG.id, new ItemStack(Item.COAL, 1, 1), 0.15F);
this.registerRecipe(Block.EMERALD_ORE.id, new ItemStack(Item.EMERALD), 1.0F);
this.registerRecipe(Item.POTATO.id, new ItemStack(Item.POTATO_BAKED), 0.35F);
+ this.registerRecipe(Block.NETHERRACK.id, new ItemStack(Item.NETHER_BRICK), 0.1F);
this.registerRecipe(Block.COAL_ORE.id, new ItemStack(Item.COAL), 0.1F);
this.registerRecipe(Block.REDSTONE_ORE.id, new ItemStack(Item.REDSTONE), 0.7F);
this.registerRecipe(Block.LAPIS_ORE.id, new ItemStack(Item.INK_SACK, 1, 4), 0.2F);
+ this.registerRecipe(Block.QUARTZ_ORE.id, new ItemStack(Item.QUARTZ), 0.2F);
}
public void registerRecipe(int i, ItemStack itemstack, float f) {
diff --git a/src/main/java/net/minecraft/server/SecondaryWorldServer.java b/src/main/java/net/minecraft/server/SecondaryWorldServer.java
index 0032fae3..94a2f05d 100644
--- a/src/main/java/net/minecraft/server/SecondaryWorldServer.java
+++ b/src/main/java/net/minecraft/server/SecondaryWorldServer.java
@@ -2,10 +2,11 @@ package net.minecraft.server;
public class SecondaryWorldServer extends WorldServer {
// CraftBukkit start - Changed signature
- public SecondaryWorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, WorldSettings worldsettings, WorldServer worldserver, MethodProfiler methodprofiler, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
- super(minecraftserver, idatamanager, s, i, worldsettings, methodprofiler, env, gen);
+ public SecondaryWorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, WorldSettings worldsettings, WorldServer worldserver, MethodProfiler methodprofiler, IConsoleLogManager iconsolelogmanager, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
+ super(minecraftserver, idatamanager, s, i, worldsettings, methodprofiler, iconsolelogmanager, env, gen);
// CraftBukkit end
this.worldMaps = worldserver.worldMaps;
+ this.scoreboard = worldserver.getScoreboard();
// this.worldData = new SecondaryWorldData(worldserver.getWorldData()); // CraftBukkit - use unique worlddata
}
diff --git a/src/main/java/net/minecraft/server/ShapedRecipes.java b/src/main/java/net/minecraft/server/ShapedRecipes.java
index 52f8ee74..a70b8285 100644
--- a/src/main/java/net/minecraft/server/ShapedRecipes.java
+++ b/src/main/java/net/minecraft/server/ShapedRecipes.java
@@ -124,7 +124,7 @@ public class ShapedRecipes implements IRecipe {
return false;
}
- if (itemstack.getData() != -1 && itemstack.getData() != itemstack1.getData()) {
+ if (itemstack.getData() != 32767 && itemstack.getData() != itemstack1.getData()) {
return false;
}
}
diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java
index 3c08c2a6..fbdad807 100644
--- a/src/main/java/net/minecraft/server/ShapelessRecipes.java
+++ b/src/main/java/net/minecraft/server/ShapelessRecipes.java
@@ -51,7 +51,7 @@ public class ShapelessRecipes implements IRecipe {
while (iterator.hasNext()) {
ItemStack itemstack1 = (ItemStack) iterator.next();
- if (itemstack.id == itemstack1.id && (itemstack1.getData() == -1 || itemstack.getData() == itemstack1.getData())) {
+ if (itemstack.id == itemstack1.id && (itemstack1.getData() == 32767 || itemstack.getData() == itemstack1.getData())) {
flag = true;
arraylist.remove(itemstack1);
break;
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 9b3e2626..2d1a3723 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -21,7 +21,7 @@ public final class SpawnerCreature {
Chunk chunk = world.getChunkAt(i, j);
int k = i * 16 + world.random.nextInt(16);
int l = j * 16 + world.random.nextInt(16);
- int i1 = world.random.nextInt(chunk == null ? world.P() : chunk.h() + 16 - 1);
+ int i1 = world.random.nextInt(chunk == null ? world.Q() : chunk.h() + 16 - 1);
return new ChunkPosition(k, i1, l);
}
@@ -105,7 +105,7 @@ public final class SpawnerCreature {
int l1 = chunkposition.y;
int i2 = chunkposition.z;
- if (!worldserver.t(k1, l1, i2) && worldserver.getMaterial(k1, l1, i2) == enumcreaturetype.c()) {
+ if (!worldserver.u(k1, l1, i2) && worldserver.getMaterial(k1, l1, i2) == enumcreaturetype.c()) {
int j2 = 0;
int k2 = 0;
@@ -158,7 +158,7 @@ public final class SpawnerCreature {
a(entityliving, worldserver, f, f1, f2);
worldserver.addEntity(entityliving, SpawnReason.NATURAL);
// CraftBukkit end
- if (j2 >= entityliving.bv()) {
+ if (j2 >= entityliving.by()) {
continue label110;
}
}
@@ -189,18 +189,18 @@ public final class SpawnerCreature {
public static boolean a(EnumCreatureType enumcreaturetype, World world, int i, int j, int k) {
if (enumcreaturetype.c() == Material.WATER) {
- return world.getMaterial(i, j, k).isLiquid() && world.getMaterial(i, j - 1, k).isLiquid() && !world.t(i, j + 1, k);
- } else if (!world.v(i, j - 1, k)) {
+ return world.getMaterial(i, j, k).isLiquid() && world.getMaterial(i, j - 1, k).isLiquid() && !world.u(i, j + 1, k);
+ } else if (!world.w(i, j - 1, k)) {
return false;
} else {
int l = world.getTypeId(i, j - 1, k);
- return l != Block.BEDROCK.id && !world.t(i, j, k) && !world.getMaterial(i, j, k).isLiquid() && !world.t(i, j + 1, k);
+ return l != Block.BEDROCK.id && !world.u(i, j, k) && !world.getMaterial(i, j, k).isLiquid() && !world.u(i, j + 1, k);
}
}
private static void a(EntityLiving entityliving, World world, float f, float f1, float f2) {
- entityliving.bG();
+ entityliving.bJ();
}
public static void a(World world, BiomeBase biomebase, int i, int j, int k, int l, Random random) {
diff --git a/src/main/java/net/minecraft/server/ThreadCommandReader.java b/src/main/java/net/minecraft/server/ThreadCommandReader.java
index 64eaa4ca..489e1846 100644
--- a/src/main/java/net/minecraft/server/ThreadCommandReader.java
+++ b/src/main/java/net/minecraft/server/ThreadCommandReader.java
@@ -39,7 +39,7 @@ class ThreadCommandReader extends Thread {
}
} catch (IOException ioexception) {
// CraftBukkit
- MinecraftServer.log.log(java.util.logging.Level.SEVERE, null, ioexception);
+ java.util.logging.Logger.getLogger("").log(java.util.logging.Level.SEVERE, null, ioexception);
}
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index d8eb6b91..db3fc42e 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -10,7 +10,7 @@ public class TileEntity {
private static Map a = new HashMap();
private static Map b = new HashMap();
- public World world; // CraftBukkit - protected -> public
+ protected World world;
public int x;
public int y;
public int z;
@@ -33,6 +33,10 @@ public class TileEntity {
this.world = world;
}
+ public World getWorld() {
+ return this.world;
+ }
+
public boolean o() {
return this.world != null;
}
@@ -56,7 +60,7 @@ public class TileEntity {
}
}
- public void g() {}
+ public void h() {}
public static TileEntity c(NBTTagCompound nbttagcompound) {
TileEntity tileentity = null;
@@ -74,7 +78,7 @@ public class TileEntity {
if (tileentity != null) {
tileentity.a(nbttagcompound);
} else {
- System.out.println("Skipping TileEntity with id " + nbttagcompound.getString("id"));
+ MinecraftServer.getServer().getLogger().warning("Skipping TileEntity with id " + nbttagcompound.getString("id"));
}
return tileentity;
@@ -92,6 +96,9 @@ public class TileEntity {
if (this.world != null) {
this.p = this.world.getData(this.x, this.y, this.z);
this.world.b(this.x, this.y, this.z, this);
+ if (this.q() != null) {
+ this.world.m(this.x, this.y, this.z, this.q().id);
+ }
}
}
@@ -119,16 +126,20 @@ public class TileEntity {
this.o = false;
}
- public void b(int i, int j) {}
+ public boolean b(int i, int j) {
+ return false;
+ }
- public void h() {
+ public void i() {
this.q = null;
this.p = -1;
}
public void a(CrashReportSystemDetails crashreportsystemdetails) {
crashreportsystemdetails.a("Name", (Callable) (new CrashReportTileEntityName(this)));
- CrashReportSystemDetails.a(crashreportsystemdetails, this.x, this.y, this.z, this.q.id, this.p);
+ CrashReportSystemDetails.a(crashreportsystemdetails, this.x, this.y, this.z, this.q().id, this.p());
+ crashreportsystemdetails.a("Actual block type", (Callable) (new CrashReportTileEntityType(this)));
+ crashreportsystemdetails.a("Actual block data value", (Callable) (new CrashReportTileEntityData(this)));
}
static Map t() {
@@ -141,6 +152,7 @@ public class TileEntity {
a(TileEntityEnderChest.class, "EnderChest");
a(TileEntityRecordPlayer.class, "RecordPlayer");
a(TileEntityDispenser.class, "Trap");
+ a(TileEntityDropper.class, "Dropper");
a(TileEntitySign.class, "Sign");
a(TileEntityMobSpawner.class, "MobSpawner");
a(TileEntityNote.class, "Music");
@@ -151,6 +163,9 @@ public class TileEntity {
a(TileEntityCommand.class, "Control");
a(TileEntityBeacon.class, "Beacon");
a(TileEntitySkull.class, "Skull");
+ a(TileEntityLightDetector.class, "DLDetector");
+ a(TileEntityHopper.class, "Hopper");
+ a(TileEntityComparator.class, "Comparator");
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java
index 9c19453f..69379293 100644
--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java
+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java
@@ -4,8 +4,6 @@ import java.util.Iterator;
import java.util.List;
// CraftBukkit start
-import java.util.List;
-
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
import org.bukkit.entity.HumanEntity;
// CraftBukkit end
@@ -18,6 +16,7 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
private int f;
private int g;
private ItemStack h;
+ private String i;
// CraftBukkit start
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
private int maxStack = MAX_STACK;
@@ -45,7 +44,7 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
public TileEntityBeacon() {}
- public void g() {
+ public void h() {
if (this.world.getTime() % 80L == 0L) {
this.v();
this.u();
@@ -54,7 +53,7 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
private void u() {
if (this.d && this.e > 0 && !this.world.isStatic && this.f > 0) {
- double d0 = (double) (this.e * 8 + 8);
+ double d0 = (double) (this.e * 10 + 10);
byte b0 = 0;
if (this.e >= 4 && this.f == this.g) {
@@ -62,6 +61,8 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
}
AxisAlignedBB axisalignedbb = AxisAlignedBB.a().a((double) this.x, (double) this.y, (double) this.z, (double) (this.x + 1), (double) (this.y + 1), (double) (this.z + 1)).grow(d0, d0, d0);
+
+ axisalignedbb.e = (double) this.world.getHeight();
List list = this.world.a(EntityHuman.class, axisalignedbb);
Iterator iterator = list.iterator();
@@ -84,7 +85,7 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
}
private void v() {
- if (!this.world.k(this.x, this.y + 1, this.z)) {
+ if (!this.world.l(this.x, this.y + 1, this.z)) {
this.d = false;
this.e = 0;
} else {
@@ -122,15 +123,15 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
}
}
- public int i() {
+ public int j() {
return this.f;
}
- public int j() {
+ public int k() {
return this.g;
}
- public int k() {
+ public int l() {
return this.e;
}
@@ -234,18 +235,30 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
}
public String getName() {
- return "container.beacon";
+ return this.c() ? this.i : "container.beacon";
+ }
+
+ public boolean c() {
+ return this.i != null && this.i.length() > 0;
+ }
+
+ public void a(String s) {
+ this.i = s;
}
public int getMaxStackSize() {
return maxStack; // CraftBukkit
}
- public boolean a_(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
}
public void startOpen() {}
- public void f() {}
+ public void g() {}
+
+ public boolean b(int i, ItemStack itemstack) {
+ return itemstack.id == Item.EMERALD.id || itemstack.id == Item.DIAMOND.id || itemstack.id == Item.GOLD_INGOT.id || itemstack.id == Item.IRON_INGOT.id;
+ }
}
diff --git a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
index f047c856..8d77f12d 100644
--- a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
+++ b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
@@ -8,18 +8,19 @@ import org.bukkit.entity.HumanEntity;
import org.bukkit.event.inventory.BrewEvent;
// CraftBukkit end
-public class TileEntityBrewingStand extends TileEntity implements IInventory {
+public class TileEntityBrewingStand extends TileEntity implements IWorldInventory {
public ItemStack[] items = new ItemStack[4]; // CraftBukkit private -> public
public int brewTime; // CraftBukkit private -> public
private int c;
private int d;
+ private String e;
public TileEntityBrewingStand() {}
// CraftBukkit start
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
- private int maxStack = 1;
+ private int maxStack = 64;
public void onOpen(CraftHumanEntity who) {
transaction.add(who);
@@ -43,50 +44,58 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
// CraftBukkit end
public String getName() {
- return "container.brewing";
+ return this.c() ? this.e : "container.brewing";
+ }
+
+ public boolean c() {
+ return this.e != null && this.e.length() > 0;
+ }
+
+ public void a(String s) {
+ this.e = s;
}
public int getSize() {
return this.items.length;
}
- public void g() {
+ public void h() {
if (this.brewTime > 0) {
--this.brewTime;
if (this.brewTime == 0) {
this.u();
this.update();
- } else if (!this.k()) {
+ } else if (!this.l()) {
this.brewTime = 0;
this.update();
} else if (this.d != this.items[3].id) {
this.brewTime = 0;
this.update();
}
- } else if (this.k()) {
+ } else if (this.l()) {
this.brewTime = 400;
this.d = this.items[3].id;
}
- int i = this.i();
+ int i = this.j();
if (i != this.c) {
this.c = i;
- this.world.setData(this.x, this.y, this.z, i);
+ this.world.setData(this.x, this.y, this.z, i, 2);
}
- super.g();
+ super.h();
}
public int x_() {
return this.brewTime;
}
- private boolean k() {
+ private boolean l() {
if (this.items[3] != null && this.items[3].count > 0) {
ItemStack itemstack = this.items[3];
- if (!Item.byId[itemstack.id].v()) {
+ if (!Item.byId[itemstack.id].w()) {
return false;
} else {
boolean flag = false;
@@ -94,15 +103,15 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
for (int i = 0; i < 3; ++i) {
if (this.items[i] != null && this.items[i].id == Item.POTION.id) {
int j = this.items[i].getData();
- int k = this.b(j, itemstack);
+ int k = this.c(j, itemstack);
- if (!ItemPotion.g(j) && ItemPotion.g(k)) {
+ if (!ItemPotion.f(j) && ItemPotion.f(k)) {
flag = true;
break;
}
- List list = Item.POTION.f(j);
- List list1 = Item.POTION.f(k);
+ List list = Item.POTION.c(j);
+ List list1 = Item.POTION.c(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null) && j != k) {
flag = true;
@@ -119,7 +128,7 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
}
private void u() {
- if (this.k()) {
+ if (this.l()) {
ItemStack itemstack = this.items[3];
// CraftBukkit start - fire BREW event
@@ -135,22 +144,22 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
for (int i = 0; i < 3; ++i) {
if (this.items[i] != null && this.items[i].id == Item.POTION.id) {
int j = this.items[i].getData();
- int k = this.b(j, itemstack);
- List list = Item.POTION.f(j);
- List list1 = Item.POTION.f(k);
+ int k = this.c(j, itemstack);
+ List list = Item.POTION.c(j);
+ List list1 = Item.POTION.c(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null)) {
if (j != k) {
this.items[i].setData(k);
}
- } else if (!ItemPotion.g(j) && ItemPotion.g(k)) {
+ } else if (!ItemPotion.f(j) && ItemPotion.f(k)) {
this.items[i].setData(k);
}
}
}
- if (Item.byId[itemstack.id].s()) {
- this.items[3] = new ItemStack(Item.byId[itemstack.id].r());
+ if (Item.byId[itemstack.id].t()) {
+ this.items[3] = new ItemStack(Item.byId[itemstack.id].s());
} else {
--this.items[3].count;
if (this.items[3].count <= 0) {
@@ -160,8 +169,8 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
}
}
- private int b(int i, ItemStack itemstack) {
- return itemstack == null ? i : (Item.byId[itemstack.id].v() ? PotionBrewer.a(i, Item.byId[itemstack.id].u()) : i);
+ private int c(int i, ItemStack itemstack) {
+ return itemstack == null ? i : (Item.byId[itemstack.id].w() ? PotionBrewer.a(i, Item.byId[itemstack.id].v()) : i);
}
public void a(NBTTagCompound nbttagcompound) {
@@ -180,6 +189,9 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
}
this.brewTime = nbttagcompound.getShort("BrewTime");
+ if (nbttagcompound.hasKey("CustomName")) {
+ this.e = nbttagcompound.getString("CustomName");
+ }
}
public void b(NBTTagCompound nbttagcompound) {
@@ -198,6 +210,9 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
}
nbttagcompound.set("Items", nbttaglist);
+ if (this.c()) {
+ nbttagcompound.setString("CustomName", this.e);
+ }
}
public ItemStack getItem(int i) {
@@ -236,15 +251,19 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
return this.maxStack; // CraftBukkit
}
- public boolean a_(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
}
public void startOpen() {}
- public void f() {}
+ public void g() {}
- public int i() {
+ public boolean b(int i, ItemStack itemstack) {
+ return i == 3 ? Item.byId[itemstack.id].w() : itemstack.id == Item.POTION.id || itemstack.id == Item.GLASS_BOTTLE.id;
+ }
+
+ public int j() {
int i = 0;
for (int j = 0; j < 3; ++j) {
@@ -255,4 +274,12 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
return i;
}
+
+ public int c(int i) {
+ return i == 1 ? 3 : 0;
+ }
+
+ public int d(int i) {
+ return i == 1 ? 1 : 3;
+ }
}
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index 4f002501..b179ddf2 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -20,6 +20,8 @@ public class TileEntityChest extends TileEntity implements IInventory {
public float g;
public int h;
private int ticks;
+ private int r = -1;
+ private String s;
public TileEntityChest() {}
@@ -100,7 +102,15 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
public String getName() {
- return "container.chest";
+ return this.c() ? this.s : "container.chest";
+ }
+
+ public boolean c() {
+ return this.s != null && this.s.length() > 0;
+ }
+
+ public void a(String s) {
+ this.s = s;
}
public void a(NBTTagCompound nbttagcompound) {
@@ -108,6 +118,9 @@ public class TileEntityChest extends TileEntity implements IInventory {
NBTTagList nbttaglist = nbttagcompound.getList("Items");
this.items = new ItemStack[this.getSize()];
+ if (nbttagcompound.hasKey("CustomName")) {
+ this.s = nbttagcompound.getString("CustomName");
+ }
for (int i = 0; i < nbttaglist.size(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
@@ -134,19 +147,22 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
nbttagcompound.set("Items", nbttaglist);
+ if (this.c()) {
+ nbttagcompound.setString("CustomName", this.s);
+ }
}
public int getMaxStackSize() {
return maxStack; // CraftBukkit
}
- public boolean a_(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
if (this.world == null) return true; // CraftBukkit
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
}
- public void h() {
- super.h();
+ public void i() {
+ super.i();
this.a = false;
}
@@ -155,52 +171,52 @@ public class TileEntityChest extends TileEntity implements IInventory {
this.a = false;
} else if (this.a) {
switch (i) {
- case 0:
- if (this.e != tileentitychest) {
- this.a = false;
- }
- break;
+ case 0:
+ if (this.e != tileentitychest) {
+ this.a = false;
+ }
+ break;
- case 1:
- if (this.d != tileentitychest) {
- this.a = false;
- }
- break;
+ case 1:
+ if (this.d != tileentitychest) {
+ this.a = false;
+ }
+ break;
- case 2:
- if (this.b != tileentitychest) {
- this.a = false;
- }
- break;
+ case 2:
+ if (this.b != tileentitychest) {
+ this.a = false;
+ }
+ break;
- case 3:
- if (this.c != tileentitychest) {
- this.a = false;
- }
+ case 3:
+ if (this.c != tileentitychest) {
+ this.a = false;
+ }
}
}
}
- public void i() {
+ public void j() {
if (!this.a) {
this.a = true;
this.b = null;
this.c = null;
this.d = null;
this.e = null;
- if (this.world.getTypeId(this.x - 1, this.y, this.z) == Block.CHEST.id) {
+ if (this.a(this.x - 1, this.y, this.z)) {
this.d = (TileEntityChest) this.world.getTileEntity(this.x - 1, this.y, this.z);
}
- if (this.world.getTypeId(this.x + 1, this.y, this.z) == Block.CHEST.id) {
+ if (this.a(this.x + 1, this.y, this.z)) {
this.c = (TileEntityChest) this.world.getTileEntity(this.x + 1, this.y, this.z);
}
- if (this.world.getTypeId(this.x, this.y, this.z - 1) == Block.CHEST.id) {
+ if (this.a(this.x, this.y, this.z - 1)) {
this.b = (TileEntityChest) this.world.getTileEntity(this.x, this.y, this.z - 1);
}
- if (this.world.getTypeId(this.x, this.y, this.z + 1) == Block.CHEST.id) {
+ if (this.a(this.x, this.y, this.z + 1)) {
this.e = (TileEntityChest) this.world.getTileEntity(this.x, this.y, this.z + 1);
}
@@ -209,11 +225,11 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
if (this.e != null) {
- this.e.a(this, 1);
+ this.e.a(this, 2);
}
if (this.c != null) {
- this.c.a(this, 2);
+ this.c.a(this, 1);
}
if (this.d != null) {
@@ -222,10 +238,16 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
}
- public void g() {
- super.g();
+ private boolean a(int i, int j, int k) {
+ Block block = Block.byId[this.world.getTypeId(i, j, k)];
+
+ return block != null && block instanceof BlockChest ? ((BlockChest) block).a == this.l() : false;
+ }
+
+ public void h() {
+ super.h();
if (this.world == null) return; // CraftBukkit
- this.i();
+ this.j();
++this.ticks;
float f;
@@ -239,9 +261,9 @@ public class TileEntityChest extends TileEntity implements IInventory {
EntityHuman entityhuman = (EntityHuman) iterator.next();
if (entityhuman.activeContainer instanceof ContainerChest) {
- IInventory iinventory = ((ContainerChest) entityhuman.activeContainer).d();
+ IInventory iinventory = ((ContainerChest) entityhuman.activeContainer).e();
- if (iinventory == this || iinventory instanceof InventoryLargeChest && ((InventoryLargeChest) iinventory).a(this)) {
+ if (iinventory == this || iinventory instanceof InventoryLargeChest && ((InventoryLargeChest) iinventory).a((IInventory) this)) {
++this.h;
}
}
@@ -303,27 +325,56 @@ public class TileEntityChest extends TileEntity implements IInventory {
}
}
- public void b(int i, int j) {
+ public boolean b(int i, int j) {
if (i == 1) {
this.h = j;
+ return true;
+ } else {
+ return super.b(i, j);
}
}
public void startOpen() {
+ if (this.h < 0) {
+ this.h = 0;
+ }
+
++this.h;
if (this.world == null) return; // CraftBukkit
- this.world.playNote(this.x, this.y, this.z, Block.CHEST.id, 1, this.h);
+ this.world.playNote(this.x, this.y, this.z, this.q().id, 1, this.h);
+ this.world.applyPhysics(this.x, this.y, this.z, this.q().id);
+ this.world.applyPhysics(this.x, this.y - 1, this.z, this.q().id);
}
- public void f() {
- --this.h;
- if (this.world == null) return; // CraftBukkit
- this.world.playNote(this.x, this.y, this.z, Block.CHEST.id, 1, this.h);
+ public void g() {
+ if (this.q() != null && this.q() instanceof BlockChest) {
+ --this.h;
+ if (this.world == null) return; // CraftBukkit
+ this.world.playNote(this.x, this.y, this.z, this.q().id, 1, this.h);
+ this.world.applyPhysics(this.x, this.y, this.z, this.q().id);
+ this.world.applyPhysics(this.x, this.y - 1, this.z, this.q().id);
+ }
+ }
+
+ public boolean b(int i, ItemStack itemstack) {
+ return true;
}
public void w_() {
super.w_();
- this.h();
this.i();
+ this.j();
+ }
+
+ public int l() {
+ if (this.r == -1) {
+ if (this.world == null || !(this.q() instanceof BlockChest)) {
+ return 0;
+ }
+
+ this.r = ((BlockChest) this.q()).a;
+ }
+
+ return this.r;
}
}
diff --git a/src/main/java/net/minecraft/server/TileEntityCommand.java b/src/main/java/net/minecraft/server/TileEntityCommand.java
index 4ff401b0..f05573d1 100644
--- a/src/main/java/net/minecraft/server/TileEntityCommand.java
+++ b/src/main/java/net/minecraft/server/TileEntityCommand.java
@@ -8,29 +8,35 @@ import com.google.common.base.Joiner;
public class TileEntityCommand extends TileEntity implements ICommandListener {
- private String a = "";
+ private int a = 0;
+ private String b = "";
+ private String c = "@";
+ // CraftBukkit start
private final org.bukkit.command.BlockCommandSender sender;
public TileEntityCommand() {
sender = new org.bukkit.craftbukkit.command.CraftBlockCommandSender(this);
}
+ // CraftBukkit end
public void b(String s) {
- this.a = s;
+ this.b = s;
this.update();
}
- public void a(World world) {
- if (!world.isStatic) {
+ public int a(World world) {
+ if (world.isStatic) {
+ return 0;
+ } else {
MinecraftServer minecraftserver = MinecraftServer.getServer();
if (minecraftserver != null && minecraftserver.getEnableCommandBlock()) {
// CraftBukkit start - handle command block as console
org.bukkit.command.SimpleCommandMap commandMap = minecraftserver.server.getCommandMap();
Joiner joiner = Joiner.on(" ");
- String command = this.a;
- if (this.a.startsWith("/")) {
- command = this.a.substring(1);
+ String command = this.b;
+ if (this.b.startsWith("/")) {
+ command = this.b.substring(1);
}
String[] args = command.split(" ");
ArrayList<String[]> commands = new ArrayList<String[]>();
@@ -39,17 +45,17 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
if (args[0].equalsIgnoreCase("stop") || args[0].equalsIgnoreCase("kick") || args[0].equalsIgnoreCase("op") ||
args[0].equalsIgnoreCase("deop") || args[0].equalsIgnoreCase("ban") || args[0].equalsIgnoreCase("ban-ip") ||
args[0].equalsIgnoreCase("pardon") || args[0].equalsIgnoreCase("pardon-ip") || args[0].equalsIgnoreCase("reload")) {
- return;
+ return 0;
}
// make sure this is a valid command
if (commandMap.getCommand(args[0]) == null) {
- return;
+ return 0;
}
// if the world has no players don't run
if (this.world.players.isEmpty()) {
- return;
+ return 0;
}
commands.add(args);
@@ -68,11 +74,22 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
}
}
+ int completed = 0;
+
// now dispatch all of the commands we ended up with
for (int i = 0; i < commands.size(); i++) {
- commandMap.dispatch(sender, joiner.join(Arrays.asList(commands.get(i))));
+ try {
+ if (commandMap.dispatch(sender, joiner.join(Arrays.asList(commands.get(i))))) {
+ completed++;
+ }
+ } catch (Throwable exception) {
+ minecraftserver.getLogger().warning(String.format("CommandBlock at (%d,%d,%d) failed to handle command", this.x, this.y, this.z), exception);
+ }
}
// CraftBukkit end
+ return completed;
+ } else {
+ return 0;
}
}
}
@@ -97,7 +114,11 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
// CraftBukkit end
public String getName() {
- return "@";
+ return this.c;
+ }
+
+ public void c(String s) {
+ this.c = s;
}
public void sendMessage(String s) {}
@@ -112,12 +133,18 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
- nbttagcompound.setString("Command", this.a);
+ nbttagcompound.setString("Command", this.b);
+ nbttagcompound.setInt("SuccessCount", this.a);
+ nbttagcompound.setString("CustomName", this.c);
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- this.a = nbttagcompound.getString("Command");
+ this.b = nbttagcompound.getString("Command");
+ this.a = nbttagcompound.getInt("SuccessCount");
+ if (nbttagcompound.hasKey("CustomName")) {
+ this.c = nbttagcompound.getString("CustomName");
+ }
}
public ChunkCoordinates b() {
@@ -130,4 +157,12 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
this.b(nbttagcompound);
return new Packet132TileEntityData(this.x, this.y, this.z, 2, nbttagcompound);
}
+
+ public int d() {
+ return this.a;
+ }
+
+ public void a(int i) {
+ this.a = i;
+ }
}
diff --git a/src/main/java/net/minecraft/server/TileEntityDispenser.java b/src/main/java/net/minecraft/server/TileEntityDispenser.java
index c0a69704..34767208 100644
--- a/src/main/java/net/minecraft/server/TileEntityDispenser.java
+++ b/src/main/java/net/minecraft/server/TileEntityDispenser.java
@@ -12,7 +12,8 @@ import org.bukkit.entity.HumanEntity;
public class TileEntityDispenser extends TileEntity implements IInventory {
private ItemStack[] items = new ItemStack[9];
- private Random b = new Random();
+ private Random c = new Random();
+ protected String a;
// CraftBukkit start
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
@@ -83,12 +84,12 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
}
}
- public int i() {
+ public int j() {
int i = -1;
int j = 1;
for (int k = 0; k < this.items.length; ++k) {
- if (this.items[k] != null && this.b.nextInt(j++) == 0) {
+ if (this.items[k] != null && this.c.nextInt(j++) == 0) {
if (this.items[k].count == 0) continue; // CraftBukkit
i = k;
}
@@ -109,7 +110,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
public int addItem(ItemStack itemstack) {
for (int i = 0; i < this.items.length; ++i) {
if (this.items[i] == null || this.items[i].id == 0) {
- this.items[i] = itemstack;
+ this.setItem(i, itemstack);
return i;
}
}
@@ -118,7 +119,15 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
}
public String getName() {
- return "container.dispenser";
+ return this.c() ? this.a : "container.dispenser";
+ }
+
+ public void a(String s) {
+ this.a = s;
+ }
+
+ public boolean c() {
+ return this.a != null;
}
public void a(NBTTagCompound nbttagcompound) {
@@ -135,6 +144,10 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
this.items[j] = ItemStack.createStack(nbttagcompound1);
}
}
+
+ if (nbttagcompound.hasKey("CustomName")) {
+ this.a = nbttagcompound.getString("CustomName");
+ }
}
public void b(NBTTagCompound nbttagcompound) {
@@ -152,17 +165,24 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
}
nbttagcompound.set("Items", nbttaglist);
+ if (this.c()) {
+ nbttagcompound.setString("CustomName", this.a);
+ }
}
public int getMaxStackSize() {
return maxStack; // CraftBukkit
}
- public boolean a_(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
}
public void startOpen() {}
- public void f() {}
+ public void g() {}
+
+ public boolean b(int i, ItemStack itemstack) {
+ return true;
+ }
}
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
index d9745ba8..b8f1d3e9 100644
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
@@ -10,12 +10,13 @@ import org.bukkit.event.inventory.FurnaceSmeltEvent;
import org.bukkit.craftbukkit.entity.CraftHumanEntity;
// CraftBukkit end
-public class TileEntityFurnace extends TileEntity implements IInventory {
+public class TileEntityFurnace extends TileEntity implements IWorldInventory {
private ItemStack[] items = new ItemStack[3];
public int burnTime = 0;
public int ticksForCurrentFuel = 0;
public int cookTime = 0;
+ private String e;
// CraftBukkit start
private int lastTick = (int) (System.currentTimeMillis() / 50);
@@ -93,7 +94,15 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
}
public String getName() {
- return "container.furnace";
+ return this.c() ? this.e : "container.furnace";
+ }
+
+ public boolean c() {
+ return this.e != null && this.e.length() > 0;
+ }
+
+ public void a(String s) {
+ this.e = s;
}
public void a(NBTTagCompound nbttagcompound) {
@@ -114,6 +123,9 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
this.burnTime = nbttagcompound.getShort("BurnTime");
this.cookTime = nbttagcompound.getShort("CookTime");
this.ticksForCurrentFuel = fuelTime(this.items[1]);
+ if (nbttagcompound.hasKey("CustomName")) {
+ this.e = nbttagcompound.getString("CustomName");
+ }
}
public void b(NBTTagCompound nbttagcompound) {
@@ -133,6 +145,9 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
}
nbttagcompound.set("Items", nbttaglist);
+ if (this.c()) {
+ nbttagcompound.setString("CustomName", this.e);
+ }
}
public int getMaxStackSize() {
@@ -143,7 +158,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
return this.burnTime > 0;
}
- public void g() {
+ public void h() {
boolean flag = this.burnTime > 0;
boolean flag1 = false;
@@ -189,7 +204,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
if (this.items[1] != null) {
--this.items[1].count;
if (this.items[1].count == 0) {
- Item item = this.items[1].getItem().r();
+ Item item = this.items[1].getItem().s();
this.items[1] = item != null ? new ItemStack(item) : null;
}
@@ -292,11 +307,23 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
return fuelTime(itemstack) > 0;
}
- public boolean a_(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
}
public void startOpen() {}
- public void f() {}
+ public void g() {}
+
+ public boolean b(int i, ItemStack itemstack) {
+ return i == 2 ? false : (i == 1 ? isFuel(itemstack) : true);
+ }
+
+ public int c(int i) {
+ return i == 0 ? 2 : (i == 1 ? 0 : 1);
+ }
+
+ public int d(int i) {
+ return 1;
+ }
}
diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java
new file mode 100644
index 00000000..c9ece0aa
--- /dev/null
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
@@ -0,0 +1,417 @@
+package net.minecraft.server;
+
+import java.util.List;
+
+// CraftBukkit start
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
+
+public class TileEntityHopper extends TileEntity implements IHopper {
+
+ private ItemStack[] a = new ItemStack[5];
+ private String b;
+ private int c = -1;
+
+ // CraftBukkit start
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ private int maxStack = MAX_STACK;
+
+ public ItemStack[] getContents() {
+ return this.a;
+ }
+
+ public void onOpen(CraftHumanEntity who) {
+ transaction.add(who);
+ }
+
+ public void onClose(CraftHumanEntity who) {
+ transaction.remove(who);
+ }
+
+ public List<HumanEntity> getViewers() {
+ return transaction;
+ }
+
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ }
+ // CraftBukkit end
+
+
+ public TileEntityHopper() {}
+
+ public void a(NBTTagCompound nbttagcompound) {
+ super.a(nbttagcompound);
+ NBTTagList nbttaglist = nbttagcompound.getList("Items");
+
+ this.a = new ItemStack[this.getSize()];
+ if (nbttagcompound.hasKey("CustomName")) {
+ this.b = nbttagcompound.getString("CustomName");
+ }
+
+ this.c = nbttagcompound.getInt("TransferCooldown");
+
+ for (int i = 0; i < nbttaglist.size(); ++i) {
+ NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
+ byte b0 = nbttagcompound1.getByte("Slot");
+
+ if (b0 >= 0 && b0 < this.a.length) {
+ this.a[b0] = ItemStack.createStack(nbttagcompound1);
+ }
+ }
+ }
+
+ public void b(NBTTagCompound nbttagcompound) {
+ super.b(nbttagcompound);
+ NBTTagList nbttaglist = new NBTTagList();
+
+ for (int i = 0; i < this.a.length; ++i) {
+ if (this.a[i] != null) {
+ NBTTagCompound nbttagcompound1 = new NBTTagCompound();
+
+ nbttagcompound1.setByte("Slot", (byte) i);
+ this.a[i].save(nbttagcompound1);
+ nbttaglist.add(nbttagcompound1);
+ }
+ }
+
+ nbttagcompound.set("Items", nbttaglist);
+ nbttagcompound.setInt("TransferCooldown", this.c);
+ if (this.c()) {
+ nbttagcompound.setString("CustomName", this.b);
+ }
+ }
+
+ public void update() {
+ super.update();
+ }
+
+ public int getSize() {
+ return this.a.length;
+ }
+
+ public ItemStack getItem(int i) {
+ return this.a[i];
+ }
+
+ public ItemStack splitStack(int i, int j) {
+ if (this.a[i] != null) {
+ ItemStack itemstack;
+
+ if (this.a[i].count <= j) {
+ itemstack = this.a[i];
+ this.a[i] = null;
+ return itemstack;
+ } else {
+ itemstack = this.a[i].a(j);
+ if (this.a[i].count == 0) {
+ this.a[i] = null;
+ }
+
+ return itemstack;
+ }
+ } else {
+ return null;
+ }
+ }
+
+ public ItemStack splitWithoutUpdate(int i) {
+ if (this.a[i] != null) {
+ ItemStack itemstack = this.a[i];
+
+ this.a[i] = null;
+ return itemstack;
+ } else {
+ return null;
+ }
+ }
+
+ public void setItem(int i, ItemStack itemstack) {
+ this.a[i] = itemstack;
+ if (itemstack != null && itemstack.count > this.getMaxStackSize()) {
+ itemstack.count = this.getMaxStackSize();
+ }
+ }
+
+ public String getName() {
+ return this.c() ? this.b : "container.hopper";
+ }
+
+ public boolean c() {
+ return this.b != null && this.b.length() > 0;
+ }
+
+ public void a(String s) {
+ this.b = s;
+ }
+
+ public int getMaxStackSize() {
+ return 64;
+ }
+
+ public boolean a(EntityHuman entityhuman) {
+ return this.world.getTileEntity(this.x, this.y, this.z) != this ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
+ }
+
+ public void startOpen() {}
+
+ public void g() {}
+
+ public boolean b(int i, ItemStack itemstack) {
+ return true;
+ }
+
+ public void h() {
+ if (this.world != null && !this.world.isStatic) {
+ --this.c;
+ if (!this.l()) {
+ this.c(0);
+ this.j();
+ }
+ }
+ }
+
+ public boolean j() {
+ if (this.world != null && !this.world.isStatic) {
+ if (!this.l() && BlockHopper.d(this.p())) {
+ boolean flag = this.u() | a((IHopper) this);
+
+ if (flag) {
+ this.c(8);
+ this.update();
+ return true;
+ }
+ }
+
+ return false;
+ } else {
+ return false;
+ }
+ }
+
+ private boolean u() {
+ int i = a(this, -1);
+ boolean flag = false;
+
+ if (i > -1) {
+ IInventory iinventory = this.v();
+
+ if (iinventory != null) {
+ ItemStack itemstack = this.getItem(i).cloneItemStack();
+ ItemStack itemstack1 = a(iinventory, this.splitStack(i, 1), Facing.OPPOSITE_FACING[BlockHopper.c(this.p())]);
+
+ if (itemstack1 != null && itemstack1.count != 0) {
+ this.setItem(i, itemstack);
+ } else {
+ flag |= true;
+ iinventory.update();
+ }
+ }
+ }
+
+ return flag;
+ }
+
+ public static boolean a(IHopper ihopper) {
+ boolean flag = false;
+ IInventory iinventory = b(ihopper);
+
+ if (iinventory != null) {
+ byte b0 = 0;
+ int i = 0;
+ int j = iinventory.getSize();
+
+ if (iinventory instanceof IWorldInventory && b0 > -1) {
+ IWorldInventory iworldinventory = (IWorldInventory) iinventory;
+
+ i = iworldinventory.c(b0);
+ j = Math.min(j, i + iworldinventory.d(b0));
+ }
+
+ for (int k = i; k < j && !flag; ++k) {
+ ItemStack itemstack = iinventory.getItem(k);
+
+ if (itemstack != null) {
+ ItemStack itemstack1 = itemstack.cloneItemStack();
+ ItemStack itemstack2 = a(ihopper, iinventory.splitStack(k, 1), -1);
+
+ if (itemstack2 != null && itemstack2.count != 0) {
+ iinventory.setItem(k, itemstack1);
+ } else {
+ flag |= true;
+ iinventory.update();
+ }
+ }
+ }
+ } else {
+ EntityItem entityitem = a(ihopper.getWorld(), ihopper.aA(), ihopper.aB() + 1.0D, ihopper.aC());
+
+ if (entityitem != null) {
+ flag |= a((IInventory) ihopper, entityitem);
+ }
+ }
+
+ return flag;
+ }
+
+ public static boolean a(IInventory iinventory, EntityItem entityitem) {
+ boolean flag = false;
+
+ if (entityitem == null) {
+ return false;
+ } else {
+ ItemStack itemstack = entityitem.getItemStack().cloneItemStack();
+ ItemStack itemstack1 = a(iinventory, itemstack, -1);
+
+ if (itemstack1 != null && itemstack1.count != 0) {
+ entityitem.setItemStack(itemstack1);
+ } else {
+ flag = true;
+ entityitem.die();
+ }
+
+ return flag;
+ }
+ }
+
+ public static int a(IInventory iinventory, int i) {
+ int j = 0;
+ int k = iinventory.getSize();
+
+ if (iinventory instanceof IWorldInventory && i > -1) {
+ IWorldInventory iworldinventory = (IWorldInventory) iinventory;
+
+ j = iworldinventory.c(i);
+ k = Math.min(k, j + iworldinventory.d(i));
+ }
+
+ for (int l = j; l < k; ++l) {
+ if (iinventory.getItem(l) != null) {
+ return l;
+ }
+ }
+
+ return -1;
+ }
+
+ public static ItemStack a(IInventory iinventory, ItemStack itemstack, int i) {
+ int j = 0;
+ int k = iinventory.getSize();
+
+ if (iinventory instanceof IWorldInventory && i > -1) {
+ IWorldInventory iworldinventory = (IWorldInventory) iinventory;
+
+ j = iworldinventory.c(i);
+ k = Math.min(k, j + iworldinventory.d(i));
+ }
+
+ for (int l = j; l < k && itemstack != null && itemstack.count > 0; ++l) {
+ ItemStack itemstack1 = iinventory.getItem(l);
+
+ if (iinventory.b(l, itemstack)) {
+ boolean flag = false;
+
+ if (itemstack1 == null) {
+ iinventory.setItem(l, itemstack);
+ itemstack = null;
+ flag = true;
+ } else if (a(itemstack1, itemstack)) {
+ int i1 = itemstack.getMaxStackSize() - itemstack1.count;
+ int j1 = Math.min(itemstack.count, i1);
+
+ itemstack.count -= j1;
+ itemstack1.count += j1;
+ flag = j1 > 0;
+ }
+
+ if (flag) {
+ if (iinventory instanceof TileEntityHopper) {
+ ((TileEntityHopper) iinventory).c(8);
+ }
+
+ iinventory.update();
+ }
+ }
+ }
+
+ if (itemstack != null && itemstack.count == 0) {
+ itemstack = null;
+ }
+
+ return itemstack;
+ }
+
+ private IInventory v() {
+ int i = BlockHopper.c(this.p());
+
+ return b(this.getWorld(), (double) (this.x + Facing.b[i]), (double) (this.y + Facing.c[i]), (double) (this.z + Facing.d[i]));
+ }
+
+ public static IInventory b(IHopper ihopper) {
+ return b(ihopper.getWorld(), ihopper.aA(), ihopper.aB() + 1.0D, ihopper.aC());
+ }
+
+ public static EntityItem a(World world, double d0, double d1, double d2) {
+ List list = world.a(EntityItem.class, AxisAlignedBB.a().a(d0, d1, d2, d0 + 1.0D, d1 + 1.0D, d2 + 1.0D), IEntitySelector.a);
+
+ return list.size() > 0 ? (EntityItem) list.get(0) : null;
+ }
+
+ public static IInventory b(World world, double d0, double d1, double d2) {
+ IInventory iinventory = null;
+ int i = MathHelper.floor(d0);
+ int j = MathHelper.floor(d1);
+ int k = MathHelper.floor(d2);
+
+ if (iinventory == null) {
+ TileEntity tileentity = world.getTileEntity(i, j, k);
+
+ if (tileentity != null && tileentity instanceof IInventory) {
+ iinventory = (IInventory) tileentity;
+ if (iinventory instanceof TileEntityChest) {
+ int l = world.getTypeId(i, j, k);
+ Block block = Block.byId[l];
+
+ if (block instanceof BlockChest) {
+ iinventory = ((BlockChest) block).g_(world, i, j, k);
+ }
+ }
+ }
+ }
+
+ if (iinventory == null) {
+ List list = world.getEntities((Entity) null, AxisAlignedBB.a().a(d0, d1, d2, d0 + 1.0D, d1 + 1.0D, d2 + 1.0D), IEntitySelector.b);
+
+ if (list != null && list.size() > 0) {
+ iinventory = (IInventory) list.get(world.random.nextInt(list.size()));
+ }
+ }
+
+ return iinventory;
+ }
+
+ private static boolean a(ItemStack itemstack, ItemStack itemstack1) {
+ return itemstack.id != itemstack1.id ? false : (itemstack.getData() != itemstack1.getData() ? false : (itemstack.count > itemstack.getMaxStackSize() ? false : ItemStack.equals(itemstack, itemstack1)));
+ }
+
+ public double aA() {
+ return (double) this.x;
+ }
+
+ public double aB() {
+ return (double) this.y;
+ }
+
+ public double aC() {
+ return (double) this.z;
+ }
+
+ public void c(int i) {
+ this.c = i;
+ }
+
+ public boolean l() {
+ return this.c > 0;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
deleted file mode 100644
index e415b6a7..00000000
--- a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java
+++ /dev/null
@@ -1,233 +0,0 @@
-package net.minecraft.server;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-public class TileEntityMobSpawner extends TileEntity {
-
- public int spawnDelay = -1;
- public String mobName = "Pig"; // CraftBukkit - private -> public
- private List mobs = null;
- private TileEntityMobSpawnerData spawnData = null;
- public double b;
- public double c = 0.0D;
- private int minSpawnDelay = 200;
- private int maxSpawnDelay = 800;
- private int spawnCount = 4;
- private Entity j;
- private int maxNearbyEntities = 6;
- private int requiredPlayerRange = 16;
- private int spawnRange = 4;
-
- public TileEntityMobSpawner() {
- this.spawnDelay = 20;
- }
-
- public String getMobName() {
- return this.spawnData == null ? this.mobName : this.spawnData.c;
- }
-
- public void a(String s) {
- this.mobName = s;
- }
-
- public boolean b() {
- return this.world.findNearbyPlayer((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D, (double) this.requiredPlayerRange) != null;
- }
-
- public void g() {
- if (this.b()) {
- double d0;
-
- if (this.world.isStatic) {
- double d1 = (double) ((float) this.x + this.world.random.nextFloat());
- double d2 = (double) ((float) this.y + this.world.random.nextFloat());
-
- d0 = (double) ((float) this.z + this.world.random.nextFloat());
- this.world.addParticle("smoke", d1, d2, d0, 0.0D, 0.0D, 0.0D);
- this.world.addParticle("flame", d1, d2, d0, 0.0D, 0.0D, 0.0D);
- if (this.spawnDelay > 0) {
- --this.spawnDelay;
- }
-
- this.c = this.b;
- this.b = (this.b + (double) (1000.0F / ((float) this.spawnDelay + 200.0F))) % 360.0D;
- } else {
- if (this.spawnDelay == -1) {
- this.e();
- }
-
- if (this.spawnDelay > 0) {
- --this.spawnDelay;
- return;
- }
-
- boolean flag = false;
-
- for (int i = 0; i < this.spawnCount; ++i) {
- Entity entity = EntityTypes.createEntityByName(this.getMobName(), this.world);
-
- if (entity == null) {
- return;
- }
-
- int j = this.world.a(entity.getClass(), AxisAlignedBB.a().a((double) this.x, (double) this.y, (double) this.z, (double) (this.x + 1), (double) (this.y + 1), (double) (this.z + 1)).grow((double) (this.spawnRange * 2), 4.0D, (double) (this.spawnRange * 2))).size();
-
- if (j >= this.maxNearbyEntities) {
- this.e();
- return;
- }
-
- if (entity != null) {
- d0 = (double) this.x + (this.world.random.nextDouble() - this.world.random.nextDouble()) * (double) this.spawnRange;
- double d3 = (double) (this.y + this.world.random.nextInt(3) - 1);
- double d4 = (double) this.z + (this.world.random.nextDouble() - this.world.random.nextDouble()) * (double) this.spawnRange;
- EntityLiving entityliving = entity instanceof EntityLiving ? (EntityLiving) entity : null;
-
- entity.setPositionRotation(d0, d3, d4, this.world.random.nextFloat() * 360.0F, 0.0F);
- if (entityliving == null || entityliving.canSpawn()) {
- this.a(entity);
- this.world.addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
- this.world.triggerEffect(2004, this.x, this.y, this.z, 0);
- if (entityliving != null) {
- entityliving.aR();
- }
-
- flag = true;
- }
- }
- }
-
- if (flag) {
- this.e();
- }
- }
-
- super.g();
- }
- }
-
- public void a(Entity entity) {
- if (this.spawnData != null) {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
-
- entity.c(nbttagcompound);
- Iterator iterator = this.spawnData.b.c().iterator();
-
- while (iterator.hasNext()) {
- NBTBase nbtbase = (NBTBase) iterator.next();
-
- nbttagcompound.set(nbtbase.getName(), nbtbase.clone());
- }
-
- entity.e(nbttagcompound);
- } else if (entity instanceof EntityLiving && entity.world != null) {
- ((EntityLiving) entity).bG();
- }
- }
-
- private void e() {
- if (this.maxSpawnDelay <= this.minSpawnDelay) {
- this.spawnDelay = this.minSpawnDelay;
- } else {
- this.spawnDelay = this.minSpawnDelay + this.world.random.nextInt(this.maxSpawnDelay - this.minSpawnDelay);
- }
-
- if (this.mobs != null && this.mobs.size() > 0) {
- this.spawnData = (TileEntityMobSpawnerData) WeightedRandom.a(this.world.random, (Collection) this.mobs);
- this.world.notify(this.x, this.y, this.z);
- }
-
- this.world.playNote(this.x, this.y, this.z, this.q().id, 1, 0);
- }
-
- public void a(NBTTagCompound nbttagcompound) {
- super.a(nbttagcompound);
- this.mobName = nbttagcompound.getString("EntityId");
- this.spawnDelay = nbttagcompound.getShort("Delay");
- if (nbttagcompound.hasKey("SpawnPotentials")) {
- this.mobs = new ArrayList();
- NBTTagList nbttaglist = nbttagcompound.getList("SpawnPotentials");
-
- for (int i = 0; i < nbttaglist.size(); ++i) {
- this.mobs.add(new TileEntityMobSpawnerData(this, (NBTTagCompound) nbttaglist.get(i)));
- }
- } else {
- this.mobs = null;
- }
-
- if (nbttagcompound.hasKey("SpawnData")) {
- this.spawnData = new TileEntityMobSpawnerData(this, nbttagcompound.getCompound("SpawnData"), this.mobName);
- } else {
- this.spawnData = null;
- }
-
- if (nbttagcompound.hasKey("MinSpawnDelay")) {
- this.minSpawnDelay = nbttagcompound.getShort("MinSpawnDelay");
- this.maxSpawnDelay = nbttagcompound.getShort("MaxSpawnDelay");
- this.spawnCount = nbttagcompound.getShort("SpawnCount");
- }
-
- if (nbttagcompound.hasKey("MaxNearbyEntities")) {
- this.maxNearbyEntities = nbttagcompound.getShort("MaxNearbyEntities");
- this.requiredPlayerRange = nbttagcompound.getShort("RequiredPlayerRange");
- }
-
- if (nbttagcompound.hasKey("SpawnRange")) {
- this.spawnRange = nbttagcompound.getShort("SpawnRange");
- }
-
- if (this.world != null && this.world.isStatic) {
- this.j = null;
- }
- }
-
- public void b(NBTTagCompound nbttagcompound) {
- super.b(nbttagcompound);
- nbttagcompound.setString("EntityId", this.getMobName());
- nbttagcompound.setShort("Delay", (short) this.spawnDelay);
- nbttagcompound.setShort("MinSpawnDelay", (short) this.minSpawnDelay);
- nbttagcompound.setShort("MaxSpawnDelay", (short) this.maxSpawnDelay);
- nbttagcompound.setShort("SpawnCount", (short) this.spawnCount);
- nbttagcompound.setShort("MaxNearbyEntities", (short) this.maxNearbyEntities);
- nbttagcompound.setShort("RequiredPlayerRange", (short) this.requiredPlayerRange);
- nbttagcompound.setShort("SpawnRange", (short) this.spawnRange);
- if (this.spawnData != null) {
- nbttagcompound.setCompound("SpawnData", (NBTTagCompound) this.spawnData.b.clone());
- }
-
- if (this.spawnData != null || this.mobs != null && this.mobs.size() > 0) {
- NBTTagList nbttaglist = new NBTTagList();
-
- if (this.mobs != null && this.mobs.size() > 0) {
- Iterator iterator = this.mobs.iterator();
-
- while (iterator.hasNext()) {
- TileEntityMobSpawnerData tileentitymobspawnerdata = (TileEntityMobSpawnerData) iterator.next();
-
- nbttaglist.add(tileentitymobspawnerdata.a());
- }
- } else {
- nbttaglist.add(this.spawnData.a());
- }
-
- nbttagcompound.set("SpawnPotentials", nbttaglist);
- }
- }
-
- public Packet getUpdatePacket() {
- NBTTagCompound nbttagcompound = new NBTTagCompound();
-
- this.b(nbttagcompound);
- nbttagcompound.remove("SpawnPotentials");
- return new Packet132TileEntityData(this.x, this.y, this.z, 1, nbttagcompound);
- }
-
- public void b(int i, int j) {
- if (i == 1 && this.world.isStatic) {
- this.spawnDelay = this.minSpawnDelay;
- }
- }
-}
diff --git a/src/main/java/net/minecraft/server/TileEntityPiston.java b/src/main/java/net/minecraft/server/TileEntityPiston.java
index becd33ec..74d9c5d3 100644
--- a/src/main/java/net/minecraft/server/TileEntityPiston.java
+++ b/src/main/java/net/minecraft/server/TileEntityPiston.java
@@ -79,24 +79,26 @@ public class TileEntityPiston extends TileEntity {
public void f() {
if (this.g < 1.0F && this.world != null) {
this.g = this.f = 1.0F;
- this.world.r(this.x, this.y, this.z);
+ this.world.s(this.x, this.y, this.z);
this.w_();
if (this.world.getTypeId(this.x, this.y, this.z) == Block.PISTON_MOVING.id) {
- this.world.setTypeIdAndData(this.x, this.y, this.z, this.a, this.b);
+ this.world.setTypeIdAndData(this.x, this.y, this.z, this.a, this.b, 3);
+ this.world.g(this.x, this.y, this.z, this.a);
}
}
}
- public void g() {
+ public void h() {
if (this.world == null) return; // CraftBukkit
this.g = this.f;
if (this.g >= 1.0F) {
this.a(1.0F, 0.25F);
- this.world.r(this.x, this.y, this.z);
+ this.world.s(this.x, this.y, this.z);
this.w_();
if (this.world.getTypeId(this.x, this.y, this.z) == Block.PISTON_MOVING.id) {
- this.world.setTypeIdAndData(this.x, this.y, this.z, this.a, this.b);
+ this.world.setTypeIdAndData(this.x, this.y, this.z, this.a, this.b, 3);
+ this.world.g(this.x, this.y, this.z, this.a);
}
} else {
this.f += 0.5F;
diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java
index c8822ce9..5e9336bc 100644
--- a/src/main/java/net/minecraft/server/Village.java
+++ b/src/main/java/net/minecraft/server/Village.java
@@ -72,7 +72,7 @@ public class Village {
}
private boolean b(int i, int j, int k, int l, int i1, int j1) {
- if (!this.world.v(i, j - 1, k)) {
+ if (!this.world.w(i, j - 1, k)) {
return false;
} else {
int k1 = i - l / 2;
@@ -81,7 +81,7 @@ public class Village {
for (int i2 = k1; i2 < k1 + l; ++i2) {
for (int j2 = j; j2 < j + i1; ++j2) {
for (int k2 = l1; k2 < l1 + j1; ++k2) {
- if (this.world.t(i2, j2, k2)) {
+ if (this.world.u(i2, j2, k2)) {
return false;
}
}
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
index b3e9687e..2deb8161 100644
--- a/src/main/java/net/minecraft/server/VillageSiege.java
+++ b/src/main/java/net/minecraft/server/VillageSiege.java
@@ -139,7 +139,7 @@ public class VillageSiege {
try {
entityzombie = new EntityZombie(this.world);
- entityzombie.bG();
+ entityzombie.bJ();
entityzombie.setVillager(false);
} catch (Exception exception) {
exception.printStackTrace();
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index c3dc4a4e..9c398156 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -44,12 +44,12 @@ public abstract class World implements IBlockAccess {
protected float o;
protected float p;
public int q = 0;
- public boolean suppressPhysics = false;
+ // public boolean suppressPhysics = false; // CraftBukkit (removed in vanilla)
public boolean callingPlaceEvent = false; // CraftBukkit
public int difficulty;
public Random random = new Random();
public WorldProvider worldProvider; // CraftBukkit - remove final
- protected List v = new ArrayList();
+ protected List u = new ArrayList();
public IChunkProvider chunkProvider; // CraftBukkit - protected -> public
protected final IDataManager dataManager;
public WorldData worldData; // CraftBukkit - protected -> public
@@ -60,8 +60,10 @@ public abstract class World implements IBlockAccess {
public final MethodProfiler methodProfiler;
private final Vec3DPool J = new Vec3DPool(300, 2000);
private final Calendar K = Calendar.getInstance();
- private UnsafeList L = new UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList
- private boolean M;
+ protected Scoreboard scoreboard = new Scoreboard();
+ private final IConsoleLogManager logAgent;
+ private UnsafeList M = new UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList
+ private boolean N;
// CraftBukkit start - public, longhashset
public boolean allowMonsters = true;
public boolean allowAnimals = true;
@@ -69,9 +71,8 @@ public abstract class World implements IBlockAccess {
public long ticksPerAnimalSpawns;
public long ticksPerMonsterSpawns;
// CraftBukkit end
- private int N;
+ private int O;
int[] H;
- private List O;
public boolean isStatic;
public BiomeBase getBiome(int i, int j) {
@@ -109,20 +110,20 @@ public abstract class World implements IBlockAccess {
}
// Changed signature
- public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, ChunkGenerator gen, org.bukkit.World.Environment env) {
+ public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, IConsoleLogManager iconsolelogmanager, ChunkGenerator gen, org.bukkit.World.Environment env) {
this.generator = gen;
this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
// CraftBukkit end
- this.N = this.random.nextInt(12000);
+ this.O = this.random.nextInt(12000);
this.H = new int['\u8000'];
- this.O = new UnsafeList(); // CraftBukkit - ArrayList -> UnsafeList
this.isStatic = false;
this.dataManager = idatamanager;
this.methodProfiler = methodprofiler;
this.worldMaps = new WorldMapCollection(idatamanager);
+ this.logAgent = iconsolelogmanager;
this.worldData = idatamanager.getWorldData();
if (worldprovider != null) {
this.worldProvider = worldprovider;
@@ -168,7 +169,7 @@ public abstract class World implements IBlockAccess {
this.villages.a(this);
}
- this.x();
+ this.y();
this.a();
this.getServer().addWorld(this.world); // CraftBukkit
@@ -216,10 +217,6 @@ public abstract class World implements IBlockAccess {
}
}
- public int b(int i, int j, int k) {
- return i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000 ? (j < 0 ? 0 : (j >= 256 ? 0 : this.getChunkAt(i >> 4, k >> 4).b(i & 15, j, k & 15))) : 0;
- }
-
public boolean isEmpty(int i, int j, int k) {
return this.getTypeId(i, j, k) == 0;
}
@@ -227,7 +224,7 @@ public abstract class World implements IBlockAccess {
public boolean isTileEntity(int i, int j, int k) {
int l = this.getTypeId(i, j, k);
- return Block.byId[l] != null && Block.byId[l].u();
+ return Block.byId[l] != null && Block.byId[l].t();
}
public int e(int i, int j, int k) {
@@ -241,10 +238,10 @@ public abstract class World implements IBlockAccess {
}
public boolean areChunksLoaded(int i, int j, int k, int l) {
- return this.d(i - l, j - l, k - l, i + l, j + l, k + l);
+ return this.e(i - l, j - l, k - l, i + l, j + l, k + l);
}
- public boolean d(int i, int j, int k, int l, int i1, int j1) {
+ public boolean e(int i, int j, int k, int l, int i1, int j1) {
if (i1 >= 0 && j < 256) {
i >>= 4;
k >>= 4;
@@ -289,11 +286,7 @@ public abstract class World implements IBlockAccess {
}
// CraftBukkit end
- public boolean setRawTypeIdAndData(int i, int j, int k, int l, int i1) {
- return this.setRawTypeIdAndData(i, j, k, l, i1, true);
- }
-
- public boolean setRawTypeIdAndData(int i, int j, int k, int l, int i1, boolean flag) {
+ public boolean setTypeIdAndData(int i, int j, int k, int l, int i1, int j1) {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
if (j < 0) {
return false;
@@ -301,37 +294,30 @@ public abstract class World implements IBlockAccess {
return false;
} else {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
- boolean flag1 = chunk.a(i & 15, j, k & 15, l, i1);
+ int k1 = 0;
- this.methodProfiler.a("checkLight");
- this.z(i, j, k);
- this.methodProfiler.b();
- if (flag && flag1 && (this.isStatic || chunk.seenByPlayer)) {
- this.notify(i, j, k);
+ if ((j1 & 1) != 0) {
+ k1 = chunk.getTypeId(i & 15, j, k & 15);
}
- return flag1;
- }
- } else {
- return false;
- }
- }
-
- public boolean setRawTypeId(int i, int j, int k, int l) {
- if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
- if (j < 0) {
- return false;
- } else if (j >= 256) {
- return false;
- } else {
- Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
- boolean flag = chunk.a(i & 15, j, k & 15, l);
+ boolean flag = chunk.a(i & 15, j, k & 15, l, i1);
this.methodProfiler.a("checkLight");
- this.z(i, j, k);
+ this.A(i, j, k);
this.methodProfiler.b();
- if (flag && (this.isStatic || chunk.seenByPlayer)) {
- this.notify(i, j, k);
+ if (flag) {
+ if ((j1 & 2) != 0 && (!this.isStatic || (j1 & 4) == 0)) {
+ this.notify(i, j, k);
+ }
+
+ if (!this.isStatic && (j1 & 1) != 0) {
+ this.update(i, j, k, k1);
+ Block block = Block.byId[l];
+
+ if (block != null && block.q_()) {
+ this.m(i, j, k, l);
+ }
+ }
}
return flag;
@@ -365,13 +351,7 @@ public abstract class World implements IBlockAccess {
}
}
- public void setData(int i, int j, int k, int l) {
- if (this.setRawData(i, j, k, l)) {
- this.update(i, j, k, this.getTypeId(i, j, k));
- }
- }
-
- public boolean setRawData(int i, int j, int k, int l) {
+ public boolean setData(int i, int j, int k, int l, int i1) {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
if (j < 0) {
return false;
@@ -379,12 +359,25 @@ public abstract class World implements IBlockAccess {
return false;
} else {
Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
- int i1 = i & 15;
- int j1 = k & 15;
- boolean flag = chunk.b(i1, j, j1, l);
+ int j1 = i & 15;
+ int k1 = k & 15;
+ boolean flag = chunk.b(j1, j, k1, l);
+
+ if (flag) {
+ int l1 = chunk.getTypeId(j1, j, k1);
- if (flag && (this.isStatic || chunk.seenByPlayer && Block.u[chunk.getTypeId(i1, j, j1) & 4095])) {
- this.notify(i, j, k);
+ if ((i1 & 2) != 0 && (!this.isStatic || (i1 & 4) == 0)) {
+ this.notify(i, j, k);
+ }
+
+ if (!this.isStatic && (i1 & 1) != 0) {
+ this.update(i, j, k, l1);
+ Block block = Block.byId[l1];
+
+ if (block != null && block.q_()) {
+ this.m(i, j, k, l1);
+ }
+ }
}
return flag;
@@ -394,27 +387,34 @@ public abstract class World implements IBlockAccess {
}
}
- public boolean setTypeId(int i, int j, int k, int l) {
- if (this.setRawTypeId(i, j, k, l)) {
- this.update(i, j, k, l);
- return true;
- } else {
- return false;
- }
+ public boolean setAir(int i, int j, int k) {
+ return this.setTypeIdAndData(i, j, k, 0, 0, 3);
}
- public boolean setTypeIdAndData(int i, int j, int k, int l, int i1) {
- if (this.setRawTypeIdAndData(i, j, k, l, i1)) {
- this.update(i, j, k, l);
- return true;
+ public boolean setAir(int i, int j, int k, boolean flag) {
+ int l = this.getTypeId(i, j, k);
+
+ if (l > 0) {
+ int i1 = this.getData(i, j, k);
+
+ this.triggerEffect(2001, i, j, k, l + (i1 << 12));
+ if (flag) {
+ Block.byId[l].c(this, i, j, k, i1, 0);
+ }
+
+ return this.setTypeIdAndData(i, j, k, 0, 0, 3);
} else {
return false;
}
}
+ public boolean setTypeIdUpdate(int i, int j, int k, int l) {
+ return this.setTypeIdAndData(i, j, k, l, 0, 3);
+ }
+
public void notify(int i, int j, int k) {
- for (int l = 0; l < this.v.size(); ++l) {
- ((IWorldAccess) this.v.get(l)).a(i, j, k);
+ for (int l = 0; l < this.u.size(); ++l) {
+ ((IWorldAccess) this.u.get(l)).a(i, j, k);
}
}
@@ -422,7 +422,7 @@ public abstract class World implements IBlockAccess {
this.applyPhysics(i, j, k, l);
}
- public void g(int i, int j, int k, int l) {
+ public void e(int i, int j, int k, int l) {
int i1;
if (k > l) {
@@ -437,32 +437,52 @@ public abstract class World implements IBlockAccess {
}
}
- this.e(i, k, j, i, l, j);
+ this.g(i, k, j, i, l, j);
}
- public void j(int i, int j, int k) {
- for (int l = 0; l < this.v.size(); ++l) {
- ((IWorldAccess) this.v.get(l)).a(i, j, k, i, j, k);
+ public void g(int i, int j, int k, int l, int i1, int j1) {
+ for (int k1 = 0; k1 < this.u.size(); ++k1) {
+ ((IWorldAccess) this.u.get(k1)).a(i, j, k, l, i1, j1);
}
}
- public void e(int i, int j, int k, int l, int i1, int j1) {
- for (int k1 = 0; k1 < this.v.size(); ++k1) {
- ((IWorldAccess) this.v.get(k1)).a(i, j, k, l, i1, j1);
- }
+ public void applyPhysics(int i, int j, int k, int l) {
+ this.g(i - 1, j, k, l);
+ this.g(i + 1, j, k, l);
+ this.g(i, j - 1, k, l);
+ this.g(i, j + 1, k, l);
+ this.g(i, j, k - 1, l);
+ this.g(i, j, k + 1, l);
}
- public void applyPhysics(int i, int j, int k, int l) {
- this.m(i - 1, j, k, l);
- this.m(i + 1, j, k, l);
- this.m(i, j - 1, k, l);
- this.m(i, j + 1, k, l);
- this.m(i, j, k - 1, l);
- this.m(i, j, k + 1, l);
+ public void c(int i, int j, int k, int l, int i1) {
+ if (i1 != 4) {
+ this.g(i - 1, j, k, l);
+ }
+
+ if (i1 != 5) {
+ this.g(i + 1, j, k, l);
+ }
+
+ if (i1 != 0) {
+ this.g(i, j - 1, k, l);
+ }
+
+ if (i1 != 1) {
+ this.g(i, j + 1, k, l);
+ }
+
+ if (i1 != 2) {
+ this.g(i, j, k - 1, l);
+ }
+
+ if (i1 != 3) {
+ this.g(i, j, k + 1, l);
+ }
}
- private void m(int i, int j, int k, int l) {
- if (!this.suppressPhysics && !this.isStatic) {
+ public void g(int i, int j, int k, int l) {
+ if (!this.isStatic) {
int i1 = this.getTypeId(i, j, k);
Block block = Block.byId[i1];
@@ -501,11 +521,15 @@ public abstract class World implements IBlockAccess {
}
}
- public boolean k(int i, int j, int k) {
+ public boolean a(int i, int j, int k, int l) {
+ return false;
+ }
+
+ public boolean l(int i, int j, int k) {
return this.getChunkAt(i >> 4, k >> 4).d(i & 15, j, k & 15);
}
- public int l(int i, int j, int k) {
+ public int m(int i, int j, int k) {
if (j < 0) {
return 0;
} else {
@@ -518,20 +542,20 @@ public abstract class World implements IBlockAccess {
}
public int getLightLevel(int i, int j, int k) {
- return this.a(i, j, k, true);
+ return this.b(i, j, k, true);
}
- public int a(int i, int j, int k, boolean flag) {
+ public int b(int i, int j, int k, boolean flag) {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
if (flag) {
int l = this.getTypeId(i, j, k);
- if (l == Block.STEP.id || l == Block.WOOD_STEP.id || l == Block.SOIL.id || l == Block.COBBLESTONE_STAIRS.id || l == Block.WOOD_STAIRS.id) {
- int i1 = this.a(i, j + 1, k, false);
- int j1 = this.a(i + 1, j, k, false);
- int k1 = this.a(i - 1, j, k, false);
- int l1 = this.a(i, j, k + 1, false);
- int i2 = this.a(i, j, k - 1, false);
+ if (Block.w[l]) {
+ int i1 = this.b(i, j + 1, k, false);
+ int j1 = this.b(i + 1, j, k, false);
+ int k1 = this.b(i - 1, j, k, false);
+ int l1 = this.b(i, j, k + 1, false);
+ int i2 = this.b(i, j, k - 1, false);
if (j1 > i1) {
i1 = j1;
@@ -633,8 +657,8 @@ public abstract class World implements IBlockAccess {
chunk.a(enumskyblock, i & 15, j, k & 15, l);
- for (int i1 = 0; i1 < this.v.size(); ++i1) {
- ((IWorldAccess) this.v.get(i1)).b(i, j, k);
+ for (int i1 = 0; i1 < this.u.size(); ++i1) {
+ ((IWorldAccess) this.u.get(i1)).b(i, j, k);
}
}
}
@@ -642,13 +666,13 @@ public abstract class World implements IBlockAccess {
}
}
- public void o(int i, int j, int k) {
- for (int l = 0; l < this.v.size(); ++l) {
- ((IWorldAccess) this.v.get(l)).b(i, j, k);
+ public void p(int i, int j, int k) {
+ for (int l = 0; l < this.u.size(); ++l) {
+ ((IWorldAccess) this.u.get(l)).b(i, j, k);
}
}
- public float p(int i, int j, int k) {
+ public float q(int i, int j, int k) {
return this.worldProvider.g[this.getLightLevel(i, j, k)];
}
@@ -677,7 +701,7 @@ public abstract class World implements IBlockAccess {
int l1 = this.getData(l, i1, j1);
Block block = Block.byId[k1];
- if ((!flag1 || block == null || block.e(this, l, i1, j1) != null) && k1 > 0 && block.a(l1, flag)) {
+ if ((!flag1 || block == null || block.b(this, l, i1, j1) != null) && k1 > 0 && block.a(l1, flag)) {
MovingObjectPosition movingobjectposition = block.a(this, l, i1, j1, vec3d, vec3d1);
if (movingobjectposition != null) {
@@ -805,7 +829,7 @@ public abstract class World implements IBlockAccess {
int j2 = this.getData(l, i1, j1);
Block block1 = Block.byId[i2];
- if ((!flag1 || block1 == null || block1.e(this, l, i1, j1) != null) && i2 > 0 && block1.a(j2, flag)) {
+ if ((!flag1 || block1 == null || block1.b(this, l, i1, j1) != null) && i2 > 0 && block1.a(j2, flag)) {
MovingObjectPosition movingobjectposition1 = block1.a(this, l, i1, j1, vec3d, vec3d1);
if (movingobjectposition1 != null) {
@@ -827,24 +851,24 @@ public abstract class World implements IBlockAccess {
public void makeSound(Entity entity, String s, float f, float f1) {
if (entity != null && s != null) {
- for (int i = 0; i < this.v.size(); ++i) {
- ((IWorldAccess) this.v.get(i)).a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1);
+ for (int i = 0; i < this.u.size(); ++i) {
+ ((IWorldAccess) this.u.get(i)).a(s, entity.locX, entity.locY - (double) entity.height, entity.locZ, f, f1);
}
}
}
public void a(EntityHuman entityhuman, String s, float f, float f1) {
if (entityhuman != null && s != null) {
- for (int i = 0; i < this.v.size(); ++i) {
- ((IWorldAccess) this.v.get(i)).a(entityhuman, s, entityhuman.locX, entityhuman.locY - (double) entityhuman.height, entityhuman.locZ, f, f1);
+ for (int i = 0; i < this.u.size(); ++i) {
+ ((IWorldAccess) this.u.get(i)).a(entityhuman, s, entityhuman.locX, entityhuman.locY - (double) entityhuman.height, entityhuman.locZ, f, f1);
}
}
}
public void makeSound(double d0, double d1, double d2, String s, float f, float f1) {
if (s != null) {
- for (int i = 0; i < this.v.size(); ++i) {
- ((IWorldAccess) this.v.get(i)).a(s, d0, d1, d2, f, f1);
+ for (int i = 0; i < this.u.size(); ++i) {
+ ((IWorldAccess) this.u.get(i)).a(s, d0, d1, d2, f, f1);
}
}
}
@@ -852,14 +876,14 @@ public abstract class World implements IBlockAccess {
public void a(double d0, double d1, double d2, String s, float f, float f1, boolean flag) {}
public void a(String s, int i, int j, int k) {
- for (int l = 0; l < this.v.size(); ++l) {
- ((IWorldAccess) this.v.get(l)).a(s, i, j, k);
+ for (int l = 0; l < this.u.size(); ++l) {
+ ((IWorldAccess) this.u.get(l)).a(s, i, j, k);
}
}
public void addParticle(String s, double d0, double d1, double d2, double d3, double d4, double d5) {
- for (int i = 0; i < this.v.size(); ++i) {
- ((IWorldAccess) this.v.get(i)).a(s, d0, d1, d2, d3, d4, d5);
+ for (int i = 0; i < this.u.size(); ++i) {
+ ((IWorldAccess) this.u.get(i)).a(s, d0, d1, d2, d3, d4, d5);
}
}
@@ -879,7 +903,7 @@ public abstract class World implements IBlockAccess {
int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D);
- boolean flag = false;
+ boolean flag = entity.p;
if (entity instanceof EntityHuman) {
flag = true;
@@ -931,16 +955,16 @@ public abstract class World implements IBlockAccess {
}
protected void a(Entity entity) {
- for (int i = 0; i < this.v.size(); ++i) {
- ((IWorldAccess) this.v.get(i)).a(entity);
+ for (int i = 0; i < this.u.size(); ++i) {
+ ((IWorldAccess) this.u.get(i)).a(entity);
}
entity.valid = true; // CraftBukkit
}
protected void b(Entity entity) {
- for (int i = 0; i < this.v.size(); ++i) {
- ((IWorldAccess) this.v.get(i)).b(entity);
+ for (int i = 0; i < this.u.size(); ++i) {
+ ((IWorldAccess) this.u.get(i)).b(entity);
}
entity.valid = false; // CraftBukkit
@@ -969,10 +993,10 @@ public abstract class World implements IBlockAccess {
this.everyoneSleeping();
}
- int i = entity.ai;
- int j = entity.ak;
+ int i = entity.aj;
+ int j = entity.al;
- if (entity.ah && this.isChunkLoaded(i, j)) {
+ if (entity.ai && this.isChunkLoaded(i, j)) {
this.getChunkAt(i, j).b(entity);
}
@@ -981,11 +1005,11 @@ public abstract class World implements IBlockAccess {
}
public void addIWorldAccess(IWorldAccess iworldaccess) {
- this.v.add(iworldaccess);
+ this.u.add(iworldaccess);
}
public List getCubes(Entity entity, AxisAlignedBB axisalignedbb) {
- this.L.clear();
+ this.M.clear();
int i = MathHelper.floor(axisalignedbb.a);
int j = MathHelper.floor(axisalignedbb.d + 1.0D);
int k = MathHelper.floor(axisalignedbb.b);
@@ -1000,7 +1024,7 @@ public abstract class World implements IBlockAccess {
Block block = Block.byId[this.getTypeId(k1, i2, l1)];
if (block != null) {
- block.a(this, k1, i2, l1, axisalignedbb, this.L, entity);
+ block.a(this, k1, i2, l1, axisalignedbb, this.M, entity);
}
}
}
@@ -1011,23 +1035,23 @@ public abstract class World implements IBlockAccess {
List list = this.getEntities(entity, axisalignedbb.grow(d0, d0, d0));
for (int j2 = 0; j2 < list.size(); ++j2) {
- AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).E();
+ AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).D();
if (axisalignedbb1 != null && axisalignedbb1.a(axisalignedbb)) {
- this.L.add(axisalignedbb1);
+ this.M.add(axisalignedbb1);
}
axisalignedbb1 = entity.g((Entity) list.get(j2));
if (axisalignedbb1 != null && axisalignedbb1.a(axisalignedbb)) {
- this.L.add(axisalignedbb1);
+ this.M.add(axisalignedbb1);
}
}
- return this.L;
+ return this.M;
}
public List a(AxisAlignedBB axisalignedbb) {
- this.L.clear();
+ this.M.clear();
int i = MathHelper.floor(axisalignedbb.a);
int j = MathHelper.floor(axisalignedbb.d + 1.0D);
int k = MathHelper.floor(axisalignedbb.b);
@@ -1042,14 +1066,14 @@ public abstract class World implements IBlockAccess {
Block block = Block.byId[this.getTypeId(k1, i2, l1)];
if (block != null) {
- block.a(this, k1, i2, l1, axisalignedbb, this.L, (Entity) null);
+ block.a(this, k1, i2, l1, axisalignedbb, this.M, (Entity) null);
}
}
}
}
}
- return this.L;
+ return this.M;
}
public int a(float f) {
@@ -1065,8 +1089,8 @@ public abstract class World implements IBlockAccess {
}
f2 = 1.0F - f2;
- f2 = (float) ((double) f2 * (1.0D - (double) (this.j(f) * 5.0F) / 16.0D));
f2 = (float) ((double) f2 * (1.0D - (double) (this.i(f) * 5.0F) / 16.0D));
+ f2 = (float) ((double) f2 * (1.0D - (double) (this.h(f) * 5.0F) / 16.0D));
f2 = 1.0F - f2;
return (int) (f2 * 11.0F);
}
@@ -1075,6 +1099,16 @@ public abstract class World implements IBlockAccess {
return this.worldProvider.a(this.worldData.getDayTime(), f);
}
+ public int v() {
+ return this.worldProvider.a(this.worldData.getDayTime());
+ }
+
+ public float d(float f) {
+ float f1 = this.c(f);
+
+ return f1 * 3.1415927F * 2.0F;
+ }
+
public int h(int i, int j) {
return this.getChunkAtWorldCoords(i, j).d(i & 15, j & 15);
}
@@ -1100,7 +1134,7 @@ public abstract class World implements IBlockAccess {
public void a(int i, int j, int k, int l, int i1, int j1) {}
- public void b(int i, int j, int k, int l, int i1) {}
+ public void b(int i, int j, int k, int l, int i1, int j1) {}
public void tickEntities() {
this.methodProfiler.a("entities");
@@ -1126,7 +1160,7 @@ public abstract class World implements IBlockAccess {
try {
++entity.ticksLived;
- entity.j_();
+ entity.l_();
} catch (Throwable throwable) {
crashreport = CrashReport.a(throwable, "Ticking entity");
crashreportsystemdetails = crashreport.a("Entity being ticked");
@@ -1152,9 +1186,9 @@ public abstract class World implements IBlockAccess {
for (i = 0; i < this.f.size(); ++i) {
entity = (Entity) this.f.get(i);
- j = entity.ai;
- k = entity.ak;
- if (entity.ah && this.isChunkLoaded(j, k)) {
+ j = entity.aj;
+ k = entity.al;
+ if (entity.ai && this.isChunkLoaded(j, k)) {
this.getChunkAt(j, k).b(entity);
}
}
@@ -1192,12 +1226,7 @@ public abstract class World implements IBlockAccess {
} catch (Throwable throwable1) {
crashreport = CrashReport.a(throwable1, "Ticking entity");
crashreportsystemdetails = crashreport.a("Entity being ticked");
- if (entity == null) {
- crashreportsystemdetails.a("Entity", "~~NULL~~");
- } else {
- entity.a(crashreportsystemdetails);
- }
-
+ entity.a(crashreportsystemdetails);
throw new ReportedException(crashreport);
}
}
@@ -1205,9 +1234,9 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.b();
this.methodProfiler.a("remove");
if (entity.dead) {
- j = entity.ai;
- k = entity.ak;
- if (entity.ah && this.isChunkLoaded(j, k)) {
+ j = entity.aj;
+ k = entity.al;
+ if (entity.ai && this.isChunkLoaded(j, k)) {
this.getChunkAt(j, k).b(entity);
}
@@ -1219,7 +1248,7 @@ public abstract class World implements IBlockAccess {
}
this.methodProfiler.c("tileEntities");
- this.M = true;
+ this.N = true;
Iterator iterator = this.tileEntityList.iterator();
while (iterator.hasNext()) {
@@ -1233,16 +1262,11 @@ public abstract class World implements IBlockAccess {
if (!tileentity.r() && tileentity.o() && this.isLoaded(tileentity.x, tileentity.y, tileentity.z)) {
try {
- tileentity.g();
+ tileentity.h();
} catch (Throwable throwable2) {
crashreport = CrashReport.a(throwable2, "Ticking tile entity");
crashreportsystemdetails = crashreport.a("Tile entity being ticked");
- if (tileentity == null) {
- crashreportsystemdetails.a("Tile entity", "~~NULL~~");
- } else {
- tileentity.a(crashreportsystemdetails);
- }
-
+ tileentity.a(crashreportsystemdetails);
throw new ReportedException(crashreport);
}
}
@@ -1259,7 +1283,7 @@ public abstract class World implements IBlockAccess {
}
}
- this.M = false;
+ this.N = false;
if (!this.b.isEmpty()) {
this.tileEntityList.removeAll(this.b);
this.b.clear();
@@ -1302,7 +1326,7 @@ public abstract class World implements IBlockAccess {
}
public void a(Collection collection) {
- if (this.M) {
+ if (this.N) {
this.a.addAll(collection);
} else {
this.tileEntityList.addAll(collection);
@@ -1318,32 +1342,32 @@ public abstract class World implements IBlockAccess {
int j = MathHelper.floor(entity.locZ);
byte b0 = 32;
- if (!flag || this.d(i - b0, 0, j - b0, i + b0, 0, j + b0)) {
- entity.T = entity.locX;
- entity.U = entity.locY;
- entity.V = entity.locZ;
+ if (!flag || this.e(i - b0, 0, j - b0, i + b0, 0, j + b0)) {
+ entity.U = entity.locX;
+ entity.V = entity.locY;
+ entity.W = entity.locZ;
entity.lastYaw = entity.yaw;
entity.lastPitch = entity.pitch;
- if (flag && entity.ah) {
+ if (flag && entity.ai) {
if (entity.vehicle != null) {
- entity.U();
+ entity.T();
} else {
++entity.ticksLived;
- entity.j_();
+ entity.l_();
}
}
this.methodProfiler.a("chunkCheck");
if (Double.isNaN(entity.locX) || Double.isInfinite(entity.locX)) {
- entity.locX = entity.T;
+ entity.locX = entity.U;
}
if (Double.isNaN(entity.locY) || Double.isInfinite(entity.locY)) {
- entity.locY = entity.U;
+ entity.locY = entity.V;
}
if (Double.isNaN(entity.locZ) || Double.isInfinite(entity.locZ)) {
- entity.locZ = entity.V;
+ entity.locZ = entity.W;
}
if (Double.isNaN((double) entity.pitch) || Double.isInfinite((double) entity.pitch)) {
@@ -1358,21 +1382,21 @@ public abstract class World implements IBlockAccess {
int l = MathHelper.floor(entity.locY / 16.0D);
int i1 = MathHelper.floor(entity.locZ / 16.0D);
- if (!entity.ah || entity.ai != k || entity.aj != l || entity.ak != i1) {
- if (entity.ah && this.isChunkLoaded(entity.ai, entity.ak)) {
- this.getChunkAt(entity.ai, entity.ak).a(entity, entity.aj);
+ if (!entity.ai || entity.aj != k || entity.ak != l || entity.al != i1) {
+ if (entity.ai && this.isChunkLoaded(entity.aj, entity.al)) {
+ this.getChunkAt(entity.aj, entity.al).a(entity, entity.ak);
}
if (this.isChunkLoaded(k, i1)) {
- entity.ah = true;
+ entity.ai = true;
this.getChunkAt(k, i1).a(entity);
} else {
- entity.ah = false;
+ entity.ai = false;
}
}
this.methodProfiler.b();
- if (flag && entity.ah && entity.passenger != null) {
+ if (flag && entity.ai && entity.passenger != null) {
if (!entity.passenger.dead && entity.passenger.vehicle == entity) {
this.playerJoinedWorld(entity.passenger);
} else {
@@ -1479,7 +1503,7 @@ public abstract class World implements IBlockAccess {
int i1 = MathHelper.floor(axisalignedbb.c);
int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
- if (this.d(i, k, i1, j, l, j1)) {
+ if (this.e(i, k, i1, j, l, j1)) {
for (int k1 = i; k1 < j; ++k1) {
for (int l1 = k; l1 < l; ++l1) {
for (int i2 = i1; i2 < j1; ++i2) {
@@ -1504,7 +1528,7 @@ public abstract class World implements IBlockAccess {
int i1 = MathHelper.floor(axisalignedbb.c);
int j1 = MathHelper.floor(axisalignedbb.f + 1.0D);
- if (!this.d(i, k, i1, j, l, j1)) {
+ if (!this.e(i, k, i1, j, l, j1)) {
return false;
} else {
boolean flag = false;
@@ -1516,7 +1540,7 @@ public abstract class World implements IBlockAccess {
Block block = Block.byId[this.getTypeId(k1, l1, i2)];
if (block != null && block.material == material) {
- double d0 = (double) ((float) (l1 + 1) - BlockFluids.e(this.getData(k1, l1, i2)));
+ double d0 = (double) ((float) (l1 + 1) - BlockFluids.d(this.getData(k1, l1, i2)));
if ((double) l >= d0) {
flag = true;
@@ -1527,7 +1551,7 @@ public abstract class World implements IBlockAccess {
}
}
- if (vec3d.b() > 0.0D) {
+ if (vec3d.b() > 0.0D && entity.aw()) {
vec3d = vec3d.a();
double d1 = 0.014D;
@@ -1665,7 +1689,7 @@ public abstract class World implements IBlockAccess {
if (this.getTypeId(i, j, k) == Block.FIRE.id) {
this.a(entityhuman, 1004, i, j, k, 0);
- this.setTypeId(i, j, k, 0);
+ this.setAir(i, j, k);
return true;
} else {
return false;
@@ -1673,38 +1697,62 @@ public abstract class World implements IBlockAccess {
}
public TileEntity getTileEntity(int i, int j, int k) {
- if (j >= 256) {
- return null;
- } else {
- Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
+ if (j >= 0 && j < 256) {
+ TileEntity tileentity = null;
+ int l;
+ TileEntity tileentity1;
+
+ if (this.N) {
+ for (l = 0; l < this.a.size(); ++l) {
+ tileentity1 = (TileEntity) this.a.get(l);
+ if (!tileentity1.r() && tileentity1.x == i && tileentity1.y == j && tileentity1.z == k) {
+ tileentity = tileentity1;
+ break;
+ }
+ }
+ }
- if (chunk == null) {
- return null;
- } else {
- TileEntity tileentity = chunk.e(i & 15, j, k & 15);
+ if (tileentity == null) {
+ Chunk chunk = this.getChunkAt(i >> 4, k >> 4);
- if (tileentity == null) {
- for (int l = 0; l < this.a.size(); ++l) {
- TileEntity tileentity1 = (TileEntity) this.a.get(l);
+ if (chunk != null) {
+ tileentity = chunk.e(i & 15, j, k & 15);
+ }
+ }
- if (!tileentity1.r() && tileentity1.x == i && tileentity1.y == j && tileentity1.z == k) {
- tileentity = tileentity1;
- break;
- }
+ if (tileentity == null) {
+ for (l = 0; l < this.a.size(); ++l) {
+ tileentity1 = (TileEntity) this.a.get(l);
+ if (!tileentity1.r() && tileentity1.x == i && tileentity1.y == j && tileentity1.z == k) {
+ tileentity = tileentity1;
+ break;
}
}
-
- return tileentity;
}
+
+ return tileentity;
+ } else {
+ return null;
}
}
public void setTileEntity(int i, int j, int k, TileEntity tileentity) {
if (tileentity != null && !tileentity.r()) {
- if (this.M) {
+ if (this.N) {
tileentity.x = i;
tileentity.y = j;
tileentity.z = k;
+ Iterator iterator = this.a.iterator();
+
+ while (iterator.hasNext()) {
+ TileEntity tileentity1 = (TileEntity) iterator.next();
+
+ if (tileentity1.x == i && tileentity1.y == j && tileentity1.z == k) {
+ tileentity1.w_();
+ iterator.remove();
+ }
+ }
+
this.a.add(tileentity);
} else {
this.tileEntityList.add(tileentity);
@@ -1717,10 +1765,10 @@ public abstract class World implements IBlockAccess {
}
}
- public void r(int i, int j, int k) {
+ public void s(int i, int j, int k) {
TileEntity tileentity = this.getTileEntity(i, j, k);
- if (tileentity != null && this.M) {
+ if (tileentity != null && this.N) {
tileentity.w_();
this.a.remove(tileentity);
} else {
@@ -1741,21 +1789,21 @@ public abstract class World implements IBlockAccess {
this.b.add(tileentity);
}
- public boolean s(int i, int j, int k) {
+ public boolean t(int i, int j, int k) {
Block block = Block.byId[this.getTypeId(i, j, k)];
return block == null ? false : block.c();
}
- public boolean t(int i, int j, int k) {
- return Block.i(this.getTypeId(i, j, k));
+ public boolean u(int i, int j, int k) {
+ return Block.l(this.getTypeId(i, j, k));
}
- public boolean u(int i, int j, int k) {
+ public boolean v(int i, int j, int k) {
int l = this.getTypeId(i, j, k);
if (l != 0 && Block.byId[l] != null) {
- AxisAlignedBB axisalignedbb = Block.byId[l].e(this, i, j, k);
+ AxisAlignedBB axisalignedbb = Block.byId[l].b(this, i, j, k);
return axisalignedbb != null && axisalignedbb.b() >= 1.0D;
} else {
@@ -1763,13 +1811,13 @@ public abstract class World implements IBlockAccess {
}
}
- public boolean v(int i, int j, int k) {
+ public boolean w(int i, int j, int k) {
Block block = Block.byId[this.getTypeId(i, j, k)];
- return block == null ? false : (block.material.k() && block.b() ? true : (block instanceof BlockStairs ? (this.getData(i, j, k) & 4) == 4 : (block instanceof BlockStepAbstract ? (this.getData(i, j, k) & 8) == 8 : false)));
+ return block == null ? false : (block.material.k() && block.b() ? true : (block instanceof BlockStairs ? (this.getData(i, j, k) & 4) == 4 : (block instanceof BlockStepAbstract ? (this.getData(i, j, k) & 8) == 8 : (block instanceof BlockHopper ? true : (block instanceof BlockSnow ? (this.getData(i, j, k) & 7) == 7 : false)))));
}
- public boolean b(int i, int j, int k, boolean flag) {
+ public boolean c(int i, int j, int k, boolean flag) {
if (i >= -30000000 && k >= -30000000 && i < 30000000 && k < 30000000) {
Chunk chunk = this.chunkProvider.getOrCreateChunk(i >> 4, k >> 4);
@@ -1785,7 +1833,7 @@ public abstract class World implements IBlockAccess {
}
}
- public void x() {
+ public void y() {
int i = this.a(1.0F);
if (i != this.j) {
@@ -1890,11 +1938,11 @@ public abstract class World implements IBlockAccess {
}
}
- public void y() {
+ public void z() {
this.worldData.setWeatherDuration(1);
}
- protected void z() {
+ protected void A() {
// this.chunkTickList.clear(); // CraftBukkit - removed
this.methodProfiler.a("buildList");
@@ -1924,8 +1972,8 @@ public abstract class World implements IBlockAccess {
}
this.methodProfiler.b();
- if (this.N > 0) {
- --this.N;
+ if (this.O > 0) {
+ --this.O;
}
this.methodProfiler.a("playerCheckLight");
@@ -1936,7 +1984,7 @@ public abstract class World implements IBlockAccess {
k = MathHelper.floor(entityhuman.locY) + this.random.nextInt(11) - 5;
int j1 = MathHelper.floor(entityhuman.locZ) + this.random.nextInt(11) - 5;
- this.z(j, k, j1);
+ this.A(j, k, j1);
}
this.methodProfiler.b();
@@ -1944,7 +1992,7 @@ public abstract class World implements IBlockAccess {
protected void a(int i, int j, Chunk chunk) {
this.methodProfiler.c("moodSound");
- if (this.N == 0 && !this.isStatic) {
+ if (this.O == 0 && !this.isStatic) {
this.k = this.k * 3 + 1013904223;
int k = this.k >> 2;
int l = k & 15;
@@ -1954,12 +2002,12 @@ public abstract class World implements IBlockAccess {
l += i;
i1 += j;
- if (k1 == 0 && this.l(l, j1, i1) <= this.random.nextInt(8) && this.b(EnumSkyBlock.SKY, l, j1, i1) <= 0) {
+ if (k1 == 0 && this.m(l, j1, i1) <= this.random.nextInt(8) && this.b(EnumSkyBlock.SKY, l, j1, i1) <= 0) {
EntityHuman entityhuman = this.findNearbyPlayer((double) l + 0.5D, (double) j1 + 0.5D, (double) i1 + 0.5D, 8.0D);
if (entityhuman != null && entityhuman.e((double) l + 0.5D, (double) j1 + 0.5D, (double) i1 + 0.5D) > 4.0D) {
this.makeSound((double) l + 0.5D, (double) j1 + 0.5D, (double) i1 + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.random.nextFloat() * 0.2F);
- this.N = this.random.nextInt(12000) + 6000;
+ this.O = this.random.nextInt(12000) + 6000;
}
}
}
@@ -1969,18 +2017,18 @@ public abstract class World implements IBlockAccess {
}
protected void g() {
- this.z();
+ this.A();
}
- public boolean w(int i, int j, int k) {
- return this.c(i, j, k, false);
+ public boolean x(int i, int j, int k) {
+ return this.d(i, j, k, false);
}
- public boolean x(int i, int j, int k) {
- return this.c(i, j, k, true);
+ public boolean y(int i, int j, int k) {
+ return this.d(i, j, k, true);
}
- public boolean c(int i, int j, int k, boolean flag) {
+ public boolean d(int i, int j, int k, boolean flag) {
BiomeBase biomebase = this.getBiome(i, k);
float f = biomebase.j();
@@ -2023,7 +2071,7 @@ public abstract class World implements IBlockAccess {
}
}
- public boolean y(int i, int j, int k) {
+ public boolean z(int i, int j, int k) {
BiomeBase biomebase = this.getBiome(i, k);
float f = biomebase.j();
@@ -2043,7 +2091,7 @@ public abstract class World implements IBlockAccess {
}
}
- public void z(int i, int j, int k) {
+ public void A(int i, int j, int k) {
if (!this.worldProvider.f) {
this.c(EnumSkyBlock.SKY, i, j, k);
}
@@ -2051,85 +2099,45 @@ public abstract class World implements IBlockAccess {
this.c(EnumSkyBlock.BLOCK, i, j, k);
}
- private int b(int i, int j, int k, int l, int i1, int j1) {
- int k1 = 0;
-
- if (this.k(j, k, l)) {
- k1 = 15;
+ private int a(int i, int j, int k, EnumSkyBlock enumskyblock) {
+ if (enumskyblock == EnumSkyBlock.SKY && this.l(i, j, k)) {
+ return 15;
} else {
- if (j1 == 0) {
- j1 = 1;
- }
-
- int l1 = this.b(EnumSkyBlock.SKY, j - 1, k, l) - j1;
- int i2 = this.b(EnumSkyBlock.SKY, j + 1, k, l) - j1;
- int j2 = this.b(EnumSkyBlock.SKY, j, k - 1, l) - j1;
- int k2 = this.b(EnumSkyBlock.SKY, j, k + 1, l) - j1;
- int l2 = this.b(EnumSkyBlock.SKY, j, k, l - 1) - j1;
- int i3 = this.b(EnumSkyBlock.SKY, j, k, l + 1) - j1;
-
- if (l1 > k1) {
- k1 = l1;
- }
+ int l = this.getTypeId(i, j, k);
+ int i1 = enumskyblock == EnumSkyBlock.SKY ? 0 : Block.lightEmission[l];
+ int j1 = Block.lightBlock[l];
- if (i2 > k1) {
- k1 = i2;
+ if (j1 >= 15 && Block.lightEmission[l] > 0) {
+ j1 = 1;
}
- if (j2 > k1) {
- k1 = j2;
+ if (j1 < 1) {
+ j1 = 1;
}
- if (k2 > k1) {
- k1 = k2;
- }
+ if (j1 >= 15) {
+ return 0;
+ } else if (i1 >= 14) {
+ return i1;
+ } else {
+ for (int k1 = 0; k1 < 6; ++k1) {
+ int l1 = i + Facing.b[k1];
+ int i2 = j + Facing.c[k1];
+ int j2 = k + Facing.d[k1];
+ int k2 = this.b(enumskyblock, l1, i2, j2) - j1;
+
+ if (k2 > i1) {
+ i1 = k2;
+ }
- if (l2 > k1) {
- k1 = l2;
- }
+ if (i1 >= 14) {
+ return i1;
+ }
+ }
- if (i3 > k1) {
- k1 = i3;
+ return i1;
}
}
-
- return k1;
- }
-
- private int g(int i, int j, int k, int l, int i1, int j1) {
- int k1 = Block.lightEmission[i1];
- int l1 = this.b(EnumSkyBlock.BLOCK, j - 1, k, l) - j1;
- int i2 = this.b(EnumSkyBlock.BLOCK, j + 1, k, l) - j1;
- int j2 = this.b(EnumSkyBlock.BLOCK, j, k - 1, l) - j1;
- int k2 = this.b(EnumSkyBlock.BLOCK, j, k + 1, l) - j1;
- int l2 = this.b(EnumSkyBlock.BLOCK, j, k, l - 1) - j1;
- int i3 = this.b(EnumSkyBlock.BLOCK, j, k, l + 1) - j1;
-
- if (l1 > k1) {
- k1 = l1;
- }
-
- if (i2 > k1) {
- k1 = i2;
- }
-
- if (j2 > k1) {
- k1 = j2;
- }
-
- if (k2 > k1) {
- k1 = k2;
- }
-
- if (l2 > k1) {
- k1 = l2;
- }
-
- if (i3 > k1) {
- k1 = i3;
- }
-
- return k1;
}
public void c(EnumSkyBlock enumskyblock, int i, int j, int k) {
@@ -2139,23 +2147,9 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.a("getBrightness");
int j1 = this.b(enumskyblock, i, j, k);
- boolean flag = false;
- int k1 = this.getTypeId(i, j, k);
- int l1 = this.b(i, j, k);
-
- if (l1 == 0) {
- l1 = 1;
- }
-
- boolean flag1 = false;
+ int k1 = this.a(i, j, k, enumskyblock);
+ int l1;
int i2;
-
- if (enumskyblock == EnumSkyBlock.SKY) {
- i2 = this.b(j1, i, j, k, k1, l1);
- } else {
- i2 = this.g(j1, i, j, k, k1, l1);
- }
-
int j2;
int k2;
int l2;
@@ -2163,58 +2157,35 @@ public abstract class World implements IBlockAccess {
int j3;
int k3;
int l3;
- int i4;
- if (i2 > j1) {
+ if (k1 > j1) {
this.H[i1++] = 133152;
- } else if (i2 < j1) {
- if (enumskyblock != EnumSkyBlock.BLOCK) {
- ;
- }
-
- this.H[i1++] = 133152 + (j1 << 18);
+ } else if (k1 < j1) {
+ this.H[i1++] = 133152 | j1 << 18;
while (l < i1) {
- k1 = this.H[l++];
- l1 = (k1 & 63) - 32 + i;
- i2 = (k1 >> 6 & 63) - 32 + j;
- j2 = (k1 >> 12 & 63) - 32 + k;
- k2 = k1 >> 18 & 15;
- l2 = this.b(enumskyblock, l1, i2, j2);
- if (l2 == k2) {
- this.b(enumskyblock, l1, i2, j2, 0);
- if (k2 > 0) {
- i3 = l1 - i;
- k3 = i2 - j;
- j3 = j2 - k;
- if (i3 < 0) {
- i3 = -i3;
- }
-
- if (k3 < 0) {
- k3 = -k3;
- }
-
- if (j3 < 0) {
- j3 = -j3;
- }
-
- if (i3 + k3 + j3 < 17) {
- for (i4 = 0; i4 < 6; ++i4) {
- l3 = i4 % 2 * 2 - 1;
- int j4 = l1 + i4 / 2 % 3 / 2 * l3;
- int k4 = i2 + (i4 / 2 + 1) % 3 / 2 * l3;
- int l4 = j2 + (i4 / 2 + 2) % 3 / 2 * l3;
-
- l2 = this.b(enumskyblock, j4, k4, l4);
- int i5 = Block.lightBlock[this.getTypeId(j4, k4, l4)];
-
- if (i5 == 0) {
- i5 = 1;
- }
-
- if (l2 == k2 - i5 && i1 < this.H.length) {
- this.H[i1++] = j4 - i + 32 + (k4 - j + 32 << 6) + (l4 - k + 32 << 12) + (k2 - i5 << 18);
+ l1 = this.H[l++];
+ i2 = (l1 & 63) - 32 + i;
+ j2 = (l1 >> 6 & 63) - 32 + j;
+ k2 = (l1 >> 12 & 63) - 32 + k;
+ l2 = l1 >> 18 & 15;
+ i3 = this.b(enumskyblock, i2, j2, k2);
+ if (i3 == l2) {
+ this.b(enumskyblock, i2, j2, k2, 0);
+ if (l2 > 0) {
+ j3 = MathHelper.a(i2 - i);
+ l3 = MathHelper.a(j2 - j);
+ k3 = MathHelper.a(k2 - k);
+ if (j3 + l3 + k3 < 17) {
+ for (int i4 = 0; i4 < 6; ++i4) {
+ int j4 = i2 + Facing.b[i4];
+ int k4 = j2 + Facing.c[i4];
+ int l4 = k2 + Facing.d[i4];
+ int i5 = Math.max(1, Block.lightBlock[this.getTypeId(j4, k4, l4)]);
+
+ i3 = this.b(enumskyblock, j4, k4, l4);
+ if (i3 == l2 - i5 && i1 < this.H.length) {
+ this.H[i1++] = j4 - i + 32 | k4 - j + 32 << 6 | l4 - k + 32 << 12 | l2 - i5 << 18;
}
}
}
@@ -2229,66 +2200,43 @@ public abstract class World implements IBlockAccess {
this.methodProfiler.a("checkedPosition < toCheckCount");
while (l < i1) {
- k1 = this.H[l++];
- l1 = (k1 & 63) - 32 + i;
- i2 = (k1 >> 6 & 63) - 32 + j;
- j2 = (k1 >> 12 & 63) - 32 + k;
- k2 = this.b(enumskyblock, l1, i2, j2);
- l2 = this.getTypeId(l1, i2, j2);
- i3 = Block.lightBlock[l2];
- if (i3 == 0) {
- i3 = 1;
- }
-
- boolean flag2 = false;
-
- if (enumskyblock == EnumSkyBlock.SKY) {
- k3 = this.b(k2, l1, i2, j2, l2, i3);
- } else {
- k3 = this.g(k2, l1, i2, j2, l2, i3);
- }
-
- if (k3 != k2) {
- this.b(enumskyblock, l1, i2, j2, k3);
- if (k3 > k2) {
- j3 = l1 - i;
- i4 = i2 - j;
- l3 = j2 - k;
- if (j3 < 0) {
- j3 = -j3;
- }
-
- if (i4 < 0) {
- i4 = -i4;
- }
-
- if (l3 < 0) {
- l3 = -l3;
- }
-
- if (j3 + i4 + l3 < 17 && i1 < this.H.length - 6) {
- if (this.b(enumskyblock, l1 - 1, i2, j2) < k3) {
- this.H[i1++] = l1 - 1 - i + 32 + (i2 - j + 32 << 6) + (j2 - k + 32 << 12);
+ l1 = this.H[l++];
+ i2 = (l1 & 63) - 32 + i;
+ j2 = (l1 >> 6 & 63) - 32 + j;
+ k2 = (l1 >> 12 & 63) - 32 + k;
+ l2 = this.b(enumskyblock, i2, j2, k2);
+ i3 = this.a(i2, j2, k2, enumskyblock);
+ if (i3 != l2) {
+ this.b(enumskyblock, i2, j2, k2, i3);
+ if (i3 > l2) {
+ j3 = Math.abs(i2 - i);
+ l3 = Math.abs(j2 - j);
+ k3 = Math.abs(k2 - k);
+ boolean flag = i1 < this.H.length - 6;
+
+ if (j3 + l3 + k3 < 17 && flag) {
+ if (this.b(enumskyblock, i2 - 1, j2, k2) < i3) {
+ this.H[i1++] = i2 - 1 - i + 32 + (j2 - j + 32 << 6) + (k2 - k + 32 << 12);
}
- if (this.b(enumskyblock, l1 + 1, i2, j2) < k3) {
- this.H[i1++] = l1 + 1 - i + 32 + (i2 - j + 32 << 6) + (j2 - k + 32 << 12);
+ if (this.b(enumskyblock, i2 + 1, j2, k2) < i3) {
+ this.H[i1++] = i2 + 1 - i + 32 + (j2 - j + 32 << 6) + (k2 - k + 32 << 12);
}
- if (this.b(enumskyblock, l1, i2 - 1, j2) < k3) {
- this.H[i1++] = l1 - i + 32 + (i2 - 1 - j + 32 << 6) + (j2 - k + 32 << 12);
+ if (this.b(enumskyblock, i2, j2 - 1, k2) < i3) {
+ this.H[i1++] = i2 - i + 32 + (j2 - 1 - j + 32 << 6) + (k2 - k + 32 << 12);
}
- if (this.b(enumskyblock, l1, i2 + 1, j2) < k3) {
- this.H[i1++] = l1 - i + 32 + (i2 + 1 - j + 32 << 6) + (j2 - k + 32 << 12);
+ if (this.b(enumskyblock, i2, j2 + 1, k2) < i3) {
+ this.H[i1++] = i2 - i + 32 + (j2 + 1 - j + 32 << 6) + (k2 - k + 32 << 12);
}
- if (this.b(enumskyblock, l1, i2, j2 - 1) < k3) {
- this.H[i1++] = l1 - i + 32 + (i2 - j + 32 << 6) + (j2 - 1 - k + 32 << 12);
+ if (this.b(enumskyblock, i2, j2, k2 - 1) < i3) {
+ this.H[i1++] = i2 - i + 32 + (j2 - j + 32 << 6) + (k2 - 1 - k + 32 << 12);
}
- if (this.b(enumskyblock, l1, i2, j2 + 1) < k3) {
- this.H[i1++] = l1 - i + 32 + (i2 - j + 32 << 6) + (j2 + 1 - k + 32 << 12);
+ if (this.b(enumskyblock, i2, j2, k2 + 1) < i3) {
+ this.H[i1++] = i2 - i + 32 + (j2 - j + 32 << 6) + (k2 + 1 - k + 32 << 12);
}
}
}
@@ -2308,7 +2256,11 @@ public abstract class World implements IBlockAccess {
}
public List getEntities(Entity entity, AxisAlignedBB axisalignedbb) {
- this.O.clear();
+ return this.getEntities(entity, axisalignedbb, (IEntitySelector) null);
+ }
+
+ public List getEntities(Entity entity, AxisAlignedBB axisalignedbb, IEntitySelector ientityselector) {
+ ArrayList arraylist = new ArrayList();
int i = MathHelper.floor((axisalignedbb.a - 2.0D) / 16.0D);
int j = MathHelper.floor((axisalignedbb.d + 2.0D) / 16.0D);
int k = MathHelper.floor((axisalignedbb.c - 2.0D) / 16.0D);
@@ -2317,12 +2269,12 @@ public abstract class World implements IBlockAccess {
for (int i1 = i; i1 <= j; ++i1) {
for (int j1 = k; j1 <= l; ++j1) {
if (this.isChunkLoaded(i1, j1)) {
- this.getChunkAt(i1, j1).a(entity, axisalignedbb, this.O);
+ this.getChunkAt(i1, j1).a(entity, axisalignedbb, arraylist, ientityselector);
}
}
}
- return this.O;
+ return arraylist;
}
public List a(Class oclass, AxisAlignedBB axisalignedbb) {
@@ -2408,11 +2360,11 @@ public abstract class World implements IBlockAccess {
this.f.addAll(list);
}
- public boolean mayPlace(int i, int j, int k, int l, boolean flag, int i1, Entity entity) {
+ public boolean mayPlace(int i, int j, int k, int l, boolean flag, int i1, Entity entity, ItemStack itemstack) {
int j1 = this.getTypeId(j, k, l);
Block block = Block.byId[j1];
Block block1 = Block.byId[i];
- AxisAlignedBB axisalignedbb = block1.e(this, j, k, l);
+ AxisAlignedBB axisalignedbb = block1.b(this, j, k, l);
if (flag) {
axisalignedbb = null;
@@ -2428,7 +2380,7 @@ public abstract class World implements IBlockAccess {
}
// CraftBukkit
- defaultReturn = block != null && block.material == Material.ORIENTABLE && block1 == Block.ANVIL ? true : i > 0 && block == null && block1.canPlace(this, j, k, l, i1);
+ defaultReturn = block != null && block.material == Material.ORIENTABLE && block1 == Block.ANVIL ? true : i > 0 && block == null && block1.canPlace(this, j, k, l, i1, itemstack);
}
// CraftBukkit start
@@ -2477,28 +2429,78 @@ public abstract class World implements IBlockAccess {
return pathentity;
}
- public boolean isBlockFacePowered(int i, int j, int k, int l) {
+ public int getBlockPower(int i, int j, int k, int l) {
int i1 = this.getTypeId(i, j, k);
- return i1 == 0 ? false : Block.byId[i1].c(this, i, j, k, l);
+ return i1 == 0 ? 0 : Block.byId[i1].c(this, i, j, k, l);
}
- public boolean isBlockPowered(int i, int j, int k) {
- return this.isBlockFacePowered(i, j - 1, k, 0) ? true : (this.isBlockFacePowered(i, j + 1, k, 1) ? true : (this.isBlockFacePowered(i, j, k - 1, 2) ? true : (this.isBlockFacePowered(i, j, k + 1, 3) ? true : (this.isBlockFacePowered(i - 1, j, k, 4) ? true : this.isBlockFacePowered(i + 1, j, k, 5)))));
+ public int getBlockPower(int i, int j, int k) {
+ byte b0 = 0;
+ int l = Math.max(b0, this.getBlockPower(i, j - 1, k, 0));
+
+ if (l >= 15) {
+ return l;
+ } else {
+ l = Math.max(l, this.getBlockPower(i, j + 1, k, 1));
+ if (l >= 15) {
+ return l;
+ } else {
+ l = Math.max(l, this.getBlockPower(i, j, k - 1, 2));
+ if (l >= 15) {
+ return l;
+ } else {
+ l = Math.max(l, this.getBlockPower(i, j, k + 1, 3));
+ if (l >= 15) {
+ return l;
+ } else {
+ l = Math.max(l, this.getBlockPower(i - 1, j, k, 4));
+ if (l >= 15) {
+ return l;
+ } else {
+ l = Math.max(l, this.getBlockPower(i + 1, j, k, 5));
+ return l >= 15 ? l : l;
+ }
+ }
+ }
+ }
+ }
}
- public boolean isBlockFaceIndirectlyPowered(int i, int j, int k, int l) {
- if (this.t(i, j, k)) {
- return this.isBlockPowered(i, j, k);
+ public boolean isBlockFacePowered(int i, int j, int k, int l) {
+ return this.getBlockFacePower(i, j, k, l) > 0;
+ }
+
+ public int getBlockFacePower(int i, int j, int k, int l) {
+ if (this.u(i, j, k)) {
+ return this.getBlockPower(i, j, k);
} else {
int i1 = this.getTypeId(i, j, k);
- return i1 == 0 ? false : Block.byId[i1].b(this, i, j, k, l);
+ return i1 == 0 ? 0 : Block.byId[i1].b(this, i, j, k, l);
}
}
public boolean isBlockIndirectlyPowered(int i, int j, int k) {
- return this.isBlockFaceIndirectlyPowered(i, j - 1, k, 0) ? true : (this.isBlockFaceIndirectlyPowered(i, j + 1, k, 1) ? true : (this.isBlockFaceIndirectlyPowered(i, j, k - 1, 2) ? true : (this.isBlockFaceIndirectlyPowered(i, j, k + 1, 3) ? true : (this.isBlockFaceIndirectlyPowered(i - 1, j, k, 4) ? true : this.isBlockFaceIndirectlyPowered(i + 1, j, k, 5)))));
+ return this.getBlockFacePower(i, j - 1, k, 0) > 0 ? true : (this.getBlockFacePower(i, j + 1, k, 1) > 0 ? true : (this.getBlockFacePower(i, j, k - 1, 2) > 0 ? true : (this.getBlockFacePower(i, j, k + 1, 3) > 0 ? true : (this.getBlockFacePower(i - 1, j, k, 4) > 0 ? true : this.getBlockFacePower(i + 1, j, k, 5) > 0))));
+ }
+
+ public int getHighestNeighborSignal(int i, int j, int k) {
+ int l = 0;
+
+ for (int i1 = 0; i1 < 6; ++i1) {
+ int j1 = this.getBlockFacePower(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1], i1);
+
+ if (j1 >= 15) {
+ return 15;
+ }
+
+ if (j1 > l) {
+ l = j1;
+ }
+ }
+
+ return l;
}
public EntityHuman findNearbyPlayer(Entity entity, double d0) {
@@ -2552,7 +2554,7 @@ public abstract class World implements IBlockAccess {
}
if (entityhuman1.isInvisible()) {
- float f = entityhuman1.bR();
+ float f = entityhuman1.ca();
if (f < 0.1F) {
f = 0.1F;
@@ -2581,7 +2583,7 @@ public abstract class World implements IBlockAccess {
return null;
}
- public void D() throws ExceptionWorldConflict { // CraftBukkit - added throws
+ public void E() throws ExceptionWorldConflict { // CraftBukkit - added throws
this.dataManager.checkSession();
}
@@ -2611,7 +2613,7 @@ public abstract class World implements IBlockAccess {
public void broadcastEntityEffect(Entity entity, byte b0) {}
- public IChunkProvider I() {
+ public IChunkProvider J() {
return this.chunkProvider;
}
@@ -2645,26 +2647,26 @@ public abstract class World implements IBlockAccess {
}
// CraftBukkit end
- public float i(float f) {
- return (this.o + (this.p - this.o) * f) * this.j(f);
+ public float h(float f) {
+ return (this.o + (this.p - this.o) * f) * this.i(f);
}
- public float j(float f) {
+ public float i(float f) {
return this.m + (this.n - this.m) * f;
}
- public boolean M() {
- return (double) this.i(1.0F) > 0.9D;
+ public boolean N() {
+ return (double) this.h(1.0F) > 0.9D;
}
- public boolean N() {
- return (double) this.j(1.0F) > 0.2D;
+ public boolean O() {
+ return (double) this.i(1.0F) > 0.2D;
}
- public boolean D(int i, int j, int k) {
- if (!this.N()) {
+ public boolean F(int i, int j, int k) {
+ if (!this.O()) {
return false;
- } else if (!this.k(i, j, k)) {
+ } else if (!this.l(i, j, k)) {
return false;
} else if (this.h(i, k) > j) {
return false;
@@ -2675,7 +2677,7 @@ public abstract class World implements IBlockAccess {
}
}
- public boolean E(int i, int j, int k) {
+ public boolean G(int i, int j, int k) {
BiomeBase biomebase = this.getBiome(i, k);
return biomebase.e();
@@ -2693,9 +2695,9 @@ public abstract class World implements IBlockAccess {
return this.worldMaps.a(s);
}
- public void e(int i, int j, int k, int l, int i1) {
- for (int j1 = 0; j1 < this.v.size(); ++j1) {
- ((IWorldAccess) this.v.get(j1)).a(i, j, k, l, i1);
+ public void d(int i, int j, int k, int l, int i1) {
+ for (int j1 = 0; j1 < this.u.size(); ++j1) {
+ ((IWorldAccess) this.u.get(j1)).a(i, j, k, l, i1);
}
}
@@ -2705,8 +2707,8 @@ public abstract class World implements IBlockAccess {
public void a(EntityHuman entityhuman, int i, int j, int k, int l, int i1) {
try {
- for (int j1 = 0; j1 < this.v.size(); ++j1) {
- ((IWorldAccess) this.v.get(j1)).a(entityhuman, i, j, k, l, i1);
+ for (int j1 = 0; j1 < this.u.size(); ++j1) {
+ ((IWorldAccess) this.u.get(j1)).a(entityhuman, i, j, k, l, i1);
}
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Playing level event");
@@ -2724,15 +2726,15 @@ public abstract class World implements IBlockAccess {
return 256;
}
- public int P() {
+ public int Q() {
return this.worldProvider.f ? 128 : 256;
}
- public IUpdatePlayerListBox a(EntityMinecart entityminecart) {
+ public IUpdatePlayerListBox a(EntityMinecartAbstract entityminecartabstract) {
return null;
}
- public Random F(int i, int j, int k) {
+ public Random H(int i, int j, int k) {
long l = (long) i * 341873128712L + (long) j * 132897987541L + this.getWorldData().getSeed() + (long) k;
this.random.setSeed(l);
@@ -2740,7 +2742,7 @@ public abstract class World implements IBlockAccess {
}
public ChunkPosition b(String s, int i, int j, int k) {
- return this.I().findNearestMapFeature(this, s, i, j, k);
+ return this.J().findNearestMapFeature(this, s, i, j, k);
}
public CrashReportSystemDetails a(CrashReport crashreport) {
@@ -2759,9 +2761,9 @@ public abstract class World implements IBlockAccess {
return crashreportsystemdetails;
}
- public void g(int i, int j, int k, int l, int i1) {
- for (int j1 = 0; j1 < this.v.size(); ++j1) {
- IWorldAccess iworldaccess = (IWorldAccess) this.v.get(j1);
+ public void f(int i, int j, int k, int l, int i1) {
+ for (int j1 = 0; j1 < this.u.size(); ++j1) {
+ IWorldAccess iworldaccess = (IWorldAccess) this.u.get(j1);
iworldaccess.b(i, j, k, l, i1);
}
@@ -2771,11 +2773,43 @@ public abstract class World implements IBlockAccess {
return this.J;
}
- public Calendar T() {
+ public Calendar U() {
if (this.getTime() % 600L == 0L) {
this.K.setTimeInMillis(System.currentTimeMillis());
}
return this.K;
}
+
+ public Scoreboard getScoreboard() {
+ return this.scoreboard;
+ }
+
+ public void m(int i, int j, int k, int l) {
+ for (int i1 = 0; i1 < 4; ++i1) {
+ int j1 = i + Direction.a[i1];
+ int k1 = k + Direction.b[i1];
+ int l1 = this.getTypeId(j1, j, k1);
+
+ if (l1 != 0) {
+ Block block = Block.byId[l1];
+
+ if (Block.REDSTONE_COMPARATOR_OFF.g(l1)) {
+ block.doPhysics(this, j1, j, k1, l);
+ } else if (Block.l(l1)) {
+ j1 += Direction.a[i1];
+ k1 += Direction.b[i1];
+ l1 = this.getTypeId(j1, j, k1);
+ block = Block.byId[l1];
+ if (Block.REDSTONE_COMPARATOR_OFF.g(l1)) {
+ block.doPhysics(this, j1, j, k1, l);
+ }
+ }
+ }
+ }
+ }
+
+ public IConsoleLogManager getLogger() {
+ return this.logAgent;
+ }
}
diff --git a/src/main/java/net/minecraft/server/WorldGenForest.java b/src/main/java/net/minecraft/server/WorldGenForest.java
index 2ca7a7ff..da137e3a 100644
--- a/src/main/java/net/minecraft/server/WorldGenForest.java
+++ b/src/main/java/net/minecraft/server/WorldGenForest.java
@@ -70,8 +70,12 @@ public class WorldGenForest extends WorldGenerator implements BlockSapling.TreeG
for (int k2 = k - k1; k2 <= k + k1; ++k2) {
int l2 = k2 - k;
- if ((Math.abs(j2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) && !Block.q[world.getTypeId(l1, i2, k2)]) {
- this.setTypeAndData(world, l1, i2, k2, Block.LEAVES.id, 2);
+ if (Math.abs(j2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) {
+ int i3 = world.getTypeId(l1, i2, k2);
+
+ if (i3 == 0 || i3 == Block.LEAVES.id) {
+ this.setTypeAndData(world, l1, i2, k2, Block.LEAVES.id, 2);
+ }
}
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenGroundBush.java b/src/main/java/net/minecraft/server/WorldGenGroundBush.java
index b0a5a7ef..b598d28e 100644
--- a/src/main/java/net/minecraft/server/WorldGenGroundBush.java
+++ b/src/main/java/net/minecraft/server/WorldGenGroundBush.java
@@ -43,7 +43,7 @@ public class WorldGenGroundBush extends WorldGenerator implements BlockSapling.T
for (int k2 = k - l1; k2 <= k + l1; ++k2) {
int l2 = k2 - k;
- if ((Math.abs(j2) != l1 || Math.abs(l2) != l1 || random.nextInt(2) != 0) && !Block.q[world.getTypeId(i2, j1, k2)]) {
+ if ((Math.abs(j2) != l1 || Math.abs(l2) != l1 || random.nextInt(2) != 0) && !Block.s[world.getTypeId(i2, j1, k2)]) {
this.setTypeAndData(world, i2, j1, k2, Block.LEAVES.id, this.a);
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java b/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java
index 9f00271e..249976e4 100644
--- a/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java
+++ b/src/main/java/net/minecraft/server/WorldGenHugeMushroom.java
@@ -162,7 +162,7 @@ public class WorldGenHugeMushroom extends WorldGenerator implements BlockSapling
l2 = 0;
}
- if ((l2 != 0 || j >= j + i1 - 1) && !Block.q[world.getTypeId(i2, k1, k2)]) {
+ if ((l2 != 0 || j >= j + i1 - 1) && !Block.s[world.getTypeId(i2, k1, k2)]) {
// CraftBukkit start
if (event == null) {
this.setTypeAndData(world, i2, k1, k2, Block.BIG_MUSHROOM_1.id + l, l2);
@@ -180,7 +180,7 @@ public class WorldGenHugeMushroom extends WorldGenerator implements BlockSapling
for (k1 = 0; k1 < i1; ++k1) {
l1 = world.getTypeId(i, j + k1, k);
- if (!Block.q[l1]) {
+ if (!Block.s[l1]) {
// CraftBukkit start
if (event == null) {
this.setTypeAndData(world, i, j + k1, k, Block.BIG_MUSHROOM_1.id + l, 10);
diff --git a/src/main/java/net/minecraft/server/WorldGenMegaTree.java b/src/main/java/net/minecraft/server/WorldGenMegaTree.java
index a49bcf4f..957b3e47 100644
--- a/src/main/java/net/minecraft/server/WorldGenMegaTree.java
+++ b/src/main/java/net/minecraft/server/WorldGenMegaTree.java
@@ -63,10 +63,10 @@ public class WorldGenMegaTree extends WorldGenerator implements BlockSapling.Tre
} else {
i1 = world.getTypeId(i, j - 1, k);
if ((i1 == Block.GRASS.id || i1 == Block.DIRT.id) && j < 256 - l - 1) {
- world.setRawTypeId(i, j - 1, k, Block.DIRT.id);
- world.setRawTypeId(i + 1, j - 1, k, Block.DIRT.id);
- world.setRawTypeId(i, j - 1, k + 1, Block.DIRT.id);
- world.setRawTypeId(i + 1, j - 1, k + 1, Block.DIRT.id);
+ world.setTypeIdAndData(i, j - 1, k, Block.DIRT.id, 0);
+ world.setTypeIdAndData(i + 1, j - 1, k, Block.DIRT.id, 0);
+ world.setTypeIdAndData(i, j - 1, k + 1, Block.DIRT.id, 0);
+ world.setTypeIdAndData(i + 1, j - 1, k + 1, Block.DIRT.id, 0);
this.a(world, i, k, j + l, 2, random);
for (int i2 = j + l - 2 - random.nextInt(4); i2 > j + l / 2; i2 -= 2 + random.nextInt(4)) {
@@ -167,8 +167,12 @@ public class WorldGenMegaTree extends WorldGenerator implements BlockSapling.Tre
for (int j2 = j - k1; j2 <= j + k1 + 1; ++j2) {
int k2 = j2 - j;
- if ((i2 >= 0 || k2 >= 0 || i2 * i2 + k2 * k2 <= k1 * k1) && (i2 <= 0 && k2 <= 0 || i2 * i2 + k2 * k2 <= (k1 + 1) * (k1 + 1)) && (random.nextInt(4) != 0 || i2 * i2 + k2 * k2 <= (k1 - 1) * (k1 - 1)) && !Block.q[world.getTypeId(l1, i1, j2)]) {
- this.setTypeAndData(world, l1, i1, j2, Block.LEAVES.id, this.c);
+ if ((i2 >= 0 || k2 >= 0 || i2 * i2 + k2 * k2 <= k1 * k1) && (i2 <= 0 && k2 <= 0 || i2 * i2 + k2 * k2 <= (k1 + 1) * (k1 + 1)) && (random.nextInt(4) != 0 || i2 * i2 + k2 * k2 <= (k1 - 1) * (k1 - 1))) {
+ int l2 = world.getTypeId(l1, i1, j2);
+
+ if (l2 == 0 || l2 == Block.LEAVES.id) {
+ this.setTypeAndData(world, l1, i1, j2, Block.LEAVES.id, this.c);
+ }
}
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenSwampTree.java b/src/main/java/net/minecraft/server/WorldGenSwampTree.java
index bdf85d8b..6f78c0ab 100644
--- a/src/main/java/net/minecraft/server/WorldGenSwampTree.java
+++ b/src/main/java/net/minecraft/server/WorldGenSwampTree.java
@@ -78,7 +78,7 @@ public class WorldGenSwampTree extends WorldGenerator implements BlockSapling.Tr
for (int k2 = k - k1; k2 <= k + k1; ++k2) {
int l2 = k2 - k;
- if ((Math.abs(i2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) && !Block.q[world.getTypeId(l1, j2, k2)]) {
+ if ((Math.abs(i2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) && !Block.s[world.getTypeId(l1, j2, k2)]) {
this.setType(world, l1, j2, k2, Block.LEAVES.id);
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenTaiga1.java b/src/main/java/net/minecraft/server/WorldGenTaiga1.java
index 1c579257..5e75f6f8 100644
--- a/src/main/java/net/minecraft/server/WorldGenTaiga1.java
+++ b/src/main/java/net/minecraft/server/WorldGenTaiga1.java
@@ -66,7 +66,7 @@ public class WorldGenTaiga1 extends WorldGenerator implements BlockSapling.TreeG
for (int i3 = k - l2; i3 <= k + l2; ++i3) {
int j3 = i3 - k;
- if ((Math.abs(k2) != l2 || Math.abs(j3) != l2 || l2 <= 0) && !Block.q[world.getTypeId(j2, i2, i3)]) {
+ if ((Math.abs(k2) != l2 || Math.abs(j3) != l2 || l2 <= 0) && !Block.s[world.getTypeId(j2, i2, i3)]) {
this.setTypeAndData(world, j2, i2, i3, Block.LEAVES.id, 1);
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenTaiga2.java b/src/main/java/net/minecraft/server/WorldGenTaiga2.java
index 40ae1664..79f5df80 100644
--- a/src/main/java/net/minecraft/server/WorldGenTaiga2.java
+++ b/src/main/java/net/minecraft/server/WorldGenTaiga2.java
@@ -74,7 +74,7 @@ public class WorldGenTaiga2 extends WorldGenerator implements BlockSapling.TreeG
for (int l3 = k - k2; l3 <= k + k2; ++l3) {
int i4 = l3 - k;
- if ((Math.abs(k3) != k2 || Math.abs(i4) != k2 || k2 <= 0) && !Block.q[world.getTypeId(i3, j3, l3)]) {
+ if ((Math.abs(k3) != k2 || Math.abs(i4) != k2 || k2 <= 0) && !Block.s[world.getTypeId(i3, j3, l3)]) {
this.setTypeAndData(world, i3, j3, l3, Block.LEAVES.id, 1);
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenTrees.java b/src/main/java/net/minecraft/server/WorldGenTrees.java
index d0d49bff..4d8b04f2 100644
--- a/src/main/java/net/minecraft/server/WorldGenTrees.java
+++ b/src/main/java/net/minecraft/server/WorldGenTrees.java
@@ -86,8 +86,12 @@ public class WorldGenTrees extends WorldGenerator implements BlockSapling.TreeGe
for (int l2 = k - i2; l2 <= k + i2; ++l2) {
int i3 = l2 - k;
- if ((Math.abs(k2) != i2 || Math.abs(i3) != i2 || random.nextInt(2) != 0 && k1 != 0) && world.isEmpty(j2, j1, l2)) {
- this.setTypeAndData(world, j2, j1, l2, Block.LEAVES.id, this.d);
+ if (Math.abs(k2) != i2 || Math.abs(i3) != i2 || random.nextInt(2) != 0 && k1 != 0) {
+ int j3 = world.getTypeId(j2, j1, l2);
+
+ if (j3 == 0 || j3 == Block.LEAVES.id) {
+ this.setTypeAndData(world, j2, j1, l2, Block.LEAVES.id, this.d);
+ }
}
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenerator.java b/src/main/java/net/minecraft/server/WorldGenerator.java
index 506a1c6a..320a1944 100644
--- a/src/main/java/net/minecraft/server/WorldGenerator.java
+++ b/src/main/java/net/minecraft/server/WorldGenerator.java
@@ -7,7 +7,6 @@ import org.bukkit.BlockChangeDelegate; // CraftBukkit
public abstract class WorldGenerator {
private final boolean a;
- private int b = 1;
public WorldGenerator() {
this.a = false;
@@ -31,7 +30,7 @@ public abstract class WorldGenerator {
if (this.a) {
world.setTypeIdAndData(i, j, k, l, i1);
} else {
- world.setRawTypeIdAndData(i, j, k, l, i1);
+ world.setTypeIdAndData(i, j, k, l, i1);
}
}
}
diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java
index a154401e..fd009002 100644
--- a/src/main/java/net/minecraft/server/WorldMap.java
+++ b/src/main/java/net/minecraft/server/WorldMap.java
@@ -147,8 +147,8 @@ public class WorldMap extends WorldMapBase {
for (int i = 0; i < this.f.size(); ++i) {
WorldMapHumanTracker worldmaphumantracker1 = (WorldMapHumanTracker) this.f.get(i);
- if (!worldmaphumantracker1.trackee.dead && (worldmaphumantracker1.trackee.inventory.c(itemstack) || itemstack.y())) {
- if (!itemstack.y() && worldmaphumantracker1.trackee.dimension == this.map) {
+ if (!worldmaphumantracker1.trackee.dead && (worldmaphumantracker1.trackee.inventory.c(itemstack) || itemstack.z())) {
+ if (!itemstack.z() && worldmaphumantracker1.trackee.dimension == this.map) {
this.a(0, worldmaphumantracker1.trackee.world, worldmaphumantracker1.trackee.getName(), worldmaphumantracker1.trackee.locX, worldmaphumantracker1.trackee.locZ, (double) worldmaphumantracker1.trackee.yaw);
}
} else {
@@ -157,8 +157,8 @@ public class WorldMap extends WorldMapBase {
}
}
- if (itemstack.y()) {
- this.a(1, entityhuman.world, "frame-" + itemstack.z().id, (double) itemstack.z().x, (double) itemstack.z().z, (double) (itemstack.z().direction * 90));
+ if (itemstack.z()) {
+ this.a(1, entityhuman.world, "frame-" + itemstack.A().id, (double) itemstack.A().x, (double) itemstack.A().z, (double) (itemstack.A().direction * 90));
}
}
diff --git a/src/main/java/net/minecraft/server/WorldMapHumanTracker.java b/src/main/java/net/minecraft/server/WorldMapHumanTracker.java
index 8d05888b..bf3e6feb 100644
--- a/src/main/java/net/minecraft/server/WorldMapHumanTracker.java
+++ b/src/main/java/net/minecraft/server/WorldMapHumanTracker.java
@@ -60,7 +60,7 @@ public class WorldMapHumanTracker {
}
// CraftBukkit end
- boolean flag = !itemstack.y();
+ boolean flag = !itemstack.z();
if (this.h != null && this.h.length == abyte.length) {
for (j = 0; j < abyte.length; ++j) {
diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java
index ddd979cc..e0ae71a8 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -16,14 +16,13 @@ import java.util.UUID;
import org.bukkit.craftbukkit.entity.CraftPlayer;
// CraftBukkit end
-public class WorldNBTStorage implements IDataManager, PlayerFileData {
+public class WorldNBTStorage implements IDataManager, IPlayerFileData {
- private static final Logger log = Logger.getLogger("Minecraft");
private final File baseDir;
private final File playerDir;
private final File dataDir;
private final long sessionId = System.currentTimeMillis();
- private final String f;
+ private final String e;
private UUID uuid = null; // CraftBukkit
public WorldNBTStorage(File file1, String s, boolean flag) {
@@ -32,7 +31,7 @@ public class WorldNBTStorage implements IDataManager, PlayerFileData {
this.playerDir = new File(this.baseDir, "players");
this.dataDir = new File(this.baseDir, "data");
this.dataDir.mkdirs();
- this.f = s;
+ this.e = s;
if (flag) {
this.playerDir.mkdirs();
}
@@ -174,7 +173,7 @@ public class WorldNBTStorage implements IDataManager, PlayerFileData {
try {
NBTTagCompound nbttagcompound = new NBTTagCompound();
- entityhuman.d(nbttagcompound);
+ entityhuman.e(nbttagcompound);
File file1 = new File(this.playerDir, entityhuman.name + ".dat.tmp");
File file2 = new File(this.playerDir, entityhuman.name + ".dat");
@@ -185,11 +184,11 @@ public class WorldNBTStorage implements IDataManager, PlayerFileData {
file1.renameTo(file2);
} catch (Exception exception) {
- log.warning("Failed to save player data for " + entityhuman.name);
+ MinecraftServer.getServer().getLogger().warning("Failed to save player data for " + entityhuman.name);
}
}
- public void load(EntityHuman entityhuman) {
+ public NBTTagCompound load(EntityHuman entityhuman) {
NBTTagCompound nbttagcompound = this.getPlayerData(entityhuman.name);
if (nbttagcompound != null) {
@@ -199,8 +198,10 @@ public class WorldNBTStorage implements IDataManager, PlayerFileData {
player.setFirstPlayed(new File(playerDir, entityhuman.name + ".dat").lastModified());
}
// CraftBukkit end
- entityhuman.e(nbttagcompound);
+ entityhuman.f(nbttagcompound);
}
+
+ return nbttagcompound;
}
public NBTTagCompound getPlayerData(String s) {
@@ -211,13 +212,13 @@ public class WorldNBTStorage implements IDataManager, PlayerFileData {
return NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file1)));
}
} catch (Exception exception) {
- log.warning("Failed to load player data for " + s);
+ MinecraftServer.getServer().getLogger().warning("Failed to load player data for " + s);
}
return null;
}
- public PlayerFileData getPlayerFileData() {
+ public IPlayerFileData getPlayerFileData() {
return this;
}
@@ -240,7 +241,7 @@ public class WorldNBTStorage implements IDataManager, PlayerFileData {
}
public String g() {
- return this.f;
+ return this.e;
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 3f73ef97..d99b6a3b 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -34,13 +34,14 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
private NoteDataList[] Q = new NoteDataList[] { new NoteDataList((EmptyClass2) null), new NoteDataList((EmptyClass2) null)};
private int R = 0;
private static final StructurePieceTreasure[] S = new StructurePieceTreasure[] { new StructurePieceTreasure(Item.STICK.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.WOOD.id, 0, 1, 3, 10), new StructurePieceTreasure(Block.LOG.id, 0, 1, 3, 10), new StructurePieceTreasure(Item.STONE_AXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_AXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.STONE_PICKAXE.id, 0, 1, 1, 3), new StructurePieceTreasure(Item.WOOD_PICKAXE.id, 0, 1, 1, 5), new StructurePieceTreasure(Item.APPLE.id, 0, 2, 3, 5), new StructurePieceTreasure(Item.BREAD.id, 0, 2, 3, 3)};
+ private ArrayList T = new ArrayList();
private IntHashMap entitiesById;
// CraftBukkit start
public final int dimension;
- public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, WorldSettings worldsettings, MethodProfiler methodprofiler, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
- super(idatamanager, s, worldsettings, WorldProvider.byDimension(env.getId()), methodprofiler, gen, env);
+ public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, WorldSettings worldsettings, MethodProfiler methodprofiler, IConsoleLogManager iconsolelogmanager, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) {
+ super(idatamanager, s, worldsettings, WorldProvider.byDimension(env.getId()), methodprofiler, iconsolelogmanager, gen, env);
this.dimension = i;
this.pvpMode = minecraftserver.getPvP();
// CraftBukkit end
@@ -60,6 +61,16 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
this.P = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit
+ this.scoreboard = new ScoreboardServer(minecraftserver);
+ ScoreboardSaveData scoreboardsavedata = (ScoreboardSaveData) this.worldMaps.get(ScoreboardSaveData.class, "scoreboard");
+
+ if (scoreboardsavedata == null) {
+ scoreboardsavedata = new ScoreboardSaveData();
+ this.worldMaps.a("scoreboard", scoreboardsavedata);
+ }
+
+ scoreboardsavedata.a(this.scoreboard);
+ ((ScoreboardServer) this.scoreboard).a(scoreboardsavedata);
}
// CraftBukkit start
@@ -106,15 +117,15 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
private TileEntity fixTileEntity(int x, int y, int z, int type, TileEntity found) {
- getServer().getLogger().severe("Block at " + x + "," + y + "," + z + " is " + org.bukkit.Material.getMaterial(type).toString() + " but has " + found + ". "
+ this.getServer().getLogger().severe("Block at " + x + "," + y + "," + z + " is " + org.bukkit.Material.getMaterial(type).toString() + " but has " + found + ". "
+ "Bukkit will attempt to fix this, but there may be additional damage that we cannot recover.");
if (Block.byId[type] instanceof BlockContainer) {
- TileEntity replacement = ((BlockContainer) Block.byId[type]).a(this);
- setTileEntity(x, y, z, replacement);
+ TileEntity replacement = ((BlockContainer) Block.byId[type]).b(this);
+ this.setTileEntity(x, y, z, replacement);
return replacement;
} else {
- getServer().getLogger().severe("Don't know how to fix for this type... Can't do anything! :(");
+ this.getServer().getLogger().severe("Don't know how to fix for this type... Can't do anything! :(");
return found;
}
}
@@ -165,7 +176,6 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
this.j = j;
}
- this.V();
this.worldData.setTime(this.worldData.getTime() + 1L);
this.worldData.setDayTime(this.worldData.getDayTime() + 1L);
this.methodProfiler.c("tickPending");
@@ -180,13 +190,13 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
this.methodProfiler.c("portalForcer");
this.P.a(this.getTime());
this.methodProfiler.b();
- this.V();
+ this.Y();
this.getWorld().processChunkGC(); // CraftBukkit
}
public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) {
- List list = this.I().getMobsFor(enumcreaturetype, i, j, k);
+ List list = this.J().getMobsFor(enumcreaturetype, i, j, k);
return list != null && !list.isEmpty() ? (BiomeMeta) WeightedRandom.a(this.random, (Collection) list) : null;
}
@@ -217,10 +227,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
}
- this.U();
+ this.X();
}
- private void U() {
+ private void X() {
// CraftBukkit start
WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), false);
this.getServer().getPluginManager().callEvent(weather);
@@ -293,13 +303,13 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
int k1;
int l1;
- if (this.random.nextInt(100000) == 0 && this.N() && this.M()) {
+ if (this.random.nextInt(100000) == 0 && this.O() && this.N()) {
this.k = this.k * 3 + 1013904223;
i1 = this.k >> 2;
j1 = k + (i1 & 15);
k1 = l + (i1 >> 8 & 15);
l1 = this.h(j1, k1);
- if (this.D(j1, l1, k1)) {
+ if (this.F(j1, l1, k1)) {
this.strikeLightning(new EntityLightning(this, (double) j1, (double) l1, (double) k1));
}
}
@@ -313,7 +323,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
j1 = i1 & 15;
k1 = i1 >> 8 & 15;
l1 = this.h(j1 + k, k1 + l);
- if (this.x(j1 + k, l1 - 1, k1 + l)) {
+ if (this.y(j1 + k, l1 - 1, k1 + l)) {
// CraftBukkit start
BlockState blockState = this.getWorld().getBlockAt(j1 + k, l1 - 1, k1 + l).getState();
blockState.setTypeId(Block.ICE.id);
@@ -326,7 +336,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
// CraftBukkit end
}
- if (this.N() && this.y(j1 + k, l1, k1 + l)) {
+ if (this.O() && this.z(j1 + k, l1, k1 + l)) {
// CraftBukkit start
BlockState blockState = this.getWorld().getBlockAt(j1 + k, l1, k1 + l).getState();
blockState.setTypeId(Block.SNOW.id);
@@ -339,13 +349,13 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
// CraftBukkit end
}
- if (this.N()) {
+ if (this.O()) {
BiomeBase biomebase = this.getBiome(j1 + k, k1 + l);
if (biomebase.d()) {
i2 = this.getTypeId(j1 + k, l1 - 1, k1 + l);
if (i2 != 0) {
- Block.byId[i2].f(this, j1 + k, l1 - 1, k1 + l);
+ Block.byId[i2].g(this, j1 + k, l1 - 1, k1 + l);
}
}
}
@@ -373,7 +383,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
if (block != null && block.isTicking()) {
++i;
- block.b(this, k2 + k, i3 + chunksection.d(), l2 + l, this.random);
+ block.a(this, k2 + k, i3 + chunksection.d(), l2 + l, this.random);
}
}
}
@@ -383,21 +393,27 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
}
+ public boolean a(int i, int j, int k, int l) {
+ NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, l);
+
+ return this.T.contains(nextticklistentry);
+ }
+
public void a(int i, int j, int k, int l, int i1) {
this.a(i, j, k, l, i1, 0);
}
public void a(int i, int j, int k, int l, int i1, int j1) {
NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, l);
- byte b0 = 8;
+ byte b0 = 0;
if (this.d && l > 0) {
if (Block.byId[l].l()) {
- if (this.d(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) {
+ if (this.e(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) {
int k1 = this.getTypeId(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c);
if (k1 == nextticklistentry.d && k1 > 0) {
- Block.byId[k1].b(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.random);
+ Block.byId[k1].a(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.random);
}
}
@@ -407,7 +423,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
i1 = 1;
}
- if (this.d(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
+ if (this.e(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
if (l > 0) {
nextticklistentry.a((long) i1 + this.worldData.getTime());
nextticklistentry.a(j1);
@@ -420,9 +436,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
}
- public void b(int i, int j, int k, int l, int i1) {
+ public void b(int i, int j, int k, int l, int i1, int j1) {
NextTickListEntry nextticklistentry = new NextTickListEntry(i, j, k, l);
+ nextticklistentry.a(j1);
if (l > 0) {
nextticklistentry.a((long) i1 + this.worldData.getTime());
}
@@ -465,23 +482,36 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
// CraftBukkit end
}
- for (int j = 0; j < i; ++j) {
- NextTickListEntry nextticklistentry = (NextTickListEntry) this.M.first();
+ this.methodProfiler.a("cleaning");
+
+ NextTickListEntry nextticklistentry;
+ for (int j = 0; j < i; ++j) {
+ nextticklistentry = (NextTickListEntry) this.M.first();
if (!flag && nextticklistentry.e > this.worldData.getTime()) {
break;
}
this.M.remove(nextticklistentry);
this.L.remove(nextticklistentry);
- byte b0 = 8;
+ this.T.add(nextticklistentry);
+ }
- if (this.d(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) {
+ this.methodProfiler.b();
+ this.methodProfiler.a("ticking");
+ Iterator iterator = this.T.iterator();
+
+ while (iterator.hasNext()) {
+ nextticklistentry = (NextTickListEntry) iterator.next();
+ iterator.remove();
+ byte b0 = 0;
+
+ if (this.e(nextticklistentry.a - b0, nextticklistentry.b - b0, nextticklistentry.c - b0, nextticklistentry.a + b0, nextticklistentry.b + b0, nextticklistentry.c + b0)) {
int k = this.getTypeId(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c);
- if (k == nextticklistentry.d && k > 0) {
+ if (k > 0 && Block.b(k, nextticklistentry.d)) {
try {
- Block.byId[k].b(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.random);
+ Block.byId[k].a(this, nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, this.random);
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Exception while ticking a block");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being ticked");
@@ -498,9 +528,13 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
throw new ReportedException(crashreport);
}
}
+ } else {
+ this.a(nextticklistentry.a, nextticklistentry.b, nextticklistentry.c, nextticklistentry.d, 0);
}
}
+ this.methodProfiler.b();
+ this.T.clear();
return !this.M.isEmpty();
}
}
@@ -508,26 +542,38 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
public List a(Chunk chunk, boolean flag) {
ArrayList arraylist = null;
ChunkCoordIntPair chunkcoordintpair = chunk.l();
- int i = chunkcoordintpair.x << 4;
- int j = i + 16;
- int k = chunkcoordintpair.z << 4;
- int l = k + 16;
- Iterator iterator = this.M.iterator();
+ int i = (chunkcoordintpair.x << 4) - 2;
+ int j = i + 16 + 2;
+ int k = (chunkcoordintpair.z << 4) - 2;
+ int l = k + 16 + 2;
- while (iterator.hasNext()) {
- NextTickListEntry nextticklistentry = (NextTickListEntry) iterator.next();
+ for (int i1 = 0; i1 < 2; ++i1) {
+ Iterator iterator;
- if (nextticklistentry.a >= i && nextticklistentry.a < j && nextticklistentry.c >= k && nextticklistentry.c < l) {
- if (flag) {
- this.L.remove(nextticklistentry);
- iterator.remove();
+ if (i1 == 0) {
+ iterator = this.M.iterator();
+ } else {
+ iterator = this.T.iterator();
+ if (!this.T.isEmpty()) {
+ System.out.println(this.T.size());
}
+ }
- if (arraylist == null) {
- arraylist = new ArrayList();
- }
+ while (iterator.hasNext()) {
+ NextTickListEntry nextticklistentry = (NextTickListEntry) iterator.next();
- arraylist.add(nextticklistentry);
+ if (nextticklistentry.a >= i && nextticklistentry.a < j && nextticklistentry.c >= k && nextticklistentry.c < l) {
+ if (flag) {
+ this.L.remove(nextticklistentry);
+ iterator.remove();
+ }
+
+ if (arraylist == null) {
+ arraylist = new ArrayList();
+ }
+
+ arraylist.add(nextticklistentry);
+ }
}
}
@@ -593,15 +639,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
public boolean a(EntityHuman entityhuman, int i, int j, int k) {
- int l = MathHelper.a(i - this.worldData.c());
- int i1 = MathHelper.a(k - this.worldData.e());
-
- if (l > i1) {
- i1 = l;
- }
-
- // CraftBukkit - Configurable spawn protection
- return i1 > this.getServer().getSpawnRadius() || this.server.getPlayerList().isOp(entityhuman.name) || this.server.I();
+ return !this.server.a(this, i, j, k, entityhuman);
}
protected void a(WorldSettings worldsettings) {
@@ -655,7 +693,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
i = chunkposition.x;
k = chunkposition.z;
} else {
- System.out.println("Unable to find spawn biome");
+ this.getLogger().warning("Unable to find spawn biome");
}
int l = 0;
@@ -711,7 +749,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
protected void a() throws ExceptionWorldConflict { // CraftBukkit - added throws
- this.D();
+ this.E();
this.dataManager.saveWorldData(this.worldData, this.server.getPlayerList().q());
this.worldMaps.a();
}
@@ -719,7 +757,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
protected void a(Entity entity) {
super.a(entity);
this.entitiesById.a(entity.id, entity);
- Entity[] aentity = entity.ao();
+ Entity[] aentity = entity.an();
if (aentity != null) {
for (int i = 0; i < aentity.length; ++i) {
@@ -731,7 +769,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
protected void b(Entity entity) {
super.b(entity);
this.entitiesById.d(entity.id);
- Entity[] aentity = entity.ao();
+ Entity[] aentity = entity.an();
if (aentity != null) {
for (int i = 0; i < aentity.length; ++i) {
@@ -818,7 +856,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
- private void V() {
+ private void Y() {
while (!this.Q[this.R].isEmpty()) {
int i = this.R;
@@ -841,12 +879,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
private boolean a(NoteBlockData noteblockdata) {
int i = this.getTypeId(noteblockdata.a(), noteblockdata.b(), noteblockdata.c());
- if (i == noteblockdata.f()) {
- Block.byId[i].b(this, noteblockdata.a(), noteblockdata.b(), noteblockdata.c(), noteblockdata.d(), noteblockdata.e());
- return true;
- } else {
- return false;
- }
+ return i == noteblockdata.f() ? Block.byId[i].b(this, noteblockdata.a(), noteblockdata.b(), noteblockdata.c(), noteblockdata.d(), noteblockdata.e()) : false;
}
public void saveLevel() {
@@ -854,10 +887,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
protected void n() {
- boolean flag = this.N();
+ boolean flag = this.O();
super.n();
- if (flag != this.N()) {
+ if (flag != this.O()) {
// CraftBukkit start - only sending weather packets to those affected
for (int i = 0; i < this.players.size(); ++i) {
if (((EntityPlayer) this.players.get(i)).world == this) {
@@ -883,4 +916,22 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
public PortalTravelAgent s() {
return this.P;
}
+
+ // CraftBukkit start - Compatibility methods for BlockChangeDelegate
+ public boolean setRawTypeId(int x, int y, int z, int typeId) {
+ return this.setTypeIdAndData(x, y, z, typeId, 0, 4);
+ }
+
+ public boolean setRawTypeIdAndData(int x, int y, int z, int typeId, int data) {
+ return this.setTypeIdAndData(x, y, z, typeId, data, 4);
+ }
+
+ public boolean setTypeId(int x, int y, int z, int typeId) {
+ return this.setTypeIdAndData(x, y, z, typeId, 0, 3);
+ }
+
+ public boolean setTypeIdAndData(int x, int y, int z, int typeId, int data) {
+ return this.setTypeIdAndData(x, y, z, typeId, data, 3);
+ }
+ // CraftBukkit end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index e7c0760f..37750226 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -522,7 +522,7 @@ public final class CraftServer implements Server {
public void reload() {
configuration = YamlConfiguration.loadConfiguration(getConfigFile());
- PropertyManager config = new PropertyManager(console.options);
+ PropertyManager config = new PropertyManager(console.options, console.getLogger());
((DedicatedServer) console).propertyManager = config;
@@ -707,7 +707,7 @@ public final class CraftServer implements Server {
} while(used);
boolean hardcore = false;
- WorldServer internal = new WorldServer(console, new ServerNBTManager(getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGamemode.a(getDefaultGameMode().getValue()), generateStructures, hardcore, type), console.methodProfiler, creator.environment(), generator);
+ WorldServer internal = new WorldServer(console, new ServerNBTManager(getWorldContainer(), name, true), name, dimension, new WorldSettings(creator.seed(), EnumGamemode.a(getDefaultGameMode().getValue()), generateStructures, hardcore, type), console.methodProfiler, console.getLogger(), creator.environment(), generator);
if (!(worlds.containsKey(name.toLowerCase()))) {
return null;
@@ -830,7 +830,7 @@ public final class CraftServer implements Server {
}
public Logger getLogger() {
- return MinecraftServer.log;
+ return console.getLogger().getLogger();
}
public ConsoleReader getReader() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 6e364b1a..9218f074 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -861,11 +861,17 @@ public class CraftWorld implements World {
}
} else if (Minecart.class.isAssignableFrom(clazz)) {
if (PoweredMinecart.class.isAssignableFrom(clazz)) {
- entity = new EntityMinecart(world, x, y, z, CraftMinecart.Type.PoweredMinecart.getId());
+ entity = new EntityMinecartFurnace(world, x, y, z);
} else if (StorageMinecart.class.isAssignableFrom(clazz)) {
- entity = new EntityMinecart(world, x, y, z, CraftMinecart.Type.StorageMinecart.getId());
+ entity = new EntityMinecartChest(world, x, y, z);
+ } else if (MinecartTNT.class.isAssignableFrom(clazz)) {
+ entity = new EntityMinecartTNT(world, x, y, z);
+ } else if (MinecartHopper.class.isAssignableFrom(clazz)) {
+ entity = new EntityMinecartHopper(world, x, y, z);
+ } else if (MinecartMobSpawner.class.isAssignableFrom(clazz)) {
+ entity = new EntityMinecartMobSpawner(world, x, y, z);
} else {
- entity = new EntityMinecart(world, x, y, z, CraftMinecart.Type.Minecart.getId());
+ entity = new EntityMinecartRideable(world, x, y, z);
}
} else if (EnderSignal.class.isAssignableFrom(clazz)) {
entity = new EntityEnderSignal(world, x, y, z);
@@ -989,7 +995,7 @@ public class CraftWorld implements World {
entity = null;
}
} else if (TNTPrimed.class.isAssignableFrom(clazz)) {
- entity = new EntityTNTPrimed(world, x, y, z);
+ entity = new EntityTNTPrimed(world, x, y, z, null);
} else if (ExperienceOrb.class.isAssignableFrom(clazz)) {
entity = new EntityExperienceOrb(world, x, y, z, 0);
} else if (Weather.class.isAssignableFrom(clazz)) {
@@ -1102,7 +1108,7 @@ public class CraftWorld implements World {
block.setType(org.bukkit.Material.AIR);
// not sure what this does, seems to have something to do with the 'base' material of a block.
// For example, WOODEN_STAIRS does something with WOOD in this method
- net.minecraft.server.Block.byId[blockId].wasExploded(this.world, blockX, blockY, blockZ);
+ net.minecraft.server.Block.byId[blockId].wasExploded(this.world, blockX, blockY, blockZ, null);
}
public void sendPluginMessage(Plugin source, String channel, byte[] message) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
index 91677bbe..1e4953dc 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
@@ -7,6 +7,7 @@ import java.util.List;
import net.minecraft.server.BiomeBase;
import net.minecraft.server.BlockRedstoneWire;
+import net.minecraft.server.Direction;
import net.minecraft.server.EnumSkyBlock;
import net.minecraft.server.NBTTagCompound;
import net.minecraft.server.TileEntitySkull;
@@ -84,14 +85,14 @@ public class CraftBlock implements Block {
}
public void setData(final byte data) {
- chunk.getHandle().world.setData(x, y, z, data);
+ chunk.getHandle().world.setData(x, y, z, data, 3);
}
public void setData(final byte data, boolean applyPhysics) {
if (applyPhysics) {
- chunk.getHandle().world.setData(x, y, z, data);
+ chunk.getHandle().world.setData(x, y, z, data, 3);
} else {
- chunk.getHandle().world.setRawData(x, y, z, data);
+ chunk.getHandle().world.setData(x, y, z, data, 4);
}
}
@@ -104,22 +105,22 @@ public class CraftBlock implements Block {
}
public boolean setTypeId(final int type) {
- return chunk.getHandle().world.setTypeId(x, y, z, type);
+ return chunk.getHandle().world.setTypeIdAndData(x, y, z, type, getData(), 3);
}
public boolean setTypeId(final int type, final boolean applyPhysics) {
if (applyPhysics) {
return setTypeId(type);
} else {
- return chunk.getHandle().world.setRawTypeId(x, y, z, type);
+ return chunk.getHandle().world.setTypeIdAndData(x, y, z, type, getData(), 4);
}
}
public boolean setTypeIdAndData(final int type, final byte data, final boolean applyPhysics) {
if (applyPhysics) {
- return chunk.getHandle().world.setTypeIdAndData(x, y, z, type, data);
+ return chunk.getHandle().world.setTypeIdAndData(x, y, z, type, data, 3);
} else {
- boolean success = chunk.getHandle().world.setRawTypeIdAndData(x, y, z, type, data);
+ boolean success = chunk.getHandle().world.setTypeIdAndData(x, y, z, type, data, 4);
if (success) {
chunk.getHandle().world.notify(x, y, z);
}
@@ -294,7 +295,7 @@ public class CraftBlock implements Block {
}
public boolean isBlockPowered() {
- return chunk.getHandle().world.isBlockPowered(x, y, z);
+ return chunk.getHandle().world.getBlockPower(x, y, z) > 0;
}
public boolean isBlockIndirectlyPowered() {
@@ -320,7 +321,14 @@ public class CraftBlock implements Block {
}
public boolean isBlockFaceIndirectlyPowered(BlockFace face) {
- return chunk.getHandle().world.isBlockFaceIndirectlyPowered(x, y, z, blockFaceToNotch(face));
+ int power = chunk.getHandle().world.getBlockFacePower(x, y, z, blockFaceToNotch(face));
+
+ Block relative = getRelative(face);
+ if (relative.getType() == Material.REDSTONE_WIRE) {
+ return Math.max(power, relative.getData()) > 0;
+ }
+
+ return power > 0;
}
public int getBlockPower(BlockFace face) {
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
index fd2e6ba2..554eee9c 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java
@@ -21,16 +21,16 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
@Deprecated
public CreatureType getCreatureType() {
- return CreatureType.fromName(spawner.mobName);
+ return CreatureType.fromName(spawner.a().getMobName());
}
public EntityType getSpawnedType() {
- return EntityType.fromName(spawner.mobName);
+ return EntityType.fromName(spawner.a().getMobName());
}
@Deprecated
public void setCreatureType(CreatureType creatureType) {
- spawner.mobName = creatureType.getName();
+ spawner.a().a(creatureType.getName());
}
public void setSpawnedType(EntityType entityType) {
@@ -38,12 +38,12 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
throw new IllegalArgumentException("Can't spawn EntityType " + entityType + " from mobspawners!");
}
- spawner.mobName = entityType.getName();
+ spawner.a().a(entityType.getName());
}
@Deprecated
public String getCreatureTypeId() {
- return spawner.mobName;
+ return spawner.a().getMobName();
}
@Deprecated
@@ -52,7 +52,7 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
}
public String getCreatureTypeName() {
- return spawner.mobName;
+ return spawner.a().getMobName();
}
public void setCreatureTypeByName(String creatureType) {
@@ -65,11 +65,11 @@ public class CraftCreatureSpawner extends CraftBlockState implements CreatureSpa
}
public int getDelay() {
- return spawner.spawnDelay;
+ return spawner.a().spawnDelay;
}
public void setDelay(int delay) {
- spawner.spawnDelay = delay;
+ spawner.a().spawnDelay = delay;
}
}
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java b/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java
index c6ac1589..16960292 100644
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftJukebox.java
@@ -23,7 +23,7 @@ public class CraftJukebox extends CraftBlockState implements Jukebox {
}
public Material getPlaying() {
- ItemStack record = jukebox.record;
+ ItemStack record = jukebox.getRecord();
if (record == null) {
return Material.AIR;
}
@@ -33,15 +33,15 @@ public class CraftJukebox extends CraftBlockState implements Jukebox {
public void setPlaying(Material record) {
if (record == null || Item.byId[record.getId()] == null) {
record = Material.AIR;
- jukebox.record = null;
+ jukebox.setRecord(null);
} else {
- jukebox.record = new ItemStack(Item.byId[record.getId()], 1);
+ jukebox.setRecord(new ItemStack(Item.byId[record.getId()], 1));
}
jukebox.update();
if (record == Material.AIR) {
- world.getHandle().setData(getX(), getY(), getZ(), 0);
+ world.getHandle().setData(getX(), getY(), getZ(), 0, 3);
} else {
- world.getHandle().setData(getX(), getY(), getZ(), 1);
+ world.getHandle().setData(getX(), getY(), getZ(), 1, 3);
}
world.playEffect(getLocation(), Effect.RECORD_PLAY, record.getId());
}
diff --git a/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java b/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java
index 89be6326..9c3848d8 100644
--- a/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java
+++ b/src/main/java/org/bukkit/craftbukkit/command/CraftBlockCommandSender.java
@@ -16,7 +16,7 @@ public class CraftBlockCommandSender extends ServerCommandSender implements Bloc
}
public Block getBlock() {
- return commandBlock.world.getWorld().getBlockAt(commandBlock.x, commandBlock.y, commandBlock.z);
+ return commandBlock.getWorld().getWorld().getBlockAt(commandBlock.x, commandBlock.y, commandBlock.z);
}
public void sendMessage(String message) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 99a8891b..f88092e1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -136,13 +136,14 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
if (entity instanceof EntityLightning) { return new CraftLightningStrike(server, (EntityLightning) entity); }
else { return new CraftWeather(server, (EntityWeather) entity); }
}
- else if (entity instanceof EntityMinecart) {
- EntityMinecart mc = (EntityMinecart) entity;
- if (mc.type == CraftMinecart.Type.StorageMinecart.getId()) { return new CraftStorageMinecart(server, mc); }
- else if (mc.type == CraftMinecart.Type.PoweredMinecart.getId()) { return new CraftPoweredMinecart(server, mc); }
- else { return new CraftMinecart(server, mc); }
- }
- else if (entity instanceof EntityHanging) {
+ else if (entity instanceof EntityMinecartAbstract) {
+ if (entity instanceof EntityMinecartFurnace) { return new CraftPoweredMinecart(server, (EntityMinecartFurnace) entity); }
+ else if (entity instanceof EntityMinecartChest) { return new CraftStorageMinecart(server, (EntityMinecartChest) entity); }
+ else if (entity instanceof EntityMinecartTNT) { return new CraftMinecartTNT(server, (EntityMinecartTNT) entity); }
+ else if (entity instanceof EntityMinecartHopper) { return new CraftMinecartHopper(server, (EntityMinecartHopper) entity); }
+ else if (entity instanceof EntityMinecartMobSpawner) { return new CraftMinecartMobSpawner(server, (EntityMinecartMobSpawner) entity); }
+ else { return new CraftMinecart(server, (EntityMinecartRideable) entity); }
+ } else if (entity instanceof EntityHanging) {
if (entity instanceof EntityPainting) { return new CraftPainting(server, (EntityPainting) entity); }
else if (entity instanceof EntityItemFrame) { return new CraftItemFrame(server, (EntityItemFrame) entity); }
else { return new CraftHanging(server, (EntityHanging) entity); }
@@ -302,7 +303,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
public UUID getUniqueId() {
- return getHandle().uniqueId;
+ return getHandle().uniqueID;
}
public int getTicksLived() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
index 9068a454..e79e5384 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java
@@ -238,7 +238,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
String title = container.getBukkitView().getTitle();
int size = container.getBukkitView().getTopInventory().getSize();
- player.playerConnection.sendPacket(new Packet100OpenWindow(container.windowId, windowType, title, size));
+ player.playerConnection.sendPacket(new Packet100OpenWindow(container.windowId, windowType, title, size, true));
getHandle().activeContainer = container;
getHandle().activeContainer.addSlotListener(player);
}
@@ -270,7 +270,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
if (location == null) {
location = getLocation();
}
- getHandle().startEnchanting(location.getBlockX(), location.getBlockY(), location.getBlockZ());
+ getHandle().startEnchanting(location.getBlockX(), location.getBlockY(), location.getBlockZ(), null);
if (force) {
getHandle().activeContainer.checkReachable = false;
}
@@ -303,7 +303,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
int windowType = CraftContainer.getNotchInventoryType(type);
String title = inventory.getTitle();
int size = inventory.getTopInventory().getSize();
- player.playerConnection.sendPacket(new Packet100OpenWindow(container.windowId, windowType, title, size));
+ player.playerConnection.sendPacket(new Packet100OpenWindow(container.windowId, windowType, title, size, false));
player.activeContainer = container;
player.activeContainer.addSlotListener(player);
}
@@ -313,7 +313,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
}
public boolean isBlocking() {
- return getHandle().bh();
+ return getHandle().bk(); // Should be isBlocking
}
public boolean setWindowProperty(InventoryView.Property prop, int value) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java
index ef95acd6..f69480cf 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java
@@ -50,7 +50,7 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame {
public void setRotation(Rotation rotation) {
Validate.notNull(rotation, "Rotation cannot be null");
- getHandle().g(toInteger(rotation));
+ getHandle().b(toInteger(rotation)); // Should be setRotation
}
static int toInteger(Rotation rotation) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 23a89b0f..1678db1c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -325,7 +325,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
public boolean hasLineOfSight(Entity other) {
- return getHandle().aA().canSee(((CraftEntity) other).getHandle()); // az should be getEntitySenses
+ return getHandle().aD().canSee(((CraftEntity) other).getHandle()); // az should be getEntitySenses
}
public boolean getRemoveWhenFarAway() {
@@ -356,4 +356,30 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return super.teleport(location, cause);
}
+
+ public void setCustomName(String name) {
+ if (name == null) {
+ name = "";
+ }
+
+ getHandle().setCustomName(name);
+ }
+
+ public String getCustomName() {
+ String name = getHandle().getCustomName();
+
+ if (name == null || name.length() == 0) {
+ return null;
+ }
+
+ return name;
+ }
+
+ public void setCustomNameVisible(boolean flag) {
+ getHandle().setCustomNameVisible(flag);
+ }
+
+ public boolean getCustomNameVisible() {
+ return getHandle().getCustomNameVisible();
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
index 807bd2cf..73e807e1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java
@@ -1,33 +1,13 @@
package org.bukkit.craftbukkit.entity;
-import net.minecraft.server.EntityMinecart;
+import net.minecraft.server.EntityMinecartAbstract;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Minecart;
import org.bukkit.util.Vector;
public class CraftMinecart extends CraftVehicle implements Minecart {
- /**
- * Stores the minecart type id, which is used by Minecraft to differentiate
- * minecart types. Here we use subclasses.
- */
- public enum Type {
- Minecart(0),
- StorageMinecart(1),
- PoweredMinecart(2);
-
- private final int id;
-
- private Type(int id) {
- this.id = id;
- }
-
- public int getId() {
- return id;
- }
- }
-
- public CraftMinecart(CraftServer server, EntityMinecart entity) {
+ public CraftMinecart(CraftServer server, EntityMinecartAbstract entity) {
super(server, entity);
}
@@ -74,8 +54,8 @@ public class CraftMinecart extends CraftVehicle implements Minecart {
}
@Override
- public EntityMinecart getHandle() {
- return (EntityMinecart) entity;
+ public EntityMinecartAbstract getHandle() {
+ return (EntityMinecartAbstract) entity;
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
new file mode 100644
index 00000000..67fcbb47
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java
@@ -0,0 +1,16 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityMinecartHopper;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.MinecartHopper;
+
+final class CraftMinecartHopper extends CraftMinecart implements MinecartHopper {
+ CraftMinecartHopper(CraftServer server, EntityMinecartHopper entity) {
+ super(server, entity);
+ }
+
+ public EntityType getType() {
+ return EntityType.MINECART_HOPPER;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartMobSpawner.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartMobSpawner.java
new file mode 100644
index 00000000..83be050b
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartMobSpawner.java
@@ -0,0 +1,16 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityMinecartMobSpawner;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.MinecartMobSpawner;
+
+final class CraftMinecartMobSpawner extends CraftMinecart implements MinecartMobSpawner {
+ CraftMinecartMobSpawner(CraftServer server, EntityMinecartMobSpawner entity) {
+ super(server, entity);
+ }
+
+ public EntityType getType() {
+ return EntityType.MINECART_MOB_SPAWNER;
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java
new file mode 100644
index 00000000..861b01fe
--- /dev/null
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartTNT.java
@@ -0,0 +1,11 @@
+package org.bukkit.craftbukkit.entity;
+
+import net.minecraft.server.EntityMinecartTNT;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.MinecartTNT;
+
+final class CraftMinecartTNT extends CraftMinecart implements MinecartTNT {
+ CraftMinecartTNT(CraftServer server, EntityMinecartTNT entity) {
+ super(server, entity);
+ }
+}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java
index b261a0f1..a07829e2 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPoweredMinecart.java
@@ -1,12 +1,13 @@
package org.bukkit.craftbukkit.entity;
import org.bukkit.craftbukkit.entity.CraftMinecart;
-import net.minecraft.server.EntityMinecart;
+import net.minecraft.server.EntityMinecartFurnace;
import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.entity.EntityType;
import org.bukkit.entity.PoweredMinecart;
public class CraftPoweredMinecart extends CraftMinecart implements PoweredMinecart {
- public CraftPoweredMinecart(CraftServer server, EntityMinecart entity) {
+ public CraftPoweredMinecart(CraftServer server, EntityMinecartFurnace entity) {
super(server, entity);
}
@@ -14,4 +15,8 @@ public class CraftPoweredMinecart extends CraftMinecart implements PoweredMineca
public String toString() {
return "CraftPoweredMinecart";
}
+
+ public EntityType getType() {
+ return EntityType.MINECART_FURNACE;
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftStorageMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftStorageMinecart.java
index e7338a6c..ef86e413 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftStorageMinecart.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftStorageMinecart.java
@@ -1,16 +1,17 @@
package org.bukkit.craftbukkit.entity;
-import net.minecraft.server.EntityMinecart;
+import net.minecraft.server.EntityMinecartChest;
-import org.bukkit.inventory.Inventory;
-import org.bukkit.craftbukkit.inventory.CraftInventory;
import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.craftbukkit.inventory.CraftInventory;
+import org.bukkit.entity.EntityType;
import org.bukkit.entity.StorageMinecart;
+import org.bukkit.inventory.Inventory;
public class CraftStorageMinecart extends CraftMinecart implements StorageMinecart {
private final CraftInventory inventory;
- public CraftStorageMinecart(CraftServer server, EntityMinecart entity) {
+ public CraftStorageMinecart(CraftServer server, EntityMinecartChest entity) {
super(server, entity);
inventory = new CraftInventory(entity);
}
@@ -23,4 +24,8 @@ public class CraftStorageMinecart extends CraftMinecart implements StorageMineca
public String toString() {
return "CraftStorageMinecart{" + "inventory=" + inventory + '}';
}
+
+ public EntityType getType() {
+ return EntityType.MINECART_CHEST;
+ }
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
index 1f136dee..0b38125c 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java
@@ -85,7 +85,7 @@ public class CraftContainer extends Container {
setupSlots(top, bottom);
}
int size = getSize();
- player.getHandle().playerConnection.sendPacket(new Packet100OpenWindow(this.windowId, type, cachedTitle, size));
+ player.getHandle().playerConnection.sendPacket(new Packet100OpenWindow(this.windowId, type, cachedTitle, size, true));
player.updateInventory();
}
return true;
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
index 6fb6cb8b..efb28969 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java
@@ -108,7 +108,7 @@ public class CraftInventoryCustom extends CraftInventory {
public void update() {}
- public boolean a_(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
return true;
}
@@ -132,8 +132,6 @@ public class CraftInventoryCustom extends CraftInventory {
return type;
}
- public void f() {}
-
public void g() {}
public InventoryHolder getOwner() {
@@ -141,5 +139,13 @@ public class CraftInventoryCustom extends CraftInventory {
}
public void startOpen() {}
+
+ public boolean c() {
+ return false;
+ }
+
+ public boolean b(int i, ItemStack itemstack) {
+ return true;
+ }
}
}