summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft
diff options
context:
space:
mode:
authorNate Mortensen <nate.richard.mortensen@gmail.com>2013-07-01 06:03:00 -0500
committerWesley Wolfe <weswolf@aol.com>2013-07-01 12:10:06 -0500
commit6c09066e224ac85b8a6464eaf8f53edfeb4beda4 (patch)
tree573e05f4b148cb1891a1d3839175e501e6257442 /src/main/java/net/minecraft
parentf887b76a259e12468b28d82d1eced93f0b73bd6d (diff)
downloadcraftbukkit-6c09066e224ac85b8a6464eaf8f53edfeb4beda4.tar
craftbukkit-6c09066e224ac85b8a6464eaf8f53edfeb4beda4.tar.gz
craftbukkit-6c09066e224ac85b8a6464eaf8f53edfeb4beda4.tar.lz
craftbukkit-6c09066e224ac85b8a6464eaf8f53edfeb4beda4.tar.xz
craftbukkit-6c09066e224ac85b8a6464eaf8f53edfeb4beda4.zip
Update CraftBukkit to 1.6.1
Diffstat (limited to 'src/main/java/net/minecraft')
-rw-r--r--src/main/java/net/minecraft/server/AABBPool.java6
-rw-r--r--src/main/java/net/minecraft/server/Block.java371
-rw-r--r--src/main/java/net/minecraft/server/BlockCactus.java6
-rw-r--r--src/main/java/net/minecraft/server/BlockCocoa.java6
-rw-r--r--src/main/java/net/minecraft/server/BlockCommand.java8
-rw-r--r--src/main/java/net/minecraft/server/BlockCrops.java6
-rw-r--r--src/main/java/net/minecraft/server/BlockDaylightDetector.java2
-rw-r--r--src/main/java/net/minecraft/server/BlockDiodeAbstract.java6
-rw-r--r--src/main/java/net/minecraft/server/BlockDispenser.java12
-rw-r--r--src/main/java/net/minecraft/server/BlockDoor.java9
-rw-r--r--src/main/java/net/minecraft/server/BlockDropper.java6
-rw-r--r--src/main/java/net/minecraft/server/BlockEnderPortal.java4
-rw-r--r--src/main/java/net/minecraft/server/BlockFire.java8
-rw-r--r--src/main/java/net/minecraft/server/BlockFlowing.java66
-rw-r--r--src/main/java/net/minecraft/server/BlockIce.java8
-rw-r--r--src/main/java/net/minecraft/server/BlockLeaves.java8
-rw-r--r--src/main/java/net/minecraft/server/BlockMushroom.java13
-rw-r--r--src/main/java/net/minecraft/server/BlockNetherWart.java6
-rw-r--r--src/main/java/net/minecraft/server/BlockPiston.java4
-rw-r--r--src/main/java/net/minecraft/server/BlockPistonExtension.java10
-rw-r--r--src/main/java/net/minecraft/server/BlockPortal.java2
-rw-r--r--src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java10
-rw-r--r--src/main/java/net/minecraft/server/BlockPressurePlateBinary.java4
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneOre.java2
-rw-r--r--src/main/java/net/minecraft/server/BlockRedstoneTorch.java2
-rw-r--r--src/main/java/net/minecraft/server/BlockSapling.java1
-rw-r--r--src/main/java/net/minecraft/server/BlockSkull.java6
-rw-r--r--src/main/java/net/minecraft/server/BlockStem.java2
-rw-r--r--src/main/java/net/minecraft/server/BlockTripwire.java4
-rw-r--r--src/main/java/net/minecraft/server/BlockVine.java47
-rw-r--r--src/main/java/net/minecraft/server/Chunk.java48
-rw-r--r--src/main/java/net/minecraft/server/ChunkRegionLoader.java8
-rw-r--r--src/main/java/net/minecraft/server/Container.java33
-rw-r--r--src/main/java/net/minecraft/server/ContainerAnvil.java29
-rw-r--r--src/main/java/net/minecraft/server/ContainerBeacon.java10
-rw-r--r--src/main/java/net/minecraft/server/ContainerBrewingStand.java10
-rw-r--r--src/main/java/net/minecraft/server/ContainerChest.java4
-rw-r--r--src/main/java/net/minecraft/server/ContainerDispenser.java4
-rw-r--r--src/main/java/net/minecraft/server/ContainerEnchantTable.java8
-rw-r--r--src/main/java/net/minecraft/server/ContainerFurnace.java10
-rw-r--r--src/main/java/net/minecraft/server/ContainerHopper.java4
-rw-r--r--src/main/java/net/minecraft/server/ContainerHorse.java104
-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.java20
-rw-r--r--src/main/java/net/minecraft/server/ControllerMove.java26
-rw-r--r--src/main/java/net/minecraft/server/CraftingManager.java6
-rw-r--r--src/main/java/net/minecraft/server/CrashReport.java4
-rw-r--r--src/main/java/net/minecraft/server/DedicatedServer.java102
-rw-r--r--src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java2
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorArmor.java9
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorBoat.java2
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java2
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java2
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java4
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorFireball.java2
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorFireworks.java2
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorFlintAndSteel.java2
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorItem.java4
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorMinecart.java10
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java4
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java2
-rw-r--r--src/main/java/net/minecraft/server/DispenseBehaviorTNT.java2
-rw-r--r--src/main/java/net/minecraft/server/Enchantment.java5
-rw-r--r--src/main/java/net/minecraft/server/Entity.java199
-rw-r--r--src/main/java/net/minecraft/server/EntityAgeable.java69
-rw-r--r--src/main/java/net/minecraft/server/EntityArrow.java22
-rw-r--r--src/main/java/net/minecraft/server/EntityBlaze.java56
-rw-r--r--src/main/java/net/minecraft/server/EntityBoat.java53
-rw-r--r--src/main/java/net/minecraft/server/EntityChicken.java70
-rw-r--r--src/main/java/net/minecraft/server/EntityCow.java33
-rw-r--r--src/main/java/net/minecraft/server/EntityCreature.java144
-rw-r--r--src/main/java/net/minecraft/server/EntityCreeper.java40
-rw-r--r--src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java6
-rw-r--r--src/main/java/net/minecraft/server/EntityEgg.java2
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderCrystal.java8
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderDragon.java313
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderPearl.java4
-rw-r--r--src/main/java/net/minecraft/server/EntityEnderman.java141
-rw-r--r--src/main/java/net/minecraft/server/EntityExperienceOrb.java16
-rw-r--r--src/main/java/net/minecraft/server/EntityFallingBlock.java16
-rw-r--r--src/main/java/net/minecraft/server/EntityFireball.java12
-rw-r--r--src/main/java/net/minecraft/server/EntityFireworks.java6
-rw-r--r--src/main/java/net/minecraft/server/EntityFishingHook.java16
-rw-r--r--src/main/java/net/minecraft/server/EntityGhast.java113
-rw-r--r--src/main/java/net/minecraft/server/EntityHanging.java51
-rw-r--r--src/main/java/net/minecraft/server/EntityHuman.java509
-rw-r--r--src/main/java/net/minecraft/server/EntityInsentient.java884
-rw-r--r--src/main/java/net/minecraft/server/EntityIronGolem.java91
-rw-r--r--src/main/java/net/minecraft/server/EntityItem.java26
-rw-r--r--src/main/java/net/minecraft/server/EntityLargeFireball.java2
-rw-r--r--src/main/java/net/minecraft/server/EntityLightning.java6
-rw-r--r--src/main/java/net/minecraft/server/EntityLiving.java2289
-rw-r--r--src/main/java/net/minecraft/server/EntityMagmaCube.java41
-rw-r--r--src/main/java/net/minecraft/server/EntityMinecartAbstract.java83
-rw-r--r--src/main/java/net/minecraft/server/EntityMinecartContainer.java6
-rw-r--r--src/main/java/net/minecraft/server/EntityMonster.java52
-rw-r--r--src/main/java/net/minecraft/server/EntityMushroomCow.java7
-rw-r--r--src/main/java/net/minecraft/server/EntityOcelot.java82
-rw-r--r--src/main/java/net/minecraft/server/EntityPainting.java12
-rw-r--r--src/main/java/net/minecraft/server/EntityPig.java53
-rw-r--r--src/main/java/net/minecraft/server/EntityPigZombie.java72
-rw-r--r--src/main/java/net/minecraft/server/EntityPlayer.java198
-rw-r--r--src/main/java/net/minecraft/server/EntityPotion.java2
-rw-r--r--src/main/java/net/minecraft/server/EntityProjectile.java14
-rw-r--r--src/main/java/net/minecraft/server/EntitySheep.java75
-rw-r--r--src/main/java/net/minecraft/server/EntitySilverfish.java77
-rw-r--r--src/main/java/net/minecraft/server/EntitySkeleton.java123
-rw-r--r--src/main/java/net/minecraft/server/EntitySlime.java97
-rw-r--r--src/main/java/net/minecraft/server/EntitySmallFireball.java4
-rw-r--r--src/main/java/net/minecraft/server/EntitySnowman.java21
-rw-r--r--src/main/java/net/minecraft/server/EntitySpider.java53
-rw-r--r--src/main/java/net/minecraft/server/EntitySquid.java118
-rw-r--r--src/main/java/net/minecraft/server/EntityTNTPrimed.java3
-rw-r--r--src/main/java/net/minecraft/server/EntityThrownExpBottle.java2
-rw-r--r--src/main/java/net/minecraft/server/EntityTracker.java4
-rw-r--r--src/main/java/net/minecraft/server/EntityTrackerEntry.java109
-rw-r--r--src/main/java/net/minecraft/server/EntityWitch.java71
-rw-r--r--src/main/java/net/minecraft/server/EntityWither.java189
-rw-r--r--src/main/java/net/minecraft/server/EntityWitherSkull.java6
-rw-r--r--src/main/java/net/minecraft/server/EntityWolf.java201
-rw-r--r--src/main/java/net/minecraft/server/EntityZombie.java186
-rw-r--r--src/main/java/net/minecraft/server/Explosion.java10
-rw-r--r--src/main/java/net/minecraft/server/FoodMetaData.java10
-rw-r--r--src/main/java/net/minecraft/server/InventoryHorseChest.java55
-rw-r--r--src/main/java/net/minecraft/server/InventoryMerchant.java2
-rw-r--r--src/main/java/net/minecraft/server/InventorySubcontainer.java18
-rw-r--r--src/main/java/net/minecraft/server/ItemBed.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemBlock.java4
-rw-r--r--src/main/java/net/minecraft/server/ItemBoat.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemBow.java12
-rw-r--r--src/main/java/net/minecraft/server/ItemBucket.java47
-rw-r--r--src/main/java/net/minecraft/server/ItemDoor.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemDye.java25
-rw-r--r--src/main/java/net/minecraft/server/ItemFireball.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemFishingRod.java7
-rw-r--r--src/main/java/net/minecraft/server/ItemFlintAndSteel.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemFood.java37
-rw-r--r--src/main/java/net/minecraft/server/ItemHanging.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemHoe.java6
-rw-r--r--src/main/java/net/minecraft/server/ItemMinecart.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemMonsterEgg.java56
-rw-r--r--src/main/java/net/minecraft/server/ItemSeeds.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemSkull.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemSnow.java2
-rw-r--r--src/main/java/net/minecraft/server/ItemStack.java101
-rw-r--r--src/main/java/net/minecraft/server/ItemStep.java1
-rw-r--r--src/main/java/net/minecraft/server/ItemWorldMap.java8
-rw-r--r--src/main/java/net/minecraft/server/MinecraftServer.java408
-rw-r--r--src/main/java/net/minecraft/server/MobEffectList.java146
-rw-r--r--src/main/java/net/minecraft/server/MobSpawnerAbstract.java25
-rw-r--r--src/main/java/net/minecraft/server/NetworkManager.java25
-rw-r--r--src/main/java/net/minecraft/server/Packet.java103
-rw-r--r--src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java45
-rw-r--r--src/main/java/net/minecraft/server/Packet2Handshake.java24
-rw-r--r--src/main/java/net/minecraft/server/Packet3Chat.java58
-rw-r--r--src/main/java/net/minecraft/server/Packet51MapChunk.java186
-rw-r--r--src/main/java/net/minecraft/server/Packet56MapChunkBulk.java42
-rw-r--r--src/main/java/net/minecraft/server/Path.java2
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java25
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java6
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalBreed.java22
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalEatTile.java14
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java90
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalSelector.java4
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalSit.java26
-rw-r--r--src/main/java/net/minecraft/server/PathfinderGoalTarget.java91
-rw-r--r--src/main/java/net/minecraft/server/PendingConnection.java61
-rw-r--r--src/main/java/net/minecraft/server/PlayerAbilities.java8
-rw-r--r--src/main/java/net/minecraft/server/PlayerChunk.java31
-rw-r--r--src/main/java/net/minecraft/server/PlayerChunkMap.java60
-rw-r--r--src/main/java/net/minecraft/server/PlayerConnection.java141
-rw-r--r--src/main/java/net/minecraft/server/PlayerInteractManager.java13
-rw-r--r--src/main/java/net/minecraft/server/PlayerInventory.java53
-rw-r--r--src/main/java/net/minecraft/server/PlayerList.java120
-rw-r--r--src/main/java/net/minecraft/server/PortalTravelAgent.java12
-rw-r--r--src/main/java/net/minecraft/server/RecipeArmorDye.java2
-rw-r--r--src/main/java/net/minecraft/server/RecipesFurnace.java1
-rw-r--r--src/main/java/net/minecraft/server/RegionFile.java4
-rw-r--r--src/main/java/net/minecraft/server/ShapedRecipes.java2
-rw-r--r--src/main/java/net/minecraft/server/Slot.java8
-rw-r--r--src/main/java/net/minecraft/server/SlotFurnaceResult.java2
-rw-r--r--src/main/java/net/minecraft/server/SpawnerCreature.java57
-rw-r--r--src/main/java/net/minecraft/server/ThreadLoginVerifier.java4
-rw-r--r--src/main/java/net/minecraft/server/TileEntity.java8
-rw-r--r--src/main/java/net/minecraft/server/TileEntityBeacon.java2
-rw-r--r--src/main/java/net/minecraft/server/TileEntityBrewingStand.java13
-rw-r--r--src/main/java/net/minecraft/server/TileEntityChest.java2
-rw-r--r--src/main/java/net/minecraft/server/TileEntityCommand.java18
-rw-r--r--src/main/java/net/minecraft/server/TileEntityFurnace.java15
-rw-r--r--src/main/java/net/minecraft/server/TileEntityHopper.java16
-rw-r--r--src/main/java/net/minecraft/server/TileEntityNote.java4
-rw-r--r--src/main/java/net/minecraft/server/Vec3DPool.java8
-rw-r--r--src/main/java/net/minecraft/server/Village.java10
-rw-r--r--src/main/java/net/minecraft/server/VillageSiege.java5
-rw-r--r--src/main/java/net/minecraft/server/World.java95
-rw-r--r--src/main/java/net/minecraft/server/WorldGenBigTree.java2
-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/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/WorldGenerator.java1
-rw-r--r--src/main/java/net/minecraft/server/WorldMap.java8
-rw-r--r--src/main/java/net/minecraft/server/WorldMapHumanTracker.java5
-rw-r--r--src/main/java/net/minecraft/server/WorldNBTStorage.java10
-rw-r--r--src/main/java/net/minecraft/server/WorldServer.java105
208 files changed, 5889 insertions, 5095 deletions
diff --git a/src/main/java/net/minecraft/server/AABBPool.java b/src/main/java/net/minecraft/server/AABBPool.java
index ed6ffd36..e3b765c6 100644
--- a/src/main/java/net/minecraft/server/AABBPool.java
+++ b/src/main/java/net/minecraft/server/AABBPool.java
@@ -8,9 +8,9 @@ public class AABBPool {
private final int a;
private final int b;
private final List pool = new ArrayList();
- private int d = 0;
- private int largestSize = 0;
- private int resizeTime = 0;
+ private int d;
+ private int largestSize;
+ private int resizeTime;
public AABBPool(int i, int j) {
this.a = i;
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java
index 4392cb2d..2a85c1c1 100644
--- a/src/main/java/net/minecraft/server/Block.java
+++ b/src/main/java/net/minecraft/server/Block.java
@@ -6,188 +6,194 @@ import java.util.Random;
public class Block {
private CreativeModeTab creativeTab;
- 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);
+ protected String f;
+ public static final StepSound g = new StepSound("stone", 1.0F, 1.0F);
+ public static final StepSound h = new StepSound("wood", 1.0F, 1.0F);
+ public static final StepSound i = new StepSound("gravel", 1.0F, 1.0F);
+ public static final StepSound j = new StepSound("grass", 1.0F, 1.0F);
+ public static final StepSound k = new StepSound("stone", 1.0F, 1.0F);
+ public static final StepSound l = new StepSound("stone", 1.0F, 1.5F);
+ public static final StepSound m = new StepSoundStone("stone", 1.0F, 1.0F);
+ public static final StepSound n = new StepSound("cloth", 1.0F, 1.0F);
+ public static final StepSound o = new StepSound("sand", 1.0F, 1.0F);
+ public static final StepSound p = new StepSound("snow", 1.0F, 1.0F);
+ public static final StepSound q = new StepSoundLadder("ladder", 1.0F, 1.0F);
+ public static final StepSound r = new StepSoundAnvil("anvil", 0.3F, 1.0F);
public static final Block[] byId = new Block[4096];
- public static final boolean[] s = new boolean[4096];
+ public static final boolean[] t = new boolean[4096];
public static final int[] lightBlock = new int[4096];
- public static final boolean[] u = new boolean[4096];
+ public static final boolean[] v = new boolean[4096];
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 boolean[] x = new boolean[4096];
+ public static final Block STONE = (new BlockStone(1)).c(1.5F).b(10.0F).a(k).c("stone").d("stone");
+ public static final BlockGrass GRASS = (BlockGrass) (new BlockGrass(2)).c(0.6F).a(j).c("grass").d("grass");
+ public static final Block DIRT = (new BlockDirt(3)).c(0.5F).a(i).c("dirt").d("dirt");
+ public static final Block COBBLESTONE = (new Block(4, Material.STONE)).c(2.0F).b(10.0F).a(k).c("stonebrick").a(CreativeModeTab.b).d("cobblestone");
+ public static final Block WOOD = (new BlockWood(5)).c(2.0F).b(5.0F).a(h).c("wood").d("planks");
+ public static final Block SAPLING = (new BlockSapling(6)).c(0.0F).a(j).c("sapling").d("sapling");
+ public static final Block BEDROCK = (new Block(7, Material.STONE)).r().b(6000000.0F).a(k).c("bedrock").C().a(CreativeModeTab.b).d("bedrock");
+ public static final BlockFluids WATER = (BlockFluids) (new BlockFlowing(8, Material.WATER)).c(100.0F).k(3).c("water").C().d("water_flow");
+ public static final Block STATIONARY_WATER = (new BlockStationary(9, Material.WATER)).c(100.0F).k(3).c("water").C().d("water_still");
+ public static final BlockFluids LAVA = (BlockFluids) (new BlockFlowing(10, Material.LAVA)).c(0.0F).a(1.0F).c("lava").C().d("lava_flow");
+ public static final Block STATIONARY_LAVA = (new BlockStationary(11, Material.LAVA)).c(100.0F).a(1.0F).c("lava").C().d("lava_still");
+ public static final Block SAND = (new BlockSand(12)).c(0.5F).a(o).c("sand").d("sand");
+ public static final Block GRAVEL = (new BlockGravel(13)).c(0.6F).a(i).c("gravel").d("gravel");
+ public static final Block GOLD_ORE = (new BlockOre(14)).c(3.0F).b(5.0F).a(k).c("oreGold").d("gold_ore");
+ public static final Block IRON_ORE = (new BlockOre(15)).c(3.0F).b(5.0F).a(k).c("oreIron").d("iron_ore");
+ public static final Block COAL_ORE = (new BlockOre(16)).c(3.0F).b(5.0F).a(k).c("oreCoal").d("coal_ore");
+ public static final Block LOG = (new BlockLog(17)).c(2.0F).a(h).c("log").d("log");
+ public static final BlockLeaves LEAVES = (BlockLeaves) (new BlockLeaves(18)).c(0.2F).k(1).a(j).c("leaves").d("leaves");
+ public static final Block SPONGE = (new BlockSponge(19)).c(0.6F).a(j).c("sponge").d("sponge");
+ public static final Block GLASS = (new BlockGlass(20, Material.SHATTERABLE, false)).c(0.3F).a(m).c("glass").d("glass");
+ public static final Block LAPIS_ORE = (new BlockOre(21)).c(3.0F).b(5.0F).a(k).c("oreLapis").d("lapis_ore");
+ public static final Block LAPIS_BLOCK = (new Block(22, Material.STONE)).c(3.0F).b(5.0F).a(k).c("blockLapis").a(CreativeModeTab.b).d("lapis_block");
+ public static final Block DISPENSER = (new BlockDispenser(23)).c(3.5F).a(k).c("dispenser").d("dispenser");
+ public static final Block SANDSTONE = (new BlockSandStone(24)).a(k).c(0.8F).c("sandStone").d("sandstone");
+ public static final Block NOTE_BLOCK = (new BlockNote(25)).c(0.8F).c("musicBlock").d("noteblock");
+ public static final Block BED = (new BlockBed(26)).c(0.2F).c("bed").C().d("bed");
+ public static final Block GOLDEN_RAIL = (new BlockPoweredRail(27)).c(0.7F).a(l).c("goldenRail").d("rail_golden");
+ public static final Block DETECTOR_RAIL = (new BlockMinecartDetector(28)).c(0.7F).a(l).c("detectorRail").d("rail_detector");
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 Block WEB = (new BlockWeb(30)).k(1).c(4.0F).c("web").d("web");
+ public static final BlockLongGrass LONG_GRASS = (BlockLongGrass) (new BlockLongGrass(31)).c(0.0F).a(j).c("tallgrass");
+ public static final BlockDeadBush DEAD_BUSH = (BlockDeadBush) (new BlockDeadBush(32)).c(0.0F).a(j).c("deadbush").d("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 Block WOOL = (new BlockCloth(35, Material.CLOTH)).c(0.8F).a(n).c("cloth").d("wool_colored");
public static final BlockPistonMoving PISTON_MOVING = new BlockPistonMoving(36);
- 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 BlockFlower YELLOW_FLOWER = (BlockFlower) (new BlockFlower(37)).c(0.0F).a(j).c("flower").d("flower_dandelion");
+ public static final BlockFlower RED_ROSE = (BlockFlower) (new BlockFlower(38)).c(0.0F).a(j).c("rose").d("flower_rose");
+ public static final BlockFlower BROWN_MUSHROOM = (BlockFlower) (new BlockMushroom(39)).c(0.0F).a(j).a(0.125F).c("mushroom").d("mushroom_brown");
+ public static final BlockFlower RED_MUSHROOM = (BlockFlower) (new BlockMushroom(40)).c(0.0F).a(j).c("mushroom").d("mushroom_red");
+ public static final Block GOLD_BLOCK = (new BlockOreBlock(41)).c(3.0F).b(10.0F).a(l).c("blockGold").d("gold_block");
+ public static final Block IRON_BLOCK = (new BlockOreBlock(42)).c(5.0F).b(10.0F).a(l).c("blockIron").d("iron_block");
+ public static final BlockStepAbstract DOUBLE_STEP = (BlockStepAbstract) (new BlockStep(43, true)).c(2.0F).b(10.0F).a(k).c("stoneSlab");
+ public static final BlockStepAbstract STEP = (BlockStepAbstract) (new BlockStep(44, false)).c(2.0F).b(10.0F).a(k).c("stoneSlab");
+ public static final Block BRICK = (new Block(45, Material.STONE)).c(2.0F).b(10.0F).a(k).c("brick").a(CreativeModeTab.b).d("brick");
+ public static final Block TNT = (new BlockTNT(46)).c(0.0F).a(j).c("tnt").d("tnt");
+ public static final Block BOOKSHELF = (new BlockBookshelf(47)).c(1.5F).a(h).c("bookshelf").d("bookshelf");
+ public static final Block MOSSY_COBBLESTONE = (new Block(48, Material.STONE)).c(2.0F).b(10.0F).a(k).c("stoneMoss").a(CreativeModeTab.b).d("cobblestone_mossy");
+ public static final Block OBSIDIAN = (new BlockObsidian(49)).c(50.0F).b(2000.0F).a(k).c("obsidian").d("obsidian");
+ public static final Block TORCH = (new BlockTorch(50)).c(0.0F).a(0.9375F).a(h).c("torch").d("torch_on");
+ public static final BlockFire FIRE = (BlockFire) (new BlockFire(51)).c(0.0F).a(1.0F).a(h).c("fire").C().d("fire");
+ public static final Block MOB_SPAWNER = (new BlockMobSpawner(52)).c(5.0F).a(l).c("mobSpawner").C().d("mob_spawner");
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 BlockChest CHEST = (BlockChest) (new BlockChest(54, 0)).c(2.5F).a(h).c("chest");
+ public static final BlockRedstoneWire REDSTONE_WIRE = (BlockRedstoneWire) (new BlockRedstoneWire(55)).c(0.0F).a(g).c("redstoneDust").C().d("redstone_dust");
+ public static final Block DIAMOND_ORE = (new BlockOre(56)).c(3.0F).b(5.0F).a(k).c("oreDiamond").d("diamond_ore");
+ public static final Block DIAMOND_BLOCK = (new BlockOreBlock(57)).c(5.0F).b(10.0F).a(l).c("blockDiamond").d("diamond_block");
+ public static final Block WORKBENCH = (new BlockWorkbench(58)).c(2.5F).a(h).c("workbench").d("crafting_table");
+ public static final Block CROPS = (new BlockCrops(59)).c("crops").d("wheat");
+ public static final Block SOIL = (new BlockSoil(60)).c(0.6F).a(i).c("farmland").d("farmland");
+ public static final Block FURNACE = (new BlockFurnace(61, false)).c(3.5F).a(k).c("furnace").a(CreativeModeTab.c);
+ public static final Block BURNING_FURNACE = (new BlockFurnace(62, true)).c(3.5F).a(k).a(0.875F).c("furnace");
+ public static final Block SIGN_POST = (new BlockSign(63, TileEntitySign.class, true)).c(1.0F).a(h).c("sign").C();
+ public static final Block WOODEN_DOOR = (new BlockDoor(64, Material.WOOD)).c(3.0F).a(h).c("doorWood").C().d("door_wood");
+ public static final Block LADDER = (new BlockLadder(65)).c(0.4F).a(q).c("ladder").d("ladder");
+ public static final Block RAILS = (new BlockMinecartTrack(66)).c(0.7F).a(l).c("rail").d("rail_normal");
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 WALL_SIGN = (new BlockSign(68, TileEntitySign.class, false)).c(1.0F).a(h).c("sign").C();
+ public static final Block LEVER = (new BlockLever(69)).c(0.5F).a(h).c("lever").d("lever");
+ public static final Block STONE_PLATE = (new BlockPressurePlateBinary(70, "stone", Material.STONE, EnumMobType.MOBS)).c(0.5F).a(k).c("pressurePlate");
+ public static final Block IRON_DOOR_BLOCK = (new BlockDoor(71, Material.ORE)).c(5.0F).a(l).c("doorIron").C().d("door_iron");
+ public static final Block WOOD_PLATE = (new BlockPressurePlateBinary(72, "planks_oak", Material.WOOD, EnumMobType.EVERYTHING)).c(0.5F).a(h).c("pressurePlate");
+ public static final Block REDSTONE_ORE = (new BlockRedstoneOre(73, false)).c(3.0F).b(5.0F).a(k).c("oreRedstone").a(CreativeModeTab.b).d("redstone_ore");
+ public static final Block GLOWING_REDSTONE_ORE = (new BlockRedstoneOre(74, true)).a(0.625F).c(3.0F).b(5.0F).a(k).c("oreRedstone").d("redstone_ore");
+ public static final Block REDSTONE_TORCH_OFF = (new BlockRedstoneTorch(75, false)).c(0.0F).a(h).c("notGate").d("redstone_torch_off");
+ public static final Block REDSTONE_TORCH_ON = (new BlockRedstoneTorch(76, true)).c(0.0F).a(0.5F).a(h).c("notGate").a(CreativeModeTab.d).d("redstone_torch_on");
+ public static final Block STONE_BUTTON = (new BlockStoneButton(77)).c(0.5F).a(k).c("button");
+ public static final Block SNOW = (new BlockSnow(78)).c(0.1F).a(p).c("snow").k(0).d("snow");
+ public static final Block ICE = (new BlockIce(79)).c(0.5F).k(3).a(m).c("ice").d("ice");
+ public static final Block SNOW_BLOCK = (new BlockSnowBlock(80)).c(0.2F).a(p).c("snow").d("snow");
+ public static final Block CACTUS = (new BlockCactus(81)).c(0.4F).a(n).c("cactus").d("cactus");
+ public static final Block CLAY = (new BlockClay(82)).c(0.6F).a(i).c("clay").d("clay");
+ public static final Block SUGAR_CANE_BLOCK = (new BlockReed(83)).c(0.0F).a(j).c("reeds").C().d("reeds");
+ public static final Block JUKEBOX = (new BlockJukeBox(84)).c(2.0F).b(10.0F).a(k).c("jukebox").d("jukebox");
+ public static final Block FENCE = (new BlockFence(85, "planks_oak", Material.WOOD)).c(2.0F).b(5.0F).a(h).c("fence");
+ public static final Block PUMPKIN = (new BlockPumpkin(86, false)).c(1.0F).a(h).c("pumpkin").d("pumpkin");
+ public static final Block NETHERRACK = (new BlockBloodStone(87)).c(0.4F).a(k).c("hellrock").d("netherrack");
+ public static final Block SOUL_SAND = (new BlockSlowSand(88)).c(0.5F).a(o).c("hellsand").d("soul_sand");
+ public static final Block GLOWSTONE = (new BlockLightStone(89, Material.SHATTERABLE)).c(0.3F).a(m).a(1.0F).c("lightgem").d("glowstone");
+ public static final BlockPortal PORTAL = (BlockPortal) (new BlockPortal(90)).c(-1.0F).a(m).a(0.75F).c("portal").d("portal");
+ public static final Block JACK_O_LANTERN = (new BlockPumpkin(91, true)).c(1.0F).a(h).a(1.0F).c("litpumpkin").d("pumpkin");
+ public static final Block CAKE_BLOCK = (new BlockCake(92)).c(0.5F).a(n).c("cake").C().d("cake");
+ public static final BlockRepeater DIODE_OFF = (BlockRepeater) (new BlockRepeater(93, false)).c(0.0F).a(h).c("diode").C().d("repeater_off");
+ public static final BlockRepeater DIODE_ON = (BlockRepeater) (new BlockRepeater(94, true)).c(0.0F).a(0.625F).a(h).c("diode").C().d("repeater_on");
+ public static final Block LOCKED_CHEST = (new BlockLockedChest(95)).c(0.0F).a(1.0F).a(h).c("lockedchest").b(true);
+ public static final Block TRAP_DOOR = (new BlockTrapdoor(96, Material.WOOD)).c(3.0F).a(h).c("trapdoor").C().d("trapdoor");
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 SMOOTH_BRICK = (new BlockSmoothBrick(98)).c(1.5F).b(10.0F).a(k).c("stonebricksmooth").d("stonebrick");
+ public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 0)).c(0.2F).a(h).c("mushroom").d("mushroom_block");
+ public static final Block BIG_MUSHROOM_2 = (new BlockHugeMushroom(100, Material.WOOD, 1)).c(0.2F).a(h).c("mushroom").d("mushroom_block");
+ public static final Block IRON_FENCE = (new BlockThinFence(101, "iron_bars", "iron_bars", Material.ORE, true)).c(5.0F).b(10.0F).a(l).c("fenceIron");
+ public static final Block THIN_GLASS = (new BlockThinFence(102, "glass", "glass_pane_top", Material.SHATTERABLE, false)).c(0.3F).a(m).c("thinGlass");
+ public static final Block MELON = (new BlockMelon(103)).c(1.0F).a(h).c("melon").d("melon");
+ public static final Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(h).c("pumpkinStem").d("pumpkin_stem");
+ public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(h).c("pumpkinStem").d("melon_stem");
+ public static final Block VINE = (new BlockVine(106)).c(0.2F).a(j).c("vine").d("vine");
+ public static final Block FENCE_GATE = (new BlockFenceGate(107)).c(2.0F).b(5.0F).a(h).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 BlockMycel MYCEL = (BlockMycel) (new BlockMycel(110)).c(0.6F).a(j).c("mycel").d("mycelium");
+ public static final Block WATER_LILY = (new BlockWaterLily(111)).c(0.0F).a(j).c("waterlily").d("waterlily");
+ public static final Block NETHER_BRICK = (new Block(112, Material.STONE)).c(2.0F).b(10.0F).a(k).c("netherBrick").a(CreativeModeTab.b).d("nether_brick");
+ public static final Block NETHER_FENCE = (new BlockFence(113, "nether_brick", Material.STONE)).c(2.0F).b(10.0F).a(k).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 NETHER_WART = (new BlockNetherWart(115)).c("netherStalk").d("nether_wart");
+ public static final Block ENCHANTMENT_TABLE = (new BlockEnchantmentTable(116)).c(5.0F).b(2000.0F).c("enchantmentTable").d("enchanting_table");
+ public static final Block BREWING_STAND = (new BlockBrewingStand(117)).c(0.5F).a(0.125F).c("brewingStand").d("brewing_stand");
+ public static final BlockCauldron CAULDRON = (BlockCauldron) (new BlockCauldron(118)).c(2.0F).c("cauldron").d("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(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 ENDER_PORTAL_FRAME = (new BlockEnderPortalFrame(120)).a(m).a(0.125F).c(-1.0F).c("endPortalFrame").b(6000000.0F).a(CreativeModeTab.c).d("endframe");
+ public static final Block WHITESTONE = (new Block(121, Material.STONE)).c(3.0F).b(15.0F).a(k).c("whiteStone").a(CreativeModeTab.b).d("end_stone");
+ public static final Block DRAGON_EGG = (new BlockDragonEgg(122)).c(3.0F).b(15.0F).a(k).a(0.125F).c("dragonEgg").d("dragon_egg");
+ public static final Block REDSTONE_LAMP_OFF = (new BlockRedstoneLamp(123, false)).c(0.3F).a(m).c("redstoneLight").a(CreativeModeTab.d).d("redstone_lamp_off");
+ public static final Block REDSTONE_LAMP_ON = (new BlockRedstoneLamp(124, true)).c(0.3F).a(m).c("redstoneLight").d("redstone_lamp_on");
+ public static final BlockStepAbstract WOOD_DOUBLE_STEP = (BlockStepAbstract) (new BlockWoodStep(125, true)).c(2.0F).b(5.0F).a(h).c("woodSlab");
+ public static final BlockStepAbstract WOOD_STEP = (BlockStepAbstract) (new BlockWoodStep(126, false)).c(2.0F).b(5.0F).a(h).c("woodSlab");
+ public static final Block COCOA = (new BlockCocoa(127)).c(0.2F).b(5.0F).a(h).c("cocoa").d("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 EMERALD_ORE = (new BlockOre(129)).c(3.0F).b(5.0F).a(k).c("oreEmerald").d("emerald_ore");
+ public static final Block ENDER_CHEST = (new BlockEnderChest(130)).c(22.5F).b(1000.0F).a(k).c("enderChest").a(0.5F);
+ public static final BlockTripwireHook TRIPWIRE_SOURCE = (BlockTripwireHook) (new BlockTripwireHook(131)).c("tripWireSource").d("trip_wire_source");
+ public static final Block TRIPWIRE = (new BlockTripwire(132)).c("tripWire").d("trip_wire");
+ public static final Block EMERALD_BLOCK = (new BlockOreBlock(133)).c(5.0F).b(10.0F).a(l).c("blockEmerald").d("emerald_block");
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 COMMAND = (new BlockCommand(137)).r().b(6000000.0F).c("commandBlock").d("command_block");
+ public static final BlockBeacon BEACON = (BlockBeacon) (new BlockBeacon(138)).c("beacon").a(1.0F).d("beacon");
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 FLOWER_POT = (new BlockFlowerPot(140)).c(0.0F).a(g).c("flowerPot").d("flower_pot");
+ public static final Block CARROTS = (new BlockCarrots(141)).c("carrots").d("carrots");
+ public static final Block POTATOES = (new BlockPotatoes(142)).c("potatoes").d("potatoes");
+ public static final Block WOOD_BUTTON = (new BlockWoodButton(143)).c(0.5F).a(h).c("button");
+ public static final Block SKULL = (new BlockSkull(144)).c(1.0F).a(k).c("skull").d("skull");
+ public static final Block ANVIL = (new BlockAnvil(145)).c(5.0F).a(r).b(2000.0F).c("anvil");
+ public static final Block TRAPPED_CHEST = (new BlockChest(146, 1)).c(2.5F).a(h).c("chestTrap");
+ public static final Block GOLD_PLATE = (new BlockPressurePlateWeighted(147, "gold_block", Material.ORE, 64)).c(0.5F).a(h).c("weightedPlate_light");
+ public static final Block IRON_PLATE = (new BlockPressurePlateWeighted(148, "iron_block", Material.ORE, 640)).c(0.5F).a(h).c("weightedPlate_heavy");
+ public static final BlockRedstoneComparator REDSTONE_COMPARATOR_OFF = (BlockRedstoneComparator) (new BlockRedstoneComparator(149, false)).c(0.0F).a(h).c("comparator").C().d("comparator_off");
+ public static final BlockRedstoneComparator REDSTONE_COMPARATOR_ON = (BlockRedstoneComparator) (new BlockRedstoneComparator(150, true)).c(0.0F).a(0.625F).a(h).c("comparator").C().d("comparator_on");
+ public static final BlockDaylightDetector DAYLIGHT_DETECTOR = (BlockDaylightDetector) (new BlockDaylightDetector(151)).c(0.2F).a(h).c("daylightDetector").d("daylight_detector");
+ public static final Block REDSTONE_BLOCK = (new BlockRedstone(152)).c(5.0F).b(10.0F).a(l).c("blockRedstone").d("redstone_block");
+ public static final Block QUARTZ_ORE = (new BlockOre(153)).c(3.0F).b(5.0F).a(k).c("netherquartz").d("quartz_ore");
+ public static final BlockHopper HOPPER = (BlockHopper) (new BlockHopper(154)).c(3.0F).b(8.0F).a(h).c("hopper").d("hopper");
+ public static final Block QUARTZ_BLOCK = (new BlockQuartz(155)).a(k).c(0.8F).c("quartzBlock").d("quartz_block");
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 static final Block ACTIVATOR_RAIL = (new BlockPoweredRail(157)).c(0.7F).a(l).c("activatorRail").d("rail_activator");
+ public static final Block DROPPER = (new BlockDropper(158)).c(3.5F).a(k).c("dropper").d("dropper");
+ public static final Block STAINED_HARDENED_CLAY = (new BlockCloth(159, Material.STONE)).c(1.25F).b(7.0F).a(k).c("clayHardenedStained").d("hardened_clay_stained");
+ public static final Block HAY_BLOCK = (new BlockHay(170)).c(0.5F).a(j).c("hayBlock").a(CreativeModeTab.b).d("hay_block");
+ public static final Block WOOL_CARPET = (new BlockCarpet(171)).c(0.1F).a(n).c("woolCarpet").k(0);
+ public static final Block HARDENED_CLAY = (new Block(172, Material.STONE)).c(1.25F).b(7.0F).a(k).c("clayHardened").a(CreativeModeTab.b).d("hardened_clay");
+ public static final Block COAL_BLOCK = (new Block(173, Material.STONE)).c(5.0F).b(10.0F).a(k).c("blockCoal").a(CreativeModeTab.b).d("coal_block");
public final int id;
protected float strength;
protected float durability;
- protected boolean cC = true;
- protected boolean cD = true;
- protected boolean cE;
+ protected boolean cI = true;
+ protected boolean cJ = true;
+ protected boolean cK;
protected boolean isTileEntity;
protected double minX;
protected double minY;
@@ -196,14 +202,14 @@ public class Block {
protected double maxY;
protected double maxZ;
public StepSound stepSound;
- public float cN;
+ public float cT;
public final Material material;
public float frictionFactor;
private String name;
protected Block(int i, Material material) {
- this.stepSound = f;
- this.cN = 1.0F;
+ this.stepSound = g;
+ this.cT = 1.0F;
this.frictionFactor = 0.6F;
if (byId[i] != null) {
throw new IllegalArgumentException("Slot " + i + " is already occupied by " + byId[i] + " when adding " + this);
@@ -212,9 +218,9 @@ public class Block {
byId[i] = this;
this.id = i;
this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
- s[i] = this.c();
+ t[i] = this.c();
lightBlock[i] = this.c() ? 255 : 0;
- u[i] = !material.blocksLight();
+ v[i] = !material.blocksLight();
}
}
@@ -277,12 +283,12 @@ public class Block {
}
protected Block b(boolean flag) {
- this.cE = flag;
+ this.cK = flag;
return this;
}
public boolean isTicking() {
- return this.cE;
+ return this.cK;
}
public boolean t() {
@@ -305,7 +311,7 @@ public class Block {
public void a(World world, int i, int j, int k, AxisAlignedBB axisalignedbb, List list, Entity entity) {
AxisAlignedBB axisalignedbb1 = this.b(world, i, j, k);
- if (axisalignedbb1 != null && axisalignedbb.a(axisalignedbb1)) {
+ if (axisalignedbb1 != null && axisalignedbb.b(axisalignedbb1)) {
list.add(axisalignedbb1);
}
}
@@ -587,9 +593,9 @@ public class Block {
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);
+ entityhuman.a(0.025F);
if (this.r_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
- ItemStack itemstack = this.c_(l);
+ ItemStack itemstack = this.d_(l);
if (itemstack != null) {
this.b(world, i, j, k, itemstack);
@@ -605,10 +611,10 @@ public class Block {
return this.b() && !this.isTileEntity;
}
- protected ItemStack c_(int i) {
+ protected ItemStack d_(int i) {
int j = 0;
- if (this.id >= 0 && this.id < Item.byId.length && Item.byId[this.id].m()) {
+ if (this.id >= 0 && this.id < Item.byId.length && Item.byId[this.id].n()) {
j = i;
}
@@ -644,12 +650,12 @@ public class Block {
return false;
}
- public boolean C() {
- return this.cD;
+ public boolean B() {
+ return this.cJ;
}
- protected Block D() {
- this.cD = false;
+ protected Block C() {
+ this.cJ = false;
return this;
}
@@ -698,9 +704,16 @@ public class Block {
return 0;
}
+ protected Block d(String s) {
+ this.f = s;
+ return this;
+ }
+
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");
+ Item.byId[STAINED_HARDENED_CLAY.id] = (new ItemCloth(STAINED_HARDENED_CLAY.id - 256)).b("clayHardenedStained");
+ Item.byId[WOOL_CARPET.id] = (new ItemCloth(WOOL_CARPET.id - 256)).b("woolCarpet");
+ Item.byId[LOG.id] = (new ItemMultiTexture(LOG.id - 256, LOG, BlockLog.b)).b("log");
Item.byId[WOOD.id] = (new ItemMultiTexture(WOOD.id - 256, WOOD, BlockWood.a)).b("wood");
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");
@@ -747,7 +760,7 @@ public class Block {
flag = true;
}
- if (u[i]) {
+ if (v[i]) {
flag = true;
}
@@ -755,11 +768,11 @@ public class Block {
flag = true;
}
- w[i] = flag;
+ x[i] = flag;
}
}
- u[0] = true;
+ v[0] = true;
StatisticList.b();
}
diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java
index 83cc09da..03eece78 100644
--- a/src/main/java/net/minecraft/server/BlockCactus.java
+++ b/src/main/java/net/minecraft/server/BlockCactus.java
@@ -84,17 +84,17 @@ public class BlockCactus extends Block {
org.bukkit.block.Block damager = world.getWorld().getBlockAt(i, j, k);
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
- EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, org.bukkit.event.entity.EntityDamageEvent.DamageCause.CONTACT, 1);
+ EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, org.bukkit.event.entity.EntityDamageEvent.DamageCause.CONTACT, 1D);
world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
damagee.setLastDamageCause(event);
- entity.damageEntity(DamageSource.CACTUS, event.getDamage());
+ entity.damageEntity(DamageSource.CACTUS, (float) event.getDamage());
}
return;
}
// CraftBukkit end
- entity.damageEntity(DamageSource.CACTUS, 1);
+ entity.damageEntity(DamageSource.CACTUS, 1.0F);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockCocoa.java b/src/main/java/net/minecraft/server/BlockCocoa.java
index b7007d94..2ed2bdab 100644
--- a/src/main/java/net/minecraft/server/BlockCocoa.java
+++ b/src/main/java/net/minecraft/server/BlockCocoa.java
@@ -14,7 +14,7 @@ public class BlockCocoa extends BlockDirectional {
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.setAir(i, j, k);
+ world.setTypeIdAndData(i, j, k, 0, 0, 2);
} else if (world.random.nextInt(5) == 0) {
int l = world.getData(i, j, k);
int i1 = c(l);
@@ -33,7 +33,7 @@ public class BlockCocoa extends BlockDirectional {
k += Direction.b[l];
int i1 = world.getTypeId(i, j, k);
- return i1 == Block.LOG.id && BlockLog.d(world.getData(i, j, k)) == 3;
+ return i1 == Block.LOG.id && BlockLog.f(world.getData(i, j, k)) == 3;
}
public int d() {
@@ -96,7 +96,7 @@ public class BlockCocoa extends BlockDirectional {
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.setTypeIdAndData(i, j, k, 0, 0, 2);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockCommand.java b/src/main/java/net/minecraft/server/BlockCommand.java
index c464beb9..d5b2df7e 100644
--- a/src/main/java/net/minecraft/server/BlockCommand.java
+++ b/src/main/java/net/minecraft/server/BlockCommand.java
@@ -70,14 +70,18 @@ public class BlockCommand extends BlockContainer {
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;
+ return tileentity != null && tileentity instanceof TileEntityCommand ? ((TileEntityCommand) tileentity).f() : 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());
+ tileentitycommand.b(itemstack.getName());
}
}
+
+ public int a(Random random) {
+ return 0;
+ }
}
diff --git a/src/main/java/net/minecraft/server/BlockCrops.java b/src/main/java/net/minecraft/server/BlockCrops.java
index 14a1c3bd..e157fbef 100644
--- a/src/main/java/net/minecraft/server/BlockCrops.java
+++ b/src/main/java/net/minecraft/server/BlockCrops.java
@@ -12,11 +12,11 @@ public class BlockCrops extends BlockFlower {
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(Block.i); // CraftBukkit - i -> Block.i, decompile error
- this.D();
+ this.a(j);
+ this.C();
}
- protected boolean f_(int i) {
+ protected boolean g_(int i) {
return i == Block.SOIL.id;
}
diff --git a/src/main/java/net/minecraft/server/BlockDaylightDetector.java b/src/main/java/net/minecraft/server/BlockDaylightDetector.java
index fc31262e..9a62eb7e 100644
--- a/src/main/java/net/minecraft/server/BlockDaylightDetector.java
+++ b/src/main/java/net/minecraft/server/BlockDaylightDetector.java
@@ -27,7 +27,7 @@ public class BlockDaylightDetector extends BlockContainer {
public void onPlace(World world, int i, int j, int k) {}
public void i_(World world, int i, int j, int k) {
- if (!world.worldProvider.f) {
+ if (!world.worldProvider.g) {
int l = world.getData(i, j, k);
int i1 = world.b(EnumSkyBlock.SKY, i, j, k) - world.j;
float f = world.d(1.0F);
diff --git a/src/main/java/net/minecraft/server/BlockDiodeAbstract.java b/src/main/java/net/minecraft/server/BlockDiodeAbstract.java
index 1ef8144d..6d205d91 100644
--- a/src/main/java/net/minecraft/server/BlockDiodeAbstract.java
+++ b/src/main/java/net/minecraft/server/BlockDiodeAbstract.java
@@ -109,7 +109,7 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
b0 = -2;
}
- world.a(i, j, k, this.id, this.i_(i1), b0);
+ world.a(i, j, k, this.id, this.k_(i1), b0);
}
}
}
@@ -246,10 +246,10 @@ public abstract class BlockDiodeAbstract extends BlockDirectional {
}
protected int h(int i) {
- return this.i_(i);
+ return this.k_(i);
}
- protected abstract int i_(int i);
+ protected abstract int k_(int i);
protected abstract BlockDiodeAbstract i();
diff --git a/src/main/java/net/minecraft/server/BlockDispenser.java b/src/main/java/net/minecraft/server/BlockDispenser.java
index e9c9ec59..9bf82b8f 100644
--- a/src/main/java/net/minecraft/server/BlockDispenser.java
+++ b/src/main/java/net/minecraft/server/BlockDispenser.java
@@ -30,19 +30,19 @@ public class BlockDispenser extends BlockContainer {
int k1 = world.getTypeId(i + 1, j, k);
byte b0 = 3;
- if (Block.s[l] && !Block.s[i1]) {
+ if (Block.t[l] && !Block.t[i1]) {
b0 = 3;
}
- if (Block.s[i1] && !Block.s[l]) {
+ if (Block.t[i1] && !Block.t[l]) {
b0 = 2;
}
- if (Block.s[j1] && !Block.s[k1]) {
+ if (Block.t[j1] && !Block.t[k1]) {
b0 = 5;
}
- if (Block.s[k1] && !Block.s[j1]) {
+ if (Block.t[k1] && !Block.t[j1]) {
b0 = 4;
}
@@ -167,7 +167,7 @@ public class BlockDispenser extends BlockContainer {
}
public static IPosition a(ISourceBlock isourceblock) {
- EnumFacing enumfacing = j_(isourceblock.h());
+ EnumFacing enumfacing = l_(isourceblock.h());
double d0 = isourceblock.getX() + 0.7D * (double) enumfacing.c();
double d1 = isourceblock.getY() + 0.7D * (double) enumfacing.d();
double d2 = isourceblock.getZ() + 0.7D * (double) enumfacing.e();
@@ -175,7 +175,7 @@ public class BlockDispenser extends BlockContainer {
return new Position(d0, d1, d2);
}
- public static EnumFacing j_(int i) {
+ public static EnumFacing l_(int i) {
return EnumFacing.a(i & 7);
}
diff --git a/src/main/java/net/minecraft/server/BlockDoor.java b/src/main/java/net/minecraft/server/BlockDoor.java
index fd28fa02..dea76145 100644
--- a/src/main/java/net/minecraft/server/BlockDoor.java
+++ b/src/main/java/net/minecraft/server/BlockDoor.java
@@ -6,17 +6,8 @@ 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);
- if (material == Material.ORE) {
- this.b = 2;
- } else {
- this.b = 0;
- }
-
float f = 0.5F;
float f1 = 1.0F;
diff --git a/src/main/java/net/minecraft/server/BlockDropper.java b/src/main/java/net/minecraft/server/BlockDropper.java
index 9498a039..d3dc5635 100644
--- a/src/main/java/net/minecraft/server/BlockDropper.java
+++ b/src/main/java/net/minecraft/server/BlockDropper.java
@@ -7,14 +7,14 @@ import org.bukkit.event.inventory.InventoryMoveItemEvent;
public class BlockDropper extends BlockDispenser {
- private final IDispenseBehavior cR = new DispenseBehaviorItem();
+ private final IDispenseBehavior cX = new DispenseBehaviorItem();
protected BlockDropper(int i) {
super(i);
}
protected IDispenseBehavior a(ItemStack itemstack) {
- return this.cR;
+ return this.cX;
}
public TileEntity b(World world) {
@@ -64,7 +64,7 @@ public class BlockDropper extends BlockDispenser {
itemstack1 = itemstack.cloneItemStack();
}
} else {
- itemstack1 = this.cR.a(sourceblock, itemstack);
+ itemstack1 = this.cX.a(sourceblock, itemstack);
if (itemstack1 != null && itemstack1.count == 0) {
itemstack1 = null;
}
diff --git a/src/main/java/net/minecraft/server/BlockEnderPortal.java b/src/main/java/net/minecraft/server/BlockEnderPortal.java
index 2b400236..b0d2d1e3 100644
--- a/src/main/java/net/minecraft/server/BlockEnderPortal.java
+++ b/src/main/java/net/minecraft/server/BlockEnderPortal.java
@@ -7,7 +7,7 @@ import org.bukkit.event.entity.EntityPortalEnterEvent; // CraftBukkit
public class BlockEnderPortal extends BlockContainer {
- public static boolean a = false;
+ public static boolean a;
protected BlockEnderPortal(int i, Material material) {
super(i, material);
@@ -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.c(1);
+ entity.b(1);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java
index a93beef6..f52d7845 100644
--- a/src/main/java/net/minecraft/server/BlockFire.java
+++ b/src/main/java/net/minecraft/server/BlockFire.java
@@ -34,6 +34,8 @@ public class BlockFire extends Block {
this.a(Block.LONG_GRASS.id, 60, 100);
this.a(Block.WOOL.id, 30, 60);
this.a(Block.VINE.id, 15, 100);
+ this.a(Block.COAL_BLOCK.id, 5, 5);
+ this.a(Block.HAY_BLOCK.id, 60, 20);
}
private void a(int i, int j, int k) {
@@ -77,7 +79,7 @@ public class BlockFire extends Block {
fireExtinguished(world, i, j, k); // CraftBukkit - invalid place location
}
- if (!flag && world.P() && (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))) {
+ if (!flag && world.Q() && (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);
@@ -127,7 +129,7 @@ public class BlockFire extends Block {
j2 /= 2;
}
- if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.P() || !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)) {
+ if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.Q() || !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) {
@@ -250,7 +252,7 @@ public class BlockFire extends Block {
}
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.n_(world, i, j, k)) {
+ if (world.worldProvider.dimension > 0 || world.getTypeId(i, j - 1, k) != Block.OBSIDIAN.id || !Block.PORTAL.o_(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 {
diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java
index c95e922d..a98dadad 100644
--- a/src/main/java/net/minecraft/server/BlockFlowing.java
+++ b/src/main/java/net/minecraft/server/BlockFlowing.java
@@ -9,7 +9,7 @@ import org.bukkit.event.block.BlockFromToEvent;
public class BlockFlowing extends BlockFluids {
- int a = 0;
+ int a;
boolean[] b = new boolean[4];
int[] c = new int[4];
@@ -34,64 +34,64 @@ public class BlockFlowing extends BlockFluids {
org.bukkit.block.Block source = bworld == null ? null : bworld.getBlockAt(i, j, k);
// CraftBukkit end
- int l = this.k_(world, i, j, k);
+ int l = this.l_(world, i, j, k);
byte b0 = 1;
- if (this.material == Material.LAVA && !world.worldProvider.e) {
+ if (this.material == Material.LAVA && !world.worldProvider.f) {
b0 = 2;
}
boolean flag = true;
- int i1;
+ int i1 = this.a(world);
+ int j1;
if (l > 0) {
byte b1 = -100;
this.a = 0;
- int j1 = this.d(world, i - 1, j, k, b1);
-
- j1 = this.d(world, i + 1, j, k, j1);
- j1 = this.d(world, i, j, k - 1, j1);
- j1 = this.d(world, i, j, k + 1, j1);
- i1 = j1 + b0;
- if (i1 >= 8 || j1 < 0) {
- i1 = -1;
+ int k1 = this.d(world, i - 1, j, k, b1);
+
+ k1 = this.d(world, i + 1, j, k, k1);
+ k1 = this.d(world, i, j, k - 1, k1);
+ k1 = this.d(world, i, j, k + 1, k1);
+ j1 = k1 + b0;
+ if (j1 >= 8 || k1 < 0) {
+ j1 = -1;
}
- if (this.k_(world, i, j + 1, k) >= 0) {
- int k1 = this.k_(world, i, j + 1, k);
+ if (this.l_(world, i, j + 1, k) >= 0) {
+ int l1 = this.l_(world, i, j + 1, k);
- if (k1 >= 8) {
- i1 = k1;
+ if (l1 >= 8) {
+ j1 = l1;
} else {
- i1 = k1 + 8;
+ j1 = l1 + 8;
}
}
if (this.a >= 2 && this.material == Material.WATER) {
if (world.getMaterial(i, j - 1, k).isBuildable()) {
- i1 = 0;
+ j1 = 0;
} else if (world.getMaterial(i, j - 1, k) == this.material && world.getData(i, j - 1, k) == 0) {
- i1 = 0;
+ j1 = 0;
}
}
- if (this.material == Material.LAVA && l < 8 && i1 < 8 && i1 > l && random.nextInt(4) != 0) {
- i1 = l;
- flag = false;
+ if (this.material == Material.LAVA && l < 8 && j1 < 8 && j1 > l && random.nextInt(4) != 0) {
+ i1 *= 4;
}
- if (i1 == l) {
+ if (j1 == l) {
if (flag) {
this.k(world, i, j, k);
}
} else {
- l = i1;
- if (i1 < 0) {
+ l = j1;
+ if (j1 < 0) {
world.setAir(i, j, k);
} else {
- world.setData(i, j, k, i1, 2);
- world.a(i, j, k, this.id, this.a(world));
+ world.setData(i, j, k, j1, 2);
+ world.a(i, j, k, this.id, i1);
world.applyPhysics(i, j, k, this.id);
}
}
@@ -123,12 +123,12 @@ public class BlockFlowing extends BlockFluids {
} else if (l >= 0 && (l == 0 || this.n(world, i, j - 1, k))) {
boolean[] aboolean = this.m(world, i, j, k);
- i1 = l + b0;
+ j1 = l + b0;
if (l >= 8) {
- i1 = 1;
+ j1 = 1;
}
- if (i1 >= 8) {
+ if (j1 >= 8) {
return;
}
@@ -145,7 +145,7 @@ public class BlockFlowing extends BlockFluids {
}
if (!event.isCancelled()) {
- this.flow(world, i + currentFace.getModX(), j, k + currentFace.getModZ(), i1);
+ this.flow(world, i + currentFace.getModX(), j, k + currentFace.getModZ(), j1);
}
}
index++;
@@ -279,7 +279,7 @@ public class BlockFlowing extends BlockFluids {
}
protected int d(World world, int i, int j, int k, int l) {
- int i1 = this.k_(world, i, j, k);
+ int i1 = this.l_(world, i, j, k);
if (i1 < 0) {
return l;
@@ -310,6 +310,6 @@ public class BlockFlowing extends BlockFluids {
}
public boolean l() {
- return false;
+ return true;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockIce.java b/src/main/java/net/minecraft/server/BlockIce.java
index e2259706..29563056 100644
--- a/src/main/java/net/minecraft/server/BlockIce.java
+++ b/src/main/java/net/minecraft/server/BlockIce.java
@@ -13,15 +13,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);
+ entityhuman.a(0.025F);
if (this.r_() && EnchantmentManager.hasSilkTouchEnchantment(entityhuman)) {
- ItemStack itemstack = this.c_(l);
+ ItemStack itemstack = this.d_(l);
if (itemstack != null) {
this.b(world, i, j, k, itemstack);
}
} else {
- if (world.worldProvider.e) {
+ if (world.worldProvider.f) {
world.setAir(i, j, k);
return;
}
@@ -49,7 +49,7 @@ public class BlockIce extends BlockHalfTransparant {
}
// CraftBukkit end
- if (world.worldProvider.e) {
+ if (world.worldProvider.f) {
world.setAir(i, j, k);
return;
}
diff --git a/src/main/java/net/minecraft/server/BlockLeaves.java b/src/main/java/net/minecraft/server/BlockLeaves.java
index 9e4a9200..e3a3242c 100644
--- a/src/main/java/net/minecraft/server/BlockLeaves.java
+++ b/src/main/java/net/minecraft/server/BlockLeaves.java
@@ -7,8 +7,8 @@ import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
public class BlockLeaves extends BlockTransparant {
public static final String[] a = new String[] { "oak", "spruce", "birch", "jungle"};
- 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][];
+ public static final String[][] b = new String[][] { { "leaves_oak", "leaves_spruce", "leaves_birch", "leaves_jungle"}, { "leaves_oak_opaque", "leaves_spruce_opaque", "leaves_birch_opaque", "leaves_jungle_opaque"}};
+ private IIcon[][] cX = new IIcon[2][];
int[] c;
protected BlockLeaves(int i) {
@@ -178,7 +178,7 @@ public class BlockLeaves extends BlockTransparant {
}
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
- if (!world.isStatic && entityhuman.cd() != null && entityhuman.cd().id == Item.SHEARS.id) {
+ if (!world.isStatic && entityhuman.bt() != null && entityhuman.bt().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 {
@@ -194,7 +194,7 @@ public class BlockLeaves extends BlockTransparant {
return !this.d;
}
- protected ItemStack c_(int i) {
+ protected ItemStack d_(int i) {
return new ItemStack(this.id, 1, i & 3);
}
}
diff --git a/src/main/java/net/minecraft/server/BlockMushroom.java b/src/main/java/net/minecraft/server/BlockMushroom.java
index 872ad003..796527da 100644
--- a/src/main/java/net/minecraft/server/BlockMushroom.java
+++ b/src/main/java/net/minecraft/server/BlockMushroom.java
@@ -14,11 +14,8 @@ import org.bukkit.event.world.StructureGrowEvent;
public class BlockMushroom extends BlockFlower {
- private final String a;
-
- protected BlockMushroom(int i, String s) {
+ protected BlockMushroom(int i) {
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);
@@ -68,7 +65,7 @@ public class BlockMushroom extends BlockFlower {
// CraftBukkit start
org.bukkit.World bworld = world.getWorld();
BlockState blockState = bworld.getBlockAt(i1, j1, k1).getState();
- blockState.setTypeId(this.id);
+ blockState.setTypeId(this.id); // nms: this.id, 0, 2
BlockSpreadEvent event = new BlockSpreadEvent(blockState.getBlock(), bworld.getBlockAt(sourceX, sourceY, sourceZ), blockState);
world.getServer().getPluginManager().callEvent(event);
@@ -85,15 +82,15 @@ public class BlockMushroom extends BlockFlower {
return super.canPlace(world, i, j, k) && this.f(world, i, j, k);
}
- protected boolean f_(int i) {
- return Block.s[i];
+ protected boolean g_(int i) {
+ return Block.t[i];
}
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.m(i, j, k) < 13 && this.f_(l);
+ return l == Block.MYCEL.id || world.m(i, j, k) < 13 && this.g_(l);
} else {
return false;
}
diff --git a/src/main/java/net/minecraft/server/BlockNetherWart.java b/src/main/java/net/minecraft/server/BlockNetherWart.java
index 1a87122e..e90a5881 100644
--- a/src/main/java/net/minecraft/server/BlockNetherWart.java
+++ b/src/main/java/net/minecraft/server/BlockNetherWart.java
@@ -4,8 +4,6 @@ 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);
this.b(true);
@@ -15,12 +13,12 @@ public class BlockNetherWart extends BlockFlower {
this.a((CreativeModeTab) null);
}
- protected boolean f_(int i) {
+ protected boolean g_(int i) {
return i == Block.SOUL_SAND.id;
}
public boolean f(World world, int i, int j, int k) {
- return this.f_(world.getTypeId(i, j - 1, k));
+ return this.g_(world.getTypeId(i, j - 1, k));
}
public void a(World world, int i, int j, int k, Random random) {
diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java
index cbafd17c..2d9e7669 100644
--- a/src/main/java/net/minecraft/server/BlockPiston.java
+++ b/src/main/java/net/minecraft/server/BlockPiston.java
@@ -15,7 +15,7 @@ public class BlockPiston extends Block {
public BlockPiston(int i, boolean flag) {
super(i, Material.PISTON);
this.a = flag;
- this.a(j);
+ this.a(k);
this.c(0.5F);
this.a(CreativeModeTab.d);
}
@@ -173,6 +173,8 @@ public class BlockPiston extends Block {
int l = iblockaccess.getData(i, j, k);
if (e(l)) {
+ float f = 0.25F;
+
switch (d(l)) {
case 0:
this.a(0.0F, 0.25F, 0.0F, 1.0F, 1.0F, 1.0F);
diff --git a/src/main/java/net/minecraft/server/BlockPistonExtension.java b/src/main/java/net/minecraft/server/BlockPistonExtension.java
index b6475f72..5d3d9845 100644
--- a/src/main/java/net/minecraft/server/BlockPistonExtension.java
+++ b/src/main/java/net/minecraft/server/BlockPistonExtension.java
@@ -5,11 +5,9 @@ import java.util.Random;
public class BlockPistonExtension extends Block {
- private IIcon a = null;
-
public BlockPistonExtension(int i) {
super(i, Material.PISTON);
- this.a(j);
+ this.a(k);
this.c(0.5F);
}
@@ -58,6 +56,11 @@ 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);
+ float f = 0.25F;
+ float f1 = 0.375F;
+ float f2 = 0.625F;
+ float f3 = 0.25F;
+ float f4 = 0.75F;
switch (d(l)) {
case 0:
@@ -107,6 +110,7 @@ public class BlockPistonExtension extends Block {
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
int l = iblockaccess.getData(i, j, k);
+ float f = 0.25F;
switch (d(l)) {
case 0:
diff --git a/src/main/java/net/minecraft/server/BlockPortal.java b/src/main/java/net/minecraft/server/BlockPortal.java
index e1a91e74..1b0fd21f 100644
--- a/src/main/java/net/minecraft/server/BlockPortal.java
+++ b/src/main/java/net/minecraft/server/BlockPortal.java
@@ -60,7 +60,7 @@ public class BlockPortal extends BlockHalfTransparant {
return false;
}
- public boolean n_(World world, int i, int j, int k) {
+ public boolean o_(World world, int i, int j, int k) {
byte b0 = 0;
byte b1 = 0;
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java b/src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java
index 23fb1879..9c330f9c 100644
--- a/src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java
+++ b/src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java
@@ -13,14 +13,14 @@ public abstract class BlockPressurePlateAbstract extends Block {
this.a = s;
this.a(CreativeModeTab.d);
this.b(true);
- this.b_(this.d(15));
+ this.c_(this.d(15));
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
- this.b_(iblockaccess.getData(i, j, k));
+ this.c_(iblockaccess.getData(i, j, k));
}
- protected void b_(int i) {
+ protected void c_(int i) {
boolean flag = this.c(i) > 0;
float f = 0.0625F;
@@ -52,13 +52,13 @@ public abstract class BlockPressurePlateAbstract extends Block {
}
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));
+ return world.w(i, j - 1, k) || BlockFence.n_(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))) {
+ if (!world.w(i, j - 1, k) && !BlockFence.n_(world.getTypeId(i, j - 1, k))) {
flag = true;
}
diff --git a/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java b/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java
index 428386c5..36642b95 100644
--- a/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java
+++ b/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java
@@ -37,7 +37,7 @@ public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
list = world.a(EntityHuman.class, this.a(i, j, k));
}
- if (!list.isEmpty()) {
+ if (list != null && !list.isEmpty()) {
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
@@ -63,7 +63,7 @@ public class BlockPressurePlateBinary extends BlockPressurePlateAbstract {
}
// CraftBukkit end
- if (!entity.at()) {
+ if (!entity.as()) {
return 15;
}
}
diff --git a/src/main/java/net/minecraft/server/BlockRedstoneOre.java b/src/main/java/net/minecraft/server/BlockRedstoneOre.java
index 73eb990c..8e2a2bf0 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneOre.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneOre.java
@@ -135,7 +135,7 @@ public class BlockRedstoneOre extends Block {
}
}
- protected ItemStack c_(int i) {
+ protected ItemStack d_(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 3a560e22..f176e666 100644
--- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java
@@ -10,7 +10,7 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit
public class BlockRedstoneTorch extends BlockTorch {
- private boolean isOn = false;
+ private boolean isOn;
private static Map b = new HashMap();
private boolean a(World world, int i, int j, int k, boolean flag) {
diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java
index 3b00939f..706d6c9b 100644
--- a/src/main/java/net/minecraft/server/BlockSapling.java
+++ b/src/main/java/net/minecraft/server/BlockSapling.java
@@ -13,7 +13,6 @@ 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) {
super(i);
diff --git a/src/main/java/net/minecraft/server/BlockSkull.java b/src/main/java/net/minecraft/server/BlockSkull.java
index 7d659efc..78449b13 100644
--- a/src/main/java/net/minecraft/server/BlockSkull.java
+++ b/src/main/java/net/minecraft/server/BlockSkull.java
@@ -154,8 +154,8 @@ 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.ay = 90.0F;
- entitywither.m();
+ entitywither.aN = 90.0F;
+ entitywither.bP();
if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
blockList.updateList();
@@ -191,7 +191,7 @@ public class BlockSkull extends BlockContainer {
if (!world.isStatic) {
entitywither = new EntityWither(world);
entitywither.setPositionRotation((double) (i + i1) + 1.5D, (double) j - 1.45D, (double) k + 0.5D, 0.0F, 0.0F);
- entitywither.m();
+ entitywither.bP();
if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) {
blockList.updateList();
diff --git a/src/main/java/net/minecraft/server/BlockStem.java b/src/main/java/net/minecraft/server/BlockStem.java
index 8339a352..f2d4e578 100644
--- a/src/main/java/net/minecraft/server/BlockStem.java
+++ b/src/main/java/net/minecraft/server/BlockStem.java
@@ -18,7 +18,7 @@ public class BlockStem extends BlockFlower {
this.a((CreativeModeTab) null);
}
- protected boolean f_(int i) {
+ protected boolean g_(int i) {
return i == Block.SOIL.id;
}
diff --git a/src/main/java/net/minecraft/server/BlockTripwire.java b/src/main/java/net/minecraft/server/BlockTripwire.java
index ac7522ef..8bdbbf81 100644
--- a/src/main/java/net/minecraft/server/BlockTripwire.java
+++ b/src/main/java/net/minecraft/server/BlockTripwire.java
@@ -76,7 +76,7 @@ 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.cd() != null && entityhuman.cd().id == Item.SHEARS.id) {
+ if (entityhuman.bt() != null && entityhuman.bt().id == Item.SHEARS.id) {
world.setData(i, j, k, l | 8, 4);
}
}
@@ -140,7 +140,7 @@ public class BlockTripwire extends Block {
while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next();
- if (!entity.at()) {
+ if (!entity.as()) {
flag1 = true;
break;
}
diff --git a/src/main/java/net/minecraft/server/BlockVine.java b/src/main/java/net/minecraft/server/BlockVine.java
index 2b05ac50..66dcfbb6 100644
--- a/src/main/java/net/minecraft/server/BlockVine.java
+++ b/src/main/java/net/minecraft/server/BlockVine.java
@@ -29,65 +29,66 @@ public class BlockVine extends Block {
}
public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {
+ float f = 0.0625F;
int l = iblockaccess.getData(i, j, k);
- float f = 1.0F;
float f1 = 1.0F;
float f2 = 1.0F;
- float f3 = 0.0F;
+ float f3 = 1.0F;
float f4 = 0.0F;
float f5 = 0.0F;
+ float f6 = 0.0F;
boolean flag = l > 0;
if ((l & 2) != 0) {
- f3 = Math.max(f3, 0.0625F);
- f = 0.0F;
+ f4 = Math.max(f4, 0.0625F);
f1 = 0.0F;
- f4 = 1.0F;
f2 = 0.0F;
f5 = 1.0F;
+ f3 = 0.0F;
+ f6 = 1.0F;
flag = true;
}
if ((l & 8) != 0) {
- f = Math.min(f, 0.9375F);
- f3 = 1.0F;
- f1 = 0.0F;
+ f1 = Math.min(f1, 0.9375F);
f4 = 1.0F;
f2 = 0.0F;
f5 = 1.0F;
+ f3 = 0.0F;
+ f6 = 1.0F;
flag = true;
}
if ((l & 4) != 0) {
- f5 = Math.max(f5, 0.0625F);
- f2 = 0.0F;
- f = 0.0F;
- f3 = 1.0F;
+ f6 = Math.max(f6, 0.0625F);
+ f3 = 0.0F;
f1 = 0.0F;
f4 = 1.0F;
+ f2 = 0.0F;
+ f5 = 1.0F;
flag = true;
}
if ((l & 1) != 0) {
- f2 = Math.min(f2, 0.9375F);
- f5 = 1.0F;
- f = 0.0F;
- f3 = 1.0F;
+ f3 = Math.min(f3, 0.9375F);
+ f6 = 1.0F;
f1 = 0.0F;
f4 = 1.0F;
+ f2 = 0.0F;
+ f5 = 1.0F;
flag = true;
}
if (!flag && this.d(iblockaccess.getTypeId(i, j + 1, k))) {
- f1 = Math.min(f1, 0.9375F);
- f4 = 1.0F;
- f = 0.0F;
- f3 = 1.0F;
- f2 = 0.0F;
+ f2 = Math.min(f2, 0.9375F);
f5 = 1.0F;
+ f1 = 0.0F;
+ f4 = 1.0F;
+ f3 = 0.0F;
+ f6 = 1.0F;
}
- this.a(f, f1, f2, f3, f4, f5);
+ this.a(f1, f2, f3, f4, f5, f6);
}
public AxisAlignedBB b(World world, int i, int j, int k) {
@@ -300,7 +301,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.cd() != null && entityhuman.cd().id == Item.SHEARS.id) {
+ if (!world.isStatic && entityhuman.bt() != null && entityhuman.bt().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 7416edcf..61e56abb 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -31,24 +31,16 @@ public class Chunk {
public long n;
public boolean seenByPlayer;
public int p;
+ public long q;
private int u;
- boolean q;
public Chunk(World world, int i, int j) {
this.sections = new ChunkSection[16];
this.s = new byte[256];
this.b = new int[256];
this.c = new boolean[256];
- this.t = false;
this.tileEntities = new HashMap();
- this.done = false;
- this.l = false;
- this.m = false;
- this.n = 0L;
- this.seenByPlayer = false;
- this.p = 0;
this.u = 4096;
- this.q = false;
this.entitySlices = new List[16];
this.world = world;
this.x = i;
@@ -85,7 +77,7 @@ public class Chunk {
int k1 = j1 >> 4;
if (this.sections[k1] == null) {
- this.sections[k1] = new ChunkSection(k1 << 4, !world.worldProvider.f);
+ this.sections[k1] = new ChunkSection(k1 << 4, !world.worldProvider.g);
}
this.sections[k1].setTypeId(l, j1 & 15, i1, b0);
@@ -145,7 +137,7 @@ public class Chunk {
}
}
- if (!this.world.worldProvider.f) {
+ if (!this.world.worldProvider.g) {
l = 15;
int i1 = i + 16 - 1;
@@ -266,7 +258,7 @@ public class Chunk {
int l1;
int i2;
- if (!this.world.worldProvider.f) {
+ if (!this.world.worldProvider.g) {
ChunkSection chunksection;
if (i1 < l) {
@@ -322,7 +314,7 @@ public class Chunk {
this.p = l1;
}
- if (!this.world.worldProvider.f) {
+ if (!this.world.worldProvider.g) {
this.d(j1 - 1, k1, i2, j2);
this.d(j1 + 1, k1, i2, j2);
this.d(j1, k1 - 1, i2, j2);
@@ -380,7 +372,7 @@ public class Chunk {
return false;
}
- chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !this.world.worldProvider.f);
+ chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !this.world.worldProvider.g);
flag = j >= k1;
}
@@ -488,20 +480,20 @@ public class Chunk {
public int getBrightness(EnumSkyBlock enumskyblock, int i, int j, int k) {
ChunkSection chunksection = this.sections[j >> 4];
- return chunksection == null ? (this.d(i, j, k) ? enumskyblock.c : 0) : (enumskyblock == EnumSkyBlock.SKY ? (this.world.worldProvider.f ? 0 : chunksection.getSkyLight(i, j & 15, k)) : (enumskyblock == EnumSkyBlock.BLOCK ? chunksection.getEmittedLight(i, j & 15, k) : enumskyblock.c));
+ return chunksection == null ? (this.d(i, j, k) ? enumskyblock.c : 0) : (enumskyblock == EnumSkyBlock.SKY ? (this.world.worldProvider.g ? 0 : chunksection.getSkyLight(i, j & 15, k)) : (enumskyblock == EnumSkyBlock.BLOCK ? chunksection.getEmittedLight(i, j & 15, k) : enumskyblock.c));
}
public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l) {
ChunkSection chunksection = this.sections[j >> 4];
if (chunksection == null) {
- chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !this.world.worldProvider.f);
+ chunksection = this.sections[j >> 4] = new ChunkSection(j >> 4 << 4, !this.world.worldProvider.g);
this.initLighting();
}
this.l = true;
if (enumskyblock == EnumSkyBlock.SKY) {
- if (!this.world.worldProvider.f) {
+ if (!this.world.worldProvider.g) {
chunksection.setSkyLight(i, j & 15, k, l);
}
} else if (enumskyblock == EnumSkyBlock.BLOCK) {
@@ -513,9 +505,9 @@ public class Chunk {
ChunkSection chunksection = this.sections[j >> 4];
if (chunksection == null) {
- return !this.world.worldProvider.f && l < EnumSkyBlock.SKY.c ? EnumSkyBlock.SKY.c - l : 0;
+ return !this.world.worldProvider.g && l < EnumSkyBlock.SKY.c ? EnumSkyBlock.SKY.c - l : 0;
} else {
- int i1 = this.world.worldProvider.f ? 0 : chunksection.getSkyLight(i, j & 15, k);
+ int i1 = this.world.worldProvider.g ? 0 : chunksection.getSkyLight(i, j & 15, k);
if (i1 > 0) {
a = true;
@@ -661,6 +653,14 @@ public class Chunk {
this.world.a(this.tileEntities.values());
for (int i = 0; i < this.entitySlices.length; ++i) {
+ Iterator iterator = this.entitySlices[i].iterator();
+
+ while (iterator.hasNext()) {
+ Entity entity = (Entity) iterator.next();
+
+ entity.P();
+ }
+
this.world.a(this.entitySlices[i]);
}
}
@@ -717,14 +717,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) && (ientityselector == null || ientityselector.a(entity1))) {
+ if (entity1 != entity && entity1.boundingBox.b(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) {
list.add(entity1);
- Entity[] aentity = entity1.an();
+ Entity[] aentity = entity1.am();
if (aentity != null) {
for (int i1 = 0; i1 < aentity.length; ++i1) {
entity1 = aentity[i1];
- if (entity1 != entity && entity1.boundingBox.a(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) {
+ if (entity1 != entity && entity1.boundingBox.b(axisalignedbb) && (ientityselector == null || ientityselector.a(entity1))) {
list.add(entity1);
}
}
@@ -756,7 +756,7 @@ public class Chunk {
for (int l = 0; l < list1.size(); ++l) {
Entity entity = (Entity) list1.get(l);
- if (oclass.isAssignableFrom(entity.getClass()) && entity.boundingBox.a(axisalignedbb) && (ientityselector == null || ientityselector.a(entity))) {
+ if (oclass.isAssignableFrom(entity.getClass()) && entity.boundingBox.b(axisalignedbb) && (ientityselector == null || ientityselector.a(entity))) {
list.add(entity);
}
}
@@ -828,7 +828,7 @@ public class Chunk {
}
public void k() {
- if (this.t && !this.world.worldProvider.f) {
+ if (this.t && !this.world.worldProvider.g) {
this.q();
}
}
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
index bee715b7..8a21f359 100644
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
@@ -126,7 +126,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
public void a(World world, Chunk chunk) {
// CraftBukkit start - "handle" exception
try {
- world.F();
+ world.G();
} catch (ExceptionWorldConflict ex) {
ex.printStackTrace();
}
@@ -210,9 +210,10 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
nbttagcompound.setLong("LastUpdate", world.getTime());
nbttagcompound.setIntArray("HeightMap", chunk.heightMap);
nbttagcompound.setBoolean("TerrainPopulated", chunk.done);
+ nbttagcompound.setLong("InhabitedTime", chunk.q);
ChunkSection[] achunksection = chunk.i();
NBTTagList nbttaglist = new NBTTagList("Sections");
- boolean flag = !world.worldProvider.f;
+ boolean flag = !world.worldProvider.g;
ChunkSection[] achunksection1 = achunksection;
int i = achunksection.length;
@@ -307,10 +308,11 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader {
chunk.heightMap = nbttagcompound.getIntArray("HeightMap");
chunk.done = nbttagcompound.getBoolean("TerrainPopulated");
+ chunk.q = nbttagcompound.getLong("InhabitedTime");
NBTTagList nbttaglist = nbttagcompound.getList("Sections");
byte b0 = 16;
ChunkSection[] achunksection = new ChunkSection[b0];
- boolean flag = !world.worldProvider.f;
+ boolean flag = !world.worldProvider.g;
for (int k = 0; k < nbttaglist.size(); ++k) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(k);
diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java
index bb4c41aa..8092047f 100644
--- a/src/main/java/net/minecraft/server/Container.java
+++ b/src/main/java/net/minecraft/server/Container.java
@@ -20,10 +20,9 @@ public abstract class Container {
public List b = new ArrayList();
public List c = new ArrayList();
- public int windowId = 0;
- private short a = 0;
+ public int windowId;
private int f = -1;
- public int g = 0; // CraftBukkit - private -> public
+ public int g; // CraftBukkit - private -> public
private final Set h = new HashSet();
protected List listeners = new ArrayList();
private Set i = new HashSet();
@@ -151,7 +150,7 @@ public abstract class Container {
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;
+ int j1 = slot1.e() ? slot1.getItem().count : 0;
a(this.h, this.f, itemstack2, j1);
if (itemstack2.count > itemstack2.getMaxStackSize()) {
@@ -276,11 +275,9 @@ public abstract class Container {
k1 = slot2.a();
}
- // CraftBukkit start
if (itemstack4.count >= k1) {
slot2.set(itemstack4.a(k1));
}
- // CraftBukkit end
if (itemstack4.count == 0) {
playerinventory.setCarried((ItemStack) null);
@@ -331,7 +328,7 @@ public abstract class Container {
}
}
- slot2.e();
+ slot2.f();
}
}
} else if (k == 2 && j >= 0 && j < 9) {
@@ -346,7 +343,7 @@ public abstract class Container {
flag |= k1 > -1;
}
- if (slot2.d() && flag) {
+ if (slot2.e() && flag) {
itemstack3 = slot2.getItem();
playerinventory.setItem(j, itemstack3.cloneItemStack());
if ((slot2.inventory != playerinventory || !slot2.isAllowed(itemstack1)) && itemstack1 != null) {
@@ -361,21 +358,21 @@ public abstract class Container {
slot2.set(itemstack1);
slot2.a(entityhuman, itemstack3);
}
- } else if (!slot2.d() && itemstack1 != null && slot2.isAllowed(itemstack1)) {
+ } else if (!slot2.e() && itemstack1 != null && slot2.isAllowed(itemstack1)) {
playerinventory.setItem(j, (ItemStack) null);
slot2.set(itemstack1);
}
}
} else if (k == 3 && entityhuman.abilities.canInstantlyBuild && playerinventory.getCarried() == null && i >= 0) {
slot2 = (Slot) this.c.get(i);
- if (slot2 != null && slot2.d()) {
+ if (slot2 != null && slot2.e()) {
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() && slot2.a(entityhuman)) {
+ if (slot2 != null && slot2.e() && slot2.a(entityhuman)) {
itemstack1 = slot2.a(j == 0 ? 1 : slot2.getItem().count);
slot2.a(entityhuman, itemstack1);
entityhuman.drop(itemstack1);
@@ -383,7 +380,7 @@ public abstract class Container {
} 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))) {
+ if (itemstack1 != null && (slot2 == null || !slot2.e() || !slot2.a(entityhuman))) {
l = j == 0 ? 0 : this.c.size() - 1;
k1 = j == 0 ? 1 : -1;
@@ -391,7 +388,7 @@ public abstract class Container {
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())) {
+ if (slot3.e() && 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);
@@ -473,12 +470,12 @@ public abstract class Container {
if (l <= itemstack.getMaxStackSize()) {
itemstack.count = 0;
itemstack1.count = l;
- slot.e();
+ slot.f();
flag1 = true;
} else if (itemstack1.count < itemstack.getMaxStackSize()) {
itemstack.count -= itemstack.getMaxStackSize() - itemstack1.count;
itemstack1.count = itemstack.getMaxStackSize();
- slot.e();
+ slot.f();
flag1 = true;
}
}
@@ -503,7 +500,7 @@ public abstract class Container {
itemstack1 = slot.getItem();
if (itemstack1 == null) {
slot.set(itemstack.cloneItemStack());
- slot.e();
+ slot.f();
itemstack.count = 0;
flag1 = true;
break;
@@ -538,9 +535,9 @@ public abstract class Container {
}
public static boolean a(Slot slot, ItemStack itemstack, boolean flag) {
- boolean flag1 = slot == null || !slot.d();
+ boolean flag1 = slot == null || !slot.e();
- if (slot != null && slot.d() && itemstack != null && itemstack.doMaterialsMatch(slot.getItem()) && ItemStack.equals(slot.getItem(), itemstack)) {
+ if (slot != null && slot.e() && itemstack != null && itemstack.doMaterialsMatch(slot.getItem()) && ItemStack.equals(slot.getItem(), itemstack)) {
int i = flag ? 0 : itemstack.count;
flag1 |= slot.getItem().count + i <= itemstack.getMaxStackSize();
diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java
index d7cee91d..9b73555c 100644
--- a/src/main/java/net/minecraft/server/ContainerAnvil.java
+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java
@@ -3,6 +3,8 @@ package net.minecraft.server;
import java.util.Iterator;
import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+
import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit
public class ContainerAnvil extends Container {
@@ -13,8 +15,8 @@ public class ContainerAnvil extends Container {
private int i;
private int j;
private int k;
- public int a = 0;
- private int l = 0;
+ public int a;
+ private int l;
private String m;
private final EntityHuman n;
// CraftBukkit start
@@ -202,7 +204,13 @@ public class ContainerAnvil extends Container {
}
}
- if (this.m != null && this.m.length() > 0 && !this.m.equalsIgnoreCase(this.n.getLocale().c(itemstack.a())) && !this.m.equals(itemstack.getName())) {
+ if (StringUtils.isBlank(this.m)) {
+ if (itemstack.hasName()) {
+ j = itemstack.g() ? 7 : itemstack.count * 5;
+ i += j;
+ itemstack1.t();
+ }
+ } else if (!this.m.equals(itemstack.getName())) {
j = itemstack.g() ? 7 : itemstack.count * 5;
i += j;
if (itemstack.hasName()) {
@@ -260,7 +268,6 @@ public class ContainerAnvil extends Container {
}
if (j == i && j > 0 && this.a >= 40) {
- // 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;
}
@@ -319,7 +326,7 @@ public class ContainerAnvil extends Container {
ItemStack itemstack = null;
Slot slot = (Slot) this.c.get(i);
- if (slot != null && slot.d()) {
+ if (slot != null && slot.e()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
@@ -340,7 +347,7 @@ public class ContainerAnvil extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.e();
+ slot.f();
}
if (itemstack1.count == itemstack.count) {
@@ -355,8 +362,14 @@ public class ContainerAnvil extends Container {
public void a(String s) {
this.m = s;
- if (this.getSlot(2).d()) {
- this.getSlot(2).getItem().c(this.m);
+ if (this.getSlot(2).e()) {
+ ItemStack itemstack = this.getSlot(2).getItem();
+
+ if (StringUtils.isBlank(s)) {
+ itemstack.t();
+ } else {
+ itemstack.c(this.m);
+ }
}
this.e();
diff --git a/src/main/java/net/minecraft/server/ContainerBeacon.java b/src/main/java/net/minecraft/server/ContainerBeacon.java
index 04ccfc1d..278b3b76 100644
--- a/src/main/java/net/minecraft/server/ContainerBeacon.java
+++ b/src/main/java/net/minecraft/server/ContainerBeacon.java
@@ -45,10 +45,6 @@ public class ContainerBeacon extends Container {
icrafting.setContainerData(this, 2, this.i);
}
- public void b() {
- super.b();
- }
-
public TileEntityBeacon e() {
return this.a;
}
@@ -62,7 +58,7 @@ public class ContainerBeacon extends Container {
ItemStack itemstack = null;
Slot slot = (Slot) this.c.get(i);
- if (slot != null && slot.d()) {
+ if (slot != null && slot.e()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
@@ -72,7 +68,7 @@ public class ContainerBeacon extends Container {
}
slot.a(itemstack1, itemstack);
- } else if (!this.f.d() && this.f.isAllowed(itemstack1) && itemstack1.count == 1) {
+ } else if (!this.f.e() && this.f.isAllowed(itemstack1) && itemstack1.count == 1) {
if (!this.a(itemstack1, 0, 1, false)) {
return null;
}
@@ -91,7 +87,7 @@ public class ContainerBeacon extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.e();
+ slot.f();
}
if (itemstack1.count == itemstack.count) {
diff --git a/src/main/java/net/minecraft/server/ContainerBrewingStand.java b/src/main/java/net/minecraft/server/ContainerBrewingStand.java
index b796ffdb..e4c2dce7 100644
--- a/src/main/java/net/minecraft/server/ContainerBrewingStand.java
+++ b/src/main/java/net/minecraft/server/ContainerBrewingStand.java
@@ -9,7 +9,7 @@ public class ContainerBrewingStand extends Container {
private TileEntityBrewingStand brewingStand;
private final Slot f;
- private int g = 0;
+ private int g;
// CraftBukkit start
private CraftInventoryView bukkitEntity = null;
private PlayerInventory player;
@@ -64,16 +64,16 @@ public class ContainerBrewingStand extends Container {
ItemStack itemstack = null;
Slot slot = (Slot) this.c.get(i);
- if (slot != null && slot.d()) {
+ if (slot != null && slot.e()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
if ((i < 0 || i > 2) && i != 3) {
- if (!this.f.d() && this.f.isAllowed(itemstack1)) {
+ if (!this.f.e() && this.f.isAllowed(itemstack1)) {
if (!this.a(itemstack1, 3, 4, false)) {
return null;
}
- } else if (SlotPotionBottle.a_(itemstack)) {
+ } else if (SlotPotionBottle.b_(itemstack)) {
if (!this.a(itemstack1, 0, 3, false)) {
return null;
}
@@ -99,7 +99,7 @@ public class ContainerBrewingStand extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.e();
+ slot.f();
}
if (itemstack1.count == itemstack.count) {
diff --git a/src/main/java/net/minecraft/server/ContainerChest.java b/src/main/java/net/minecraft/server/ContainerChest.java
index d58d955e..273e9e84 100644
--- a/src/main/java/net/minecraft/server/ContainerChest.java
+++ b/src/main/java/net/minecraft/server/ContainerChest.java
@@ -71,7 +71,7 @@ public class ContainerChest extends Container {
ItemStack itemstack = null;
Slot slot = (Slot) this.c.get(i);
- if (slot != null && slot.d()) {
+ if (slot != null && slot.e()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
@@ -86,7 +86,7 @@ public class ContainerChest extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.e();
+ slot.f();
}
}
diff --git a/src/main/java/net/minecraft/server/ContainerDispenser.java b/src/main/java/net/minecraft/server/ContainerDispenser.java
index 6a8cfd81..9cafc14e 100644
--- a/src/main/java/net/minecraft/server/ContainerDispenser.java
+++ b/src/main/java/net/minecraft/server/ContainerDispenser.java
@@ -49,7 +49,7 @@ public class ContainerDispenser extends Container {
ItemStack itemstack = null;
Slot slot = (Slot) this.c.get(i);
- if (slot != null && slot.d()) {
+ if (slot != null && slot.e()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
@@ -64,7 +64,7 @@ public class ContainerDispenser extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.e();
+ slot.f();
}
if (itemstack1.count == itemstack.count) {
diff --git a/src/main/java/net/minecraft/server/ContainerEnchantTable.java b/src/main/java/net/minecraft/server/ContainerEnchantTable.java
index 92b654ad..e231b3c6 100644
--- a/src/main/java/net/minecraft/server/ContainerEnchantTable.java
+++ b/src/main/java/net/minecraft/server/ContainerEnchantTable.java
@@ -125,7 +125,7 @@ public class ContainerEnchantTable extends Container {
// CraftBukkit start
CraftItemStack item = CraftItemStack.asCraftMirror(itemstack);
PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(player, this.getBukkitView(), this.world.getWorld().getBlockAt(this.x, this.y, this.z), item, this.costs, i);
- event.setCancelled(!itemstack.w());
+ event.setCancelled(!itemstack.x());
this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
@@ -229,7 +229,7 @@ public class ContainerEnchantTable extends Container {
ItemStack itemstack = null;
Slot slot = (Slot) this.c.get(i);
- if (slot != null && slot.d()) {
+ if (slot != null && slot.e()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
@@ -238,7 +238,7 @@ public class ContainerEnchantTable extends Container {
return null;
}
} else {
- if (((Slot) this.c.get(0)).d() || !((Slot) this.c.get(0)).isAllowed(itemstack1)) {
+ if (((Slot) this.c.get(0)).e() || !((Slot) this.c.get(0)).isAllowed(itemstack1)) {
return null;
}
@@ -254,7 +254,7 @@ public class ContainerEnchantTable extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.e();
+ slot.f();
}
if (itemstack1.count == itemstack.count) {
diff --git a/src/main/java/net/minecraft/server/ContainerFurnace.java b/src/main/java/net/minecraft/server/ContainerFurnace.java
index 5b744d9a..d9764da2 100644
--- a/src/main/java/net/minecraft/server/ContainerFurnace.java
+++ b/src/main/java/net/minecraft/server/ContainerFurnace.java
@@ -8,9 +8,9 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
public class ContainerFurnace extends Container {
private TileEntityFurnace furnace;
- private int f = 0;
- private int g = 0;
- private int h = 0;
+ private int f;
+ private int g;
+ private int h;
// CraftBukkit start
private CraftInventoryView bukkitEntity = null;
@@ -87,7 +87,7 @@ public class ContainerFurnace extends Container {
ItemStack itemstack = null;
Slot slot = (Slot) this.c.get(i);
- if (slot != null && slot.d()) {
+ if (slot != null && slot.e()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
@@ -120,7 +120,7 @@ public class ContainerFurnace extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.e();
+ slot.f();
}
if (itemstack1.count == itemstack.count) {
diff --git a/src/main/java/net/minecraft/server/ContainerHopper.java b/src/main/java/net/minecraft/server/ContainerHopper.java
index 68c3d68a..a46a3d3d 100644
--- a/src/main/java/net/minecraft/server/ContainerHopper.java
+++ b/src/main/java/net/minecraft/server/ContainerHopper.java
@@ -56,7 +56,7 @@ public class ContainerHopper extends Container {
ItemStack itemstack = null;
Slot slot = (Slot) this.c.get(i);
- if (slot != null && slot.d()) {
+ if (slot != null && slot.e()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
@@ -71,7 +71,7 @@ public class ContainerHopper extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.e();
+ slot.f();
}
}
diff --git a/src/main/java/net/minecraft/server/ContainerHorse.java b/src/main/java/net/minecraft/server/ContainerHorse.java
new file mode 100644
index 00000000..2c2ae9a9
--- /dev/null
+++ b/src/main/java/net/minecraft/server/ContainerHorse.java
@@ -0,0 +1,104 @@
+package net.minecraft.server;
+
+// CraftBukkit start
+import org.bukkit.craftbukkit.inventory.CraftInventory;
+import org.bukkit.craftbukkit.inventory.CraftInventoryView;
+import org.bukkit.inventory.InventoryView;
+// CraftBukkit end
+
+public class ContainerHorse extends Container {
+
+ private IInventory a;
+ private EntityHorse f;
+
+ // CraftBukkit start
+ org.bukkit.craftbukkit.inventory.CraftInventoryView bukkitEntity;
+ PlayerInventory player;
+
+ @Override
+ public InventoryView getBukkitView() {
+ if (bukkitEntity != null) {
+ return bukkitEntity;
+ }
+
+ CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryHorse(this.a);
+ return bukkitEntity = new CraftInventoryView(player.player.getBukkitEntity(), inventory, this);
+ }
+
+ public ContainerHorse(IInventory iinventory, IInventory iinventory1, EntityHorse entityhorse) {
+ player = (PlayerInventory) iinventory;
+ // CraftBukkit end
+ this.a = iinventory1;
+ this.f = entityhorse;
+ byte b0 = 3;
+
+ iinventory1.startOpen();
+ int i = (b0 - 4) * 18;
+
+ this.a(new SlotHorseSaddle(this, iinventory1, 0, 8, 18));
+ this.a(new SlotHorseArmor(this, iinventory1, 1, 8, 36, entityhorse));
+ int j;
+ int k;
+
+ if (entityhorse.ca()) {
+ for (j = 0; j < b0; ++j) {
+ for (k = 0; k < 5; ++k) {
+ this.a(new Slot(iinventory1, 2 + k + j * 5, 80 + k * 18, 18 + j * 18));
+ }
+ }
+ }
+
+ for (j = 0; j < 3; ++j) {
+ for (k = 0; k < 9; ++k) {
+ this.a(new Slot(iinventory, k + j * 9 + 9, 8 + k * 18, 102 + j * 18 + i));
+ }
+ }
+
+ for (j = 0; j < 9; ++j) {
+ this.a(new Slot(iinventory, j, 8 + j * 18, 160 + i));
+ }
+ }
+
+ public boolean a(EntityHuman entityhuman) {
+ return this.a.a(entityhuman) && this.f.d(entityhuman) < 8.0F;
+ }
+
+ public ItemStack b(EntityHuman entityhuman, int i) {
+ ItemStack itemstack = null;
+ Slot slot = (Slot) this.c.get(i);
+
+ if (slot != null && slot.e()) {
+ 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.getSlot(1).isAllowed(itemstack1)) {
+ if (!this.a(itemstack1, 1, 2, false)) {
+ return null;
+ }
+ } else if (this.getSlot(0).isAllowed(itemstack1)) {
+ if (!this.a(itemstack1, 0, 1, false)) {
+ return null;
+ }
+ } else if (this.a.getSize() <= 2 || !this.a(itemstack1, 2, this.a.getSize(), false)) {
+ return null;
+ }
+
+ if (itemstack1.count == 0) {
+ slot.set((ItemStack) null);
+ } else {
+ slot.f();
+ }
+ }
+
+ 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 2f256780..7424452d 100644
--- a/src/main/java/net/minecraft/server/ContainerMerchant.java
+++ b/src/main/java/net/minecraft/server/ContainerMerchant.java
@@ -72,7 +72,7 @@ public class ContainerMerchant extends Container {
ItemStack itemstack = null;
Slot slot = (Slot) this.c.get(i);
- if (slot != null && slot.d()) {
+ if (slot != null && slot.e()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
@@ -97,7 +97,7 @@ public class ContainerMerchant extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.e();
+ slot.f();
}
if (itemstack1.count == itemstack.count) {
@@ -112,7 +112,7 @@ public class ContainerMerchant extends Container {
public void b(EntityHuman entityhuman) {
super.b(entityhuman);
- this.merchant.a((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 d230ce76..48b6d90a 100644
--- a/src/main/java/net/minecraft/server/ContainerPlayer.java
+++ b/src/main/java/net/minecraft/server/ContainerPlayer.java
@@ -9,7 +9,7 @@ public class ContainerPlayer extends Container {
public InventoryCrafting craftInventory = new InventoryCrafting(this, 2, 2);
public IInventory resultInventory = new InventoryCraftResult();
- public boolean g = false;
+ public boolean g;
private final EntityHuman h;
// CraftBukkit start
private CraftInventoryView bukkitEntity = null;
@@ -87,7 +87,7 @@ public class ContainerPlayer extends Container {
ItemStack itemstack = null;
Slot slot = (Slot) this.c.get(i);
- if (slot != null && slot.d()) {
+ if (slot != null && slot.e()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
@@ -105,7 +105,7 @@ 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()).b)).d()) {
+ } else if (itemstack.getItem() instanceof ItemArmor && !((Slot) this.c.get(5 + ((ItemArmor) itemstack.getItem()).b)).e()) {
int j = 5 + ((ItemArmor) itemstack.getItem()).b;
if (!this.a(itemstack1, j, j + 1, false)) {
@@ -126,7 +126,7 @@ public class ContainerPlayer extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.e();
+ slot.f();
}
if (itemstack1.count == itemstack.count) {
diff --git a/src/main/java/net/minecraft/server/ContainerWorkbench.java b/src/main/java/net/minecraft/server/ContainerWorkbench.java
index a1d4c921..025cc625 100644
--- a/src/main/java/net/minecraft/server/ContainerWorkbench.java
+++ b/src/main/java/net/minecraft/server/ContainerWorkbench.java
@@ -89,7 +89,7 @@ public class ContainerWorkbench extends Container {
ItemStack itemstack = null;
Slot slot = (Slot) this.c.get(i);
- if (slot != null && slot.d()) {
+ if (slot != null && slot.e()) {
ItemStack itemstack1 = slot.getItem();
itemstack = itemstack1.cloneItemStack();
@@ -114,7 +114,7 @@ public class ContainerWorkbench extends Container {
if (itemstack1.count == 0) {
slot.set((ItemStack) null);
} else {
- slot.e();
+ slot.f();
}
if (itemstack1.count == itemstack.count) {
diff --git a/src/main/java/net/minecraft/server/ControllerLook.java b/src/main/java/net/minecraft/server/ControllerLook.java
index bd297b38..a4b4ba7e 100644
--- a/src/main/java/net/minecraft/server/ControllerLook.java
+++ b/src/main/java/net/minecraft/server/ControllerLook.java
@@ -4,16 +4,16 @@ import org.bukkit.craftbukkit.TrigMath; // CraftBukkit
public class ControllerLook {
- private EntityLiving a;
+ private EntityInsentient a;
private float b;
private float c;
- private boolean d = false;
+ private boolean d;
private double e;
private double f;
private double g;
- public ControllerLook(EntityLiving entityliving) {
- this.a = entityliving;
+ public ControllerLook(EntityInsentient entityinsentient) {
+ this.a = entityinsentient;
}
public void a(Entity entity, float f, float f1) {
@@ -53,20 +53,20 @@ public class ControllerLook {
// CraftBukkit end
this.a.pitch = this.a(this.a.pitch, f1, this.c);
- this.a.aA = this.a(this.a.aA, f, this.b);
+ this.a.aP = this.a(this.a.aP, f, this.b);
} else {
- this.a.aA = this.a(this.a.aA, this.a.ax, 10.0F);
+ this.a.aP = this.a(this.a.aP, this.a.aN, 10.0F);
}
- float f2 = MathHelper.g(this.a.aA - this.a.ay);
+ float f2 = MathHelper.g(this.a.aP - this.a.aN);
- if (!this.a.getNavigation().f()) {
+ if (!this.a.getNavigation().g()) {
if (f2 < -75.0F) {
- this.a.aA = this.a.ay - 75.0F;
+ this.a.aP = this.a.aN - 75.0F;
}
if (f2 > 75.0F) {
- this.a.aA = this.a.ay + 75.0F;
+ this.a.aP = this.a.aN + 75.0F;
}
}
}
diff --git a/src/main/java/net/minecraft/server/ControllerMove.java b/src/main/java/net/minecraft/server/ControllerMove.java
index 1b66c970..246c6a36 100644
--- a/src/main/java/net/minecraft/server/ControllerMove.java
+++ b/src/main/java/net/minecraft/server/ControllerMove.java
@@ -2,38 +2,38 @@ package net.minecraft.server;
public class ControllerMove {
- private EntityLiving a;
+ private EntityInsentient a;
private double b;
private double c;
private double d;
- private float e;
- private boolean f = false;
+ private double e;
+ private boolean f;
- public ControllerMove(EntityLiving entityliving) {
- this.a = entityliving;
- this.b = entityliving.locX;
- this.c = entityliving.locY;
- this.d = entityliving.locZ;
+ public ControllerMove(EntityInsentient entityinsentient) {
+ this.a = entityinsentient;
+ this.b = entityinsentient.locX;
+ this.c = entityinsentient.locY;
+ this.d = entityinsentient.locZ;
}
public boolean a() {
return this.f;
}
- public float b() {
+ public double b() {
return this.e;
}
- public void a(double d0, double d1, double d2, float f) {
+ public void a(double d0, double d1, double d2, double d3) {
this.b = d0;
this.c = d1;
this.d = d2;
- this.e = f;
+ this.e = d3;
this.f = true;
}
public void c() {
- this.a.f(0.0F);
+ this.a.n(0.0F);
if (this.f) {
this.f = false;
int i = MathHelper.floor(this.a.boundingBox.b + 0.5D);
@@ -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.bE());
+ this.a.i((float) (this.e * this.a.a(GenericAttributes.d).e()));
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 b6dc7900..146521e4 100644
--- a/src/main/java/net/minecraft/server/CraftingManager.java
+++ b/src/main/java/net/minecraft/server/CraftingManager.java
@@ -42,6 +42,8 @@ public class CraftingManager {
this.registerShapedRecipe(new ItemStack(Block.NETHER_FENCE, 6), new Object[] { "###", "###", Character.valueOf('#'), Block.NETHER_BRICK});
this.registerShapedRecipe(new ItemStack(Block.FENCE_GATE, 1), new Object[] { "#W#", "#W#", Character.valueOf('#'), Item.STICK, Character.valueOf('W'), Block.WOOD});
this.registerShapedRecipe(new ItemStack(Block.JUKEBOX, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.WOOD, Character.valueOf('X'), Item.DIAMOND});
+ this.registerShapedRecipe(new ItemStack(Item.LEASH, 2), new Object[] { "~~ ", "~O ", " ~", Character.valueOf('~'), Item.STRING, Character.valueOf('O'), Item.SLIME_BALL});
+ this.registerShapedRecipe(new ItemStack(Block.HAY_BLOCK, 1), new Object[] { "###", "###", "###", Character.valueOf('#'), Item.WHEAT});
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});
@@ -110,9 +112,10 @@ public class CraftingManager {
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});
+ this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1, 0), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.GOLD_INGOT, Character.valueOf('X'), Item.APPLE});
this.registerShapedRecipe(new ItemStack(Item.GOLDEN_APPLE, 1, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Block.GOLD_BLOCK, Character.valueOf('X'), Item.APPLE});
this.registerShapedRecipe(new ItemStack(Item.CARROT_GOLDEN, 1, 0), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.GOLD_NUGGET, Character.valueOf('X'), Item.CARROT});
+ this.registerShapedRecipe(new ItemStack(Item.SPECKLED_MELON, 1), new Object[] { "###", "#X#", "###", Character.valueOf('#'), Item.GOLD_NUGGET, Character.valueOf('X'), Item.MELON});
this.registerShapedRecipe(new ItemStack(Block.LEVER, 1), new Object[] { "X", "#", Character.valueOf('#'), Block.COBBLESTONE, Character.valueOf('X'), Item.STICK});
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});
@@ -141,7 +144,6 @@ public class CraftingManager {
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");
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/CrashReport.java b/src/main/java/net/minecraft/server/CrashReport.java
index 211b7420..9f96e461 100644
--- a/src/main/java/net/minecraft/server/CrashReport.java
+++ b/src/main/java/net/minecraft/server/CrashReport.java
@@ -18,7 +18,7 @@ public class CrashReport {
private final Throwable b;
private final CrashReportSystemDetails c = new CrashReportSystemDetails(this, "System Details");
private final List d = new ArrayList();
- private File e = null;
+ private File e;
private boolean f = true;
private StackTraceElement[] g = new StackTraceElement[0];
@@ -130,7 +130,7 @@ public class CrashReport {
return stringbuilder.toString();
}
- public boolean a(File file1, IConsoleLogManager iconsolelogmanager) {
+ public boolean a(File file1, IConsoleLogManager iconsolelogmanager) {
if (this.e != null) {
return false;
} else {
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
index 7261dc92..0ce6c49a 100644
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
@@ -19,21 +19,21 @@ import org.bukkit.event.server.ServerCommandEvent;
public class DedicatedServer extends MinecraftServer implements IMinecraftServer {
- private final List k = Collections.synchronizedList(new ArrayList());
- private final IConsoleLogManager l;
- private RemoteStatusListener m;
- private RemoteControlListener n;
+ private final List l = Collections.synchronizedList(new ArrayList());
+ private final IConsoleLogManager m;
+ private RemoteStatusListener n;
+ private RemoteControlListener o;
public PropertyManager propertyManager; // CraftBukkit - private -> public
private boolean generateStructures;
- private EnumGamemode q;
- private ServerConnection r;
- private boolean s = false;
+ private EnumGamemode r;
+ private ServerConnection s;
+ private boolean t;
// CraftBukkit start - Signature changed
public DedicatedServer(joptsimple.OptionSet options) {
super(options);
// CraftBukkit end
- this.l = new ConsoleLogManager("Minecraft-Server", (String) null, (String) null); // CraftBukkit - null last argument
+ this.m = new ConsoleLogManager("Minecraft-Server", (String) null, (String) null); // CraftBukkit - null last argument
new ThreadSleepForever(this);
}
@@ -48,18 +48,18 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
System.setErr(new PrintStream(new LoggerOutputStream(this.getLogger().getLogger(), Level.SEVERE), true));
// CraftBukkit end
- this.getLogger().info("Starting minecraft server version 1.5.2");
+ this.getLogger().info("Starting minecraft server version 1.6.1");
if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) {
this.getLogger().warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\"");
}
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");
+ if (this.K()) {
+ this.c("127.0.0.1");
} else {
this.setOnlineMode(this.propertyManager.getBoolean("online-mode", true));
- this.d(this.propertyManager.getString("server-ip", ""));
+ this.c(this.propertyManager.getString("server-ip", ""));
}
this.setSpawnAnimals(this.propertyManager.getBoolean("spawn-animals", true));
@@ -78,24 +78,24 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.generateStructures = this.propertyManager.getBoolean("generate-structures", true);
int i = this.propertyManager.getInt("gamemode", EnumGamemode.SURVIVAL.a());
- this.q = WorldSettings.a(i);
- this.getLogger().info("Default game type: " + this.q);
+ this.r = WorldSettings.a(i);
+ this.getLogger().info("Default game type: " + this.r);
InetAddress inetaddress = null;
if (this.getServerIp().length() > 0) {
inetaddress = InetAddress.getByName(this.getServerIp());
}
- if (this.G() < 0) {
+ if (this.I() < 0) {
this.setPort(this.propertyManager.getInt("server-port", 25565));
}
this.getLogger().info("Generating keypair");
this.a(MinecraftEncryption.b());
- this.getLogger().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.I());
try {
- this.r = new DedicatedServerConnection(this, inetaddress, this.G());
+ this.s = new DedicatedServerConnection(this, inetaddress, this.I());
} catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable
this.getLogger().warning("**** FAILED TO BIND TO PORT!");
this.getLogger().warning("The exception was: {0}", new Object[] { ioexception.toString()});
@@ -116,8 +116,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved from MinecraftServer constructor
long j = System.nanoTime();
- if (this.J() == null) {
- this.l(this.propertyManager.getString("level-name", "world"));
+ if (this.L() == null) {
+ this.k(this.propertyManager.getString("level-name", "world"));
}
String s = this.propertyManager.getString("level-seed", "");
@@ -147,22 +147,22 @@ 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()));
- this.getLogger().info("Preparing level \"" + this.J() + "\"");
- this.a(this.J(), this.J(), k, worldtype, s2);
+ this.getLogger().info("Preparing level \"" + this.L() + "\"");
+ this.a(this.L(), this.L(), k, worldtype, s2);
long i1 = System.nanoTime() - j;
String s3 = String.format("%.3fs", new Object[] { Double.valueOf((double) i1 / 1.0E9D)});
this.getLogger().info("Done (" + s3 + ")! For help, type \"help\" or \"?\"");
if (this.propertyManager.getBoolean("enable-query", false)) {
this.getLogger().info("Starting GS4 status listener");
- this.m = new RemoteStatusListener(this);
- this.m.a();
+ this.n = new RemoteStatusListener(this);
+ this.n.a();
}
if (this.propertyManager.getBoolean("enable-rcon", false)) {
this.getLogger().info("Starting remote control listener");
- this.n = new RemoteControlListener(this);
- this.n.a();
+ this.o = new RemoteControlListener(this);
+ this.o.a();
this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit
}
@@ -188,7 +188,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public EnumGamemode getGamemode() {
- return this.q;
+ return this.r;
}
public int getDifficulty() {
@@ -201,7 +201,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
protected void a(CrashReport crashreport) {
while (this.isRunning()) {
- this.an();
+ this.ar();
try {
Thread.sleep(10L);
@@ -218,13 +218,13 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return crashreport;
}
- protected void p() {
+ protected void r() {
System.exit(0);
}
- public void r() { // CraftBukkit - protected -> public
- super.r();
- this.an();
+ public void t() { // CraftBukkit - protected -> public
+ super.t();
+ this.ar();
}
public boolean getAllowNether() {
@@ -236,8 +236,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public void a(MojangStatisticsGenerator mojangstatisticsgenerator) {
- mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.ao().getHasWhitelist()));
- mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.ao().getWhitelisted().size()));
+ mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.as().getHasWhitelist()));
+ mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.as().getWhitelisted().size()));
super.a(mojangstatisticsgenerator);
}
@@ -246,12 +246,12 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public void issueCommand(String s, ICommandListener icommandlistener) {
- this.k.add(new ServerCommand(s, icommandlistener));
+ this.l.add(new ServerCommand(s, icommandlistener));
}
- public void an() {
- while (!this.k.isEmpty()) {
- ServerCommand servercommand = (ServerCommand) this.k.remove(0);
+ public void ar() {
+ while (!this.l.isEmpty()) {
+ ServerCommand servercommand = (ServerCommand) this.l.remove(0);
// CraftBukkit start - ServerCommand for preprocessing
ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command);
@@ -264,16 +264,16 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
}
- public boolean T() {
+ public boolean V() {
return true;
}
- public DedicatedPlayerList ao() {
+ public DedicatedPlayerList as() {
return (DedicatedPlayerList) super.getPlayerList();
}
- public ServerConnection ae() {
- return this.r;
+ public ServerConnection ag() {
+ return this.s;
}
public int a(String s, int i) {
@@ -302,13 +302,13 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
return file1 != null ? file1.getAbsolutePath() : "No settings file";
}
- public void ap() {
+ public void at() {
ServerGUI.a(this);
- this.s = true;
+ this.t = true;
}
- public boolean ag() {
- return this.s;
+ public boolean ai() {
+ return this.t;
}
public String a(EnumGamemode enumgamemode, boolean flag) {
@@ -326,9 +326,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) {
if (world.worldProvider.dimension != 0) {
return false;
- } else if (this.ao().getOPs().isEmpty()) {
+ } else if (this.as().getOPs().isEmpty()) {
return false;
- } else if (this.ao().isOp(entityhuman.name)) {
+ } else if (this.as().isOp(entityhuman.getName())) {
return false;
} else if (this.getSpawnProtection() <= 0) {
return false;
@@ -343,10 +343,14 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
}
public IConsoleLogManager getLogger() {
- return this.l;
+ return this.m;
+ }
+
+ public int k() {
+ return this.propertyManager.getInt("op-permission-level", 4);
}
public PlayerList getPlayerList() {
- return this.ao();
+ return this.as();
}
}
diff --git a/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java b/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java
index ef7e10d2..25265c0a 100644
--- a/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java
+++ b/src/main/java/net/minecraft/server/DedicatedServerConnectionThread.java
@@ -13,7 +13,7 @@ public class DedicatedServerConnectionThread extends Thread {
private final List a = Collections.synchronizedList(new ArrayList());
private final HashMap b = new HashMap();
- private int c = 0;
+ private int c;
private final ServerSocket d;
private ServerConnection e;
private final InetAddress f;
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorArmor.java b/src/main/java/net/minecraft/server/DispenseBehaviorArmor.java
index 1c50ad4f..f324d4d9 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorArmor.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorArmor.java
@@ -12,7 +12,7 @@ final class DispenseBehaviorArmor extends DispenseBehaviorItem {
DispenseBehaviorArmor() {}
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
int k = isourceblock.getBlockZ() + enumfacing.e();
@@ -22,7 +22,7 @@ final class DispenseBehaviorArmor extends DispenseBehaviorItem {
if (list.size() > 0) {
EntityLiving entityliving = (EntityLiving) list.get(0);
int l = entityliving instanceof EntityHuman ? 1 : 0;
- int i1 = EntityLiving.b(itemstack);
+ int i1 = EntityInsentient.b(itemstack);
// CraftBukkit start
ItemStack itemstack1 = itemstack.a(1);
@@ -54,7 +54,10 @@ final class DispenseBehaviorArmor extends DispenseBehaviorItem {
itemstack1.count = 1;
entityliving.setEquipment(i1 - l, itemstack1);
- entityliving.a(i1, 2.0F);
+ if (entityliving instanceof EntityInsentient) {
+ ((EntityInsentient) entityliving).a(i1, 2.0F);
+ }
+
// --itemstack.count; // CraftBukkit - handled above
return itemstack;
} else {
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorBoat.java b/src/main/java/net/minecraft/server/DispenseBehaviorBoat.java
index 8e3a8615..708cf60d 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorBoat.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorBoat.java
@@ -12,7 +12,7 @@ final class DispenseBehaviorBoat extends DispenseBehaviorItem {
DispenseBehaviorBoat() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
World world = isourceblock.k();
double d0 = isourceblock.getX() + (double) ((float) enumfacing.c() * 1.125F);
double d1 = isourceblock.getY() + (double) ((float) enumfacing.d() * 1.125F);
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java b/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java
index 54c590b6..1a58814d 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java
@@ -13,7 +13,7 @@ final class DispenseBehaviorBonemeal extends DispenseBehaviorItem {
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
if (itemstack.getData() == 15) {
- EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
World world = isourceblock.k();
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java b/src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java
index 1ed656ab..1e6d8529 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java
@@ -12,7 +12,7 @@ final class DispenseBehaviorEmptyBucket extends DispenseBehaviorItem {
DispenseBehaviorEmptyBucket() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
World world = isourceblock.k();
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java b/src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java
index 24395c3a..b8a2a78f 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java
@@ -16,7 +16,7 @@ final class DispenseBehaviorFilledBucket extends DispenseBehaviorItem {
int i = isourceblock.getBlockX();
int j = isourceblock.getBlockY();
int k = isourceblock.getBlockZ();
- EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
// CraftBukkit start
World world = isourceblock.k();
@@ -50,7 +50,7 @@ final class DispenseBehaviorFilledBucket extends DispenseBehaviorItem {
}
// CraftBukkit end
- if (itembucket.a(isourceblock.k(), (double) i, (double) j, (double) k, i + enumfacing.c(), j + enumfacing.d(), k + enumfacing.e())) {
+ if (itembucket.a(isourceblock.k(), i + enumfacing.c(), j + enumfacing.d(), k + enumfacing.e())) {
// CraftBukkit start - Handle stacked buckets
Item item = Item.BUCKET;
if (--itemstack.count == 0) {
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java b/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java
index 1cb73aac..6d428c8f 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorFireball.java
@@ -12,7 +12,7 @@ final class DispenseBehaviorFireball extends DispenseBehaviorItem {
DispenseBehaviorFireball() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
IPosition iposition = BlockDispenser.a(isourceblock);
double d0 = iposition.getX() + (double) ((float) enumfacing.c() * 0.3F);
double d1 = iposition.getY() + (double) ((float) enumfacing.c() * 0.3F);
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorFireworks.java b/src/main/java/net/minecraft/server/DispenseBehaviorFireworks.java
index 6141b441..6abc928a 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorFireworks.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorFireworks.java
@@ -10,7 +10,7 @@ final class DispenseBehaviorFireworks extends DispenseBehaviorItem {
DispenseBehaviorFireworks() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.l_(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/DispenseBehaviorFlintAndSteel.java b/src/main/java/net/minecraft/server/DispenseBehaviorFlintAndSteel.java
index 6fc910b7..d7f44fe1 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorFlintAndSteel.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorFlintAndSteel.java
@@ -12,7 +12,7 @@ final class DispenseBehaviorFlintAndSteel extends DispenseBehaviorItem {
DispenseBehaviorFlintAndSteel() {}
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
World world = isourceblock.k();
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorItem.java b/src/main/java/net/minecraft/server/DispenseBehaviorItem.java
index c3a9f36d..290b5837 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, BlockDispenser.j_(isourceblock.h()));
+ this.a(isourceblock, BlockDispenser.l_(isourceblock.h()));
return itemstack1;
}
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.l_(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 2a7b4ad3..0682194b 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorMinecart.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorMinecart.java
@@ -12,7 +12,7 @@ final class DispenseBehaviorMinecart extends DispenseBehaviorItem {
DispenseBehaviorMinecart() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
World world = isourceblock.k();
double d0 = isourceblock.getX() + (double) ((float) enumfacing.c() * 1.125F);
double d1 = isourceblock.getY() + (double) ((float) enumfacing.d() * 1.125F);
@@ -23,10 +23,10 @@ final class DispenseBehaviorMinecart extends DispenseBehaviorItem {
int l = world.getTypeId(i, j, k);
double d3;
- if (BlockMinecartTrackAbstract.d_(l)) {
+ if (BlockMinecartTrackAbstract.e_(l)) {
d3 = 0.0D;
} else {
- if (l != 0 || !BlockMinecartTrackAbstract.d_(world.getTypeId(i, j - 1, k))) {
+ if (l != 0 || !BlockMinecartTrackAbstract.e_(world.getTypeId(i, j - 1, k))) {
return this.b.a(isourceblock, itemstack);
}
@@ -63,6 +63,10 @@ final class DispenseBehaviorMinecart extends DispenseBehaviorItem {
EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), ((ItemMinecart) itemstack1.getItem()).a);
// CraftBukkit end
+ if (itemstack.hasName()) {
+ entityminecartabstract.a(itemstack.getName());
+ }
+
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 a29b550e..b3d01287 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java
@@ -10,7 +10,7 @@ final class DispenseBehaviorMonsterEgg extends DispenseBehaviorItem {
DispenseBehaviorMonsterEgg() {}
public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.l_(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 +47,7 @@ final class DispenseBehaviorMonsterEgg extends DispenseBehaviorItem {
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());
+ ((EntityInsentient) entity).setCustomName(itemstack.getName());
}
// itemstack.a(1); // Handled during event processing
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java b/src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java
index 916ce148..21948081 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 = BlockDispenser.j_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
IProjectile iprojectile = this.a(world, iposition);
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorTNT.java b/src/main/java/net/minecraft/server/DispenseBehaviorTNT.java
index 950d9e9d..affe3ec7 100644
--- a/src/main/java/net/minecraft/server/DispenseBehaviorTNT.java
+++ b/src/main/java/net/minecraft/server/DispenseBehaviorTNT.java
@@ -10,7 +10,7 @@ final class DispenseBehaviorTNT extends DispenseBehaviorItem {
DispenseBehaviorTNT() {}
protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) {
- EnumFacing enumfacing = BlockDispenser.j_(isourceblock.h());
+ EnumFacing enumfacing = BlockDispenser.l_(isourceblock.h());
World world = isourceblock.k();
int i = isourceblock.getBlockX() + enumfacing.c();
int j = isourceblock.getBlockY() + enumfacing.d();
diff --git a/src/main/java/net/minecraft/server/Enchantment.java b/src/main/java/net/minecraft/server/Enchantment.java
index fec45c46..54071dba 100644
--- a/src/main/java/net/minecraft/server/Enchantment.java
+++ b/src/main/java/net/minecraft/server/Enchantment.java
@@ -71,8 +71,8 @@ public abstract class Enchantment {
return 0;
}
- public int a(int i, EntityLiving entityliving) {
- return 0;
+ public float a(int i, EntityLiving entityliving) {
+ return 0.0F;
}
public boolean a(Enchantment enchantment) {
@@ -106,7 +106,6 @@ public abstract class Enchantment {
for (int j = 0; j < i; ++j) {
Enchantment enchantment = aenchantment[j];
-
if (enchantment != null) {
arraylist.add(enchantment);
}
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 0f7be97a..3953bc49 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -38,7 +38,7 @@ public abstract class Entity {
}
// CraftBukkit end
- private static int entityCount = 0;
+ private static int entityCount;
public int id;
public double l;
public boolean m;
@@ -108,42 +108,20 @@ public abstract class Entity {
private boolean invulnerable;
public UUID uniqueID; // CraftBukkit - private -> public
public EnumEntitySize at;
- public boolean valid = false; // CraftBukkit
+ public boolean valid; // CraftBukkit
public Entity(World world) {
this.id = entityCount++;
this.l = 1.0D;
- this.m = false;
this.boundingBox = AxisAlignedBB.a(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
- this.onGround = false;
- this.I = false;
- this.velocityChanged = false;
this.L = true;
- this.dead = false;
- this.height = 0.0F;
this.width = 0.6F;
this.length = 1.8F;
- this.Q = 0.0F;
- this.R = 0.0F;
- this.S = 0.0F;
- this.fallDistance = 0.0F;
this.c = 1;
- this.X = 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.inWater = false;
- this.noDamageTicks = 0;
this.justCreated = true;
- this.fireProof = false;
this.datawatcher = new DataWatcher();
- this.ai = false;
- this.as = 0;
- this.invulnerable = false;
this.uniqueID = UUID.randomUUID();
this.at = EnumEntitySize.SIZE_2;
this.world = world;
@@ -279,7 +257,7 @@ public abstract class Entity {
b0 = -1;
}
- this.c(b0);
+ this.b(b0);
}
this.ap = false;
@@ -324,7 +302,7 @@ public abstract class Entity {
}
} else {
if (this.fireTicks % 20 == 0) {
- this.damageEntity(DamageSource.BURN, 1);
+ this.damageEntity(DamageSource.BURN, 1.0F);
}
--this.fireTicks;
@@ -342,7 +320,6 @@ public abstract class Entity {
if (!this.world.isStatic) {
this.a(0, this.fireTicks > 0);
- this.a(2, this.vehicle != null);
}
this.justCreated = false;
@@ -363,12 +340,12 @@ public abstract class Entity {
org.bukkit.block.Block damager = null; // ((WorldServer) this.l).getWorld().getBlockAt(i, j, k);
org.bukkit.entity.Entity damagee = this.getBukkitEntity();
- EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, EntityDamageEvent.DamageCause.LAVA, 4);
+ EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, EntityDamageEvent.DamageCause.LAVA, 4D);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
damagee.setLastDamageCause(event);
- this.damageEntity(DamageSource.LAVA, event.getDamage());
+ this.damageEntity(DamageSource.LAVA, (float) event.getDamage());
}
if (this.fireTicks <= 0) {
@@ -549,7 +526,7 @@ public abstract class Entity {
d2 = d8;
AxisAlignedBB axisalignedbb1 = this.boundingBox.clone();
- this.boundingBox.c(axisalignedbb);
+ this.boundingBox.d(axisalignedbb);
list = this.world.getCubes(this, this.boundingBox.a(d6, d1, d8));
for (k = 0; k < list.size(); ++k) {
@@ -603,7 +580,7 @@ public abstract class Entity {
d0 = d10;
d1 = d11;
d2 = d12;
- this.boundingBox.c(axisalignedbb1);
+ this.boundingBox.d(axisalignedbb1);
}
}
@@ -653,7 +630,7 @@ public abstract class Entity {
}
// CraftBukkit end
- if (this.f_() && !flag && this.vehicle == null) {
+ if (this.e_() && !flag && this.vehicle == null) {
int l = MathHelper.floor(this.locX);
k = MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height);
@@ -691,7 +668,16 @@ public abstract class Entity {
}
}
- this.C();
+ try {
+ this.C();
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Checking entity tile collision");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being checked for collision");
+
+ this.a(crashreportsystemdetails);
+ throw new ReportedException(crashreport);
+ }
+
boolean flag2 = this.F();
if (this.world.e(this.boundingBox.shrink(0.001D, 0.001D, 0.001D))) {
@@ -739,7 +725,15 @@ public abstract class Entity {
int j2 = this.world.getTypeId(k1, l1, i2);
if (j2 > 0) {
- Block.byId[j2].a(this.world, k1, l1, i2, this);
+ try {
+ Block.byId[j2].a(this.world, k1, l1, i2, this);
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Colliding entity with tile");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Tile being collided with");
+
+ CrashReportSystemDetails.a(crashreportsystemdetails, k1, l1, i2, j2, this.world.getData(k1, l1, i2));
+ throw new ReportedException(crashreport);
+ }
}
}
}
@@ -762,14 +756,14 @@ public abstract class Entity {
this.world.makeSound(this, s, f, f1);
}
- protected boolean f_() {
+ protected boolean e_() {
return true;
}
protected void a(double d0, boolean flag) {
if (flag) {
if (this.fallDistance > 0.0F) {
- this.a(this.fallDistance);
+ this.b(this.fallDistance);
this.fallDistance = 0.0F;
}
} else if (d0 < 0.0D) {
@@ -781,9 +775,9 @@ public abstract class Entity {
return null;
}
- protected void burn(int i) {
+ protected void burn(float i) { // CraftBukkit - int -> float
if (!this.fireProof) {
- this.damageEntity(DamageSource.FIRE, i);
+ this.damageEntity(DamageSource.FIRE, (float) i);
}
}
@@ -791,9 +785,9 @@ public abstract class Entity {
return this.fireProof;
}
- protected void a(float f) {
+ protected void b(float f) {
if (this.passenger != null) {
- this.passenger.a(f);
+ this.passenger.b(f);
}
}
@@ -889,7 +883,7 @@ public abstract class Entity {
}
}
- public float c(float f) {
+ public float d(float f) {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locZ);
@@ -1018,7 +1012,7 @@ public abstract class Entity {
this.velocityChanged = true;
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else {
@@ -1035,10 +1029,10 @@ public abstract class Entity {
return false;
}
- public void c(Entity entity, int i) {}
+ public void b(Entity entity, int i) {}
public boolean c(NBTTagCompound nbttagcompound) {
- String s = this.P();
+ String s = this.O();
if (!this.dead && s != null) {
nbttagcompound.setString("id", s);
@@ -1050,7 +1044,7 @@ public abstract class Entity {
}
public boolean d(NBTTagCompound nbttagcompound) {
- String s = this.P();
+ String s = this.O();
if (!this.dead && s != null && this.passenger == null) {
nbttagcompound.setString("id", s);
@@ -1162,7 +1156,8 @@ public abstract class Entity {
// Reset the persistence for tamed animals
if (entity instanceof EntityTameableAnimal && !isLevelAtLeast(nbttagcompound, 2) && !nbttagcompound.getBoolean("PersistenceRequired")) {
- entity.persistent = !entity.isTypeNotPersistent();
+ EntityInsentient entityinsentient = (EntityInsentient) entity;
+ entityinsentient.persistent = !entityinsentient.isTypeNotPersistent();
}
}
// CraftBukkit end
@@ -1215,7 +1210,7 @@ public abstract class Entity {
}
}
- protected final String P() {
+ protected final String O() {
return EntityTypes.b(this);
}
@@ -1223,6 +1218,8 @@ public abstract class Entity {
protected abstract void b(NBTTagCompound nbttagcompound);
+ public void P() {}
+
protected NBTTagList a(double... adouble) {
NBTTagList nbttaglist = new NBTTagList();
double[] adouble1 = adouble;
@@ -1260,11 +1257,15 @@ public abstract class Entity {
}
public EntityItem a(ItemStack itemstack, float f) {
- EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack);
+ if (itemstack.count == 0) {
+ return null;
+ } else {
+ EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack);
- entityitem.pickupDelay = 10;
- this.world.addEntity(entityitem);
- return entityitem;
+ entityitem.pickupDelay = 10;
+ this.world.addEntity(entityitem);
+ return entityitem;
+ }
}
public boolean isAlive() {
@@ -1288,7 +1289,7 @@ public abstract class Entity {
return false;
}
- public boolean a_(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
return false;
}
@@ -1354,12 +1355,6 @@ public abstract class Entity {
public void U() {
if (this.passenger != null) {
- if (!(this.passenger instanceof EntityHuman) || !((EntityHuman) this.passenger).cg()) {
- 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.W() + this.passenger.V(), this.locZ);
}
}
@@ -1430,43 +1425,6 @@ public abstract class Entity {
}
}
- public void h(Entity entity) {
- 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) {
- if (d3 != 0.0D || d4 != 0.0D) {
- int i = (int) (this.locX + d3);
- int j = (int) (this.locZ + d4);
- AxisAlignedBB axisalignedbb = this.boundingBox.c(d3, 1.0D, d4);
-
- if (this.world.a(axisalignedbb).isEmpty()) {
- 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.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;
- }
- }
- }
- }
- }
-
- this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
- }
-
public float X() {
return 0.1F;
}
@@ -1501,11 +1459,11 @@ public abstract class Entity {
public void setEquipment(int i, ItemStack itemstack) {}
public boolean isBurning() {
- return this.fireTicks > 0 || this.f(0);
+ return !this.fireProof && (this.fireTicks > 0 || this.f(0));
}
- public boolean af() {
- return this.vehicle != null || this.f(2);
+ public boolean ae() {
+ return this.vehicle != null;
}
public boolean isSneaking() {
@@ -1573,12 +1531,12 @@ public abstract class Entity {
}
}
- EntityDamageEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDamageEvent(entitylightning, this, EntityDamageEvent.DamageCause.LIGHTNING, 5);
+ EntityDamageEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDamageEvent(entitylightning, this, EntityDamageEvent.DamageCause.LIGHTNING, 5D);
if (event.isCancelled()) {
return;
}
- this.burn(event.getDamage());
+ this.burn((float) event.getDamage());
// CraftBukkit end
++this.fireTicks;
@@ -1671,7 +1629,7 @@ public abstract class Entity {
}
}
- public void al() {
+ public void ak() {
this.K = true;
this.fallDistance = 0.0F;
}
@@ -1686,11 +1644,11 @@ public abstract class Entity {
return LocaleI18n.get("entity." + s + ".name");
}
- public Entity[] an() {
+ public Entity[] am() {
return null;
}
- public boolean i(Entity entity) {
+ public boolean h(Entity entity) {
return this == entity;
}
@@ -1698,11 +1656,11 @@ public abstract class Entity {
return 0.0F;
}
- public boolean ap() {
+ public boolean ao() {
return true;
}
- public boolean j(Entity entity) {
+ public boolean i(Entity entity) {
return false;
}
@@ -1714,7 +1672,7 @@ public abstract class Entity {
return this.invulnerable;
}
- public void k(Entity entity) {
+ public void j(Entity entity) {
this.setPositionRotation(entity.locX, entity.locY, entity.locZ, entity.yaw, entity.pitch);
}
@@ -1727,7 +1685,7 @@ public abstract class Entity {
this.as = entity.as;
}
- public void c(int i) {
+ public void b(int i) {
if (!this.world.isStatic && !this.dead) {
this.world.methodProfiler.a("changeDimension");
MinecraftServer minecraftserver = MinecraftServer.getServer();
@@ -1767,6 +1725,13 @@ public abstract class Entity {
// CraftBukkit end
this.dimension = i;
+ /* CraftBukkit start - TODO: Check if we need this
+ if (j == 1 && i == 1) {
+ worldserver1 = minecraftserver.getWorldServer(0);
+ this.dimension = 0;
+ }
+ // CraftBukkit end */
+
this.world.kill(this);
this.dead = false;
this.world.methodProfiler.a("reposition");
@@ -1782,6 +1747,14 @@ public abstract class Entity {
if (entity != null) {
entity.a(this, true);
+ /* CraftBukkit start - We need to do this...
+ if (j == 1 && i == 1) {
+ ChunkCoordinates chunkcoordinates = worldserver1.getSpawn();
+
+ chunkcoordinates.y = this.world.i(chunkcoordinates.x, chunkcoordinates.z);
+ entity.setPositionRotation((double) chunkcoordinates.x, (double) chunkcoordinates.y, (double) chunkcoordinates.z, entity.yaw, entity.pitch);
+ }
+ // CraftBukkit end */
worldserver1.addEntity(entity);
// CraftBukkit start - Forward the CraftEntity to the new entity
this.getBukkitEntity().setHandle(entity);
@@ -1805,15 +1778,15 @@ public abstract class Entity {
return true;
}
- public int ar() {
+ public int aq() {
return 3;
}
- public int as() {
+ public int ar() {
return this.as;
}
- public boolean at() {
+ public boolean as() {
return false;
}
@@ -1826,7 +1799,11 @@ public abstract class Entity {
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() {
+ public UUID getUniqueID() {
+ return this.uniqueID;
+ }
+
+ public boolean av() {
return true;
}
diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java
index fdc9167a..5ba19f3c 100644
--- a/src/main/java/net/minecraft/server/EntityAgeable.java
+++ b/src/main/java/net/minecraft/server/EntityAgeable.java
@@ -2,8 +2,8 @@ package net.minecraft.server;
public abstract class EntityAgeable extends EntityCreature {
- private float d = -1.0F;
- private float e;
+ private float bp = -1.0F;
+ private float bq;
public boolean ageLocked = false; // CraftBukkit
public EntityAgeable(World world) {
@@ -12,34 +12,38 @@ 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) {
- Class oclass = EntityTypes.a(itemstack.getData());
+ if (itemstack != null && itemstack.id == Item.MONSTER_EGG.id) {
+ if (!this.world.isStatic) {
+ Class oclass = EntityTypes.a(itemstack.getData());
- if (oclass != null && oclass.isAssignableFrom(this.getClass())) {
- EntityAgeable entityageable = this.createChild(this);
+ if (oclass != null && oclass.isAssignableFrom(this.getClass())) {
+ EntityAgeable entityageable = this.createChild(this);
- if (entityageable != null) {
- 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 (entityageable != null) {
+ 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 "infinite"
- entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
+ if (!entityhuman.abilities.canInstantlyBuild) {
+ --itemstack.count;
+ if (itemstack.count == 0) { // CraftBukkit - allow less than 0 stacks as "infinite"
+ entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
+ }
}
}
}
}
- }
- return super.a_(entityhuman);
+ return true;
+ } else {
+ return false;
+ }
}
protected void a() {
@@ -51,6 +55,17 @@ public abstract class EntityAgeable extends EntityCreature {
return this.datawatcher.getInt(12);
}
+ public void a(int i) {
+ int j = this.getAge();
+
+ j += i * 20;
+ if (j > 0) {
+ j = 0;
+ }
+
+ this.setAge(j);
+ }
+
public void setAge(int i) {
this.datawatcher.watch(12, Integer.valueOf(i));
this.a(this.isBaby());
@@ -90,20 +105,20 @@ public abstract class EntityAgeable extends EntityCreature {
}
public void a(boolean flag) {
- this.j(flag ? 0.5F : 1.0F);
+ this.a(flag ? 0.5F : 1.0F);
}
protected final void a(float f, float f1) {
- boolean flag = this.d > 0.0F;
+ boolean flag = this.bp > 0.0F;
- this.d = f;
- this.e = f1;
+ this.bp = f;
+ this.bq = f1;
if (!flag) {
- this.j(1.0F);
+ this.a(1.0F);
}
}
- private void j(float f) {
- super.a(this.d * f, this.e * f);
+ protected final void a(float f) {
+ super.a(this.bp * f, this.bq * f);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java
index f46c9209..affeca6e 100644
--- a/src/main/java/net/minecraft/server/EntityArrow.java
+++ b/src/main/java/net/minecraft/server/EntityArrow.java
@@ -12,14 +12,14 @@ public class EntityArrow extends Entity implements IProjectile {
private int d = -1;
private int e = -1;
private int f = -1;
- private int g = 0;
- private int h = 0;
- private boolean inGround = false;
- public int fromPlayer = 0;
- public int shake = 0;
+ private int g;
+ private int h;
+ private boolean inGround;
+ public int fromPlayer;
+ public int shake;
public Entity shooter;
private int j;
- private int au = 0;
+ private int au;
private double damage = 2.0D;
private int aw;
@@ -237,12 +237,12 @@ public class EntityArrow extends Entity implements IProjectile {
// CraftBukkit end
}
- // if (movingobjectposition.entity.damageEntity(damagesource, i1)) { // CraftBukkit - moved up
+ // if (movingobjectposition.entity.damageEntity(damagesource, (float) i1)) { // CraftBukkit - moved up
if (movingobjectposition.entity instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) movingobjectposition.entity;
if (!this.world.isStatic) {
- entityliving.r(entityliving.bM() + 1);
+ entityliving.m(entityliving.aQ() + 1);
}
if (this.aw > 0) {
@@ -386,7 +386,7 @@ public class EntityArrow extends Entity implements IProjectile {
EntityItem item = new EntityItem(this.world, this.locX, this.locY, this.locZ, itemstack);
PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), new org.bukkit.craftbukkit.entity.CraftItem(this.world.getServer(), this, item), 0);
- event.setCancelled(!entityhuman.canPickUpLoot);
+ // event.setCancelled(!entityhuman.canPickUpLoot); TODO
this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
@@ -409,7 +409,7 @@ public class EntityArrow extends Entity implements IProjectile {
}
}
- protected boolean f_() {
+ protected boolean e_() {
return false;
}
@@ -425,7 +425,7 @@ public class EntityArrow extends Entity implements IProjectile {
this.aw = i;
}
- public boolean ap() {
+ public boolean ao() {
return false;
}
diff --git a/src/main/java/net/minecraft/server/EntityBlaze.java b/src/main/java/net/minecraft/server/EntityBlaze.java
index 8c72066f..f9c0430c 100644
--- a/src/main/java/net/minecraft/server/EntityBlaze.java
+++ b/src/main/java/net/minecraft/server/EntityBlaze.java
@@ -2,19 +2,19 @@ package net.minecraft.server;
public class EntityBlaze extends EntityMonster {
- private float d = 0.5F;
- private int e;
- private int f;
+ private float bp = 0.5F;
+ private int bq;
+ private int br;
public EntityBlaze(World world) {
super(world);
- this.texture = "/mob/fire.png";
this.fireProof = true;
- this.be = 10;
+ this.b = 10;
}
- public int getMaxHealth() {
- return 20;
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.e).a(6.0D);
}
protected void a() {
@@ -22,35 +22,35 @@ public class EntityBlaze extends EntityMonster {
this.datawatcher.a(16, new Byte((byte) 0));
}
- protected String bb() {
+ protected String r() {
return "mob.blaze.breathe";
}
- protected String bc() {
+ protected String aK() {
return "mob.blaze.hit";
}
- protected String bd() {
+ protected String aL() {
return "mob.blaze.death";
}
- public float c(float f) {
+ public float d(float f) {
return 1.0F;
}
public void c() {
if (!this.world.isStatic) {
if (this.F()) {
- this.damageEntity(DamageSource.DROWN, 1);
+ this.damageEntity(DamageSource.DROWN, 1.0F);
}
- --this.e;
- if (this.e <= 0) {
- this.e = 100;
- this.d = 0.5F + (float) this.random.nextGaussian() * 3.0F;
+ --this.bq;
+ if (this.bq <= 0) {
+ this.bq = 100;
+ this.bp = 0.5F + (float) this.random.nextGaussian() * 3.0F;
}
- if (this.l() != null && this.l().locY + (double) this.l().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.d) {
+ if (this.bJ() != null && this.bJ().locY + (double) this.bJ().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.bp) {
this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D;
}
}
@@ -80,19 +80,19 @@ public class EntityBlaze extends EntityMonster {
double d2 = entity.locZ - this.locZ;
if (this.attackTicks == 0) {
- ++this.f;
- if (this.f == 1) {
+ ++this.br;
+ if (this.br == 1) {
this.attackTicks = 60;
this.a(true);
- } else if (this.f <= 4) {
+ } else if (this.br <= 4) {
this.attackTicks = 6;
} else {
this.attackTicks = 100;
- this.f = 0;
+ this.br = 0;
this.a(false);
}
- if (this.f > 1) {
+ if (this.br > 1) {
float f1 = MathHelper.c(f) * 0.5F;
this.world.a((EntityHuman) null, 1009, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
@@ -107,18 +107,18 @@ public class EntityBlaze extends EntityMonster {
}
this.yaw = (float) (Math.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F;
- this.b = true;
+ this.bn = true;
}
}
- protected void a(float f) {}
+ protected void b(float f) {}
protected int getLootId() {
return Item.BLAZE_ROD.id;
}
public boolean isBurning() {
- return this.m();
+ return this.bP();
}
protected void dropDeathLoot(boolean flag, int i) {
@@ -136,7 +136,7 @@ public class EntityBlaze extends EntityMonster {
}
}
- public boolean m() {
+ public boolean bP() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
@@ -155,8 +155,4 @@ public class EntityBlaze extends EntityMonster {
protected boolean i_() {
return true;
}
-
- public int c(Entity entity) {
- return 6;
- }
}
diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java
index acafa6cb..7c9b2733 100644
--- a/src/main/java/net/minecraft/server/EntityBoat.java
+++ b/src/main/java/net/minecraft/server/EntityBoat.java
@@ -53,14 +53,14 @@ public class EntityBoat extends Entity {
this.height = this.length / 2.0F;
}
- protected boolean f_() {
+ protected boolean e_() {
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(19, new Float(0.0F));
}
public AxisAlignedBB g(Entity entity) {
@@ -92,7 +92,7 @@ public class EntityBoat extends Entity {
return (double) this.length * 0.0D - 0.30000001192092896D;
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else if (!this.world.isStatic && !this.dead) {
@@ -100,7 +100,7 @@ public class EntityBoat extends Entity {
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity attacker = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
- VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, i);
+ VehicleDamageEvent event = new VehicleDamageEvent(vehicle, attacker, (double) f);
this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
@@ -109,19 +109,19 @@ public class EntityBoat extends Entity {
// i = event.getDamage(); // TODO Why don't we do this?
// CraftBukkit end
- this.h(-this.h());
- this.b(10);
- this.setDamage(this.getDamage() + i * 10);
+ this.c(-this.h());
+ this.a(10);
+ this.setDamage(this.getDamage() + f * 10.0F);
this.J();
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
- if (flag || this.getDamage() > 40) {
+ if (flag || this.getDamage() > 40.0F) {
// CraftBukkit start
VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, attacker);
this.world.getServer().getPluginManager().callEvent(destroyEvent);
if (destroyEvent.isCancelled()) {
- this.setDamage(40); // Maximize damage so this doesn't get triggered again right away
+ this.setDamage(40F); // Maximize damage so this doesn't get triggered again right away
return true;
}
// CraftBukkit end
@@ -157,12 +157,12 @@ public class EntityBoat extends Entity {
// CraftBukkit end
super.l_();
- if (this.g() > 0) {
- this.b(this.g() - 1);
+ if (this.e() > 0) {
+ this.a(this.e() - 1);
}
- if (this.getDamage() > 0) {
- this.setDamage(this.getDamage() - 1);
+ if (this.getDamage() > 0.0F) {
+ this.setDamage(this.getDamage() - 1.0F);
}
this.lastX = this.locX;
@@ -248,9 +248,14 @@ public class EntityBoat extends Entity {
this.motY += 0.007000000216066837D;
}
- if (this.passenger != null) {
- this.motX += this.passenger.motX * this.b;
- this.motZ += this.passenger.motZ * this.b;
+ if (this.passenger != null && this.passenger instanceof EntityLiving) {
+ d4 = (double) ((EntityLiving) this.passenger).bf;
+ if (d4 > 0.0D) {
+ d5 = -Math.sin((double) (this.passenger.yaw * 3.1415927F / 180.0F));
+ d10 = Math.cos((double) (this.passenger.yaw * 3.1415927F / 180.0F));
+ this.motX += d5 * this.b * 0.05000000074505806D;
+ this.motZ += d10 * this.b * 0.05000000074505806D;
+ }
}
// CraftBukkit start - Support unoccupied deceleration
else if (unoccupiedDeceleration >= 0) {
@@ -420,7 +425,7 @@ public class EntityBoat extends Entity {
protected void a(NBTTagCompound nbttagcompound) {}
- public boolean a_(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
if (this.passenger != null && this.passenger instanceof EntityHuman && this.passenger != entityhuman) {
return true;
} else {
@@ -432,23 +437,23 @@ public class EntityBoat extends Entity {
}
}
- public void setDamage(int i) {
- this.datawatcher.watch(19, Integer.valueOf(i));
+ public void setDamage(float f) {
+ this.datawatcher.watch(19, Float.valueOf(f));
}
- public int getDamage() {
- return this.datawatcher.getInt(19);
+ public float getDamage() {
+ return this.datawatcher.getFloat(19);
}
- public void b(int i) {
+ public void a(int i) {
this.datawatcher.watch(17, Integer.valueOf(i));
}
- public int g() {
+ public int e() {
return this.datawatcher.getInt(17);
}
- public void h(int i) {
+ public void c(int i) {
this.datawatcher.watch(18, Integer.valueOf(i));
}
diff --git a/src/main/java/net/minecraft/server/EntityChicken.java b/src/main/java/net/minecraft/server/EntityChicken.java
index 7d06ded2..b03f1ddb 100644
--- a/src/main/java/net/minecraft/server/EntityChicken.java
+++ b/src/main/java/net/minecraft/server/EntityChicken.java
@@ -2,80 +2,78 @@ package net.minecraft.server;
public class EntityChicken extends EntityAnimal {
- public boolean d = false;
- public float e = 0.0F;
- public float f = 0.0F;
- public float g;
- public float h;
- public float i = 1.0F;
- public int j;
+ public float bp;
+ public float bq;
+ public float br;
+ public float bs;
+ public float bt = 1.0F;
+ public int bu;
public EntityChicken(World world) {
super(world);
- this.texture = "/mob/chicken.png";
this.a(0.3F, 0.7F);
- this.j = this.random.nextInt(6000) + 6000;
- float f = 0.25F;
-
+ this.bu = this.random.nextInt(6000) + 6000;
this.goalSelector.a(0, new PathfinderGoalFloat(this));
- this.goalSelector.a(1, new PathfinderGoalPanic(this, 0.38F));
- this.goalSelector.a(2, new PathfinderGoalBreed(this, f));
- this.goalSelector.a(3, new PathfinderGoalTempt(this, 0.25F, Item.SEEDS.id, false));
- this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 0.28F));
- this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, f));
+ this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.4D));
+ this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D));
+ this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.0D, Item.SEEDS.id, false));
+ this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 1.1D));
+ this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 1.0D));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
}
- public boolean bh() {
+ public boolean bb() {
return true;
}
- public int getMaxHealth() {
- return 4;
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.a).a(4.0D);
+ this.a(GenericAttributes.d).a(0.25D);
}
public void c() {
super.c();
- this.h = this.e;
- this.g = this.f;
- this.f = (float) ((double) this.f + (double) (this.onGround ? -1 : 4) * 0.3D);
- if (this.f < 0.0F) {
- this.f = 0.0F;
+ this.bs = this.bp;
+ this.br = this.bq;
+ this.bq = (float) ((double) this.bq + (double) (this.onGround ? -1 : 4) * 0.3D);
+ if (this.bq < 0.0F) {
+ this.bq = 0.0F;
}
- if (this.f > 1.0F) {
- this.f = 1.0F;
+ if (this.bq > 1.0F) {
+ this.bq = 1.0F;
}
- if (!this.onGround && this.i < 1.0F) {
- this.i = 1.0F;
+ if (!this.onGround && this.bt < 1.0F) {
+ this.bt = 1.0F;
}
- this.i = (float) ((double) this.i * 0.9D);
+ this.bt = (float) ((double) this.bt * 0.9D);
if (!this.onGround && this.motY < 0.0D) {
this.motY *= 0.6D;
}
- this.e += this.i * 2.0F;
- if (!this.isBaby() && !this.world.isStatic && --this.j <= 0) {
+ this.bp += this.bt * 2.0F;
+ if (!this.isBaby() && !this.world.isStatic && --this.bu <= 0) {
this.makeSound("mob.chicken.plop", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
this.b(Item.EGG.id, 1);
- this.j = this.random.nextInt(6000) + 6000;
+ this.bu = this.random.nextInt(6000) + 6000;
}
}
- protected void a(float f) {}
+ protected void b(float f) {}
- protected String bb() {
+ protected String r() {
return "mob.chicken.say";
}
- protected String bc() {
+ protected String aK() {
return "mob.chicken.hurt";
}
- protected String bd() {
+ protected String aL() {
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 748f7abf..9173a0a1 100644
--- a/src/main/java/net/minecraft/server/EntityCow.java
+++ b/src/main/java/net/minecraft/server/EntityCow.java
@@ -9,36 +9,37 @@ public class EntityCow extends EntityAnimal {
public EntityCow(World world) {
super(world);
- this.texture = "/mob/cow.png";
this.a(0.9F, 1.3F);
this.getNavigation().a(true);
this.goalSelector.a(0, new PathfinderGoalFloat(this));
- this.goalSelector.a(1, new PathfinderGoalPanic(this, 0.38F));
- this.goalSelector.a(2, new PathfinderGoalBreed(this, 0.2F));
- this.goalSelector.a(3, new PathfinderGoalTempt(this, 0.25F, Item.WHEAT.id, false));
- this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 0.25F));
- this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 0.2F));
+ this.goalSelector.a(1, new PathfinderGoalPanic(this, 2.0D));
+ this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D));
+ this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.25D, Item.WHEAT.id, false));
+ this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 1.25D));
+ this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 1.0D));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this));
}
- public boolean bh() {
+ public boolean bb() {
return true;
}
- public int getMaxHealth() {
- return 10;
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.a).a(10.0D);
+ this.a(GenericAttributes.d).a(0.20000000298023224D);
}
- protected String bb() {
+ protected String r() {
return "mob.cow.say";
}
- protected String bc() {
+ protected String aK() {
return "mob.cow.hurt";
}
- protected String bd() {
+ protected String aL() {
return "mob.cow.hurt";
}
@@ -46,7 +47,7 @@ public class EntityCow extends EntityAnimal {
this.makeSound("mob.cow.step", 0.15F, 1.0F);
}
- protected float ba() {
+ protected float aW() {
return 0.4F;
}
@@ -75,10 +76,10 @@ 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) {
+ if (itemstack != null && itemstack.id == Item.BUCKET.id && !entityhuman.abilities.canInstantlyBuild) {
// CraftBukkit start - Got milk?
org.bukkit.Location loc = this.getBukkitEntity().getLocation();
org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), -1, itemstack, Item.MILK_BUCKET);
@@ -96,7 +97,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 4d91a461..052f2338 100644
--- a/src/main/java/net/minecraft/server/EntityCreature.java
+++ b/src/main/java/net/minecraft/server/EntityCreature.java
@@ -1,33 +1,43 @@
package net.minecraft.server;
+import java.util.UUID;
+
// CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.event.entity.EntityTargetEvent;
// CraftBukkit end
-public abstract class EntityCreature extends EntityLiving {
+public abstract class EntityCreature extends EntityInsentient {
+ public static final UUID h = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A");
+ public static final AttributeModifier i = (new AttributeModifier(h, "Fleeing speed bonus", 2.0D, 2)).a(false);
public PathEntity pathEntity; // CraftBukkit - private -> public
public Entity target; // CraftBukkit - protected -> public
- protected boolean b = false;
- protected int c = 0;
+ protected boolean bn;
+ protected int bo;
+ private ChunkCoordinates bq = new ChunkCoordinates(0, 0, 0);
+ private float br = -1.0F;
+ private PathfinderGoal bs = new PathfinderGoalMoveTowardsRestriction(this, 1.0D);
+ private boolean bt;
public EntityCreature(World world) {
super(world);
}
- protected boolean h() {
+ protected boolean bF() {
return false;
}
- protected void bq() {
+ protected void bh() {
this.world.methodProfiler.a("ai");
- if (this.c > 0) {
- --this.c;
+ if (this.bo > 0 && --this.bo == 0) {
+ AttributeInstance attributeinstance = this.a(GenericAttributes.d);
+
+ attributeinstance.b(i);
}
- this.b = this.h();
- float f = 16.0F;
+ this.bn = this.bF();
+ float f11 = 16.0F;
if (this.target == null) {
// CraftBukkit start
@@ -47,12 +57,12 @@ public abstract class EntityCreature extends EntityLiving {
// CraftBukkit end
if (this.target != null) {
- this.pathEntity = this.world.findPath(this, this.target, f, true, false, false, true);
+ this.pathEntity = this.world.findPath(this, this.target, f11, true, false, false, true);
}
} else if (this.target.isAlive()) {
float f1 = this.target.d((Entity) this);
- if (this.n(this.target)) {
+ if (this.o(this.target)) {
this.a(this.target, f1);
}
} else {
@@ -71,10 +81,10 @@ 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.bC < 100) {
- this.i();
+ if (!this.bn && this.target != null && (this.pathEntity == null || this.random.nextInt(20) == 0)) {
+ this.pathEntity = this.world.findPath(this, this.target, f11, true, false, false, true);
+ } else if (!this.bn && (this.pathEntity == null && this.random.nextInt(180) == 0 || this.random.nextInt(120) == 0 || this.bo > 0) && this.aV < 100) {
+ this.bG();
}
int i = MathHelper.floor(this.boundingBox.b + 0.5D);
@@ -97,7 +107,7 @@ public abstract class EntityCreature extends EntityLiving {
}
}
- this.bG = false;
+ this.bd = false;
if (vec3d != null) {
double d1 = vec3d.c - this.locX;
double d2 = vec3d.e - this.locZ;
@@ -106,7 +116,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.bE = this.bI;
+ this.bf = (float) this.a(GenericAttributes.d).e();
if (f3 > 30.0F) {
f3 = 30.0F;
}
@@ -116,19 +126,19 @@ public abstract class EntityCreature extends EntityLiving {
}
this.yaw += f3;
- if (this.b && this.target != null) {
+ if (this.bn && this.target != null) {
double d4 = this.target.locX - this.locX;
double d5 = this.target.locZ - this.locZ;
float f4 = this.yaw;
this.yaw = (float) (Math.atan2(d5, d4) * 180.0D / 3.1415927410125732D) - 90.0F;
f3 = (f4 - this.yaw + 90.0F) * 3.1415927F / 180.0F;
- this.bD = -MathHelper.sin(f3) * this.bE * 1.0F;
- this.bE = MathHelper.cos(f3) * this.bE * 1.0F;
+ this.be = -MathHelper.sin(f3) * this.bf * 1.0F;
+ this.bf = MathHelper.cos(f3) * this.bf * 1.0F;
}
if (d3 > 0.0D) {
- this.bG = true;
+ this.bd = true;
}
}
@@ -136,22 +146,22 @@ public abstract class EntityCreature extends EntityLiving {
this.a(this.target, 30.0F, 30.0F);
}
- if (this.positionChanged && !this.k()) {
- this.bG = true;
+ if (this.positionChanged && !this.bI()) {
+ this.bd = true;
}
if (this.random.nextFloat() < 0.8F && (flag || flag1)) {
- this.bG = true;
+ this.bd = true;
}
this.world.methodProfiler.b();
} else {
- super.bq();
+ super.bh();
this.pathEntity = null;
}
}
- protected void i() {
+ protected void bG() {
this.world.methodProfiler.a("stroll");
boolean flag = false;
int i = -1;
@@ -199,7 +209,7 @@ public abstract class EntityCreature extends EntityLiving {
return super.canSpawn() && this.a(i, j, k) >= 0.0F;
}
- public boolean k() {
+ public boolean bI() {
return this.pathEntity != null;
}
@@ -207,7 +217,7 @@ public abstract class EntityCreature extends EntityLiving {
this.pathEntity = pathentity;
}
- public Entity l() {
+ public Entity bJ() {
return this.target;
}
@@ -215,13 +225,79 @@ public abstract class EntityCreature extends EntityLiving {
this.target = entity;
}
- public float bE() {
- float f = super.bE();
+ public boolean bK() {
+ return this.b(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
+ }
- if (this.c > 0 && !this.bh()) {
- f *= 2.0F;
- }
+ public boolean b(int i, int j, int k) {
+ return this.br == -1.0F ? true : this.bq.e(i, j, k) < this.br * this.br;
+ }
+
+ public void b(int i, int j, int k, int l) {
+ this.bq.b(i, j, k);
+ this.br = (float) l;
+ }
+
+ public ChunkCoordinates bL() {
+ return this.bq;
+ }
+
+ public float bM() {
+ return this.br;
+ }
+
+ public void bN() {
+ this.br = -1.0F;
+ }
+
+ public boolean bO() {
+ return this.br != -1.0F;
+ }
- return f;
+ protected void bB() {
+ super.bB();
+ if (this.bD() && this.bE() != null && this.bE().world == this.world) {
+ Entity entity = this.bE();
+
+ this.b((int) entity.locX, (int) entity.locY, (int) entity.locZ, 5);
+ float f = this.d(entity);
+
+ if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
+ if (f > 10.0F) {
+ this.i(true);
+ }
+
+ return;
+ }
+
+ if (!this.bt) {
+ this.goalSelector.a(2, this.bs);
+ this.getNavigation().a(false);
+ this.bt = true;
+ }
+
+ if (f > 4.0F) {
+ this.getNavigation().a(entity, 1.0D);
+ }
+
+ if (f > 6.0F) {
+ double d0 = (entity.locX - this.locX) / (double) f;
+ double d1 = (entity.locY - this.locY) / (double) f;
+ double d2 = (entity.locZ - this.locZ) / (double) f;
+
+ this.motX += d0 * Math.abs(d0) * 0.4D;
+ this.motY += d1 * Math.abs(d1) * 0.4D;
+ this.motZ += d2 * Math.abs(d2) * 0.4D;
+ }
+
+ if (f > 10.0F) {
+ this.i(true);
+ }
+ } else if (!this.bD() && this.bt) {
+ this.bt = false;
+ this.goalSelector.a(this.bs);
+ this.getNavigation().a(true);
+ this.bN();
+ }
}
}
diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java
index 5752e267..bd02091b 100644
--- a/src/main/java/net/minecraft/server/EntityCreeper.java
+++ b/src/main/java/net/minecraft/server/EntityCreeper.java
@@ -7,7 +7,7 @@ import org.bukkit.event.entity.ExplosionPrimeEvent;
public class EntityCreeper extends EntityMonster {
- private int d;
+ private int bp;
private int fuseTicks;
private int maxFuseTicks = 30;
private int explosionRadius = 3;
@@ -15,38 +15,38 @@ public class EntityCreeper extends EntityMonster {
public EntityCreeper(World world) {
super(world);
- this.texture = "/mob/creeper.png";
this.goalSelector.a(1, new PathfinderGoalFloat(this));
this.goalSelector.a(2, new PathfinderGoalSwell(this));
- this.goalSelector.a(3, new PathfinderGoalAvoidPlayer(this, EntityOcelot.class, 6.0F, 0.25F, 0.3F));
- this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, 0.25F, false));
- this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 0.2F));
+ this.goalSelector.a(3, new PathfinderGoalAvoidPlayer(this, EntityOcelot.class, 6.0F, 1.0D, 1.2D));
+ this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, 1.0D, false));
+ this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 0.8D));
this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F));
this.goalSelector.a(6, new PathfinderGoalRandomLookaround(this));
- this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 16.0F, 0, true));
+ this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, true));
this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false));
}
- public boolean bh() {
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.d).a(0.25D);
+ }
+
+ public boolean bb() {
return true;
}
- public int ar() {
- return this.getGoalTarget() == null ? 3 : 3 + (this.health - 1);
+ public int aq() {
+ return this.getGoalTarget() == null ? 3 : 3 + (int) (this.getHealth() - 1.0F);
}
- protected void a(float f) {
- super.a(f);
+ protected void b(float f) {
+ super.b(f);
this.fuseTicks = (int) ((float) this.fuseTicks + f * 1.5F);
if (this.fuseTicks > this.maxFuseTicks - 5) {
this.fuseTicks = this.maxFuseTicks - 5;
}
}
- public int getMaxHealth() {
- return 20;
- }
-
protected void a() {
super.a();
this.datawatcher.a(16, Byte.valueOf((byte) -1));
@@ -77,8 +77,8 @@ public class EntityCreeper extends EntityMonster {
public void l_() {
if (this.isAlive()) {
- this.d = this.fuseTicks;
- int i = this.o();
+ this.bp = this.fuseTicks;
+ int i = this.bR();
if (i > 0 && this.fuseTicks == 0) {
this.makeSound("random.fuse", 1.0F, 0.5F);
@@ -112,11 +112,11 @@ public class EntityCreeper extends EntityMonster {
super.l_();
}
- protected String bc() {
+ protected String aK() {
return "mob.creeper.say";
}
- protected String bd() {
+ protected String aL() {
return "mob.creeper.death";
}
@@ -173,7 +173,7 @@ public class EntityCreeper extends EntityMonster {
return Item.SULPHUR.id;
}
- public int o() {
+ public int bR() {
return this.datawatcher.getByte(16);
}
diff --git a/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java b/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java
index 19121530..73838198 100644
--- a/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java
+++ b/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java
@@ -17,13 +17,13 @@ public class EntityDamageSourceIndirect extends EntityDamageSource {
return this.owner;
}
- public String getLocalizedDeathMessage(EntityLiving entityliving) {
+ public ChatMessage 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;
+ ItemStack itemstack = this.owner instanceof EntityLiving ? ((EntityLiving) this.owner).aV() : 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});
+ return itemstack != null && itemstack.hasName() && LocaleI18n.b(s2) ? ChatMessage.b(s2, new Object[] { entityliving.getScoreboardDisplayName(), s, itemstack.getName()}) : ChatMessage.b(s1, new Object[] { entityliving.getScoreboardDisplayName(), s});
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java
index ed8f271f..16d8328b 100644
--- a/src/main/java/net/minecraft/server/EntityEgg.java
+++ b/src/main/java/net/minecraft/server/EntityEgg.java
@@ -23,7 +23,7 @@ public class EntityEgg extends EntityProjectile {
protected void a(MovingObjectPosition movingobjectposition) {
if (movingobjectposition.entity != null) {
- movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.getShooter()), 0);
+ movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.getShooter()), 0.0F);
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/EntityEnderCrystal.java b/src/main/java/net/minecraft/server/EntityEnderCrystal.java
index 582ecac3..ebf76a0b 100644
--- a/src/main/java/net/minecraft/server/EntityEnderCrystal.java
+++ b/src/main/java/net/minecraft/server/EntityEnderCrystal.java
@@ -4,7 +4,7 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class EntityEnderCrystal extends Entity {
- public int a = 0;
+ public int a;
public int b;
public EntityEnderCrystal(World world) {
@@ -16,7 +16,7 @@ public class EntityEnderCrystal extends Entity {
this.a = this.random.nextInt(100000);
}
- protected boolean f_() {
+ protected boolean e_() {
return false;
}
@@ -51,13 +51,13 @@ public class EntityEnderCrystal extends Entity {
return true;
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else {
if (!this.dead && !this.world.isStatic) {
// CraftBukkit start - All non-living entities need this
- if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, i)) {
+ if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) {
return false;
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
index e020e7f5..f776aeb3 100644
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
@@ -12,68 +12,67 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.Bukkit;
// CraftBukkit end
-public class EntityEnderDragon extends EntityLiving implements IComplex {
+public class EntityEnderDragon extends EntityInsentient implements IComplex, IMonster {
- public double a;
- public double b;
- public double c;
- public double[][] d = new double[64][3];
- public int e = -1;
+ public double h;
+ public double i;
+ public double j;
+ public double[][] bn = new double[64][3];
+ public int bo = -1;
public EntityComplexPart[] children;
- public EntityComplexPart g;
- public EntityComplexPart h;
- public EntityComplexPart i;
- public EntityComplexPart j;
- public EntityComplexPart bK;
- public EntityComplexPart bL;
- public EntityComplexPart bM;
- public float bN = 0.0F;
- public float bO = 0.0F;
- public boolean bP = false;
- public boolean bQ = false;
- private Entity bT;
- public int bR = 0;
- public EntityEnderCrystal bS = null;
+ public EntityComplexPart bq;
+ public EntityComplexPart br;
+ public EntityComplexPart bs;
+ public EntityComplexPart bt;
+ public EntityComplexPart bu;
+ public EntityComplexPart bv;
+ public EntityComplexPart bw;
+ public float bx;
+ public float by;
+ public boolean bz;
+ public boolean bA;
+ private Entity bD;
+ public int bB;
+ public EntityEnderCrystal bC;
private Explosion explosionSource = new Explosion(null, this, Double.NaN, Double.NaN, Double.NaN, Float.NaN); // CraftBukkit - reusable source for CraftTNTPrimed.getSource()
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.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.children = new EntityComplexPart[] { this.bq = new EntityComplexPart(this, "head", 6.0F, 6.0F), this.br = new EntityComplexPart(this, "body", 8.0F, 8.0F), this.bs = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bt = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bu = new EntityComplexPart(this, "tail", 4.0F, 4.0F), this.bv = new EntityComplexPart(this, "wing", 4.0F, 4.0F), this.bw = 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.Z = true;
this.fireProof = true;
- this.b = 100.0D;
+ this.i = 100.0D;
this.am = true;
}
- public int getMaxHealth() {
- return 200;
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.a).a(200.0D);
}
protected void a() {
super.a();
- this.datawatcher.a(16, new Integer(this.getMaxHealth()));
}
public double[] b(int i, float f) {
- if (this.health <= 0) {
+ if (this.getHealth() <= 0.0F) {
f = 0.0F;
}
f = 1.0F - f;
- int j = this.e - i * 1 & 63;
- int k = this.e - i * 1 - 1 & 63;
+ int j = this.bo - i * 1 & 63;
+ int k = this.bo - i * 1 - 1 & 63;
double[] adouble = new double[3];
- double d0 = this.d[j][0];
- double d1 = MathHelper.g(this.d[k][0] - d0);
+ double d0 = this.bn[j][0];
+ double d1 = MathHelper.g(this.bn[k][0] - d0);
adouble[0] = d0 + d1 * (double) f;
- d0 = this.d[j][1];
- d1 = this.d[k][1] - d0;
+ d0 = this.bn[j][1];
+ d1 = this.bn[k][1] - d0;
adouble[1] = d0 + d1 * (double) f;
- adouble[2] = this.d[j][2] + (this.d[k][2] - this.d[j][2]) * (double) f;
+ adouble[2] = this.bn[j][2] + (this.bn[k][2] - this.bn[j][2]) * (double) f;
return adouble;
}
@@ -81,48 +80,46 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
float f;
float f1;
- if (!this.world.isStatic) {
- this.datawatcher.watch(16, Integer.valueOf(this.getScaledHealth())); // CraftBukkit - this.health -> this.getScaledHealth()
- } else {
- f = MathHelper.cos(this.bO * 3.1415927F * 2.0F);
- f1 = MathHelper.cos(this.bN * 3.1415927F * 2.0F);
+ if (this.world.isStatic) {
+ f = MathHelper.cos(this.by * 3.1415927F * 2.0F);
+ f1 = MathHelper.cos(this.bx * 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.bN = this.bO;
+ this.bx = this.by;
float f2;
- if (this.health <= 0) {
+ if (this.getHealth() <= 0.0F) {
f = (this.random.nextFloat() - 0.5F) * 8.0F;
f1 = (this.random.nextFloat() - 0.5F) * 4.0F;
f2 = (this.random.nextFloat() - 0.5F) * 8.0F;
this.world.addParticle("largeexplode", this.locX + (double) f, this.locY + 2.0D + (double) f1, this.locZ + (double) f2, 0.0D, 0.0D, 0.0D);
} else {
- this.h();
+ this.bF();
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.bQ) {
- this.bO += f * 0.5F;
+ if (this.bA) {
+ this.by += f * 0.5F;
} else {
- this.bO += f;
+ this.by += f;
}
this.yaw = MathHelper.g(this.yaw);
- if (this.e < 0) {
- for (int d05 = 0; d05 < this.d.length; ++d05) {
- this.d[d05][0] = (double) this.yaw;
- this.d[d05][1] = this.locY;
+ if (this.bo < 0) {
+ for (int d05 = 0; d05 < this.bn.length; ++d05) {
+ this.bn[d05][0] = (double) this.yaw;
+ this.bn[d05][1] = this.locY;
}
}
- if (++this.e == this.d.length) {
- this.e = 0;
+ if (++this.bo == this.bn.length) {
+ this.bo = 0;
}
- this.d[this.e][0] = (double) this.yaw;
- this.d[this.e][1] = this.locY;
+ this.bn[this.bo][0] = (double) this.yaw;
+ this.bn[this.bo][1] = this.locY;
double d0;
double d1;
double d2;
@@ -130,27 +127,27 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
float f3;
if (this.world.isStatic) {
- 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;
+ if (this.bh > 0) {
+ d0 = this.locX + (this.bi - this.locX) / (double) this.bh;
+ d1 = this.locY + (this.bj - this.locY) / (double) this.bh;
+ d2 = this.locZ + (this.bk - this.locZ) / (double) this.bh;
+ d3 = MathHelper.g(this.bl - (double) this.yaw);
+ this.yaw = (float) ((double) this.yaw + d3 / (double) this.bh);
+ this.pitch = (float) ((double) this.pitch + (this.bm - (double) this.pitch) / (double) this.bh);
+ --this.bh;
this.setPosition(d0, d1, d2);
this.b(this.yaw, this.pitch);
}
} else {
- d0 = this.a - this.locX;
- d1 = this.b - this.locY;
- d2 = this.c - this.locZ;
+ d0 = this.h - this.locX;
+ d1 = this.i - this.locY;
+ d2 = this.j - this.locZ;
d3 = d0 * d0 + d1 * d1 + d2 * d2;
- 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;
+ if (this.bD != null) {
+ this.h = this.bD.locX;
+ this.j = this.bD.locZ;
+ double d4 = this.h - this.locX;
+ double d5 = this.j - this.locZ;
double d6 = Math.sqrt(d4 * d4 + d5 * d5);
double d7 = 0.4000000059604645D + d6 / 80.0D - 1.0D;
@@ -158,14 +155,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
d7 = 10.0D;
}
- this.b = this.bT.boundingBox.b + d7;
+ this.i = this.bD.boundingBox.b + d7;
} else {
- this.a += this.random.nextGaussian() * 2.0D;
- this.c += this.random.nextGaussian() * 2.0D;
+ this.h += this.random.nextGaussian() * 2.0D;
+ this.j += this.random.nextGaussian() * 2.0D;
}
- if (this.bP || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.H) {
- this.i();
+ if (this.bz || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.H) {
+ this.bG();
}
d1 /= (double) MathHelper.sqrt(d0 * d0 + d2 * d2);
@@ -191,7 +188,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
d9 = -50.0D;
}
- Vec3D vec3d = this.world.getVec3DPool().create(this.a - this.locX, this.b - this.locY, this.c - this.locZ).a();
+ Vec3D vec3d = this.world.getVec3DPool().create(this.h - this.locX, this.i - this.locY, this.j - this.locZ).a();
Vec3D vec3d1 = this.world.getVec3DPool().create((double) MathHelper.sin(this.yaw * 3.1415927F / 180.0F), this.motY, (double) (-MathHelper.cos(this.yaw * 3.1415927F / 180.0F))).a();
float f4 = (float) (vec3d1.b(vec3d) + 0.5D) / 1.5F;
@@ -199,7 +196,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
f4 = 0.0F;
}
- this.bF *= 0.8F;
+ this.bg *= 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 +204,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
d10 = 40.0D;
}
- this.bF = (float) ((double) this.bF + d9 * (0.699999988079071D / d10 / (double) f5));
- this.yaw += this.bF * 0.1F;
+ this.bg = (float) ((double) this.bg + d9 * (0.699999988079071D / d10 / (double) f5));
+ this.yaw += this.bg * 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.bQ) {
+ if (this.bA) {
this.move(this.motX * 0.800000011920929D, this.motY * 0.800000011920929D, this.motZ * 0.800000011920929D);
} else {
this.move(this.motX, this.motY, this.motZ);
@@ -228,17 +225,17 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
this.motY *= 0.9100000262260437D;
}
- 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.bK.width = this.bK.length = 2.0F;
- this.h.length = 3.0F;
- this.h.width = 5.0F;
- this.bL.length = 2.0F;
- this.bL.width = 4.0F;
- this.bM.length = 3.0F;
- this.bM.width = 4.0F;
+ this.aN = this.yaw;
+ this.bq.width = this.bq.length = 3.0F;
+ this.bs.width = this.bs.length = 2.0F;
+ this.bt.width = this.bt.length = 2.0F;
+ this.bu.width = this.bu.length = 2.0F;
+ this.br.length = 3.0F;
+ this.br.width = 5.0F;
+ this.bv.length = 2.0F;
+ this.bv.width = 4.0F;
+ this.bw.length = 3.0F;
+ this.bw.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);
@@ -246,40 +243,40 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
float f11 = MathHelper.sin(f10);
float f12 = MathHelper.cos(f10);
- 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.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);
+ this.br.l_();
+ this.br.setPositionRotation(this.locX + (double) (f11 * 0.5F), this.locY, this.locZ - (double) (f12 * 0.5F), 0.0F, 0.0F);
+ this.bv.l_();
+ this.bv.setPositionRotation(this.locX + (double) (f12 * 4.5F), this.locY + 2.0D, this.locZ + (double) (f11 * 4.5F), 0.0F, 0.0F);
+ this.bw.l_();
+ this.bw.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.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)));
+ this.a(this.world.getEntities(this, this.bv.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
+ this.a(this.world.getEntities(this, this.bw.boundingBox.grow(4.0D, 2.0D, 4.0D).d(0.0D, -2.0D, 0.0D)));
+ this.b(this.world.getEntities(this, this.bq.boundingBox.grow(1.0D, 1.0D, 1.0D)));
}
double[] adouble = this.b(5, 1.0F);
double[] adouble1 = this.b(0, 1.0F);
- 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);
+ f3 = MathHelper.sin(this.yaw * 3.1415927F / 180.0F - this.bg * 0.01F);
+ float f13 = MathHelper.cos(this.yaw * 3.1415927F / 180.0F - this.bg * 0.01F);
- 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);
+ this.bq.l_();
+ this.bq.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) {
EntityComplexPart entitycomplexpart = null;
if (j == 0) {
- entitycomplexpart = this.i;
+ entitycomplexpart = this.bs;
}
if (j == 1) {
- entitycomplexpart = this.j;
+ entitycomplexpart = this.bt;
}
if (j == 2) {
- entitycomplexpart = this.bK;
+ entitycomplexpart = this.bu;
}
double[] adouble2 = this.b(12 + j * 2, 1.0F);
@@ -294,26 +291,26 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
if (!this.world.isStatic) {
- this.bQ = this.a(this.g.boundingBox) | this.a(this.h.boundingBox);
+ this.bA = this.a(this.bq.boundingBox) | this.a(this.br.boundingBox);
}
}
}
- private void h() {
- if (this.bS != null) {
- if (this.bS.dead) {
+ private void bF() {
+ if (this.bC != null) {
+ if (this.bC.dead) {
if (!this.world.isStatic) {
- this.a(this.g, DamageSource.explosion((Explosion) null), 10);
+ this.a(this.bq, DamageSource.explosion((Explosion) null), 10.0F);
}
- this.bS = null;
- } else if (this.ticksLived % 10 == 0 && this.health < this.maxHealth) { // CraftBukkit - this.getMaxHealth() -> this.maxHealth
+ this.bC = null;
+ } else if (this.ticksLived % 10 == 0 && this.getHealth() < this.maxHealth) { // CraftBukkit - this.getMaxHealth() -> this.maxHealth
// CraftBukkit start
- EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL);
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), 1.0D, EntityRegainHealthEvent.RegainReason.ENDER_CRYSTAL);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- this.setHealth(this.getHealth() + event.getAmount());
+ this.setHealth((float) (this.getHealth() + event.getAmount()));
}
// CraftBukkit end
}
@@ -336,13 +333,13 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
}
- this.bS = entityendercrystal;
+ this.bC = entityendercrystal;
}
}
private void a(List list) {
- double d0 = (this.h.boundingBox.a + this.h.boundingBox.d) / 2.0D;
- double d1 = (this.h.boundingBox.c + this.h.boundingBox.f) / 2.0D;
+ double d0 = (this.br.boundingBox.a + this.br.boundingBox.d) / 2.0D;
+ double d1 = (this.br.boundingBox.c + this.br.boundingBox.f) / 2.0D;
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
@@ -363,32 +360,32 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
Entity entity = (Entity) list.get(i);
if (entity instanceof EntityLiving) {
- entity.damageEntity(DamageSource.mobAttack(this), 10);
+ entity.damageEntity(DamageSource.mobAttack(this), 10.0F);
}
}
}
- private void i() {
- this.bP = false;
+ private void bG() {
+ this.bz = false;
if (this.random.nextInt(2) == 0 && !this.world.players.isEmpty()) {
- this.bT = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
+ this.bD = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
} else {
boolean flag = false;
do {
- this.a = 0.0D;
- this.b = (double) (70.0F + this.random.nextFloat() * 50.0F);
- this.c = 0.0D;
- this.a += (double) (this.random.nextFloat() * 120.0F - 60.0F);
- this.c += (double) (this.random.nextFloat() * 120.0F - 60.0F);
- double d0 = this.locX - this.a;
- double d1 = this.locY - this.b;
- double d2 = this.locZ - this.c;
+ this.h = 0.0D;
+ this.i = (double) (70.0F + this.random.nextFloat() * 50.0F);
+ this.j = 0.0D;
+ this.h += (double) (this.random.nextFloat() * 120.0F - 60.0F);
+ this.j += (double) (this.random.nextFloat() * 120.0F - 60.0F);
+ double d0 = this.locX - this.h;
+ double d1 = this.locY - this.i;
+ double d2 = this.locZ - this.j;
flag = d0 * d0 + d1 * d1 + d2 * d2 > 100.0D;
} while (!flag);
- this.bT = null;
+ this.bD = null;
}
}
@@ -477,37 +474,37 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
return flag;
}
- public boolean a(EntityComplexPart entitycomplexpart, DamageSource damagesource, int i) {
- if (entitycomplexpart != this.g) {
- i = i / 4 + 1;
+ public boolean a(EntityComplexPart entitycomplexpart, DamageSource damagesource, float f) {
+ if (entitycomplexpart != this.bq) {
+ f = f / 4.0F + 1.0F;
}
- float f = this.yaw * 3.1415927F / 180.0F;
- float f1 = MathHelper.sin(f);
- float f2 = MathHelper.cos(f);
+ float f1 = this.yaw * 3.1415927F / 180.0F;
+ float f2 = MathHelper.sin(f1);
+ float f3 = MathHelper.cos(f1);
- 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.bT = null;
+ this.h = this.locX + (double) (f2 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
+ this.i = this.locY + (double) (this.random.nextFloat() * 3.0F) + 1.0D;
+ this.j = this.locZ - (double) (f3 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
+ this.bD = null;
if (damagesource.getEntity() instanceof EntityHuman || damagesource.c()) {
- this.dealDamage(damagesource, i);
+ this.dealDamage(damagesource, f);
}
return true;
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
return false;
}
- public boolean dealDamage(DamageSource damagesource, int i) { // CraftBukkit - protected -> public
- return super.damageEntity(damagesource, i);
+ public boolean dealDamage(DamageSource damagesource, float f) { // CraftBukkit - protected -> public
+ return super.damageEntity(damagesource, f);
}
- protected void aS() {
- ++this.bR;
- if (this.bR >= 180 && this.bR <= 200) {
+ protected void az() {
+ ++this.bB;
+ if (this.bB >= 180 && this.bB <= 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;
@@ -519,7 +516,7 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
int j;
if (!this.world.isStatic) {
- if (this.bR > 150 && this.bR % 5 == 0) {
+ if (this.bB > 150 && this.bB % 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) {
@@ -529,14 +526,14 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
}
}
- if (this.bR == 1) {
+ if (this.bB == 1) {
this.world.d(1018, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
}
this.move(0.0D, 0.10000000149011612D, 0.0D);
- this.ay = this.yaw += 20.0F;
- if (this.bR == 200 && !this.world.isStatic) {
+ this.aN = this.yaw += 20.0F;
+ if (this.bB == 200 && !this.world.isStatic) {
i = expToDrop - 10 * (expToDrop / 12); // CraftBukkit - drop the remaining experience
while (i > 0) {
@@ -616,9 +613,9 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
BlockEnderPortal.a = false;
}
- protected void bn() {}
+ protected void bk() {}
- public Entity[] an() {
+ public Entity[] am() {
return this.children;
}
@@ -626,19 +623,19 @@ public class EntityEnderDragon extends EntityLiving implements IComplex {
return false;
}
- public World d() {
+ public World b() {
return this.world;
}
- protected String bb() {
+ protected String r() {
return "mob.enderdragon.growl";
}
- protected String bc() {
+ protected String aK() {
return "mob.enderdragon.hit";
}
- protected float ba() {
+ protected float aW() {
return 5.0F;
}
diff --git a/src/main/java/net/minecraft/server/EntityEnderPearl.java b/src/main/java/net/minecraft/server/EntityEnderPearl.java
index fa2ccc48..585154e4 100644
--- a/src/main/java/net/minecraft/server/EntityEnderPearl.java
+++ b/src/main/java/net/minecraft/server/EntityEnderPearl.java
@@ -43,13 +43,13 @@ public class EntityEnderPearl extends EntityProjectile {
entityplayer.playerConnection.teleport(teleEvent.getTo());
this.getShooter().fallDistance = 0.0F;
- EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), player, EntityDamageByEntityEvent.DamageCause.FALL, 5);
+ EntityDamageByEntityEvent damageEvent = new EntityDamageByEntityEvent(this.getBukkitEntity(), player, EntityDamageByEntityEvent.DamageCause.FALL, 5.0D);
Bukkit.getPluginManager().callEvent(damageEvent);
if (!damageEvent.isCancelled() && !entityplayer.playerConnection.disconnected) {
entityplayer.invulnerableTicks = -1; // Remove spawning invulnerability
player.setLastDamageCause(damageEvent);
- entityplayer.damageEntity(DamageSource.FALL, damageEvent.getDamage());
+ entityplayer.damageEntity(DamageSource.FALL, (float) damageEvent.getDamage());
}
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java
index e1be9b0c..3692aeb5 100644
--- a/src/main/java/net/minecraft/server/EntityEnderman.java
+++ b/src/main/java/net/minecraft/server/EntityEnderman.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import java.util.UUID;
+
// CraftBukkit start
import org.bukkit.Location;
import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -8,21 +10,25 @@ import org.bukkit.event.entity.EntityTeleportEvent;
public class EntityEnderman extends EntityMonster {
- private static boolean[] d = new boolean[256];
- private int e = 0;
- private int f = 0;
- private boolean g;
+ private static final UUID bp = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0");
+ private static final AttributeModifier bq = (new AttributeModifier(bp, "Attacking speed boost", 6.199999809265137D, 0)).a(false);
+ private static boolean[] br = new boolean[256];
+ private int bs;
+ private int bt;
+ private Entity bu;
+ private boolean bv;
public EntityEnderman(World world) {
super(world);
- this.texture = "/mob/enderman.png";
- this.bI = 0.2F;
this.a(0.6F, 2.9F);
this.Y = 1.0F;
}
- public int getMaxHealth() {
- return 40;
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.a).a(40.0D);
+ this.a(GenericAttributes.d).a(0.30000001192092896D);
+ this.a(GenericAttributes.e).a(7.0D);
}
protected void a() {
@@ -48,48 +54,57 @@ public class EntityEnderman extends EntityMonster {
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 64.0D);
if (entityhuman != null) {
- if (this.e(entityhuman)) {
- this.g = true;
- if (this.f == 0) {
+ if (this.f(entityhuman)) {
+ this.bv = true;
+ if (this.bt == 0) {
this.world.makeSound(entityhuman, "mob.endermen.stare", 1.0F, 1.0F);
}
- if (this.f++ == 5) {
- this.f = 0;
+ if (this.bt++ == 5) {
+ this.bt = 0;
this.a(true);
return entityhuman;
}
} else {
- this.f = 0;
+ this.bt = 0;
}
}
return null;
}
- private boolean e(EntityHuman entityhuman) {
+ private boolean f(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.armor[3];
if (itemstack != null && itemstack.id == Block.PUMPKIN.id) {
return false;
} else {
- Vec3D vec3d = entityhuman.i(1.0F).a();
+ Vec3D vec3d = entityhuman.j(1.0F).a();
Vec3D vec3d1 = this.world.getVec3DPool().create(this.locX - entityhuman.locX, this.boundingBox.b + (double) (this.length / 2.0F) - (entityhuman.locY + (double) entityhuman.getHeadHeight()), this.locZ - entityhuman.locZ);
double d0 = vec3d1.b();
vec3d1 = vec3d1.a();
double d1 = vec3d.b(vec3d1);
- return d1 > 1.0D - 0.025D / d0 ? entityhuman.n(this) : false;
+ return d1 > 1.0D - 0.025D / d0 ? entityhuman.o(this) : false;
}
}
public void c() {
if (this.F()) {
- this.damageEntity(DamageSource.DROWN, 1);
+ this.damageEntity(DamageSource.DROWN, 1.0F);
+ }
+
+ if (this.bu != this.target) {
+ AttributeInstance attributeinstance = this.a(GenericAttributes.d);
+
+ attributeinstance.b(bq);
+ if (this.target != null) {
+ attributeinstance.a(bq);
+ }
}
- this.bI = this.target != null ? 6.5F : 0.3F;
+ this.bu = this.target;
int i;
if (!this.world.isStatic && this.world.getGameRules().getBoolean("mobGriefing")) {
@@ -103,7 +118,7 @@ public class EntityEnderman extends EntityMonster {
j = MathHelper.floor(this.locY + this.random.nextDouble() * 3.0D);
k = MathHelper.floor(this.locZ - 2.0D + this.random.nextDouble() * 4.0D);
l = this.world.getTypeId(i, j, k);
- if (d[l]) {
+ if (br[l]) {
// CraftBukkit start - Pickup event
if (!CraftEventFactory.callEntityChangeBlockEvent(this, this.world.getWorld().getBlockAt(i, j, k), org.bukkit.Material.AIR).isCancelled()) {
this.setCarriedId(this.world.getTypeId(i, j, k));
@@ -136,55 +151,53 @@ public class EntityEnderman extends EntityMonster {
}
if (this.world.v() && !this.world.isStatic) {
- float f = this.c(1.0F);
+ float f = this.d(1.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.a(false);
- this.g = false;
- this.m();
+ this.bv = false;
+ this.bP();
}
}
if (this.F() || this.isBurning()) {
this.target = null;
this.a(false);
- this.g = false;
- this.m();
+ this.bv = false;
+ this.bP();
}
- if (this.q() && !this.g && this.random.nextInt(100) == 0) {
+ if (this.bT() && !this.bv && this.random.nextInt(100) == 0) {
this.a(false);
}
- this.bG = false;
+ this.bd = 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.e((EntityHuman) this.target)) {
- this.bD = this.bE = 0.0F;
- this.bI = 0.0F;
+ if (this.target instanceof EntityHuman && this.f((EntityHuman) this.target)) {
if (this.target.e((Entity) this) < 16.0D) {
- this.m();
+ this.bP();
}
- this.e = 0;
- } else if (this.target.e((Entity) this) > 256.0D && this.e++ >= 30 && this.p(this.target)) {
- this.e = 0;
+ this.bs = 0;
+ } else if (this.target.e((Entity) this) > 256.0D && this.bs++ >= 30 && this.c(this.target)) {
+ this.bs = 0;
}
} else {
this.a(false);
- this.e = 0;
+ this.bs = 0;
}
}
super.c();
}
- protected boolean m() {
+ protected boolean bP() {
double d0 = this.locX + (this.random.nextDouble() - 0.5D) * 64.0D;
double d1 = this.locY + (double) (this.random.nextInt(64) - 32);
double d2 = this.locZ + (this.random.nextDouble() - 0.5D) * 64.0D;
@@ -192,7 +205,7 @@ public class EntityEnderman extends EntityMonster {
return this.j(d0, d1, d2);
}
- protected boolean p(Entity entity) {
+ protected boolean c(Entity entity) {
Vec3D vec3d = this.world.getVec3DPool().create(this.locX - entity.locX, this.boundingBox.b + (double) (this.length / 2.0F) - entity.locY + (double) entity.getHeadHeight(), this.locZ - entity.locZ);
vec3d = vec3d.a();
@@ -273,15 +286,15 @@ public class EntityEnderman extends EntityMonster {
}
}
- protected String bb() {
- return this.q() ? "mob.endermen.scream" : "mob.endermen.idle";
+ protected String r() {
+ return this.bT() ? "mob.endermen.scream" : "mob.endermen.idle";
}
- protected String bc() {
+ protected String aK() {
return "mob.endermen.hit";
}
- protected String bd() {
+ protected String aL() {
return "mob.endermen.death";
}
@@ -322,32 +335,32 @@ public class EntityEnderman extends EntityMonster {
return this.datawatcher.getByte(17);
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else {
this.a(true);
if (damagesource instanceof EntityDamageSource && damagesource.getEntity() instanceof EntityHuman) {
- this.g = true;
+ this.bv = true;
}
if (damagesource instanceof EntityDamageSourceIndirect) {
- this.g = false;
+ this.bv = false;
- for (int j = 0; j < 64; ++j) {
- if (this.m()) {
+ for (int i = 0; i < 64; ++i) {
+ if (this.bP()) {
return true;
}
}
return false;
} else {
- return super.damageEntity(damagesource, i);
+ return super.damageEntity(damagesource, f);
}
}
}
- public boolean q() {
+ public boolean bT() {
return this.datawatcher.getByte(18) > 0;
}
@@ -355,24 +368,20 @@ public class EntityEnderman extends EntityMonster {
this.datawatcher.watch(18, Byte.valueOf((byte) (flag ? 1 : 0)));
}
- public int c(Entity entity) {
- return 7;
- }
-
static {
- d[Block.GRASS.id] = true;
- d[Block.DIRT.id] = true;
- d[Block.SAND.id] = true;
- d[Block.GRAVEL.id] = true;
- d[Block.YELLOW_FLOWER.id] = true;
- d[Block.RED_ROSE.id] = true;
- d[Block.BROWN_MUSHROOM.id] = true;
- d[Block.RED_MUSHROOM.id] = true;
- d[Block.TNT.id] = true;
- d[Block.CACTUS.id] = true;
- d[Block.CLAY.id] = true;
- d[Block.PUMPKIN.id] = true;
- d[Block.MELON.id] = true;
- d[Block.MYCEL.id] = true;
+ br[Block.GRASS.id] = true;
+ br[Block.DIRT.id] = true;
+ br[Block.SAND.id] = true;
+ br[Block.GRAVEL.id] = true;
+ br[Block.YELLOW_FLOWER.id] = true;
+ br[Block.RED_ROSE.id] = true;
+ br[Block.BROWN_MUSHROOM.id] = true;
+ br[Block.RED_MUSHROOM.id] = true;
+ br[Block.TNT.id] = true;
+ br[Block.CACTUS.id] = true;
+ br[Block.CLAY.id] = true;
+ br[Block.PUMPKIN.id] = true;
+ br[Block.MELON.id] = true;
+ br[Block.MYCEL.id] = true;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
index e76e0f94..9a1152d0 100644
--- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java
+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java
@@ -8,7 +8,7 @@ import org.bukkit.event.entity.EntityTargetEvent;
public class EntityExperienceOrb extends Entity {
public int a;
- public int b = 0;
+ public int b;
public int c;
private int d = 5;
public int value; // CraftBukkit - private -> public
@@ -27,7 +27,7 @@ public class EntityExperienceOrb extends Entity {
this.value = i;
}
- protected boolean f_() {
+ protected boolean e_() {
return false;
}
@@ -119,15 +119,15 @@ public class EntityExperienceOrb extends Entity {
}
protected void burn(int i) {
- this.damageEntity(DamageSource.FIRE, i);
+ this.damageEntity(DamageSource.FIRE, (float) i);
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else {
this.J();
- this.d -= i;
+ this.d = (int) ((float) this.d - f);
if (this.d <= 0) {
this.die();
}
@@ -150,8 +150,8 @@ public class EntityExperienceOrb extends Entity {
public void b_(EntityHuman entityhuman) {
if (!this.world.isStatic) {
- if (this.c == 0 && entityhuman.bT == 0) {
- entityhuman.bT = 2;
+ if (this.c == 0 && entityhuman.bv == 0) {
+ entityhuman.bv = 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 ap() {
+ public boolean ao() {
return false;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java
index 17d837dd..daa376c3 100644
--- a/src/main/java/net/minecraft/server/EntityFallingBlock.java
+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java
@@ -22,13 +22,9 @@ public class EntityFallingBlock extends Entity {
public EntityFallingBlock(World world) {
super(world);
- this.c = 0;
this.dropItem = true;
- 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) {
@@ -37,13 +33,9 @@ public class EntityFallingBlock extends Entity {
public EntityFallingBlock(World world, double d0, double d1, double d2, int i, int j) {
super(world);
- this.c = 0;
this.dropItem = true;
- 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;
@@ -58,7 +50,7 @@ public class EntityFallingBlock extends Entity {
this.lastZ = d2;
}
- protected boolean f_() {
+ protected boolean e_() {
return false;
}
@@ -150,7 +142,7 @@ public class EntityFallingBlock extends Entity {
}
}
- protected void a(float f) {
+ protected void b(float f) {
if (this.hurtEntities) {
int i = MathHelper.f(f - 1.0F);
@@ -163,14 +155,14 @@ public class EntityFallingBlock extends Entity {
Entity entity = (Entity) iterator.next();
// CraftBukkit start
- int damage = Math.min(MathHelper.d((float) i * this.fallHurtAmount), this.fallHurtMax);
+ float damage = (float) Math.min(MathHelper.d((float) i * this.fallHurtAmount), this.fallHurtMax);
EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent(this, entity, EntityDamageEvent.DamageCause.FALLING_BLOCK, damage);
if (event.isCancelled()) {
continue;
}
- entity.damageEntity(damagesource, event.getDamage());
+ entity.damageEntity(damagesource, (float) event.getDamage());
// CraftBukkit end
}
diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java
index 194a58fc..a8237967 100644
--- a/src/main/java/net/minecraft/server/EntityFireball.java
+++ b/src/main/java/net/minecraft/server/EntityFireball.java
@@ -7,11 +7,11 @@ public abstract class EntityFireball extends Entity {
private int e = -1;
private int f = -1;
private int g = -1;
- private int h = 0;
- private boolean i = false;
+ private int h;
+ private boolean i;
public EntityLiving shooter;
private int j;
- private int au = 0;
+ private int au;
public double dirX;
public double dirY;
public double dirZ;
@@ -106,7 +106,7 @@ public abstract class EntityFireball extends Entity {
for (int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
- if (entity1.K() && (!entity1.i(this.shooter) || this.au >= 25)) {
+ if (entity1.K() && (!entity1.h(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);
@@ -227,7 +227,7 @@ public abstract class EntityFireball extends Entity {
return 1.0F;
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else {
@@ -255,7 +255,7 @@ public abstract class EntityFireball extends Entity {
}
}
- public float c(float f) {
+ public float d(float f) {
return 1.0F;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java
index 6856e5b5..35fb8d43 100644
--- a/src/main/java/net/minecraft/server/EntityFireworks.java
+++ b/src/main/java/net/minecraft/server/EntityFireworks.java
@@ -111,11 +111,11 @@ public class EntityFireworks extends Entity {
}
}
- public float c(float f) {
- return super.c(f);
+ public float d(float f) {
+ return super.d(f);
}
- public boolean ap() {
+ public boolean ao() {
return false;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java
index fbae2934..255ff381 100644
--- a/src/main/java/net/minecraft/server/EntityFishingHook.java
+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java
@@ -13,14 +13,14 @@ public class EntityFishingHook extends Entity {
private int d = -1;
private int e = -1;
private int f = -1;
- private int g = 0;
- private boolean h = false;
- public int a = 0;
+ private int g;
+ private boolean h;
+ public int a;
public EntityHuman owner;
private int i;
- private int j = 0;
- private int au = 0;
- public Entity hooked = null;
+ private int j;
+ private int au;
+ public Entity hooked;
private int av;
private double aw;
private double ax;
@@ -93,7 +93,7 @@ public class EntityFishingHook extends Entity {
this.b(this.yaw, this.pitch);
} else {
if (!this.world.isStatic) {
- ItemStack itemstack = this.owner.cd();
+ ItemStack itemstack = this.owner.bt();
if (this.owner.dead || !this.owner.isAlive() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.e(this.owner) > 1024.0D) {
this.die();
@@ -180,7 +180,7 @@ public class EntityFishingHook extends Entity {
if (movingobjectposition != null) {
org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // Craftbukkit - Call event
if (movingobjectposition.entity != null) {
- if (movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.owner), 0)) {
+ if (movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.owner), 0.0F)) {
this.hooked = movingobjectposition.entity;
}
} else {
diff --git a/src/main/java/net/minecraft/server/EntityGhast.java b/src/main/java/net/minecraft/server/EntityGhast.java
index f18a9246..be3922a2 100644
--- a/src/main/java/net/minecraft/server/EntityGhast.java
+++ b/src/main/java/net/minecraft/server/EntityGhast.java
@@ -8,33 +8,32 @@ import org.bukkit.event.entity.EntityTargetEvent;
public class EntityGhast extends EntityFlying implements IMonster {
- public int b = 0;
- public double c;
- public double d;
- public double e;
- private Entity target = null;
- private int i = 0;
- public int f = 0;
- public int g = 0;
+ public int h;
+ public double i;
+ public double j;
+ public double bn;
+ private Entity target;
+ private int br;
+ public int bo;
+ public int bp;
private int explosionPower = 1;
public EntityGhast(World world) {
super(world);
- this.texture = "/mob/ghast.png";
this.a(4.0F, 4.0F);
this.fireProof = true;
- this.be = 5;
+ this.b = 5;
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else if ("fireball".equals(damagesource.n()) && damagesource.getEntity() instanceof EntityHuman) {
- super.damageEntity(damagesource, 1000);
+ super.damageEntity(damagesource, 1000.0F);
((EntityHuman) damagesource.getEntity()).a((Statistic) AchievementList.y);
return true;
} else {
- return super.damageEntity(damagesource, i);
+ return super.damageEntity(damagesource, f);
}
}
@@ -43,46 +42,40 @@ public class EntityGhast extends EntityFlying implements IMonster {
this.datawatcher.a(16, Byte.valueOf((byte) 0));
}
- public int getMaxHealth() {
- return 10;
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.a).a(10.0D);
}
- public void l_() {
- super.l_();
- byte b0 = this.datawatcher.getByte(16);
-
- this.texture = b0 == 1 ? "/mob/ghast_fire.png" : "/mob/ghast.png";
- }
-
- protected void bq() {
+ protected void bh() {
if (!this.world.isStatic && this.world.difficulty == 0) {
this.die();
}
- this.bn();
- this.f = this.g;
- double d0 = this.c - this.locX;
- double d1 = this.d - this.locY;
- double d2 = this.e - this.locZ;
+ this.bk();
+ this.bo = this.bp;
+ double d0 = this.i - this.locX;
+ double d1 = this.j - this.locY;
+ double d2 = this.bn - this.locZ;
double d3 = d0 * d0 + d1 * d1 + d2 * d2;
if (d3 < 1.0D || d3 > 3600.0D) {
- this.c = this.locX + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
- this.d = this.locY + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
- this.e = this.locZ + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
+ this.i = this.locX + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
+ this.j = this.locY + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
+ this.bn = this.locZ + (double) ((this.random.nextFloat() * 2.0F - 1.0F) * 16.0F);
}
- if (this.b-- <= 0) {
- this.b += this.random.nextInt(5) + 2;
+ if (this.h-- <= 0) {
+ this.h += this.random.nextInt(5) + 2;
d3 = (double) MathHelper.sqrt(d3);
- if (this.a(this.c, this.d, this.e, d3)) {
+ if (this.a(this.i, this.j, this.bn, d3)) {
this.motX += d0 / d3 * 0.1D;
this.motY += d1 / d3 * 0.1D;
this.motZ += d2 / d3 * 0.1D;
} else {
- this.c = this.locX;
- this.d = this.locY;
- this.e = this.locZ;
+ this.i = this.locX;
+ this.j = this.locY;
+ this.bn = this.locZ;
}
}
@@ -101,7 +94,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
// CraftBukkit end
}
- if (this.target == null || this.i-- <= 0) {
+ if (this.target == null || this.br-- <= 0) {
// CraftBukkit start
Entity target = this.world.findNearbyVulnerablePlayer(this, 100.0D);
if (target != null) {
@@ -119,7 +112,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
// CraftBukkit end
if (this.target != null) {
- this.i = 20;
+ this.br = 20;
}
}
@@ -130,41 +123,41 @@ 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.ay = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
- if (this.n(this.target)) {
- if (this.g == 10) {
+ this.aN = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F;
+ if (this.o(this.target)) {
+ if (this.bp == 10) {
this.world.a((EntityHuman) null, 1007, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
- ++this.g;
- if (this.g == 20) {
+ ++this.bp;
+ if (this.bp == 20) {
this.world.a((EntityHuman) null, 1008, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
EntityLargeFireball entitylargefireball = new EntityLargeFireball(this.world, this, d5, d6, d7);
// CraftBukkit - set yield when setting explosionpower
entitylargefireball.yield = entitylargefireball.e = this.explosionPower;
double d8 = 4.0D;
- Vec3D vec3d = this.i(1.0F);
+ Vec3D vec3d = this.j(1.0F);
entitylargefireball.locX = this.locX + vec3d.c * d8;
entitylargefireball.locY = this.locY + (double) (this.length / 2.0F) + 0.5D;
entitylargefireball.locZ = this.locZ + vec3d.e * d8;
this.world.addEntity(entitylargefireball);
- this.g = -40;
+ this.bp = -40;
}
- } else if (this.g > 0) {
- --this.g;
+ } else if (this.bp > 0) {
+ --this.bp;
}
} else {
- this.ay = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
- if (this.g > 0) {
- --this.g;
+ this.aN = this.yaw = -((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F;
+ if (this.bp > 0) {
+ --this.bp;
}
}
if (!this.world.isStatic) {
byte b0 = this.datawatcher.getByte(16);
- byte b1 = (byte) (this.g > 10 ? 1 : 0);
+ byte b1 = (byte) (this.bp > 10 ? 1 : 0);
if (b0 != b1) {
this.datawatcher.watch(16, Byte.valueOf(b1));
@@ -173,9 +166,9 @@ public class EntityGhast extends EntityFlying implements IMonster {
}
private boolean a(double d0, double d1, double d2, double d3) {
- double d4 = (this.c - this.locX) / d3;
- double d5 = (this.d - this.locY) / d3;
- double d6 = (this.e - this.locZ) / d3;
+ double d4 = (this.i - this.locX) / d3;
+ double d5 = (this.j - this.locY) / d3;
+ double d6 = (this.bn - this.locZ) / d3;
AxisAlignedBB axisalignedbb = this.boundingBox.clone();
for (int i = 1; (double) i < d3; ++i) {
@@ -188,15 +181,15 @@ public class EntityGhast extends EntityFlying implements IMonster {
return true;
}
- protected String bb() {
+ protected String r() {
return "mob.ghast.moan";
}
- protected String bc() {
+ protected String aK() {
return "mob.ghast.scream";
}
- protected String bd() {
+ protected String aL() {
return "mob.ghast.death";
}
@@ -225,7 +218,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
// CraftBukkit end
}
- protected float ba() {
+ protected float aW() {
return 10.0F;
}
@@ -233,7 +226,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
return this.random.nextInt(20) == 0 && super.canSpawn() && this.world.difficulty > 0;
}
- public int by() {
+ public int br() {
return 1;
}
diff --git a/src/main/java/net/minecraft/server/EntityHanging.java b/src/main/java/net/minecraft/server/EntityHanging.java
index f697d851..af64f750 100644
--- a/src/main/java/net/minecraft/server/EntityHanging.java
+++ b/src/main/java/net/minecraft/server/EntityHanging.java
@@ -20,8 +20,6 @@ public abstract class EntityHanging extends Entity {
public EntityHanging(World world) {
super(world);
- this.e = 0;
- this.direction = 0;
this.height = 0.0F;
this.a(0.5F, 0.5F);
}
@@ -39,7 +37,7 @@ public abstract class EntityHanging extends Entity {
this.direction = i;
this.lastYaw = this.yaw = (float) (i * 90);
float f = (float) this.d();
- float f1 = (float) this.g();
+ float f1 = (float) this.e();
float f2 = (float) this.d();
if (i != 2 && i != 0) {
@@ -74,33 +72,36 @@ public abstract class EntityHanging extends Entity {
}
if (i == 2) {
- f3 -= this.b(this.d());
+ f3 -= this.c(this.d());
}
if (i == 1) {
- f5 += this.b(this.d());
+ f5 += this.c(this.d());
}
if (i == 0) {
- f3 += this.b(this.d());
+ f3 += this.c(this.d());
}
if (i == 3) {
- f5 -= this.b(this.d());
+ f5 -= this.c(this.d());
}
- f4 += this.b(this.g());
+ f4 += this.c(this.e());
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 b(int i) {
+ private float c(int i) {
return i == 32 ? 0.5F : (i == 64 ? 0.5F : 0.0F);
}
public void l_() {
+ this.lastX = this.locX;
+ this.lastY = this.locY;
+ this.lastZ = this.locZ;
if (this.e++ == 100 && !this.world.isStatic) {
this.e = 0;
if (!this.dead && !this.survives()) {
@@ -132,7 +133,7 @@ public abstract class EntityHanging extends Entity {
// CraftBukkit end
this.die();
- this.h();
+ this.b((Entity) null);
}
}
}
@@ -142,7 +143,7 @@ public abstract class EntityHanging extends Entity {
return false;
} else {
int i = Math.max(1, this.d() / 16);
- int j = Math.max(1, this.g() / 16);
+ int j = Math.max(1, this.e() / 16);
int k = this.x;
int l = this.y;
int i1 = this.z;
@@ -163,7 +164,7 @@ public abstract class EntityHanging extends Entity {
i1 = MathHelper.floor(this.locZ - (double) ((float) this.d() / 32.0F));
}
- l = MathHelper.floor(this.locY - (double) ((float) this.g() / 32.0F));
+ l = MathHelper.floor(this.locY - (double) ((float) this.e() / 32.0F));
for (int j1 = 0; j1 < i; ++j1) {
for (int k1 = 0; k1 < j; ++k1) {
@@ -202,11 +203,11 @@ public abstract class EntityHanging extends Entity {
return true;
}
- public boolean j(Entity entity) {
- return entity instanceof EntityHuman ? this.damageEntity(DamageSource.playerAttack((EntityHuman) entity), 0) : false;
+ public boolean i(Entity entity) {
+ return entity instanceof EntityHuman ? this.damageEntity(DamageSource.playerAttack((EntityHuman) entity), 0.0F) : false;
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else {
@@ -239,17 +240,7 @@ public abstract class EntityHanging extends Entity {
this.die();
this.J();
- EntityHuman entityhuman = null;
-
- if (damagesource.getEntity() instanceof EntityHuman) {
- entityhuman = (EntityHuman) damagesource.getEntity();
- }
-
- if (entityhuman != null && entityhuman.abilities.canInstantlyBuild) {
- return true;
- }
-
- this.h();
+ this.b(damagesource.getEntity());
}
return true;
@@ -261,14 +252,14 @@ public abstract class EntityHanging extends Entity {
if (dead) return; // CraftBukkit
this.die();
- this.h();
+ this.b((Entity) null);
}
}
public void g(double d0, double d1, double d2) {
if (false && !this.world.isStatic && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { // CraftBukkit - not needed
this.die();
- this.h();
+ this.b((Entity) null);
}
}
@@ -325,7 +316,7 @@ public abstract class EntityHanging extends Entity {
public abstract int d();
- public abstract int g();
+ public abstract int e();
- public abstract void h();
+ public abstract void b(Entity entity);
}
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
index 6ea27779..96c1f8c0 100644
--- a/src/main/java/net/minecraft/server/EntityHuman.java
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
@@ -23,18 +23,17 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public Container defaultContainer;
public Container activeContainer;
protected FoodMetaData foodData = new FoodMetaData();
- protected int bO = 0;
- public byte bP = 0;
- public float bQ;
- public float bR;
- public String name;
- public int bT = 0;
- public double bU;
- public double bV;
- public double bW;
- public double bX;
- public double bY;
- public double bZ;
+ protected int br;
+ public float bs;
+ public float bt;
+ protected final String name;
+ public int bv;
+ public double bw;
+ public double bx;
+ public double by;
+ public double bz;
+ public double bA;
+ public double bB;
// CraftBukkit start
public boolean sleeping; // protected -> public
public boolean fauxSleeping;
@@ -46,10 +45,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
// CraftBukkit end
- public ChunkCoordinates cb;
+ public ChunkCoordinates bD;
public int sleepTicks; // CraftBukkit - private -> public
- public float cc;
- public float cd;
+ public float bE;
+ public float bF;
private ChunkCoordinates c;
private boolean d;
private ChunkCoordinates e;
@@ -60,49 +59,49 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public float exp;
private ItemStack f;
private int g;
- protected float ci = 0.1F;
- protected float cj = 0.02F;
- private int h = 0;
- public EntityFishingHook hookedFish = null;
+ protected float bK = 0.1F;
+ protected float bL = 0.02F;
+ private int h;
+ public EntityFishingHook hookedFish;
- public EntityHuman(World world) {
+ public EntityHuman(World world, String s) {
super(world);
+ this.name = s;
this.defaultContainer = new ContainerPlayer(this.inventory, !world.isStatic, this);
this.activeContainer = this.defaultContainer;
this.height = 1.62F;
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.aK = "humanoid";
- this.aJ = 180.0F;
+ this.ba = 180.0F;
this.maxFireTicks = 20;
- this.texture = "/mob/char.png";
}
- public int getMaxHealth() {
- return 20;
+ protected void ax() {
+ super.ax();
+ this.aT().b(GenericAttributes.e).a(1.0D);
}
protected void a() {
super.a();
this.datawatcher.a(16, Byte.valueOf((byte) 0));
- this.datawatcher.a(17, Byte.valueOf((byte) 0));
+ this.datawatcher.a(17, Float.valueOf(0.0F));
this.datawatcher.a(18, Integer.valueOf(0));
}
- public boolean bX() {
+ public boolean bm() {
return this.f != null;
}
- public void bZ() {
+ public void bo() {
if (this.f != null) {
this.f.b(this.world, this, this.g);
}
- this.ca();
+ this.bp();
}
- public void ca() {
+ public void bp() {
this.f = null;
this.g = 0;
if (!this.world.isStatic) {
@@ -111,7 +110,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
public boolean isBlocking() {
- return this.bX() && Item.byId[this.f.id].b_(this.f) == EnumAnimation.BLOCK;
+ return this.bm() && Item.byId[this.f.id].c_(this.f) == EnumAnimation.BLOCK;
}
public void l_() {
@@ -124,15 +123,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (--this.g == 0 && !this.world.isStatic) {
- this.m();
+ this.n();
}
} else {
- this.ca();
+ this.bp();
}
}
- if (this.bT > 0) {
- --this.bT;
+ if (this.bv > 0) {
+ --this.bv;
}
if (this.isSleeping()) {
@@ -142,7 +141,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (!this.world.isStatic) {
- if (!this.i()) {
+ if (!this.h()) {
this.a(true, true, false);
} else if (this.world.v()) {
this.a(false, true, true);
@@ -165,41 +164,41 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.extinguish();
}
- this.bU = this.bX;
- this.bV = this.bY;
- this.bW = this.bZ;
- double d0 = this.locX - this.bX;
- double d1 = this.locY - this.bY;
- double d2 = this.locZ - this.bZ;
+ this.bw = this.bz;
+ this.bx = this.bA;
+ this.by = this.bB;
+ double d0 = this.locX - this.bz;
+ double d1 = this.locY - this.bA;
+ double d2 = this.locZ - this.bB;
double d3 = 10.0D;
if (d0 > d3) {
- this.bU = this.bX = this.locX;
+ this.bw = this.bz = this.locX;
}
if (d2 > d3) {
- this.bW = this.bZ = this.locZ;
+ this.by = this.bB = this.locZ;
}
if (d1 > d3) {
- this.bV = this.bY = this.locY;
+ this.bx = this.bA = this.locY;
}
if (d0 < -d3) {
- this.bU = this.bX = this.locX;
+ this.bw = this.bz = this.locX;
}
if (d2 < -d3) {
- this.bW = this.bZ = this.locZ;
+ this.by = this.bB = this.locZ;
}
if (d1 < -d3) {
- this.bV = this.bY = this.locY;
+ this.bx = this.bA = this.locY;
}
- this.bX += d0 * 0.25D;
- this.bZ += d2 * 0.25D;
- this.bY += d1 * 0.25D;
+ this.bz += d0 * 0.25D;
+ this.bB += d2 * 0.25D;
+ this.bA += d1 * 0.25D;
this.a(StatisticList.k, 1);
if (this.vehicle == null) {
this.e = null;
@@ -245,7 +244,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- protected void m() {
+ protected void n() {
if (this.f != null) {
this.c(this.f, 16);
int i = this.f.count;
@@ -284,12 +283,12 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- this.ca();
+ this.bp();
}
}
- protected boolean bj() {
- return this.getHealth() <= 0 || this.isSleeping();
+ protected boolean aY() {
+ return this.getHealth() <= 0.0F || this.isSleeping();
}
// CraftBukkit - protected -> public
@@ -304,8 +303,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void setPassengerOf(Entity entity) {
// CraftBukkit end
- if (this.vehicle == entity) {
- this.h(entity);
+ if (this.vehicle != null && entity == null) {
+ if (!this.world.isStatic) {
+ this.l(this.vehicle);
+ }
+
if (this.vehicle != null) {
this.vehicle.passenger = null;
}
@@ -317,48 +319,59 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
public void T() {
- double d0 = this.locX;
- double d1 = this.locY;
- double d2 = this.locZ;
- float f = this.yaw;
- float f1 = this.pitch;
-
- 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.ay = ((EntityPig) this.vehicle).ay;
+ if (!this.world.isStatic && this.isSneaking()) {
+ this.mount((Entity) null);
+ this.setSneaking(false);
+ } else {
+ double d0 = this.locX;
+ double d1 = this.locY;
+ double d2 = this.locZ;
+ float f = this.yaw;
+ float f1 = this.pitch;
+
+ super.T();
+ this.bs = this.bt;
+ this.bt = 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.aN = ((EntityPig) this.vehicle).aN;
+ }
}
}
- protected void bq() {
- this.br();
+ protected void bh() {
+ super.bh();
+ this.aS();
}
public void c() {
- if (this.bO > 0) {
- --this.bO;
+ if (this.br > 0) {
+ --this.br;
}
// CraftBukkit - this.getMaxHealth() -> this.maxHealth
- if (this.world.difficulty == 0 && this.getHealth() < this.maxHealth && this.ticksLived % 20 * 12 == 0) {
+ if (this.world.difficulty == 0 && this.getHealth() < this.maxHealth && this.world.getGameRules().getBoolean("naturalRegeneration") && this.ticksLived % 20 * 12 == 0) {
// CraftBukkit - added regain reason of "REGEN" for filtering purposes.
- this.heal(1, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.REGEN);
+ this.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.REGEN);
}
this.inventory.k();
- this.bQ = this.bR;
+ this.bs = this.bt;
super.c();
- this.aO = this.abilities.b();
- this.aP = this.cj;
+ AttributeInstance attributeinstance = this.a(GenericAttributes.d);
+
+ if (!this.world.isStatic) {
+ attributeinstance.a((double) this.abilities.b());
+ }
+
+ this.aR = this.bL;
if (this.isSprinting()) {
- this.aO = (float) ((double) this.aO + (double) this.abilities.b() * 0.3D);
- this.aP = (float) ((double) this.aP + (double) this.cj * 0.3D);
+ this.aR = (float) ((double) this.aR + (double) this.bL * 0.3D);
}
+ this.i((float) attributeinstance.e());
float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
// CraftBukkit - Math -> TrigMath
float f1 = (float) org.bukkit.craftbukkit.TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0F;
@@ -367,18 +380,26 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
f = 0.1F;
}
- if (!this.onGround || this.getHealth() <= 0) {
+ if (!this.onGround || this.getHealth() <= 0.0F) {
f = 0.0F;
}
- if (this.onGround || this.getHealth() <= 0) {
+ if (this.onGround || this.getHealth() <= 0.0F) {
f1 = 0.0F;
}
- 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));
+ this.bt += (f - this.bt) * 0.4F;
+ this.aK += (f1 - this.aK) * 0.8F;
+ if (this.getHealth() > 0.0F) {
+ AxisAlignedBB axisalignedbb = null;
+
+ if (this.vehicle != null && !this.vehicle.dead) {
+ axisalignedbb = this.boundingBox.a(this.vehicle.boundingBox).grow(1.0D, 0.0D, 1.0D);
+ } else {
+ axisalignedbb = this.boundingBox.grow(1.0D, 0.5D, 1.0D);
+ }
+
+ List list = this.world.getEntities(this, axisalignedbb);
if (list != null) {
for (int i = 0; i < list.size(); ++i) {
@@ -424,8 +445,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (damagesource != null) {
- 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);
+ this.motX = (double) (-MathHelper.cos((this.aA + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
+ this.motZ = (double) (-MathHelper.sin((this.aA + this.yaw) * 3.1415927F / 180.0F) * 0.1F);
} else {
this.motX = this.motZ = 0.0D;
}
@@ -434,7 +455,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.a(StatisticList.y, 1);
}
- public void c(Entity entity, int i) {
+ public void b(Entity entity, int i) {
this.addScore(i);
// CraftBukkit - Get our scores instead
Collection<ScoreboardScore> collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.e, this.getLocalizedName(), new java.util.ArrayList<ScoreboardScore>());
@@ -467,6 +488,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public EntityItem a(ItemStack itemstack, boolean flag) {
if (itemstack == null) {
return null;
+ } else if (itemstack.count == 0) {
+ return null;
} else {
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.getHeadHeight(), this.locZ, itemstack);
@@ -571,7 +594,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.expTotal = nbttagcompound.getInt("XpTotal");
this.setScore(nbttagcompound.getInt("Score"));
if (this.sleeping) {
- this.cb = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
+ this.bD = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
this.a(true, true, false);
}
@@ -625,6 +648,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void openMinecartHopper(EntityMinecartHopper entityminecarthopper) {}
+ public void openHorseInventory(EntityHorse entityhorse, IInventory iinventory) {}
+
public void startEnchanting(int i, int j, int k, String s) {}
public void openAnvil(int i, int j, int k) {}
@@ -635,18 +660,18 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return 0.12F;
}
- protected void e_() {
+ protected void d_() {
this.height = 1.62F;
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else if (this.abilities.isInvulnerable && !damagesource.ignoresInvulnerability()) {
return false;
} else {
- this.bC = 0;
- if (this.getHealth() <= 0) {
+ this.aV = 0;
+ if (this.getHealth() <= 0.0F) {
return false;
} else {
if (this.isSleeping() && !this.world.isStatic) {
@@ -655,19 +680,19 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (damagesource.p()) {
if (this.world.difficulty == 0) {
- return false; // CraftBukkit - i = 0 -> return false
+ return false; // CraftBukkit - f = 0 -> return false
}
if (this.world.difficulty == 1) {
- i = i / 2 + 1;
+ f = f / 2.0F + 1.0F;
}
if (this.world.difficulty == 3) {
- i = i * 3 / 2;
+ f = f * 3.0F / 2.0F;
}
}
- if (false && i == 0) { // CraftBukkit - Don't filter out 0 damage
+ if (false && f == 0.0F) { // CraftBukkit - Don't filter out 0 damage
return false;
} else {
Entity entity = damagesource.getEntity();
@@ -680,8 +705,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.a((EntityLiving) entity, false);
}
- this.a(StatisticList.x, i);
- return super.damageEntity(damagesource, i);
+ this.a(StatisticList.x, Math.round(f * 10.0F));
+ return super.damageEntity(damagesource, f);
}
}
}
@@ -724,30 +749,32 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
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();
+ if (!(entityliving instanceof EntityHorse) || !((EntityHorse) entityliving).bS()) {
+ 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();
- while (iterator.hasNext()) {
- EntityWolf entitywolf1 = (EntityWolf) iterator.next();
+ while (iterator.hasNext()) {
+ EntityWolf entitywolf1 = (EntityWolf) iterator.next();
- if (entitywolf1.isTamed() && entitywolf1.l() == null && this.name.equals(entitywolf1.getOwnerName()) && (!flag || !entitywolf1.isSitting())) {
- entitywolf1.setSitting(false);
- entitywolf1.setTarget(entityliving);
+ if (entitywolf1.isTamed() && entitywolf1.bJ() == null && this.name.equals(entitywolf1.getOwnerName()) && (!flag || !entitywolf1.isSitting())) {
+ entitywolf1.setSitting(false);
+ entitywolf1.setTarget(entityliving);
+ }
}
}
}
}
}
- protected void k(int i) {
- this.inventory.g(i);
+ protected void h(float f) {
+ this.inventory.a(f);
}
- public int aZ() {
+ public int aM() {
return this.inventory.l();
}
- public float cc() {
+ public float bs() {
int i = 0;
ItemStack[] aitemstack = this.inventory.armor;
int j = aitemstack.length;
@@ -763,19 +790,25 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return (float) i / (float) this.inventory.armor.length;
}
- protected void d(DamageSource damagesource, int i) {
+ protected void d(DamageSource damagesource, float f) {
if (!this.isInvulnerable()) {
- if (!damagesource.ignoresArmor() && this.isBlocking()) {
- i = 1 + i >> 1;
+ if (!damagesource.ignoresArmor() && this.isBlocking() && f > 0.0F) {
+ f = (1.0F + f) * 0.5F;
}
- i = this.b(damagesource, i);
- i = this.c(damagesource, i);
- this.j(damagesource.f());
- int j = this.getHealth();
+ f = this.b(damagesource, f);
+ f = this.c(damagesource, f);
+ float f1 = f;
+
+ f = Math.max(f - this.bj(), 0.0F);
+ this.m(this.bj() - (f1 - f));
+ if (f != 0.0F) {
+ this.a(damagesource.f());
+ float f2 = this.getHealth();
- this.setHealth(this.getHealth() - i);
- this.bt.a(damagesource, j, i);
+ this.setHealth(this.getHealth() - f);
+ this.aN().a(damagesource, f2, f);
+ }
}
}
@@ -791,23 +824,22 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void openTrade(IMerchant imerchant, String s) {}
- public void d(ItemStack itemstack) {}
+ public void c(ItemStack itemstack) {}
public boolean p(Entity entity) {
- if (entity.a_(this)) {
- return true;
- } else {
- ItemStack itemstack = this.cd();
+ ItemStack itemstack = this.bt();
+ ItemStack itemstack1 = itemstack != null ? itemstack.cloneItemStack() : null;
+ if (!entity.c(this)) {
if (itemstack != null && entity instanceof EntityLiving) {
if (this.abilities.canInstantlyBuild) {
- itemstack = itemstack.cloneItemStack();
+ itemstack = itemstack1;
}
- if (itemstack.a((EntityLiving) entity)) {
+ if (itemstack.a(this, (EntityLiving) entity)) {
// CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0 && !this.abilities.canInstantlyBuild) {
- this.ce();
+ this.bu();
}
return true;
@@ -815,14 +847,24 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
return false;
+ } else {
+ if (itemstack != null && itemstack == this.bt()) {
+ if (itemstack.count <= 0 && !this.abilities.canInstantlyBuild) {
+ this.bu();
+ } else if (itemstack.count < itemstack1.count && this.abilities.canInstantlyBuild) {
+ itemstack.count = itemstack1.count;
+ }
+ }
+
+ return true;
}
}
- public ItemStack cd() {
+ public ItemStack bt() {
return this.inventory.getItemInHand();
}
- public void ce() {
+ public void bu() {
this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null);
}
@@ -831,47 +873,38 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
public void attack(Entity entity) {
- if (entity.ap()) {
- if (!entity.j(this)) {
- int i = this.inventory.a(entity);
-
- if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
- i += 3 << this.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier();
- }
-
- if (this.hasEffect(MobEffectList.WEAKNESS)) {
- i -= 2 << this.getEffect(MobEffectList.WEAKNESS).getAmplifier();
- }
-
- int j = 0;
- int k = 0;
+ if (entity.ao()) {
+ if (!entity.i(this)) {
+ float f = (float) this.a(GenericAttributes.e).e();
+ int i = 0;
+ float f1 = 0.0F;
if (entity instanceof EntityLiving) {
- k = EnchantmentManager.a((EntityLiving) this, (EntityLiving) entity);
- j += EnchantmentManager.getKnockbackEnchantmentLevel(this, (EntityLiving) entity);
+ f1 = EnchantmentManager.a((EntityLiving) this, (EntityLiving) entity);
+ i += EnchantmentManager.getKnockbackEnchantmentLevel(this, (EntityLiving) entity);
}
if (this.isSprinting()) {
- ++j;
+ ++i;
}
- if (i > 0 || k > 0) {
- boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.g_() && !this.G() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
+ if (f > 0.0F || f1 > 0.0F) {
+ boolean flag = this.fallDistance > 0.0F && !this.onGround && !this.e() && !this.G() && !this.hasEffect(MobEffectList.BLINDNESS) && this.vehicle == null && entity instanceof EntityLiving;
- if (flag && i > 0) {
- i += this.random.nextInt(i / 2 + 2);
+ if (flag && f > 0.0F) {
+ f *= 1.5F;
}
- i += k;
+ f += f1;
boolean flag1 = false;
- int l = EnchantmentManager.getFireAspectEnchantmentLevel(this);
+ int j = EnchantmentManager.getFireAspectEnchantmentLevel(this);
- if (entity instanceof EntityLiving && l > 0 && !entity.isBurning()) {
+ if (entity instanceof EntityLiving && j > 0 && !entity.isBurning()) {
flag1 = true;
entity.setOnFire(1);
}
- boolean flag2 = entity.damageEntity(DamageSource.playerAttack(this), i);
+ boolean flag2 = entity.damageEntity(DamageSource.playerAttack(this), f);
// CraftBukkit start - Return when the damage fails so that the item will not lose durability
if (!flag2) {
@@ -883,8 +916,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
// CraftBukkit end
if (flag2) {
- if (j > 0) {
- entity.g((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F));
+ if (i > 0) {
+ entity.g((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F));
this.motX *= 0.6D;
this.motZ *= 0.6D;
this.setSprinting(false);
@@ -894,21 +927,21 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.b(entity);
}
- if (k > 0) {
+ if (f1 > 0.0F) {
this.c(entity);
}
- if (i >= 18) {
+ if (f >= 18.0F) {
this.a((Statistic) AchievementList.E);
}
- this.l(entity);
+ this.k(entity);
if (entity instanceof EntityLiving) {
EnchantmentThorns.a(this, (EntityLiving) entity, this.random);
}
}
- ItemStack itemstack = this.cd();
+ ItemStack itemstack = this.bt();
Object object = entity;
if (entity instanceof EntityComplexPart) {
@@ -923,7 +956,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
itemstack.a((EntityLiving) object, this);
// CraftBukkit - bypass infinite items; <= 0 -> == 0
if (itemstack.count == 0) {
- this.ce();
+ this.bu();
}
}
@@ -932,10 +965,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.a((EntityLiving) entity, true);
}
- this.a(StatisticList.w, i);
- if (l > 0 && flag2) {
+ this.a(StatisticList.w, Math.round(f * 10.0F));
+ if (j > 0 && flag2) {
// CraftBukkit start - Call a combust event when somebody hits with a fire enchanted item
- EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), l * 4);
+ EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), j * 4);
org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent);
if (!combustEvent.isCancelled()) {
@@ -947,7 +980,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- this.j(0.3F);
+ this.a(0.3F);
}
}
}
@@ -969,10 +1002,6 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return !this.sleeping && super.inBlock();
}
- public boolean cg() {
- return false;
- }
-
public EnumBedResult a(int i, int j, int k) {
if (!this.world.isStatic) {
if (this.isSleeping() || !this.isAlive()) {
@@ -1000,6 +1029,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
+ if (this.ae()) {
+ this.mount((Entity) null);
+ }
+
// CraftBukkit start
if (this.getBukkitEntity() instanceof Player) {
Player player = (Player) this.getBukkitEntity();
@@ -1039,7 +1072,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
f = 0.9F;
}
- this.x(i1);
+ this.t(i1);
this.setPosition((double) ((float) i + f), (double) ((float) j + 0.9375F), (double) ((float) k + f1));
} else {
this.setPosition((double) ((float) i + 0.5F), (double) ((float) j + 0.9375F), (double) ((float) k + 0.5F));
@@ -1047,7 +1080,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.sleeping = true;
this.sleepTicks = 0;
- this.cb = new ChunkCoordinates(i, j, k);
+ this.bD = new ChunkCoordinates(i, j, k);
this.motX = this.motZ = this.motY = 0.0D;
if (!this.world.isStatic) {
this.world.everyoneSleeping();
@@ -1056,32 +1089,32 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return EnumBedResult.OK;
}
- private void x(int i) {
- this.cc = 0.0F;
- this.cd = 0.0F;
+ private void t(int i) {
+ this.bE = 0.0F;
+ this.bF = 0.0F;
switch (i) {
case 0:
- this.cd = -1.8F;
+ this.bF = -1.8F;
break;
case 1:
- this.cc = 1.8F;
+ this.bE = 1.8F;
break;
case 2:
- this.cd = 1.8F;
+ this.bF = 1.8F;
break;
case 3:
- this.cc = -1.8F;
+ this.bE = -1.8F;
}
}
public void a(boolean flag, boolean flag1, boolean flag2) {
this.a(0.6F, 1.8F);
- this.e_();
- ChunkCoordinates chunkcoordinates = this.cb;
- ChunkCoordinates chunkcoordinates1 = this.cb;
+ this.d_();
+ ChunkCoordinates chunkcoordinates = this.bD;
+ ChunkCoordinates chunkcoordinates1 = this.bD;
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);
@@ -1121,16 +1154,16 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
if (flag2) {
- this.setRespawnPosition(this.cb, false);
+ this.setRespawnPosition(this.bD, false);
}
}
- private boolean i() {
- return this.world.getTypeId(this.cb.x, this.cb.y, this.cb.z) == Block.BED.id;
+ private boolean h() {
+ return this.world.getTypeId(this.bD.x, this.bD.y, this.bD.z) == Block.BED.id;
}
public static ChunkCoordinates getBed(World world, ChunkCoordinates chunkcoordinates, boolean flag) {
- IChunkProvider ichunkprovider = world.K();
+ IChunkProvider ichunkprovider = world.L();
ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z - 3 >> 4);
ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z - 3 >> 4);
@@ -1168,7 +1201,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- public void b(String s) {}
+ public void a(String s) {}
public ChunkCoordinates getBed() {
return this.c;
@@ -1196,13 +1229,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
public void a(Statistic statistic, int i) {}
- protected void bl() {
- super.bl();
+ protected void ba() {
+ super.ba();
this.a(StatisticList.u, 1);
if (this.isSprinting()) {
- this.j(0.8F);
+ this.a(0.8F);
} else {
- this.j(0.2F);
+ this.a(0.2F);
}
}
@@ -1213,12 +1246,12 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (this.abilities.isFlying && this.vehicle == null) {
double d3 = this.motY;
- float f2 = this.aP;
+ float f2 = this.aR;
- this.aP = this.abilities.a();
+ this.aR = this.abilities.a();
super.e(f, f1);
this.motY = d3 * 0.6D;
- this.aP = f2;
+ this.aR = f2;
} else {
super.e(f, f1);
}
@@ -1226,6 +1259,10 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.checkMovement(this.locX - d0, this.locY - d1, this.locZ - d2);
}
+ public float bc() {
+ return (float) this.a(GenericAttributes.d).e();
+ }
+
public void checkMovement(double d0, double d1, double d2) {
if (this.vehicle == null) {
int i;
@@ -1234,15 +1271,15 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
i = Math.round(MathHelper.sqrt(d0 * d0 + d1 * d1 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.q, i);
- this.j(0.015F * (float) i * 0.01F);
+ this.a(0.015F * (float) i * 0.01F);
}
} else if (this.G()) {
i = Math.round(MathHelper.sqrt(d0 * d0 + d2 * d2) * 100.0F);
if (i > 0) {
this.a(StatisticList.m, i);
- this.j(0.015F * (float) i * 0.01F);
+ this.a(0.015F * (float) i * 0.01F);
}
- } else if (this.g_()) {
+ } else if (this.e()) {
if (d1 > 0.0D) {
this.a(StatisticList.o, (int) Math.round(d1 * 100.0D));
}
@@ -1251,9 +1288,9 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
if (i > 0) {
this.a(StatisticList.l, i);
if (this.isSprinting()) {
- this.j(0.099999994F * (float) i * 0.01F);
+ this.a(0.099999994F * (float) i * 0.01F);
} else {
- this.j(0.01F * (float) i * 0.01F);
+ this.a(0.01F * (float) i * 0.01F);
}
}
} else {
@@ -1286,13 +1323,13 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- protected void a(float f) {
+ protected void b(float f) {
if (!this.abilities.canFly) {
if (f >= 2.0F) {
this.a(StatisticList.n, (int) Math.round((double) f * 100.0D));
}
- super.a(f);
+ super.b(f);
}
}
@@ -1302,20 +1339,16 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- public void al() {
+ public void ak() {
if (!this.abilities.isFlying) {
- super.al();
+ super.ak();
}
}
- public ItemStack q(int i) {
+ public ItemStack o(int i) {
return this.inventory.f(i);
}
- protected void bH() {}
-
- protected void bI() {}
-
public void giveExp(int i) {
this.addScore(i);
int j = Integer.MAX_VALUE - this.expTotal;
@@ -1352,7 +1385,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return this.expLevel >= 30 ? 62 + (this.expLevel - 30) * 7 : (this.expLevel >= 15 ? 17 + (this.expLevel - 15) * 3 : 17);
}
- public void j(float f) {
+ public void a(float f) {
if (!this.abilities.isInvulnerable) {
if (!this.world.isStatic) {
this.foodData.a(f);
@@ -1364,12 +1397,12 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return this.foodData;
}
- public boolean i(boolean flag) {
+ public boolean g(boolean flag) {
return (flag || this.foodData.c()) && !this.abilities.isInvulnerable;
}
- public boolean co() {
- return this.getHealth() > 0 && this.getHealth() < this.maxHealth; // CraftBukkit - this.getMaxHealth() -> this.maxHealth
+ public boolean bE() {
+ return this.getHealth() > 0.0F && this.getHealth() < this.maxHealth; // CraftBukkit - this.getMaxHealth() -> this.maxHealth
}
public void a(ItemStack itemstack, int i) {
@@ -1382,7 +1415,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
}
- public boolean e(int i, int j, int k) {
+ public boolean d(int i, int j, int k) {
if (this.abilities.mayBuild) {
return true;
} else {
@@ -1395,8 +1428,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return true;
}
- if (this.cd() != null) {
- ItemStack itemstack = this.cd();
+ if (this.bt() != null) {
+ ItemStack itemstack = this.bt();
if (itemstack.b(block) || itemstack.a(block) > 1.0F) {
return true;
@@ -1409,7 +1442,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.y() : false);
+ return this.abilities.mayBuild ? true : (itemstack != null ? itemstack.z() : false);
}
protected int getExpValue(EntityHuman entityhuman) {
@@ -1430,20 +1463,10 @@ 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 bT() {
- return false;
- }
- // CraftBukkit end */
-
public void copyTo(EntityHuman entityhuman, boolean flag) {
if (flag) {
this.inventory.b(entityhuman.inventory);
- this.health = entityhuman.health;
+ this.setHealth(entityhuman.getHealth());
this.foodData = entityhuman.foodData;
this.expLevel = entityhuman.expLevel;
this.expTotal = entityhuman.expTotal;
@@ -1461,7 +1484,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
this.enderChest = entityhuman.enderChest;
}
- protected boolean f_() {
+ protected boolean e_() {
return !this.abilities.isFlying;
}
@@ -1473,12 +1496,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return this.name;
}
- public LocaleLanguage getLocale() {
- return LocaleLanguage.a();
- }
-
- public String a(String s, Object... aobject) {
- return this.getLocale().a(s, aobject);
+ public World f_() {
+ return this.world;
}
public InventoryEnderChest getEnderChest() {
@@ -1489,7 +1508,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return i == 0 ? this.inventory.getItemInHand() : this.inventory.armor[i - 1];
}
- public ItemStack bG() {
+ public ItemStack aV() {
return this.inventory.getItemInHand();
}
@@ -1501,7 +1520,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
return this.inventory.armor;
}
- public boolean aw() {
+ public boolean av() {
return !this.abilities.isFlying;
}
@@ -1514,7 +1533,19 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
}
public String getScoreboardDisplayName() {
- // TODO: fun
+ // CraftBukkit todo: fun
return ScoreboardTeam.getPlayerDisplayName(this.getScoreboardTeam(), this.name);
}
+
+ public void m(float f) {
+ if (f < 0.0F) {
+ f = 0.0F;
+ }
+
+ this.getDataWatcher().watch(17, Float.valueOf(f));
+ }
+
+ public float bj() {
+ return this.getDataWatcher().getFloat(17);
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java
new file mode 100644
index 00000000..7d8f2b42
--- /dev/null
+++ b/src/main/java/net/minecraft/server/EntityInsentient.java
@@ -0,0 +1,884 @@
+package net.minecraft.server;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.UUID;
+
+//CraftBukkit start
+import org.bukkit.craftbukkit.event.CraftEventFactory;
+import org.bukkit.event.entity.EntityDamageByBlockEvent;
+import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.event.entity.EntityRegainHealthEvent;
+//CraftBukkit end
+
+public abstract class EntityInsentient extends EntityLiving {
+
+ public int a_;
+ protected int b;
+ private ControllerLook h;
+ private ControllerMove moveController;
+ private ControllerJump lookController;
+ private EntityAIBodyControl bn;
+ private Navigation navigation;
+ protected final PathfinderGoalSelector goalSelector;
+ protected final PathfinderGoalSelector targetSelector;
+ private EntityLiving goalTarget;
+ private EntitySenses bq;
+ private ItemStack[] equipment = new ItemStack[5];
+ public float[] dropChances = new float[5]; // CraftBukkit - protected -> public
+ public boolean canPickUpLoot; // CraftBukkit - private -> public
+ public boolean persistent; // CraftBukkit - private -> public
+ protected float f;
+ private Entity bu;
+ protected int g;
+ private boolean bv;
+ private Entity bw;
+ private NBTTagCompound bx;
+
+ public EntityInsentient(World world) {
+ super(world);
+ this.goalSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null);
+ this.targetSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null);
+ this.h = new ControllerLook(this);
+ this.moveController = new ControllerMove(this);
+ this.lookController = new ControllerJump(this);
+ this.bn = new EntityAIBodyControl(this);
+ this.navigation = new Navigation(this, world);
+ this.bq = new EntitySenses(this);
+
+ for (int i = 0; i < this.dropChances.length; ++i) {
+ this.dropChances[i] = 0.085F;
+ }
+ }
+
+ protected void ax() {
+ super.ax();
+ this.aT().b(GenericAttributes.b).a(16.0D);
+ }
+
+ public ControllerLook getControllerLook() {
+ return this.h;
+ }
+
+ public ControllerMove getControllerMove() {
+ return this.moveController;
+ }
+
+ public ControllerJump getControllerJump() {
+ return this.lookController;
+ }
+
+ public Navigation getNavigation() {
+ return this.navigation;
+ }
+
+ public EntitySenses getEntitySenses() {
+ return this.bq;
+ }
+
+ public EntityLiving getGoalTarget() {
+ return this.goalTarget;
+ }
+
+ public void setGoalTarget(EntityLiving entityliving) {
+ this.goalTarget = entityliving;
+ }
+
+ public boolean a(Class oclass) {
+ return EntityCreeper.class != oclass && EntityGhast.class != oclass;
+ }
+
+ public void n() {}
+
+ protected void a() {
+ super.a();
+ this.datawatcher.a(11, Byte.valueOf((byte) 0));
+ this.datawatcher.a(10, "");
+ }
+
+ public int o() {
+ return 80;
+ }
+
+ public void p() {
+ String s = this.r();
+
+ if (s != null) {
+ this.makeSound(s, this.aW(), this.aX());
+ }
+ }
+
+ public void x() {
+ super.x();
+ this.world.methodProfiler.a("mobBaseTick");
+ if (this.isAlive() && this.random.nextInt(1000) < this.a_++) {
+ this.a_ = -this.o();
+ this.p();
+ }
+
+ this.world.methodProfiler.b();
+ }
+
+ protected int getExpValue(EntityHuman entityhuman) {
+ if (this.b > 0) {
+ int i = this.b;
+ ItemStack[] aitemstack = this.getEquipment();
+
+ for (int j = 0; j < aitemstack.length; ++j) {
+ if (aitemstack[j] != null && this.dropChances[j] <= 1.0F) {
+ i += 1 + this.random.nextInt(3);
+ }
+ }
+
+ return i;
+ } else {
+ return this.b;
+ }
+ }
+
+ public void q() {
+ for (int i = 0; i < 20; ++i) {
+ double d0 = this.random.nextGaussian() * 0.02D;
+ double d1 = this.random.nextGaussian() * 0.02D;
+ double d2 = this.random.nextGaussian() * 0.02D;
+ double d3 = 10.0D;
+
+ this.world.addParticle("explode", this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width - d0 * d3, this.locY + (double) (this.random.nextFloat() * this.length) - d1 * d3, this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width - d2 * d3, d0, d1, d2);
+ }
+ }
+
+ public void l_() {
+ super.l_();
+ if (!this.world.isStatic) {
+ this.bB();
+ }
+ }
+
+ protected float f(float f, float f1) {
+ if (this.bb()) {
+ this.bn.a();
+ return f1;
+ } else {
+ return super.f(f, f1);
+ }
+ }
+
+ protected String r() {
+ return null;
+ }
+
+ protected int getLootId() {
+ return 0;
+ }
+
+ protected void dropDeathLoot(boolean flag, int i) {
+ // CraftBukkit start - Whole method
+ List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
+ int j = this.getLootId();
+
+ if (j > 0) {
+ int k = this.random.nextInt(3);
+
+ if (i > 0) {
+ k += this.random.nextInt(i + 1);
+ }
+
+ if (k > 0) {
+ loot.add(new org.bukkit.inventory.ItemStack(j, k));
+ }
+ }
+
+ // Determine rare item drops and add them to the loot
+ if (this.lastDamageByPlayerTime > 0) {
+ int k = this.random.nextInt(200) - i;
+
+ if (k < 5) {
+ ItemStack itemstack = this.l(k <= 0 ? 1 : 0);
+ if (itemstack != null) {
+ loot.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
+ }
+ }
+ }
+
+ CraftEventFactory.callEntityDeathEvent(this, loot); // raise event even for those times when the entity does not drop loot
+ // CraftBukkit end
+ }
+
+ public void b(NBTTagCompound nbttagcompound) {
+ super.b(nbttagcompound);
+ nbttagcompound.setBoolean("CanPickUpLoot", this.bz());
+ nbttagcompound.setBoolean("PersistenceRequired", this.persistent);
+ NBTTagList nbttaglist = new NBTTagList();
+
+ NBTTagCompound nbttagcompound1;
+
+ for (int i = 0; i < this.equipment.length; ++i) {
+ nbttagcompound1 = new NBTTagCompound();
+ if (this.equipment[i] != null) {
+ this.equipment[i].save(nbttagcompound1);
+ }
+
+ nbttaglist.add(nbttagcompound1);
+ }
+
+ nbttagcompound.set("Equipment", nbttaglist);
+ NBTTagList nbttaglist1 = new NBTTagList();
+
+ for (int j = 0; j < this.dropChances.length; ++j) {
+ nbttaglist1.add(new NBTTagFloat(j + "", this.dropChances[j]));
+ }
+
+ nbttagcompound.set("DropChances", nbttaglist1);
+ nbttagcompound.setString("CustomName", this.getCustomName());
+ nbttagcompound.setBoolean("CustomNameVisible", this.getCustomNameVisible());
+ nbttagcompound.setBoolean("Leashed", this.bv);
+ if (this.bw != null) {
+ nbttagcompound1 = new NBTTagCompound("Leash");
+ if (this.bw instanceof EntityLiving) {
+ nbttagcompound1.setLong("UUIDMost", this.bw.getUniqueID().getMostSignificantBits());
+ nbttagcompound1.setLong("UUIDLeast", this.bw.getUniqueID().getLeastSignificantBits());
+ } else if (this.bw instanceof EntityHanging) {
+ EntityHanging entityhanging = (EntityHanging) this.bw;
+
+ nbttagcompound1.setInt("X", entityhanging.x);
+ nbttagcompound1.setInt("Y", entityhanging.y);
+ nbttagcompound1.setInt("Z", entityhanging.z);
+ }
+
+ nbttagcompound.set("Leash", nbttagcompound1);
+ }
+ }
+
+ public void a(NBTTagCompound nbttagcompound) {
+ super.a(nbttagcompound);
+ this.h(nbttagcompound.getBoolean("CanPickUpLoot"));
+ this.persistent = nbttagcompound.getBoolean("PersistenceRequired");
+
+ // CraftBukkit start - If looting or persistence is false only use it if it was set after we started using it
+ boolean data = nbttagcompound.getBoolean("CanPickUpLoot");
+ if (isLevelAtLeast(nbttagcompound, 1) || data) {
+ this.canPickUpLoot = data;
+ }
+
+ data = nbttagcompound.getBoolean("PersistenceRequired");
+ if (isLevelAtLeast(nbttagcompound, 1) || data) {
+ this.persistent = data;
+ }
+ // 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;
+
+ if (nbttagcompound.hasKey("Equipment")) {
+ nbttaglist = nbttagcompound.getList("Equipment");
+
+ for (i = 0; i < this.equipment.length; ++i) {
+ this.equipment[i] = ItemStack.createStack((NBTTagCompound) nbttaglist.get(i));
+ }
+ }
+
+ if (nbttagcompound.hasKey("DropChances")) {
+ nbttaglist = nbttagcompound.getList("DropChances");
+
+ for (i = 0; i < nbttaglist.size(); ++i) {
+ this.dropChances[i] = ((NBTTagFloat) nbttaglist.get(i)).data;
+ }
+ }
+
+ this.bv = nbttagcompound.getBoolean("Leashed");
+ if (this.bv && nbttagcompound.hasKey("Leash")) {
+ this.bx = nbttagcompound.getCompound("Leash");
+ }
+ }
+
+ public void n(float f) {
+ this.bf = f;
+ }
+
+ public void i(float f) {
+ super.i(f);
+ this.n(f);
+ }
+
+ public void c() {
+ super.c();
+ this.world.methodProfiler.a("looting");
+ if (!this.world.isStatic && this.bz() && !this.aU && 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();
+
+ while (iterator.hasNext()) {
+ EntityItem entityitem = (EntityItem) iterator.next();
+
+ if (!entityitem.dead && entityitem.getItemStack() != null) {
+ ItemStack itemstack = entityitem.getItemStack();
+ int i = b(itemstack);
+
+ if (i > -1) {
+ boolean flag = true;
+ ItemStack itemstack1 = this.getEquipment(i);
+
+ if (itemstack1 != null) {
+ if (i == 0) {
+ if (itemstack.getItem() instanceof ItemSword && !(itemstack1.getItem() instanceof ItemSword)) {
+ flag = true;
+ } else if (itemstack.getItem() instanceof ItemSword && itemstack1.getItem() instanceof ItemSword) {
+ ItemSword itemsword = (ItemSword) itemstack.getItem();
+ ItemSword itemsword1 = (ItemSword) itemstack1.getItem();
+
+ if (itemsword.g() == itemsword1.g()) {
+ flag = itemstack.getData() > itemstack1.getData() || itemstack.hasTag() && !itemstack1.hasTag();
+ } else {
+ flag = itemsword.g() > itemsword1.g();
+ }
+ } else {
+ flag = false;
+ }
+ } else if (itemstack.getItem() instanceof ItemArmor && !(itemstack1.getItem() instanceof ItemArmor)) {
+ flag = true;
+ } else if (itemstack.getItem() instanceof ItemArmor && itemstack1.getItem() instanceof ItemArmor) {
+ ItemArmor itemarmor = (ItemArmor) itemstack.getItem();
+ ItemArmor itemarmor1 = (ItemArmor) itemstack1.getItem();
+
+ if (itemarmor.c == itemarmor1.c) {
+ flag = itemstack.getData() > itemstack1.getData() || itemstack.hasTag() && !itemstack1.hasTag();
+ } else {
+ flag = itemarmor.c > itemarmor1.c;
+ }
+ } else {
+ flag = false;
+ }
+ }
+
+ if (flag) {
+ if (itemstack1 != null && this.random.nextFloat() - 0.1F < this.dropChances[i]) {
+ this.a(itemstack1, 0.0F);
+ }
+
+ this.setEquipment(i, itemstack);
+ this.dropChances[i] = 2.0F;
+ this.persistent = true;
+ this.receive(entityitem, 1);
+ entityitem.die();
+ }
+ }
+ }
+ }
+ }
+
+ this.world.methodProfiler.b();
+ }
+
+ protected boolean bb() {
+ return false;
+ }
+
+ protected boolean isTypeNotPersistent() {
+ return true;
+ }
+
+ protected void bk() {
+ if (this.persistent) {
+ this.aV = 0;
+ } else {
+ EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
+
+ if (entityhuman != null) {
+ double d0 = entityhuman.locX - this.locX;
+ double d1 = entityhuman.locY - this.locY;
+ double d2 = entityhuman.locZ - this.locZ;
+ double d3 = d0 * d0 + d1 * d1 + d2 * d2;
+
+ if (d3 > 16384.0D) { // CraftBukkit - remove isTypeNotPersistent() check
+ this.die();
+ }
+
+ if (this.aV > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check
+ this.die();
+ } else if (d3 < 1024.0D) {
+ this.aV = 0;
+ }
+ }
+ }
+ }
+
+ protected void be() {
+ ++this.aV;
+ this.world.methodProfiler.a("checkDespawn");
+ this.bk();
+ this.world.methodProfiler.b();
+ this.world.methodProfiler.a("sensing");
+ this.bq.a();
+ this.world.methodProfiler.b();
+ this.world.methodProfiler.a("targetSelector");
+ this.targetSelector.a();
+ this.world.methodProfiler.b();
+ this.world.methodProfiler.a("goalSelector");
+ this.goalSelector.a();
+ this.world.methodProfiler.b();
+ this.world.methodProfiler.a("navigation");
+ this.navigation.f();
+ this.world.methodProfiler.b();
+ this.world.methodProfiler.a("mob tick");
+ this.bg();
+ this.world.methodProfiler.b();
+ this.world.methodProfiler.a("controls");
+ this.world.methodProfiler.a("move");
+ this.moveController.c();
+ this.world.methodProfiler.c("look");
+ this.h.a();
+ this.world.methodProfiler.c("jump");
+ this.lookController.b();
+ this.world.methodProfiler.b();
+ this.world.methodProfiler.b();
+ }
+
+ protected void bh() {
+ super.bh();
+ this.be = 0.0F;
+ this.bf = 0.0F;
+ this.bk();
+ float f = 8.0F;
+
+ if (this.random.nextFloat() < 0.02F) {
+ EntityHuman entityhuman = this.world.findNearbyPlayer(this, (double) f);
+
+ if (entityhuman != null) {
+ this.bu = entityhuman;
+ this.g = 10 + this.random.nextInt(20);
+ } else {
+ this.bg = (this.random.nextFloat() - 0.5F) * 20.0F;
+ }
+ }
+
+ if (this.bu != null) {
+ this.a(this.bu, 10.0F, (float) this.bl());
+ if (this.g-- <= 0 || this.bu.dead || this.bu.e((Entity) this) > (double) (f * f)) {
+ this.bu = null;
+ }
+ } else {
+ if (this.random.nextFloat() < 0.05F) {
+ this.bg = (this.random.nextFloat() - 0.5F) * 20.0F;
+ }
+
+ this.yaw += this.bg;
+ this.pitch = this.f;
+ }
+
+ boolean flag = this.G();
+ boolean flag1 = this.I();
+
+ if (flag || flag1) {
+ this.bd = this.random.nextFloat() < 0.8F;
+ }
+ }
+
+ public int bl() {
+ return 40;
+ }
+
+ public void a(Entity entity, float f, float f1) {
+ double d0 = entity.locX - this.locX;
+ double d1 = entity.locZ - this.locZ;
+ double d2;
+
+ if (entity instanceof EntityLiving) {
+ EntityLiving entityliving = (EntityLiving) entity;
+
+ 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());
+ }
+
+ double d3 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1);
+ 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.yaw = this.b(this.yaw, f2, f);
+ }
+
+ private float b(float f, float f1, float f2) {
+ float f3 = MathHelper.g(f1 - f);
+
+ if (f3 > f2) {
+ f3 = f2;
+ }
+
+ if (f3 < -f2) {
+ f3 = -f2;
+ }
+
+ return f + f3;
+ }
+
+ public boolean canSpawn() {
+ return this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
+ }
+
+ public int br() {
+ return 4;
+ }
+
+ public int aq() {
+ if (this.getGoalTarget() == null) {
+ return 3;
+ } else {
+ int i = (int) (this.getHealth() - this.maxHealth * 0.33F); // CraftBukkit - this.getMaxHealth() -> this.maxHealth
+
+ i -= (3 - this.world.difficulty) * 4;
+ if (i < 0) {
+ i = 0;
+ }
+
+ return i + 3;
+ }
+ }
+
+ public ItemStack aV() {
+ return this.equipment[0];
+ }
+
+ public ItemStack getEquipment(int i) {
+ return this.equipment[i];
+ }
+
+ public ItemStack o(int i) {
+ return this.equipment[i + 1];
+ }
+
+ public void setEquipment(int i, ItemStack itemstack) {
+ this.equipment[i] = itemstack;
+ }
+
+ public ItemStack[] getEquipment() {
+ return this.equipment;
+ }
+
+ protected void dropEquipment(boolean flag, int i) {
+ for (int j = 0; j < this.getEquipment().length; ++j) {
+ ItemStack itemstack = this.getEquipment(j);
+ 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.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;
+ }
+
+ if (l < 1) {
+ l = 1;
+ }
+
+ itemstack.setData(l);
+ }
+
+ this.a(itemstack, 0.0F);
+ }
+ }
+ }
+
+ protected void bs() {
+ if (this.random.nextFloat() < 0.15F * this.world.b(this.locX, this.locY, this.locZ)) {
+ int i = this.random.nextInt(2);
+ float f = this.world.difficulty == 3 ? 0.1F : 0.25F;
+
+ if (this.random.nextFloat() < 0.095F) {
+ ++i;
+ }
+
+ if (this.random.nextFloat() < 0.095F) {
+ ++i;
+ }
+
+ if (this.random.nextFloat() < 0.095F) {
+ ++i;
+ }
+
+ for (int j = 3; j >= 0; --j) {
+ ItemStack itemstack = this.o(j);
+
+ if (j < 3 && this.random.nextFloat() < f) {
+ break;
+ }
+
+ if (itemstack == null) {
+ Item item = a(j + 1, i);
+
+ if (item != null) {
+ this.setEquipment(j + 1, new ItemStack(item));
+ }
+ }
+ }
+ }
+ }
+
+ 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()).b) {
+ case 0:
+ return 4;
+
+ case 1:
+ return 3;
+
+ case 2:
+ return 2;
+
+ case 3:
+ return 1;
+ }
+ }
+
+ return 0;
+ } else {
+ return 4;
+ }
+ }
+
+ public static Item a(int i, int j) {
+ switch (i) {
+ case 4:
+ if (j == 0) {
+ return Item.LEATHER_HELMET;
+ } else if (j == 1) {
+ return Item.GOLD_HELMET;
+ } else if (j == 2) {
+ return Item.CHAINMAIL_HELMET;
+ } else if (j == 3) {
+ return Item.IRON_HELMET;
+ } else if (j == 4) {
+ return Item.DIAMOND_HELMET;
+ }
+
+ case 3:
+ if (j == 0) {
+ return Item.LEATHER_CHESTPLATE;
+ } else if (j == 1) {
+ return Item.GOLD_CHESTPLATE;
+ } else if (j == 2) {
+ return Item.CHAINMAIL_CHESTPLATE;
+ } else if (j == 3) {
+ return Item.IRON_CHESTPLATE;
+ } else if (j == 4) {
+ return Item.DIAMOND_CHESTPLATE;
+ }
+
+ case 2:
+ if (j == 0) {
+ return Item.LEATHER_LEGGINGS;
+ } else if (j == 1) {
+ return Item.GOLD_LEGGINGS;
+ } else if (j == 2) {
+ return Item.CHAINMAIL_LEGGINGS;
+ } else if (j == 3) {
+ return Item.IRON_LEGGINGS;
+ } else if (j == 4) {
+ return Item.DIAMOND_LEGGINGS;
+ }
+
+ case 1:
+ if (j == 0) {
+ return Item.LEATHER_BOOTS;
+ } else if (j == 1) {
+ return Item.GOLD_BOOTS;
+ } else if (j == 2) {
+ return Item.CHAINMAIL_BOOTS;
+ } else if (j == 3) {
+ return Item.IRON_BOOTS;
+ } else if (j == 4) {
+ return Item.DIAMOND_BOOTS;
+ }
+
+ default:
+ return null;
+ }
+ }
+
+ protected void bt() {
+ float f = this.world.b(this.locX, this.locY, this.locZ);
+
+ if (this.aV() != null && this.random.nextFloat() < 0.25F * f) {
+ EnchantmentManager.a(this.random, this.aV(), (int) (5.0F + f * (float) this.random.nextInt(18)));
+ }
+
+ for (int i = 0; i < 4; ++i) {
+ ItemStack itemstack = this.o(i);
+
+ if (itemstack != null && this.random.nextFloat() < 0.5F * f) {
+ EnchantmentManager.a(this.random, itemstack, (int) (5.0F + f * (float) this.random.nextInt(18)));
+ }
+ }
+ }
+
+ public GroupDataEntity a(GroupDataEntity groupdataentity) {
+ this.a(GenericAttributes.b).a(new AttributeModifier("Random spawn bonus", this.random.nextGaussian() * 0.05D, 1));
+ return groupdataentity;
+ }
+
+ public boolean bu() {
+ return false;
+ }
+
+ public String getLocalizedName() {
+ return this.hasCustomName() ? this.getCustomName() : super.getLocalizedName();
+ }
+
+ public void bv() {
+ this.persistent = true;
+ }
+
+ public void setCustomName(String s) {
+ this.datawatcher.watch(10, s);
+ }
+
+ public String getCustomName() {
+ return this.datawatcher.getString(10);
+ }
+
+ public boolean hasCustomName() {
+ return this.datawatcher.getString(10).length() > 0;
+ }
+
+ public void setCustomNameVisible(boolean flag) {
+ this.datawatcher.watch(11, Byte.valueOf((byte) (flag ? 1 : 0)));
+ }
+
+ public boolean getCustomNameVisible() {
+ return this.datawatcher.getByte(11) == 1;
+ }
+
+ public void a(int i, float f) {
+ this.dropChances[i] = f;
+ }
+
+ public boolean bz() {
+ return this.canPickUpLoot;
+ }
+
+ public void h(boolean flag) {
+ this.canPickUpLoot = flag;
+ }
+
+ public boolean bA() {
+ return this.persistent;
+ }
+
+ public final boolean c(EntityHuman entityhuman) {
+ if (this.bD() && this.bE() == entityhuman) {
+ this.i(true);
+ return true;
+ } else {
+ ItemStack itemstack = entityhuman.inventory.getItemInHand();
+
+ if (itemstack != null && itemstack.id == Item.LEASH.id && this.bC()) {
+ if (!(this instanceof EntityTameableAnimal) || !((EntityTameableAnimal) this).isTamed()) {
+ this.b(entityhuman, true);
+ --itemstack.count;
+ return true;
+ }
+
+ if (entityhuman.getName().equalsIgnoreCase(((EntityTameableAnimal) this).getOwnerName())) {
+ this.b(entityhuman, true);
+ --itemstack.count;
+ return true;
+ }
+ }
+
+ return this.a(entityhuman) ? true : super.c(entityhuman);
+ }
+ }
+
+ protected boolean a(EntityHuman entityhuman) {
+ return false;
+ }
+
+ protected void bB() {
+ if (this.bx != null) {
+ this.bF();
+ }
+
+ if (this.bv) {
+ if (this.bw == null || this.bw.dead) {
+ this.i(true);
+ }
+ }
+ }
+
+ public void i(boolean flag) {
+ if (this.bv) {
+ this.bv = false;
+ this.bw = null;
+ if (!this.world.isStatic) {
+ this.b(Item.LEASH.id, 1);
+ }
+
+ if (!this.world.isStatic && flag && this.world instanceof WorldServer) {
+ ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet39AttachEntity(1, this, (Entity) null)));
+ }
+ }
+ }
+
+ public boolean bC() {
+ return !this.bD() && !(this instanceof IMonster);
+ }
+
+ public boolean bD() {
+ return this.bv;
+ }
+
+ public Entity bE() {
+ return this.bw;
+ }
+
+ public void b(Entity entity, boolean flag) {
+ this.bv = true;
+ this.bw = entity;
+ if (!this.world.isStatic && flag && this.world instanceof WorldServer) {
+ ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet39AttachEntity(1, this, this.bw)));
+ }
+ }
+
+ private void bF() {
+ if (this.bv && this.bx != null) {
+ if (this.bx.hasKey("UUIDMost") && this.bx.hasKey("UUIDLeast")) {
+ UUID uuid = new UUID(this.bx.getLong("UUIDMost"), this.bx.getLong("UUIDLeast"));
+ List list = this.world.a(EntityLiving.class, this.boundingBox.grow(10.0D, 10.0D, 10.0D));
+ Iterator iterator = list.iterator();
+
+ while (iterator.hasNext()) {
+ EntityLiving entityliving = (EntityLiving) iterator.next();
+
+ if (entityliving.getUniqueID().equals(uuid)) {
+ this.bw = entityliving;
+ break;
+ }
+ }
+ } else if (this.bx.hasKey("X") && this.bx.hasKey("Y") && this.bx.hasKey("Z")) {
+ int i = this.bx.getInt("X");
+ int j = this.bx.getInt("Y");
+ int k = this.bx.getInt("Z");
+ EntityLeash entityleash = EntityLeash.b(this.world, i, j, k);
+
+ if (entityleash == null) {
+ entityleash = EntityLeash.a(this.world, i, j, k);
+ }
+
+ this.bw = entityleash;
+ } else {
+ this.i(false);
+ }
+ }
+
+ this.bx = null;
+ }
+}
diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java
index d2c5857e..35826769 100644
--- a/src/main/java/net/minecraft/server/EntityIronGolem.java
+++ b/src/main/java/net/minecraft/server/EntityIronGolem.java
@@ -4,27 +4,26 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
public class EntityIronGolem extends EntityGolem {
- private int e = 0;
- Village d = null;
- private int f;
- private int g;
+ private int bq;
+ Village bp;
+ private int br;
+ private int bs;
public EntityIronGolem(World world) {
super(world);
- this.texture = "/mob/villager_golem.png";
this.a(1.4F, 2.9F);
this.getNavigation().a(true);
- this.goalSelector.a(1, new PathfinderGoalMeleeAttack(this, 0.25F, true));
- this.goalSelector.a(2, new PathfinderGoalMoveTowardsTarget(this, 0.22F, 32.0F));
- this.goalSelector.a(3, new PathfinderGoalMoveThroughVillage(this, 0.16F, true));
- this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, 0.16F));
+ this.goalSelector.a(1, new PathfinderGoalMeleeAttack(this, 1.0D, true));
+ this.goalSelector.a(2, new PathfinderGoalMoveTowardsTarget(this, 0.9D, 32.0F));
+ this.goalSelector.a(3, new PathfinderGoalMoveThroughVillage(this, 0.6D, true));
+ this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
this.goalSelector.a(5, new PathfinderGoalOfferFlower(this));
- this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, 0.16F));
+ this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, 0.6D));
this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
this.targetSelector.a(1, new PathfinderGoalDefendVillage(this));
this.targetSelector.a(2, new PathfinderGoalHurtByTarget(this, false));
- this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityLiving.class, 16.0F, 0, false, true, IMonster.a));
+ this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget(this, EntityInsentient.class, 0, false, true, IMonster.a));
}
protected void a() {
@@ -32,50 +31,52 @@ public class EntityIronGolem extends EntityGolem {
this.datawatcher.a(16, Byte.valueOf((byte) 0));
}
- public boolean bh() {
+ public boolean bb() {
return true;
}
- 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.aO();
+ protected void bg() {
+ if (--this.bq <= 0) {
+ this.bq = 70 + this.random.nextInt(50);
+ this.bp = this.world.villages.getClosestVillage(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 32);
+ if (this.bp == null) {
+ this.bN();
} else {
- ChunkCoordinates chunkcoordinates = this.d.getCenter();
+ ChunkCoordinates chunkcoordinates = this.bp.getCenter();
- this.b(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, (int) ((float) this.d.getSize() * 0.6F));
+ this.b(chunkcoordinates.x, chunkcoordinates.y, chunkcoordinates.z, (int) ((float) this.bp.getSize() * 0.6F));
}
}
- super.bp();
+ super.bg();
}
- public int getMaxHealth() {
- return 100;
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.a).a(100.0D);
+ this.a(GenericAttributes.d).a(0.25D);
}
protected int h(int i) {
return i;
}
- protected void o(Entity entity) {
- if (entity instanceof IMonster && this.aE().nextInt(20) == 0) {
+ protected void n(Entity entity) {
+ if (entity instanceof IMonster && this.aB().nextInt(20) == 0) {
this.setGoalTarget((EntityLiving) entity);
}
- super.o(entity);
+ super.n(entity);
}
public void c() {
super.c();
- if (this.f > 0) {
- --this.f;
+ if (this.br > 0) {
+ --this.br;
}
- if (this.g > 0) {
- --this.g;
+ if (this.bs > 0) {
+ --this.bs;
}
if (this.motX * this.motX + this.motZ * this.motZ > 2.500000277905201E-7D && this.random.nextInt(5) == 0) {
@@ -91,12 +92,12 @@ public class EntityIronGolem extends EntityGolem {
}
public boolean a(Class oclass) {
- return this.p() && EntityHuman.class.isAssignableFrom(oclass) ? false : super.a(oclass);
+ return this.bS() && EntityHuman.class.isAssignableFrom(oclass) ? false : super.a(oclass);
}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
- nbttagcompound.setBoolean("PlayerCreated", this.p());
+ nbttagcompound.setBoolean("PlayerCreated", this.bS());
}
public void a(NBTTagCompound nbttagcompound) {
@@ -105,9 +106,9 @@ public class EntityIronGolem extends EntityGolem {
}
public boolean m(Entity entity) {
- this.f = 10;
+ this.br = 10;
this.world.broadcastEntityEffect(this, (byte) 4);
- boolean flag = entity.damageEntity(DamageSource.mobAttack(this), 7 + this.random.nextInt(15));
+ boolean flag = entity.damageEntity(DamageSource.mobAttack(this), (float) (7 + this.random.nextInt(15)));
if (flag) {
entity.motY += 0.4000000059604645D;
@@ -117,24 +118,24 @@ public class EntityIronGolem extends EntityGolem {
return flag;
}
- public Village m() {
- return this.d;
+ public Village bP() {
+ return this.bp;
}
public void a(boolean flag) {
- this.g = flag ? 400 : 0;
+ this.bs = flag ? 400 : 0;
this.world.broadcastEntityEffect(this, (byte) 11);
}
- protected String bb() {
+ protected String r() {
return "none";
}
- protected String bc() {
+ protected String aK() {
return "mob.irongolem.hit";
}
- protected String bd() {
+ protected String aL() {
return "mob.irongolem.death";
}
@@ -163,11 +164,11 @@ public class EntityIronGolem extends EntityGolem {
// CraftBukkit end
}
- public int o() {
- return this.g;
+ public int bR() {
+ return this.bs;
}
- public boolean p() {
+ public boolean bS() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
@@ -182,8 +183,8 @@ public class EntityIronGolem extends EntityGolem {
}
public void die(DamageSource damagesource) {
- if (!this.p() && this.killer != null && this.d != null) {
- this.d.a(this.killer.getName(), -5);
+ if (!this.bS() && this.killer != null && this.bp != null) {
+ this.bp.a(this.killer.getName(), -5);
}
super.die(damagesource);
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
index 0225f535..cb2b1143 100644
--- a/src/main/java/net/minecraft/server/EntityItem.java
+++ b/src/main/java/net/minecraft/server/EntityItem.java
@@ -14,7 +14,6 @@ public class EntityItem extends Entity {
public EntityItem(World world, double d0, double d1, double d2) {
super(world);
- this.age = 0;
this.d = 5;
this.c = (float) (Math.random() * 3.141592653589793D * 2.0D);
this.a(0.25F, 0.25F);
@@ -36,13 +35,12 @@ public class EntityItem extends Entity {
this.setItemStack(itemstack);
}
- protected boolean f_() {
+ protected boolean e_() {
return false;
}
public EntityItem(World world) {
super(world);
- this.age = 0;
this.d = 5;
this.c = (float) (Math.random() * 3.141592653589793D * 2.0D);
this.a(0.25F, 0.25F);
@@ -79,7 +77,7 @@ public class EntityItem extends Entity {
}
if (!this.world.isStatic) {
- this.g();
+ this.e();
}
}
@@ -113,7 +111,7 @@ public class EntityItem extends Entity {
}
}
- private void g() {
+ private void e() {
Iterator iterator = this.world.a(EntityItem.class, this.boundingBox.grow(0.5D, 0.0D, 0.5D)).iterator();
while (iterator.hasNext()) {
@@ -136,7 +134,7 @@ public class EntityItem extends Entity {
return false;
} else if (itemstack1.hasTag() && !itemstack1.getTag().equals(itemstack.getTag())) {
return false;
- } else if (itemstack1.getItem().m() && itemstack1.getData() != itemstack.getData()) {
+ } else if (itemstack1.getItem().n() && itemstack1.getData() != itemstack.getData()) {
return false;
} else if (itemstack1.count < itemstack.count) {
return entityitem.a(this);
@@ -164,17 +162,17 @@ public class EntityItem extends Entity {
}
protected void burn(int i) {
- this.damageEntity(DamageSource.FIRE, i);
+ this.damageEntity(DamageSource.FIRE, (float) i);
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else if (this.getItemStack() != null && this.getItemStack().id == Item.NETHER_STAR.id && damagesource.c()) {
return false;
} else {
this.J();
- this.d -= i;
+ this.d = (int) ((float) this.d - f);
if (this.d <= 0) {
this.die();
}
@@ -225,7 +223,7 @@ public class EntityItem extends Entity {
if (this.pickupDelay <= 0 && canHold > 0) {
itemstack.count = canHold;
PlayerPickupItemEvent event = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining);
- event.setCancelled(!entityhuman.canPickUpLoot);
+ // event.setCancelled(!entityhuman.canPickUpLoot); TODO
this.world.getServer().getPluginManager().callEvent(event);
itemstack.count = canHold + remaining;
@@ -268,14 +266,14 @@ public class EntityItem extends Entity {
return LocaleI18n.get("item." + this.getItemStack().a());
}
- public boolean ap() {
+ public boolean ao() {
return false;
}
- public void c(int i) {
- super.c(i);
+ public void b(int i) {
+ super.b(i);
if (!this.world.isStatic) {
- this.g();
+ this.e();
}
}
diff --git a/src/main/java/net/minecraft/server/EntityLargeFireball.java b/src/main/java/net/minecraft/server/EntityLargeFireball.java
index 0aebd902..748acd81 100644
--- a/src/main/java/net/minecraft/server/EntityLargeFireball.java
+++ b/src/main/java/net/minecraft/server/EntityLargeFireball.java
@@ -17,7 +17,7 @@ public class EntityLargeFireball extends EntityFireball {
protected void a(MovingObjectPosition movingobjectposition) {
if (!this.world.isStatic) {
if (movingobjectposition.entity != null) {
- movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 6);
+ movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 6.0F);
}
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java
index 83c45101..a438d674 100644
--- a/src/main/java/net/minecraft/server/EntityLightning.java
+++ b/src/main/java/net/minecraft/server/EntityLightning.java
@@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class EntityLightning extends EntityWeather {
private int lifeTicks;
- public long a = 0L;
+ public long a;
private int c;
// CraftBukkit start
@@ -32,7 +32,7 @@ public class EntityLightning extends EntityWeather {
this.c = this.random.nextInt(3) + 1;
// CraftBukkit
- if (!isEffect && !world.isStatic && world.difficulty >= 2 && world.areChunksLoaded(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) {
+ if (!isEffect && !world.isStatic && world.getGameRules().getBoolean("doFireTick") && world.difficulty >= 2 && world.areChunksLoaded(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2), 10)) {
int i = MathHelper.floor(d0);
int j = MathHelper.floor(d1);
int k = MathHelper.floor(d2);
@@ -77,7 +77,7 @@ public class EntityLightning extends EntityWeather {
this.lifeTicks = 1;
this.a = this.random.nextLong();
// CraftBukkit
- if (!this.isEffect && !this.world.isStatic && this.world.areChunksLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 10)) {
+ if (!isEffect && !this.world.isStatic && this.world.getGameRules().getBoolean("doFireTick") && this.world.areChunksLoaded(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ), 10)) {
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locY);
int k = MathHelper.floor(this.locZ);
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 965e6ce4..0d9ba820 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -5,7 +5,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
-import java.util.concurrent.Callable;
+import java.util.UUID;
// CraftBukkit start
import org.bukkit.craftbukkit.event.CraftEventFactory;
@@ -16,206 +16,100 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
public abstract class EntityLiving extends Entity {
- 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.07F};
- public static final float[] au = new float[] { 0.0F, 0.1F, 0.15F, 0.45F};
- public int maxNoDamageTicks = 20;
- public float aw;
+ private static final UUID b = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D");
+ private static final AttributeModifier c = (new AttributeModifier(b, "Sprinting speed boost", 0.30000001192092896D, 2)).a(false);
+ private AttributeMapBase d;
+ public CombatTracker combatTracker = new CombatTracker(this); // CraftBukkit - private -> public, remove final
+ public final HashMap effects = new HashMap(); // CraftBukkit - protected -> public
+ private final ItemStack[] g = new ItemStack[5];
+ public boolean au;
+ public int av;
+ public int aw;
public float ax;
- public float ay = 0.0F;
- public float az = 0.0F;
- public float aA = 0.0F;
- public float aB = 0.0F;
- protected float aC;
- protected float aD;
- protected float aE;
- protected float aF;
- protected boolean aG = true;
- protected String texture = "/mob/char.png";
- 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 aT;
- protected int aU;
- public int aV;
public int hurtTicks;
- public int aX;
- public float aY = 0.0F;
- public int deathTicks = 0;
- public int attackTicks = 0;
- public float bb;
- 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 bm = 0;
- public HashMap effects = new HashMap(); // CraftBukkit - protected -> public
+ public int az;
+ public float aA;
+ public int deathTicks;
+ public int attackTicks;
+ public float aD;
+ public float aE;
+ public float aF;
+ public float aG;
+ public float aH;
+ public int maxNoDamageTicks = 20;
+ public float aJ;
+ public float aK;
+ public float aL;
+ public float aM;
+ public float aN;
+ public float aO;
+ public float aP;
+ public float aQ;
+ public float aR = 0.02F;
+ public EntityHuman killer; // CraftBukkit - protected -> public
+ protected int lastDamageByPlayerTime;
+ protected boolean aU;
+ protected int aV;
+ protected float aW;
+ protected float aX;
+ protected float aY;
+ protected float aZ;
+ protected float ba;
+ protected int bb;
+ public float lastDamage; // CraftBukkit - protected -> public
+ protected boolean bd;
+ public float be;
+ public float bf;
+ protected float bg;
+ protected int bh;
+ protected double bi;
+ protected double bj;
+ protected double bk;
+ protected double bl;
+ protected double bm;
public boolean updateEffects = true; // CraftBukkit - private -> public
- private int i;
- private ControllerLook lookController;
- private ControllerMove moveController;
- private ControllerJump jumpController;
- private EntityAIBodyControl senses;
- private Navigation navigation;
- protected final PathfinderGoalSelector goalSelector;
- protected final PathfinderGoalSelector targetSelector;
- private EntityLiving goalTarget;
- 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[] 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 CombatTracker bt = new CombatTracker(this); // CraftBukkit - remove final
- protected int bu;
- protected double bv;
- protected double bw;
- protected double bx;
- protected double by;
- protected double bz;
- float bA = 0.0F;
- public int lastDamage = 0; // CraftBukkit - protected -> public
- protected int bC = 0;
- protected float bD;
- protected float bE;
- 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;
+ public EntityLiving lastDamager; // CraftBukkit - private -> public
+ private int j;
+ private EntityLiving bn;
+ private float bo;
+ private int bp;
+ private float bq;
// CraftBukkit start
- public int expToDrop = 0;
+ public int expToDrop;
public int maxAirTicks = 300;
- public int maxHealth = this.getMaxHealth();
+ public float maxHealth;
// CraftBukkit end
public EntityLiving(World world) {
super(world);
+ this.ax();
+ this.setHealth(this.getMaxHealth());
this.m = true;
- this.goalSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null);
- this.targetSelector = new PathfinderGoalSelector(world != null && world.methodProfiler != null ? world.methodProfiler : null);
- this.lookController = new ControllerLook(this);
- this.moveController = new ControllerMove(this);
- this.jumpController = new ControllerJump(this);
- this.senses = new EntityAIBodyControl(this);
- this.navigation = new Navigation(this, world, (float) this.ay());
- this.bP = new EntitySenses(this);
- this.ax = (float) (Math.random() + 1.0D) * 0.01F;
+ this.aM = (float) (Math.random() + 1.0D) * 0.01F;
this.setPosition(this.locX, this.locY, this.locZ);
- this.aw = (float) Math.random() * 12398.0F;
+ this.aL = (float) Math.random() * 12398.0F;
this.yaw = (float) (Math.random() * 3.1415927410125732D * 2.0D);
- this.aA = this.yaw;
-
- for (int i = 0; i < this.dropChances.length; ++i) {
- this.dropChances[i] = 0.085F;
- }
-
+ this.aP = this.yaw;
this.Y = 0.5F;
+ maxHealth = this.getMaxHealth(); // CraftBukkit - We can't initialize maxHealth until this.ax() has been invoked.
}
- protected int ay() {
- return 16;
- }
-
- public ControllerLook getControllerLook() {
- return this.lookController;
- }
-
- public ControllerMove getControllerMove() {
- return this.moveController;
- }
-
- public ControllerJump getControllerJump() {
- return this.jumpController;
- }
-
- public Navigation getNavigation() {
- return this.navigation;
- }
-
- public EntitySenses getEntitySenses() {
- return this.bP;
- }
-
- public Random aE() {
- return this.random;
- }
-
- public EntityLiving aF() {
- return this.lastDamager;
- }
-
- public EntityLiving aG() {
- return this.g;
+ protected void a() {
+ this.datawatcher.a(7, Integer.valueOf(0));
+ this.datawatcher.a(8, Byte.valueOf((byte) 0));
+ this.datawatcher.a(9, Byte.valueOf((byte) 0));
+ this.datawatcher.a(6, Float.valueOf(1.0F));
}
- public void l(Entity entity) {
- if (entity instanceof EntityLiving) {
- this.g = (EntityLiving) entity;
+ protected void ax() {
+ this.aT().b(GenericAttributes.a);
+ this.aT().b(GenericAttributes.c);
+ this.aT().b(GenericAttributes.d);
+ if (!this.bb()) {
+ this.a(GenericAttributes.d).a(0.10000000149011612D);
}
}
- public int aH() {
- return this.bC;
- }
-
- public float getHeadRotation() {
- return this.aA;
- }
-
- public float aI() {
- return this.bQ;
- }
-
- public void e(float f) {
- this.bQ = f;
- this.f(f);
- }
-
- public boolean m(Entity entity) {
- this.l(entity);
- return false;
- }
-
- public EntityLiving getGoalTarget() {
- return this.goalTarget;
- }
-
- public void setGoalTarget(EntityLiving entityliving) {
- this.goalTarget = entityliving;
- }
-
- public boolean a(Class oclass) {
- return EntityCreeper.class != oclass && EntityGhast.class != oclass;
- }
-
- public void aK() {}
-
protected void a(double d0, boolean flag) {
if (!this.G()) {
this.H();
@@ -243,87 +137,16 @@ public abstract class EntityLiving extends Entity {
super.a(d0, flag);
}
- public boolean aL() {
- return this.d(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
- }
-
- 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.bR.b(i, j, k);
- this.bS = (float) l;
- }
-
- public ChunkCoordinates aM() {
- return this.bR;
- }
-
- public float aN() {
- return this.bS;
- }
-
- public void aO() {
- this.bS = -1.0F;
- }
-
- public boolean aP() {
- return this.bS != -1.0F;
- }
-
- public void c(EntityLiving entityliving) {
- this.lastDamager = entityliving;
- 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 K() {
- return !this.dead;
- }
-
- public boolean L() {
- return !this.dead;
- }
-
- public float getHeadHeight() {
- return this.length * 0.85F;
- }
-
- public int aQ() {
- return 80;
- }
-
- public void aR() {
- String s = this.bb();
-
- if (s != null) {
- this.makeSound(s, this.ba(), this.aY());
- }
+ public boolean ay() {
+ return false;
}
public void x() {
- this.aQ = this.aR;
+ this.aD = this.aE;
super.x();
- this.world.methodProfiler.a("mobBaseTick");
- if (this.isAlive() && this.random.nextInt(1000) < this.aV++) {
- this.aV = -this.aQ();
- this.aR();
- }
-
+ this.world.methodProfiler.a("livingEntityBaseTick");
if (this.isAlive() && this.inBlock()) {
- this.damageEntity(DamageSource.STUCK, 1);
+ this.damageEntity(DamageSource.STUCK, 1.0F);
}
if (this.isFireproof() || this.world.isStatic) {
@@ -332,23 +155,28 @@ public abstract class EntityLiving extends Entity {
boolean flag = this instanceof EntityHuman && ((EntityHuman) this).abilities.isInvulnerable;
- 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);
+ if (this.isAlive() && this.a(Material.WATER)) {
+ if (!this.ay() && !this.hasEffect(MobEffectList.WATER_BREATHING.id) && !flag) {
+ this.setAirTicks(this.h(this.getAirTicks()));
+ if (this.getAirTicks() == -20) {
+ this.setAirTicks(0);
- for (int i = 0; i < 8; ++i) {
- float f = this.random.nextFloat() - this.random.nextFloat();
- float f1 = this.random.nextFloat() - this.random.nextFloat();
- float f2 = this.random.nextFloat() - this.random.nextFloat();
+ for (int i = 0; i < 8; ++i) {
+ float f = this.random.nextFloat() - this.random.nextFloat();
+ float f1 = this.random.nextFloat() - this.random.nextFloat();
+ float f2 = this.random.nextFloat() - this.random.nextFloat();
- this.world.addParticle("bubble", this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, this.motX, this.motY, this.motZ);
- }
+ this.world.addParticle("bubble", this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, this.motX, this.motY, this.motZ);
+ }
- this.damageEntity(DamageSource.DROWN, 2);
+ this.damageEntity(DamageSource.DROWN, 2.0F);
+ }
}
this.extinguish();
+ if (!this.world.isStatic && this.ae() && this.vehicle instanceof EntityLiving) {
+ this.mount((Entity) null);
+ }
} else {
// CraftBukkit start - Only set if needed to work around a DataWatcher inefficiency
if (this.getAirTicks() != 300) {
@@ -357,7 +185,7 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit end
}
- this.bb = this.bc;
+ this.aJ = this.aK;
if (this.attackTicks > 0) {
--this.attackTicks;
}
@@ -370,8 +198,8 @@ public abstract class EntityLiving extends Entity {
--this.noDamageTicks;
}
- if (this.health <= 0) {
- this.aS();
+ if (this.getHealth() <= 0.0F) {
+ this.az();
}
if (this.lastDamageByPlayerTime > 0) {
@@ -380,24 +208,24 @@ public abstract class EntityLiving extends Entity {
this.killer = null;
}
- if (this.g != null && !this.g.isAlive()) {
- this.g = null;
+ if (this.bn != null && !this.bn.isAlive()) {
+ this.bn = null;
}
if (this.lastDamager != null) {
if (!this.lastDamager.isAlive()) {
- this.c((EntityLiving) null);
- } else if (this.f > 0) {
- --this.f;
+ this.b((EntityLiving) null);
+ } else if (this.j > 0) {
+ --this.j;
} else {
- this.c((EntityLiving) null);
+ this.b((EntityLiving) null);
}
}
- this.bA();
- this.aF = this.aE;
- this.az = this.ay;
- this.aB = this.aA;
+ this.aF();
+ this.aZ = this.aY;
+ this.aO = this.aN;
+ this.aQ = this.aP;
this.lastYaw = this.yaw;
this.lastPitch = this.pitch;
this.world.methodProfiler.b();
@@ -414,7 +242,7 @@ public abstract class EntityLiving extends Entity {
}
}
- public int getScaledHealth() {
+ public float getScaledHealth() {
if (this.maxHealth != this.getMaxHealth() && this.getHealth() > 0) {
return this.getHealth() * this.getMaxHealth() / this.maxHealth + 1;
} else {
@@ -423,7 +251,11 @@ public abstract class EntityLiving extends Entity {
}
// CraftBukkit end
- protected void aS() {
+ public boolean isBaby() {
+ return false;
+ }
+
+ protected void az() {
++this.deathTicks;
if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead)
int i;
@@ -458,253 +290,372 @@ public abstract class EntityLiving extends Entity {
}
protected int getExpValue(EntityHuman entityhuman) {
- if (this.be > 0) {
- int i = this.be;
- ItemStack[] aitemstack = this.getEquipment();
-
- for (int j = 0; j < aitemstack.length; ++j) {
- if (aitemstack[j] != null && this.dropChances[j] <= 1.0F) {
- i += 1 + this.random.nextInt(3);
- }
- }
-
- return i;
- } else {
- return this.be;
- }
+ return 0;
}
protected boolean alwaysGivesExp() {
return false;
}
- public void aU() {
- for (int i = 0; i < 20; ++i) {
- double d0 = this.random.nextGaussian() * 0.02D;
- double d1 = this.random.nextGaussian() * 0.02D;
- double d2 = this.random.nextGaussian() * 0.02D;
- double d3 = 10.0D;
+ public Random aB() {
+ return this.random;
+ }
+
+ public EntityLiving getLastDamager() {
+ return this.lastDamager;
+ }
+
+ public void b(EntityLiving entityliving) {
+ this.lastDamager = entityliving;
+ this.j = this.lastDamager != null ? 100 : 0;
+ }
+
+ public EntityLiving aD() {
+ return this.bn;
+ }
- this.world.addParticle("explode", this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width - d0 * d3, this.locY + (double) (this.random.nextFloat() * this.length) - d1 * d3, this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width - d2 * d3, d0, d1, d2);
+ public void k(Entity entity) {
+ if (entity instanceof EntityLiving) {
+ this.bn = (EntityLiving) entity;
}
}
- public void T() {
- super.T();
- this.aC = this.aD;
- this.aD = 0.0F;
- this.fallDistance = 0.0F;
+ public int aE() {
+ return this.aV;
}
- public void l_() {
- super.l_();
- if (!this.world.isStatic) {
- int i;
+ public void b(NBTTagCompound nbttagcompound) {
+ nbttagcompound.setFloat("HealF", this.getHealth());
+ nbttagcompound.setShort("Health", (short) ((int) Math.ceil((double) this.getHealth())));
+ nbttagcompound.setFloat("Bukkit.MaxHealth", this.maxHealth); // CraftBukkit
+ nbttagcompound.setShort("HurtTime", (short) this.hurtTicks);
+ nbttagcompound.setShort("DeathTime", (short) this.deathTicks);
+ nbttagcompound.setShort("AttackTime", (short) this.attackTicks);
+ nbttagcompound.setFloat("AbsorptionAmount", this.bj());
+ ItemStack[] aitemstack = this.getEquipment();
+ int i = aitemstack.length;
- for (i = 0; i < 5; ++i) {
- ItemStack itemstack = this.getEquipment(i);
+ int j;
+ ItemStack itemstack;
- if (!ItemStack.matches(itemstack, this.bU[i])) {
- ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet5EntityEquipment(this.id, i, itemstack)));
- this.bU[i] = itemstack == null ? null : itemstack.cloneItemStack();
- }
+ for (j = 0; j < i; ++j) {
+ itemstack = aitemstack[j];
+ if (itemstack != null) {
+ this.d.a(itemstack.D());
}
+ }
- i = this.bM();
- if (i > 0) {
- if (this.bm <= 0) {
- this.bm = 20 * (30 - i);
- }
+ nbttagcompound.set("Attributes", GenericAttributes.a(this.aT()));
+ aitemstack = this.getEquipment();
+ i = aitemstack.length;
- --this.bm;
- if (this.bm <= 0) {
- this.r(i - 1);
- }
+ for (j = 0; j < i; ++j) {
+ itemstack = aitemstack[j];
+ if (itemstack != null) {
+ this.d.b(itemstack.D());
}
}
- this.c();
- double d0 = this.locX - this.lastX;
- double d1 = this.locZ - this.lastZ;
- float f = (float) (d0 * d0 + d1 * d1);
- float f1 = this.ay;
- float f2 = 0.0F;
+ if (!this.effects.isEmpty()) {
+ NBTTagList nbttaglist = new NBTTagList();
+ Iterator iterator = this.effects.values().iterator();
- this.aC = this.aD;
- float f3 = 0.0F;
+ while (iterator.hasNext()) {
+ MobEffect mobeffect = (MobEffect) iterator.next();
- if (f > 0.0025000002F) {
- f3 = 1.0F;
- f2 = (float) Math.sqrt((double) f) * 3.0F;
- // CraftBukkit - Math -> TrigMath
- f1 = (float) org.bukkit.craftbukkit.TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F;
+ nbttaglist.add(mobeffect.a(new NBTTagCompound()));
+ }
+
+ nbttagcompound.set("ActiveEffects", nbttaglist);
}
+ }
- if (this.aR > 0.0F) {
- f1 = this.yaw;
+ public void a(NBTTagCompound nbttagcompound) {
+ this.m(nbttagcompound.getFloat("AbsorptionAmount"));
+ if (nbttagcompound.hasKey("Attributes") && this.world != null && !this.world.isStatic) {
+ GenericAttributes.a(this.aT(), nbttagcompound.getList("Attributes"), this.world == null ? null : this.world.getLogger());
}
- if (!this.onGround) {
- f3 = 0.0F;
+ if (nbttagcompound.hasKey("ActiveEffects")) {
+ NBTTagList nbttaglist = nbttagcompound.getList("ActiveEffects");
+
+ for (int i = 0; i < nbttaglist.size(); ++i) {
+ NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
+ MobEffect mobeffect = MobEffect.b(nbttagcompound1);
+
+ this.effects.put(Integer.valueOf(mobeffect.getEffectId()), mobeffect);
+ }
}
- this.aD += (f3 - this.aD) * 0.3F;
- this.world.methodProfiler.a("headTurn");
- if (this.bh()) {
- this.senses.a();
+ // CraftBukkit start
+ if (nbttagcompound.hasKey("Bukkit.MaxHealth")) {
+ NBTBase nbtbase = nbttagcompound.get("Bukkit.MaxHealth");
+ if (nbtbase.getTypeId() == 5) {
+ this.maxHealth = ((NBTTagFloat) nbtbase).data;
+ } else if (nbtbase.getTypeId() == 3) {
+ this.maxHealth = (float) ((NBTTagInt) nbtbase).data;
+ }
+ }
+ // CraftBukkit end
+
+ if (nbttagcompound.hasKey("HealF")) {
+ this.setHealth(nbttagcompound.getFloat("HealF"));
} else {
- float f4 = MathHelper.g(f1 - this.ay);
+ NBTBase nbtbase = nbttagcompound.get("Health");
+
+ if (nbtbase == null) {
+ this.setHealth(this.maxHealth); // CraftBukkit - this.getMaxHealth() -> this.maxHealth
+ } else if (nbtbase.getTypeId() == 5) {
+ this.setHealth(((NBTTagFloat) nbtbase).data);
+ } else if (nbtbase.getTypeId() == 2) {
+ this.setHealth((float) ((NBTTagShort) nbtbase).data);
+ }
+ }
+
+ this.hurtTicks = nbttagcompound.getShort("HurtTime");
+ this.deathTicks = nbttagcompound.getShort("DeathTime");
+ this.attackTicks = nbttagcompound.getShort("AttackTime");
+ }
+
+ protected void aF() {
+ Iterator iterator = this.effects.keySet().iterator();
- this.ay += f4 * 0.3F;
- float f5 = MathHelper.g(this.yaw - this.ay);
- boolean flag = f5 < -90.0F || f5 >= 90.0F;
+ while (iterator.hasNext()) {
+ Integer integer = (Integer) iterator.next();
+ MobEffect mobeffect = (MobEffect) this.effects.get(integer);
- if (f5 < -75.0F) {
- f5 = -75.0F;
+ if (!mobeffect.tick(this)) {
+ if (!this.world.isStatic) {
+ iterator.remove();
+ this.c(mobeffect);
+ }
+ } else if (mobeffect.getDuration() % 600 == 0) {
+ this.b(mobeffect);
}
+ }
+
+ int i;
- if (f5 >= 75.0F) {
- f5 = 75.0F;
+ if (this.updateEffects) {
+ if (!this.world.isStatic) {
+ if (this.effects.isEmpty()) {
+ this.datawatcher.watch(8, Byte.valueOf((byte) 0));
+ this.datawatcher.watch(7, Integer.valueOf(0));
+ this.setInvisible(false);
+ } else {
+ i = PotionBrewer.a(this.effects.values());
+ this.datawatcher.watch(8, Byte.valueOf((byte) (PotionBrewer.b(this.effects.values()) ? 1 : 0)));
+ this.datawatcher.watch(7, Integer.valueOf(i));
+ this.setInvisible(this.hasEffect(MobEffectList.INVISIBILITY.id));
+ }
}
- this.ay = this.yaw - f5;
- if (f5 * f5 > 2500.0F) {
- this.ay += f5 * 0.2F;
+ this.updateEffects = false;
+ }
+
+ i = this.datawatcher.getInt(7);
+ boolean flag = this.datawatcher.getByte(8) > 0;
+
+ if (i > 0) {
+ boolean flag1 = false;
+
+ if (!this.isInvisible()) {
+ flag1 = this.random.nextBoolean();
+ } else {
+ flag1 = this.random.nextInt(15) == 0;
}
if (flag) {
- f2 *= -1.0F;
+ flag1 &= this.random.nextInt(5) == 0;
}
- }
- this.world.methodProfiler.b();
- this.world.methodProfiler.a("rangeChecks");
+ if (flag1 && i > 0) {
+ double d0 = (double) (i >> 16 & 255) / 255.0D;
+ double d1 = (double) (i >> 8 & 255) / 255.0D;
+ double d2 = (double) (i >> 0 & 255) / 255.0D;
- while (this.yaw - this.lastYaw < -180.0F) {
- this.lastYaw -= 360.0F;
+ this.world.addParticle(flag ? "mobSpellAmbient" : "mobSpell", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length - (double) this.height, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, d0, d1, d2);
+ }
}
+ }
- while (this.yaw - this.lastYaw >= 180.0F) {
- this.lastYaw += 360.0F;
+ public void aG() {
+ Iterator iterator = this.effects.keySet().iterator();
+
+ while (iterator.hasNext()) {
+ Integer integer = (Integer) iterator.next();
+ MobEffect mobeffect = (MobEffect) this.effects.get(integer);
+
+ if (!this.world.isStatic) {
+ iterator.remove();
+ this.c(mobeffect);
+ }
}
+ }
+
+ public Collection getEffects() {
+ return this.effects.values();
+ }
+
+ public boolean hasEffect(int i) {
+ // CraftBukkit - Add size check for efficiency
+ return this.effects.size() != 0 && this.effects.containsKey(Integer.valueOf(i));
+ }
+
+ public boolean hasEffect(MobEffectList mobeffectlist) {
+ // CraftBukkit - Add size check for efficiency
+ return this.effects.size() != 0 && this.effects.containsKey(Integer.valueOf(mobeffectlist.id));
+ }
+
+ public MobEffect getEffect(MobEffectList mobeffectlist) {
+ return (MobEffect) this.effects.get(Integer.valueOf(mobeffectlist.id));
+ }
- while (this.ay - this.az < -180.0F) {
- this.az -= 360.0F;
+ public void addEffect(MobEffect mobeffect) {
+ if (this.e(mobeffect)) {
+ if (this.effects.containsKey(Integer.valueOf(mobeffect.getEffectId()))) {
+ ((MobEffect) this.effects.get(Integer.valueOf(mobeffect.getEffectId()))).a(mobeffect);
+ this.b((MobEffect) this.effects.get(Integer.valueOf(mobeffect.getEffectId())));
+ } else {
+ this.effects.put(Integer.valueOf(mobeffect.getEffectId()), mobeffect);
+ this.a(mobeffect);
+ }
}
+ }
+
+ public boolean e(MobEffect mobeffect) {
+ if (this.getMonsterType() == EnumMonsterType.UNDEAD) {
+ int i = mobeffect.getEffectId();
- while (this.ay - this.az >= 180.0F) {
- this.az += 360.0F;
+ if (i == MobEffectList.REGENERATION.id || i == MobEffectList.POISON.id) {
+ return false;
+ }
}
- while (this.pitch - this.lastPitch < -180.0F) {
- this.lastPitch -= 360.0F;
+ return true;
+ }
+
+ public boolean aI() {
+ return this.getMonsterType() == EnumMonsterType.UNDEAD;
+ }
+
+ public void k(int i) {
+ MobEffect mobeffect = (MobEffect) this.effects.remove(Integer.valueOf(i));
+
+ if (mobeffect != null) {
+ this.c(mobeffect);
}
+ }
- while (this.pitch - this.lastPitch >= 180.0F) {
- this.lastPitch += 360.0F;
+ protected void a(MobEffect mobeffect) {
+ this.updateEffects = true;
+ if (!this.world.isStatic) {
+ MobEffectList.byId[mobeffect.getEffectId()].b(this, this.aT(), mobeffect.getAmplifier());
}
+ }
- while (this.aA - this.aB < -180.0F) {
- this.aB -= 360.0F;
+ protected void b(MobEffect mobeffect) {
+ this.updateEffects = true;
+ if (!this.world.isStatic) {
+ MobEffectList.byId[mobeffect.getEffectId()].a(this, this.aT(), mobeffect.getAmplifier());
}
- while (this.aA - this.aB >= 180.0F) {
- this.aB += 360.0F;
+ if (!this.world.isStatic) {
+ MobEffectList.byId[mobeffect.getEffectId()].b(this, this.aT(), mobeffect.getAmplifier());
}
+ }
- this.world.methodProfiler.b();
- this.aE += f2;
+ protected void c(MobEffect mobeffect) {
+ this.updateEffects = true;
+ if (!this.world.isStatic) {
+ MobEffectList.byId[mobeffect.getEffectId()].a(this, this.aT(), mobeffect.getAmplifier());
+ }
}
// CraftBukkit start - Delegate so we can handle providing a reason for health being regained
- public void heal(int i) {
- heal(i, EntityRegainHealthEvent.RegainReason.CUSTOM);
+ public void heal(float f) {
+ heal(f, EntityRegainHealthEvent.RegainReason.CUSTOM);
}
- public void heal(int i, EntityRegainHealthEvent.RegainReason regainReason) {
- if (this.health > 0) {
- EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), i, regainReason);
+ public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason) {
+ float f1 = this.getHealth();
+
+ if (f1 > 0.0F) {
+ EntityRegainHealthEvent event = new EntityRegainHealthEvent(this.getBukkitEntity(), f, regainReason);
this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- this.setHealth(this.getHealth() + event.getAmount());
+ this.setHealth((float) (this.getHealth() + event.getAmount()));
}
- // this.getMaxHealth() -> this.maxHealth
- if (this.health > this.maxHealth) {
+ // TODO should we be doing this anymore
+ if (this.getHealth() > this.maxHealth) {
this.setHealth(this.maxHealth);
- // CraftBukkit end
}
-
- this.noDamageTicks = this.maxNoDamageTicks / 2;
+ // CraftBukkit end
}
}
- public abstract int getMaxHealth();
-
- public int getHealth() {
- return this.health;
+ public final float getHealth() {
+ return this.datawatcher.getFloat(6);
}
- public void setHealth(int i) {
- this.health = i;
- if (i > this.getMaxHealth()) {
- i = this.getMaxHealth();
- }
+ public void setHealth(float f) {
+ this.datawatcher.watch(6, Float.valueOf(MathHelper.a(f, 0.0F, this.getMaxHealth())));
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else if (this.world.isStatic) {
return false;
} else {
- this.bC = 0;
- if (this.health <= 0) {
+ this.aV = 0;
+ if (this.getHealth() <= 0.0F) {
return false;
} else if (damagesource.m() && this.hasEffect(MobEffectList.FIRE_RESISTANCE)) {
return false;
} else {
if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && this.getEquipment(4) != null) {
- this.getEquipment(4).damage(i * 4 + this.random.nextInt(i * 2), this);
- i = (int) ((float) i * 0.75F);
+ this.getEquipment(4).damage((int) (f * 4.0F + this.random.nextFloat() * f * 2.0F), this);
+ f *= 0.75F;
}
- this.bi = 1.5F;
+ this.aG = 1.5F;
boolean flag = true;
// CraftBukkit start
- EntityDamageEvent event = CraftEventFactory.handleEntityDamageEvent(this, damagesource, i);
+ EntityDamageEvent event = CraftEventFactory.handleEntityDamageEvent(this, damagesource, f);
if (event != null) {
if (event.isCancelled()) {
return false;
}
- i = event.getDamage();
+ f = (float) event.getDamage();
}
// CraftBukkit end
if ((float) this.noDamageTicks > (float) this.maxNoDamageTicks / 2.0F) {
- if (i <= this.lastDamage) {
+ if (f <= this.lastDamage) {
return false;
}
- this.d(damagesource, i - this.lastDamage);
- this.lastDamage = i;
+ this.d(damagesource, f - this.lastDamage);
+ this.lastDamage = f;
flag = false;
} else {
- this.lastDamage = i;
- this.aT = this.health;
+ this.lastDamage = f;
+ this.ax = this.getHealth();
this.noDamageTicks = this.maxNoDamageTicks;
- this.d(damagesource, i);
- this.hurtTicks = this.aX = 10;
+ this.d(damagesource, f);
+ this.hurtTicks = this.az = 10;
}
- this.aY = 0.0F;
+ this.aA = 0.0F;
Entity entity = damagesource.getEntity();
if (entity != null) {
if (entity instanceof EntityLiving) {
- this.c((EntityLiving) entity);
+ this.b((EntityLiving) entity);
}
if (entity instanceof EntityHuman) {
@@ -735,21 +686,21 @@ public abstract class EntityLiving extends Entity {
d0 = (Math.random() - Math.random()) * 0.01D;
}
- this.aY = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw;
- this.a(entity, i, d0, d1);
+ this.aA = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - this.yaw;
+ this.a(entity, f, d0, d1);
} else {
- this.aY = (float) ((int) (Math.random() * 2.0D) * 180);
+ this.aA = (float) ((int) (Math.random() * 2.0D) * 180);
}
}
- if (this.health <= 0) {
+ if (this.getHealth() <= 0.0F) {
if (flag) {
- this.makeSound(this.bd(), this.ba(), this.aY());
+ this.makeSound(this.aL(), this.aW(), this.aX());
}
this.die(damagesource);
} else if (flag) {
- this.makeSound(this.bc(), this.ba(), this.aY());
+ this.makeSound(this.aK(), this.aW(), this.aX());
}
return true;
@@ -757,11 +708,149 @@ public abstract class EntityLiving extends Entity {
}
}
- 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 void a(ItemStack itemstack) {
+ this.makeSound("random.break", 0.8F, 0.8F + this.world.random.nextFloat() * 0.4F);
+
+ for (int i = 0; i < 5; ++i) {
+ Vec3D vec3d = this.world.getVec3DPool().create(((double) this.random.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
+
+ vec3d.a(-this.pitch * 3.1415927F / 180.0F);
+ vec3d.b(-this.yaw * 3.1415927F / 180.0F);
+ Vec3D vec3d1 = this.world.getVec3DPool().create(((double) this.random.nextFloat() - 0.5D) * 0.3D, (double) (-this.random.nextFloat()) * 0.6D - 0.3D, 0.6D);
+
+ vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
+ vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
+ vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ);
+ this.world.addParticle("iconcrack_" + itemstack.getItem().id, vec3d1.c, vec3d1.d, vec3d1.e, vec3d.c, vec3d.d + 0.05D, vec3d.e);
+ }
+ }
+
+ public void die(DamageSource damagesource) {
+ Entity entity = damagesource.getEntity();
+ EntityLiving entityliving = this.aO();
+
+ if (this.bb >= 0 && entityliving != null) {
+ entityliving.b(this, this.bb);
+ }
+
+ if (entity != null) {
+ entity.a(this);
+ }
+
+ this.aU = true;
+ if (!this.world.isStatic) {
+ int i = 0;
+
+ if (entity instanceof EntityHuman) {
+ i = EnchantmentManager.getBonusMonsterLootEnchantmentLevel((EntityLiving) entity);
+ }
+
+ if (!this.isBaby() && this.world.getGameRules().getBoolean("doMobLoot")) {
+ this.dropDeathLoot(this.lastDamageByPlayerTime > 0, i);
+ this.dropEquipment(this.lastDamageByPlayerTime > 0, i);
+ if (false && this.lastDamageByPlayerTime > 0) { // CraftBukkit - move rare item drop call to dropDeathLoot
+ int j = this.random.nextInt(200) - i;
+
+ if (j < 5) {
+ this.l(j <= 0 ? 1 : 0);
+ }
+ }
+ } else { // CraftBukkit
+ CraftEventFactory.callEntityDeathEvent(this); // CraftBukkit
+ }
+ }
+
+ this.world.broadcastEntityEffect(this, (byte) 3);
+ }
+
+ protected void dropEquipment(boolean flag, int i) {}
+
+ public void a(Entity entity, float f, double d0, double d1) {
+ if (this.random.nextDouble() >= this.a(GenericAttributes.c).e()) {
+ this.an = true;
+ float f1 = MathHelper.sqrt(d0 * d0 + d1 * d1);
+ float f2 = 0.4F;
+
+ this.motX /= 2.0D;
+ this.motY /= 2.0D;
+ this.motZ /= 2.0D;
+ this.motX -= d0 / (double) f1 * (double) f2;
+ this.motY += (double) f2;
+ this.motZ -= d1 / (double) f1 * (double) f2;
+ if (this.motY > 0.4000000059604645D) {
+ this.motY = 0.4000000059604645D;
+ }
+ }
+ }
+
+ protected String aK() {
+ return "damage.hit";
+ }
+
+ protected String aL() {
+ return "damage.hit";
+ }
+
+ // CraftBukkit start - Change return type to ItemStack
+ protected ItemStack l(int i) {
+ return null;
+ }
+ // CraftBukkit end
+
+ protected void dropDeathLoot(boolean flag, int i) {}
+
+ public boolean e() {
+ int i = MathHelper.floor(this.locX);
+ int j = MathHelper.floor(this.boundingBox.b);
+ int k = MathHelper.floor(this.locZ);
+ int l = this.world.getTypeId(i, j, k);
+
+ return l == Block.LADDER.id || l == Block.VINE.id;
+ }
+
+ public boolean isAlive() {
+ return !this.dead && this.getHealth() > 0.0F;
+ }
+
+ protected void b(float f) {
+ super.b(f);
+ MobEffect mobeffect = this.getEffect(MobEffectList.JUMP);
+ float f1 = mobeffect != null ? (float) (mobeffect.getAmplifier() + 1) : 0.0F;
+ // CraftBukkit start
+ float i = MathHelper.f(f - 3.0F - f1);
+
+ if (i > 0) {
+ EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent(null, this, EntityDamageEvent.DamageCause.FALL, i);
+ if (event.isCancelled()) {
+ return;
+ }
+
+ i = (float) event.getDamage();
+ if (i > 0) {
+ this.getBukkitEntity().setLastDamageCause(event);
+ }
+ }
+ // CraftBukkit end
+
+ if (i > 0) {
+ if (i > 4) {
+ this.makeSound("damage.fallbig", 1.0F, 1.0F);
+ } else {
+ this.makeSound("damage.fallsmall", 1.0F, 1.0F);
+ }
+
+ this.damageEntity(DamageSource.FALL, (float) i);
+ int j = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height), MathHelper.floor(this.locZ));
+
+ if (j > 0) {
+ StepSound stepsound = Block.byId[j].stepSound;
+
+ this.makeSound(stepsound.getStepSound(), stepsound.getVolume1() * 0.5F, stepsound.getVolume2() * 0.75F);
+ }
+ }
}
- public int aZ() {
+ public int aM() {
int i = 0;
ItemStack[] aitemstack = this.getEquipment();
int j = aitemstack.length;
@@ -779,211 +868,227 @@ public abstract class EntityLiving extends Entity {
return i;
}
- protected void k(int i) {}
+ protected void h(float f) {}
- protected int b(DamageSource damagesource, int i) {
+ protected float b(DamageSource damagesource, float f) {
if (!damagesource.ignoresArmor()) {
- int j = 25 - this.aZ();
- int k = i * j + this.aU;
+ int i = 25 - this.aM();
+ float f1 = f * (float) i;
- this.k(i);
- i = k / 25;
- this.aU = k % 25;
+ this.h(f);
+ f = f1 / 25.0F;
}
- return i;
+ return f;
}
- protected int c(DamageSource damagesource, int i) {
+ protected float c(DamageSource damagesource, float f) {
+ if (this instanceof EntityZombie) {
+ f = f;
+ }
+
+ int i;
int j;
- int k;
- int l;
+ float f1;
- 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.aU = l % 25;
+ if (this.hasEffect(MobEffectList.RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) {
+ i = (this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5;
+ j = 25 - i;
+ f1 = f * (float) j;
+ f = f1 / 25.0F;
}
- if (i <= 0) {
- return 0;
+ if (f <= 0.0F) {
+ return 0.0F;
} else {
- j = EnchantmentManager.a(this.getEquipment(), damagesource);
- if (j > 20) {
- j = 20;
+ i = EnchantmentManager.a(this.getEquipment(), damagesource);
+ if (i > 20) {
+ i = 20;
}
- if (j > 0 && j <= 20) {
- k = 25 - j;
- l = i * k + this.aU;
- i = l / 25;
- this.aU = l % 25;
+ if (i > 0 && i <= 20) {
+ j = 25 - i;
+ f1 = f * (float) j;
+ f = f1 / 25.0F;
}
- return i;
+ return f;
}
}
- protected void d(DamageSource damagesource, int i) {
+ protected void d(DamageSource damagesource, float f) {
if (!this.isInvulnerable()) {
- i = this.b(damagesource, i);
- i = this.c(damagesource, i);
- int j = this.getHealth();
+ f = this.b(damagesource, f);
+ f = this.c(damagesource, f);
+ float f1 = f;
+
+ f = Math.max(f - this.bj(), 0.0F);
+ this.m(this.bj() - (f1 - f));
+ if (f != 0.0F) {
+ float f2 = this.getHealth();
- this.health -= i;
- this.bt.a(damagesource, j, i);
+ this.setHealth(f2 - f);
+ this.aN().a(damagesource, f2, f);
+ this.m(this.bj() - f);
+ }
}
}
- protected float ba() {
- return 1.0F;
+ public CombatTracker aN() {
+ return this.combatTracker;
}
- protected String bb() {
- return null;
+ public EntityLiving aO() {
+ return (EntityLiving) (this.combatTracker.c() != null ? this.combatTracker.c() : (this.killer != null ? this.killer : (this.lastDamager != null ? this.lastDamager : null)));
}
- protected String bc() {
- return "damage.hit";
+ public final float getMaxHealth() {
+ return (float) this.a(GenericAttributes.a).e();
}
- protected String bd() {
- return "damage.hit";
+ public final int aQ() {
+ return this.datawatcher.getByte(9);
}
- public void a(Entity entity, int i, double d0, double d1) {
- this.an = true;
- float f = MathHelper.sqrt(d0 * d0 + d1 * d1);
- float f1 = 0.4F;
-
- this.motX /= 2.0D;
- this.motY /= 2.0D;
- this.motZ /= 2.0D;
- this.motX -= d0 / (double) f * (double) f1;
- this.motY += (double) f1;
- this.motZ -= d1 / (double) f * (double) f1;
- if (this.motY > 0.4000000059604645D) {
- this.motY = 0.4000000059604645D;
- }
+ public final void m(int i) {
+ this.datawatcher.watch(9, Byte.valueOf((byte) i));
}
- public void die(DamageSource damagesource) {
- Entity entity = damagesource.getEntity();
- EntityLiving entityliving = this.bN();
+ 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);
+ }
- if (this.aM >= 0 && entityliving != null) {
- entityliving.c(this, this.aM);
+ public void aR() {
+ if (!this.au || this.av >= this.h() / 2 || this.av < 0) {
+ this.av = -1;
+ this.au = true;
+ if (this.world instanceof WorldServer) {
+ ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet18ArmAnimation(this, 1)));
+ }
}
+ }
- if (entity != null) {
- entity.a(this);
- }
+ protected void B() {
+ this.damageEntity(DamageSource.OUT_OF_WORLD, 4.0F);
+ }
- this.bd = true;
- if (!this.world.isStatic) {
- int i = 0;
+ protected void aS() {
+ int i = this.h();
- if (entity instanceof EntityHuman) {
- i = EnchantmentManager.getBonusMonsterLootEnchantmentLevel((EntityLiving) entity);
+ if (this.au) {
+ ++this.av;
+ if (this.av >= i) {
+ this.av = 0;
+ this.au = false;
}
+ } else {
+ this.av = 0;
+ }
- if (!this.isBaby() && this.world.getGameRules().getBoolean("doMobLoot")) {
- this.dropDeathLoot(this.lastDamageByPlayerTime > 0, i);
- this.dropEquipment(this.lastDamageByPlayerTime > 0, i);
- if (false && this.lastDamageByPlayerTime > 0) { // CraftBukkit - move rare item drop call to dropDeathLoot
- int j = this.random.nextInt(200) - i;
+ this.aE = (float) this.av / (float) i;
+ }
- if (j < 5) {
- this.l(j <= 0 ? 1 : 0);
- }
- }
- } else { // CraftBukkit
- CraftEventFactory.callEntityDeathEvent(this); // CraftBukkit
+ public AttributeInstance a(IAttribute iattribute) {
+ return this.aT().a(iattribute);
+ }
+
+ public AttributeMapBase aT() {
+ if (this.d == null) {
+ if (this.world != null && !this.world.isStatic) {
+ this.d = new AttributeMapServer();
+ } else {
+ this.d = new AttributeMapClient();
}
}
- this.world.broadcastEntityEffect(this, (byte) 3);
+ return this.d;
}
- // CraftBukkit start - Change return type to ItemStack
- protected ItemStack l(int i) {
- return null;
+ public EnumMonsterType getMonsterType() {
+ return EnumMonsterType.UNDEFINED;
}
- // CraftBukkit end
- protected void dropDeathLoot(boolean flag, int i) {
- // CraftBukkit start - Whole method
- List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
- int j = this.getLootId();
+ public abstract ItemStack aV();
- if (j > 0) {
- int k = this.random.nextInt(3);
+ public abstract ItemStack getEquipment(int i);
- if (i > 0) {
- k += this.random.nextInt(i + 1);
- }
+ public abstract void setEquipment(int i, ItemStack itemstack);
+
+ public void setSprinting(boolean flag) {
+ super.setSprinting(flag);
+ if (!this.world.isStatic) {
+ AttributeInstance attributeinstance = this.a(GenericAttributes.d);
- if (k > 0) {
- loot.add(new org.bukkit.inventory.ItemStack(j, k));
+ attributeinstance.b(c);
+ if (flag) {
+ attributeinstance.a(c);
}
}
+ }
- // Determine rare item drops and add them to the loot
- if (this.lastDamageByPlayerTime > 0) {
- int k = this.random.nextInt(200) - i;
+ public abstract ItemStack[] getEquipment();
- if (k < 5) {
- ItemStack itemstack = this.l(k <= 0 ? 1 : 0);
- if (itemstack != null) {
- loot.add(org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack));
- }
- }
- }
+ protected float aW() {
+ return 1.0F;
+ }
- CraftEventFactory.callEntityDeathEvent(this, loot); // raise event even for those times when the entity does not drop loot
- // CraftBukkit end
+ protected float aX() {
+ return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F;
}
- protected int getLootId() {
- return 0;
+ protected boolean aY() {
+ return this.getHealth() <= 0.0F;
}
- protected void a(float f) {
- super.a(f);
- int i = MathHelper.f(f - 3.0F);
+ public void enderTeleportTo(double d0, double d1, double d2) {
+ this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
+ }
- // CraftBukkit start
- if (i > 0) {
- EntityDamageEvent event = CraftEventFactory.callEntityDamageEvent(null, this, EntityDamageEvent.DamageCause.FALL, i);
- if (event.isCancelled()) {
- return;
- }
+ public void l(Entity entity) {
+ double d0 = entity.locX;
+ double d1 = entity.boundingBox.b + (double) entity.length;
+ double d2 = entity.locZ;
+
+ for (double d3 = -1.5D; d3 < 2.0D; ++d3) {
+ for (double d4 = -1.5D; d4 < 2.0D; ++d4) {
+ if (d3 != 0.0D || d4 != 0.0D) {
+ int i = (int) (this.locX + d3);
+ int j = (int) (this.locZ + d4);
+ AxisAlignedBB axisalignedbb = this.boundingBox.c(d3, 1.0D, d4);
+
+ if (this.world.a(axisalignedbb).isEmpty()) {
+ if (this.world.w(i, (int) this.locY, j)) {
+ this.enderTeleportTo(this.locX + d3, this.locY + 1.0D, this.locZ + d4);
+ return;
+ }
- i = event.getDamage();
- if (i > 0) {
- this.getBukkitEntity().setLastDamageCause(event);
+ 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;
+ }
+ }
+ }
}
}
- // CraftBukkit end
- if (i > 0) {
- if (i > 4) {
- this.makeSound("damage.fallbig", 1.0F, 1.0F);
- } else {
- this.makeSound("damage.fallsmall", 1.0F, 1.0F);
- }
+ this.enderTeleportTo(d0, d1, d2);
+ }
- this.damageEntity(DamageSource.FALL, i);
- int j = this.world.getTypeId(MathHelper.floor(this.locX), MathHelper.floor(this.locY - 0.20000000298023224D - (double) this.height), MathHelper.floor(this.locZ));
+ protected void ba() {
+ this.motY = 0.41999998688697815D;
+ if (this.hasEffect(MobEffectList.JUMP)) {
+ this.motY += (double) ((float) (this.getEffect(MobEffectList.JUMP).getAmplifier() + 1) * 0.1F);
+ }
- if (j > 0) {
- StepSound stepsound = Block.byId[j].stepSound;
+ if (this.isSprinting()) {
+ float f = this.yaw * 0.017453292F;
- this.makeSound(stepsound.getStepSound(), stepsound.getVolume1() * 0.5F, stepsound.getVolume2() * 0.75F);
- }
+ this.motX -= (double) (MathHelper.sin(f) * 0.2F);
+ this.motZ += (double) (MathHelper.cos(f) * 0.2F);
}
+
+ this.an = true;
}
public void e(float f, float f1) {
@@ -991,7 +1096,7 @@ public abstract class EntityLiving extends Entity {
if (this.G() && (!(this instanceof EntityHuman) || !((EntityHuman) this).abilities.isFlying)) {
d0 = this.locY;
- this.a(f, f1, this.bh() ? 0.04F : 0.02F);
+ this.a(f, f1, this.bb() ? 0.04F : 0.02F);
this.move(this.motX, this.motY, this.motZ);
this.motX *= 0.800000011920929D;
this.motY *= 0.800000011920929D;
@@ -1027,15 +1132,9 @@ public abstract class EntityLiving extends Entity {
float f4;
if (this.onGround) {
- if (this.bh()) {
- f4 = this.aI();
- } else {
- f4 = this.aO;
- }
-
- f4 *= f3;
+ f4 = this.bc() * f3;
} else {
- f4 = this.aP;
+ f4 = this.aR;
}
this.a(f, f1, f4);
@@ -1049,7 +1148,7 @@ public abstract class EntityLiving extends Entity {
}
}
- if (this.g_()) {
+ if (this.e()) {
float f5 = 0.15F;
if (this.motX < (double) (-f5)) {
@@ -1081,7 +1180,7 @@ public abstract class EntityLiving extends Entity {
}
this.move(this.motX, this.motY, this.motZ);
- if (this.positionChanged && this.g_()) {
+ if (this.positionChanged && this.e()) {
this.motY = 0.2D;
}
@@ -1100,7 +1199,7 @@ public abstract class EntityLiving extends Entity {
this.motZ *= (double) f2;
}
- this.bh = this.bi;
+ this.aF = this.aG;
d0 = this.locX - this.lastX;
double d1 = this.locZ - this.lastZ;
float f6 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 4.0F;
@@ -1109,164 +1208,174 @@ public abstract class EntityLiving extends Entity {
f6 = 1.0F;
}
- this.bi += (f6 - this.bi) * 0.4F;
- this.bj += this.bi;
+ this.aG += (f6 - this.aG) * 0.4F;
+ this.aH += this.aG;
}
- public boolean g_() {
- int i = MathHelper.floor(this.locX);
- int j = MathHelper.floor(this.boundingBox.b);
- int k = MathHelper.floor(this.locZ);
- int l = this.world.getTypeId(i, j, k);
+ protected boolean bb() {
+ return false;
+ }
- return l == Block.LADDER.id || l == Block.VINE.id;
+ public float bc() {
+ return this.bb() ? this.bo : 0.1F;
}
- public void b(NBTTagCompound nbttagcompound) {
- if (this.health < -32768) {
- this.health = -32768;
- }
+ public void i(float f) {
+ this.bo = f;
+ }
- nbttagcompound.setShort("Health", (short) this.health);
- nbttagcompound.setShort("HurtTime", (short) this.hurtTicks);
- nbttagcompound.setShort("DeathTime", (short) this.deathTicks);
- nbttagcompound.setShort("AttackTime", (short) this.attackTicks);
- nbttagcompound.setBoolean("CanPickUpLoot", this.bT());
- nbttagcompound.setBoolean("PersistenceRequired", this.persistent);
- NBTTagList nbttaglist = new NBTTagList();
+ public boolean m(Entity entity) {
+ this.k(entity);
+ return false;
+ }
- for (int i = 0; i < this.equipment.length; ++i) {
- NBTTagCompound nbttagcompound1 = new NBTTagCompound();
+ public boolean isSleeping() {
+ return false;
+ }
- if (this.equipment[i] != null) {
- this.equipment[i].save(nbttagcompound1);
- }
+ public void l_() {
+ super.l_();
+ if (!this.world.isStatic) {
+ int i = this.aQ();
- nbttaglist.add(nbttagcompound1);
- }
+ if (i > 0) {
+ if (this.aw <= 0) {
+ this.aw = 20 * (30 - i);
+ }
- nbttagcompound.set("Equipment", nbttaglist);
- NBTTagList nbttaglist1;
+ --this.aw;
+ if (this.aw <= 0) {
+ this.m(i - 1);
+ }
+ }
- if (!this.effects.isEmpty()) {
- nbttaglist1 = new NBTTagList();
- Iterator iterator = this.effects.values().iterator();
+ for (int j = 0; j < 5; ++j) {
+ ItemStack itemstack = this.g[j];
+ ItemStack itemstack1 = this.getEquipment(j);
- while (iterator.hasNext()) {
- MobEffect mobeffect = (MobEffect) iterator.next();
+ if (!ItemStack.matches(itemstack1, itemstack)) {
+ ((WorldServer) this.world).getTracker().a((Entity) this, (Packet) (new Packet5EntityEquipment(this.id, j, itemstack1)));
+ if (itemstack != null) {
+ this.d.a(itemstack.D());
+ }
- nbttaglist1.add(mobeffect.a(new NBTTagCompound()));
- }
+ if (itemstack1 != null) {
+ this.d.b(itemstack1.D());
+ }
- nbttagcompound.set("ActiveEffects", nbttaglist1);
+ this.g[j] = itemstack1 == null ? null : itemstack1.cloneItemStack();
+ }
+ }
}
- nbttaglist1 = new NBTTagList();
+ this.c();
+ double d0 = this.locX - this.lastX;
+ double d1 = this.locZ - this.lastZ;
+ float f = (float) (d0 * d0 + d1 * d1);
+ float f1 = this.aN;
+ float f2 = 0.0F;
- for (int j = 0; j < this.dropChances.length; ++j) {
- nbttaglist1.add(new NBTTagFloat(j + "", this.dropChances[j]));
- }
+ this.aW = this.aX;
+ float f3 = 0.0F;
- nbttagcompound.set("DropChances", nbttaglist1);
- nbttagcompound.setString("CustomName", this.getCustomName());
- nbttagcompound.setBoolean("CustomNameVisible", this.getCustomNameVisible());
- nbttagcompound.setInt("Bukkit.MaxHealth", this.maxHealth); // CraftBukkit
- }
+ if (f > 0.0025000002F) {
+ f3 = 1.0F;
+ f2 = (float) Math.sqrt((double) f) * 3.0F;
+ // CraftBukkit - Math -> TrigMath
+ f1 = (float) org.bukkit.craftbukkit.TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F;
+ }
- public void a(NBTTagCompound nbttagcompound) {
- this.health = nbttagcompound.getShort("Health");
- // CraftBukkit start
- if (nbttagcompound.hasKey("Bukkit.MaxHealth")) {
- this.maxHealth = nbttagcompound.getInt("Bukkit.MaxHealth");
+ if (this.aE > 0.0F) {
+ f1 = this.yaw;
}
- // CraftBukkit end
- if (!nbttagcompound.hasKey("Health")) {
- this.health = this.maxHealth; // CraftBukkit - this.getMaxHealth() -> this.maxHealth
+ if (!this.onGround) {
+ f3 = 0.0F;
}
- this.hurtTicks = nbttagcompound.getShort("HurtTime");
- this.deathTicks = nbttagcompound.getShort("DeathTime");
- this.attackTicks = nbttagcompound.getShort("AttackTime");
+ this.aX += (f3 - this.aX) * 0.3F;
+ this.world.methodProfiler.a("headTurn");
+ f2 = this.f(f1, f2);
+ this.world.methodProfiler.b();
+ this.world.methodProfiler.a("rangeChecks");
- // CraftBukkit start - If looting or persistence is false only use it if it was set after we started using it
- boolean data = nbttagcompound.getBoolean("CanPickUpLoot");
- if (isLevelAtLeast(nbttagcompound, 1) || data) {
- this.canPickUpLoot = data;
+ while (this.yaw - this.lastYaw < -180.0F) {
+ this.lastYaw -= 360.0F;
}
- data = nbttagcompound.getBoolean("PersistenceRequired");
- if (isLevelAtLeast(nbttagcompound, 1) || data) {
- this.persistent = data;
+ while (this.yaw - this.lastYaw >= 180.0F) {
+ this.lastYaw += 360.0F;
}
- // CraftBukkit end
- if (nbttagcompound.hasKey("CustomName") && nbttagcompound.getString("CustomName").length() > 0) {
- this.setCustomName(nbttagcompound.getString("CustomName"));
+ while (this.aN - this.aO < -180.0F) {
+ this.aO -= 360.0F;
}
- this.setCustomNameVisible(nbttagcompound.getBoolean("CustomNameVisible"));
- NBTTagList nbttaglist;
- int i;
-
- if (nbttagcompound.hasKey("Equipment")) {
- nbttaglist = nbttagcompound.getList("Equipment");
+ while (this.aN - this.aO >= 180.0F) {
+ this.aO += 360.0F;
+ }
- for (i = 0; i < this.equipment.length; ++i) {
- this.equipment[i] = ItemStack.createStack((NBTTagCompound) nbttaglist.get(i));
- }
+ while (this.pitch - this.lastPitch < -180.0F) {
+ this.lastPitch -= 360.0F;
}
- if (nbttagcompound.hasKey("ActiveEffects")) {
- nbttaglist = nbttagcompound.getList("ActiveEffects");
+ while (this.pitch - this.lastPitch >= 180.0F) {
+ this.lastPitch += 360.0F;
+ }
- for (i = 0; i < nbttaglist.size(); ++i) {
- NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
- MobEffect mobeffect = MobEffect.b(nbttagcompound1);
+ while (this.aP - this.aQ < -180.0F) {
+ this.aQ -= 360.0F;
+ }
- this.effects.put(Integer.valueOf(mobeffect.getEffectId()), mobeffect);
- }
+ while (this.aP - this.aQ >= 180.0F) {
+ this.aQ += 360.0F;
}
- if (nbttagcompound.hasKey("DropChances")) {
- nbttaglist = nbttagcompound.getList("DropChances");
+ this.world.methodProfiler.b();
+ this.aY += f2;
+ }
- for (i = 0; i < nbttaglist.size(); ++i) {
- this.dropChances[i] = ((NBTTagFloat) nbttaglist.get(i)).data;
- }
+ protected float f(float f, float f1) {
+ float f2 = MathHelper.g(f - this.aN);
+
+ this.aN += f2 * 0.3F;
+ float f3 = MathHelper.g(this.yaw - this.aN);
+ boolean flag = f3 < -90.0F || f3 >= 90.0F;
+
+ if (f3 < -75.0F) {
+ f3 = -75.0F;
}
- }
- public boolean isAlive() {
- return !this.dead && this.health > 0;
- }
+ if (f3 >= 75.0F) {
+ f3 = 75.0F;
+ }
- public boolean bf() {
- return false;
- }
+ this.aN = this.yaw - f3;
+ if (f3 * f3 > 2500.0F) {
+ this.aN += f3 * 0.2F;
+ }
- public void f(float f) {
- this.bE = f;
- }
+ if (flag) {
+ f1 *= -1.0F;
+ }
- public void f(boolean flag) {
- this.bG = flag;
+ return f1;
}
public void c() {
- if (this.bX > 0) {
- --this.bX;
+ if (this.bp > 0) {
+ --this.bp;
}
- 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);
+ if (this.bh > 0) {
+ double d0 = this.locX + (this.bi - this.locX) / (double) this.bh;
+ double d1 = this.locY + (this.bj - this.locY) / (double) this.bh;
+ double d2 = this.locZ + (this.bk - this.locZ) / (double) this.bh;
+ double d3 = MathHelper.g(this.bl - (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.yaw = (float) ((double) this.yaw + d3 / (double) this.bh);
+ this.pitch = (float) ((double) this.pitch + (this.bm - (double) this.pitch) / (double) this.bh);
+ --this.bh;
this.setPosition(d0, d1, d2);
this.b(this.yaw, this.pitch);
} else if (!this.bi()) {
@@ -1288,131 +1397,64 @@ public abstract class EntityLiving extends Entity {
}
this.world.methodProfiler.a("ai");
- if (this.bj()) {
- this.bG = false;
- this.bD = 0.0F;
- this.bE = 0.0F;
- this.bF = 0.0F;
+ if (this.aY()) {
+ this.bd = false;
+ this.be = 0.0F;
+ this.bf = 0.0F;
+ this.bg = 0.0F;
} else if (this.bi()) {
- if (this.bh()) {
+ if (this.bb()) {
this.world.methodProfiler.a("newAi");
- this.bo();
+ this.be();
this.world.methodProfiler.b();
} else {
this.world.methodProfiler.a("oldAi");
- this.bq();
+ this.bh();
this.world.methodProfiler.b();
- this.aA = this.yaw;
+ this.aP = this.yaw;
}
}
this.world.methodProfiler.b();
this.world.methodProfiler.a("jump");
- if (this.bG) {
+ if (this.bd) {
if (!this.G() && !this.I()) {
- if (this.onGround && this.bX == 0) {
- this.bl();
- this.bX = 10;
+ if (this.onGround && this.bp == 0) {
+ this.ba();
+ this.bp = 10;
}
} else {
this.motY += 0.03999999910593033D;
}
} else {
- this.bX = 0;
+ this.bp = 0;
}
this.world.methodProfiler.b();
this.world.methodProfiler.a("travel");
- this.bD *= 0.98F;
- this.bE *= 0.98F;
- this.bF *= 0.9F;
- float f = this.aO;
-
- this.aO *= this.bE();
- this.e(this.bD, this.bE);
- this.aO = f;
+ this.be *= 0.98F;
+ this.bf *= 0.98F;
+ this.bg *= 0.9F;
+ this.e(this.be, this.bf);
this.world.methodProfiler.b();
this.world.methodProfiler.a("push");
if (!this.world.isStatic) {
- 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.bT() && !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();
-
- while (iterator.hasNext()) {
- EntityItem entityitem = (EntityItem) iterator.next();
-
- if (!entityitem.dead && entityitem.getItemStack() != null) {
- ItemStack itemstack = entityitem.getItemStack();
- int i = b(itemstack);
-
- if (i > -1) {
- boolean flag = true;
- ItemStack itemstack1 = this.getEquipment(i);
-
- if (itemstack1 != null) {
- if (i == 0) {
- if (itemstack.getItem() instanceof ItemSword && !(itemstack1.getItem() instanceof ItemSword)) {
- flag = true;
- } else if (itemstack.getItem() instanceof ItemSword && itemstack1.getItem() instanceof ItemSword) {
- ItemSword itemsword = (ItemSword) itemstack.getItem();
- ItemSword itemsword1 = (ItemSword) itemstack1.getItem();
-
- if (itemsword.g() == itemsword1.g()) {
- flag = itemstack.getData() > itemstack1.getData() || itemstack.hasTag() && !itemstack1.hasTag();
- } else {
- flag = itemsword.g() > itemsword1.g();
- }
- } else {
- flag = false;
- }
- } else if (itemstack.getItem() instanceof ItemArmor && !(itemstack1.getItem() instanceof ItemArmor)) {
- flag = true;
- } else if (itemstack.getItem() instanceof ItemArmor && itemstack1.getItem() instanceof ItemArmor) {
- ItemArmor itemarmor = (ItemArmor) itemstack.getItem();
- ItemArmor itemarmor1 = (ItemArmor) itemstack1.getItem();
-
- if (itemarmor.c == itemarmor1.c) {
- flag = itemstack.getData() > itemstack1.getData() || itemstack.hasTag() && !itemstack1.hasTag();
- } else {
- flag = itemarmor.c > itemarmor1.c;
- }
- } else {
- flag = false;
- }
- }
-
- if (flag) {
- if (itemstack1 != null && this.random.nextFloat() - 0.1F < this.dropChances[i]) {
- this.a(itemstack1, 0.0F);
- }
-
- this.setEquipment(i, itemstack);
- this.dropChances[i] = 2.0F;
- this.persistent = true;
- this.receive(entityitem, 1);
- entityitem.die();
- }
- }
- }
- }
+ this.bf();
}
this.world.methodProfiler.b();
}
- protected void bg() {
+ protected void be() {}
+
+ protected void bf() {
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);
+ // TODO better check now?
// CraftBukkit start - Only handle mob (non-player) collisions every other tick
if (entity instanceof EntityLiving && !(this instanceof EntityPlayer) && this.ticksLived % 2 == 0) {
continue;
@@ -1420,220 +1462,60 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit end
if (entity.L()) {
- this.o(entity);
+ this.n(entity);
}
}
}
}
- protected void o(Entity entity) {
+ protected void n(Entity entity) {
entity.collide(this);
}
- protected boolean bh() {
- return false;
- }
-
- protected boolean bi() {
- return !this.world.isStatic;
+ public void T() {
+ super.T();
+ this.aW = this.aX;
+ this.aX = 0.0F;
+ this.fallDistance = 0.0F;
}
- protected boolean bj() {
- return this.health <= 0;
- }
+ protected void bg() {}
- public boolean isBlocking() {
- return false;
+ protected void bh() {
+ ++this.aV;
}
- protected void bl() {
- this.motY = 0.41999998688697815D;
- if (this.hasEffect(MobEffectList.JUMP)) {
- this.motY += (double) ((float) (this.getEffect(MobEffectList.JUMP).getAmplifier() + 1) * 0.1F);
- }
-
- if (this.isSprinting()) {
- float f = this.yaw * 0.017453292F;
-
- this.motX -= (double) (MathHelper.sin(f) * 0.2F);
- this.motZ += (double) (MathHelper.cos(f) * 0.2F);
- }
-
- this.an = true;
- }
-
- protected boolean isTypeNotPersistent() {
- return true;
- }
-
- protected void bn() {
- if (!this.persistent) {
- EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D);
-
- if (entityhuman != null) {
- double d0 = entityhuman.locX - this.locX;
- double d1 = entityhuman.locY - this.locY;
- double d2 = entityhuman.locZ - this.locZ;
- double d3 = d0 * d0 + d1 * d1 + d2 * d2;
-
- if (d3 > 16384.0D) { // CraftBukkit - remove isTypeNotPersistent() check
- this.die();
- }
-
- if (this.bC > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check
- this.die();
- } else if (d3 < 1024.0D) {
- this.bC = 0;
- }
- }
- // CraftBukkit start
- } else {
- this.bC = 0;
- }
- // CraftBukkit end
- }
-
- protected void bo() {
- ++this.bC;
- this.world.methodProfiler.a("checkDespawn");
- this.bn();
- this.world.methodProfiler.b();
- this.world.methodProfiler.a("sensing");
- this.bP.a();
- this.world.methodProfiler.b();
- this.world.methodProfiler.a("targetSelector");
- this.targetSelector.a();
- this.world.methodProfiler.b();
- this.world.methodProfiler.a("goalSelector");
- this.goalSelector.a();
- this.world.methodProfiler.b();
- this.world.methodProfiler.a("navigation");
- this.navigation.e();
- this.world.methodProfiler.b();
- this.world.methodProfiler.a("mob tick");
- this.bp();
- this.world.methodProfiler.b();
- this.world.methodProfiler.a("controls");
- this.world.methodProfiler.a("move");
- this.moveController.c();
- this.world.methodProfiler.c("look");
- this.lookController.a();
- this.world.methodProfiler.c("jump");
- this.jumpController.b();
- this.world.methodProfiler.b();
- this.world.methodProfiler.b();
+ public void f(boolean flag) {
+ this.bd = flag;
}
- protected void bp() {}
-
- 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);
+ public void receive(Entity entity, int i) {
+ if (!entity.dead && !this.world.isStatic) {
+ EntityTracker entitytracker = ((WorldServer) this.world).getTracker();
- if (entityhuman != null) {
- this.bY = entityhuman;
- this.bJ = 10 + this.random.nextInt(20);
- } else {
- this.bF = (this.random.nextFloat() - 0.5F) * 20.0F;
+ if (entity instanceof EntityItem) {
+ entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id)));
}
- }
- 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.bF = (this.random.nextFloat() - 0.5F) * 20.0F;
+ if (entity instanceof EntityArrow) {
+ entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id)));
}
- this.yaw += this.bF;
- this.pitch = this.bH;
- }
-
- boolean flag = this.G();
- boolean flag1 = this.I();
-
- if (flag || flag1) {
- this.bG = this.random.nextFloat() < 0.8F;
- }
- }
-
- protected void br() {
- int i = this.h();
-
- if (this.br) {
- ++this.bs;
- if (this.bs >= i) {
- this.bs = 0;
- this.br = false;
+ if (entity instanceof EntityExperienceOrb) {
+ entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id)));
}
- } else {
- this.bs = 0;
- }
-
- this.aR = (float) this.bs / (float) i;
- }
-
- public int bs() {
- return 40;
- }
-
- public void a(Entity entity, float f, float f1) {
- double d0 = entity.locX - this.locX;
- double d1 = entity.locZ - this.locZ;
- double d2;
-
- if (entity instanceof EntityLiving) {
- EntityLiving entityliving = (EntityLiving) entity;
-
- 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());
- }
-
- double d3 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1);
- 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.yaw = this.b(this.yaw, f2, f);
- }
-
- private float b(float f, float f1, float f2) {
- float f3 = MathHelper.g(f1 - f);
-
- if (f3 > f2) {
- f3 = f2;
- }
-
- if (f3 < -f2) {
- f3 = -f2;
}
-
- return f + f3;
- }
-
- public boolean canSpawn() {
- return this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox);
}
- protected void B() {
- this.damageEntity(DamageSource.OUT_OF_WORLD, 4);
+ public boolean o(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 Vec3D Y() {
- return this.i(1.0F);
+ return this.j(1.0F);
}
- public Vec3D i(float f) {
+ public Vec3D j(float f) {
float f1;
float f2;
float f3;
@@ -1657,496 +1539,39 @@ public abstract class EntityLiving extends Entity {
}
}
- public int by() {
- return 4;
- }
-
- public boolean isSleeping() {
- return false;
- }
-
- protected void bA() {
- Iterator iterator = this.effects.keySet().iterator();
-
- while (iterator.hasNext()) {
- Integer integer = (Integer) iterator.next();
- MobEffect mobeffect = (MobEffect) this.effects.get(integer);
-
- try {
- if (!mobeffect.tick(this)) {
- if (!this.world.isStatic) {
- iterator.remove();
- this.c(mobeffect);
- }
- } else if (mobeffect.getDuration() % 600 == 0) {
- this.b(mobeffect);
- }
- } catch (Throwable throwable) {
- CrashReport crashreport = CrashReport.a(throwable, "Ticking mob effect instance");
- CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Mob effect being ticked");
-
- crashreportsystemdetails.a("Effect Name", (Callable) (new CrashReportEffectName(this, mobeffect)));
- crashreportsystemdetails.a("Effect ID", (Callable) (new CrashReportEffectID(this, mobeffect)));
- crashreportsystemdetails.a("Effect Duration", (Callable) (new CrashReportEffectDuration(this, mobeffect)));
- crashreportsystemdetails.a("Effect Amplifier", (Callable) (new CrashReportEffectAmplifier(this, mobeffect)));
- crashreportsystemdetails.a("Effect is Splash", (Callable) (new CrashReportEffectSplash(this, mobeffect)));
- crashreportsystemdetails.a("Effect is Ambient", (Callable) (new CrashReportEffectAmbient(this, mobeffect)));
- throw new ReportedException(crashreport);
- }
- }
-
- int i;
-
- if (this.updateEffects) {
- if (!this.world.isStatic) {
- if (this.effects.isEmpty()) {
- this.datawatcher.watch(9, Byte.valueOf((byte) 0));
- this.datawatcher.watch(8, Integer.valueOf(0));
- this.setInvisible(false);
- } else {
- i = PotionBrewer.a(this.effects.values());
- this.datawatcher.watch(9, Byte.valueOf((byte) (PotionBrewer.b(this.effects.values()) ? 1 : 0)));
- this.datawatcher.watch(8, Integer.valueOf(i));
- this.setInvisible(this.hasEffect(MobEffectList.INVISIBILITY.id));
- }
- }
-
- this.updateEffects = false;
- }
-
- i = this.datawatcher.getInt(8);
- boolean flag = this.datawatcher.getByte(9) > 0;
-
- if (i > 0) {
- boolean flag1 = false;
-
- if (!this.isInvisible()) {
- flag1 = this.random.nextBoolean();
- } else {
- flag1 = this.random.nextInt(15) == 0;
- }
-
- if (flag) {
- flag1 &= this.random.nextInt(5) == 0;
- }
-
- if (flag1 && i > 0) {
- double d0 = (double) (i >> 16 & 255) / 255.0D;
- double d1 = (double) (i >> 8 & 255) / 255.0D;
- double d2 = (double) (i >> 0 & 255) / 255.0D;
-
- this.world.addParticle(flag ? "mobSpellAmbient" : "mobSpell", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length - (double) this.height, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, d0, d1, d2);
- }
- }
- }
-
- public void bB() {
- Iterator iterator = this.effects.keySet().iterator();
-
- while (iterator.hasNext()) {
- Integer integer = (Integer) iterator.next();
- MobEffect mobeffect = (MobEffect) this.effects.get(integer);
-
- if (!this.world.isStatic) {
- iterator.remove();
- this.c(mobeffect);
- }
- }
- }
-
- public Collection getEffects() {
- return this.effects.values();
- }
-
- public boolean hasEffect(int i) {
- // CraftBukkit - Add size check for efficiency
- return this.effects.size() != 0 && this.effects.containsKey(Integer.valueOf(i));
- }
-
- public boolean hasEffect(MobEffectList mobeffectlist) {
- // CraftBukkit - Add size check for efficiency
- return this.effects.size() != 0 && this.effects.containsKey(Integer.valueOf(mobeffectlist.id));
- }
-
- public MobEffect getEffect(MobEffectList mobeffectlist) {
- return (MobEffect) this.effects.get(Integer.valueOf(mobeffectlist.id));
- }
-
- public void addEffect(MobEffect mobeffect) {
- if (this.e(mobeffect)) {
- if (this.effects.containsKey(Integer.valueOf(mobeffect.getEffectId()))) {
- ((MobEffect) this.effects.get(Integer.valueOf(mobeffect.getEffectId()))).a(mobeffect);
- this.b((MobEffect) this.effects.get(Integer.valueOf(mobeffect.getEffectId())));
- } else {
- this.effects.put(Integer.valueOf(mobeffect.getEffectId()), mobeffect);
- this.a(mobeffect);
- }
- }
+ public boolean bi() {
+ return !this.world.isStatic;
}
- public boolean e(MobEffect mobeffect) {
- if (this.getMonsterType() == EnumMonsterType.UNDEAD) {
- int i = mobeffect.getEffectId();
-
- if (i == MobEffectList.REGENERATION.id || i == MobEffectList.POISON.id) {
- return false;
- }
- }
-
- return true;
+ public boolean K() {
+ return !this.dead;
}
- public boolean bD() {
- return this.getMonsterType() == EnumMonsterType.UNDEAD;
+ public boolean L() {
+ return !this.dead;
}
- public void o(int i) {
- MobEffect mobeffect = (MobEffect) this.effects.remove(Integer.valueOf(i));
-
- if (mobeffect != null) {
- this.c(mobeffect);
- }
+ public float getHeadHeight() {
+ return this.length * 0.85F;
}
- protected void a(MobEffect mobeffect) {
- this.updateEffects = true;
+ protected void J() {
+ this.velocityChanged = this.random.nextDouble() >= this.a(GenericAttributes.c).e();
}
- protected void b(MobEffect mobeffect) {
- this.updateEffects = true;
+ public float getHeadRotation() {
+ return this.aP;
}
- protected void c(MobEffect mobeffect) {
- this.updateEffects = true;
+ public float bj() {
+ return this.bq;
}
- public float bE() {
- float f = 1.0F;
-
- if (this.hasEffect(MobEffectList.FASTER_MOVEMENT)) {
- f *= 1.0F + 0.2F * (float) (this.getEffect(MobEffectList.FASTER_MOVEMENT).getAmplifier() + 1);
- }
-
- if (this.hasEffect(MobEffectList.SLOWER_MOVEMENT)) {
- f *= 1.0F - 0.15F * (float) (this.getEffect(MobEffectList.SLOWER_MOVEMENT).getAmplifier() + 1);
- }
-
+ public void m(float f) {
if (f < 0.0F) {
f = 0.0F;
}
- return f;
- }
-
- public void enderTeleportTo(double d0, double d1, double d2) {
- this.setPositionRotation(d0, d1, d2, this.yaw, this.pitch);
- }
-
- public boolean isBaby() {
- return false;
- }
-
- public EnumMonsterType getMonsterType() {
- return EnumMonsterType.UNDEFINED;
- }
-
- public void a(ItemStack itemstack) {
- this.makeSound("random.break", 0.8F, 0.8F + this.world.random.nextFloat() * 0.4F);
-
- for (int i = 0; i < 5; ++i) {
- Vec3D vec3d = this.world.getVec3DPool().create(((double) this.random.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
-
- vec3d.a(-this.pitch * 3.1415927F / 180.0F);
- vec3d.b(-this.yaw * 3.1415927F / 180.0F);
- Vec3D vec3d1 = this.world.getVec3DPool().create(((double) this.random.nextFloat() - 0.5D) * 0.3D, (double) (-this.random.nextFloat()) * 0.6D - 0.3D, 0.6D);
-
- vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
- vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
- vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ);
- this.world.addParticle("iconcrack_" + itemstack.getItem().id, vec3d1.c, vec3d1.d, vec3d1.e, vec3d.c, vec3d.d + 0.05D, vec3d.e);
- }
- }
-
- public int ar() {
- if (this.getGoalTarget() == null) {
- return 3;
- } else {
- int i = (int) ((float) this.health - (float) this.maxHealth * 0.33F); // CraftBukkit - this.getMaxHealth() -> this.maxHealth
-
- i -= (3 - this.world.difficulty) * 4;
- if (i < 0) {
- i = 0;
- }
-
- return i + 3;
- }
- }
-
- public ItemStack bG() {
- return this.equipment[0];
- }
-
- public ItemStack getEquipment(int i) {
- return this.equipment[i];
- }
-
- public ItemStack q(int i) {
- return this.equipment[i + 1];
- }
-
- public void setEquipment(int i, ItemStack itemstack) {
- this.equipment[i] = itemstack;
- }
-
- public ItemStack[] getEquipment() {
- return this.equipment;
- }
-
- protected void dropEquipment(boolean flag, int i) {
- for (int j = 0; j < this.getEquipment().length; ++j) {
- ItemStack itemstack = this.getEquipment(j);
- 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.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;
- }
-
- if (l < 1) {
- l = 1;
- }
-
- itemstack.setData(l);
- }
-
- this.a(itemstack, 0.0F);
- }
- }
- }
-
- 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.095F) {
- ++i;
- }
-
- if (this.random.nextFloat() < 0.095F) {
- ++i;
- }
-
- if (this.random.nextFloat() < 0.095F) {
- ++i;
- }
-
- for (int j = 3; j >= 0; --j) {
- ItemStack itemstack = this.q(j);
-
- if (j < 3 && this.random.nextFloat() < f) {
- break;
- }
-
- if (itemstack == null) {
- Item item = a(j + 1, i);
-
- if (item != null) {
- this.setEquipment(j + 1, new ItemStack(item));
- }
- }
- }
- }
- }
-
- public void receive(Entity entity, int i) {
- if (!entity.dead && !this.world.isStatic) {
- EntityTracker entitytracker = ((WorldServer) this.world).getTracker();
-
- if (entity instanceof EntityItem) {
- entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id)));
- }
-
- if (entity instanceof EntityArrow) {
- entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id)));
- }
-
- if (entity instanceof EntityExperienceOrb) {
- entitytracker.a(entity, (Packet) (new Packet22Collect(entity.id, this.id)));
- }
- }
- }
-
- 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()).b) {
- case 0:
- return 4;
-
- case 1:
- return 3;
-
- case 2:
- return 2;
-
- case 3:
- return 1;
- }
- }
-
- return 0;
- } else {
- return 4;
- }
- }
-
- public static Item a(int i, int j) {
- switch (i) {
- case 4:
- if (j == 0) {
- return Item.LEATHER_HELMET;
- } else if (j == 1) {
- return Item.GOLD_HELMET;
- } else if (j == 2) {
- return Item.CHAINMAIL_HELMET;
- } else if (j == 3) {
- return Item.IRON_HELMET;
- } else if (j == 4) {
- return Item.DIAMOND_HELMET;
- }
-
- case 3:
- if (j == 0) {
- return Item.LEATHER_CHESTPLATE;
- } else if (j == 1) {
- return Item.GOLD_CHESTPLATE;
- } else if (j == 2) {
- return Item.CHAINMAIL_CHESTPLATE;
- } else if (j == 3) {
- return Item.IRON_CHESTPLATE;
- } else if (j == 4) {
- return Item.DIAMOND_CHESTPLATE;
- }
-
- case 2:
- if (j == 0) {
- return Item.LEATHER_LEGGINGS;
- } else if (j == 1) {
- return Item.GOLD_LEGGINGS;
- } else if (j == 2) {
- return Item.CHAINMAIL_LEGGINGS;
- } else if (j == 3) {
- return Item.IRON_LEGGINGS;
- } else if (j == 4) {
- return Item.DIAMOND_LEGGINGS;
- }
-
- case 1:
- if (j == 0) {
- return Item.LEATHER_BOOTS;
- } else if (j == 1) {
- return Item.GOLD_BOOTS;
- } else if (j == 2) {
- return Item.CHAINMAIL_BOOTS;
- } else if (j == 3) {
- return Item.IRON_BOOTS;
- } else if (j == 4) {
- return Item.DIAMOND_BOOTS;
- }
-
- default:
- return null;
- }
- }
-
- 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) {
- ItemStack itemstack = this.q(i);
-
- if (itemstack != null && this.random.nextFloat() < c[this.world.difficulty]) {
- EnchantmentManager.a(this.random, itemstack, 5 + this.world.difficulty * this.random.nextInt(6));
- }
- }
- }
-
- 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 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 bL() {
- return false;
- }
-
- 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 bT() {
- return this.canPickUpLoot;
- }
-
- public void h(boolean flag) {
- this.canPickUpLoot = flag;
- }
-
- public boolean bU() {
- return this.persistent;
+ this.bq = f;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityMagmaCube.java b/src/main/java/net/minecraft/server/EntityMagmaCube.java
index 40066247..3f9dd6a0 100644
--- a/src/main/java/net/minecraft/server/EntityMagmaCube.java
+++ b/src/main/java/net/minecraft/server/EntityMagmaCube.java
@@ -4,28 +4,31 @@ public class EntityMagmaCube extends EntitySlime {
public EntityMagmaCube(World world) {
super(world);
- this.texture = "/mob/lava.png";
this.fireProof = true;
- this.aO = 0.2F;
+ }
+
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.d).a(0.20000000298023224D);
}
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 aZ() {
+ public int aM() {
return this.getSize() * 3;
}
- public float c(float f) {
+ public float d(float f) {
return 1.0F;
}
- protected String h() {
+ protected String bF() {
return "flame";
}
- protected EntitySlime i() {
+ protected EntitySlime bG() {
return new EntityMagmaCube(this.world);
}
@@ -58,38 +61,38 @@ public class EntityMagmaCube extends EntitySlime {
return false;
}
- protected int j() {
- return super.j() * 4;
+ protected int bH() {
+ return super.bH() * 4;
}
- protected void k() {
- this.b *= 0.9F;
+ protected void bI() {
+ this.h *= 0.9F;
}
- protected void bl() {
+ protected void ba() {
this.motY = (double) (0.42F + (float) this.getSize() * 0.1F);
this.an = true;
}
- protected void a(float f) {}
+ protected void b(float f) {}
- protected boolean l() {
+ protected boolean bJ() {
return true;
}
- protected int m() {
- return super.m() + 2;
+ protected int bK() {
+ return super.bK() + 2;
}
- protected String bc() {
+ protected String aK() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
- protected String bd() {
+ protected String aL() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
- protected String n() {
+ protected String bL() {
return this.getSize() > 1 ? "mob.magmacube.big" : "mob.magmacube.small";
}
@@ -97,7 +100,7 @@ public class EntityMagmaCube extends EntitySlime {
return false;
}
- protected boolean o() {
+ protected boolean bM() {
return true;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
index eed15778..126826cd 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
@@ -37,7 +37,6 @@ public abstract class EntityMinecartAbstract extends Entity {
public EntityMinecartAbstract(World world) {
super(world);
- this.a = false;
this.m = true;
this.a(0.98F, 0.7F);
this.height = this.length / 2.0F;
@@ -66,14 +65,14 @@ public abstract class EntityMinecartAbstract extends Entity {
}
}
- protected boolean f_() {
+ protected boolean e_() {
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(19, new Float(0.0F));
this.datawatcher.a(20, new Integer(0));
this.datawatcher.a(21, new Integer(6));
this.datawatcher.a(22, Byte.valueOf((byte) 0));
@@ -93,7 +92,7 @@ public abstract class EntityMinecartAbstract extends Entity {
public EntityMinecartAbstract(World world, double d0, double d1, double d2) {
this(world);
- this.setPosition(d0, d1 + (double) this.height, d2);
+ this.setPosition(d0, d1, d2);
this.motX = 0.0D;
this.motY = 0.0D;
this.motZ = 0.0D;
@@ -108,7 +107,7 @@ public abstract class EntityMinecartAbstract extends Entity {
return (double) this.length * 0.0D - 0.30000001192092896D;
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (!this.world.isStatic && !this.dead) {
if (this.isInvulnerable()) {
return false;
@@ -117,23 +116,23 @@ public abstract class EntityMinecartAbstract extends Entity {
Vehicle vehicle = (Vehicle) this.getBukkitEntity();
org.bukkit.entity.Entity passenger = (damagesource.getEntity() == null) ? null : damagesource.getEntity().getBukkitEntity();
- VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, i);
+ VehicleDamageEvent event = new VehicleDamageEvent(vehicle, passenger, f);
this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
return true;
}
- i = event.getDamage();
+ f = (float) event.getDamage();
// CraftBukkit end
- this.j(-this.k());
- this.i(10);
+ this.h(-this.k());
+ this.c(10);
this.J();
- this.setDamage(this.getDamage() + i * 10);
+ this.setDamage(this.getDamage() + f * 10.0F);
boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild;
- if (flag || this.getDamage() > 40) {
+ if (flag || this.getDamage() > 40.0F) {
if (this.passenger != null) {
this.passenger.mount(this);
}
@@ -198,11 +197,11 @@ public abstract class EntityMinecartAbstract extends Entity {
}
if (this.j() > 0) {
- this.i(this.j() - 1);
+ this.c(this.j() - 1);
}
- if (this.getDamage() > 0) {
- this.setDamage(this.getDamage() - 1);
+ if (this.getDamage() > 0.0F) {
+ this.setDamage(this.getDamage() - 1.0F);
}
if (this.locY < -64.0D) {
@@ -229,7 +228,7 @@ public abstract class EntityMinecartAbstract extends Entity {
b0 = -1;
}
- this.c(b0);
+ this.b(b0);
}
this.ap = false;
@@ -285,7 +284,7 @@ public abstract class EntityMinecartAbstract extends Entity {
double d5 = 0.0078125D;
int l = this.world.getTypeId(j, i, k);
- if (BlockMinecartTrackAbstract.d_(l)) {
+ if (BlockMinecartTrackAbstract.e_(l)) {
int i1 = this.world.getData(j, i, k);
this.a(j, i, k, d4, d5, l, i1);
@@ -447,14 +446,20 @@ public abstract class EntityMinecartAbstract extends Entity {
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;
+ double d9;
+ double d10;
+
+ if (this.passenger != null && this.passenger instanceof EntityLiving) {
+ d7 = (double) ((EntityLiving) this.passenger).bf;
+ if (d7 > 0.0D) {
+ d8 = -Math.sin((double) (this.passenger.yaw * 3.1415927F / 180.0F));
+ d9 = Math.cos((double) (this.passenger.yaw * 3.1415927F / 180.0F));
+ d10 = this.motX * this.motX + this.motZ * this.motZ;
+ if (d10 < 0.01D) {
+ this.motX += d8 * 0.1D;
+ this.motZ += d9 * 0.1D;
+ flag1 = false;
+ }
}
}
@@ -473,8 +478,8 @@ public abstract class EntityMinecartAbstract extends Entity {
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;
+ d9 = (double) k + 0.5D + (double) aint[0][2] * 0.5D;
+ 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;
@@ -598,7 +603,7 @@ public abstract class EntityMinecartAbstract extends Entity {
int l = this.world.getTypeId(i, j, k);
- if (BlockMinecartTrackAbstract.d_(l)) {
+ if (BlockMinecartTrackAbstract.e_(l)) {
int i1 = this.world.getData(i, j, k);
d1 = (double) j;
@@ -654,9 +659,9 @@ public abstract class EntityMinecartAbstract extends Entity {
protected void a(NBTTagCompound nbttagcompound) {
if (nbttagcompound.getBoolean("CustomDisplayTile")) {
- this.k(nbttagcompound.getInt("DisplayTile"));
- this.l(nbttagcompound.getInt("DisplayData"));
- this.m(nbttagcompound.getInt("DisplayOffset"));
+ this.i(nbttagcompound.getInt("DisplayTile"));
+ this.j(nbttagcompound.getInt("DisplayData"));
+ this.k(nbttagcompound.getInt("DisplayOffset"));
}
if (nbttagcompound.hasKey("CustomName") && nbttagcompound.getString("CustomName").length() > 0) {
@@ -764,15 +769,15 @@ public abstract class EntityMinecartAbstract extends Entity {
}
}
- public void setDamage(int i) {
- this.datawatcher.watch(19, Integer.valueOf(i));
+ public void setDamage(float f) {
+ this.datawatcher.watch(19, Float.valueOf(f));
}
- public int getDamage() {
- return this.datawatcher.getInt(19);
+ public float getDamage() {
+ return this.datawatcher.getFloat(19);
}
- public void i(int i) {
+ public void c(int i) {
this.datawatcher.watch(17, Integer.valueOf(i));
}
@@ -780,7 +785,7 @@ public abstract class EntityMinecartAbstract extends Entity {
return this.datawatcher.getInt(17);
}
- public void j(int i) {
+ public void h(int i) {
this.datawatcher.watch(18, Integer.valueOf(i));
}
@@ -820,12 +825,12 @@ public abstract class EntityMinecartAbstract extends Entity {
return 6;
}
- public void k(int i) {
+ public void i(int i) {
this.getDataWatcher().watch(20, Integer.valueOf(i & '\uffff' | this.o() << 16));
this.a(true);
}
- public void l(int i) {
+ public void j(int i) {
Block block = this.m();
int j = block == null ? 0 : block.id;
@@ -833,7 +838,7 @@ public abstract class EntityMinecartAbstract extends Entity {
this.a(true);
}
- public void m(int i) {
+ public void k(int i) {
this.getDataWatcher().watch(21, Integer.valueOf(i));
this.a(true);
}
diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
index c207076d..e89b1063 100644
--- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java
+++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java
@@ -148,9 +148,9 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
return 64;
}
- public void c(int i) {
+ public void b(int i) {
this.b = false;
- super.c(i);
+ super.b(i);
}
public void die() {
@@ -224,7 +224,7 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp
}
}
- public boolean a_(EntityHuman entityhuman) {
+ public boolean c(EntityHuman entityhuman) {
if (!this.world.isStatic) {
entityhuman.openContainer(this);
}
diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java
index e9d15405..71d23ef6 100644
--- a/src/main/java/net/minecraft/server/EntityMonster.java
+++ b/src/main/java/net/minecraft/server/EntityMonster.java
@@ -6,15 +6,15 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
public EntityMonster(World world) {
super(world);
- this.be = 5;
+ this.b = 5;
}
public void c() {
- this.br();
- float f = this.c(1.0F);
+ this.aS();
+ float f = this.d(1.0F);
if (f > 0.5F) {
- this.bC += 2;
+ this.aV += 2;
}
super.c();
@@ -30,13 +30,13 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
protected Entity findTarget() {
EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D);
- return entityhuman != null && this.n(entityhuman) ? entityhuman : null;
+ return entityhuman != null && this.o(entityhuman) ? entityhuman : null;
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
- } else if (super.damageEntity(damagesource, i)) {
+ } else if (super.damageEntity(damagesource, f)) {
Entity entity = damagesource.getEntity();
if (this.passenger != entity && this.vehicle != entity) {
@@ -68,36 +68,27 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
public boolean m(Entity entity) {
- int i = this.c(entity);
-
- if (this.hasEffect(MobEffectList.INCREASE_DAMAGE)) {
- i += 3 << this.getEffect(MobEffectList.INCREASE_DAMAGE).getAmplifier();
- }
-
- if (this.hasEffect(MobEffectList.WEAKNESS)) {
- i -= 2 << this.getEffect(MobEffectList.WEAKNESS).getAmplifier();
- }
-
- int j = 0;
+ float f = (float) this.a(GenericAttributes.e).e();
+ int i = 0;
if (entity instanceof EntityLiving) {
- i += EnchantmentManager.a((EntityLiving) this, (EntityLiving) entity);
- j += EnchantmentManager.getKnockbackEnchantmentLevel(this, (EntityLiving) entity);
+ f += EnchantmentManager.a((EntityLiving) this, (EntityLiving) entity);
+ i += EnchantmentManager.getKnockbackEnchantmentLevel(this, (EntityLiving) entity);
}
- boolean flag = entity.damageEntity(DamageSource.mobAttack(this), i);
+ boolean flag = entity.damageEntity(DamageSource.mobAttack(this), f);
if (flag) {
- if (j > 0) {
- entity.g((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) j * 0.5F));
+ if (i > 0) {
+ entity.g((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F));
this.motX *= 0.6D;
this.motZ *= 0.6D;
}
- int k = EnchantmentManager.getFireAspectEnchantmentLevel(this);
+ int j = EnchantmentManager.getFireAspectEnchantmentLevel(this);
- if (k > 0) {
- entity.setOnFire(k * 4);
+ if (j > 0) {
+ entity.setOnFire(j * 4);
}
if (entity instanceof EntityLiving) {
@@ -129,7 +120,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
} else {
int l = this.world.getLightLevel(i, j, k);
- if (this.world.O()) {
+ if (this.world.P()) {
int i1 = this.world.j;
this.world.j = 10;
@@ -142,10 +133,11 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
}
public boolean canSpawn() {
- return this.i_() && super.canSpawn();
+ return this.world.difficulty > 0 && this.i_() && super.canSpawn();
}
- public int c(Entity entity) {
- return 2;
+ protected void ax() {
+ super.ax();
+ this.aT().b(GenericAttributes.e);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java
index 3f22c9fc..abf7d270 100644
--- a/src/main/java/net/minecraft/server/EntityMushroomCow.java
+++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java
@@ -6,11 +6,10 @@ public class EntityMushroomCow extends EntityCow {
public EntityMushroomCow(World world) {
super(world);
- this.texture = "/mob/redcow.png";
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 +41,7 @@ public class EntityMushroomCow extends EntityCow {
entitycow.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
entitycow.setHealth(this.getHealth());
- entitycow.ay = this.ay;
+ entitycow.aN = this.aN;
this.world.addEntity(entitycow);
for (int i = 0; i < 5; ++i) {
@@ -52,7 +51,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 48d311f1..e2f5a04f 100644
--- a/src/main/java/net/minecraft/server/EntityOcelot.java
+++ b/src/main/java/net/minecraft/server/EntityOcelot.java
@@ -2,25 +2,24 @@ package net.minecraft.server;
public class EntityOcelot extends EntityTameableAnimal {
- private PathfinderGoalTempt e;
+ private PathfinderGoalTempt bq;
public EntityOcelot(World world) {
super(world);
- this.texture = "/mob/ozelot.png";
this.a(0.6F, 0.8F);
this.getNavigation().a(true);
this.goalSelector.a(1, new PathfinderGoalFloat(this));
- this.goalSelector.a(2, this.d);
- this.goalSelector.a(3, this.e = new PathfinderGoalTempt(this, 0.18F, Item.RAW_FISH.id, true));
- this.goalSelector.a(4, new PathfinderGoalAvoidPlayer(this, EntityHuman.class, 16.0F, 0.23F, 0.4F));
- this.goalSelector.a(5, new PathfinderGoalFollowOwner(this, 0.3F, 10.0F, 5.0F));
- this.goalSelector.a(6, new PathfinderGoalJumpOnBlock(this, 0.4F));
+ this.goalSelector.a(2, this.bp);
+ this.goalSelector.a(3, this.bq = new PathfinderGoalTempt(this, 0.6D, Item.RAW_FISH.id, true));
+ this.goalSelector.a(4, new PathfinderGoalAvoidPlayer(this, EntityHuman.class, 16.0F, 0.8D, 1.33D));
+ this.goalSelector.a(5, new PathfinderGoalFollowOwner(this, 1.0D, 10.0F, 5.0F));
+ this.goalSelector.a(6, new PathfinderGoalJumpOnBlock(this, 1.33D));
this.goalSelector.a(7, new PathfinderGoalLeapAtTarget(this, 0.3F));
this.goalSelector.a(8, new PathfinderGoalOcelotAttack(this));
- this.goalSelector.a(9, new PathfinderGoalBreed(this, 0.23F));
- this.goalSelector.a(10, new PathfinderGoalRandomStroll(this, 0.23F));
+ this.goalSelector.a(9, new PathfinderGoalBreed(this, 0.8D));
+ this.goalSelector.a(10, new PathfinderGoalRandomStroll(this, 0.8D));
this.goalSelector.a(11, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 10.0F));
- this.targetSelector.a(1, new PathfinderGoalRandomTargetNonTamed(this, EntityChicken.class, 14.0F, 750, false));
+ this.targetSelector.a(1, new PathfinderGoalRandomTargetNonTamed(this, EntityChicken.class, 750, false));
}
protected void a() {
@@ -28,14 +27,14 @@ public class EntityOcelot extends EntityTameableAnimal {
this.datawatcher.a(18, Byte.valueOf((byte) 0));
}
- public void bp() {
+ public void bg() {
if (this.getControllerMove().a()) {
- float f = this.getControllerMove().b();
+ double d0 = this.getControllerMove().b();
- if (f == 0.18F) {
+ if (d0 == 0.6D) {
this.setSneaking(true);
this.setSprinting(false);
- } else if (f == 0.4F) {
+ } else if (d0 == 1.33D) {
this.setSneaking(false);
this.setSprinting(true);
} else {
@@ -49,18 +48,20 @@ public class EntityOcelot extends EntityTameableAnimal {
}
protected boolean isTypeNotPersistent() {
- return !this.isTamed();
+ return !this.isTamed() && this.ticksLived > 2400;
}
- public boolean bh() {
+ public boolean bb() {
return true;
}
- public int getMaxHealth() {
- return 10;
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.a).a(10.0D);
+ this.a(GenericAttributes.d).a(0.30000001192092896D);
}
- protected void a(float f) {}
+ protected void b(float f) {}
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
@@ -72,19 +73,19 @@ public class EntityOcelot extends EntityTameableAnimal {
this.setCatType(nbttagcompound.getInt("CatType"));
}
- protected String bb() {
- return this.isTamed() ? (this.r() ? "mob.cat.purr" : (this.random.nextInt(4) == 0 ? "mob.cat.purreow" : "mob.cat.meow")) : "";
+ protected String r() {
+ return this.isTamed() ? (this.bU() ? "mob.cat.purr" : (this.random.nextInt(4) == 0 ? "mob.cat.purreow" : "mob.cat.meow")) : "";
}
- protected String bc() {
+ protected String aK() {
return "mob.cat.hitt";
}
- protected String bd() {
+ protected String aL() {
return "mob.cat.hitt";
}
- protected float ba() {
+ protected float aW() {
return 0.4F;
}
@@ -93,15 +94,15 @@ public class EntityOcelot extends EntityTameableAnimal {
}
public boolean m(Entity entity) {
- return entity.damageEntity(DamageSource.mobAttack(this), 3);
+ return entity.damageEntity(DamageSource.mobAttack(this), 3.0F);
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else {
- this.d.setSitting(false);
- return super.damageEntity(damagesource, i);
+ this.bp.setSitting(false);
+ return super.damageEntity(damagesource, f);
}
}
@@ -109,14 +110,14 @@ 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()) {
- if (entityhuman.name.equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.c(itemstack)) {
- this.d.setSitting(!this.isSitting());
+ if (entityhuman.getName().equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.c(itemstack)) {
+ this.bp.setSitting(!this.isSitting());
}
- } else if (this.e.f() && itemstack != null && itemstack.id == Item.RAW_FISH.id && entityhuman.e(this) < 9.0D) {
+ } else if (this.bq.f() && itemstack != null && itemstack.id == Item.RAW_FISH.id && entityhuman.e(this) < 9.0D) {
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
}
@@ -130,12 +131,12 @@ public class EntityOcelot extends EntityTameableAnimal {
if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) {
this.setTamed(true);
this.setCatType(1 + this.world.random.nextInt(3));
- this.setOwnerName(entityhuman.name);
- this.i(true);
- this.d.setSitting(true);
+ this.setOwnerName(entityhuman.getName());
+ this.j(true);
+ this.bp.setSitting(true);
this.world.broadcastEntityEffect(this, (byte) 7);
} else {
- this.i(false);
+ this.j(false);
this.world.broadcastEntityEffect(this, (byte) 6);
}
}
@@ -143,7 +144,7 @@ public class EntityOcelot extends EntityTameableAnimal {
return true;
}
- return super.a_(entityhuman);
+ return super.a(entityhuman);
}
public EntityOcelot b(EntityAgeable entityageable) {
@@ -172,7 +173,7 @@ public class EntityOcelot extends EntityTameableAnimal {
} else {
EntityOcelot entityocelot = (EntityOcelot) entityanimal;
- return !entityocelot.isTamed() ? false : this.r() && entityocelot.r();
+ return !entityocelot.isTamed() ? false : this.bU() && entityocelot.bU();
}
}
@@ -212,7 +213,8 @@ public class EntityOcelot extends EntityTameableAnimal {
return this.hasCustomName() ? this.getCustomName() : (this.isTamed() ? "entity.Cat.name" : super.getLocalizedName());
}
- public void bJ() {
+ public GroupDataEntity a(GroupDataEntity groupdataentity) {
+ groupdataentity = super.a(groupdataentity);
if (this.world.random.nextInt(7) == 0) {
for (int i = 0; i < 2; ++i) {
EntityOcelot entityocelot = new EntityOcelot(this.world);
@@ -222,6 +224,8 @@ public class EntityOcelot extends EntityTameableAnimal {
this.world.addEntity(entityocelot);
}
}
+
+ return groupdataentity;
}
public EntityAgeable createChild(EntityAgeable entityageable) {
diff --git a/src/main/java/net/minecraft/server/EntityPainting.java b/src/main/java/net/minecraft/server/EntityPainting.java
index 6fb2afa5..1bd0cccf 100644
--- a/src/main/java/net/minecraft/server/EntityPainting.java
+++ b/src/main/java/net/minecraft/server/EntityPainting.java
@@ -63,11 +63,19 @@ public class EntityPainting extends EntityHanging {
return this.art.C;
}
- public int g() {
+ public int e() {
return this.art.D;
}
- public void h() {
+ public void b(Entity entity) {
+ if (entity instanceof EntityHuman) {
+ EntityHuman entityhuman = (EntityHuman) entity;
+
+ if (entityhuman.abilities.canInstantlyBuild) {
+ return;
+ }
+ }
+
this.a(new ItemStack(Item.PAINTING), 0.0F);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java
index e9fe7cff..b77751e5 100644
--- a/src/main/java/net/minecraft/server/EntityPig.java
+++ b/src/main/java/net/minecraft/server/EntityPig.java
@@ -4,41 +4,40 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class EntityPig extends EntityAnimal {
- private final PathfinderGoalPassengerCarrotStick d;
+ private final PathfinderGoalPassengerCarrotStick bp;
public EntityPig(World world) {
super(world);
- this.texture = "/mob/pig.png";
this.a(0.9F, 0.9F);
this.getNavigation().a(true);
- float f = 0.25F;
-
this.goalSelector.a(0, new PathfinderGoalFloat(this));
- this.goalSelector.a(1, new PathfinderGoalPanic(this, 0.38F));
- this.goalSelector.a(2, this.d = new PathfinderGoalPassengerCarrotStick(this, 0.34F));
- this.goalSelector.a(3, new PathfinderGoalBreed(this, f));
- this.goalSelector.a(4, new PathfinderGoalTempt(this, 0.3F, Item.CARROT_STICK.id, false));
- this.goalSelector.a(4, new PathfinderGoalTempt(this, 0.3F, Item.CARROT.id, false));
- this.goalSelector.a(5, new PathfinderGoalFollowParent(this, 0.28F));
- this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, f));
+ this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.25D));
+ this.goalSelector.a(2, this.bp = new PathfinderGoalPassengerCarrotStick(this, 0.3F));
+ this.goalSelector.a(3, new PathfinderGoalBreed(this, 1.0D));
+ this.goalSelector.a(4, new PathfinderGoalTempt(this, 1.2D, Item.CARROT_STICK.id, false));
+ this.goalSelector.a(4, new PathfinderGoalTempt(this, 1.2D, Item.CARROT.id, false));
+ this.goalSelector.a(5, new PathfinderGoalFollowParent(this, 1.1D));
+ this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, 1.0D));
this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
}
- public boolean bh() {
+ public boolean bb() {
return true;
}
- public int getMaxHealth() {
- return 10;
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.a).a(10.0D);
+ this.a(GenericAttributes.d).a(0.25D);
}
- protected void bo() {
- super.bo();
+ protected void be() {
+ super.be();
}
- public boolean bL() {
- ItemStack itemstack = ((EntityHuman) this.passenger).bG();
+ public boolean bu() {
+ ItemStack itemstack = ((EntityHuman) this.passenger).aV();
return itemstack != null && itemstack.id == Item.CARROT_STICK.id;
}
@@ -58,15 +57,15 @@ public class EntityPig extends EntityAnimal {
this.setSaddle(nbttagcompound.getBoolean("Saddle"));
}
- protected String bb() {
+ protected String r() {
return "mob.pig.say";
}
- protected String bc() {
+ protected String aK() {
return "mob.pig.say";
}
- protected String bd() {
+ protected String aL() {
return "mob.pig.death";
}
@@ -74,8 +73,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);
@@ -139,8 +138,8 @@ public class EntityPig extends EntityAnimal {
}
}
- protected void a(float f) {
- super.a(f);
+ protected void b(float f) {
+ super.b(f);
if (f > 5.0F && this.passenger instanceof EntityHuman) {
((EntityHuman) this.passenger).a((Statistic) AchievementList.u);
}
@@ -154,8 +153,8 @@ public class EntityPig extends EntityAnimal {
return itemstack != null && itemstack.id == Item.CARROT.id;
}
- public PathfinderGoalPassengerCarrotStick n() {
- return this.d;
+ public PathfinderGoalPassengerCarrotStick bQ() {
+ return this.bp;
}
public EntityAgeable createChild(EntityAgeable entityageable) {
diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java
index 8a6dda60..3bc0f925 100644
--- a/src/main/java/net/minecraft/server/EntityPigZombie.java
+++ b/src/main/java/net/minecraft/server/EntityPigZombie.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import java.util.List;
+import java.util.UUID;
// CraftBukkit start
import org.bukkit.craftbukkit.inventory.CraftItemStack;
@@ -9,24 +10,41 @@ import org.bukkit.event.entity.EntityTargetEvent;
public class EntityPigZombie extends EntityZombie {
- public int angerLevel = 0; // CraftBukkit - private -> public
- private int soundDelay = 0;
+ private static final UUID bq = UUID.fromString("49455A49-7EC5-45BA-B886-3B90B23A1718");
+ private static final AttributeModifier br = (new AttributeModifier(bq, "Attacking speed boost", 0.45D, 0)).a(false);
+ public int angerLevel; // CraftBukkit - private -> public
+ private int soundDelay;
+ private Entity bu;
public EntityPigZombie(World world) {
super(world);
- this.texture = "/mob/pigzombie.png";
- this.bI = 0.5F;
this.fireProof = true;
}
- protected boolean bh() {
+ protected void ax() {
+ super.ax();
+ this.a(bp).a(0.0D);
+ this.a(GenericAttributes.d).a(0.5D);
+ this.a(GenericAttributes.e).a(5.0D);
+ }
+
+ protected boolean bb() {
return false;
}
public void l_() {
- this.bI = this.target != null ? 0.95F : 0.5F;
+ if (this.bu != this.target && !this.world.isStatic) {
+ AttributeInstance attributeinstance = this.a(GenericAttributes.d);
+
+ attributeinstance.b(br);
+ if (this.target != null) {
+ attributeinstance.a(br);
+ }
+ }
+
+ this.bu = this.target;
if (this.soundDelay > 0 && --this.soundDelay == 0) {
- this.makeSound("mob.zombiepig.zpigangry", this.ba() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
+ this.makeSound("mob.zombiepig.zpigangry", this.aW() * 2.0F, ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 1.8F);
}
super.l_();
@@ -50,7 +68,7 @@ public class EntityPigZombie extends EntityZombie {
return this.angerLevel == 0 ? null : super.findTarget();
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else {
@@ -59,24 +77,24 @@ public class EntityPigZombie extends EntityZombie {
if (entity instanceof EntityHuman) {
List list = this.world.getEntities(this, this.boundingBox.grow(32.0D, 32.0D, 32.0D));
- for (int j = 0; j < list.size(); ++j) {
- Entity entity1 = (Entity) list.get(j);
+ for (int i = 0; i < list.size(); ++i) {
+ Entity entity1 = (Entity) list.get(i);
if (entity1 instanceof EntityPigZombie) {
EntityPigZombie entitypigzombie = (EntityPigZombie) entity1;
- entitypigzombie.p(entity);
+ entitypigzombie.c(entity);
}
}
- this.p(entity);
+ this.c(entity);
}
- return super.damageEntity(damagesource, i);
+ return super.damageEntity(damagesource, f);
}
}
- private void p(Entity entity) {
+ private void c(Entity entity) {
// CraftBukkit start
org.bukkit.entity.Entity bukkitTarget = entity == null ? null : entity.getBukkitEntity();
@@ -99,15 +117,15 @@ public class EntityPigZombie extends EntityZombie {
this.soundDelay = this.random.nextInt(40);
}
- protected String bb() {
+ protected String r() {
return "mob.zombiepig.zpig";
}
- protected String bc() {
+ protected String aK() {
return "mob.zombiepig.zpighurt";
}
- protected String bd() {
+ protected String aL() {
return "mob.zombiepig.zpigdeath";
}
@@ -142,7 +160,7 @@ public class EntityPigZombie extends EntityZombie {
// CraftBukkit end
}
- public boolean a_(EntityHuman entityhuman) {
+ public boolean a(EntityHuman entityhuman) {
return false;
}
@@ -156,23 +174,13 @@ public class EntityPigZombie extends EntityZombie {
return Item.ROTTEN_FLESH.id;
}
- protected void bH() {
+ protected void bs() {
this.setEquipment(0, new ItemStack(Item.GOLD_SWORD));
}
- public void bJ() {
- super.bJ();
+ public GroupDataEntity a(GroupDataEntity groupdataentity) {
+ super.a(groupdataentity);
this.setVillager(false);
- }
-
- public int c(Entity entity) {
- ItemStack itemstack = this.bG();
- int i = 5;
-
- if (itemstack != null) {
- i += itemstack.a((Entity) this);
- }
-
- return i;
+ return groupdataentity;
}
}
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 7de5b48b..094da966 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -23,7 +23,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
public class EntityPlayer extends EntityHuman implements ICrafting {
- private LocaleLanguage locale = new LocaleLanguage("en_US");
+ private String locale = "en_US";
public PlayerConnection playerConnection;
public MinecraftServer server;
public PlayerInteractManager playerInteractManager;
@@ -31,18 +31,19 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public double e;
public final List chunkCoordIntPairQueue = new LinkedList();
public final List removeQueue = new LinkedList();
- private int cm = -99999999;
- private int cn = -99999999;
- private boolean co = true;
+ private float bO = Float.MIN_VALUE;
+ private float bP = -1.0E8F;
+ private int bQ = -99999999;
+ private boolean bR = true;
public int lastSentExp = -99999999; // CraftBukkit - private -> public
public int invulnerableTicks = 60; // CraftBukkit - private -> public
- private int cr = 0;
- private int cs = 0;
- private boolean ct = true;
- private int containerCounter = 0;
+ private int bU;
+ private int bV;
+ private boolean bW = true;
+ private int containerCounter;
public boolean h;
public int ping;
- public boolean viewingCredits = false;
+ public boolean viewingCredits;
// CraftBukkit start
public String displayName;
public String listName;
@@ -54,16 +55,16 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, PlayerInteractManager playerinteractmanager) {
- super(world);
+ super(world, s);
playerinteractmanager.player = this;
this.playerInteractManager = playerinteractmanager;
- this.cr = minecraftserver.getPlayerList().o();
+ this.bU = minecraftserver.getPlayerList().o();
ChunkCoordinates chunkcoordinates = world.getSpawn();
int i = chunkcoordinates.x;
int j = chunkcoordinates.z;
int k = chunkcoordinates.y;
- if (!world.worldProvider.f && world.getWorldData().getGameType() != EnumGamemode.ADVENTURE) {
+ if (!world.worldProvider.g && world.getWorldData().getGameType() != EnumGamemode.ADVENTURE) {
int l = Math.max(5, minecraftserver.getSpawnProtection() - 6);
i += this.random.nextInt(l * 2) - l;
@@ -73,7 +74,6 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.server = minecraftserver;
this.Y = 0.0F;
- this.name = s;
this.height = 0.0F;
this.setPositionRotation((double) i + 0.5D, (double) k, (double) j + 0.5D, 0.0F, 0.0F);
@@ -84,7 +84,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit start
this.displayName = this.name;
this.listName = this.name;
- this.canPickUpLoot = true;
+ // this.canPickUpLoot = true; TODO
// CraftBukkit end
}
@@ -140,7 +140,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.activeContainer.addSlotListener(this);
}
- protected void e_() {
+ protected void d_() {
this.height = 0.0F;
}
@@ -152,6 +152,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.playerInteractManager.a();
--this.invulnerableTicks;
this.activeContainer.b();
+ if (!this.world.isStatic && !this.activeContainer.a((EntityHuman) this)) {
+ this.closeInventory();
+ this.activeContainer = this.defaultContainer;
+ }
// CraftBukkit start - Check inventory status every tick
if (!this.activeContainer.a(this)) { // Should be stillValid
@@ -207,19 +211,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
while (iterator2.hasNext()) {
Chunk chunk = (Chunk) iterator2.next();
- this.o().getTracker().a(this, chunk);
+ this.p().getTracker().a(this, chunk);
}
}
}
}
- public void setHealth(int i) {
- super.setHealth(i);
- // CraftBukkit - Update ALL the scores!
- this.world.getServer().getScoreboardManager().updateAllScoresForList(IScoreboardCriteria.f, this.getLocalizedName(), com.google.common.collect.ImmutableList.of(this));
- }
-
- public void g() {
+ public void h() {
try {
super.l_();
@@ -235,12 +233,18 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- if (this.getHealth() != this.cm || this.cn != this.foodData.a() || this.foodData.e() == 0.0F != this.co) {
+ if (this.getHealth() != this.bP || this.bQ != this.foodData.a() || this.foodData.e() == 0.0F != this.bR) {
// 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;
+ this.bP = this.getHealth();
+ this.bQ = this.foodData.a();
+ this.bR = this.foodData.e() == 0.0F;
+ }
+
+ if (this.getHealth() + this.bj() != this.bO) {
+ this.bO = this.getHealth() + this.bj();
+ // CraftBukkit - Update ALL the scores!
+ this.world.getServer().getScoreboardManager().updateAllScoresForList(IScoreboardCriteria.f, this.getLocalizedName(), com.google.common.collect.ImmutableList.of(this));
}
if (this.expTotal != this.lastSentExp) {
@@ -290,12 +294,19 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, this.bt.b());
+ ChatMessage chatmessage = this.aN().b();
+
+ String deathmessage = chatmessage.toString();
+ org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage);
String deathMessage = event.getDeathMessage();
if (deathMessage != null && deathMessage.length() > 0) {
- this.server.getPlayerList().k(event.getDeathMessage());
+ if (deathMessage.equals(chatmessage.toString())) {
+ this.server.getPlayerList().sendMessage(chatmessage);
+ } else {
+ this.server.getPlayerList().sendMessage(ChatMessage.d(event.getDeathMessage()));
+ }
}
// CraftBukkit - we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory.
@@ -322,19 +333,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
scoreboardscore.incrementScore();
}
- EntityLiving entityliving = this.bN();
+ EntityLiving entityliving = this.aO();
if (entityliving != null) {
- entityliving.c(this, this.aM);
+ entityliving.b(this, this.bb);
}
+
+ this.a(StatisticList.y, 1);
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else {
// CraftBukkit - this.server.getPvP() -> this.world.pvpMode
- boolean flag = this.server.T() && this.world.pvpMode && "fall".equals(damagesource.translationIndex);
+ boolean flag = this.server.V() && this.world.pvpMode && "fall".equals(damagesource.translationIndex);
if (!flag && this.invulnerableTicks > 0 && damagesource != DamageSource.OUT_OF_WORLD) {
return false;
@@ -355,7 +368,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- return super.damageEntity(damagesource, i);
+ return super.damageEntity(damagesource, f);
}
}
}
@@ -365,14 +378,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
return !this.world.pvpMode ? false : super.a(entityhuman);
}
- public void c(int i) {
+ public void b(int i) {
if (this.dimension == 1 && i == 1) {
this.a((Statistic) AchievementList.C);
this.world.kill(this);
this.viewingCredits = true;
this.playerConnection.sendPacket(new Packet70Bed(4, 0));
} else {
- if (this.dimension == 1 && i == 0) {
+ if (this.dimension == 0 && i == 1) {
this.a((Statistic) AchievementList.B);
// CraftBukkit start - Rely on custom portal management
/*
@@ -394,8 +407,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.server.getPlayerList().changeDimension(this, i, cause);
// CraftBukkit end
this.lastSentExp = -1;
- this.cm = -1;
- this.cn = -1;
+ this.bP = -1.0F;
+ this.bQ = -1;
}
}
@@ -420,7 +433,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
if (enumbedresult == EnumBedResult.OK) {
Packet17EntityLocationAction packet17entitylocationaction = new Packet17EntityLocationAction(this, 0, i, j, k);
- this.o().getTracker().a((Entity) this, (Packet) packet17entitylocationaction);
+ this.p().getTracker().a((Entity) this, (Packet) packet17entitylocationaction);
this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
this.playerConnection.sendPacket(packet17entitylocationaction);
}
@@ -432,7 +445,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.o().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 3));
+ this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 3));
}
super.a(flag, flag1, flag2);
@@ -453,7 +466,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
super.setPassengerOf(entity);
// CraftBukkit end
- this.playerConnection.sendPacket(new Packet39AttachEntity(this, this.vehicle));
+ this.playerConnection.sendPacket(new Packet39AttachEntity(0, this, this.vehicle));
this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch);
}
@@ -631,6 +644,23 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
+ public void openHorseInventory(EntityHorse entityhorse, IInventory iinventory) {
+ // CraftBukkit start - Inventory open hook
+ Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHorse(this.inventory, iinventory, entityhorse));
+ if(container == null) return;
+ // CraftBukkit end
+
+ if (this.activeContainer != this.defaultContainer) {
+ this.closeInventory();
+ }
+
+ this.nextContainerCounter();
+ this.playerConnection.sendPacket(new Packet100OpenWindow(this.containerCounter, 11, iinventory.getName(), iinventory.getSize(), iinventory.c(), entityhorse.id));
+ this.activeContainer = container; // CraftBukkit - Use container we passed to event
+ this.activeContainer.windowId = this.containerCounter;
+ this.activeContainer.addSlotListener(this);
+ }
+
public void a(Container container, int i, ItemStack itemstack) {
if (!(container.getSlot(i) instanceof SlotResult)) {
if (!this.h) {
@@ -660,7 +690,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void closeInventory() {
CraftEventFactory.handleInventoryCloseEvent(this); // CraftBukkit
this.playerConnection.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId));
- this.j();
+ this.k();
}
public void broadcastCarriedItem() {
@@ -669,25 +699,35 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- public void j() {
+ public void k() {
this.activeContainer.b((EntityHuman) this);
this.activeContainer = this.defaultContainer;
}
+ public void a(float f, float f1, boolean flag, boolean flag1) {
+ if (this.vehicle != null) {
+ if (f >= -1.0F && f <= 1.0F) {
+ this.be = f;
+ }
+
+ if (f1 >= -1.0F && f1 <= 1.0F) {
+ this.bf = f1;
+ }
+
+ this.bd = flag;
+ this.setSneaking(flag1);
+ }
+ }
+
public void a(Statistic statistic, int i) {
if (statistic != null) {
if (!statistic.f) {
- while (i > 100) {
- this.playerConnection.sendPacket(new Packet200Statistic(statistic.e, 100));
- i -= 100;
- }
-
this.playerConnection.sendPacket(new Packet200Statistic(statistic.e, i));
}
}
}
- public void k() {
+ public void l() {
if (this.passenger != null) {
this.passenger.mount(this);
}
@@ -698,34 +738,31 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void triggerHealthUpdate() {
- this.cm = -99999999;
+ this.bP = -1.0E8F;
this.lastSentExp = -1; // CraftBukkit - Added to reset
}
- public void b(String s) {
- LocaleLanguage localelanguage = LocaleLanguage.a();
- String s1 = localelanguage.a(s);
-
- this.playerConnection.sendPacket(new Packet3Chat(s1));
+ public void a(String s) {
+ this.playerConnection.sendPacket(new Packet3Chat(ChatMessage.e(s)));
}
- protected void m() {
+ protected void n() {
this.playerConnection.sendPacket(new Packet38EntityStatus(this.id, (byte) 9));
- super.m();
+ super.n();
}
public void a(ItemStack itemstack, int i) {
super.a(itemstack, i);
- if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().b_(itemstack) == EnumAnimation.EAT) {
- this.o().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 5));
+ if (itemstack != null && itemstack.getItem() != null && itemstack.getItem().c_(itemstack) == EnumAnimation.EAT) {
+ this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(this, 5));
}
}
public void copyTo(EntityHuman entityhuman, boolean flag) {
super.copyTo(entityhuman, flag);
this.lastSentExp = -1;
- this.cm = -1;
- this.cn = -1;
+ this.bP = -1.0F;
+ this.bQ = -1;
this.removeQueue.addAll(((EntityPlayer) entityhuman).removeQueue);
}
@@ -749,11 +786,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void b(Entity entity) {
- this.o().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 6));
+ this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 6));
}
public void c(Entity entity) {
- this.o().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 7));
+ this.p().getTracker().sendPacketToEntity(this, new Packet18ArmAnimation(entity, 7));
}
public void updateAbilities() {
@@ -762,7 +799,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
}
- public WorldServer o() {
+ public WorldServer p() {
return (WorldServer) this.world;
}
@@ -771,15 +808,15 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.playerConnection.sendPacket(new Packet70Bed(3, enumgamemode.a()));
}
- public void sendMessage(String s) {
- this.playerConnection.sendPacket(new Packet3Chat(s));
+ public void sendMessage(ChatMessage chatmessage) {
+ this.playerConnection.sendPacket(new Packet3Chat(chatmessage));
}
public boolean a(int i, String s) {
- return "seed".equals(s) && !this.server.T() ? true : (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) ? this.server.getPlayerList().isOp(this.name) : true);
+ return "seed".equals(s) && !this.server.V() ? true : (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) ? (this.server.getPlayerList().isOp(this.name) ? this.server.k() >= i : false) : true);
}
- public String p() {
+ public String q() {
String s = this.playerConnection.networkManager.getSocketAddress().toString();
s = s.substring(s.indexOf("/") + 1);
@@ -788,31 +825,24 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
}
public void a(Packet204LocaleAndViewDistance packet204localeandviewdistance) {
- if (this.locale.b().containsKey(packet204localeandviewdistance.d())) {
- this.locale.a(packet204localeandviewdistance.d(), false);
- }
-
+ this.locale = packet204localeandviewdistance.d();
int i = 256 >> packet204localeandviewdistance.f();
if (i > 3 && i < 15) {
- this.cr = i;
+ this.bU = i;
}
- this.cs = packet204localeandviewdistance.g();
- this.ct = packet204localeandviewdistance.h();
- if (this.server.I() && this.server.H().equals(this.name)) {
+ this.bV = packet204localeandviewdistance.g();
+ this.bW = packet204localeandviewdistance.h();
+ if (this.server.K() && this.server.J().equals(this.name)) {
this.server.c(packet204localeandviewdistance.i());
}
this.b(1, !packet204localeandviewdistance.j());
}
- public LocaleLanguage getLocale() {
- return this.locale;
- }
-
public int getChatFlags() {
- return this.cs;
+ return this.bV;
}
public void a(String s, int i) {
@@ -859,7 +889,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void resetPlayerWeather() {
this.weather = null;
- this.setPlayerWeather(this.o().getWorldData().hasStorm() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false);
+ this.setPlayerWeather(this.world.getWorldData().hasStorm() ? WeatherType.DOWNFALL : WeatherType.CLEAR, false);
}
@Override
@@ -877,7 +907,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.newLevel = this.expLevel;
}
- this.health = this.maxHealth;
+ this.setHealth(this.maxHealth);
this.fireTicks = 0;
this.fallDistance = 0;
this.foodData = new FoodMetaData();
@@ -890,7 +920,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.activeContainer = this.defaultContainer;
this.killer = null;
this.lastDamager = null;
- this.bt = new CombatTracker(this); // Should be combatTracker
+ this.combatTracker = new CombatTracker(this);
this.lastSentExp = -1;
if (this.keepLevel || keepInventory) {
this.exp = exp;
diff --git a/src/main/java/net/minecraft/server/EntityPotion.java b/src/main/java/net/minecraft/server/EntityPotion.java
index be9e339c..a4330c74 100644
--- a/src/main/java/net/minecraft/server/EntityPotion.java
+++ b/src/main/java/net/minecraft/server/EntityPotion.java
@@ -32,7 +32,7 @@ public class EntityPotion extends EntityProjectile {
this.c = itemstack;
}
- protected float g() {
+ protected float e() {
return 0.05F;
}
diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java
index 2ab11b3c..688c4d80 100644
--- a/src/main/java/net/minecraft/server/EntityProjectile.java
+++ b/src/main/java/net/minecraft/server/EntityProjectile.java
@@ -7,13 +7,13 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
private int blockX = -1;
private int blockY = -1;
private int blockZ = -1;
- private int inBlockId = 0;
- protected boolean inGround = false;
- public int shake = 0;
+ private int inBlockId;
+ protected boolean inGround;
+ public int shake;
public EntityLiving shooter; // CraftBukkit - private -> public
- public String shooterName = null; // CraftBukkit - private -> public
+ public String shooterName; // CraftBukkit - private -> public
private int i;
- private int j = 0;
+ private int j;
public EntityProjectile(World world) {
super(world);
@@ -188,7 +188,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
this.pitch = this.lastPitch + (this.pitch - this.lastPitch) * 0.2F;
this.yaw = this.lastYaw + (this.yaw - this.lastYaw) * 0.2F;
float f2 = 0.99F;
- float f3 = this.g();
+ float f3 = this.e();
if (this.G()) {
for (int k = 0; k < 4; ++k) {
@@ -207,7 +207,7 @@ public abstract class EntityProjectile extends Entity implements IProjectile {
this.setPosition(this.locX, this.locY, this.locZ);
}
- protected float g() {
+ protected float e() {
return 0.03F;
}
diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java
index a1f0fcb4..7bf82d9b 100644
--- a/src/main/java/net/minecraft/server/EntitySheep.java
+++ b/src/main/java/net/minecraft/server/EntitySheep.java
@@ -9,51 +9,50 @@ import org.bukkit.event.player.PlayerShearEntityEvent;
public class EntitySheep extends EntityAnimal {
- private final InventoryCrafting e = new InventoryCrafting(new ContainerSheepBreed(this), 2, 1);
- public static final float[][] d = new float[][] { { 1.0F, 1.0F, 1.0F}, { 0.85F, 0.5F, 0.2F}, { 0.7F, 0.3F, 0.85F}, { 0.4F, 0.6F, 0.85F}, { 0.9F, 0.9F, 0.2F}, { 0.5F, 0.8F, 0.1F}, { 0.95F, 0.5F, 0.65F}, { 0.3F, 0.3F, 0.3F}, { 0.6F, 0.6F, 0.6F}, { 0.3F, 0.5F, 0.6F}, { 0.5F, 0.25F, 0.7F}, { 0.2F, 0.3F, 0.7F}, { 0.4F, 0.3F, 0.2F}, { 0.4F, 0.5F, 0.2F}, { 0.6F, 0.2F, 0.2F}, { 0.1F, 0.1F, 0.1F}};
- private int f;
- private PathfinderGoalEatTile g = new PathfinderGoalEatTile(this);
+ private final InventoryCrafting bq = new InventoryCrafting(new ContainerSheepBreed(this), 2, 1);
+ public static final float[][] bp = new float[][] { { 1.0F, 1.0F, 1.0F}, { 0.85F, 0.5F, 0.2F}, { 0.7F, 0.3F, 0.85F}, { 0.4F, 0.6F, 0.85F}, { 0.9F, 0.9F, 0.2F}, { 0.5F, 0.8F, 0.1F}, { 0.95F, 0.5F, 0.65F}, { 0.3F, 0.3F, 0.3F}, { 0.6F, 0.6F, 0.6F}, { 0.3F, 0.5F, 0.6F}, { 0.5F, 0.25F, 0.7F}, { 0.2F, 0.3F, 0.7F}, { 0.4F, 0.3F, 0.2F}, { 0.4F, 0.5F, 0.2F}, { 0.6F, 0.2F, 0.2F}, { 0.1F, 0.1F, 0.1F}};
+ private int br;
+ private PathfinderGoalEatTile bs = new PathfinderGoalEatTile(this);
public EntitySheep(World world) {
super(world);
- this.texture = "/mob/sheep.png";
this.a(0.9F, 1.3F);
- float f = 0.23F;
-
this.getNavigation().a(true);
this.goalSelector.a(0, new PathfinderGoalFloat(this));
- this.goalSelector.a(1, new PathfinderGoalPanic(this, 0.38F));
- this.goalSelector.a(2, new PathfinderGoalBreed(this, f));
- this.goalSelector.a(3, new PathfinderGoalTempt(this, 0.25F, Item.WHEAT.id, false));
- this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 0.25F));
- this.goalSelector.a(5, this.g);
- this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, f));
+ this.goalSelector.a(1, new PathfinderGoalPanic(this, 1.25D));
+ this.goalSelector.a(2, new PathfinderGoalBreed(this, 1.0D));
+ this.goalSelector.a(3, new PathfinderGoalTempt(this, 1.1D, Item.WHEAT.id, false));
+ this.goalSelector.a(4, new PathfinderGoalFollowParent(this, 1.1D));
+ this.goalSelector.a(5, this.bs);
+ this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, 1.0D));
this.goalSelector.a(7, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this));
- this.e.setItem(0, new ItemStack(Item.INK_SACK, 1, 0));
- this.e.setItem(1, new ItemStack(Item.INK_SACK, 1, 0));
- this.e.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event
+ this.bq.setItem(0, new ItemStack(Item.INK_SACK, 1, 0));
+ this.bq.setItem(1, new ItemStack(Item.INK_SACK, 1, 0));
+ this.bq.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event
}
- protected boolean bh() {
+ protected boolean bb() {
return true;
}
- protected void bo() {
- this.f = this.g.f();
- super.bo();
+ protected void be() {
+ this.br = this.bs.f();
+ super.be();
}
public void c() {
if (this.world.isStatic) {
- this.f = Math.max(0, this.f - 1);
+ this.br = Math.max(0, this.br - 1);
}
super.c();
}
- public int getMaxHealth() {
- return 8;
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.a).a(8.0D);
+ this.a(GenericAttributes.d).a(0.23000000417232513D);
}
protected void a() {
@@ -77,7 +76,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 +106,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 +121,15 @@ public class EntitySheep extends EntityAnimal {
this.setColor(nbttagcompound.getByte("Color"));
}
- protected String bb() {
+ protected String r() {
return "mob.sheep.say";
}
- protected String bc() {
+ protected String aK() {
return "mob.sheep.say";
}
- protected String bd() {
+ protected String aL() {
return "mob.sheep.say";
}
@@ -177,7 +176,7 @@ public class EntitySheep extends EntityAnimal {
return entitysheep1;
}
- public void aK() {
+ public void n() {
// CraftBukkit start
SheepRegrowWoolEvent event = new SheepRegrowWoolEvent((org.bukkit.entity.Sheep) this.getBukkitEntity());
this.world.getServer().getPluginManager().callEvent(event);
@@ -188,27 +187,23 @@ public class EntitySheep extends EntityAnimal {
// CraftBukkit end
if (this.isBaby()) {
- int i = this.getAge() + 1200;
-
- if (i > 0) {
- i = 0;
- }
-
- this.setAge(i);
+ this.a(60);
}
}
- public void bJ() {
+ public GroupDataEntity a(GroupDataEntity groupdataentity) {
+ groupdataentity = super.a(groupdataentity);
this.setColor(a(this.world.random));
+ return groupdataentity;
}
private int a(EntityAnimal entityanimal, EntityAnimal entityanimal1) {
int i = this.b(entityanimal);
int j = this.b(entityanimal1);
- this.e.getItem(0).setData(i);
- this.e.getItem(1).setData(j);
- ItemStack itemstack = CraftingManager.getInstance().craft(this.e, ((EntitySheep) entityanimal).world);
+ this.bq.getItem(0).setData(i);
+ this.bq.getItem(1).setData(j);
+ ItemStack itemstack = CraftingManager.getInstance().craft(this.bq, ((EntitySheep) entityanimal).world);
int k;
if (itemstack != null && itemstack.getItem().id == Item.INK_SACK.id) {
diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java
index 4ea06d0a..fe212d4a 100644
--- a/src/main/java/net/minecraft/server/EntitySilverfish.java
+++ b/src/main/java/net/minecraft/server/EntitySilverfish.java
@@ -4,20 +4,21 @@ import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit
public class EntitySilverfish extends EntityMonster {
- private int d;
+ private int bp;
public EntitySilverfish(World world) {
super(world);
- this.texture = "/mob/silverfish.png";
this.a(0.3F, 0.7F);
- this.bI = 0.6F;
}
- public int getMaxHealth() {
- return 8;
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.a).a(8.0D);
+ this.a(GenericAttributes.d).a(0.6000000238418579D);
+ this.a(GenericAttributes.e).a(1.0D);
}
- protected boolean f_() {
+ protected boolean e_() {
return false;
}
@@ -27,27 +28,27 @@ public class EntitySilverfish extends EntityMonster {
return this.world.findNearbyVulnerablePlayer(this, d0);
}
- protected String bb() {
+ protected String r() {
return "mob.silverfish.say";
}
- protected String bc() {
+ protected String aK() {
return "mob.silverfish.hit";
}
- protected String bd() {
+ protected String aL() {
return "mob.silverfish.kill";
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else {
- if (this.d <= 0 && (damagesource instanceof EntityDamageSource || damagesource == DamageSource.MAGIC)) {
- this.d = 20;
+ if (this.bp <= 0 && (damagesource instanceof EntityDamageSource || damagesource == DamageSource.MAGIC)) {
+ this.bp = 20;
}
- return super.damageEntity(damagesource, i);
+ return super.damageEntity(damagesource, f);
}
}
@@ -67,21 +68,21 @@ public class EntitySilverfish extends EntityMonster {
}
public void l_() {
- this.ay = this.yaw;
+ this.aN = this.yaw;
super.l_();
}
- protected void bq() {
- super.bq();
+ protected void bh() {
+ super.bh();
if (!this.world.isStatic) {
int i;
int j;
int k;
int l;
- if (this.d > 0) {
- --this.d;
- if (this.d == 0) {
+ if (this.bp > 0) {
+ --this.bp;
+ if (this.bp == 0) {
i = MathHelper.floor(this.locX);
j = MathHelper.floor(this.locY);
k = MathHelper.floor(this.locZ);
@@ -99,7 +100,23 @@ public class EntitySilverfish extends EntityMonster {
}
// CraftBukkit end
- this.world.setAir(i + i1, j + l, k + j1, false);
+ if (!this.world.getGameRules().getBoolean("mobGriefing")) {
+ int l1 = this.world.getData(i + i1, j + l, k + j1);
+ Block block = Block.STONE;
+
+ if (l1 == 1) {
+ block = Block.COBBLESTONE;
+ }
+
+ if (l1 == 2) {
+ block = Block.SMOOTH_BRICK;
+ }
+
+ this.world.setTypeIdAndData(i + i1, j + l, k + j1, block.id, 0, 3);
+ } else {
+ 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;
@@ -112,27 +129,27 @@ public class EntitySilverfish extends EntityMonster {
}
}
- if (this.target == null && !this.k()) {
+ if (this.target == null && !this.bI()) {
i = MathHelper.floor(this.locX);
j = MathHelper.floor(this.locY + 0.5D);
k = MathHelper.floor(this.locZ);
- int l1 = this.random.nextInt(6);
+ int i2 = this.random.nextInt(6);
- l = this.world.getTypeId(i + Facing.b[l1], j + Facing.c[l1], k + Facing.d[l1]);
+ l = this.world.getTypeId(i + Facing.b[i2], j + Facing.c[i2], k + Facing.d[i2]);
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.e(l)).isCancelled()) {
+ if (CraftEventFactory.callEntityChangeBlockEvent(this, i + Facing.b[i2], j + Facing.c[i2], k + Facing.d[i2], 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.e(l), 3);
- this.aU();
+ this.world.setTypeIdAndData(i + Facing.b[i2], j + Facing.c[i2], k + Facing.d[i2], Block.MONSTER_EGGS.id, BlockMonsterEggs.e(l), 3);
+ this.q();
this.die();
} else {
- this.i();
+ this.bG();
}
- } else if (this.target != null && !this.k()) {
+ } else if (this.target != null && !this.bI()) {
this.target = null;
}
}
@@ -156,10 +173,6 @@ public class EntitySilverfish extends EntityMonster {
}
}
- public int c(Entity entity) {
- return 1;
- }
-
public EnumMonsterType getMonsterType() {
return EnumMonsterType.ARTHROPOD;
}
diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java
index 94946271..e5db8a1c 100644
--- a/src/main/java/net/minecraft/server/EntitySkeleton.java
+++ b/src/main/java/net/minecraft/server/EntitySkeleton.java
@@ -6,48 +6,47 @@ import org.bukkit.event.entity.EntityCombustEvent; // CraftBukkit
public class EntitySkeleton extends EntityMonster implements IRangedEntity {
- private PathfinderGoalArrowAttack d = new PathfinderGoalArrowAttack(this, 0.25F, 20, 60, 15.0F);
- private PathfinderGoalMeleeAttack e = new PathfinderGoalMeleeAttack(this, EntityHuman.class, 0.31F, false);
+ private PathfinderGoalArrowAttack bp = new PathfinderGoalArrowAttack(this, 1.0D, 20, 60, 15.0F);
+ private PathfinderGoalMeleeAttack bq = new PathfinderGoalMeleeAttack(this, EntityHuman.class, 1.2D, false);
public EntitySkeleton(World world) {
super(world);
- this.texture = "/mob/skeleton.png";
- 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.bI));
- this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bI));
+ this.goalSelector.a(3, new PathfinderGoalFleeSun(this, 1.0D));
+ this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 1.0D));
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));
- this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 16.0F, 0, true));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, true));
if (world != null && !world.isStatic) {
- this.m();
+ this.bP();
}
}
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.d).a(0.25D);
+ }
+
protected void a() {
super.a();
this.datawatcher.a(13, new Byte((byte) 0));
}
- public boolean bh() {
+ public boolean bb() {
return true;
}
- public int getMaxHealth() {
- return 20;
- }
-
- protected String bb() {
+ protected String r() {
return "mob.skeleton.say";
}
- protected String bc() {
+ protected String aK() {
return "mob.skeleton.hurt";
}
- protected String bd() {
+ protected String aL() {
return "mob.skeleton.death";
}
@@ -67,28 +66,13 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
}
}
- public int c(Entity entity) {
- if (this.getSkeletonType() == 1) {
- ItemStack itemstack = this.bG();
- int i = 4;
-
- if (itemstack != null) {
- i += itemstack.a((Entity) this);
- }
-
- return i;
- } else {
- return super.c(entity);
- }
- }
-
public EnumMonsterType getMonsterType() {
return EnumMonsterType.UNDEAD;
}
public void c() {
if (this.world.v() && !this.world.isStatic) {
- float f = this.c(1.0F);
+ float f = this.d(1.0F);
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;
@@ -108,13 +92,13 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
if (flag) {
// CraftBukkit start
- EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
- this.world.getServer().getPluginManager().callEvent(event);
+ EntityCombustEvent event = new EntityCombustEvent(this.getBukkitEntity(), 8);
+ this.world.getServer().getPluginManager().callEvent(event);
- if (!event.isCancelled()) {
- this.setOnFire(event.getDuration());
- }
- // CraftBukkit end
+ if (!event.isCancelled()) {
+ this.setOnFire(event.getDuration());
+ }
+ // CraftBukkit end
}
}
}
@@ -126,6 +110,15 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
super.c();
}
+ public void T() {
+ super.T();
+ if (this.vehicle instanceof EntityCreature) {
+ EntityCreature entitycreature = (EntityCreature) this.vehicle;
+
+ this.aN = entitycreature.aN;
+ }
+ }
+
public void die(DamageSource damagesource) {
super.die(damagesource);
if (damagesource.h() instanceof EntityArrow && damagesource.getEntity() instanceof EntityHuman) {
@@ -186,52 +179,56 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
return new ItemStack(Item.SKULL.id, 1, 1); // CraftBukkit
}
- return null;
+ return null; // CraftBukkit
}
- protected void bH() {
- super.bH();
+ protected void bs() {
+ super.bs();
this.setEquipment(0, new ItemStack(Item.BOW));
}
- public void bJ() {
- if (this.world.worldProvider instanceof WorldProviderHell && this.aE().nextInt(5) > 0) {
- this.goalSelector.a(4, this.e);
+ public GroupDataEntity a(GroupDataEntity groupdataentity) {
+ groupdataentity = super.a(groupdataentity);
+ if (this.world.worldProvider instanceof WorldProviderHell && this.aB().nextInt(5) > 0) {
+ this.goalSelector.a(4, this.bq);
this.setSkeletonType(1);
this.setEquipment(0, new ItemStack(Item.STONE_SWORD));
+ this.a(GenericAttributes.e).a(4.0D);
} else {
- this.goalSelector.a(4, this.d);
- this.bH();
- this.bI();
+ this.goalSelector.a(4, this.bp);
+ this.bs();
+ this.bt();
}
- this.h(this.random.nextFloat() < au[this.world.difficulty]);
+ this.h(this.random.nextFloat() < 0.55F * this.world.b(this.locX, this.locY, this.locZ));
if (this.getEquipment(4) == null) {
- Calendar calendar = this.world.V();
+ Calendar calendar = this.world.W();
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));
this.dropChances[4] = 0.0F;
}
}
+
+ return groupdataentity;
}
- public void m() {
- this.goalSelector.a((PathfinderGoal) this.e);
- this.goalSelector.a((PathfinderGoal) this.d);
- ItemStack itemstack = this.bG();
+ public void bP() {
+ this.goalSelector.a((PathfinderGoal) this.bq);
+ this.goalSelector.a((PathfinderGoal) this.bp);
+ ItemStack itemstack = this.aV();
if (itemstack != null && itemstack.id == Item.BOW.id) {
- this.goalSelector.a(4, this.d);
+ this.goalSelector.a(4, this.bp);
} else {
- this.goalSelector.a(4, this.e);
+ this.goalSelector.a(4, this.bq);
}
}
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());
+ int i = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_DAMAGE.id, this.aV());
+ int j = EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_KNOCKBACK.id, this.aV());
entityarrow.b((double) (f * 2.0F) + this.random.nextGaussian() * 0.25D + (double) ((float) this.world.difficulty * 0.11F));
if (i > 0) {
@@ -242,11 +239,11 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
entityarrow.a(j);
}
- if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bG()) > 0 || this.getSkeletonType() == 1) {
+ if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.aV()) > 0 || this.getSkeletonType() == 1) {
entityarrow.setOnFire(100);
}
- this.makeSound("random.bow", 1.0F, 1.0F / (this.aE().nextFloat() * 0.4F + 0.8F));
+ this.makeSound("random.bow", 1.0F, 1.0F / (this.aB().nextFloat() * 0.4F + 0.8F));
this.world.addEntity(entityarrow);
}
@@ -272,7 +269,7 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
this.setSkeletonType(b0);
}
- this.m();
+ this.bP();
}
public void b(NBTTagCompound nbttagcompound) {
@@ -283,7 +280,11 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity {
public void setEquipment(int i, ItemStack itemstack) {
super.setEquipment(i, itemstack);
if (!this.world.isStatic && i == 0) {
- this.m();
+ this.bP();
}
}
+
+ public double V() {
+ return super.V() - 0.5D;
+ }
}
diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java
index f6a0c9e6..6789d2fb 100644
--- a/src/main/java/net/minecraft/server/EntitySlime.java
+++ b/src/main/java/net/minecraft/server/EntitySlime.java
@@ -4,21 +4,19 @@ package net.minecraft.server;
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.entity.EntityTargetEvent;
-import org.bukkit.event.entity.SlimeSplitEvent;
+import org.bukkit.event.entity.SlimeSplitEvent;
// CraftBukkit end
-public class EntitySlime extends EntityLiving implements IMonster {
+public class EntitySlime extends EntityInsentient 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;
- private int jumpDelay = 0;
+ public float h;
+ public float i;
+ public float j;
+ private int jumpDelay;
private Entity lastTarget; // CraftBukkit
public EntitySlime(World world) {
super(world);
- this.texture = "/mob/slime.png";
int i = 1 << this.random.nextInt(3);
this.height = 0.0F;
@@ -37,19 +35,14 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.datawatcher.watch(16, new Byte((byte) i));
this.a(0.6F * (float) i, 0.6F * (float) i);
this.setPosition(this.locX, this.locY, this.locZ);
+ this.a(GenericAttributes.a).a((double) (i * i));
// CraftBukkit start
if (updateMaxHealth) {
this.maxHealth = this.getMaxHealth();
}
this.setHealth(this.maxHealth);
// CraftBukkit end
- this.be = i;
- }
-
- public int getMaxHealth() {
- int i = this.getSize();
-
- return i * i;
+ this.b = i;
}
public int getSize() {
@@ -66,11 +59,11 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.setSize(nbttagcompound.getInt("Size") + 1);
}
- protected String h() {
+ protected String bF() {
return "slime";
}
- protected String n() {
+ protected String bL() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
@@ -79,8 +72,8 @@ public class EntitySlime extends EntityLiving implements IMonster {
this.dead = true;
}
- this.c += (this.b - this.c) * 0.5F;
- this.d = this.c;
+ this.i += (this.h - this.i) * 0.5F;
+ this.j = this.i;
boolean flag = this.onGround;
super.l_();
@@ -95,27 +88,27 @@ public class EntitySlime extends EntityLiving implements IMonster {
float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1;
float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1;
- this.world.addParticle(this.h(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D);
+ this.world.addParticle(this.bF(), this.locX + (double) f2, this.boundingBox.b, this.locZ + (double) f3, 0.0D, 0.0D, 0.0D);
}
- if (this.o()) {
- this.makeSound(this.n(), this.ba(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
+ if (this.bM()) {
+ this.makeSound(this.bL(), this.aW(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) / 0.8F);
}
- this.b = -0.5F;
+ this.h = -0.5F;
} else if (!this.onGround && flag) {
- this.b = 1.0F;
+ this.h = 1.0F;
}
- this.k();
+ this.bI();
if (this.world.isStatic) {
i = this.getSize();
this.a(0.6F * (float) i, 0.6F * (float) i);
}
}
- protected void bq() {
- this.bn();
+ protected void bh() {
+ this.bk();
// CraftBukkit start
Entity entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D); // EntityHuman -> Entity
EntityTargetEvent event = null;
@@ -138,42 +131,42 @@ public class EntitySlime extends EntityLiving implements IMonster {
}
if (this.onGround && this.jumpDelay-- <= 0) {
- this.jumpDelay = this.j();
+ this.jumpDelay = this.bH();
if (entityhuman != null) {
this.jumpDelay /= 3;
}
- this.bG = true;
- if (this.q()) {
- this.makeSound(this.n(), this.ba(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
+ this.bd = true;
+ if (this.bO()) {
+ this.makeSound(this.bL(), this.aW(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
}
- this.bD = 1.0F - this.random.nextFloat() * 2.0F;
- this.bE = (float) (1 * this.getSize());
+ this.be = 1.0F - this.random.nextFloat() * 2.0F;
+ this.bf = (float) (1 * this.getSize());
} else {
- this.bG = false;
+ this.bd = false;
if (this.onGround) {
- this.bD = this.bE = 0.0F;
+ this.be = this.bf = 0.0F;
}
}
}
- protected void k() {
- this.b *= 0.6F;
+ protected void bI() {
+ this.h *= 0.6F;
}
- protected int j() {
+ protected int bH() {
return this.random.nextInt(20) + 10;
}
- protected EntitySlime i() {
+ protected EntitySlime bG() {
return new EntitySlime(this.world);
}
public void die() {
int i = this.getSize();
- if (!this.world.isStatic && i > 1 && this.getHealth() <= 0) {
+ if (!this.world.isStatic && i > 1 && this.getHealth() <= 0.0F) {
int j = 2 + this.random.nextInt(3);
// CraftBukkit start
@@ -191,7 +184,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
for (int k = 0; k < j; ++k) {
float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F;
float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F;
- EntitySlime entityslime = this.i();
+ EntitySlime entityslime = this.bG();
entityslime.setSize(i / 2);
entityslime.setPositionRotation(this.locX + (double) f, this.locY + 0.5D, this.locZ + (double) f1, this.random.nextFloat() * 360.0F, 0.0F);
@@ -203,28 +196,28 @@ public class EntitySlime extends EntityLiving implements IMonster {
}
public void b_(EntityHuman entityhuman) {
- if (this.l()) {
+ if (this.bJ()) {
int i = this.getSize();
- if (this.n(entityhuman) && this.e(entityhuman) < 0.6D * (double) i * 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), this.m())) {
+ if (this.o(entityhuman) && this.e(entityhuman) < 0.6D * (double) i * 0.6D * (double) i && entityhuman.damageEntity(DamageSource.mobAttack(this), (float) this.bK())) {
this.makeSound("mob.attack", 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
}
}
- protected boolean l() {
+ protected boolean bJ() {
return this.getSize() > 1;
}
- protected int m() {
+ protected int bK() {
return this.getSize();
}
- protected String bc() {
+ protected String aK() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
- protected String bd() {
+ protected String aL() {
return "mob.slime." + (this.getSize() > 1 ? "big" : "small");
}
@@ -241,7 +234,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
if (this.getSize() == 1 || this.world.difficulty > 0) {
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.w()] && this.world.getLightLevel(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) <= this.random.nextInt(8)) {
+ if (biomebase == BiomeBase.SWAMPLAND && this.locY > 50.0D && this.locY < 70.0D && this.random.nextFloat() < 0.5F && this.random.nextFloat() < this.world.x() && this.world.getLightLevel(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) <= this.random.nextInt(8)) {
return super.canSpawn();
}
@@ -254,19 +247,19 @@ public class EntitySlime extends EntityLiving implements IMonster {
}
}
- protected float ba() {
+ protected float aW() {
return 0.4F * (float) this.getSize();
}
- public int bs() {
+ public int bl() {
return 0;
}
- protected boolean q() {
+ protected boolean bO() {
return this.getSize() > 0;
}
- protected boolean o() {
+ protected boolean bM() {
return this.getSize() > 2;
}
}
diff --git a/src/main/java/net/minecraft/server/EntitySmallFireball.java b/src/main/java/net/minecraft/server/EntitySmallFireball.java
index abc95ca2..68bd2123 100644
--- a/src/main/java/net/minecraft/server/EntitySmallFireball.java
+++ b/src/main/java/net/minecraft/server/EntitySmallFireball.java
@@ -22,7 +22,7 @@ public class EntitySmallFireball extends EntityFireball {
protected void a(MovingObjectPosition movingobjectposition) {
if (!this.world.isStatic) {
if (movingobjectposition.entity != null) {
- if (!movingobjectposition.entity.isFireproof() && movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5)) {
+ if (!movingobjectposition.entity.isFireproof() && movingobjectposition.entity.damageEntity(DamageSource.fireball(this, this.shooter), 5.0F)) {
// CraftBukkit start - Entity damage by entity event + combust event
EntityCombustByEntityEvent event = new EntityCombustByEntityEvent((org.bukkit.entity.Projectile) this.getBukkitEntity(), movingobjectposition.entity.getBukkitEntity(), 5);
movingobjectposition.entity.world.getServer().getPluginManager().callEvent(event);
@@ -79,7 +79,7 @@ public class EntitySmallFireball extends EntityFireball {
return false;
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
return false;
}
}
diff --git a/src/main/java/net/minecraft/server/EntitySnowman.java b/src/main/java/net/minecraft/server/EntitySnowman.java
index 8b9fb83c..6499a7bd 100644
--- a/src/main/java/net/minecraft/server/EntitySnowman.java
+++ b/src/main/java/net/minecraft/server/EntitySnowman.java
@@ -9,35 +9,36 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
public EntitySnowman(World world) {
super(world);
- this.texture = "/mob/snowman.png";
this.a(0.4F, 1.8F);
this.getNavigation().a(true);
- this.goalSelector.a(1, new PathfinderGoalArrowAttack(this, 0.25F, 20, 10.0F));
- this.goalSelector.a(2, new PathfinderGoalRandomStroll(this, 0.2F));
+ this.goalSelector.a(1, new PathfinderGoalArrowAttack(this, 1.25D, 20, 10.0F));
+ this.goalSelector.a(2, new PathfinderGoalRandomStroll(this, 1.0D));
this.goalSelector.a(3, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 6.0F));
this.goalSelector.a(4, new PathfinderGoalRandomLookaround(this));
- this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget(this, EntityLiving.class, 16.0F, 0, true, false, IMonster.a));
+ this.targetSelector.a(1, new PathfinderGoalNearestAttackableTarget(this, EntityInsentient.class, 0, true, false, IMonster.a));
}
- public boolean bh() {
+ public boolean bb() {
return true;
}
- public int getMaxHealth() {
- return 4;
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.a).a(4.0D);
+ this.a(GenericAttributes.d).a(0.20000000298023224D);
}
public void c() {
super.c();
if (this.F()) {
- this.damageEntity(DamageSource.DROWN, 1);
+ this.damageEntity(DamageSource.DROWN, 1.0F);
}
int i = MathHelper.floor(this.locX);
int j = MathHelper.floor(this.locZ);
if (this.world.getBiome(i, j).j() > 1.0F) {
- this.damageEntity(CraftEventFactory.MELTING, 1); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
+ this.damageEntity(CraftEventFactory.MELTING, 1.0F); // CraftBukkit - DamageSource.BURN -> CraftEventFactory.MELTING
}
for (i = 0; i < 4; ++i) {
@@ -86,7 +87,7 @@ public class EntitySnowman extends EntityGolem implements IRangedEntity {
float f1 = MathHelper.sqrt(d0 * d0 + d2 * d2) * 0.2F;
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.makeSound("random.bow", 1.0F, 1.0F / (this.aB().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 a7598034..061119fd 100644
--- a/src/main/java/net/minecraft/server/EntitySpider.java
+++ b/src/main/java/net/minecraft/server/EntitySpider.java
@@ -6,9 +6,7 @@ public class EntitySpider extends EntityMonster {
public EntitySpider(World world) {
super(world);
- this.texture = "/mob/spider.png";
this.a(1.4F, 0.9F);
- this.bI = 0.8F;
}
protected void a() {
@@ -23,16 +21,14 @@ public class EntitySpider extends EntityMonster {
}
}
- public int getMaxHealth() {
- return 16;
- }
-
- public double W() {
- return (double) this.length * 0.75D - 0.5D;
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.a).a(16.0D);
+ this.a(GenericAttributes.d).a(0.800000011920929D);
}
protected Entity findTarget() {
- float f = this.c(1.0F);
+ float f = this.d(1.0F);
if (f < 0.5F) {
double d0 = 16.0D;
@@ -43,15 +39,15 @@ public class EntitySpider extends EntityMonster {
}
}
- protected String bb() {
+ protected String r() {
return "mob.spider.say";
}
- protected String bc() {
+ protected String aK() {
return "mob.spider.say";
}
- protected String bd() {
+ protected String aL() {
return "mob.spider.death";
}
@@ -60,7 +56,7 @@ public class EntitySpider extends EntityMonster {
}
protected void a(Entity entity, float f) {
- float f1 = this.c(1.0F);
+ float f1 = this.d(1.0F);
if (f1 > 0.5F && this.random.nextInt(100) == 0) {
// CraftBukkit start
@@ -119,11 +115,11 @@ public class EntitySpider extends EntityMonster {
// CraftBukkit end
}
- public boolean g_() {
- return this.o();
+ public boolean e() {
+ return this.bP();
}
- public void al() {}
+ public void ak() {}
public EnumMonsterType getMonsterType() {
return EnumMonsterType.ARTHROPOD;
@@ -133,7 +129,7 @@ public class EntitySpider extends EntityMonster {
return mobeffect.getEffectId() == MobEffectList.POISON.id ? false : super.e(mobeffect);
}
- public boolean o() {
+ public boolean bP() {
return (this.datawatcher.getByte(16) & 1) != 0;
}
@@ -149,14 +145,33 @@ public class EntitySpider extends EntityMonster {
this.datawatcher.watch(16, Byte.valueOf(b0));
}
- public void bJ() {
+ public GroupDataEntity a(GroupDataEntity groupdataentity) {
+ Object object = super.a(groupdataentity);
+
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.bJ();
+ entityskeleton.a((GroupDataEntity) null);
this.world.addEntity(entityskeleton);
entityskeleton.mount(this);
}
+
+ if (object == null) {
+ object = new GroupDataSpider();
+ if (this.world.difficulty > 2 && this.world.random.nextFloat() < 0.1F * this.world.b(this.locX, this.locY, this.locZ)) {
+ ((GroupDataSpider) object).a(this.world.random);
+ }
+ }
+
+ if (object instanceof GroupDataSpider) {
+ int i = ((GroupDataSpider) object).a;
+
+ if (i > 0 && MobEffectList.byId[i] != null) {
+ this.addEffect(new MobEffect(i, Integer.MAX_VALUE));
+ }
+ }
+
+ return (GroupDataEntity) object;
}
}
diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java
index c6e8f786..70b40c78 100644
--- a/src/main/java/net/minecraft/server/EntitySquid.java
+++ b/src/main/java/net/minecraft/server/EntitySquid.java
@@ -4,45 +4,45 @@ import org.bukkit.craftbukkit.TrigMath; // CraftBukkit
public class EntitySquid extends EntityWaterAnimal {
- public float d = 0.0F;
- public float e = 0.0F;
- public float f = 0.0F;
- public float g = 0.0F;
- public float h = 0.0F;
- public float i = 0.0F;
- public float j = 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 float bp;
+ public float bq;
+ public float br;
+ public float bs;
+ public float bt;
+ public float bu;
+ public float bv;
+ public float bw;
+ private float bx;
+ private float by;
+ private float bz;
+ private float bA;
+ private float bB;
+ private float bC;
public EntitySquid(World world) {
super(world);
- this.texture = "/mob/squid.png";
this.a(0.95F, 0.95F);
- this.bM = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
+ this.by = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}
- public int getMaxHealth() {
- return 10;
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.a).a(10.0D);
}
- protected String bb() {
+ protected String r() {
return null;
}
- protected String bc() {
+ protected String aK() {
return null;
}
- protected String bd() {
+ protected String aL() {
return null;
}
- protected float ba() {
+ protected float aW() {
return 0.4F;
}
@@ -50,6 +50,10 @@ public class EntitySquid extends EntityWaterAnimal {
return 0;
}
+ protected boolean e_() {
+ return false;
+ }
+
protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - Whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
@@ -71,51 +75,51 @@ public class EntitySquid extends EntityWaterAnimal {
public void c() {
super.c();
- this.e = this.d;
- this.g = this.f;
- this.i = this.h;
- this.bK = this.j;
- this.h += this.bM;
- if (this.h > 6.2831855F) {
- this.h -= 6.2831855F;
+ this.bq = this.bp;
+ this.bs = this.br;
+ this.bu = this.bt;
+ this.bw = this.bv;
+ this.bt += this.by;
+ if (this.bt > 6.2831855F) {
+ this.bt -= 6.2831855F;
if (this.random.nextInt(10) == 0) {
- this.bM = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
+ this.by = 1.0F / (this.random.nextFloat() + 1.0F) * 0.2F;
}
}
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 (this.bt < 3.1415927F) {
+ f = this.bt / 3.1415927F;
+ this.bv = MathHelper.sin(f * f * 3.1415927F) * 3.1415927F * 0.25F;
if ((double) f > 0.75D) {
- this.bL = 1.0F;
- this.bN = 1.0F;
+ this.bx = 1.0F;
+ this.bz = 1.0F;
} else {
- this.bN *= 0.8F;
+ this.bz *= 0.8F;
}
} else {
- this.j = 0.0F;
- this.bL *= 0.9F;
- this.bN *= 0.99F;
+ this.bv = 0.0F;
+ this.bx *= 0.9F;
+ this.bz *= 0.99F;
}
if (!this.world.isStatic) {
- this.motX = (double) (this.bO * this.bL);
- this.motY = (double) (this.bP * this.bL);
- this.motZ = (double) (this.bQ * this.bL);
+ this.motX = (double) (this.bA * this.bx);
+ this.motY = (double) (this.bB * this.bx);
+ this.motZ = (double) (this.bC * this.bx);
}
f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ);
// CraftBukkit - Math -> TrigMath
- 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;
+ this.aN += (-((float) TrigMath.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.aN) * 0.1F;
+ this.yaw = this.aN;
+ this.br += 3.1415927F * this.bz * 1.5F;
// CraftBukkit - Math -> TrigMath
- this.d += (-((float) TrigMath.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.d) * 0.1F;
+ this.bp += (-((float) TrigMath.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.bp) * 0.1F;
} else {
- this.j = MathHelper.abs(MathHelper.sin(this.h)) * 3.1415927F * 0.25F;
+ this.bv = MathHelper.abs(MathHelper.sin(this.bt)) * 3.1415927F * 0.25F;
if (!this.world.isStatic) {
this.motX = 0.0D;
this.motY -= 0.08D;
@@ -123,7 +127,7 @@ public class EntitySquid extends EntityWaterAnimal {
this.motZ = 0.0D;
}
- this.d = (float) ((double) this.d + (double) (-90.0F - this.d) * 0.02D);
+ this.bp = (float) ((double) this.bp + (double) (-90.0F - this.bp) * 0.02D);
}
}
@@ -131,19 +135,19 @@ public class EntitySquid extends EntityWaterAnimal {
this.move(this.motX, this.motY, this.motZ);
}
- 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.inWater || this.bO == 0.0F && this.bP == 0.0F && this.bQ == 0.0F) {
+ protected void bh() {
+ ++this.aV;
+ if (this.aV > 100) {
+ this.bA = this.bB = this.bC = 0.0F;
+ } else if (this.random.nextInt(50) == 0 || !this.inWater || this.bA == 0.0F && this.bB == 0.0F && this.bC == 0.0F) {
float f = this.random.nextFloat() * 3.1415927F * 2.0F;
- this.bO = MathHelper.cos(f) * 0.2F;
- this.bP = -0.1F + this.random.nextFloat() * 0.2F;
- this.bQ = MathHelper.sin(f) * 0.2F;
+ this.bA = MathHelper.cos(f) * 0.2F;
+ this.bB = -0.1F + this.random.nextFloat() * 0.2F;
+ this.bC = MathHelper.sin(f) * 0.2F;
}
- this.bn();
+ this.bk();
}
public boolean canSpawn() {
diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
index 41139997..99e7ac2b 100644
--- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java
+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java
@@ -11,7 +11,6 @@ public class EntityTNTPrimed extends Entity {
public EntityTNTPrimed(World world) {
super(world);
- this.fuseTicks = 0;
this.m = true;
this.a(0.98F, 0.98F);
this.height = this.length / 2.0F;
@@ -34,7 +33,7 @@ public class EntityTNTPrimed extends Entity {
protected void a() {}
- protected boolean f_() {
+ protected boolean e_() {
return false;
}
diff --git a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
index eb8b59f3..51695390 100644
--- a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
+++ b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java
@@ -14,7 +14,7 @@ public class EntityThrownExpBottle extends EntityProjectile {
super(world, d0, d1, d2);
}
- protected float g() {
+ protected float e() {
return 0.07F;
}
diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java
index 9e2b76f8..a8e45dd0 100644
--- a/src/main/java/net/minecraft/server/EntityTracker.java
+++ b/src/main/java/net/minecraft/server/EntityTracker.java
@@ -73,14 +73,12 @@ public class EntityTracker {
this.addEntity(entity, 160, 10, true);
} else if (entity instanceof EntityFallingBlock) {
this.addEntity(entity, 160, 20, true);
- } else if (entity instanceof EntityPainting) {
+ } else if (entity instanceof EntityHanging) {
this.addEntity(entity, 160, Integer.MAX_VALUE, false);
} else if (entity instanceof EntityExperienceOrb) {
this.addEntity(entity, 160, 20, true);
} else if (entity instanceof EntityEnderCrystal) {
this.addEntity(entity, 256, Integer.MAX_VALUE, false);
- } else if (entity instanceof EntityItemFrame) {
- this.addEntity(entity, 160, Integer.MAX_VALUE, false);
}
}
diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
index 5c037329..e58af635 100644
--- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java
+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -24,16 +25,16 @@ public class EntityTrackerEntry {
public double j;
public double k;
public double l;
- public int m = 0;
+ public int m;
private double p;
private double q;
private double r;
- private boolean s = false;
+ private boolean s;
private boolean isMoving;
- private int u = 0;
+ private int u;
private Entity v;
- private boolean w = false;
- public boolean n = false;
+ private boolean w;
+ public boolean n;
public Set trackedPlayers = new HashSet();
public EntityTrackerEntry(Entity entity, int i, int j, boolean flag) {
@@ -70,37 +71,33 @@ public class EntityTrackerEntry {
if (this.v != this.tracker.vehicle /* || this.tracker.vehicle != null && this.m % 60 == 0 */) { // CraftBukkit - Revert to 1.4 logic, this packet is a toggle
this.v = this.tracker.vehicle;
- this.broadcast(new Packet39AttachEntity(this.tracker, this.tracker.vehicle));
+ this.broadcast(new Packet39AttachEntity(0, this.tracker, this.tracker.vehicle));
}
if (this.tracker instanceof EntityItemFrame /*&& this.m % 10 == 0*/) { // CraftBukkit - Moved below, should always enter this block
- EntityItemFrame i4 = (EntityItemFrame) this.tracker;
- ItemStack i5 = i4.i();
+ EntityItemFrame i3 = (EntityItemFrame) this.tracker;
+ ItemStack i4 = i3.h();
- if (this.m % 10 == 0 && i5 != null && i5.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.m % 10 logic here so item frames do not enter the other blocks
- WorldMap i7 = Item.MAP.getSavedMap(i5, this.tracker.world);
- Iterator j0 = this.trackedPlayers.iterator(); // CraftBukkit
+ if (this.m % 10 == 0 && i4 != null && i4.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.m % 10 logic here so item frames do not enter the other blocks
+ WorldMap i6 = Item.MAP.getSavedMap(i4, this.tracker.world);
+ Iterator i7 = this.trackedPlayers.iterator(); // CraftBukkit
- while (j0.hasNext()) {
- EntityHuman j1 = (EntityHuman) j0.next();
- EntityPlayer j2 = (EntityPlayer) j1;
+ while (i7.hasNext()) {
+ EntityHuman i8 = (EntityHuman) i7.next();
+ EntityPlayer i9 = (EntityPlayer) i8;
- i7.a(j2, i5);
- if (j2.playerConnection.lowPriorityCount() <= 5) {
- Packet j3 = Item.MAP.c(i5, this.tracker.world, j2);
+ i6.a(i9, i4);
+ if (i9.playerConnection.lowPriorityCount() <= 5) {
+ Packet j0 = Item.MAP.c(i4, this.tracker.world, i9);
- if (j3 != null) {
- j2.playerConnection.sendPacket(j3);
+ if (j0 != null) {
+ i9.playerConnection.sendPacket(j0);
}
}
}
}
- DataWatcher i9 = this.tracker.getDataWatcher();
-
- if (i9.a()) {
- this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, i9, false));
- }
+ this.b();
} else if (this.m % this.c == 0 || this.tracker.an || this.tracker.getDataWatcher().a()) {
int i;
int j;
@@ -171,12 +168,7 @@ public class EntityTrackerEntry {
this.broadcast((Packet) object);
}
- DataWatcher datawatcher1 = this.tracker.getDataWatcher();
-
- if (datawatcher1.a()) {
- this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher1, false));
- }
-
+ this.b();
/* CraftBukkit start - Code moved up
if (flag) {
this.xLoc = i;
@@ -205,12 +197,7 @@ public class EntityTrackerEntry {
this.xLoc = this.tracker.at.a(this.tracker.locX);
this.yLoc = MathHelper.floor(this.tracker.locY * 32.0D);
this.zLoc = this.tracker.at.a(this.tracker.locZ);
- DataWatcher datawatcher2 = this.tracker.getDataWatcher();
-
- if (datawatcher2.a()) {
- this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher2, false));
- }
-
+ this.b();
this.w = true;
}
@@ -251,6 +238,25 @@ public class EntityTrackerEntry {
}
}
+ private void b() {
+ DataWatcher datawatcher = this.tracker.getDataWatcher();
+
+ if (datawatcher.a()) {
+ this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher, false));
+ }
+
+ if (this.tracker instanceof EntityLiving) {
+ AttributeMapServer attributemapserver = (AttributeMapServer) ((EntityLiving) this.tracker).aT();
+ Set set = attributemapserver.b();
+
+ if (!set.isEmpty()) {
+ this.broadcastIncludingSelf(new Packet44UpdateAttributes(this.tracker.id, set));
+ }
+
+ set.clear();
+ }
+ }
+
public void broadcast(Packet packet) {
Iterator iterator = this.trackedPlayers.iterator();
@@ -304,13 +310,22 @@ public class EntityTrackerEntry {
// CraftBukkit end
this.trackedPlayers.add(entityplayer);
- Packet packet = this.b();
+ Packet packet = this.c();
entityplayer.playerConnection.sendPacket(packet);
if (!this.tracker.getDataWatcher().d()) {
entityplayer.playerConnection.sendPacket(new Packet40EntityMetadata(this.tracker.id, this.tracker.getDataWatcher(), true));
}
+ if (this.tracker instanceof EntityLiving) {
+ AttributeMapServer attributemapserver = (AttributeMapServer) ((EntityLiving) this.tracker).aT();
+ Collection collection = attributemapserver.c();
+
+ if (!collection.isEmpty()) {
+ entityplayer.playerConnection.sendPacket(new Packet44UpdateAttributes(this.tracker.id, collection));
+ }
+ }
+
this.j = this.tracker.motX;
this.k = this.tracker.motY;
this.l = this.tracker.motZ;
@@ -320,9 +335,13 @@ public class EntityTrackerEntry {
// CraftBukkit start
if (this.tracker.vehicle != null && this.tracker.id > this.tracker.vehicle.id) {
- entityplayer.playerConnection.sendPacket(new Packet39AttachEntity(this.tracker, this.tracker.vehicle));
+ entityplayer.playerConnection.sendPacket(new Packet39AttachEntity(0, this.tracker, this.tracker.vehicle));
} else if (this.tracker.passenger != null && this.tracker.id > this.tracker.passenger.id) {
- entityplayer.playerConnection.sendPacket(new Packet39AttachEntity(this.tracker.passenger, this.tracker));
+ entityplayer.playerConnection.sendPacket(new Packet39AttachEntity(0, this.tracker.passenger, this.tracker));
+ }
+
+ if (this.tracker instanceof EntityInsentient && ((EntityInsentient) this.tracker).bE() != null) {
+ entityplayer.playerConnection.sendPacket(new Packet39AttachEntity(1, this.tracker, ((EntityInsentient) this.tracker).bE()));
}
// CraftBukkit end
@@ -368,7 +387,7 @@ public class EntityTrackerEntry {
}
private boolean d(EntityPlayer entityplayer) {
- return entityplayer.o().getPlayerChunkMap().a(entityplayer, this.tracker.aj, this.tracker.al);
+ return entityplayer.p().getPlayerChunkMap().a(entityplayer, this.tracker.aj, this.tracker.al);
}
public void scanPlayers(List list) {
@@ -377,7 +396,7 @@ public class EntityTrackerEntry {
}
}
- private Packet b() {
+ private Packet c() {
if (this.tracker.dead) {
// CraftBukkit start - Remove useless error spam, just return
// this.tracker.world.getLogger().warning("Fetching addPacket for removed entity");
@@ -461,6 +480,14 @@ public class EntityTrackerEntry {
packet23vehiclespawn.c = MathHelper.d((float) (entityitemframe.y * 32));
packet23vehiclespawn.d = MathHelper.d((float) (entityitemframe.z * 32));
return packet23vehiclespawn;
+ } else if (this.tracker instanceof EntityLeash) {
+ EntityLeash entityleash = (EntityLeash) this.tracker;
+
+ packet23vehiclespawn = new Packet23VehicleSpawn(this.tracker, 77);
+ packet23vehiclespawn.b = MathHelper.d((float) (entityleash.x * 32));
+ packet23vehiclespawn.c = MathHelper.d((float) (entityleash.y * 32));
+ packet23vehiclespawn.d = MathHelper.d((float) (entityleash.z * 32));
+ return packet23vehiclespawn;
} else if (this.tracker instanceof EntityExperienceOrb) {
return new Packet26AddExpOrb((EntityExperienceOrb) this.tracker);
} else {
diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java
index e44d7bee..368652de 100644
--- a/src/main/java/net/minecraft/server/EntityWitch.java
+++ b/src/main/java/net/minecraft/server/EntityWitch.java
@@ -2,23 +2,24 @@ package net.minecraft.server;
import java.util.Iterator;
import java.util.List;
+import java.util.UUID;
public class EntityWitch extends EntityMonster implements IRangedEntity {
- private static final int[] d = new int[] { Item.GLOWSTONE_DUST.id, Item.SUGAR.id, Item.REDSTONE.id, Item.SPIDER_EYE.id, Item.GLASS_BOTTLE.id, Item.SULPHUR.id, Item.STICK.id, Item.STICK.id};
- private int e = 0;
+ private static final UUID bp = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E");
+ private static final AttributeModifier bq = (new AttributeModifier(bp, "Drinking speed penalty", -0.25D, 0)).a(false);
+ private static final int[] br = new int[] { Item.GLOWSTONE_DUST.id, Item.SUGAR.id, Item.REDSTONE.id, Item.SPIDER_EYE.id, Item.GLASS_BOTTLE.id, Item.SULPHUR.id, Item.STICK.id, Item.STICK.id};
+ private int bs;
public EntityWitch(World world) {
super(world);
- this.texture = "/mob/villager/witch.png";
- this.bI = 0.25F;
this.goalSelector.a(1, new PathfinderGoalFloat(this));
- this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, this.bI, 60, 10.0F));
- this.goalSelector.a(2, new PathfinderGoalRandomStroll(this, this.bI));
+ this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, 1.0D, 60, 10.0F));
+ this.goalSelector.a(2, new PathfinderGoalRandomStroll(this, 1.0D));
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));
- this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 16.0F, 0, true));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, true));
}
protected void a() {
@@ -26,15 +27,15 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
this.getDataWatcher().a(21, Byte.valueOf((byte) 0));
}
- protected String bb() {
+ protected String r() {
return "mob.witch.idle";
}
- protected String bc() {
+ protected String aK() {
return "mob.witch.hurt";
}
- protected String bd() {
+ protected String aL() {
return "mob.witch.death";
}
@@ -42,24 +43,26 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
this.getDataWatcher().watch(21, Byte.valueOf((byte) (flag ? 1 : 0)));
}
- public boolean m() {
+ public boolean bP() {
return this.getDataWatcher().getByte(21) == 1;
}
- public int getMaxHealth() {
- return 26;
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.a).a(26.0D);
+ this.a(GenericAttributes.d).a(0.25D);
}
- public boolean bh() {
+ public boolean bb() {
return true;
}
public void c() {
if (!this.world.isStatic) {
- if (this.m()) {
- if (this.e-- <= 0) {
+ if (this.bP()) {
+ if (this.bs-- <= 0) {
this.a(false);
- ItemStack itemstack = this.bG();
+ ItemStack itemstack = this.aV();
this.setEquipment(0, (ItemStack) null);
if (itemstack != null && itemstack.id == Item.POTION.id) {
@@ -75,13 +78,15 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
}
}
}
+
+ this.a(GenericAttributes.d).b(bq);
}
} else {
short short1 = -1;
if (this.random.nextFloat() < 0.15F && this.isBurning() && !this.hasEffect(MobEffectList.FIRE_RESISTANCE)) {
short1 = 16307;
- } else if (this.random.nextFloat() < 0.05F && this.health < this.maxHealth) { // CraftBukkit - this.getMaxHealth -> this.maxHealth
+ } else if (this.random.nextFloat() < 0.05F && this.getHealth() < this.maxHealth) { // CraftBukkit - this.getMaxHealth() -> this.maxHealth
short1 = 16341;
} else if (this.random.nextFloat() < 0.25F && this.getGoalTarget() != null && !this.hasEffect(MobEffectList.FASTER_MOVEMENT) && this.getGoalTarget().e(this) > 121.0D) {
short1 = 16274;
@@ -91,8 +96,12 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
if (short1 > -1) {
this.setEquipment(0, new ItemStack(Item.POTION, 1, short1));
- this.e = this.bG().n();
+ this.bs = this.aV().n();
this.a(true);
+ AttributeInstance attributeinstance = this.a(GenericAttributes.d);
+
+ attributeinstance.b(bq);
+ attributeinstance.a(bq);
}
}
@@ -104,24 +113,14 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
super.c();
}
- protected int c(DamageSource damagesource, int i) {
- i = super.c(damagesource, i);
+ protected float c(DamageSource damagesource, float f) {
+ f = super.c(damagesource, f);
if (damagesource.getEntity() == this) {
- i = 0;
+ f = 0.0F;
}
if (damagesource.q()) {
- i = (int) ((double) i * 0.15D);
- }
-
- return i;
- }
-
- public float bE() {
- float f = super.bE();
-
- if (this.m()) {
- f *= 0.75F;
+ f = (float) ((double) f * 0.15D);
}
return f;
@@ -135,7 +134,7 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
for (int k = 0; k < j; ++k) {
int l = this.random.nextInt(3);
- int i1 = d[this.random.nextInt(d.length)];
+ int i1 = br[this.random.nextInt(br.length)];
if (i > 0) {
l += this.random.nextInt(i + 1);
@@ -149,7 +148,7 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
}
public void a(EntityLiving entityliving, float f) {
- if (!this.m()) {
+ if (!this.bP()) {
EntityPotion entitypotion = new EntityPotion(this.world, this, 32732);
entitypotion.pitch -= -20.0F;
@@ -160,7 +159,7 @@ public class EntityWitch extends EntityMonster implements IRangedEntity {
if (f1 >= 8.0F && !entityliving.hasEffect(MobEffectList.SLOWER_MOVEMENT)) {
entitypotion.setPotionValue(32698);
- } else if (entityliving.getHealth() >= 8 && !entityliving.hasEffect(MobEffectList.POISON)) {
+ } else if (entityliving.getHealth() >= 8.0F && !entityliving.hasEffect(MobEffectList.POISON)) {
entitypotion.setPotionValue(32660);
} else if (f1 <= 3.0F && !entityliving.hasEffect(MobEffectList.WEAKNESS) && this.random.nextFloat() < 0.25F) {
entitypotion.setPotionValue(32696);
diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java
index 176f8099..bd260822 100644
--- a/src/main/java/net/minecraft/server/EntityWither.java
+++ b/src/main/java/net/minecraft/server/EntityWither.java
@@ -9,36 +9,33 @@ import org.bukkit.event.entity.ExplosionPrimeEvent;
public class EntityWither extends EntityMonster implements IRangedEntity {
- private float[] d = new float[2];
- private float[] e = new float[2];
- private float[] f = new float[2];
- private float[] g = new float[2];
- private int[] h = new int[2];
- private int[] i = new int[2];
- private int j;
- private static final IEntitySelector bK = new EntitySelectorNotUndead();
+ private float[] bp = new float[2];
+ private float[] bq = new float[2];
+ private float[] br = new float[2];
+ private float[] bs = new float[2];
+ private int[] bt = new int[2];
+ private int[] bu = new int[2];
+ private int bv;
+ private static final IEntitySelector bw = new EntitySelectorNotUndead();
public EntityWither(World world) {
super(world);
this.setHealth(this.getMaxHealth());
- this.texture = "/mob/wither.png";
this.a(0.9F, 4.0F);
this.fireProof = true;
- this.bI = 0.6F;
this.getNavigation().e(true);
this.goalSelector.a(0, new PathfinderGoalFloat(this));
- this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, this.bI, 40, 20.0F));
- this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, this.bI));
+ this.goalSelector.a(2, new PathfinderGoalArrowAttack(this, 1.0D, 40, 20.0F));
+ this.goalSelector.a(5, new PathfinderGoalRandomStroll(this, 1.0D));
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, bK));
- this.be = 50;
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityInsentient.class, 0, false, false, bw));
+ this.b = 50;
}
protected void a() {
super.a();
- this.datawatcher.a(16, new Integer(100));
this.datawatcher.a(17, new Integer(0));
this.datawatcher.a(18, new Integer(0));
this.datawatcher.a(19, new Integer(0));
@@ -47,42 +44,37 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
- nbttagcompound.setInt("Invul", this.n());
+ nbttagcompound.setInt("Invul", this.bQ());
}
public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound);
- this.t(nbttagcompound.getInt("Invul"));
- this.datawatcher.watch(16, Integer.valueOf(this.health));
+ this.p(nbttagcompound.getInt("Invul"));
}
- protected String bb() {
+ protected String r() {
return "mob.wither.idle";
}
- protected String bc() {
+ protected String aK() {
return "mob.wither.hurt";
}
- protected String bd() {
+ protected String aL() {
return "mob.wither.death";
}
public void c() {
- if (!this.world.isStatic) {
- this.datawatcher.watch(16, Integer.valueOf(this.getScaledHealth())); // CraftBukkit - this.health -> this.getScaledHealth()
- }
-
this.motY *= 0.6000000238418579D;
double d0;
double d1;
double d2;
- if (!this.world.isStatic && this.u(0) > 0) {
- Entity entity = this.world.getEntity(this.u(0));
+ if (!this.world.isStatic && this.q(0) > 0) {
+ Entity entity = this.world.getEntity(this.q(0));
if (entity != null) {
- if (this.locY < entity.locY || !this.o() && this.locY < entity.locY + 5.0D) {
+ if (this.locY < entity.locY || !this.bR() && this.locY < entity.locY + 5.0D) {
if (this.motY < 0.0D) {
this.motY = 0.0D;
}
@@ -111,14 +103,14 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
int i;
for (i = 0; i < 2; ++i) {
- this.g[i] = this.e[i];
- this.f[i] = this.d[i];
+ this.bs[i] = this.bq[i];
+ this.br[i] = this.bp[i];
}
int j;
for (i = 0; i < 2; ++i) {
- j = this.u(i + 1);
+ j = this.q(i + 1);
Entity entity1 = null;
if (j > 0) {
@@ -126,9 +118,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
if (entity1 != null) {
- d0 = this.v(i + 1);
- d1 = this.w(i + 1);
- d2 = this.x(i + 1);
+ d0 = this.r(i + 1);
+ d1 = this.s(i + 1);
+ d2 = this.t(i + 1);
double d4 = entity1.locX - d0;
double d5 = entity1.locY + (double) entity1.getHeadHeight() - d1;
double d6 = entity1.locZ - d2;
@@ -136,19 +128,19 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
float f = (float) (Math.atan2(d6, d4) * 180.0D / 3.1415927410125732D) - 90.0F;
float f1 = (float) (-(Math.atan2(d5, d7) * 180.0D / 3.1415927410125732D));
- this.d[i] = this.b(this.d[i], f1, 40.0F);
- this.e[i] = this.b(this.e[i], f, 10.0F);
+ this.bp[i] = this.b(this.bp[i], f1, 40.0F);
+ this.bq[i] = this.b(this.bq[i], f, 10.0F);
} else {
- this.e[i] = this.b(this.e[i], this.ay, 10.0F);
+ this.bq[i] = this.b(this.bq[i], this.aN, 10.0F);
}
}
- boolean flag = this.o();
+ boolean flag = this.bR();
for (j = 0; j < 3; ++j) {
- double d8 = this.v(j);
- double d9 = this.w(j);
- double d10 = this.x(j);
+ double d8 = this.r(j);
+ double d9 = this.s(j);
+ double d10 = this.t(j);
this.world.addParticle("smoke", d8 + this.random.nextGaussian() * 0.30000001192092896D, d9 + this.random.nextGaussian() * 0.30000001192092896D, d10 + this.random.nextGaussian() * 0.30000001192092896D, 0.0D, 0.0D, 0.0D);
if (flag && this.world.random.nextInt(4) == 0) {
@@ -156,18 +148,18 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
}
- if (this.n() > 0) {
+ if (this.bQ() > 0) {
for (j = 0; j < 3; ++j) {
this.world.addParticle("mobSpell", this.locX + this.random.nextGaussian() * 1.0D, this.locY + (double) (this.random.nextFloat() * 3.3F), this.locZ + this.random.nextGaussian() * 1.0D, 0.699999988079071D, 0.699999988079071D, 0.8999999761581421D);
}
}
}
- protected void bo() {
+ protected void be() {
int i;
- if (this.n() > 0) {
- i = this.n() - 1;
+ if (this.bQ() > 0) {
+ i = this.bQ() - 1;
if (i <= 0) {
// CraftBukkit start
ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 7.0F, false);
@@ -178,26 +170,27 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
// CraftBukkit end
+ this.world.createExplosion(this, this.locX, this.locY + (double) this.getHeadHeight(), this.locZ, 7.0F, false, this.world.getGameRules().getBoolean("mobGriefing"));
this.world.d(1013, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
- this.t(i);
+ this.p(i);
if (this.ticksLived % 10 == 0) {
- this.heal(10, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit
+ this.heal(10.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER_SPAWN); // CraftBukkit
}
} else {
- super.bo();
+ super.be();
int j;
for (i = 1; i < 3; ++i) {
- if (this.ticksLived >= this.h[i - 1]) {
- this.h[i - 1] = this.ticksLived + 10 + this.random.nextInt(10);
+ if (this.ticksLived >= this.bt[i - 1]) {
+ this.bt[i - 1] = this.ticksLived + 10 + this.random.nextInt(10);
if (this.world.difficulty >= 2) {
int i1001 = i - 1;
- int i1003 = this.i[i - 1];
+ int i1003 = this.bu[i - 1];
- this.i[i1001] = this.i[i - 1] + 1;
+ this.bu[i1001] = this.bu[i - 1] + 1;
if (i1003 > 15) {
float f = 10.0F;
float f1 = 5.0F;
@@ -206,28 +199,28 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
double d2 = MathHelper.a(this.random, this.locZ - (double) f, this.locZ + (double) f);
this.a(i + 1, d0, d1, d2, true);
- this.i[i - 1] = 0;
+ this.bu[i - 1] = 0;
}
}
- j = this.u(i);
+ j = this.q(i);
if (j > 0) {
Entity entity = this.world.getEntity(j);
- if (entity != null && entity.isAlive() && this.e(entity) <= 900.0D && this.n(entity)) {
+ if (entity != null && entity.isAlive() && this.e(entity) <= 900.0D && this.o(entity)) {
this.a(i + 1, (EntityLiving) entity);
- this.h[i - 1] = this.ticksLived + 40 + this.random.nextInt(20);
- this.i[i - 1] = 0;
+ this.bt[i - 1] = this.ticksLived + 40 + this.random.nextInt(20);
+ this.bu[i - 1] = 0;
} else {
this.c(i, 0);
}
} else {
- List list = this.world.a(EntityLiving.class, this.boundingBox.grow(20.0D, 8.0D, 20.0D), bK);
+ List list = this.world.a(EntityLiving.class, this.boundingBox.grow(20.0D, 8.0D, 20.0D), bw);
for (int i1 = 0; i1 < 10 && !list.isEmpty(); ++i1) {
EntityLiving entityliving = (EntityLiving) list.get(this.random.nextInt(list.size()));
- if (entityliving != this && entityliving.isAlive() && this.n(entityliving)) {
+ if (entityliving != this && entityliving.isAlive() && this.o(entityliving)) {
if (entityliving instanceof EntityHuman) {
if (!((EntityHuman) entityliving).abilities.isInvulnerable) {
this.c(i, entityliving.id);
@@ -250,9 +243,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.c(0, 0);
}
- if (this.j > 0) {
- --this.j;
- if (this.j == 0 && this.world.getGameRules().getBoolean("mobGriefing")) {
+ if (this.bv > 0) {
+ --this.bv;
+ if (this.bv == 0 && this.world.getGameRules().getBoolean("mobGriefing")) {
i = MathHelper.floor(this.locY);
j = MathHelper.floor(this.locX);
int j1 = MathHelper.floor(this.locZ);
@@ -286,42 +279,42 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
}
if (this.ticksLived % 20 == 0) {
- this.heal(1);
+ this.heal(1.0F);
}
}
}
- public void m() {
- this.t(220);
- this.setHealth(this.getMaxHealth() / 3);
+ public void bP() {
+ this.p(220);
+ this.setHealth(this.getMaxHealth() / 3.0F);
}
- public void al() {}
+ public void ak() {}
- public int aZ() {
+ public int aM() {
return 4;
}
- private double v(int i) {
+ private double r(int i) {
if (i <= 0) {
return this.locX;
} else {
- float f = (this.ay + (float) (180 * (i - 1))) / 180.0F * 3.1415927F;
+ float f = (this.aN + (float) (180 * (i - 1))) / 180.0F * 3.1415927F;
float f1 = MathHelper.cos(f);
return this.locX + (double) f1 * 1.3D;
}
}
- private double w(int i) {
+ private double s(int i) {
return i <= 0 ? this.locY + 3.0D : this.locY + 2.2D;
}
- private double x(int i) {
+ private double t(int i) {
if (i <= 0) {
return this.locZ;
} else {
- float f = (this.ay + (float) (180 * (i - 1))) / 180.0F * 3.1415927F;
+ float f = (this.aN + (float) (180 * (i - 1))) / 180.0F * 3.1415927F;
float f1 = MathHelper.sin(f);
return this.locZ + (double) f1 * 1.3D;
@@ -348,9 +341,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
private void a(int i, double d0, double d1, double d2, boolean flag) {
this.world.a((EntityHuman) null, 1014, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
- double d3 = this.v(i);
- double d4 = this.w(i);
- double d5 = this.x(i);
+ double d3 = this.r(i);
+ double d4 = this.s(i);
+ double d5 = this.t(i);
double d6 = d0 - d3;
double d7 = d1 - d4;
double d8 = d2 - d5;
@@ -370,17 +363,17 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.a(0, entityliving);
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else if (damagesource == DamageSource.DROWN) {
return false;
- } else if (this.n() > 0) {
+ } else if (this.bQ() > 0) {
return false;
} else {
Entity entity;
- if (this.o()) {
+ if (this.bR()) {
entity = damagesource.h();
if (entity instanceof EntityArrow) {
return false;
@@ -391,15 +384,15 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
if (entity != null && !(entity instanceof EntityHuman) && entity instanceof EntityLiving && ((EntityLiving) entity).getMonsterType() == this.getMonsterType()) {
return false;
} else {
- if (this.j <= 0) {
- this.j = 20;
+ if (this.bv <= 0) {
+ this.bv = 20;
}
- for (int j = 0; j < this.i.length; ++j) {
- this.i[j] += 3;
+ for (int i = 0; i < this.bu.length; ++i) {
+ this.bu[i] += 3;
}
- return super.damageEntity(damagesource, i);
+ return super.damageEntity(damagesource, f);
}
}
}
@@ -412,39 +405,39 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
// CraftBukkit end
}
- protected void bn() {
- this.bC = 0;
+ protected void bk() {
+ this.aV = 0;
}
public boolean K() {
return !this.dead;
}
- public int b() {
- return this.datawatcher.getInt(16);
+ protected void b(float f) {
}
- protected void a(float f) {}
-
public void addEffect(MobEffect mobeffect) {}
- protected boolean bh() {
+ protected boolean bb() {
return true;
}
- public int getMaxHealth() {
- return 300;
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.a).a(300.0D);
+ this.a(GenericAttributes.d).a(0.6000000238418579D);
+ this.a(GenericAttributes.b).a(40.0D);
}
- public int n() {
+ public int bQ() {
return this.datawatcher.getInt(20);
}
- public void t(int i) {
+ public void p(int i) {
this.datawatcher.watch(20, Integer.valueOf(i));
}
- public int u(int i) {
+ public int q(int i) {
return this.datawatcher.getInt(17 + i);
}
@@ -452,8 +445,8 @@ public class EntityWither extends EntityMonster implements IRangedEntity {
this.datawatcher.watch(17 + i, Integer.valueOf(j));
}
- public boolean o() {
- return this.b() <= this.maxHealth / 2; // CraftBukkit - this.getMaxHealth() -> this.maxHealth
+ public boolean bR() {
+ return this.getHealth() <= this.maxHealth / 2.0F; // CraftBukkit - this.getMaxHealth() -> this.maxHealth
}
public EnumMonsterType getMonsterType() {
diff --git a/src/main/java/net/minecraft/server/EntityWitherSkull.java b/src/main/java/net/minecraft/server/EntityWitherSkull.java
index fab412aa..546430ca 100644
--- a/src/main/java/net/minecraft/server/EntityWitherSkull.java
+++ b/src/main/java/net/minecraft/server/EntityWitherSkull.java
@@ -36,8 +36,8 @@ public class EntityWitherSkull extends EntityFireball {
if (!this.world.isStatic) {
if (movingobjectposition.entity != null) {
if (this.shooter != null) {
- if (movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8) && !movingobjectposition.entity.isAlive()) {
- this.shooter.heal(5, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit
+ if (movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8.0F) && !movingobjectposition.entity.isAlive()) {
+ this.shooter.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit
}
} else {
movingobjectposition.entity.damageEntity(DamageSource.MAGIC, 5);
@@ -77,7 +77,7 @@ public class EntityWitherSkull extends EntityFireball {
return false;
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
return false;
}
diff --git a/src/main/java/net/minecraft/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java
index 132b55f9..d3593bc0 100644
--- a/src/main/java/net/minecraft/server/EntityWolf.java
+++ b/src/main/java/net/minecraft/server/EntityWolf.java
@@ -1,60 +1,84 @@
package net.minecraft.server;
+import java.util.Iterator;
+import java.util.List;
+
public class EntityWolf extends EntityTameableAnimal {
- private float e;
- private float f;
- private boolean g;
- private boolean h;
- private float i;
- private float j;
+ private float bq;
+ private float br;
+ private boolean bs;
+ private boolean bt;
+ private float bu;
+ private float bv;
public EntityWolf(World world) {
super(world);
- this.texture = "/mob/wolf.png";
this.a(0.6F, 0.8F);
- this.bI = 0.3F;
this.getNavigation().a(true);
this.goalSelector.a(1, new PathfinderGoalFloat(this));
- this.goalSelector.a(2, this.d);
+ this.goalSelector.a(2, this.bp);
this.goalSelector.a(3, new PathfinderGoalLeapAtTarget(this, 0.4F));
- 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(4, new PathfinderGoalMeleeAttack(this, 1.0D, true));
+ this.goalSelector.a(5, new PathfinderGoalFollowOwner(this, 1.0D, 10.0F, 2.0F));
+ this.goalSelector.a(6, new PathfinderGoalBreed(this, 1.0D));
+ this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D));
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));
this.targetSelector.a(1, new PathfinderGoalOwnerHurtByTarget(this));
this.targetSelector.a(2, new PathfinderGoalOwnerHurtTarget(this));
this.targetSelector.a(3, new PathfinderGoalHurtByTarget(this, true));
- this.targetSelector.a(4, new PathfinderGoalRandomTargetNonTamed(this, EntitySheep.class, 16.0F, 200, false));
+ this.targetSelector.a(4, new PathfinderGoalRandomTargetNonTamed(this, EntitySheep.class, 200, false));
+ this.setTamed(false);
}
- public boolean bh() {
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.d).a(0.30000001192092896D);
+ if (this.isTamed()) {
+ this.a(GenericAttributes.a).a(20.0D);
+ } else {
+ this.a(GenericAttributes.a).a(8.0D);
+ }
+ }
+
+ public boolean bb() {
return true;
}
public void setGoalTarget(EntityLiving entityliving) {
super.setGoalTarget(entityliving);
- if (entityliving instanceof EntityHuman) {
+ if (entityliving == null) {
+ if (!this.isAngry()) {
+ return;
+ }
+
+ this.setAngry(false);
+ List list = this.world.a(this.getClass(), AxisAlignedBB.a().a(this.locX, this.locY, this.locZ, this.locX + 1.0D, this.locY + 1.0D, this.locZ + 1.0D).grow(16.0D, 10.0D, 16.0D));
+ Iterator iterator = list.iterator();
+
+ while (iterator.hasNext()) {
+ EntityWolf entitywolf = (EntityWolf) iterator.next();
+
+ if (this != entitywolf) {
+ entitywolf.setAngry(false);
+ }
+ }
+ } else {
this.setAngry(true);
}
}
- protected void bp() {
- this.datawatcher.watch(18, Integer.valueOf(this.getScaledHealth())); // CraftBukkit - this.getHealth() -> this.getScaledHealth()
- }
-
- public int getMaxHealth() {
- return this.isTamed() ? 20 : 8;
+ protected void bg() {
+ this.datawatcher.watch(18, Float.valueOf(this.getScaledHealth())); // CraftBukkit - this.getHealth() -> this.getScaledHealth()
}
protected void a() {
super.a();
- this.datawatcher.a(18, new Integer(this.getHealth()));
+ this.datawatcher.a(18, new Float(this.getHealth()));
this.datawatcher.a(19, new Byte((byte) 0));
- this.datawatcher.a(20, new Byte((byte) BlockCloth.g_(1)));
+ this.datawatcher.a(20, new Byte((byte) BlockCloth.j_(1)));
}
protected void a(int i, int j, int k, int l) {
@@ -75,24 +99,20 @@ public class EntityWolf extends EntityTameableAnimal {
}
}
- protected boolean isTypeNotPersistent() {
- return this.isAngry() && !this.isTamed();
- }
-
- protected String bb() {
+ protected String r() {
// 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");
+ return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.isTamed() && this.datawatcher.getFloat(18) < this.maxHealth / 2 ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark");
}
- protected String bc() {
+ protected String aK() {
return "mob.wolf.hurt";
}
- protected String bd() {
+ protected String aL() {
return "mob.wolf.death";
}
- protected float ba() {
+ protected float aW() {
return 0.4F;
}
@@ -102,49 +122,49 @@ public class EntityWolf extends EntityTameableAnimal {
public void c() {
super.c();
- if (!this.world.isStatic && this.g && !this.h && !this.k() && this.onGround) {
- this.h = true;
- this.i = 0.0F;
- this.j = 0.0F;
+ if (!this.world.isStatic && this.bs && !this.bt && !this.bI() && this.onGround) {
+ this.bt = true;
+ this.bu = 0.0F;
+ this.bv = 0.0F;
this.world.broadcastEntityEffect(this, (byte) 8);
}
}
public void l_() {
super.l_();
- this.f = this.e;
- if (this.bY()) {
- this.e += (1.0F - this.e) * 0.4F;
+ this.br = this.bq;
+ if (this.ca()) {
+ this.bq += (1.0F - this.bq) * 0.4F;
} else {
- this.e += (0.0F - this.e) * 0.4F;
+ this.bq += (0.0F - this.bq) * 0.4F;
}
- if (this.bY()) {
- this.bJ = 10;
+ if (this.ca()) {
+ this.g = 10;
}
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.ba(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
+ this.bs = true;
+ this.bt = false;
+ this.bu = 0.0F;
+ this.bv = 0.0F;
+ } else if ((this.bs || this.bt) && this.bt) {
+ if (this.bu == 0.0F) {
+ this.makeSound("mob.wolf.shake", this.aW(), (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F);
}
- this.j = this.i;
- this.i += 0.05F;
- if (this.j >= 2.0F) {
- this.g = false;
- this.h = false;
- this.j = 0.0F;
- this.i = 0.0F;
+ this.bv = this.bu;
+ this.bu += 0.05F;
+ if (this.bv >= 2.0F) {
+ this.bs = false;
+ this.bt = false;
+ this.bv = 0.0F;
+ this.bu = 0.0F;
}
- if (this.i > 0.4F) {
+ if (this.bu > 0.4F) {
float f = (float) this.boundingBox.b;
- int i = (int) (MathHelper.sin((this.i - 0.4F) * 3.1415927F) * 7.0F);
+ int i = (int) (MathHelper.sin((this.bu - 0.4F) * 3.1415927F) * 7.0F);
for (int j = 0; j < i; ++j) {
float f1 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
@@ -160,32 +180,41 @@ public class EntityWolf extends EntityTameableAnimal {
return this.length * 0.8F;
}
- public int bs() {
- return this.isSitting() ? 20 : super.bs();
+ public int bl() {
+ return this.isSitting() ? 20 : super.bl();
}
- public boolean damageEntity(DamageSource damagesource, int i) {
+ public boolean damageEntity(DamageSource damagesource, float f) {
if (this.isInvulnerable()) {
return false;
} else {
Entity entity = damagesource.getEntity();
- this.d.setSitting(false);
+ this.bp.setSitting(false);
if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) {
- i = (i + 1) / 2;
+ f = (f + 1.0F) / 2.0F;
}
- return super.damageEntity(damagesource, i);
+ return super.damageEntity(damagesource, f);
}
}
public boolean m(Entity entity) {
int i = this.isTamed() ? 4 : 2;
- return entity.damageEntity(DamageSource.mobAttack(this), i);
+ return entity.damageEntity(DamageSource.mobAttack(this), (float) i);
}
- public boolean a_(EntityHuman entityhuman) {
+ public void setTamed(boolean flag) {
+ super.setTamed(flag);
+ if (flag) {
+ this.a(GenericAttributes.a).a(20.0D);
+ } else {
+ this.a(GenericAttributes.a).a(8.0D);
+ }
+ }
+
+ public boolean a(EntityHuman entityhuman) {
ItemStack itemstack = entityhuman.inventory.getItemInHand();
if (this.isTamed()) {
@@ -193,12 +222,12 @@ public class EntityWolf extends EntityTameableAnimal {
if (Item.byId[itemstack.id] instanceof ItemFood) {
ItemFood itemfood = (ItemFood) Item.byId[itemstack.id];
- if (itemfood.i() && this.datawatcher.getInt(18) < 20) {
+ if (itemfood.j() && this.datawatcher.getFloat(18) < 20.0F) {
if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count;
}
- this.heal(itemfood.getNutrition());
+ this.heal((float) itemfood.getNutrition());
if (itemstack.count <= 0) {
entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null);
}
@@ -206,7 +235,7 @@ public class EntityWolf extends EntityTameableAnimal {
return true;
}
} else if (itemstack.id == Item.INK_SACK.id) {
- int i = BlockCloth.g_(itemstack.getData());
+ int i = BlockCloth.j_(itemstack.getData());
if (i != this.getCollarColor()) {
this.setCollarColor(i);
@@ -219,9 +248,9 @@ public class EntityWolf extends EntityTameableAnimal {
}
}
- if (entityhuman.name.equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.c(itemstack)) {
- this.d.setSitting(!this.isSitting());
- this.bG = false;
+ if (entityhuman.getName().equalsIgnoreCase(this.getOwnerName()) && !this.world.isStatic && !this.c(itemstack)) {
+ this.bp.setSitting(!this.isSitting());
+ this.bd = false;
this.setPathEntity((PathEntity) null);
}
} else if (itemstack != null && itemstack.id == Item.BONE.id && !this.isAngry()) {
@@ -240,18 +269,18 @@ public class EntityWolf extends EntityTameableAnimal {
this.setTamed(true);
this.setPathEntity((PathEntity) null);
this.setGoalTarget((EntityLiving) null);
- this.d.setSitting(true);
+ this.bp.setSitting(true);
// CraftBukkit start
if (updateMaxHealth) {
this.maxHealth = this.getMaxHealth();
}
this.setHealth(this.maxHealth);
// CraftBukkit end
- this.setOwnerName(entityhuman.name);
- this.i(true);
+ this.setOwnerName(entityhuman.getName());
+ this.j(true);
this.world.broadcastEntityEffect(this, (byte) 7);
} else {
- this.i(false);
+ this.j(false);
this.world.broadcastEntityEffect(this, (byte) 6);
}
}
@@ -259,14 +288,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());
+ return itemstack == null ? false : (!(Item.byId[itemstack.id] instanceof ItemFood) ? false : ((ItemFood) Item.byId[itemstack.id]).j());
}
- public int by() {
+ public int br() {
return 8;
}
@@ -304,9 +333,7 @@ public class EntityWolf extends EntityTameableAnimal {
return entitywolf;
}
- public void m(boolean flag) {
- byte b0 = this.datawatcher.getByte(19);
-
+ public void n(boolean flag) {
if (flag) {
this.datawatcher.watch(19, Byte.valueOf((byte) 1));
} else {
@@ -324,14 +351,18 @@ public class EntityWolf extends EntityTameableAnimal {
} else {
EntityWolf entitywolf = (EntityWolf) entityanimal;
- return !entitywolf.isTamed() ? false : (entitywolf.isSitting() ? false : this.r() && entitywolf.r());
+ return !entitywolf.isTamed() ? false : (entitywolf.isSitting() ? false : this.bU() && entitywolf.bU());
}
}
- public boolean bY() {
+ public boolean ca() {
return this.datawatcher.getByte(19) == 1;
}
+ protected boolean isTypeNotPersistent() {
+ return !this.isTamed() && this.ticksLived > 2400;
+ }
+
public EntityAgeable createChild(EntityAgeable entityageable) {
return this.b(entityageable);
}
diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java
index 352127d0..75ca31c0 100644
--- a/src/main/java/net/minecraft/server/EntityZombie.java
+++ b/src/main/java/net/minecraft/server/EntityZombie.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import java.util.Calendar;
+import java.util.UUID;
//CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftLivingEntity;
@@ -10,34 +11,35 @@ import org.bukkit.event.entity.EntityCombustEvent;
public class EntityZombie extends EntityMonster {
- private int d = 0;
+ protected static final IAttribute bp = (new AttributeRanged("zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance");
+ private static final UUID bq = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836");
+ private static final AttributeModifier br = new AttributeModifier(bq, "Baby speed boost", 0.5D, 0);
+ private int bs;
private int lastTick = MinecraftServer.currentTick; // CraftBukkit
public EntityZombie(World world) {
super(world);
- this.texture = "/mob/zombie.png";
- 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.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(2, new PathfinderGoalMeleeAttack(this, EntityHuman.class, 1.0D, false));
+ this.goalSelector.a(3, new PathfinderGoalMeleeAttack(this, EntityVillager.class, 1.0D, true));
+ this.goalSelector.a(4, new PathfinderGoalMoveTowardsRestriction(this, 1.0D));
+ this.goalSelector.a(5, new PathfinderGoalMoveThroughVillage(this, 1.0D, false));
+ this.goalSelector.a(6, new PathfinderGoalRandomStroll(this, 1.0D));
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, 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));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityHuman.class, 0, true));
+ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget(this, EntityVillager.class, 0, false));
}
- protected int ay() {
- return 40;
- }
-
- public float bE() {
- return super.bE() * (this.isBaby() ? 1.5F : 1.0F);
+ protected void ax() {
+ super.ax();
+ this.a(GenericAttributes.b).a(40.0D);
+ this.a(GenericAttributes.d).a(0.23000000417232513D);
+ this.a(GenericAttributes.e).a(3.0D);
+ this.aT().b(bp).a(this.random.nextDouble() * 0.10000000149011612D);
}
protected void a() {
@@ -47,12 +49,8 @@ public class EntityZombie extends EntityMonster {
this.getDataWatcher().a(14, Byte.valueOf((byte) 0));
}
- public int getMaxHealth() {
- return 20;
- }
-
- public int aZ() {
- int i = super.aZ() + 2;
+ public int aM() {
+ int i = super.aM() + 2;
if (i > 20) {
i = 20;
@@ -61,7 +59,7 @@ public class EntityZombie extends EntityMonster {
return i;
}
- protected boolean bh() {
+ protected boolean bb() {
return true;
}
@@ -70,7 +68,15 @@ public class EntityZombie extends EntityMonster {
}
public void setBaby(boolean flag) {
- this.getDataWatcher().watch(12, Byte.valueOf((byte) (flag ? 1 : 0))); // CraftBukkit - added flag
+ this.getDataWatcher().watch(12, Byte.valueOf((byte) (flag ? 1 : 0)));
+ if (this.world != null && !this.world.isStatic) {
+ AttributeInstance attributeinstance = this.a(GenericAttributes.d);
+
+ attributeinstance.b(br);
+ if (flag) {
+ attributeinstance.a(br);
+ }
+ }
}
public boolean isVillager() {
@@ -83,7 +89,7 @@ public class EntityZombie extends EntityMonster {
public void c() {
if (this.world.v() && !this.world.isStatic && !this.isBaby()) {
- float f = this.c(1.0F);
+ float f = this.d(1.0F);
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;
@@ -117,9 +123,52 @@ public class EntityZombie extends EntityMonster {
super.c();
}
+ public boolean damageEntity(DamageSource damagesource, float f) {
+ if (!super.damageEntity(damagesource, f)) {
+ return false;
+ } else {
+ EntityLiving entityliving = this.getGoalTarget();
+
+ if (entityliving == null && this.bJ() instanceof EntityLiving) {
+ entityliving = (EntityLiving) this.bJ();
+ }
+
+ if (entityliving == null && damagesource.getEntity() instanceof EntityLiving) {
+ entityliving = (EntityLiving) damagesource.getEntity();
+ }
+
+ if (entityliving != null && this.world.difficulty >= 3 && (double) this.random.nextFloat() < this.a(bp).e()) {
+ int i = MathHelper.floor(this.locX);
+ int j = MathHelper.floor(this.locY);
+ int k = MathHelper.floor(this.locZ);
+ EntityZombie entityzombie = new EntityZombie(this.world);
+
+ for (int l = 0; l < 50; ++l) {
+ int i1 = i + MathHelper.nextInt(this.random, 7, 40) * MathHelper.nextInt(this.random, -1, 1);
+ int j1 = j + MathHelper.nextInt(this.random, 7, 40) * MathHelper.nextInt(this.random, -1, 1);
+ int k1 = k + MathHelper.nextInt(this.random, 7, 40) * MathHelper.nextInt(this.random, -1, 1);
+
+ if (this.world.w(i1, j1 - 1, k1) && this.world.getLightLevel(i1, j1, k1) < 10) {
+ entityzombie.setPosition((double) i1, (double) j1, (double) k1);
+ if (this.world.b(entityzombie.boundingBox) && this.world.getCubes(entityzombie, entityzombie.boundingBox).isEmpty() && !this.world.containsLiquid(entityzombie.boundingBox)) {
+ this.world.addEntity(entityzombie);
+ entityzombie.setGoalTarget(entityliving);
+ entityzombie.a((GroupDataEntity) null);
+ this.a(bp).a(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
+ entityzombie.a(bp).a(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0));
+ break;
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+ }
+
public void l_() {
- if (!this.world.isStatic && this.o()) {
- int i = this.q();
+ if (!this.world.isStatic && this.bR()) {
+ int i = this.bT();
// CraftBukkit start - Use wall time instead of ticks for villager conversion
int elapsedTicks = MinecraftServer.currentTick - this.lastTick;
@@ -127,9 +176,9 @@ public class EntityZombie extends EntityMonster {
i *= elapsedTicks;
// CraftBukkit end
- this.d -= i;
- if (this.d <= 0) {
- this.p();
+ this.bs -= i;
+ if (this.bs <= 0) {
+ this.bS();
}
}
@@ -139,7 +188,7 @@ public class EntityZombie extends EntityMonster {
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) {
+ if (flag && this.aV() == null && this.isBurning() && this.random.nextFloat() < (float) this.world.difficulty * 0.3F) {
// CraftBukkit start
EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * this.world.difficulty);
this.world.getServer().getPluginManager().callEvent(event);
@@ -153,28 +202,15 @@ public class EntityZombie extends EntityMonster {
return flag;
}
- public int c(Entity entity) {
- ItemStack itemstack = this.bG();
- // CraftBukkit - getMaxHealth() -> ((CraftLivingEntity) this.bukkitEntity).getMaxHealth()
- float f = (float) (((CraftLivingEntity) this.bukkitEntity).getMaxHealth() - this.getHealth()) / (float) ((CraftLivingEntity) this.bukkitEntity).getMaxHealth();
- int i = 3 + MathHelper.d(f * 4.0F);
-
- if (itemstack != null) {
- i += itemstack.a((Entity) this);
- }
-
- return i;
- }
-
- protected String bb() {
+ protected String r() {
return "mob.zombie.say";
}
- protected String bc() {
+ protected String aK() {
return "mob.zombie.hurt";
}
- protected String bd() {
+ protected String aL() {
return "mob.zombie.death";
}
@@ -205,8 +241,8 @@ public class EntityZombie extends EntityMonster {
}
// CraftBukkit end
- protected void bH() {
- super.bH();
+ protected void bs() {
+ super.bs();
if (this.random.nextFloat() < (this.world.difficulty == 3 ? 0.05F : 0.01F)) {
int i = this.random.nextInt(3);
@@ -228,7 +264,7 @@ public class EntityZombie extends EntityMonster {
nbttagcompound.setBoolean("IsVillager", true);
}
- nbttagcompound.setInt("ConversionTime", this.o() ? this.d : -1);
+ nbttagcompound.setInt("ConversionTime", this.bR() ? this.bs : -1);
}
public void a(NBTTagCompound nbttagcompound) {
@@ -255,9 +291,9 @@ public class EntityZombie extends EntityMonster {
EntityZombie entityzombie = new EntityZombie(this.world);
- entityzombie.k(entityliving);
+ entityzombie.j(entityliving);
this.world.kill(entityliving);
- entityzombie.bJ();
+ entityzombie.a((GroupDataEntity) null);
entityzombie.setVillager(true);
if (entityliving.isBaby()) {
entityzombie.setBaby(true);
@@ -268,26 +304,38 @@ public class EntityZombie extends EntityMonster {
}
}
- public void bJ() {
- this.h(this.random.nextFloat() < au[this.world.difficulty]);
+ public GroupDataEntity a(GroupDataEntity groupdataentity) {
+ groupdataentity = super.a(groupdataentity);
+ float f = this.world.b(this.locX, this.locY, this.locZ);
+
+ this.h(this.random.nextFloat() < 0.55F * f);
if (this.world.random.nextFloat() < 0.05F) {
this.setVillager(true);
}
- this.bH();
- this.bI();
+ this.bs();
+ this.bt();
if (this.getEquipment(4) == null) {
- Calendar calendar = this.world.V();
+ Calendar calendar = this.world.W();
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));
this.dropChances[4] = 0.0F;
}
}
+
+ this.a(GenericAttributes.c).a(new AttributeModifier("Random spawn bonus", this.random.nextDouble() * 0.05000000074505806D, 0));
+ this.a(GenericAttributes.b).a(new AttributeModifier("Random zombie-spawn bonus", this.random.nextDouble() * 1.5D, 2));
+ if (this.random.nextFloat() < f * 0.05F) {
+ this.a(bp).a(new AttributeModifier("Leader zombie bonus", this.random.nextDouble() * 0.25D + 0.5D, 0));
+ this.a(GenericAttributes.a).a(new AttributeModifier("Leader zombie bonus", this.random.nextDouble() * 3.0D + 1.0D, 2));
+ }
+
+ return groupdataentity;
}
- public boolean a_(EntityHuman entityhuman) {
- ItemStack itemstack = entityhuman.cd();
+ public boolean a(EntityHuman entityhuman) {
+ ItemStack itemstack = entityhuman.bt();
if (itemstack != null && itemstack.getItem() == Item.GOLDEN_APPLE && itemstack.getData() == 0 && this.isVillager() && this.hasEffect(MobEffectList.WEAKNESS)) {
if (!entityhuman.abilities.canInstantlyBuild) {
@@ -309,23 +357,27 @@ public class EntityZombie extends EntityMonster {
}
protected void a(int i) {
- this.d = i;
+ this.bs = i;
this.getDataWatcher().watch(14, Byte.valueOf((byte) 1));
- this.o(MobEffectList.WEAKNESS.id);
+ this.k(MobEffectList.WEAKNESS.id);
this.addEffect(new MobEffect(MobEffectList.INCREASE_DAMAGE.id, i, Math.min(this.world.difficulty - 1, 0)));
this.world.broadcastEntityEffect(this, (byte) 16);
}
- public boolean o() {
+ protected boolean isTypeNotPersistent() {
+ return !this.bR();
+ }
+
+ public boolean bR() {
return this.getDataWatcher().getByte(14) == 1;
}
- protected void p() {
+ protected void bS() {
EntityVillager entityvillager = new EntityVillager(this.world);
- entityvillager.k(this);
- entityvillager.bJ();
- entityvillager.q();
+ entityvillager.j(this);
+ entityvillager.a((GroupDataEntity) null);
+ entityvillager.bT();
if (this.isBaby()) {
entityvillager.setAge(-24000);
}
@@ -336,7 +388,7 @@ public class EntityZombie extends EntityMonster {
this.world.a((EntityHuman) null, 1017, (int) this.locX, (int) this.locY, (int) this.locZ, 0);
}
- protected int q() {
+ protected int bT() {
int i = 1;
if (this.random.nextFloat() < 0.01F) {
diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java
index ef220c1f..758d447b 100644
--- a/src/main/java/net/minecraft/server/Explosion.java
+++ b/src/main/java/net/minecraft/server/Explosion.java
@@ -19,7 +19,7 @@ import org.bukkit.Location;
public class Explosion {
- public boolean a = false;
+ public boolean a;
public boolean b = true;
private int i = 16;
private Random j = new Random();
@@ -133,7 +133,7 @@ public class Explosion {
// CraftBukkit start - Explosion damage hook
org.bukkit.entity.Entity damagee = (entity == null) ? null : entity.getBukkitEntity();
- int damageDone = (int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.size + 1.0D);
+ float damageDone = (float) ((int) ((d10 * d10 + d10) / 2.0D * 8.0D * (double) this.size + 1.0D));
if (damagee == null) {
// nothing was hurt
@@ -143,7 +143,7 @@ public class Explosion {
if (!event.isCancelled()) {
damagee.setLastDamageCause(event);
- entity.damageEntity(DamageSource.explosion(this), event.getDamage());
+ entity.damageEntity(DamageSource.explosion(this), (float) 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(this), event.getDamage());
+ entity.damageEntity(DamageSource.explosion(this), (float) event.getDamage());
entity.motX += d0 * d10;
entity.motY += d1 * d10;
@@ -287,7 +287,7 @@ public class Explosion {
l = this.world.getTypeId(i, j, k);
int i1 = this.world.getTypeId(i, j - 1, k);
- if (l == 0 && Block.s[i1] && this.j.nextInt(3) == 0) {
+ if (l == 0 && Block.t[i1] && this.j.nextInt(3) == 0) {
// CraftBukkit start - Ignition by explosion
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.world, i, j, k, this).isCancelled()) {
this.world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java
index f26d5522..543a430a 100644
--- a/src/main/java/net/minecraft/server/FoodMetaData.java
+++ b/src/main/java/net/minecraft/server/FoodMetaData.java
@@ -8,7 +8,7 @@ public class FoodMetaData {
public int foodLevel = 20;
public float saturationLevel = 5.0F;
public float exhaustionLevel;
- public int foodTickTimer = 0;
+ public int foodTickTimer;
// CraftBukkit end
private int e = 20;
@@ -44,18 +44,18 @@ public class FoodMetaData {
}
}
- if (this.foodLevel >= 18 && entityhuman.co()) {
+ if (entityhuman.world.getGameRules().getBoolean("naturalRegeneration") && this.foodLevel >= 18 && entityhuman.bE()) {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
// CraftBukkit - added RegainReason
- entityhuman.heal(1, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED);
+ entityhuman.heal(1.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.SATIATED);
this.foodTickTimer = 0;
}
} else if (this.foodLevel <= 0) {
++this.foodTickTimer;
if (this.foodTickTimer >= 80) {
- if (entityhuman.getHealth() > 10 || i >= 3 || entityhuman.getHealth() > 1 && i >= 2) {
- entityhuman.damageEntity(DamageSource.STARVE, 1);
+ if (entityhuman.getHealth() > 10.0F || i >= 3 || entityhuman.getHealth() > 1.0F && i >= 2) {
+ entityhuman.damageEntity(DamageSource.STARVE, 1.0F);
}
this.foodTickTimer = 0;
diff --git a/src/main/java/net/minecraft/server/InventoryHorseChest.java b/src/main/java/net/minecraft/server/InventoryHorseChest.java
new file mode 100644
index 00000000..1fa3d5f4
--- /dev/null
+++ b/src/main/java/net/minecraft/server/InventoryHorseChest.java
@@ -0,0 +1,55 @@
+package net.minecraft.server;
+
+// CraftBukkit start
+import java.util.List;
+import org.bukkit.craftbukkit.entity.CraftHumanEntity;
+import org.bukkit.entity.HumanEntity;
+// CraftBukkit end
+
+public class InventoryHorseChest extends InventorySubcontainer {
+
+ public InventoryHorseChest(String s, int i) {
+ super(s, false, i);
+ }
+
+ // CraftBukkit start
+ public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
+ public org.bukkit.entity.Player player;
+ private int maxStack = MAX_STACK;
+
+ @Override
+ public ItemStack[] getContents() {
+ return this.items;
+ }
+
+ @Override
+ public void onOpen(CraftHumanEntity who) {
+ transaction.add(who);
+ }
+
+ @Override
+ public void onClose(CraftHumanEntity who) {
+ transaction.remove(who);
+ }
+
+ @Override
+ public List<HumanEntity> getViewers() {
+ return transaction;
+ }
+
+ @Override
+ public org.bukkit.inventory.InventoryHolder getOwner() {
+ return this.player;
+ }
+
+ @Override
+ public void setMaxStackSize(int size) {
+ maxStack = size;
+ }
+
+ @Override
+ public int getMaxStackSize() {
+ return maxStack;
+ }
+ // CraftBukkit end
+} \ No newline at end of file
diff --git a/src/main/java/net/minecraft/server/InventoryMerchant.java b/src/main/java/net/minecraft/server/InventoryMerchant.java
index d89bcb30..9ab8fdc5 100644
--- a/src/main/java/net/minecraft/server/InventoryMerchant.java
+++ b/src/main/java/net/minecraft/server/InventoryMerchant.java
@@ -177,6 +177,8 @@ public class InventoryMerchant implements IInventory {
}
}
}
+
+ this.merchant.a_(this.getItem(2));
}
public MerchantRecipe getRecipe() {
diff --git a/src/main/java/net/minecraft/server/InventorySubcontainer.java b/src/main/java/net/minecraft/server/InventorySubcontainer.java
index c288380c..825d5ac9 100644
--- a/src/main/java/net/minecraft/server/InventorySubcontainer.java
+++ b/src/main/java/net/minecraft/server/InventorySubcontainer.java
@@ -1,5 +1,6 @@
package net.minecraft.server;
+import java.util.ArrayList;
import java.util.List;
public abstract class InventorySubcontainer implements IInventory { // CraftBukkit - abstract
@@ -17,6 +18,18 @@ public abstract class InventorySubcontainer implements IInventory { // CraftBukk
this.items = new ItemStack[i];
}
+ public void a(IInventoryListener iinventorylistener) {
+ if (this.d == null) {
+ this.d = new ArrayList();
+ }
+
+ this.d.add(iinventorylistener);
+ }
+
+ public void b(IInventoryListener iinventorylistener) {
+ this.d.remove(iinventorylistener);
+ }
+
public ItemStack getItem(int i) {
return this.items[i];
}
@@ -76,6 +89,11 @@ public abstract class InventorySubcontainer implements IInventory { // CraftBukk
return this.e;
}
+ public void a(String s) {
+ this.e = true;
+ this.a = s;
+ }
+
public int getMaxStackSize() {
return 64;
}
diff --git a/src/main/java/net/minecraft/server/ItemBed.java b/src/main/java/net/minecraft/server/ItemBed.java
index 311fa730..f72133d6 100644
--- a/src/main/java/net/minecraft/server/ItemBed.java
+++ b/src/main/java/net/minecraft/server/ItemBed.java
@@ -37,7 +37,7 @@ 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.w(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.w(i + b0, j - 1, k + b1)) {
// CraftBukkit start
// world.setTypeIdAndData(i, j, k, blockbed.id, i1, 3);
if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, blockbed.id, i1, clickedX, clickedY, clickedZ)) {
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
index 01c06af2..b2c3ed8d 100644
--- a/src/main/java/net/minecraft/server/ItemBlock.java
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
@@ -14,7 +14,7 @@ public class ItemBlock extends Item {
}
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;
+ final int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
int i1 = world.getTypeId(i, j, k);
if (i1 == Block.SNOW.id && (world.getData(i, j, k) & 7) < 1) {
@@ -67,6 +67,8 @@ public class ItemBlock extends Item {
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 processBlockPlace(world, entityhuman, itemstack, i, j, k, this.id, k1, clickedX, clickedY, clickedZ);
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/server/ItemBoat.java b/src/main/java/net/minecraft/server/ItemBoat.java
index 494c4d31..4ebf389e 100644
--- a/src/main/java/net/minecraft/server/ItemBoat.java
+++ b/src/main/java/net/minecraft/server/ItemBoat.java
@@ -31,7 +31,7 @@ public class ItemBoat extends Item {
if (movingobjectposition == null) {
return itemstack;
} else {
- Vec3D vec3d2 = entityhuman.i(f);
+ Vec3D vec3d2 = entityhuman.j(f);
boolean flag = false;
float f9 = 1.0F;
List list = world.getEntities(entityhuman, entityhuman.boundingBox.a(vec3d2.c * d3, vec3d2.d * d3, vec3d2.e * d3).grow((double) f9, (double) f9, (double) f9));
diff --git a/src/main/java/net/minecraft/server/ItemBow.java b/src/main/java/net/minecraft/server/ItemBow.java
index ad34840d..7b0bb510 100644
--- a/src/main/java/net/minecraft/server/ItemBow.java
+++ b/src/main/java/net/minecraft/server/ItemBow.java
@@ -2,7 +2,7 @@ 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 static final String[] a = new String[] { "pulling_0", "pulling_1", "pulling_2"};
public ItemBow(int i) {
super(i);
@@ -15,7 +15,7 @@ public class ItemBow extends Item {
boolean flag = entityhuman.abilities.canInstantlyBuild || EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_INFINITE.id, itemstack) > 0;
if (flag || entityhuman.inventory.e(Item.ARROW.id)) {
- int j = this.c_(itemstack) - i;
+ int j = this.d_(itemstack) - i;
float f = (float) j / 20.0F;
f = (f * f + f * 2.0F) / 3.0F;
@@ -62,7 +62,7 @@ public class ItemBow extends Item {
// CraftBukkit end
itemstack.damage(1, entityhuman);
- world.makeSound(entityhuman, "random.bow", 1.0F, 1.0F / (e.nextFloat() * 0.4F + 1.2F) + f * 0.5F);
+ world.makeSound(entityhuman, "random.bow", 1.0F, 1.0F / (Item.f.nextFloat() * 0.4F + 1.2F) + f * 0.5F); // CraftBukkit - Fix compilation
if (flag) {
entityarrow.fromPlayer = 2;
} else {
@@ -76,17 +76,17 @@ public class ItemBow extends Item {
return itemstack;
}
- public int c_(ItemStack itemstack) {
+ public int d_(ItemStack itemstack) {
return 72000;
}
- public EnumAnimation b_(ItemStack itemstack) {
+ public EnumAnimation c_(ItemStack itemstack) {
return EnumAnimation.BOW;
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
if (entityhuman.abilities.canInstantlyBuild || entityhuman.inventory.e(Item.ARROW.id)) {
- entityhuman.a(itemstack, this.c_(itemstack));
+ entityhuman.a(itemstack, this.d_(itemstack));
}
return itemstack;
diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java
index ecab05b2..86522a76 100644
--- a/src/main/java/net/minecraft/server/ItemBucket.java
+++ b/src/main/java/net/minecraft/server/ItemBucket.java
@@ -19,10 +19,6 @@ public class ItemBucket extends Item {
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
- float f = 1.0F;
- double d0 = entityhuman.lastX + (entityhuman.locX - entityhuman.lastX) * (double) f;
- double d1 = entityhuman.lastY + (entityhuman.locY - entityhuman.lastY) * (double) f + 1.62D - (double) entityhuman.height;
- double d2 = entityhuman.lastZ + (entityhuman.locZ - entityhuman.lastZ) * (double) f;
boolean flag = this.a == 0;
MovingObjectPosition movingobjectposition = this.a(world, entityhuman, flag);
@@ -143,44 +139,41 @@ public class ItemBucket extends Item {
}
// CraftBukkit end
- if (this.a(world, d0, d1, d2, i, j, k) && !entityhuman.abilities.canInstantlyBuild) {
+ if (this.a(world, i, j, k) && !entityhuman.abilities.canInstantlyBuild) {
return CraftItemStack.asNMSCopy(event.getItemStack()); // CraftBukkit
}
}
- } else if (this.a == 0 && movingobjectposition.entity instanceof EntityCow) {
- // CraftBukkit start - This codepath seems to be *NEVER* called
- org.bukkit.Location loc = movingobjectposition.entity.getBukkitEntity().getLocation();
- PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(entityhuman, loc.getBlockX(), loc.getBlockY(), loc.getBlockZ(), -1, itemstack, Item.MILK_BUCKET);
-
- if (event.isCancelled()) {
- return itemstack;
- }
-
- return CraftItemStack.asNMSCopy(event.getItemStack());
- // CraftBukkit end
}
return itemstack;
}
}
- public boolean a(World world, double d0, double d1, double d2, int i, int j, int k) {
+ public boolean a(World world, int i, int j, int k) {
if (this.a <= 0) {
return false;
- } else if (!world.isEmpty(i, j, k) && world.getMaterial(i, j, k).isBuildable()) {
- return false;
} else {
- if (world.worldProvider.e && this.a == Block.WATER.id) {
- world.makeSound(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F);
+ boolean flag = !world.getMaterial(i, j, k).isBuildable();
- for (int l = 0; l < 8; ++l) {
- world.addParticle("largesmoke", (double) i + Math.random(), (double) j + Math.random(), (double) k + Math.random(), 0.0D, 0.0D, 0.0D);
- }
+ if (!world.isEmpty(i, j, k) && !flag) {
+ return false;
} else {
- world.setTypeIdAndData(i, j, k, this.a, 0, 3);
- }
+ if (!world.isStatic && flag) {
+ world.setAir(i, j, k, true);
+ }
+
+ if (world.worldProvider.f && this.a == Block.WATER.id) {
+ 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);
- return true;
+ for (int l = 0; l < 8; ++l) {
+ 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, 3);
+ }
+
+ return true;
+ }
}
}
}
diff --git a/src/main/java/net/minecraft/server/ItemDoor.java b/src/main/java/net/minecraft/server/ItemDoor.java
index 438a69ad..708fcf8e 100644
--- a/src/main/java/net/minecraft/server/ItemDoor.java
+++ b/src/main/java/net/minecraft/server/ItemDoor.java
@@ -86,7 +86,7 @@ public class ItemDoor extends Item {
// CraftBukkit start
if (entityhuman != null) {
- if(!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, block.id, l, clickedX, clickedY, clickedZ)) {
+ if (!ItemBlock.processBlockPlace(world, entityhuman, null, i, j, k, block.id, l, clickedX, clickedY, clickedZ)) {
((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet53BlockChange(i, j + 1, k, world));
return false;
}
diff --git a/src/main/java/net/minecraft/server/ItemDye.java b/src/main/java/net/minecraft/server/ItemDye.java
index cb971d74..d0ffd84f 100644
--- a/src/main/java/net/minecraft/server/ItemDye.java
+++ b/src/main/java/net/minecraft/server/ItemDye.java
@@ -8,7 +8,7 @@ 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 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 String[] b = new String[] { "black", "red", "green", "brown", "blue", "purple", "cyan", "silver", "gray", "pink", "lime", "yellow", "light_blue", "magenta", "orange", "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) {
@@ -29,7 +29,7 @@ public class ItemDye extends Item {
return false;
} else {
if (itemstack.getData() == 15) {
- if (a(itemstack, world, i, j, k, entityhuman)) {
+ if (a(itemstack, world, i, j, k)) {
if (!world.isStatic) {
world.triggerEffect(2005, i, j, k, 0);
}
@@ -40,7 +40,7 @@ public class ItemDye extends Item {
int i1 = world.getTypeId(i, j, k);
int j1 = world.getData(i, j, k);
- if (i1 == Block.LOG.id && BlockLog.d(j1) == 3) {
+ if (i1 == Block.LOG.id && BlockLog.f(j1) == 3) {
if (l == 0) {
return false;
}
@@ -67,6 +67,7 @@ public class ItemDye extends Item {
if (world.isEmpty(i, j, k)) {
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;
@@ -149,20 +150,20 @@ public class ItemDye extends Item {
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;
+ j1 += f.nextInt(3) - 1;
+ k1 += (f.nextInt(3) - 1) * f.nextInt(3) / 2;
+ l1 += f.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 (f.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) {
+ } else if (f.nextInt(3) != 0) {
if (Block.YELLOW_FLOWER.f(world, j1, k1, l1)) {
world.setTypeIdUpdate(j1, k1, l1, Block.YELLOW_FLOWER.id);
}
@@ -190,8 +191,8 @@ public class ItemDye extends Item {
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);
+ 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 not cancelled by a plugin
@@ -202,10 +203,10 @@ public class ItemDye extends Item {
}
}
- public boolean a(ItemStack itemstack, EntityLiving entityliving) {
+ public boolean a(ItemStack itemstack, EntityHuman entityhuman, EntityLiving entityliving) {
if (entityliving instanceof EntitySheep) {
EntitySheep entitysheep = (EntitySheep) entityliving;
- int i = BlockCloth.g_(itemstack.getData());
+ int i = BlockCloth.j_(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 81777fcf..3145c943 100644
--- a/src/main/java/net/minecraft/server/ItemFireball.java
+++ b/src/main/java/net/minecraft/server/ItemFireball.java
@@ -50,7 +50,7 @@ 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, e.nextFloat() * 0.4F + 0.8F);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, Item.f.nextFloat() * 0.4F + 0.8F); // CraftBukkit - Fix compilation
world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
}
diff --git a/src/main/java/net/minecraft/server/ItemFishingRod.java b/src/main/java/net/minecraft/server/ItemFishingRod.java
index 7b92c92f..eb510781 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.bK();
+ entityhuman.aR();
} else {
// CraftBukkit start
EntityFishingHook hook = new EntityFishingHook(world, entityhuman);
@@ -27,13 +27,12 @@ public class ItemFishingRod extends Item {
return itemstack;
}
// CraftBukkit end
-
- world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (e.nextFloat() * 0.4F + 0.8F));
+ world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (f.nextFloat() * 0.4F + 0.8F));
if (!world.isStatic) {
world.addEntity(hook); // CraftBukkit - moved creation up
}
- entityhuman.bK();
+ entityhuman.aR();
}
return itemstack;
diff --git a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
index 3f106a5e..e2d0a141 100644
--- a/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
+++ b/src/main/java/net/minecraft/server/ItemFlintAndSteel.java
@@ -56,7 +56,7 @@ 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, e.nextFloat() * 0.4F + 0.8F);
+ world.makeSound((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D, "fire.ignite", 1.0F, Item.f.nextFloat() * 0.4F + 0.8F); // CraftBukkit - fix compilation
world.setTypeIdUpdate(i, j, k, Block.FIRE.id);
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/ItemFood.java b/src/main/java/net/minecraft/server/ItemFood.java
index 409addf8..5b77fc72 100644
--- a/src/main/java/net/minecraft/server/ItemFood.java
+++ b/src/main/java/net/minecraft/server/ItemFood.java
@@ -6,11 +6,11 @@ public class ItemFood extends Item {
private final int b;
private final float c;
private final boolean d;
- private boolean cu;
- private int cv;
- private int cw;
- private int cx;
- private float cy;
+ private boolean cB;
+ private int cC;
+ private int cD;
+ private int cE;
+ private float cF;
public ItemFood(int i, int j, float f, boolean flag) {
super(i);
@@ -39,28 +39,29 @@ public class ItemFood extends Item {
((EntityPlayer) entityhuman).playerConnection.sendPacket(new Packet8UpdateHealth(entityhuman.getHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel));
// CraftBukkit end
+ entityhuman.getFoodData().a(this);
world.makeSound(entityhuman, "random.burp", 0.5F, world.random.nextFloat() * 0.1F + 0.9F);
this.c(itemstack, world, entityhuman);
return itemstack;
}
protected void c(ItemStack itemstack, World world, EntityHuman entityhuman) {
- if (!world.isStatic && this.cv > 0 && world.random.nextFloat() < this.cy) {
- entityhuman.addEffect(new MobEffect(this.cv, this.cw * 20, this.cx));
+ if (!world.isStatic && this.cC > 0 && world.random.nextFloat() < this.cF) {
+ entityhuman.addEffect(new MobEffect(this.cC, this.cD * 20, this.cE));
}
}
- public int c_(ItemStack itemstack) {
+ public int d_(ItemStack itemstack) {
return 32;
}
- public EnumAnimation b_(ItemStack itemstack) {
+ public EnumAnimation c_(ItemStack itemstack) {
return EnumAnimation.EAT;
}
public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
- if (entityhuman.i(this.cu)) {
- entityhuman.a(itemstack, this.c_(itemstack));
+ if (entityhuman.g(this.cB)) {
+ entityhuman.a(itemstack, this.d_(itemstack));
}
return itemstack;
@@ -74,20 +75,20 @@ public class ItemFood extends Item {
return this.c;
}
- public boolean i() {
+ public boolean j() {
return this.d;
}
public ItemFood a(int i, int j, int k, float f) {
- this.cv = i;
- this.cw = j;
- this.cx = k;
- this.cy = f;
+ this.cC = i;
+ this.cD = j;
+ this.cE = k;
+ this.cF = f;
return this;
}
- public ItemFood j() {
- this.cu = true;
+ public ItemFood k() {
+ this.cB = true;
return this;
}
}
diff --git a/src/main/java/net/minecraft/server/ItemHanging.java b/src/main/java/net/minecraft/server/ItemHanging.java
index 27d4c259..bfcd283d 100644
--- a/src/main/java/net/minecraft/server/ItemHanging.java
+++ b/src/main/java/net/minecraft/server/ItemHanging.java
@@ -39,7 +39,7 @@ public class ItemHanging extends Item {
world.getServer().getPluginManager().callEvent(event);
PaintingPlaceEvent paintingEvent = null;
- if(entityhanging instanceof EntityPainting) {
+ if (entityhanging instanceof EntityPainting) {
// Fire old painting event until it can be removed
paintingEvent = new PaintingPlaceEvent((org.bukkit.entity.Painting) entityhanging.getBukkitEntity(), who, blockClicked, blockFace);
paintingEvent.setCancelled(event.isCancelled());
diff --git a/src/main/java/net/minecraft/server/ItemHoe.java b/src/main/java/net/minecraft/server/ItemHoe.java
index aa96737e..4d216e83 100644
--- a/src/main/java/net/minecraft/server/ItemHoe.java
+++ b/src/main/java/net/minecraft/server/ItemHoe.java
@@ -20,9 +20,7 @@ public class ItemHoe extends Item {
int i1 = world.getTypeId(i, j, k);
int j1 = world.getTypeId(i, j + 1, k);
- if ((l == 0 || j1 != 0 || i1 != Block.GRASS.id) && i1 != Block.DIRT.id) {
- return false;
- } else {
+ if (l != 0 && j1 == 0 && (i1 == Block.GRASS.id || i1 == Block.DIRT.id)) {
Block block = Block.SOIL;
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), block.stepSound.getStepSound(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
@@ -39,6 +37,8 @@ public class ItemHoe extends Item {
itemstack.damage(1, entityhuman);
return true;
}
+ } else {
+ return false;
}
}
}
diff --git a/src/main/java/net/minecraft/server/ItemMinecart.java b/src/main/java/net/minecraft/server/ItemMinecart.java
index b4320456..5df0c320 100644
--- a/src/main/java/net/minecraft/server/ItemMinecart.java
+++ b/src/main/java/net/minecraft/server/ItemMinecart.java
@@ -16,7 +16,7 @@ public class ItemMinecart extends Item {
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.d_(i1)) {
+ if (BlockMinecartTrackAbstract.e_(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);
diff --git a/src/main/java/net/minecraft/server/ItemMonsterEgg.java b/src/main/java/net/minecraft/server/ItemMonsterEgg.java
index a1fe7039..06967d8a 100644
--- a/src/main/java/net/minecraft/server/ItemMonsterEgg.java
+++ b/src/main/java/net/minecraft/server/ItemMonsterEgg.java
@@ -8,7 +8,7 @@ public class ItemMonsterEgg extends Item {
this.a(CreativeModeTab.f);
}
- public String i(ItemStack itemstack) {
+ public String l(ItemStack itemstack) {
String s = ("" + LocaleI18n.get(this.getName() + ".name")).trim();
String s1 = EntityTypes.b(itemstack.getData());
@@ -38,7 +38,7 @@ public class ItemMonsterEgg extends Item {
if (entity != null) {
if (entity instanceof EntityLiving && itemstack.hasName()) {
- ((EntityLiving) entity).setCustomName(itemstack.getName());
+ ((EntityInsentient) entity).setCustomName(itemstack.getName());
}
if (!entityhuman.abilities.canInstantlyBuild) {
@@ -50,6 +50,48 @@ public class ItemMonsterEgg extends Item {
}
}
+ public ItemStack a(ItemStack itemstack, World world, EntityHuman entityhuman) {
+ if (world.isStatic) {
+ return itemstack;
+ } else {
+ MovingObjectPosition movingobjectposition = this.a(world, entityhuman, true);
+
+ if (movingobjectposition == null) {
+ return itemstack;
+ } else {
+ if (movingobjectposition.type == EnumMovingObjectType.TILE) {
+ int i = movingobjectposition.b;
+ int j = movingobjectposition.c;
+ int k = movingobjectposition.d;
+
+ if (!world.a(entityhuman, i, j, k)) {
+ return itemstack;
+ }
+
+ if (!entityhuman.a(i, j, k, movingobjectposition.face, itemstack)) {
+ return itemstack;
+ }
+
+ if (world.getMaterial(i, j, k) == Material.WATER) {
+ Entity entity = a(world, itemstack.getData(), (double) i, (double) j, (double) k);
+
+ if (entity != null) {
+ if (entity instanceof EntityLiving && itemstack.hasName()) {
+ ((EntityInsentient) entity).setCustomName(itemstack.getName());
+ }
+
+ if (!entityhuman.abilities.canInstantlyBuild) {
+ --itemstack.count;
+ }
+ }
+ }
+ }
+
+ return itemstack;
+ }
+ }
+ }
+
public static Entity a(World world, int i, double d0, double d1, double d2) {
if (!EntityTypes.a.containsKey(Integer.valueOf(i))) {
return null;
@@ -59,14 +101,14 @@ public class ItemMonsterEgg extends Item {
for (int j = 0; j < 1; ++j) {
entity = EntityTypes.a(i, world);
if (entity != null && entity instanceof EntityLiving) {
- EntityLiving entityliving = (EntityLiving) entity;
+ EntityInsentient entityinsentient = (EntityInsentient) entity;
entity.setPositionRotation(d0, d1, d2, MathHelper.g(world.random.nextFloat() * 360.0F), 0.0F);
- entityliving.aA = entityliving.yaw;
- entityliving.ay = entityliving.yaw;
- entityliving.bJ();
+ entityinsentient.aP = entityinsentient.yaw;
+ entityinsentient.aN = entityinsentient.yaw;
+ entityinsentient.a((GroupDataEntity) null);
world.addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
- entityliving.aR();
+ entityinsentient.p();
}
}
diff --git a/src/main/java/net/minecraft/server/ItemSeeds.java b/src/main/java/net/minecraft/server/ItemSeeds.java
index bd1a46f1..381d028e 100644
--- a/src/main/java/net/minecraft/server/ItemSeeds.java
+++ b/src/main/java/net/minecraft/server/ItemSeeds.java
@@ -16,7 +16,7 @@ public class ItemSeeds extends Item {
final int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
if (l != 1) {
return false;
- } else if (entityhuman.e(i, j, k) && entityhuman.e(i, j + 1, k)) {
+ } else if (entityhuman.a(i, j, k, l, itemstack) && entityhuman.a(i, j + 1, k, l, itemstack)) {
int i1 = world.getTypeId(i, j, k);
if (i1 == this.b && world.isEmpty(i, j + 1, k)) {
diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java
index 9d8f8ffb..063f50b6 100644
--- a/src/main/java/net/minecraft/server/ItemSkull.java
+++ b/src/main/java/net/minecraft/server/ItemSkull.java
@@ -3,7 +3,7 @@ package net.minecraft.server;
public class ItemSkull extends Item {
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 static final String[] a = new String[] { "skeleton", "wither", "zombie", "steve", "creeper"};
public ItemSkull(int i) {
super(i);
diff --git a/src/main/java/net/minecraft/server/ItemSnow.java b/src/main/java/net/minecraft/server/ItemSnow.java
index 916aecc0..1cee156e 100644
--- a/src/main/java/net/minecraft/server/ItemSnow.java
+++ b/src/main/java/net/minecraft/server/ItemSnow.java
@@ -7,7 +7,7 @@ public class ItemSnow extends ItemBlockWithAuxData {
}
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;
+ final int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
if (itemstack.count == 0) {
return false;
} else if (!entityhuman.a(i, j, k, l, itemstack)) {
diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java
index 343b8cb5..f42f1622 100644
--- a/src/main/java/net/minecraft/server/ItemStack.java
+++ b/src/main/java/net/minecraft/server/ItemStack.java
@@ -1,15 +1,19 @@
package net.minecraft.server;
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Multimap;
+import java.text.DecimalFormat;
import java.util.Random;
public final class ItemStack {
+ public static final DecimalFormat a = new DecimalFormat("#.###");
public int count;
- public int b;
+ public int c;
public int id;
public NBTTagCompound tag;
private int damage;
- private EntityItemFrame f;
+ private EntityItemFrame g;
public ItemStack(Block block) {
this(block, 1);
@@ -36,12 +40,11 @@ public final class ItemStack {
}
public ItemStack(int i, int j, int k) {
- this.count = 0;
- this.f = null;
this.id = i;
this.count = j;
// CraftBukkit start - Pass to setData to do filtering
this.setData(k);
+ //this.damage = k;
//if (this.damage < 0) {
// this.damage = 0;
//}
@@ -55,10 +58,7 @@ public final class ItemStack {
return itemstack.getItem() != null ? itemstack : null;
}
- private ItemStack() {
- this.count = 0;
- this.f = null;
- }
+ private ItemStack() {}
public ItemStack a(int i) {
ItemStack itemstack = new ItemStack(this.id, i, this.damage);
@@ -135,7 +135,7 @@ public final class ItemStack {
}
public boolean usesData() {
- return Item.byId[this.id].m();
+ return Item.byId[this.id].n();
}
public boolean i() {
@@ -206,13 +206,18 @@ public final class ItemStack {
public void damage(int i, EntityLiving entityliving) {
if (!(entityliving instanceof EntityHuman) || !((EntityHuman) entityliving).abilities.canInstantlyBuild) {
if (this.g()) {
- if (this.isDamaged(i, entityliving.aE())) {
+ if (this.isDamaged(i, entityliving.aB())) {
entityliving.a(this);
+ --this.count;
if (entityliving instanceof EntityHuman) {
- ((EntityHuman) entityliving).a(StatisticList.F[this.id], 1);
+ EntityHuman entityhuman = (EntityHuman) entityliving;
+
+ entityhuman.a(StatisticList.F[this.id], 1);
+ if (this.count == 0 && this.getItem() instanceof ItemBow) {
+ entityhuman.bu();
+ }
}
- --this.count;
if (this.count < 0) {
this.count = 0;
}
@@ -245,16 +250,12 @@ public final class ItemStack {
}
}
- public int a(Entity entity) {
- return Item.byId[this.id].a(entity);
- }
-
public boolean b(Block block) {
return Item.byId[this.id].canDestroySpecialBlock(block);
}
- public boolean a(EntityLiving entityliving) {
- return Item.byId[this.id].a(this, entityliving);
+ public boolean a(EntityHuman entityhuman, EntityLiving entityliving) {
+ return Item.byId[this.id].a(this, entityhuman, entityliving);
}
public ItemStack cloneItemStack() {
@@ -296,8 +297,8 @@ public final class ItemStack {
}
public void a(World world, Entity entity, int i, boolean flag) {
- if (this.b > 0) {
- --this.b;
+ if (this.c > 0) {
+ --this.c;
}
Item.byId[this.id].a(this, world, entity, i, flag);
@@ -309,11 +310,11 @@ public final class ItemStack {
}
public int n() {
- return this.getItem().c_(this);
+ return this.getItem().d_(this);
}
public EnumAnimation o() {
- return this.getItem().b_(this);
+ return this.getItem().c_(this);
}
public void b(World world, EntityHuman entityhuman, int i) {
@@ -362,12 +363,28 @@ public final class ItemStack {
this.tag.getCompound("display").setString("Name", s);
}
+ public void t() {
+ if (this.tag != null) {
+ if (this.tag.hasKey("display")) {
+ NBTTagCompound nbttagcompound = this.tag.getCompound("display");
+
+ nbttagcompound.remove("Name");
+ if (nbttagcompound.isEmpty()) {
+ this.tag.remove("display");
+ if (this.tag.isEmpty()) {
+ this.setTag((NBTTagCompound) null);
+ }
+ }
+ }
+ }
+ }
+
public boolean hasName() {
return this.tag == null ? false : (!this.tag.hasKey("display") ? false : this.tag.getCompound("display").hasKey("Name"));
}
- public boolean w() {
- return !this.getItem().d_(this) ? false : !this.hasEnchantments();
+ public boolean x() {
+ return !this.getItem().e_(this) ? false : !this.hasEnchantments();
}
public void addEnchantment(Enchantment enchantment, int i) {
@@ -399,20 +416,20 @@ public final class ItemStack {
this.tag.set(s, nbtbase);
}
- public boolean y() {
- return this.getItem().y();
+ public boolean z() {
+ return this.getItem().z();
}
- public boolean z() {
- return this.f != null;
+ public boolean A() {
+ return this.g != null;
}
public void a(EntityItemFrame entityitemframe) {
- this.f = entityitemframe;
+ this.g = entityitemframe;
}
- public EntityItemFrame A() {
- return this.f;
+ public EntityItemFrame B() {
+ return this.g;
}
public int getRepairCost() {
@@ -426,4 +443,26 @@ public final class ItemStack {
this.tag.setInt("RepairCost", i);
}
+
+ public Multimap D() {
+ Object object;
+
+ if (this.hasTag() && this.tag.hasKey("AttributeModifiers")) {
+ object = HashMultimap.create();
+ NBTTagList nbttaglist = this.tag.getList("AttributeModifiers");
+
+ for (int i = 0; i < nbttaglist.size(); ++i) {
+ NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.get(i);
+ AttributeModifier attributemodifier = GenericAttributes.a(nbttagcompound);
+
+ if (attributemodifier.a().getLeastSignificantBits() != 0L && attributemodifier.a().getMostSignificantBits() != 0L) {
+ ((Multimap) object).put(nbttagcompound.getString("AttributeName"), attributemodifier);
+ }
+ }
+ } else {
+ object = this.getItem().h();
+ }
+
+ return (Multimap) object;
+ }
}
diff --git a/src/main/java/net/minecraft/server/ItemStep.java b/src/main/java/net/minecraft/server/ItemStep.java
index 67af6d68..4f5a8846 100644
--- a/src/main/java/net/minecraft/server/ItemStep.java
+++ b/src/main/java/net/minecraft/server/ItemStep.java
@@ -90,6 +90,7 @@ public class ItemStep extends ItemBlock {
// CraftBukkit end
--itemstack.count;
}
+
return true;
} else {
return false;
diff --git a/src/main/java/net/minecraft/server/ItemWorldMap.java b/src/main/java/net/minecraft/server/ItemWorldMap.java
index cf3bb1ff..cf6ebd11 100644
--- a/src/main/java/net/minecraft/server/ItemWorldMap.java
+++ b/src/main/java/net/minecraft/server/ItemWorldMap.java
@@ -50,7 +50,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
int i1 = MathHelper.floor(entity.locZ - (double) k) / i + short2 / 2;
int j1 = 128 / i;
- if (world.worldProvider.f) {
+ if (world.worldProvider.g) {
j1 /= 2;
}
@@ -84,7 +84,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
int l4;
int i5;
- if (world.worldProvider.f) {
+ if (world.worldProvider.g) {
j4 = i3 + j3 * 231871;
j4 = j4 * j4 * 31287121 + j4 * 11;
if ((j4 >> 20 & 1) == 0) {
@@ -108,7 +108,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
j5 = chunk.getTypeId(j4 + k3, l4 - 1, k4 + l3);
if (j5 == 0) {
flag1 = false;
- } else if (l4 > 0 && j5 > 0 && Block.byId[j5].material.G == MaterialMapColor.b) {
+ } else if (l4 > 0 && j5 > 0 && Block.byId[j5].material.H == MaterialMapColor.b) {
flag1 = false;
}
@@ -165,7 +165,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
i5 = 0;
if (k4 > 0) {
- MaterialMapColor materialmapcolor = Block.byId[k4].material.G;
+ MaterialMapColor materialmapcolor = Block.byId[k4].material.H;
if (materialmapcolor == MaterialMapColor.n) {
d2 = (double) i4 * 0.1D + (double) (k1 + j2 & 1) * 0.2D;
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 3e134fb7..96d291df 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
import java.awt.GraphicsEnvironment;
import java.io.File;
+import java.net.Proxy;
import java.security.KeyPair;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@@ -26,51 +27,52 @@ import org.bukkit.event.world.WorldSaveEvent;
public abstract class MinecraftServer implements ICommandListener, Runnable, IMojangStatistics {
- private static MinecraftServer k = null;
+ private static MinecraftServer l;
public Convertable convertable; // CraftBukkit - private final -> public
- private final MojangStatisticsGenerator m = new MojangStatisticsGenerator("server", this);
+ private final MojangStatisticsGenerator n = new MojangStatisticsGenerator("server", this, aq());
public File universe; // CraftBukkit - private final -> public
- private final List o = new ArrayList();
- private final ICommandHandler p;
+ private final List p = new ArrayList();
+ private final ICommandHandler q;
public final MethodProfiler methodProfiler = new MethodProfiler();
private String serverIp;
- private int r = -1;
+ private int s = -1;
public WorldServer[] worldServer;
- private PlayerList s;
+ private PlayerList t;
private boolean isRunning = true;
- private boolean isStopped = false;
- private int ticks = 0;
- public String c;
- public int d;
+ private boolean isStopped;
+ private int ticks;
+ protected Proxy c;
+ public String d;
+ public int e;
private boolean onlineMode;
private boolean spawnAnimals;
private boolean spawnNPCs;
private boolean pvpMode;
private boolean allowFlight;
private String motd;
- private int C;
- private long D;
+ private int D;
private long E;
private long F;
private long G;
- 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 long[][] j;
- private KeyPair H;
- private String I;
+ private long H;
+ public final long[] f;
+ public final long[] g;
+ public final long[] h;
+ public final long[] i;
+ public final long[] j;
+ public long[][] k;
+ private KeyPair I;
private String J;
+ private String K;
private boolean demoMode;
- private boolean M;
private boolean N;
- private String O = "";
- private boolean P = false;
- private long Q;
- private String R;
- private boolean S;
- private boolean T = false;
+ private boolean O;
+ private String P;
+ private boolean Q;
+ private long R;
+ private String S;
+ private boolean T;
+ private boolean U;
// CraftBukkit start
public List<WorldServer> worlds = new ArrayList<WorldServer>();
@@ -86,11 +88,18 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
// CraftBukkit end
public MinecraftServer(OptionSet options) { // CraftBukkit - signature file -> OptionSet
- k = this;
+ this.c = Proxy.NO_PROXY;
+ this.f = new long[100];
+ this.g = new long[100];
+ this.h = new long[100];
+ this.i = new long[100];
+ this.j = new long[100];
+ this.P = "";
+ l = this;
// this.universe = file1; // CraftBukkit
- this.p = new CommandDispatcher();
+ this.q = new CommandDispatcher();
// this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved to DedicatedServer.init
- this.an();
+ this.ar();
// CraftBukkit start
this.options = options;
@@ -117,27 +126,27 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
public abstract PropertyManager getPropertyManager();
// CraftBukkit end
- private void an() {
+ private void ar() {
DispenserRegistry.a();
}
protected abstract boolean init() throws java.net.UnknownHostException; // CraftBukkit - throws UnknownHostException
- protected void b(String s) {
+ protected void a(String s) {
if (this.getConvertable().isConvertable(s)) {
this.getLogger().info("Converting map!");
- this.c("menu.convertingLevel");
+ this.b("menu.convertingLevel");
this.getConvertable().convert(s, new ConvertProgressUpdater(this));
}
}
- protected synchronized void c(String s) {
- this.R = s;
+ protected synchronized void b(String s) {
+ this.S = s;
}
protected void a(String s, String s1, long i, WorldType worldtype, String s2) {
- this.b(s);
- this.c("menu.loadingLevel");
+ this.a(s);
+ this.b("menu.loadingLevel");
this.worldServer = new WorldServer[3];
// CraftBukkit - Removed ticktime arrays
IDataManager idatamanager = this.convertable.a(s, true);
@@ -173,7 +182,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
worldsettings.a(s2);
if (j == 0) {
- if (this.M()) { // Strip out DEMO?
+ if (this.O()) { // Strip out DEMO?
// CraftBukkit
world = new DemoWorldServer(this, new ServerNBTManager(server.getWorldContainer(), s1, true), s1, dimension, this.methodProfiler, this.getLogger());
} else {
@@ -231,56 +240,55 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldInitEvent(world.getWorld()));
world.addIWorldAccess(new WorldManager(this, world));
- if (!this.I()) {
+ if (!this.K()) {
world.getWorldData().setGameType(this.getGamemode());
}
this.worlds.add(world);
- this.s.setPlayerFileData(this.worlds.toArray(new WorldServer[this.worlds.size()]));
+ this.t.setPlayerFileData(this.worlds.toArray(new WorldServer[this.worlds.size()]));
// CraftBukkit end
}
this.c(this.getDifficulty());
- this.e();
+ this.f();
}
- protected void e() {
- long i = System.currentTimeMillis(); // CraftBukkit - current time
+ protected void f() {
+ boolean flag = true;
+ boolean flag1 = true;
+ boolean flag2 = true;
+ boolean flag3 = true;
+ int i = 0;
- this.c("menu.generatingTerrain");
+ this.b("menu.generatingTerrain");
byte b0 = 0;
// CraftBukkit start
- for (int j = 0; j < this.worlds.size(); ++j) {
- WorldServer worldserver = this.worlds.get(j);
- this.getLogger().info("Preparing start region for level " + j + " (Seed: " + worldserver.getSeed() + ")");
+ for (int m = 0; m < this.worlds.size(); ++m) {
+ WorldServer worldserver = this.worlds.get(m);
+ this.getLogger().info("Preparing start region for level " + b0 + " (Seed: " + worldserver.getSeed() + ")");
if (!worldserver.getWorld().getKeepSpawnInMemory()) {
continue;
}
ChunkCoordinates chunkcoordinates = worldserver.getSpawn();
+ long j = aq();
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) {
- i = i1;
- }
+ long i1 = aq();
- if (i1 > i + 1000L) {
- 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;
+ if (i1 - j > 1000L) {
+ this.a_("Preparing spawn area", i * 100 / 625);
+ j = i1;
}
+ ++i;
worldserver.chunkProviderServer.getChunkAt(chunkcoordinates.x + k >> 4, chunkcoordinates.z + l >> 4);
}
}
}
// CraftBukkit end
- this.j();
+ this.l();
}
public abstract boolean getGenerateStructures();
@@ -291,21 +299,23 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
public abstract boolean isHardcore();
+ public abstract int k();
+
protected void a_(String s, int i) {
- this.c = s;
- this.d = i;
+ this.d = s;
+ this.e = i;
this.getLogger().info(s + ": " + i + "%");
}
- protected void j() {
- this.c = null;
- this.d = 0;
+ protected void l() {
+ this.d = null;
+ this.e = 0;
this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD); // CraftBukkit
}
protected void saveChunks(boolean flag) throws ExceptionWorldConflict { // CraftBukkit - added throws
- if (!this.N) {
+ if (!this.O) {
// CraftBukkit start
for (int j = 0; j < this.worlds.size(); ++j) {
WorldServer worldserver = this.worlds.get(j);
@@ -327,7 +337,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public void stop() throws ExceptionWorldConflict { // CraftBukkit - added throws
- if (!this.N) {
+ if (!this.O) {
this.getLogger().info("Stopping server");
// CraftBukkit start
if (this.server != null) {
@@ -335,14 +345,14 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
// CraftBukkit end
- if (this.ae() != null) {
- this.ae().a();
+ if (this.ag() != null) {
+ this.ag().a();
}
- if (this.s != null) {
+ if (this.t != null) {
this.getLogger().info("Saving players");
- this.s.savePlayers();
- this.s.r();
+ this.t.savePlayers();
+ this.t.r();
}
this.getLogger().info("Saving worlds");
@@ -355,8 +365,8 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
worldserver.saveLevel();
}
// CraftBukkit end */
- if (this.m != null && this.m.d()) {
- this.m.e();
+ if (this.n != null && this.n.d()) {
+ this.n.e();
}
}
}
@@ -365,7 +375,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
return this.serverIp;
}
- public void d(String s) {
+ public void c(String s) {
this.serverIp = s;
}
@@ -380,17 +390,17 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
public void run() {
try {
if (this.init()) {
- long i = System.currentTimeMillis();
+ long i = aq();
- for (long j = 0L; this.isRunning; this.P = true) {
- long k = System.currentTimeMillis();
+ for (long j = 0L; this.isRunning; this.Q = true) {
+ long k = aq();
long l = k - i;
- if (l > 2000L && i - this.Q >= 15000L) {
+ if (l > 2000L && i - this.R >= 15000L) {
if (this.server.getWarnOnOverload()) // CraftBukkit - Added option to suppress warning messages
this.getLogger().warning("Can\'t keep up! Did the system time change, or is the server overloaded?");
l = 2000L;
- this.Q = i;
+ this.R = i;
}
if (l < 0L) {
@@ -401,13 +411,13 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
j += l;
i = k;
if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit
- this.q();
+ this.s();
j = 0L;
} else {
while (j > 50L) {
MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit
j -= 50L;
- this.q();
+ this.s();
}
}
@@ -427,7 +437,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
crashreport = this.b(new CrashReport("Exception in server tick loop", throwable));
}
- File file1 = new File(new File(this.o(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt");
+ File file1 = new File(new File(this.q(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt");
if (crashreport.a(file1, this.getLogger())) {
this.getLogger().severe("This crash report has been saved to: " + file1.getAbsolutePath());
@@ -449,64 +459,64 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
} catch (Exception e) {
}
// CraftBukkit end
- this.p();
+ this.r();
}
}
}
- protected File o() {
+ protected File q() {
return new File(".");
}
protected void a(CrashReport crashreport) {}
- protected void p() {}
+ protected void r() {}
- protected void q() throws ExceptionWorldConflict { // CraftBukkit - added throws
+ protected void s() throws ExceptionWorldConflict { // CraftBukkit - added throws
long i = System.nanoTime();
AxisAlignedBB.a().a();
++this.ticks;
- if (this.S) {
- this.S = false;
+ if (this.T) {
+ this.T = false;
this.methodProfiler.a = true;
this.methodProfiler.a();
}
this.methodProfiler.a("root");
- this.r();
+ this.t();
if ((this.autosavePeriod > 0) && ((this.ticks % this.autosavePeriod) == 0)) { // CraftBukkit
this.methodProfiler.a("save");
- this.s.savePlayers();
+ this.t.savePlayers();
this.saveChunks(true);
this.methodProfiler.b();
}
this.methodProfiler.a("tallying");
- 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.j[this.ticks % 100] = System.nanoTime() - i;
+ this.f[this.ticks % 100] = Packet.q - this.E;
+ this.E = Packet.q;
+ this.g[this.ticks % 100] = Packet.r - this.F;
+ this.F = Packet.r;
+ this.h[this.ticks % 100] = Packet.o - this.G;
+ this.G = Packet.o;
+ this.i[this.ticks % 100] = Packet.p - this.H;
+ this.H = Packet.p;
this.methodProfiler.b();
this.methodProfiler.a("snooper");
- if (!this.m.d() && this.ticks > 100) {
- this.m.a();
+ if (!this.n.d() && this.ticks > 100) {
+ this.n.a();
}
if (this.ticks % 6000 == 0) {
- this.m.b();
+ this.n.b();
}
this.methodProfiler.b();
this.methodProfiler.b();
}
- public void r() {
+ public void t() {
this.methodProfiler.a("levels");
// CraftBukkit start
@@ -523,7 +533,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
if (this.ticks % 20 == 0) {
for (int i = 0; i < this.getPlayerList().players.size(); ++i) {
EntityPlayer entityplayer = (EntityPlayer) this.getPlayerList().players.get(i);
- entityplayer.playerConnection.sendPacket(new Packet4UpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime())); // Add support for per player time
+ entityplayer.playerConnection.sendPacket(new Packet4UpdateTime(entityplayer.world.getTime(), entityplayer.getPlayerTime(), entityplayer.world.getGameRules().getBoolean("doDaylightCycle"))); // Add support for per player time
}
}
@@ -542,7 +552,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
/* Drop global time updates
if (this.ticks % 20 == 0) {
this.methodProfiler.a("timeSync");
- this.s.a(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime()), worldserver.worldProvider.dimension);
+ this.t.a(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")), worldserver.worldProvider.dimension);
this.methodProfiler.b();
}
// CraftBukkit end */
@@ -574,17 +584,17 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.methodProfiler.b();
// } // CraftBukkit
- // this.j[i][this.ticks % 100] = System.nanoTime() - j; // CraftBukkit
+ // this.k[i][this.ticks % 100] = System.nanoTime() - j; // CraftBukkit
}
this.methodProfiler.c("connection");
- this.ae().b();
+ this.ag().b();
this.methodProfiler.c("players");
- this.s.tick();
+ this.t.tick();
this.methodProfiler.c("tickables");
- for (i = 0; i < this.o.size(); ++i) {
- ((IUpdatePlayerListBox) this.o.get(i)).a();
+ for (i = 0; i < this.p.size(); ++i) {
+ ((IUpdatePlayerListBox) this.p.get(i)).a();
}
this.methodProfiler.b();
@@ -595,7 +605,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public void a(IUpdatePlayerListBox iupdateplayerlistbox) {
- this.o.add(iupdateplayerlistbox);
+ this.p.add(iupdateplayerlistbox);
}
public static void main(final OptionSet options) { // CraftBukkit - replaces main(String[] astring)
@@ -604,7 +614,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
try {
/* CraftBukkit start - Replace everything
- boolean flag = false;
+ boolean flag = !GraphicsEnvironment.isHeadless();
String s = null;
String s1 = ".";
String s2 = null;
@@ -665,16 +675,15 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
if (options.has("world")) {
- dedicatedserver.l((String) options.valueOf("world"));
+ dedicatedserver.j((String) options.valueOf("world"));
}
-
/*
if (s != null) {
- dedicatedserver.k(s);
+ dedicatedserver.j(s);
}
if (s2 != null) {
- dedicatedserver.l(s2);
+ dedicatedserver.k(s2);
}
if (i >= 0) {
@@ -690,7 +699,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
if (flag) {
- dedicatedserver.ap();
+ dedicatedserver.at();
}
*/
@@ -706,12 +715,12 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
}
- public void t() {
+ public void v() {
// (new ThreadServerApplication(this, "Server thread")).start(); // CraftBukkit - prevent abuse
}
- public File e(String s) {
- return new File(this.o(), s);
+ public File d(String s) {
+ return new File(this.q(), s);
}
public void info(String s) {
@@ -734,32 +743,32 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
// CraftBukkit end
}
- public String u() {
+ public String w() {
return this.serverIp;
}
- public int v() {
- return this.r;
+ public int x() {
+ return this.s;
}
- public String w() {
+ public String y() {
return this.motd;
}
public String getVersion() {
- return "1.5.2";
+ return "1.6.1";
}
- public int y() {
- return this.s.getPlayerCount();
+ public int A() {
+ return this.t.getPlayerCount();
}
- public int z() {
- return this.s.getMaxPlayers();
+ public int B() {
+ return this.t.getMaxPlayers();
}
public String[] getPlayers() {
- return this.s.d();
+ return this.t.d();
}
public String getPlugins() {
@@ -790,11 +799,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
// CraftBukkit start
- public String h(final String s) { // CraftBukkit - final parameter
+ public String g(final String s) { // CraftBukkit - final parameter
Waitable<String> waitable = new Waitable<String>() {
@Override
protected String evaluate() {
- RemoteControlCommandListener.instance.c();
+ RemoteControlCommandListener.instance.d();
// Event changes start
RemoteServerCommandEvent event = new RemoteServerCommandEvent(MinecraftServer.this.remoteConsole, s);
MinecraftServer.this.server.getPluginManager().callEvent(event);
@@ -802,7 +811,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
ServerCommand servercommand = new ServerCommand(event.getCommand(), RemoteControlCommandListener.instance);
// this.p.a(RemoteControlCommandListener.instance, s);
MinecraftServer.this.server.dispatchServerCommand(MinecraftServer.this.remoteConsole, servercommand); // CraftBukkit
- return RemoteControlCommandListener.instance.d();
+ return RemoteControlCommandListener.instance.e();
}};
processQueue.add(waitable);
try {
@@ -820,11 +829,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
return this.getPropertyManager().getBoolean("debug", false); // CraftBukkit - don't hardcode
}
- public void i(String s) {
+ public void h(String s) {
this.getLogger().severe(s);
}
- public void j(String s) {
+ public void i(String s) {
if (this.isDebugging()) {
this.getLogger().info(s);
}
@@ -836,11 +845,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
public CrashReport b(CrashReport crashreport) {
crashreport.g().a("Profiler Position", (Callable) (new CrashReportProfilerPosition(this)));
- if (this.worlds != null && this.worlds.size() > 0 && this.worlds.get(0) != null) {
+ if (this.worlds != null && this.worlds.size() > 0 && this.worlds.get(0) != null) { // CraftBukkit
crashreport.g().a("Vec3 Pool Size", (Callable) (new CrashReportVec3DPoolSize(this)));
}
- if (this.s != null) {
+ if (this.t != null) {
crashreport.g().a("Player Count", (Callable) (new CrashReportPlayerCount(this)));
}
@@ -894,63 +903,59 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public static MinecraftServer getServer() {
- return k;
+ return l;
}
public String getName() {
return "Server";
}
- public void sendMessage(String s) {
- this.getLogger().info(StripColor.a(s));
+ public void sendMessage(ChatMessage chatmessage) {
+ this.getLogger().info(chatmessage.toString());
}
public boolean a(int i, String s) {
return true;
}
- public String a(String s, Object... aobject) {
- return LocaleLanguage.a().a(s, aobject);
- }
-
public ICommandHandler getCommandHandler() {
- return this.p;
+ return this.q;
}
- public KeyPair F() {
- return this.H;
+ public KeyPair H() {
+ return this.I;
}
- public int G() {
- return this.r;
+ public int I() {
+ return this.s;
}
public void setPort(int i) {
- this.r = i;
+ this.s = i;
}
- public String H() {
- return this.I;
+ public String J() {
+ return this.J;
}
- public void k(String s) {
- this.I = s;
+ public void j(String s) {
+ this.J = s;
}
- public boolean I() {
- return this.I != null;
+ public boolean K() {
+ return this.J != null;
}
- public String J() {
- return this.J;
+ public String L() {
+ return this.K;
}
- public void l(String s) {
- this.J = s;
+ public void k(String s) {
+ this.K = s;
}
public void a(KeyPair keypair) {
- this.H = keypair;
+ this.I = keypair;
}
public void c(int i) {
@@ -963,7 +968,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
if (worldserver.getWorldData().isHardcore()) {
worldserver.difficulty = 3;
worldserver.setSpawnFlags(true, true);
- } else if (this.I()) {
+ } else if (this.K()) {
worldserver.difficulty = i;
worldserver.setSpawnFlags(worldserver.difficulty > 0, true);
} else {
@@ -978,7 +983,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
return true;
}
- public boolean M() {
+ public boolean O() {
return this.demoMode;
}
@@ -987,15 +992,15 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public void c(boolean flag) {
- this.M = flag;
+ this.N = flag;
}
public Convertable getConvertable() {
return this.convertable;
}
- public void P() {
- this.N = true;
+ public void R() {
+ this.O = true;
this.getConvertable().d();
// CraftBukkit start - This needs review, what does it do? (it's new)
@@ -1013,26 +1018,27 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public String getTexturePack() {
- return this.O;
+ return this.P;
}
public void setTexturePack(String s) {
- this.O = s;
+ this.P = s;
}
public void a(MojangStatisticsGenerator mojangstatisticsgenerator) {
mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(false));
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.s.getSeenPlayers().length));
+ mojangstatisticsgenerator.a("players_current", Integer.valueOf(this.A()));
+ mojangstatisticsgenerator.a("players_max", Integer.valueOf(this.B()));
+ mojangstatisticsgenerator.a("players_seen", Integer.valueOf(this.t.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.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)));
+ mojangstatisticsgenerator.a("gui_state", this.ai() ? "enabled" : "disabled");
+ mojangstatisticsgenerator.a("run_time", Long.valueOf((aq() - mojangstatisticsgenerator.g()) / 60L * 1000L));
+ 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)));
int i = 0;
// CraftBukkit start
@@ -1048,8 +1054,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.C));
- mojangstatisticsgenerator.a("world[" + i + "][chunks_loaded]", Integer.valueOf(worldserver.K().getLoadedChunks()));
+ mojangstatisticsgenerator.a("world[" + i + "][height]", Integer.valueOf(this.D));
+ mojangstatisticsgenerator.a("world[" + i + "][chunks_loaded]", Integer.valueOf(worldserver.L().getLoadedChunks()));
++i;
// } // CraftBukkit
}
@@ -1058,21 +1064,21 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public void b(MojangStatisticsGenerator mojangstatisticsgenerator) {
- mojangstatisticsgenerator.a("singleplayer", Boolean.valueOf(this.I()));
+ mojangstatisticsgenerator.a("singleplayer", Boolean.valueOf(this.K()));
mojangstatisticsgenerator.a("server_brand", this.getServerModName());
mojangstatisticsgenerator.a("gui_supported", GraphicsEnvironment.isHeadless() ? "headless" : "supported");
- mojangstatisticsgenerator.a("dedicated", Boolean.valueOf(this.T()));
+ mojangstatisticsgenerator.a("dedicated", Boolean.valueOf(this.V()));
}
public boolean getSnooperEnabled() {
return true;
}
- public int S() {
+ public int U() {
return 16;
}
- public abstract boolean T();
+ public abstract boolean V();
public boolean getOnlineMode() {
return this.server.getOnlineMode(); // CraftBukkit
@@ -1125,11 +1131,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public int getMaxBuildHeight() {
- return this.C;
+ return this.D;
}
public void d(int i) {
- this.C = i;
+ this.D = i;
}
public boolean isStopped() {
@@ -1137,11 +1143,11 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
public PlayerList getPlayerList() {
- return this.s;
+ return this.t;
}
public void a(PlayerList playerlist) {
- this.s = playerlist;
+ this.t = playerlist;
}
public void a(EnumGamemode enumgamemode) {
@@ -1152,26 +1158,30 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
}
}
- public abstract ServerConnection ae();
+ public abstract ServerConnection ag();
- public boolean ag() {
+ public boolean ai() {
return false;
}
public abstract String a(EnumGamemode enumgamemode, boolean flag);
- public int ah() {
+ public int aj() {
return this.ticks;
}
- public void ai() {
- this.S = true;
+ public void ak() {
+ this.T = true;
}
public ChunkCoordinates b() {
return new ChunkCoordinates(0, 0, 0);
}
+ public World f_() {
+ return this.worlds.get(0); // CraftBukkit
+ }
+
public int getSpawnProtection() {
return 16;
}
@@ -1183,14 +1193,22 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
public abstract IConsoleLogManager getLogger();
public void setForceGamemode(boolean flag) {
- this.T = flag;
+ this.U = flag;
}
public boolean getForceGamemode() {
- return this.T;
+ return this.U;
+ }
+
+ public Proxy ap() {
+ return this.c;
+ }
+
+ public static long aq() {
+ return System.currentTimeMillis();
}
public static PlayerList a(MinecraftServer minecraftserver) {
- return minecraftserver.s;
+ return minecraftserver.t;
}
}
diff --git a/src/main/java/net/minecraft/server/MobEffectList.java b/src/main/java/net/minecraft/server/MobEffectList.java
index 6a5a5f17..ab2432f4 100644
--- a/src/main/java/net/minecraft/server/MobEffectList.java
+++ b/src/main/java/net/minecraft/server/MobEffectList.java
@@ -1,5 +1,11 @@
package net.minecraft.server;
+import com.google.common.collect.Maps;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.UUID;
+import java.util.Map.Entry;
+
// CraftBukkit start
import org.bukkit.craftbukkit.event.CraftEventFactory;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
@@ -9,11 +15,11 @@ public class MobEffectList {
public static final MobEffectList[] byId = new MobEffectList[32];
public static final MobEffectList b = null;
- public static final MobEffectList FASTER_MOVEMENT = (new MobEffectList(1, false, 8171462)).b("potion.moveSpeed").b(0, 0);
- public static final MobEffectList SLOWER_MOVEMENT = (new MobEffectList(2, true, 5926017)).b("potion.moveSlowdown").b(1, 0);
+ public static final MobEffectList FASTER_MOVEMENT = (new MobEffectList(1, false, 8171462)).b("potion.moveSpeed").b(0, 0).a(GenericAttributes.d, "91AEAA56-376B-4498-935B-2F7F68070635", 0.20000000298023224D, 2);
+ public static final MobEffectList SLOWER_MOVEMENT = (new MobEffectList(2, true, 5926017)).b("potion.moveSlowdown").b(1, 0).a(GenericAttributes.d, "7107DE5E-7CE8-4030-940E-514C1F160890", -0.15000000596046448D, 2);
public static final MobEffectList FASTER_DIG = (new MobEffectList(3, false, 14270531)).b("potion.digSpeed").b(2, 0).a(1.5D);
public static final MobEffectList SLOWER_DIG = (new MobEffectList(4, true, 4866583)).b("potion.digSlowDown").b(3, 0);
- public static final MobEffectList INCREASE_DAMAGE = (new MobEffectList(5, false, 9643043)).b("potion.damageBoost").b(4, 0);
+ public static final MobEffectList INCREASE_DAMAGE = (new MobEffectAttackDamage(5, false, 9643043)).b("potion.damageBoost").b(4, 0).a(GenericAttributes.e, "648D7064-6A60-4F59-8ABE-C2C23A6DD7A9", 3.0D, 2);
public static final MobEffectList HEAL = (new InstantMobEffect(6, false, 16262179)).b("potion.heal");
public static final MobEffectList HARM = (new InstantMobEffect(7, true, 4393481)).b("potion.harm");
public static final MobEffectList JUMP = (new MobEffectList(8, false, 7889559)).b("potion.jump").b(2, 1);
@@ -26,12 +32,12 @@ public class MobEffectList {
public static final MobEffectList BLINDNESS = (new MobEffectList(15, true, 2039587)).b("potion.blindness").b(5, 1).a(0.25D);
public static final MobEffectList NIGHT_VISION = (new MobEffectList(16, false, 2039713)).b("potion.nightVision").b(4, 1);
public static final MobEffectList HUNGER = (new MobEffectList(17, true, 5797459)).b("potion.hunger").b(1, 1);
- public static final MobEffectList WEAKNESS = (new MobEffectList(18, true, 4738376)).b("potion.weakness").b(5, 0);
+ public static final MobEffectList WEAKNESS = (new MobEffectAttackDamage(18, true, 4738376)).b("potion.weakness").b(5, 0).a(GenericAttributes.e, "22653B89-116E-49DC-9B6B-9971489B5BE5", 2.0D, 0);
public static final MobEffectList POISON = (new MobEffectList(19, true, 5149489)).b("potion.poison").b(6, 0).a(0.25D);
public static final MobEffectList WITHER = (new MobEffectList(20, true, 3484199)).b("potion.wither").b(1, 2).a(0.25D);
- public static final MobEffectList w = null;
- public static final MobEffectList x = null;
- public static final MobEffectList y = null;
+ public static final MobEffectList HEALTH_BOOST = (new MobEffectHealthBoost(21, false, 16284963)).b("potion.healthBoost").b(2, 2).a(GenericAttributes.a, "5D6F0BA2-1186-46AC-B896-C61C5CEE99CC", 4.0D, 0);
+ public static final MobEffectList ABSORPTION = (new MobEffectAbsorption(22, false, 2445989)).b("potion.absorption").b(2, 2);
+ public static final MobEffectList SATURATION = (new InstantMobEffect(23, false, 16262179)).b("potion.saturation");
public static final MobEffectList z = null;
public static final MobEffectList A = null;
public static final MobEffectList B = null;
@@ -41,30 +47,31 @@ public class MobEffectList {
public static final MobEffectList F = null;
public static final MobEffectList G = null;
public final int id;
- private String I = "";
- private int J = -1;
- private final boolean K;
- private double L;
- private boolean M;
- private final int N;
+ private final Map I = Maps.newHashMap();
+ private final boolean J;
+ private final int K;
+ private String L = "";
+ private int M = -1;
+ private double N;
+ private boolean O;
protected MobEffectList(int i, boolean flag, int j) {
this.id = i;
byId[i] = this;
- this.K = flag;
+ this.J = flag;
if (flag) {
- this.L = 0.5D;
+ this.N = 0.5D;
} else {
- this.L = 1.0D;
+ this.N = 1.0D;
}
- this.N = j;
+ this.K = j;
org.bukkit.potion.PotionEffectType.registerPotionEffectType(new org.bukkit.craftbukkit.potion.CraftPotionEffectType(this)); // CraftBukkit
}
protected MobEffectList b(int i, int j) {
- this.J = i + j * 8;
+ this.M = i + j * 8;
return this;
}
@@ -75,22 +82,26 @@ public class MobEffectList {
public void tick(EntityLiving entityliving, int i) {
if (this.id == REGENERATION.id) {
if (entityliving.getHealth() < entityliving.maxHealth) { // CraftBukkit - .getMaxHealth() -> .maxHealth
- entityliving.heal(1, RegainReason.MAGIC_REGEN); // CraftBukkit
+ entityliving.heal(1.0F, RegainReason.MAGIC_REGEN); // CraftBukkit
}
} else if (this.id == POISON.id) {
- if (entityliving.getHealth() > 1) {
- entityliving.damageEntity(CraftEventFactory.POISON, 1); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON
+ if (entityliving.getHealth() > 1.0F) {
+ entityliving.damageEntity(CraftEventFactory.POISON, 1.0F); // CraftBukkit - DamageSource.MAGIC -> CraftEventFactory.POISON
}
} else if (this.id == WITHER.id) {
- entityliving.damageEntity(DamageSource.WITHER, 1);
+ entityliving.damageEntity(DamageSource.WITHER, 1.0F);
} else if (this.id == HUNGER.id && entityliving instanceof EntityHuman) {
- ((EntityHuman) entityliving).j(0.025F * (float) (i + 1));
- } 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()) {
- entityliving.damageEntity(DamageSource.MAGIC, 6 << i);
+ ((EntityHuman) entityliving).a(0.025F * (float) (i + 1));
+ } else if (this.id == SATURATION.id && entityliving instanceof EntityHuman) {
+ if (!entityliving.world.isStatic) {
+ ((EntityHuman) entityliving).getFoodData().eat(i + 1, 1.0F);
+ }
+ } else if ((this.id != HEAL.id || entityliving.aI()) && (this.id != HARM.id || !entityliving.aI())) {
+ if (this.id == HARM.id && !entityliving.aI() || this.id == HEAL.id && entityliving.aI()) {
+ entityliving.damageEntity(DamageSource.MAGIC, (float) (6 << i));
}
} else {
- entityliving.heal(6 << i, RegainReason.MAGIC); // CraftBukkit
+ entityliving.heal((float) Math.max(4 << i, 0), RegainReason.MAGIC); // CraftBukkit
}
}
@@ -103,19 +114,19 @@ public class MobEffectList {
// CraftBukkit end
int j;
- 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()) {
+ if ((this.id != HEAL.id || entityliving1.aI()) && (this.id != HARM.id || !entityliving1.aI())) {
+ if (this.id == HARM.id && !entityliving1.aI() || this.id == HEAL.id && entityliving1.aI()) {
j = (int) (d0 * (double) (6 << i) + 0.5D);
if (entityliving == null) {
- entityliving1.damageEntity(DamageSource.MAGIC, j);
+ entityliving1.damageEntity(DamageSource.MAGIC, (float) j);
} else {
// CraftBukkit - The "damager" needs to be the potion
- entityliving1.damageEntity(DamageSource.b(potion != null ? potion : entityliving1, entityliving), j);
+ entityliving1.damageEntity(DamageSource.b(potion != null ? potion : entityliving1, entityliving), (float) j);
}
}
} else {
- j = (int) (d0 * (double) (6 << i) + 0.5D);
- entityliving1.heal(j, RegainReason.MAGIC); // CraftBukkit
+ j = (int) (d0 * (double) (4 << i) + 0.5D);
+ entityliving1.heal((float) j, RegainReason.MAGIC);
}
}
@@ -126,42 +137,83 @@ public class MobEffectList {
public boolean a(int i, int j) {
int k;
- if (this.id != REGENERATION.id && this.id != POISON.id) {
- if (this.id == WITHER.id) {
- k = 40 >> j;
- return k > 0 ? i % k == 0 : true;
- } else {
- return this.id == HUNGER.id;
- }
- } else {
+ if (this.id == REGENERATION.id) {
+ k = 50 >> j;
+ return k > 0 ? i % k == 0 : true;
+ } else if (this.id == POISON.id) {
k = 25 >> j;
return k > 0 ? i % k == 0 : true;
+ } else if (this.id == WITHER.id) {
+ k = 40 >> j;
+ return k > 0 ? i % k == 0 : true;
+ } else {
+ return this.id == HUNGER.id;
}
}
public MobEffectList b(String s) {
- this.I = s;
+ this.L = s;
return this;
}
public String a() {
- return this.I;
+ return this.L;
}
protected MobEffectList a(double d0) {
- this.L = d0;
+ this.N = d0;
return this;
}
public double getDurationModifier() {
- return this.L;
+ return this.N;
}
public boolean i() {
- return this.M;
+ return this.O;
}
public int j() {
- return this.N;
+ return this.K;
+ }
+
+ public MobEffectList a(IAttribute iattribute, String s, double d0, int i) {
+ AttributeModifier attributemodifier = new AttributeModifier(UUID.fromString(s), this.a(), d0, i);
+
+ this.I.put(iattribute, attributemodifier);
+ return this;
+ }
+
+ public void a(EntityLiving entityliving, AttributeMapBase attributemapbase, int i) {
+ Iterator iterator = this.I.entrySet().iterator();
+
+ while (iterator.hasNext()) {
+ Entry entry = (Entry) iterator.next();
+ AttributeInstance attributeinstance = attributemapbase.a((IAttribute) entry.getKey());
+
+ if (attributeinstance != null) {
+ attributeinstance.b((AttributeModifier) entry.getValue());
+ }
+ }
+ }
+
+ public void b(EntityLiving entityliving, AttributeMapBase attributemapbase, int i) {
+ Iterator iterator = this.I.entrySet().iterator();
+
+ while (iterator.hasNext()) {
+ Entry entry = (Entry) iterator.next();
+ AttributeInstance attributeinstance = attributemapbase.a((IAttribute) entry.getKey());
+
+ if (attributeinstance != null) {
+ AttributeModifier attributemodifier = (AttributeModifier) entry.getValue();
+
+ attributeinstance.b(attributemodifier);
+ attributeinstance.a(new AttributeModifier(attributemodifier.a(), this.a() + " " + i, this.a(i, attributemodifier), attributemodifier.c()));
+ }
+ }
+ }
+
+ public double a(int i, AttributeModifier attributemodifier) {
+ return attributemodifier.d() * (double) (i + 1);
}
}
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index 4ba4735c..108b375b 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -11,10 +11,10 @@ public abstract class MobSpawnerAbstract {
public int spawnDelay = 20;
private String mobName = "Pig";
- private List mobs = null;
- private TileEntityMobSpawnerData spawnData = null;
+ private List mobs;
+ private TileEntityMobSpawnerData spawnData;
public double c;
- public double d = 0.0D;
+ public double d;
private int minSpawnDelay = 200;
private int maxSpawnDelay = 800;
private int spawnCount = 4;
@@ -91,14 +91,14 @@ public abstract class MobSpawnerAbstract {
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;
+ EntityInsentient entityinsentient = entity instanceof EntityInsentient ? (EntityInsentient) entity : null;
entity.setPositionRotation(d0, d3, d4, this.a().random.nextFloat() * 360.0F, 0.0F);
- if (entityliving == null || entityliving.canSpawn()) {
+ if (entityinsentient == null || entityinsentient.canSpawn()) {
this.a(entity);
this.a().triggerEffect(2004, this.b(), this.c(), this.d(), 0);
- if (entityliving != null) {
- entityliving.aU();
+ if (entityinsentient != null) {
+ entityinsentient.q();
}
flag = true;
@@ -134,7 +134,7 @@ public abstract class MobSpawnerAbstract {
for (Entity entity1 = entity; nbttagcompound.hasKey("Riding"); nbttagcompound = nbttagcompound1) {
nbttagcompound1 = nbttagcompound.getCompound("Riding");
- Entity entity2 = EntityTypes.createEntityByName(nbttagcompound1.getString("id"), this.a());
+ Entity entity2 = EntityTypes.createEntityByName(nbttagcompound1.getString("id"), entity.world);
if (entity2 != null) {
NBTTagCompound nbttagcompound2 = new NBTTagCompound();
@@ -150,15 +150,18 @@ public abstract class MobSpawnerAbstract {
entity2.f(nbttagcompound2);
entity2.setPositionRotation(entity1.locX, entity1.locY, entity1.locZ, entity1.yaw, entity1.pitch);
- this.a().addEntity(entity2, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit);
+ if (entity.world != null) {
+ entity.world.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);
+ ((EntityInsentient) entity).a((GroupDataEntity) null);
+ this.a().addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit
}
return entity;
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 1862863c..c60abf13 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
+import java.io.DataOutput;
import java.io.DataOutputStream;
import java.io.InputStream;
import java.net.Socket;
@@ -28,25 +29,25 @@ public class NetworkManager implements INetworkManager {
private volatile DataInputStream input;
private volatile DataOutputStream output;
private volatile boolean n = true;
- private volatile boolean o = false;
+ private volatile boolean o;
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 t = false;
+ private boolean t;
private Thread u;
private Thread v;
private String w = "";
private Object[] x;
- private int y = 0;
- private int z = 0;
+ private int y;
+ private int z;
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 A = null;
- private PrivateKey B = null;
+ public int e;
+ boolean f;
+ boolean g;
+ private SecretKey A;
+ private PrivateKey B;
private int lowPriorityQueueDelay = 50;
public NetworkManager(IConsoleLogManager iconsolelogmanager, Socket socket, String s, Connection connection, PrivateKey privatekey) throws IOException { // CraftBukkit - throws IOException
@@ -94,10 +95,10 @@ public class NetworkManager implements INetworkManager {
int i;
int[] aint;
- if (this.e == 0 || !this.highPriorityQueue.isEmpty() && System.currentTimeMillis() - ((Packet) this.highPriorityQueue.get(0)).timestamp >= (long) this.e) {
+ if (this.e == 0 || !this.highPriorityQueue.isEmpty() && MinecraftServer.aq() - ((Packet) this.highPriorityQueue.get(0)).timestamp >= (long) this.e) {
packet = this.a(false);
if (packet != null) {
- Packet.a(packet, this.output);
+ Packet.a(packet, (DataOutput) this.output);
if (packet instanceof Packet252KeyResponse && !this.g) {
if (!this.connection.a()) {
this.A = ((Packet252KeyResponse) packet).d();
@@ -117,7 +118,7 @@ public class NetworkManager implements INetworkManager {
if ((flag || this.lowPriorityQueueDelay-- <= 0) && !this.lowPriorityQueue.isEmpty() && (this.highPriorityQueue.isEmpty() || ((Packet) this.highPriorityQueue.get(0)).timestamp > ((Packet) this.lowPriorityQueue.get(0)).timestamp)) {
packet = this.a(true);
if (packet != null) {
- Packet.a(packet, this.output);
+ Packet.a(packet, (DataOutput) this.output);
aint = d;
i = packet.n();
aint[i] += packet.a() + 1;
diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java
index 1b367da9..b11c26b1 100644
--- a/src/main/java/net/minecraft/server/Packet.java
+++ b/src/main/java/net/minecraft/server/Packet.java
@@ -1,7 +1,7 @@
package net.minecraft.server;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
+import java.io.DataInput;
+import java.io.DataOutput;
import java.io.EOFException;
import java.io.IOException;
import java.net.Socket;
@@ -10,6 +10,8 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit
+
public abstract class Packet {
public static IntHashMap l = new IntHashMap();
@@ -17,12 +19,12 @@ public abstract class Packet {
private static Set b = new HashSet();
private static Set c = new HashSet();
protected IConsoleLogManager m;
- public final long timestamp = System.currentTimeMillis();
+ public final long timestamp = MinecraftServer.aq();
public static long o;
public static long p;
public static long q;
public static long r;
- public boolean lowPriority = false;
+ public boolean lowPriority;
// CraftBukkit start - Calculate packet ID once - used a bunch of times
private int packetID;
@@ -61,20 +63,20 @@ public abstract class Packet {
}
}
- public static void a(DataOutputStream dataoutputstream, byte[] abyte) throws IOException { // CraftBukkit - throws IOException
- dataoutputstream.writeShort(abyte.length);
- dataoutputstream.write(abyte);
+ public static void a(DataOutput dataoutput, byte[] abyte) throws IOException { // CraftBukkit - throws IOException
+ dataoutput.writeShort(abyte.length);
+ dataoutput.write(abyte);
}
- public static byte[] b(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOException
- short short1 = datainputstream.readShort();
+ public static byte[] b(DataInput datainput) throws IOException { // CraftBukkit - throws IOException
+ short short1 = datainput.readShort();
if (short1 < 0) {
throw new IOException("Key was smaller than nothing! Weird key!");
} else {
byte[] abyte = new byte[short1];
- datainputstream.readFully(abyte);
+ datainput.readFully(abyte);
return abyte;
}
}
@@ -83,7 +85,7 @@ public abstract class Packet {
return packetID; // ((Integer) a.get(this.getClass())).intValue(); // CraftBukkit
}
- public static Packet a(IConsoleLogManager iconsolelogmanager, DataInputStream datainputstream, boolean flag, Socket socket) throws IOException { // CraftBukkit - throws IOException
+ public static Packet a(IConsoleLogManager iconsolelogmanager, DataInput datainput, boolean flag, Socket socket) throws IOException { // CraftBukkit - throws IOException
boolean flag1 = false;
Packet packet = null;
int i = socket.getSoTimeout();
@@ -91,11 +93,7 @@ public abstract class Packet {
int j;
try {
- j = datainputstream.read();
- if (j == -1) {
- return null;
- }
-
+ j = datainput.readUnsignedByte();
if (flag && !c.contains(Integer.valueOf(j)) || !flag && !b.contains(Integer.valueOf(j))) {
throw new IOException("Bad packet id " + j);
}
@@ -110,11 +108,11 @@ public abstract class Packet {
socket.setSoTimeout(1500);
}
- packet.a(datainputstream);
+ packet.a(datainput);
++o;
p += (long) packet.a();
} catch (EOFException eofexception) {
- iconsolelogmanager.severe("Reached end of stream");
+ iconsolelogmanager.severe("Reached end of stream for " + socket.getInetAddress());
return null;
}
@@ -135,24 +133,24 @@ public abstract class Packet {
return packet;
}
- public static void a(Packet packet, DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
- dataoutputstream.write(packet.n());
- packet.a(dataoutputstream);
+ public static void a(Packet packet, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
+ dataoutput.write(packet.n());
+ packet.a(dataoutput);
++q;
r += (long) packet.a();
}
- public static void a(String s, DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
+ public static void a(String s, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
if (s.length() > 32767) {
throw new IOException("String too big");
} else {
- dataoutputstream.writeShort(s.length());
- dataoutputstream.writeChars(s);
+ dataoutput.writeShort(s.length());
+ dataoutput.writeChars(s);
}
}
- public static String a(DataInputStream datainputstream, int i) throws IOException { // CraftBukkit - throws IOException
- short short1 = datainputstream.readShort();
+ public static String a(DataInput datainput, int i) throws IOException { // CraftBukkit - throws IOException
+ short short1 = datainput.readShort();
if (short1 > i) {
throw new IOException("Received string length longer than maximum allowed (" + short1 + " > " + i + ")");
@@ -162,16 +160,16 @@ public abstract class Packet {
StringBuilder stringbuilder = new StringBuilder();
for (int j = 0; j < short1; ++j) {
- stringbuilder.append(datainputstream.readChar());
+ stringbuilder.append(datainput.readChar());
}
return stringbuilder.toString();
}
}
- public abstract void a(DataInputStream datainputstream) throws IOException; // CraftBukkit - throws IOException
+ public abstract void a(DataInput datainput) throws IOException; // CraftBukkit - throws IOException
- public abstract void a(DataOutputStream dataoutputstream) throws IOException; // CraftBukkit - throws IOException
+ public abstract void a(DataOutput dataoutput) throws IOException; // CraftBukkit - throws IOException
public abstract void handle(Connection connection);
@@ -186,7 +184,7 @@ public abstract class Packet {
}
public boolean a_() {
- return false;
+ return this instanceof Packet3Chat && !((Packet3Chat) this).message.startsWith("/"); // CraftBukkit - async chat
}
public String toString() {
@@ -195,59 +193,64 @@ public abstract class Packet {
return s;
}
- public static ItemStack c(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOException
+ public static ItemStack c(DataInput datainput) throws IOException { // CraftBukkit - throws IOException
ItemStack itemstack = null;
- short short1 = datainputstream.readShort();
+ short short1 = datainput.readShort();
if (short1 >= 0) {
- byte b0 = datainputstream.readByte();
- short short2 = datainputstream.readShort();
+ byte b0 = datainput.readByte();
+ short short2 = datainput.readShort();
itemstack = new ItemStack(short1, b0, short2);
- itemstack.tag = d(datainputstream);
+ itemstack.tag = d(datainput);
+ // CraftBukkit start
+ if (itemstack.tag != null) {
+ CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
+ }
+ // CraftBukkit end
}
return itemstack;
}
- public static void a(ItemStack itemstack, DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
+ public static void a(ItemStack itemstack, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
if (itemstack == null || itemstack.getItem() == null) { // CraftBukkit - NPE fix itemstack.getItem()
- dataoutputstream.writeShort(-1);
+ dataoutput.writeShort(-1);
} else {
- dataoutputstream.writeShort(itemstack.id);
- dataoutputstream.writeByte(itemstack.count);
- dataoutputstream.writeShort(itemstack.getData());
+ dataoutput.writeShort(itemstack.id);
+ dataoutput.writeByte(itemstack.count);
+ dataoutput.writeShort(itemstack.getData());
NBTTagCompound nbttagcompound = null;
- if (itemstack.getItem().usesDurability() || itemstack.getItem().r()) {
+ if (itemstack.getItem().usesDurability() || itemstack.getItem().s()) {
nbttagcompound = itemstack.tag;
}
- a(nbttagcompound, dataoutputstream);
+ a(nbttagcompound, dataoutput);
}
}
- public static NBTTagCompound d(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOException
- short short1 = datainputstream.readShort();
+ public static NBTTagCompound d(DataInput datainput) throws IOException { // CraftBukkit - throws IOException
+ short short1 = datainput.readShort();
if (short1 < 0) {
return null;
} else {
byte[] abyte = new byte[short1];
- datainputstream.readFully(abyte);
+ datainput.readFully(abyte);
return NBTCompressedStreamTools.a(abyte);
}
}
- protected static void a(NBTTagCompound nbttagcompound, DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
+ protected static void a(NBTTagCompound nbttagcompound, DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
if (nbttagcompound == null) {
- dataoutputstream.writeShort(-1);
+ dataoutput.writeShort(-1);
} else {
byte[] abyte = NBTCompressedStreamTools.a(nbttagcompound);
- dataoutputstream.writeShort((short) abyte.length);
- dataoutputstream.write(abyte);
+ dataoutput.writeShort((short) abyte.length);
+ dataoutput.write(abyte);
}
}
@@ -278,6 +281,7 @@ public abstract class Packet {
a(24, true, false, Packet24MobSpawn.class);
a(25, true, false, Packet25EntityPainting.class);
a(26, true, false, Packet26AddExpOrb.class);
+ a(27, false, true, Packet27PlayerInput.class);
a(28, true, false, Packet28EntityVelocity.class);
a(29, true, false, Packet29DestroyEntity.class);
a(30, true, false, Packet30Entity.class);
@@ -292,6 +296,7 @@ public abstract class Packet {
a(41, true, false, Packet41MobEffect.class);
a(42, true, false, Packet42RemoveMobEffect.class);
a(43, true, false, Packet43SetExperience.class);
+ a(44, true, false, Packet44UpdateAttributes.class);
a(51, true, false, Packet51MapChunk.class);
a(52, true, false, Packet52MultiBlockChange.class);
a(53, true, false, Packet53BlockChange.class);
diff --git a/src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java b/src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java
index 1d4a4311..1843d9ce 100644
--- a/src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java
+++ b/src/main/java/net/minecraft/server/Packet20NamedEntitySpawn.java
@@ -1,7 +1,7 @@
package net.minecraft.server;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
+import java.io.DataInput;
+import java.io.DataOutput;
import java.util.List;
import java.io.IOException; // CraftBukkit
@@ -32,6 +32,7 @@ public class Packet20NamedEntitySpawn extends Packet {
}
// CraftBukkit end
+ this.b = entityhuman.getName();
this.c = MathHelper.floor(entityhuman.locX * 32.0D);
this.d = MathHelper.floor(entityhuman.locY * 32.0D);
this.e = MathHelper.floor(entityhuman.locZ * 32.0D);
@@ -43,28 +44,28 @@ public class Packet20NamedEntitySpawn extends Packet {
this.i = entityhuman.getDataWatcher();
}
- public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit
- this.a = datainputstream.readInt();
- this.b = a(datainputstream, 16);
- this.c = datainputstream.readInt();
- this.d = datainputstream.readInt();
- this.e = datainputstream.readInt();
- this.f = datainputstream.readByte();
- this.g = datainputstream.readByte();
- this.h = datainputstream.readShort();
- this.j = DataWatcher.a(datainputstream);
+ public void a(DataInput datainput) throws IOException { // CraftBukkit
+ this.a = datainput.readInt();
+ this.b = a(datainput, 16);
+ this.c = datainput.readInt();
+ this.d = datainput.readInt();
+ this.e = datainput.readInt();
+ this.f = datainput.readByte();
+ this.g = datainput.readByte();
+ this.h = datainput.readShort();
+ this.j = DataWatcher.a(datainput);
}
- public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit
- dataoutputstream.writeInt(this.a);
- a(this.b, dataoutputstream);
- dataoutputstream.writeInt(this.c);
- dataoutputstream.writeInt(this.d);
- dataoutputstream.writeInt(this.e);
- dataoutputstream.writeByte(this.f);
- dataoutputstream.writeByte(this.g);
- dataoutputstream.writeShort(this.h);
- this.i.a(dataoutputstream);
+ public void a(DataOutput dataoutput) throws IOException { // CraftBukkit
+ dataoutput.writeInt(this.a);
+ a(this.b, dataoutput);
+ dataoutput.writeInt(this.c);
+ dataoutput.writeInt(this.d);
+ dataoutput.writeInt(this.e);
+ dataoutput.writeByte(this.f);
+ dataoutput.writeByte(this.g);
+ dataoutput.writeShort(this.h);
+ this.i.a(dataoutput);
}
public void handle(Connection connection) {
diff --git a/src/main/java/net/minecraft/server/Packet2Handshake.java b/src/main/java/net/minecraft/server/Packet2Handshake.java
index 343af93d..1e7bad08 100644
--- a/src/main/java/net/minecraft/server/Packet2Handshake.java
+++ b/src/main/java/net/minecraft/server/Packet2Handshake.java
@@ -1,7 +1,7 @@
package net.minecraft.server;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
+import java.io.DataInput;
+import java.io.DataOutput;
import java.io.IOException; // CraftBukkit
@@ -14,18 +14,18 @@ public class Packet2Handshake extends Packet {
public Packet2Handshake() {}
- public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOException
- this.a = datainputstream.readByte();
- this.b = a(datainputstream, 16);
- this.c = a(datainputstream, 255);
- this.d = datainputstream.readInt();
+ public void a(DataInput datainput) throws IOException { // CraftBukkit - throws IOException
+ this.a = datainput.readByte();
+ this.b = a(datainput, 16);
+ this.c = a(datainput, 255);
+ this.d = datainput.readInt();
}
- public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
- dataoutputstream.writeByte(this.a);
- a(this.b, dataoutputstream);
- a(this.c, dataoutputstream);
- dataoutputstream.writeInt(this.d);
+ public void a(DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
+ dataoutput.writeByte(this.a);
+ a(this.b, dataoutput);
+ a(this.c, dataoutput);
+ dataoutput.writeInt(this.d);
}
public void handle(Connection connection) {
diff --git a/src/main/java/net/minecraft/server/Packet3Chat.java b/src/main/java/net/minecraft/server/Packet3Chat.java
deleted file mode 100644
index e48348bc..00000000
--- a/src/main/java/net/minecraft/server/Packet3Chat.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package net.minecraft.server;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-
-import java.io.IOException; // CraftBukkit
-
-public class Packet3Chat extends Packet {
-
- public static int a = 119;
- public String message;
- private boolean c;
-
- public Packet3Chat() {
- this.c = true;
- }
-
- public Packet3Chat(String s) {
- this(s, true);
- }
-
- public Packet3Chat(String s, boolean flag) {
- this.c = true;
-
- /* CraftBukkit start - Handle this later
- if (s.length() > b) {
- s = s.substring(0, b);
- }
- // CraftBukkit end */
-
- this.message = s;
- this.c = flag;
- }
-
- public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit
- this.message = a(datainputstream, a);
- }
-
- public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit
- a(this.message, dataoutputstream);
- }
-
- public void handle(Connection connection) {
- connection.a(this);
- }
-
- public int a() {
- return 2 + this.message.length() * 2;
- }
-
- public boolean isServer() {
- return this.c;
- }
-
- public boolean a_() {
- return !this.message.startsWith("/");
- }
-}
diff --git a/src/main/java/net/minecraft/server/Packet51MapChunk.java b/src/main/java/net/minecraft/server/Packet51MapChunk.java
deleted file mode 100644
index 97c953bb..00000000
--- a/src/main/java/net/minecraft/server/Packet51MapChunk.java
+++ /dev/null
@@ -1,186 +0,0 @@
-package net.minecraft.server;
-
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.IOException;
-import java.util.zip.DataFormatException;
-import java.util.zip.Deflater;
-import java.util.zip.Inflater;
-
-public class Packet51MapChunk extends Packet {
-
- public int a;
- public int b;
- public int c;
- public int d;
- private byte[] buffer;
- private byte[] inflatedBuffer;
- public boolean e;
- private int size;
- private static byte[] buildBuffer = new byte[196864];
-
- public Packet51MapChunk() {
- this.lowPriority = true;
- }
-
- public Packet51MapChunk(Chunk chunk, boolean flag, int i) {
- this.lowPriority = true;
- this.a = chunk.x;
- this.b = chunk.z;
- this.e = flag;
- ChunkMap chunkmap = a(chunk, flag, i);
- Deflater deflater = new Deflater(-1);
-
- this.d = chunkmap.c;
- this.c = chunkmap.b;
-
- try {
- this.inflatedBuffer = chunkmap.a;
- deflater.setInput(chunkmap.a, 0, chunkmap.a.length);
- deflater.finish();
- this.buffer = new byte[chunkmap.a.length];
- this.size = deflater.deflate(this.buffer);
- } finally {
- deflater.end();
- }
- }
-
- public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOException
- this.a = datainputstream.readInt();
- this.b = datainputstream.readInt();
- this.e = datainputstream.readBoolean();
- this.c = datainputstream.readShort();
- this.d = datainputstream.readShort();
- this.size = datainputstream.readInt();
- if (buildBuffer.length < this.size) {
- buildBuffer = new byte[this.size];
- }
-
- datainputstream.readFully(buildBuffer, 0, this.size);
- int i = 0;
-
- int j;
-
- for (j = 0; j < 16; ++j) {
- i += this.c >> j & 1;
- }
-
- j = 12288 * i;
- if (this.e) {
- j += 256;
- }
-
- this.inflatedBuffer = new byte[j];
- Inflater inflater = new Inflater();
-
- inflater.setInput(buildBuffer, 0, this.size);
-
- try {
- inflater.inflate(this.inflatedBuffer);
- } catch (DataFormatException dataformatexception) {
- throw new IOException("Bad compressed data format");
- } finally {
- inflater.end();
- }
- }
-
- public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
- dataoutputstream.writeInt(this.a);
- dataoutputstream.writeInt(this.b);
- dataoutputstream.writeBoolean(this.e);
- dataoutputstream.writeShort((short) (this.c & '\uffff'));
- dataoutputstream.writeShort((short) (this.d & '\uffff'));
- dataoutputstream.writeInt(this.size);
- dataoutputstream.write(this.buffer, 0, this.size);
- }
-
- public void handle(Connection connection) {
- connection.a(this);
- }
-
- public int a() {
- return 17 + this.size;
- }
-
- public static ChunkMap a(Chunk chunk, boolean flag, int i) {
- int j = 0;
- ChunkSection[] achunksection = chunk.i();
- int k = 0;
- ChunkMap chunkmap = new ChunkMap();
- byte[] abyte = buildBuffer;
-
- if (flag) {
- chunk.seenByPlayer = true;
- }
-
- int l;
-
- for (l = 0; l < achunksection.length; ++l) {
- if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) {
- chunkmap.b |= 1 << l;
- if (achunksection[l].getExtendedIdArray() != null) {
- chunkmap.c |= 1 << l;
- ++k;
- }
- }
- }
-
- for (l = 0; l < achunksection.length; ++l) {
- if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) {
- byte[] abyte1 = achunksection[l].getIdArray();
-
- System.arraycopy(abyte1, 0, abyte, j, abyte1.length);
- j += abyte1.length;
- }
- }
-
- NibbleArray nibblearray;
-
- for (l = 0; l < achunksection.length; ++l) {
- if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) {
- nibblearray = achunksection[l].getDataArray();
- System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length);
- j += nibblearray.a.length;
- }
- }
-
- for (l = 0; l < achunksection.length; ++l) {
- if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) {
- nibblearray = achunksection[l].getEmittedLightArray();
- System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length);
- j += nibblearray.a.length;
- }
- }
-
- if (!chunk.world.worldProvider.f) {
- for (l = 0; l < achunksection.length; ++l) {
- if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) {
- nibblearray = achunksection[l].getSkyLightArray();
- System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length);
- j += nibblearray.a.length;
- }
- }
- }
-
- if (k > 0) {
- for (l = 0; l < achunksection.length; ++l) {
- if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && achunksection[l].getExtendedIdArray() != null && (i & 1 << l) != 0) {
- nibblearray = achunksection[l].getExtendedIdArray();
- System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length);
- j += nibblearray.a.length;
- }
- }
- }
-
- if (flag) {
- byte[] abyte2 = chunk.m();
-
- System.arraycopy(abyte2, 0, abyte, j, abyte2.length);
- j += abyte2.length;
- }
-
- chunkmap.a = new byte[j];
- System.arraycopy(abyte, 0, chunkmap.a, 0, j);
- return chunkmap;
- }
-}
diff --git a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
index 129dc4f1..04c44fcc 100644
--- a/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
+++ b/src/main/java/net/minecraft/server/Packet56MapChunkBulk.java
@@ -1,7 +1,7 @@
package net.minecraft.server;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
+import java.io.DataInput;
+import java.io.DataOutput;
import java.io.IOException;
import java.util.List;
import java.util.zip.DataFormatException;
@@ -39,7 +39,7 @@ public class Packet56MapChunkBulk extends Packet {
this.a = new int[i];
this.b = new int[i];
this.inflatedBuffers = new byte[i][];
- this.h = !list.isEmpty() && !((Chunk) list.get(0)).world.worldProvider.f;
+ this.h = !list.isEmpty() && !((Chunk) list.get(0)).world.worldProvider.g;
int j = 0;
for (int k = 0; k < i; ++k) {
@@ -92,11 +92,11 @@ public class Packet56MapChunkBulk extends Packet {
}
// CraftBukkit end
- public void a(DataInputStream datainputstream) throws IOException { // CraftBukkit - throws IOException
- short short1 = datainputstream.readShort();
+ public void a(DataInput datainput) throws IOException { // CraftBukkit - throws IOException
+ short short1 = datainput.readShort();
- this.size = datainputstream.readInt();
- this.h = datainputstream.readBoolean();
+ this.size = datainput.readInt();
+ this.h = datainput.readBoolean();
this.c = new int[short1];
this.d = new int[short1];
this.a = new int[short1];
@@ -106,7 +106,7 @@ public class Packet56MapChunkBulk extends Packet {
buildBuffer = new byte[this.size];
}
- datainputstream.readFully(buildBuffer, 0, this.size);
+ datainput.readFully(buildBuffer, 0, this.size);
byte[] abyte = new byte[196864 * short1];
Inflater inflater = new Inflater();
@@ -123,10 +123,10 @@ public class Packet56MapChunkBulk extends Packet {
int i = 0;
for (int j = 0; j < short1; ++j) {
- this.c[j] = datainputstream.readInt();
- this.d[j] = datainputstream.readInt();
- this.a[j] = datainputstream.readShort();
- this.b[j] = datainputstream.readShort();
+ this.c[j] = datainput.readInt();
+ this.d[j] = datainput.readInt();
+ this.a[j] = datainput.readShort();
+ this.b[j] = datainput.readShort();
int k = 0;
int l = 0;
@@ -149,18 +149,18 @@ public class Packet56MapChunkBulk extends Packet {
}
}
- public void a(DataOutputStream dataoutputstream) throws IOException { // CraftBukkit - throws IOException
+ public void a(DataOutput dataoutput) throws IOException { // CraftBukkit - throws IOException
compress(); // CraftBukkit
- dataoutputstream.writeShort(this.c.length);
- dataoutputstream.writeInt(this.size);
- dataoutputstream.writeBoolean(this.h);
- dataoutputstream.write(this.buffer, 0, this.size);
+ dataoutput.writeShort(this.c.length);
+ dataoutput.writeInt(this.size);
+ dataoutput.writeBoolean(this.h);
+ dataoutput.write(this.buffer, 0, this.size);
for (int i = 0; i < this.c.length; ++i) {
- dataoutputstream.writeInt(this.c[i]);
- dataoutputstream.writeInt(this.d[i]);
- dataoutputstream.writeShort((short) (this.a[i] & '\uffff'));
- dataoutputstream.writeShort((short) (this.b[i] & '\uffff'));
+ dataoutput.writeInt(this.c[i]);
+ dataoutput.writeInt(this.d[i]);
+ dataoutput.writeShort((short) (this.a[i] & '\uffff'));
+ dataoutput.writeShort((short) (this.b[i] & '\uffff'));
}
}
diff --git a/src/main/java/net/minecraft/server/Path.java b/src/main/java/net/minecraft/server/Path.java
index 530cf09b..90c3ef97 100644
--- a/src/main/java/net/minecraft/server/Path.java
+++ b/src/main/java/net/minecraft/server/Path.java
@@ -3,7 +3,7 @@ package net.minecraft.server;
public class Path {
private PathPoint[] a = new PathPoint[128]; // CraftBukkit - reduce default size
- private int b = 0;
+ private int b;
public Path() {}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java b/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java
index 5470591b..cb2af02f 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java
@@ -4,34 +4,33 @@ import org.bukkit.event.entity.EntityTargetEvent; // CraftBukkit
public class PathfinderGoalArrowAttack extends PathfinderGoal {
- private final EntityLiving a;
+ private final EntityInsentient a;
private final IRangedEntity b;
private EntityLiving c;
private int d;
- private float e;
+ private double e;
private int f;
private int g;
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, double d0, int i, float f) {
+ this(irangedentity, d0, i, i, f);
}
- public PathfinderGoalArrowAttack(IRangedEntity irangedentity, float f, int i, int j, float f1) {
+ public PathfinderGoalArrowAttack(IRangedEntity irangedentity, double d0, int i, int j, float f) {
this.d = -1;
- this.f = 0;
if (!(irangedentity instanceof EntityLiving)) {
throw new IllegalArgumentException("ArrowAttackGoal requires Mob implements RangedAttackMob");
} else {
this.b = irangedentity;
- this.a = (EntityLiving) irangedentity;
- this.e = f;
+ this.a = (EntityInsentient) irangedentity;
+ this.e = d0;
this.g = i;
this.h = j;
- this.i = f1;
- this.j = f1 * f1;
+ this.i = f;
+ this.j = f * f;
this.a(3);
}
}
@@ -48,7 +47,7 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal {
}
public boolean b() {
- return this.a() || !this.a.getNavigation().f();
+ return this.a() || !this.a.getNavigation().g();
}
public void d() {
@@ -72,9 +71,9 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal {
}
if (d0 <= (double) this.j && this.f >= 20) {
- this.a.getNavigation().g();
+ this.a.getNavigation().h();
} else {
- this.a.getNavigation().a(this.c, this.e);
+ this.a.getNavigation().a((Entity) this.c, this.e);
}
this.a.getControllerLook().a(this.c, 30.0F, 30.0F);
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java b/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java
index 86b194ce..8f8b077e 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java
@@ -5,8 +5,8 @@ public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract {
private int i;
private int j = -1;
- public PathfinderGoalBreakDoor(EntityLiving entityliving) {
- super(entityliving);
+ public PathfinderGoalBreakDoor(EntityInsentient entityinsentient) {
+ super(entityinsentient);
}
public boolean a() {
@@ -31,7 +31,7 @@ public class PathfinderGoalBreakDoor extends PathfinderGoalDoorInteract {
public void e() {
super.e();
- if (this.a.aE().nextInt(20) == 0) {
+ if (this.a.aB().nextInt(20) == 0) {
this.a.world.triggerEffect(1010, this.b, this.c, this.d, 0);
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
index ca544f36..a2560043 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalBreed.java
@@ -9,18 +9,18 @@ public class PathfinderGoalBreed extends PathfinderGoal {
private EntityAnimal d;
World a;
private EntityAnimal e;
- int b = 0;
- float c;
+ int b;
+ double c;
- public PathfinderGoalBreed(EntityAnimal entityanimal, float f) {
+ public PathfinderGoalBreed(EntityAnimal entityanimal, double d0) {
this.d = entityanimal;
this.a = entityanimal.world;
- this.c = f;
+ this.c = d0;
this.a(3);
}
public boolean a() {
- if (!this.d.r()) {
+ if (!this.d.bU()) {
return false;
} else {
this.e = this.f();
@@ -29,7 +29,7 @@ public class PathfinderGoalBreed extends PathfinderGoal {
}
public boolean b() {
- return this.e.isAlive() && this.e.r() && this.b < 60;
+ return this.e.isAlive() && this.e.bU() && this.b < 60;
}
public void d() {
@@ -38,8 +38,8 @@ public class PathfinderGoalBreed extends PathfinderGoal {
}
public void e() {
- this.d.getControllerLook().a(this.e, 10.0F, (float) this.d.bs());
- this.d.getNavigation().a((EntityLiving) this.e, this.c);
+ this.d.getControllerLook().a(this.e, 10.0F, (float) this.d.bl());
+ this.d.getNavigation().a((Entity) this.e, this.c);
++this.b;
if (this.b >= 60 && this.d.e(this.e) < 9.0D) {
this.g();
@@ -71,12 +71,12 @@ public class PathfinderGoalBreed extends PathfinderGoal {
if (entityageable != null) {
this.d.setAge(6000);
this.e.setAge(6000);
- this.d.s();
- this.e.s();
+ this.d.bV();
+ this.e.bV();
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.aE();
+ Random random = this.d.aB();
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 1feced1a..3048b694 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalEatTile.java
@@ -7,18 +7,18 @@ import org.bukkit.Material;
public class PathfinderGoalEatTile extends PathfinderGoal {
- private EntityLiving b;
+ private EntityInsentient b;
private World c;
- int a = 0;
+ int a;
- public PathfinderGoalEatTile(EntityLiving entityliving) {
- this.b = entityliving;
- this.c = entityliving.world;
+ public PathfinderGoalEatTile(EntityInsentient entityinsentient) {
+ this.b = entityinsentient;
+ this.c = entityinsentient.world;
this.a(7);
}
public boolean a() {
- if (this.b.aE().nextInt(this.b.isBaby() ? 50 : 1000) != 0) {
+ if (this.b.aB().nextInt(this.b.isBaby() ? 50 : 1000) != 0) {
return false;
} else {
int i = MathHelper.floor(this.b.locX);
@@ -32,7 +32,7 @@ public class PathfinderGoalEatTile extends PathfinderGoal {
public void c() {
this.a = 40;
this.c.broadcastEntityEffect(this.b, (byte) 10);
- this.b.getNavigation().g();
+ this.b.getNavigation().h();
}
public void d() {
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
index e5d13f5f..8b7a0152 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java
@@ -5,26 +5,24 @@ import org.bukkit.event.entity.EntityTargetEvent; // CraftBukkit
public class PathfinderGoalMeleeAttack extends PathfinderGoal {
World a;
- EntityLiving b;
- EntityLiving c;
- int d;
- float e;
- boolean f;
- PathEntity g;
- Class h;
- private int i;
-
- public PathfinderGoalMeleeAttack(EntityLiving entityliving, Class oclass, float f, boolean flag) {
- this(entityliving, f, flag);
- this.h = oclass;
+ EntityCreature b;
+ int c;
+ double d;
+ boolean e;
+ PathEntity f;
+ Class g;
+ private int h;
+
+ public PathfinderGoalMeleeAttack(EntityCreature entitycreature, Class oclass, double d0, boolean flag) {
+ this(entitycreature, d0, flag);
+ this.g = oclass;
}
- public PathfinderGoalMeleeAttack(EntityLiving entityliving, float f, boolean flag) {
- this.d = 0;
- this.b = entityliving;
- this.a = entityliving.world;
- this.e = f;
- this.f = flag;
+ public PathfinderGoalMeleeAttack(EntityCreature entitycreature, double d0, boolean flag) {
+ this.b = entitycreature;
+ this.a = entitycreature.world;
+ this.d = d0;
+ this.e = flag;
this.a(3);
}
@@ -33,54 +31,58 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal {
if (entityliving == null) {
return false;
- } else if (this.h != null && !this.h.isAssignableFrom(entityliving.getClass())) {
+ } else if (!entityliving.isAlive()) {
+ return false;
+ } else if (this.g != null && !this.g.isAssignableFrom(entityliving.getClass())) {
return false;
} else {
- this.c = entityliving;
- this.g = this.b.getNavigation().a(this.c);
- return this.g != null;
+ this.f = this.b.getNavigation().a(entityliving);
+ return this.f != null;
}
}
public boolean b() {
EntityLiving entityliving = this.b.getGoalTarget();
- 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))));
+ // CraftBukkit start
+ EntityTargetEvent.TargetReason reason = this.b.getGoalTarget() == null ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
+ if (this.b.getGoalTarget() == null || (this.b.getGoalTarget() != null && !this.b.getGoalTarget().isAlive())) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(b, null, reason);
+ }
+ // CraftBukkit end
+
+ return entityliving == null ? false : (!entityliving.isAlive() ? false : (!this.e ? !this.b.getNavigation().g() : this.b.b(MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))));
}
public void c() {
- this.b.getNavigation().a(this.g, this.e);
- this.i = 0;
+ this.b.getNavigation().a(this.f, this.d);
+ this.h = 0;
}
public void d() {
- // CraftBukkit start
- EntityTargetEvent.TargetReason reason = this.c.isAlive() ? EntityTargetEvent.TargetReason.FORGOT_TARGET : EntityTargetEvent.TargetReason.TARGET_DIED;
- org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetEvent(b, null, reason);
- // CraftBukkit end
-
- this.c = null;
- this.b.getNavigation().g();
+ this.b.getNavigation().h();
}
public void e() {
- this.b.getControllerLook().a(this.c, 30.0F, 30.0F);
- if ((this.f || this.b.getEntitySenses().canSee(this.c)) && --this.i <= 0) {
- this.i = 4 + this.b.aE().nextInt(7);
- this.b.getNavigation().a(this.c, this.e);
+ EntityLiving entityliving = this.b.getGoalTarget();
+
+ this.b.getControllerLook().a(entityliving, 30.0F, 30.0F);
+ if ((this.e || this.b.getEntitySenses().canSee(entityliving)) && --this.h <= 0) {
+ this.h = 4 + this.b.aB().nextInt(7);
+ this.b.getNavigation().a((Entity) entityliving, this.d);
}
- this.d = Math.max(this.d - 1, 0);
- double d0 = (double) (this.b.width * 2.0F * this.b.width * 2.0F);
+ this.c = Math.max(this.c - 1, 0);
+ double d0 = (double) (this.b.width * 2.0F * this.b.width * 2.0F + entityliving.width);
- 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.bG() != null) {
- this.b.bK();
+ if (this.b.e(entityliving.locX, entityliving.boundingBox.b, entityliving.locZ) <= d0) {
+ if (this.c <= 0) {
+ this.c = 20;
+ if (this.b.aV() != null) {
+ this.b.aR();
}
- this.b.m(this.c);
+ this.b.m(entityliving);
}
}
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
index 28608784..1da9a42c 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java
@@ -13,7 +13,7 @@ public class PathfinderGoalSelector {
private List b = new UnsafeList();
// CraftBukkit end
private final MethodProfiler c;
- private int d = 0;
+ private int d;
private int e = 3;
public PathfinderGoalSelector(MethodProfiler methodprofiler) {
@@ -130,7 +130,7 @@ public class PathfinderGoalSelector {
((UnsafeList.Itr) iterator).valid = false; // CraftBukkit - mark iterator for reuse
return false;
}
- // CraftBukkit - switch order
+ // CraftBukkit - switch order
} else if (!pathfindergoalselectoritem1.a.i() && this.b.contains(pathfindergoalselectoritem1)) {
this.c.b();
((UnsafeList.Itr) iterator).valid = false; // CraftBukkit - mark iterator for reuse
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSit.java b/src/main/java/net/minecraft/server/PathfinderGoalSit.java
index 031005ed..ff300bff 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalSit.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalSit.java
@@ -2,38 +2,38 @@ package net.minecraft.server;
public class PathfinderGoalSit extends PathfinderGoal {
- private EntityTameableAnimal a;
- private boolean b = false;
+ private EntityTameableAnimal entity;
+ private boolean willSit;
public PathfinderGoalSit(EntityTameableAnimal entitytameableanimal) {
- this.a = entitytameableanimal;
+ this.entity = entitytameableanimal;
this.a(5);
}
public boolean a() {
- if (!this.a.isTamed()) {
- return this.b && this.a.getGoalTarget() == null; // CraftBukkit - Allow sitting for wild animals
- } else if (this.a.G()) {
+ if (!this.entity.isTamed()) {
+ return this.willSit && this.entity.getGoalTarget() == null; // CraftBukkit - Allow sitting for wild animals
+ } else if (this.entity.G()) {
return false;
- } else if (!this.a.onGround) {
+ } else if (!this.entity.onGround) {
return false;
} else {
- EntityLiving entityliving = this.a.getOwner();
+ EntityLiving entityliving = this.entity.getOwner();
- return entityliving == null ? true : (this.a.e(entityliving) < 144.0D && entityliving.aF() != null ? false : this.b);
+ return entityliving == null ? true : (this.entity.e(entityliving) < 144.0D && entityliving.getLastDamager() != null ? false : this.willSit);
}
}
public void c() {
- this.a.getNavigation().g();
- this.a.setSitting(true);
+ this.entity.getNavigation().h();
+ this.entity.setSitting(true);
}
public void d() {
- this.a.setSitting(false);
+ this.entity.setSitting(false);
}
public void setSitting(boolean flag) {
- this.b = flag;
+ this.willSit = flag;
}
}
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java
index 0dd60150..5a840830 100644
--- a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java
+++ b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java
@@ -1,5 +1,7 @@
package net.minecraft.server;
+import org.apache.commons.lang3.StringUtils;
+
// CraftBukkit start
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.event.entity.EntityTargetEvent;
@@ -7,89 +9,94 @@ import org.bukkit.event.entity.EntityTargetEvent;
public abstract class PathfinderGoalTarget extends PathfinderGoal {
- protected EntityLiving d;
- protected float e;
- protected boolean f;
+ protected EntityCreature c;
+ protected boolean d;
private boolean a;
private int b;
- private int c;
- private int g;
+ private int e;
+ private int f;
- public PathfinderGoalTarget(EntityLiving entityliving, float f, boolean flag) {
- this(entityliving, f, flag, false);
+ public PathfinderGoalTarget(EntityCreature entitycreature, boolean flag) {
+ this(entitycreature, flag, false);
}
- public PathfinderGoalTarget(EntityLiving entityliving, float f, boolean flag, boolean flag1) {
- this.b = 0;
- this.c = 0;
- this.g = 0;
- this.d = entityliving;
- this.e = f;
- this.f = flag;
+ public PathfinderGoalTarget(EntityCreature entitycreature, boolean flag, boolean flag1) {
+ this.c = entitycreature;
+ this.d = flag;
this.a = flag1;
}
public boolean b() {
- EntityLiving entityliving = this.d.getGoalTarget();
+ EntityLiving entityliving = this.c.getGoalTarget();
if (entityliving == null) {
return false;
} else if (!entityliving.isAlive()) {
return false;
- } else if (this.d.e(entityliving) > (double) (this.e * this.e)) {
- return false;
} else {
- if (this.f) {
- if (this.d.getEntitySenses().canSee(entityliving)) {
- this.g = 0;
- } else if (++this.g > 60) {
- return false;
+ double d0 = this.f();
+
+ if (this.c.e(entityliving) > d0 * d0) {
+ return false;
+ } else {
+ if (this.d) {
+ if (this.c.getEntitySenses().canSee(entityliving)) {
+ this.f = 0;
+ } else if (++this.f > 60) {
+ return false;
+ }
}
- }
- return true;
+ return true;
+ }
}
}
+ protected double f() {
+ AttributeInstance attributeinstance = this.c.a(GenericAttributes.b);
+
+ return attributeinstance == null ? 16.0D : attributeinstance.e();
+ }
+
public void c() {
this.b = 0;
- this.c = 0;
- this.g = 0;
+ this.e = 0;
+ this.f = 0;
}
public void d() {
- this.d.setGoalTarget((EntityLiving) null);
+ this.c.setGoalTarget((EntityLiving) null);
}
protected boolean a(EntityLiving entityliving, boolean flag) {
if (entityliving == null) {
return false;
- } else if (entityliving == this.d) {
+ } else if (entityliving == this.c) {
return false;
} else if (!entityliving.isAlive()) {
return false;
- } else if (!this.d.a(entityliving.getClass())) {
+ } else if (!this.c.a(entityliving.getClass())) {
return false;
} else {
- if (this.d instanceof EntityTameableAnimal && ((EntityTameableAnimal) this.d).isTamed()) {
- if (entityliving instanceof EntityTameableAnimal && ((EntityTameableAnimal) entityliving).isTamed()) {
+ if (this.c instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.c).getOwnerName())) {
+ if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.c).getOwnerName().equals(((EntityOwnable) entityliving).getOwnerName())) {
return false;
}
- if (entityliving == ((EntityTameableAnimal) this.d).getOwner()) {
+ if (entityliving == ((EntityOwnable) this.c).getOwner()) {
return false;
}
} else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) {
return false;
}
- if (!this.d.d(MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) {
+ if (!this.c.b(MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) {
return false;
- } else if (this.f && !this.d.getEntitySenses().canSee(entityliving)) {
+ } else if (this.d && !this.c.getEntitySenses().canSee(entityliving)) {
return false;
} else {
if (this.a) {
- if (--this.c <= 0) {
+ if (--this.e <= 0) {
this.b = 0;
}
@@ -119,15 +126,15 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
reason = EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET;
}
- org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(this.d, entityliving, reason);
+ org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(this.c, entityliving, reason);
if (event.isCancelled() || event.getTarget() == null) {
- this.d.setGoalTarget(null);
+ this.c.setGoalTarget(null);
return false;
} else if (entityliving.getBukkitEntity() != event.getTarget()) {
- this.d.setGoalTarget((EntityLiving) ((CraftEntity) event.getTarget()).getHandle());
+ this.c.setGoalTarget((EntityLiving) ((CraftEntity) event.getTarget()).getHandle());
}
- if (this.d instanceof EntityCreature) {
- ((EntityCreature) this.d).target = ((CraftEntity) event.getTarget()).getHandle();
+ if (this.c instanceof EntityCreature) {
+ ((EntityCreature) this.c).target = ((CraftEntity) event.getTarget()).getHandle();
}
// CraftBukkit end
@@ -137,8 +144,8 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal {
}
private boolean a(EntityLiving entityliving) {
- this.c = 10 + this.d.aE().nextInt(5);
- PathEntity pathentity = this.d.getNavigation().a(entityliving);
+ this.e = 10 + this.c.aB().nextInt(5);
+ PathEntity pathentity = this.c.getNavigation().a(entityliving);
if (pathentity == null) {
return false;
diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java
index 17cfacc9..252cea7c 100644
--- a/src/main/java/net/minecraft/server/PendingConnection.java
+++ b/src/main/java/net/minecraft/server/PendingConnection.java
@@ -9,7 +9,6 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
-import java.util.logging.Logger;
import javax.crypto.SecretKey;
public class PendingConnection extends Connection {
@@ -18,18 +17,18 @@ public class PendingConnection extends Connection {
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;
+ public boolean b;
+ private int f;
+ private String g;
+ private volatile boolean h;
private String loginKey = Long.toString(random.nextLong(), 16); // CraftBukkit - Security fix
- private boolean j = false;
- private SecretKey k = null;
+ private boolean j;
+ private SecretKey k;
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(minecraftserver.getLogger(), socket, s, this, minecraftserver.F().getPrivate());
+ this.networkManager = new NetworkManager(minecraftserver.getLogger(), socket, s, this, minecraftserver.H().getPrivate());
this.networkManager.e = 0;
}
@@ -70,10 +69,10 @@ public class PendingConnection extends Connection {
if (!this.g.equals(StripColor.a(this.g))) {
this.disconnect("Invalid username!");
} else {
- PublicKey publickey = this.server.F().getPublic();
+ PublicKey publickey = this.server.H().getPublic();
- if (packet2handshake.d() != 61) {
- if (packet2handshake.d() > 61) {
+ if (packet2handshake.d() != 73) {
+ if (packet2handshake.d() > 73) {
this.disconnect("Outdated server!");
} else {
this.disconnect("Outdated client!");
@@ -88,7 +87,7 @@ public class PendingConnection extends Connection {
}
public void a(Packet252KeyResponse packet252keyresponse) {
- PrivateKey privatekey = this.server.F().getPrivate();
+ PrivateKey privatekey = this.server.H().getPrivate();
this.k = packet252keyresponse.a(privatekey);
if (!Arrays.equals(this.d, packet252keyresponse.b(privatekey))) {
@@ -100,12 +99,13 @@ public class PendingConnection extends Connection {
public void a(Packet205ClientCommand packet205clientcommand) {
if (packet205clientcommand.a == 0) {
+ if (this.j) {
+ this.disconnect("Duplicate login");
+ return;
+ }
+
+ this.j = true;
if (this.server.getOnlineMode()) {
- if (this.j) {
- this.disconnect("Duplicate login");
- return;
- }
- this.j = true;
(new ThreadLoginVerifier(this, server.server)).start(); // CraftBukkit - add CraftServer
} else {
this.h = true;
@@ -120,10 +120,11 @@ public class PendingConnection extends Connection {
EntityPlayer s = this.server.getPlayerList().attemptLogin(this, this.g, this.hostname);
if (s == null) {
+ // this.disconnect(s);
return;
// CraftBukkit end
} else {
- EntityPlayer entityplayer = this.server.getPlayerList().processLogin(s); // CraftBukkit - this.h -> s
+ EntityPlayer entityplayer = this.server.getPlayerList().processLogin(s); // CraftBukkit - this.g -> s
if (entityplayer != null) {
this.server.getPlayerList().a((INetworkManager) this.networkManager, entityplayer);
@@ -145,24 +146,22 @@ public class PendingConnection extends Connection {
String s = null;
// CraftBukkit
org.bukkit.event.server.ServerListPingEvent pingEvent = org.bukkit.craftbukkit.event.CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.getMotd(), playerlist.getPlayerCount(), playerlist.getMaxPlayers());
+ if (packet254getinfo.d()) {
+ // CraftBukkit
+ s = pingEvent.getMotd() + "\u00A7" + playerlist.getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers();
+ } else {
+ List list = Arrays.asList(new Serializable[] { Integer.valueOf(1), Integer.valueOf(73), this.server.getVersion(), this.server.getMotd(), Integer.valueOf(playerlist.getPlayerCount()), Integer.valueOf(playerlist.getMaxPlayers())});
- if (packet254getinfo.a == 1) {
- // CraftBukkit start - Fix decompile issues, don't create a list from an array
- Object[] list = new Object[] { 1, 61, this.server.getVersion(), pingEvent.getMotd(), playerlist.getPlayerCount(), pingEvent.getMaxPlayers() };
+ Object object;
- for (Object object : list) {
+ for (Iterator iterator = list.iterator(); iterator.hasNext(); s = s + object.toString().replaceAll("\0", "")) {
+ object = iterator.next();
if (s == null) {
s = "\u00A7";
} else {
- s = s + "\0";
+ s = s + '\0';
}
-
- s += org.apache.commons.lang.StringUtils.replace(object.toString(), "\0", "");
}
- // CraftBukkit end
- } else {
- // CraftBukkit
- s = pingEvent.getMotd() + "\u00A7" + playerlist.getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers();
}
InetAddress inetaddress = null;
@@ -173,8 +172,8 @@ public class PendingConnection extends Connection {
this.networkManager.queue(new Packet255KickDisconnect(s));
this.networkManager.d();
- if (inetaddress != null && this.server.ae() instanceof DedicatedServerConnection) {
- ((DedicatedServerConnection) this.server.ae()).a(inetaddress);
+ if (inetaddress != null && this.server.ag() instanceof DedicatedServerConnection) {
+ ((DedicatedServerConnection) this.server.ag()).a(inetaddress);
}
this.b = true;
diff --git a/src/main/java/net/minecraft/server/PlayerAbilities.java b/src/main/java/net/minecraft/server/PlayerAbilities.java
index 5ce83dda..7acea6e9 100644
--- a/src/main/java/net/minecraft/server/PlayerAbilities.java
+++ b/src/main/java/net/minecraft/server/PlayerAbilities.java
@@ -2,10 +2,10 @@ package net.minecraft.server;
public class PlayerAbilities {
- public boolean isInvulnerable = false;
- public boolean isFlying = false;
- public boolean canFly = false;
- public boolean canInstantlyBuild = false;
+ public boolean isInvulnerable;
+ public boolean isFlying;
+ public boolean canFly;
+ public boolean canInstantlyBuild;
public boolean mayBuild = true;
public float flySpeed = 0.05F; // CraftBukkit private -> public
public float walkSpeed = 0.1F; // CraftBukkit private -> public
diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java
index 10a43b64..81d66e45 100644
--- a/src/main/java/net/minecraft/server/PlayerChunk.java
+++ b/src/main/java/net/minecraft/server/PlayerChunk.java
@@ -10,6 +10,7 @@ class PlayerChunk {
private short[] dirtyBlocks;
private int dirtyCount;
private int f;
+ private long g;
private boolean loaded = false; // CraftBukkit
final PlayerChunkMap playerChunkMap;
@@ -18,7 +19,6 @@ class PlayerChunk {
this.playerChunkMap = playerchunkmap;
this.b = new ArrayList();
this.dirtyBlocks = new short[64];
- this.dirtyCount = 0;
this.location = new ChunkCoordIntPair(i, j);
// CraftBukkit start
playerchunkmap.a().chunkProviderServer.getChunkAt(i, j, new Runnable() {
@@ -33,6 +33,10 @@ class PlayerChunk {
if (this.b.contains(entityplayer)) {
throw new IllegalStateException("Failed to add player. " + entityplayer + " already is in chunk " + this.location.x + ", " + this.location.z);
} else {
+ if (this.b.isEmpty()) {
+ this.g = PlayerChunkMap.a(this.playerChunkMap).getTime();
+ }
+
this.b.add(entityplayer);
// CraftBukkit start
@@ -52,15 +56,19 @@ class PlayerChunk {
public void b(EntityPlayer entityplayer) {
if (this.b.contains(entityplayer)) {
- entityplayer.playerConnection.sendPacket(new Packet51MapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), true, 0));
+ Chunk chunk = PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z);
+
+ entityplayer.playerConnection.sendPacket(new Packet51MapChunk(chunk, true, 0));
this.b.remove(entityplayer);
entityplayer.chunkCoordIntPairQueue.remove(this.location);
if (this.b.isEmpty()) {
long i = (long) this.location.x + 2147483647L | (long) this.location.z + 2147483647L << 32;
+ this.a(chunk);
PlayerChunkMap.b(this.playerChunkMap).remove(i);
+ PlayerChunkMap.c(this.playerChunkMap).remove(this);
if (this.dirtyCount > 0) {
- PlayerChunkMap.c(this.playerChunkMap).remove(this);
+ PlayerChunkMap.d(this.playerChunkMap).remove(this);
}
this.playerChunkMap.a().chunkProviderServer.queueUnload(this.location.x, this.location.z);
@@ -68,9 +76,18 @@ class PlayerChunk {
}
}
+ public void a() {
+ this.a(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z));
+ }
+
+ private void a(Chunk chunk) {
+ chunk.q += PlayerChunkMap.a(this.playerChunkMap).getTime() - this.g;
+ this.g = PlayerChunkMap.a(this.playerChunkMap).getTime();
+ }
+
public void a(int i, int j, int k) {
if (this.dirtyCount == 0) {
- PlayerChunkMap.c(this.playerChunkMap).add(this);
+ PlayerChunkMap.d(this.playerChunkMap).add(this);
}
this.f |= 1 << (j >> 4);
@@ -97,7 +114,7 @@ class PlayerChunk {
}
}
- public void a() {
+ public void b() {
if (this.dirtyCount != 0) {
int i;
int j;
@@ -107,7 +124,7 @@ class PlayerChunk {
i = this.location.x * 16 + (this.dirtyBlocks[0] >> 12 & 15);
j = this.dirtyBlocks[0] & 255;
k = this.location.z * 16 + (this.dirtyBlocks[0] >> 8 & 15);
- this.sendAll(new Packet53BlockChange(i, j, k, PlayerChunkMap.a(this.playerChunkMap)));
+ this.sendAll(new Packet51MapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); // CraftBukkit - send everything (including biome) if all sections flagged
if (PlayerChunkMap.a(this.playerChunkMap).isTileEntity(i, j, k)) {
this.sendTileEntity(PlayerChunkMap.a(this.playerChunkMap).getTileEntity(i, j, k));
}
@@ -117,7 +134,7 @@ class PlayerChunk {
if (this.dirtyCount == 64) {
i = this.location.x * 16;
j = this.location.z * 16;
- this.sendAll(new Packet51MapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), (this.f == 0xFFFF), this.f)); // CraftBukkit - send everything (including biome) if all sections flagged
+ this.sendAll(new Packet51MapChunk(PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z), false, this.f));
for (k = 0; k < 16; ++k) {
if ((this.f & 1 << k) != 0) {
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 0dfd1907..4e0398c7 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -15,8 +15,10 @@ public class PlayerChunkMap {
private final List managedPlayers = new ArrayList();
private final LongHashMap c = new LongHashMap();
private final Queue d = new java.util.concurrent.ConcurrentLinkedQueue(); // CraftBukkit ArrayList -> ConcurrentLinkedQueue
- private final int e;
- private final int[][] f = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}};
+ private final Queue e = new java.util.concurrent.ConcurrentLinkedQueue(); // CraftBukkit ArrayList -> ConcurrentLinkedQueue
+ private final int f;
+ private long g;
+ private final int[][] h = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}};
private boolean wasNotEmpty; // CraftBukkit
public PlayerChunkMap(WorldServer worldserver, int i) {
@@ -25,7 +27,7 @@ public class PlayerChunkMap {
} else if (i < 3) {
throw new IllegalArgumentException("Too small view radius!");
} else {
- this.e = i;
+ this.f = i;
this.world = worldserver;
}
}
@@ -35,15 +37,30 @@ public class PlayerChunkMap {
}
public void flush() {
- // CraftBukkit start - Use iterator
- java.util.Iterator iterator = this.d.iterator();
+ long i = this.world.getTime();
+ int j;
+ PlayerChunk playerchunk;
+
+ if (i - this.g > 8000L) {
+ this.g = i;
+
+ // CraftBukkit start - Use iterator
+ java.util.Iterator iterator = this.e.iterator();
+ while (iterator.hasNext()) {
+ playerchunk = (PlayerChunk) iterator.next();
+ playerchunk.b();
+ playerchunk.a();
+ }
+ } else {
+ java.util.Iterator iterator = this.d.iterator();
- while (iterator.hasNext()) {
- PlayerChunk playerinstance = (PlayerChunk) iterator.next();
- playerinstance.a();
- iterator.remove();
+ while (iterator.hasNext()) {
+ playerchunk = (PlayerChunk) iterator.next();
+ playerchunk.b();
+ iterator.remove();
+ // CraftBukkit end
+ }
}
- // CraftBukkit end
// this.d.clear(); // CraftBukkit - Removals are already covered
if (this.managedPlayers.isEmpty()) {
@@ -68,6 +85,7 @@ public class PlayerChunkMap {
if (playerchunk == null && flag) {
playerchunk = new PlayerChunk(this, i, j);
this.c.put(k, playerchunk);
+ this.e.add(playerchunk);
}
return playerchunk;
@@ -101,8 +119,8 @@ public class PlayerChunkMap {
// CraftBukkit start - Load nearby chunks first
List<ChunkCoordIntPair> chunkList = new LinkedList<ChunkCoordIntPair>();
- for (int k = i - this.e; k <= i + this.e; ++k) {
- for (int l = j - this.e; l <= j + this.e; ++l) {
+ for (int k = i - this.f; k <= i + this.f; ++k) {
+ for (int l = j - this.f; l <= j + this.f; ++l) {
chunkList.add(new ChunkCoordIntPair(k, l));
}
}
@@ -120,7 +138,7 @@ public class PlayerChunkMap {
public void b(EntityPlayer entityplayer) {
ArrayList arraylist = new ArrayList(entityplayer.chunkCoordIntPairQueue);
int i = 0;
- int j = this.e;
+ int j = this.f;
int k = (int) entityplayer.locX >> 4;
int l = (int) entityplayer.locZ >> 4;
int i1 = 0;
@@ -136,7 +154,7 @@ public class PlayerChunkMap {
for (k1 = 1; k1 <= j * 2; ++k1) {
for (int l1 = 0; l1 < 2; ++l1) {
- int[] aint = this.f[i++ % 4];
+ int[] aint = this.h[i++ % 4];
for (int i2 = 0; i2 < k1; ++i2) {
i1 += aint[0];
@@ -152,8 +170,8 @@ public class PlayerChunkMap {
i %= 4;
for (k1 = 0; k1 < j * 2; ++k1) {
- i1 += this.f[i][0];
- j1 += this.f[i][1];
+ i1 += this.h[i][0];
+ j1 += this.h[i][1];
chunkcoordintpair = PlayerChunk.a(this.a(k + i1, l + j1, true));
if (arraylist.contains(chunkcoordintpair)) {
entityplayer.chunkCoordIntPairQueue.add(chunkcoordintpair);
@@ -165,8 +183,8 @@ public class PlayerChunkMap {
int i = (int) entityplayer.d >> 4;
int j = (int) entityplayer.e >> 4;
- for (int k = i - this.e; k <= i + this.e; ++k) {
- for (int l = j - this.e; l <= j + this.e; ++l) {
+ for (int k = i - this.f; k <= i + this.f; ++k) {
+ for (int l = j - this.f; l <= j + this.f; ++l) {
PlayerChunk playerchunk = this.a(k, l, false);
if (playerchunk != null) {
@@ -195,7 +213,7 @@ public class PlayerChunkMap {
if (d2 >= 64.0D) {
int k = (int) entityplayer.d >> 4;
int l = (int) entityplayer.e >> 4;
- int i1 = this.e;
+ int i1 = this.f;
int j1 = i - k;
int k1 = j - l;
List<ChunkCoordIntPair> chunksToLoad = new LinkedList<ChunkCoordIntPair>(); // CraftBukkit
@@ -254,6 +272,10 @@ public class PlayerChunkMap {
}
static Queue c(PlayerChunkMap playermanager) { // CraftBukkit List -> Queue
+ return playermanager.e;
+ }
+
+ static Queue d(PlayerChunkMap playermanager) { // CraftBukkit List -> Queue
return playermanager.d;
}
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
index 018c314f..f82d932d 100644
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
@@ -1,6 +1,7 @@
package net.minecraft.server;
import java.io.ByteArrayInputStream;
+import java.io.DataInput;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.ArrayList;
@@ -8,6 +9,8 @@ import java.util.Iterator;
import java.util.Random;
import java.util.concurrent.Callable;
+import org.apache.commons.lang3.StringUtils;
+
// CraftBukkit start
import java.io.UnsupportedEncodingException;
import java.util.concurrent.ExecutionException;
@@ -54,7 +57,7 @@ public class PlayerConnection extends Connection {
public final INetworkManager networkManager;
private final MinecraftServer minecraftServer;
- public boolean disconnected = false;
+ public boolean disconnected;
public EntityPlayer player;
private int e;
private int f;
@@ -63,7 +66,7 @@ public class PlayerConnection extends Connection {
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 volatile int chatThrottle; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); // CraftBukkit - multithreaded field
private int x = 0;
private double y;
private double z;
@@ -141,7 +144,7 @@ public class PlayerConnection extends Connection {
public void disconnect(String s) {
if (!this.disconnected) {
// CraftBukkit start
- String leaveMessage = EnumChatFormat.YELLOW + this.player.name + " left the game.";
+ String leaveMessage = EnumChatFormat.YELLOW + this.player.getName() + " left the game.";
PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage);
@@ -157,14 +160,14 @@ public class PlayerConnection extends Connection {
s = event.getReason();
// CraftBukkit end
- this.player.k();
+ this.player.l();
this.sendPacket(new Packet255KickDisconnect(s));
this.networkManager.d();
// CraftBukkit start
leaveMessage = event.getLeaveMessage();
if (leaveMessage != null && leaveMessage.length() > 0) {
- this.minecraftServer.getPlayerList().sendAll(new Packet3Chat(leaveMessage));
+ this.minecraftServer.getPlayerList().sendMessage(ChatMessage.d(leaveMessage));
}
// CraftBukkit end
@@ -173,6 +176,10 @@ public class PlayerConnection extends Connection {
}
}
+ public void a(Packet27PlayerInput packet27playerinput) {
+ this.player.a(packet27playerinput.d(), packet27playerinput.f(), packet27playerinput.g(), packet27playerinput.h());
+ }
+
public void a(Packet10Flying packet10flying) {
WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension);
@@ -276,7 +283,7 @@ public class PlayerConnection extends Connection {
if (packet10flying.hasPos && packet10flying.y == -999.0D && packet10flying.stance == -999.0D) {
if (Math.abs(packet10flying.x) > 1.0D || Math.abs(packet10flying.z) > 1.0D) {
- System.err.println(this.player.name + " was caught trying to crash the server with an invalid position.");
+ System.err.println(this.player.getName() + " was caught trying to crash the server with an invalid position.");
this.disconnect("Nope!");
return;
}
@@ -286,13 +293,13 @@ public class PlayerConnection extends Connection {
}
this.player.onGround = packet10flying.g;
- this.player.g();
+ this.player.h();
this.player.move(d5, 0.0D, d4);
this.player.setLocation(d1, d2, d3, f, f1);
this.player.motX = d5;
this.player.motZ = d4;
if (this.player.vehicle != null) {
- worldserver.vehicleEnteredWorld(this.player.vehicle, true);
+ // worldserver.vehicleEnteredWorld(this.player.vehicle, true); // CraftBukkit - removed
}
if (this.player.vehicle != null) {
@@ -300,15 +307,18 @@ public class PlayerConnection extends Connection {
}
this.minecraftServer.getPlayerList().d(this.player);
- this.y = this.player.locX;
- this.z = this.player.locY;
- this.p = this.player.locZ;
+ if (this.checkMovement) {
+ this.y = this.player.locX;
+ this.z = this.player.locY;
+ this.p = this.player.locZ;
+ }
+
worldserver.playerJoinedWorld(this.player);
return;
}
if (this.player.isSleeping()) {
- this.player.g();
+ this.player.h();
this.player.setLocation(this.y, this.z, this.p, this.player.yaw, this.player.pitch);
worldserver.playerJoinedWorld(this.player);
return;
@@ -335,7 +345,7 @@ public class PlayerConnection extends Connection {
d4 = packet10flying.stance - packet10flying.y;
if (!this.player.isSleeping() && (d4 > 1.65D || d4 < 0.1D)) {
this.disconnect("Illegal stance");
- this.minecraftServer.getLogger().warning(this.player.name + " had an illegal stance: " + d4);
+ this.minecraftServer.getLogger().warning(this.player.getName() + " had an illegal stance: " + d4);
return;
}
@@ -351,7 +361,7 @@ public class PlayerConnection extends Connection {
f3 = packet10flying.pitch;
}
- this.player.g();
+ this.player.h();
this.player.X = 0.0F;
this.player.setLocation(this.y, this.z, this.p, f2, f3);
if (!this.checkMovement) {
@@ -368,8 +378,8 @@ public class PlayerConnection extends Connection {
// CraftBukkit end
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
- this.minecraftServer.getLogger().warning(this.player.name + " moved too quickly! " + d4 + "," + d6 + "," + d7 + " (" + d8 + ", " + d9 + ", " + d10 + ")");
+ if (d11 > 100.0D && this.checkMovement && (!this.minecraftServer.K() || !this.minecraftServer.H().equals(this.player.getName()))) { // CraftBukkit - Added this.checkMovement condition to solve this check being triggered by teleports
+ this.minecraftServer.getLogger().warning(this.player.getName() + " moved too quickly! " + d4 + "," + d6 + "," + d7 + " (" + d8 + ", " + d9 + ", " + d10 + ")");
this.a(this.y, this.z, this.p, this.player.yaw, this.player.pitch);
return;
}
@@ -378,7 +388,7 @@ public class PlayerConnection extends Connection {
boolean flag = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).isEmpty();
if (this.player.onGround && !packet10flying.g && d6 > 0.0D) {
- this.player.j(0.2F);
+ this.player.a(0.2F);
}
this.player.move(d4, d6, d7);
@@ -398,7 +408,7 @@ public class PlayerConnection extends Connection {
if (d11 > 0.0625D && !this.player.isSleeping() && !this.player.playerInteractManager.isCreative()) {
flag1 = true;
- this.minecraftServer.getLogger().warning(this.player.name + " moved wrongly!");
+ this.minecraftServer.getLogger().warning(this.player.getName() + " moved wrongly!");
}
this.player.setLocation(d1, d2, d3, f2, f3);
@@ -415,7 +425,7 @@ public class PlayerConnection extends Connection {
if (d12 >= -0.03125D) {
++this.f;
if (this.f > 80) {
- this.minecraftServer.getLogger().warning(this.player.name + " was kicked for floating too long!");
+ this.minecraftServer.getLogger().warning(this.player.getName() + " was kicked for floating too long!");
this.disconnect("Flying is not enabled on this server");
return;
}
@@ -428,6 +438,8 @@ public class PlayerConnection extends Connection {
this.minecraftServer.getPlayerList().d(this.player);
if (this.player.playerInteractManager.isCreative()) return; // CraftBukkit - fixed fall distance accumulating while being in Creative mode.
this.player.b(this.player.locY - d0, packet10flying.g);
+ } else if (this.e % 20 == 0) {
+ this.a(this.y, this.z, this.p, this.player.yaw, this.player.pitch);
}
}
}
@@ -496,7 +508,7 @@ public class PlayerConnection extends Connection {
// Else we increment the drop count and check the amount.
this.dropCount++;
if (this.dropCount >= 20) {
- this.minecraftServer.getLogger().warning(this.player.name + " dropped their items too quickly!");
+ this.minecraftServer.getLogger().warning(this.player.getName() + " dropped their items too quickly!");
this.disconnect("You dropped your items too quickly (Hacking?)");
return;
}
@@ -506,7 +518,7 @@ public class PlayerConnection extends Connection {
} else if (packet14blockdig.e == 3) {
this.player.a(true);
} else if (packet14blockdig.e == 5) {
- this.player.bZ();
+ this.player.bo();
} else {
boolean flag = false;
@@ -625,7 +637,7 @@ 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("" + EnumChatFormat.GRAY + "Height limit for building is " + this.minecraftServer.getMaxBuildHeight()));
+ this.player.playerConnection.sendPacket(new Packet3Chat(ChatMessage.b("build.tooHigh", new Object[] { Integer.valueOf(this.minecraftServer.getMaxBuildHeight())}).a(EnumChatFormat.RED)));
flag = true;
} else {
// CraftBukkit start - Check if we can actually do something over this large a distance
@@ -692,15 +704,15 @@ 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
- this.minecraftServer.getLogger().info(this.player.name + " lost connection: " + s);
+ this.minecraftServer.getLogger().info(this.player.getName() + " 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)) {
- this.minecraftServer.getPlayerList().sendAll(new Packet3Chat(quitMessage));
+ this.minecraftServer.getPlayerList().sendMessage(ChatMessage.d(quitMessage));
}
// CraftBukkit end
this.disconnected = true;
- if (this.minecraftServer.I() && this.player.name.equals(this.minecraftServer.H())) {
+ if (this.minecraftServer.K() && this.player.getName().equals(this.minecraftServer.J())) {
this.minecraftServer.getLogger().info("Stopping singleplayer server as player logged out");
this.minecraftServer.safeShutdown();
}
@@ -770,14 +782,14 @@ public class PlayerConnection extends Connection {
this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex;
} else {
- this.minecraftServer.getLogger().warning(this.player.name + " tried to set an invalid carried item");
+ this.minecraftServer.getLogger().warning(this.player.getName() + " tried to set an invalid carried item");
this.disconnect("Nope!"); // CraftBukkit
}
}
public void a(Packet3Chat packet3chat) {
if (this.player.getChatFlags() == 2) {
- this.sendPacket(new Packet3Chat("Cannot send chat message."));
+ this.sendPacket(new Packet3Chat(ChatMessage.e("chat.cannotSend").a(EnumChatFormat.RED)));
} else {
String s = packet3chat.message;
@@ -806,7 +818,7 @@ public class PlayerConnection extends Connection {
}
// CraftBukkit end
} else {
- s = s.trim();
+ s = StringUtils.normalizeSpace(s);
for (int i = 0; i < s.length(); ++i) {
if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) {
@@ -846,7 +858,7 @@ public class PlayerConnection extends Connection {
this.chat(s, packet3chat.a_());
// This section stays because it is only applicable to packets
- if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.name)) { // CraftBukkit use thread-safe spam
+ if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getName())) { // CraftBukkit use thread-safe spam
if (packet3chat.a_()) {
Waitable waitable = new Waitable() {
@Override
@@ -876,7 +888,7 @@ public class PlayerConnection extends Connection {
public void chat(String s, boolean async) {
if (!this.player.dead) {
if (s.length() == 0) {
- this.minecraftServer.getLogger().warning(this.player.name + " tried to send an empty message");
+ this.minecraftServer.getLogger().warning(this.player.getName() + " tried to send an empty message");
return;
}
@@ -910,7 +922,7 @@ public class PlayerConnection extends Connection {
PlayerConnection.this.minecraftServer.console.sendMessage(message);
if (((LazyPlayerSet) queueEvent.getRecipients()).isLazy()) {
for (Object player : PlayerConnection.this.minecraftServer.getPlayerList().players) {
- ((EntityPlayer) player).sendMessage(message);
+ ((EntityPlayer) player).sendMessage(ChatMessage.d(message));
}
} else {
for (Player player : queueEvent.getRecipients()) {
@@ -940,7 +952,7 @@ public class PlayerConnection extends Connection {
minecraftServer.console.sendMessage(s);
if (((LazyPlayerSet) event.getRecipients()).isLazy()) {
for (Object recipient : minecraftServer.getPlayerList().players) {
- ((EntityPlayer) recipient).sendMessage(s);
+ ((EntityPlayer) recipient).sendMessage(ChatMessage.d(s));
}
} else {
for (Player recipient : event.getRecipients()) {
@@ -1017,7 +1029,7 @@ public class PlayerConnection extends Connection {
if (event.isCancelled()) return;
// CraftBukkit end
- this.player.bK();
+ this.player.aR();
}
}
@@ -1055,6 +1067,12 @@ public class PlayerConnection extends Connection {
} else if (packet19entityaction.animation == 3) {
this.player.a(false, true, true);
// this.checkMovement = false; // CraftBukkit - this is handled in teleport
+ } else if (packet19entityaction.animation == 6) {
+ if (this.player.vehicle != null && this.player.vehicle instanceof EntityHorse) {
+ ((EntityHorse) this.player.vehicle).u(packet19entityaction.c);
+ }
+ } else if (packet19entityaction.animation == 7 && this.player.vehicle != null && this.player.vehicle instanceof EntityHorse) {
+ ((EntityHorse) this.player.vehicle).f(this.player);
}
}
@@ -1073,7 +1091,7 @@ public class PlayerConnection extends Connection {
Entity entity = worldserver.getEntity(packet7useentity.target);
if (entity != null) {
- boolean flag = this.player.n(entity);
+ boolean flag = this.player.o(entity);
double d0 = 36.0D;
if (!flag) {
@@ -1097,10 +1115,11 @@ public class PlayerConnection extends Connection {
this.player.updateInventory(this.player.activeContainer);
}
} else if (packet7useentity.action == 1) {
- if ((entity instanceof EntityItem) || (entity instanceof EntityExperienceOrb) || (entity instanceof EntityArrow)) {
+ // CraftBukkit - Check for player
+ if ((entity instanceof EntityItem) || (entity instanceof EntityExperienceOrb) || (entity instanceof EntityArrow) || (entity == this.player)) {
String type = entity.getClass().getSimpleName();
disconnect("Attacking an " + type + " is not permitted");
- System.out.println("Player " + player.name + " tried to attack an " + type + ", so I have disconnected them for exploiting.");
+ System.out.println("Player " + player.getName() + " tried to attack an " + type + ", so I have disconnected them for exploiting.");
return;
}
@@ -1119,19 +1138,19 @@ public class PlayerConnection extends Connection {
if (packet205clientcommand.a == 1) {
if (this.player.viewingCredits) {
this.minecraftServer.getPlayerList().changeDimension(this.player, 0, PlayerTeleportEvent.TeleportCause.END_PORTAL); // CraftBukkit - reroute logic through custom portal management
- } else if (this.player.o().getWorldData().isHardcore()) {
- if (this.minecraftServer.I() && this.player.name.equals(this.minecraftServer.H())) {
+ } else if (this.player.p().getWorldData().isHardcore()) {
+ if (this.minecraftServer.K() && this.player.getName().equals(this.minecraftServer.J())) {
this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!");
- this.minecraftServer.P();
+ this.minecraftServer.R();
} else {
- BanEntry banentry = new BanEntry(this.player.name);
+ BanEntry banentry = new BanEntry(this.player.getName());
banentry.setReason("Death in Hardcore");
this.minecraftServer.getPlayerList().getNameBans().add(banentry);
this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!");
}
} else {
- if (this.player.getHealth() > 0) {
+ if (this.player.getHealth() > 0.0F) {
return;
}
@@ -1151,7 +1170,7 @@ public class PlayerConnection extends Connection {
CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit
- this.player.j();
+ this.player.k();
}
public void a(Packet102WindowClick packet102windowclick) {
@@ -1240,7 +1259,7 @@ public class PlayerConnection extends Connection {
action = InventoryAction.NOTHING;
} else {
Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot);
- if (slot != null && slot.a(this.player) && slot.d()) { // Should be Slot.hasItem()
+ if (slot != null && slot.a(this.player) && slot.e()) { // Should be Slot.hasItem()
action = InventoryAction.MOVE_TO_OTHER_INVENTORY;
} else {
action = InventoryAction.NOTHING;
@@ -1254,7 +1273,7 @@ public class PlayerConnection extends Connection {
if (clickedSlot.a(player)) {
ItemStack hotbar = this.player.inventory.getItem(packet102windowclick.button);
boolean canCleanSwap = hotbar == null || (clickedSlot.inventory == player.inventory && clickedSlot.isAllowed(hotbar)); // the slot will accept the hotbar item
- if (clickedSlot.d()) {
+ if (clickedSlot.e()) {
if (canCleanSwap) {
action = InventoryAction.HOTBAR_SWAP;
} else {
@@ -1265,7 +1284,7 @@ public class PlayerConnection extends Connection {
action = InventoryAction.NOTHING; // This is not sane! Mojang: You should test for other slots of same type
}
}
- } else if (!clickedSlot.d() && hotbar != null && clickedSlot.isAllowed(hotbar)) {
+ } else if (!clickedSlot.e() && hotbar != null && clickedSlot.isAllowed(hotbar)) {
action = InventoryAction.HOTBAR_SWAP;
} else {
action = InventoryAction.NOTHING;
@@ -1283,7 +1302,7 @@ public class PlayerConnection extends Connection {
action = InventoryAction.NOTHING;
} else {
Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot);
- if (slot != null && slot.d() && player.abilities.canInstantlyBuild && player.inventory.getCarried() == null) {
+ if (slot != null && slot.e() && player.abilities.canInstantlyBuild && player.inventory.getCarried() == null) {
action = InventoryAction.CLONE_STACK;
} else {
action = InventoryAction.NOTHING;
@@ -1298,7 +1317,7 @@ public class PlayerConnection extends Connection {
if (packet102windowclick.button == 0) {
click = ClickType.DROP;
Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot);
- if (slot != null && slot.d() && slot.a(player) && slot.getItem() != null && slot.getItem().id != 0) {
+ if (slot != null && slot.e() && slot.a(player) && slot.getItem() != null && slot.getItem().id != 0) {
action = InventoryAction.DROP_ONE_SLOT;
} else {
action = InventoryAction.NOTHING;
@@ -1306,7 +1325,7 @@ public class PlayerConnection extends Connection {
} else if (packet102windowclick.button == 1) {
click = ClickType.CONTROL_DROP;
Slot slot = this.player.activeContainer.getSlot(packet102windowclick.slot);
- if (slot != null && slot.d() && slot.a(player) && slot.getItem() != null && slot.getItem().id != 0) {
+ if (slot != null && slot.e() && slot.a(player) && slot.getItem() != null && slot.getItem().id != 0) {
action = InventoryAction.DROP_ALL_SLOT;
} else {
action = InventoryAction.NOTHING;
@@ -1538,7 +1557,7 @@ public class PlayerConnection extends Connection {
TileEntitySign tileentitysign = (TileEntitySign) tileentity;
if (!tileentitysign.a()) {
- this.minecraftServer.warning("Player " + this.player.name + " just tried to change non-editable sign");
+ this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign");
this.sendPacket(new Packet130UpdateSign(packet130updatesign.x, packet130updatesign.y, packet130updatesign.z, tileentitysign.lines)); // CraftBukkit
return;
}
@@ -1626,7 +1645,7 @@ public class PlayerConnection extends Connection {
String s;
- for (Iterator iterator = this.minecraftServer.a((ICommandListener) this.player, packet203tabcomplete.d()).iterator(); iterator.hasNext(); stringbuilder.append(s)) {
+ for (Iterator iterator = this.minecraftServer.a(this.player, packet203tabcomplete.d()).iterator(); iterator.hasNext(); stringbuilder.append(s)) {
s = (String) iterator.next();
if (stringbuilder.length() > 0) {
stringbuilder.append('\0'); // CraftBukkit - fix decompile issue
@@ -1665,7 +1684,7 @@ public class PlayerConnection extends Connection {
}
// CraftBukkit start
} catch (Throwable exception) {
- this.minecraftServer.getLogger().warning(this.player.name + " sent invalid MC|BEdit data", exception);
+ this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|BEdit data", exception);
this.disconnect("Invalid book data!");
// CraftBukkit end
}
@@ -1683,7 +1702,7 @@ public class PlayerConnection extends Connection {
}
// CraftBukkit start
} catch (Throwable exception1) {
- this.minecraftServer.getLogger().warning(this.player.name + " sent invalid MC|BSign data", exception1);
+ this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|BSign data", exception1);
this.disconnect("Invalid book data!");
// CraftBukkit end
}
@@ -1701,7 +1720,7 @@ public class PlayerConnection extends Connection {
}
} catch (Exception exception2) {
// CraftBukkit start
- this.minecraftServer.getLogger().warning(this.player.name + " sent invalid MC|TrSel data", exception2);
+ this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|TrSel data", exception2);
this.disconnect("Invalid trade data!");
// CraftBukkit end
}
@@ -1710,29 +1729,29 @@ public class PlayerConnection extends Connection {
if ("MC|AdvCdm".equals(packet250custompayload.tag)) {
if (!this.minecraftServer.getEnableCommandBlock()) {
- this.player.sendMessage(this.player.a("advMode.notEnabled", new Object[0]));
+ this.player.sendMessage(ChatMessage.e("advMode.notEnabled"));
} else if (this.player.a(2, "") && this.player.abilities.canInstantlyBuild) {
try {
datainputstream = new DataInputStream(new ByteArrayInputStream(packet250custompayload.data));
i = datainputstream.readInt();
j = datainputstream.readInt();
int k = datainputstream.readInt();
- String s = Packet.a(datainputstream, 256);
+ String s = Packet.a((DataInput) datainputstream, 256);
TileEntity tileentity = this.player.world.getTileEntity(i, j, k);
if (tileentity != null && tileentity instanceof TileEntityCommand) {
- ((TileEntityCommand) tileentity).b(s);
+ ((TileEntityCommand) tileentity).a(s);
this.player.world.notify(i, j, k);
- this.player.sendMessage("Command set: " + s);
+ this.player.sendMessage(ChatMessage.b("advMode.setCommand.success", new Object[] { s}));
}
} catch (Exception exception3) {
// CraftBukkit start
- this.minecraftServer.getLogger().warning(this.player.name + " sent invalid MC|AdvCdm data", exception3);
+ this.minecraftServer.getLogger().warning(this.player.getName() + " sent invalid MC|AdvCdm data", exception3);
this.disconnect("Invalid CommandBlock data!");
// CraftBukkit end
}
} else {
- this.player.sendMessage(this.player.a("advMode.notAllowed", new Object[0]));
+ this.player.sendMessage(ChatMessage.e("advMode.notAllowed"));
}
} else if ("MC|Beacon".equals(packet250custompayload.tag)) {
if (this.player.activeContainer instanceof ContainerBeacon) {
@@ -1743,7 +1762,7 @@ public class PlayerConnection extends Connection {
ContainerBeacon containerbeacon = (ContainerBeacon) this.player.activeContainer;
Slot slot = containerbeacon.getSlot(0);
- if (slot.d()) {
+ if (slot.e()) {
slot.a(1);
TileEntityBeacon tileentitybeacon = containerbeacon.e();
@@ -1753,7 +1772,7 @@ public class PlayerConnection extends Connection {
}
} catch (Exception exception4) {
// CraftBukkit start
- this.minecraftServer.getLogger().warning(this.player.name + " sent invalid MC|Beacon data", exception4);
+ this.minecraftServer.getLogger().warning(this.player.getName() + " 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 1243d1d0..d77a4cc1 100644
--- a/src/main/java/net/minecraft/server/PlayerInteractManager.java
+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java
@@ -107,7 +107,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.e(i, j, k)) {
+ if (!this.gamemode.isAdventure() || this.player.d(i, j, k)) {
// CraftBukkit start
if (event.isCancelled()) {
// Let the client know the block still exists
@@ -258,7 +258,10 @@ public class PlayerInteractManager {
event = new BlockBreakEvent(block, this.player.getBukkitEntity());
// Adventure mode pre-cancel
- event.setCancelled(this.gamemode.isAdventure() && !this.player.e(i, j, k));
+ event.setCancelled(this.gamemode.isAdventure() && !this.player.d(i, j, k));
+
+ // Sword + Creative mode pre-cancel
+ event.setCancelled(event.isCancelled() || (this.gamemode.d() && this.player.aV() != null && this.player.aV().getItem() instanceof ItemSword));
// Calculate default block experience
Block nmsBlock = Block.byId[block.getTypeId()];
@@ -308,13 +311,13 @@ public class PlayerInteractManager {
if (this.isCreative()) {
this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world));
} else {
- ItemStack itemstack = this.player.cd();
+ ItemStack itemstack = this.player.bt();
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.ce();
+ this.player.bu();
}
}
@@ -353,7 +356,7 @@ public class PlayerInteractManager {
entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = null;
}
- if (!entityhuman.bX()) {
+ if (!entityhuman.bm()) {
((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 7bf2c6f3..7cf491aa 100644
--- a/src/main/java/net/minecraft/server/PlayerInventory.java
+++ b/src/main/java/net/minecraft/server/PlayerInventory.java
@@ -13,10 +13,10 @@ public class PlayerInventory implements IInventory {
public ItemStack[] items = new ItemStack[36];
public ItemStack[] armor = new ItemStack[4];
- public int itemInHandIndex = 0;
+ public int itemInHandIndex;
public EntityHuman player;
private ItemStack g;
- public boolean e = false;
+ public boolean e;
// CraftBukkit start
public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>();
@@ -63,7 +63,7 @@ public class PlayerInventory implements IInventory {
return 9;
}
- private int h(int i) {
+ private int g(int i) {
for (int j = 0; j < this.items.length; ++j) {
if (this.items[j] != null && this.items[j].id == i) {
return j;
@@ -131,6 +131,19 @@ public class PlayerInventory implements IInventory {
}
}
+ if (this.g != null) {
+ if (i > -1 && this.g.id != i) {
+ return k;
+ }
+
+ if (j > -1 && this.g.getData() != j) {
+ return k;
+ }
+
+ k += this.g.count;
+ this.setCarried((ItemStack) null);
+ }
+
return k;
}
@@ -181,7 +194,7 @@ public class PlayerInventory implements IInventory {
} else {
j -= l;
this.items[k].count += l;
- this.items[k].b = 5;
+ this.items[k].c = 5;
return j;
}
}
@@ -197,7 +210,7 @@ public class PlayerInventory implements IInventory {
}
public boolean d(int i) {
- int j = this.h(i);
+ int j = this.g(i);
if (j < 0) {
return false;
@@ -211,7 +224,7 @@ public class PlayerInventory implements IInventory {
}
public boolean e(int i) {
- int j = this.h(i);
+ int j = this.g(i);
return j >= 0;
}
@@ -219,6 +232,8 @@ public class PlayerInventory implements IInventory {
public boolean pickup(ItemStack itemstack) {
if (itemstack == null) {
return false;
+ } else if (itemstack.count == 0) {
+ return false;
} else {
try {
int i;
@@ -227,7 +242,7 @@ public class PlayerInventory implements IInventory {
i = this.j();
if (i >= 0) {
this.items[i] = ItemStack.b(itemstack);
- this.items[i].b = 5;
+ this.items[i].c = 5;
itemstack.count = 0;
return true;
} else if (this.player.abilities.canInstantlyBuild) {
@@ -401,12 +416,6 @@ public class PlayerInventory implements IInventory {
return maxStack;
}
- public int a(Entity entity) {
- ItemStack itemstack = this.getItem(this.itemInHandIndex);
-
- return itemstack != null ? itemstack.a(entity) : 1;
- }
-
public boolean b(Block block) {
if (block.material.isAlwaysDestroyable()) {
return true;
@@ -435,17 +444,17 @@ public class PlayerInventory implements IInventory {
return i;
}
- public void g(int i) {
- i /= 4;
- if (i < 1) {
- i = 1;
+ public void a(float f) {
+ f /= 4.0F;
+ if (f < 1.0F) {
+ f = 1.0F;
}
- for (int j = 0; j < this.armor.length; ++j) {
- if (this.armor[j] != null && this.armor[j].getItem() instanceof ItemArmor) {
- this.armor[j].damage(i, this.player);
- if (this.armor[j].count == 0) {
- this.armor[j] = null;
+ for (int i = 0; i < this.armor.length; ++i) {
+ if (this.armor[i] != null && this.armor[i].getItem() instanceof ItemArmor) {
+ this.armor[i].damage((int) f, this.player);
+ if (this.armor[i].count == 0) {
+ this.armor[i] = null;
}
}
}
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index b7e327bc..b98a0787 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -46,7 +46,7 @@ public abstract class PlayerList {
protected int c;
private EnumGamemode l;
private boolean m;
- private int n = 0;
+ private int n;
// CraftBukkit start
private CraftServer cserver;
@@ -75,7 +75,7 @@ public abstract class PlayerList {
}
// CraftBukkit - add world and location to 'logged in' message.
- 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 + ")");
+ this.server.getLogger().info(entityplayer.getName() + "[" + 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();
@@ -96,13 +96,13 @@ public abstract class PlayerList {
playerconnection.sendPacket(new Packet16BlockItemSwitch(entityplayer.inventory.itemInHandIndex));
this.a((ScoreboardServer) worldserver.getScoreboard(), entityplayer);
this.b(entityplayer, worldserver);
- // this.sendAll(new Packet3Chat(EnumChatFormat.YELLOW + entityplayer.getScoreboardDisplayName() + EnumChatFormat.YELLOW + " joined the game.")); // CraftBukkit - handled in event
+ // this.sendMessage(ChatMessage.b("multiplayer.player.joined", new Object[] { entityplayer.getScoreboardDisplayName()}).a(EnumChatFormat.YELLOW)); // CraftBukkit - handled in event
this.c(entityplayer);
playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch);
- this.server.ae().a(playerconnection);
- playerconnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime()));
+ this.server.ag().a(playerconnection);
+ playerconnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")));
if (this.server.getTexturePack().length() > 0) {
- entityplayer.a(this.server.getTexturePack(), this.server.S());
+ entityplayer.a(this.server.getTexturePack(), this.server.U());
}
Iterator iterator = entityplayer.getEffects().iterator();
@@ -160,7 +160,7 @@ public abstract class PlayerList {
}
public void a(EntityPlayer entityplayer, WorldServer worldserver) {
- WorldServer worldserver1 = entityplayer.o();
+ WorldServer worldserver1 = entityplayer.p();
if (worldserver != null) {
worldserver.getPlayerChunkMap().removePlayer(entityplayer);
@@ -178,7 +178,7 @@ public abstract class PlayerList {
NBTTagCompound nbttagcompound = this.server.worlds.get(0).getWorldData().i(); // CraftBukkit
NBTTagCompound nbttagcompound1;
- if (entityplayer.getName().equals(this.server.H()) && nbttagcompound != null) {
+ if (entityplayer.getName().equals(this.server.J()) && nbttagcompound != null) {
entityplayer.f(nbttagcompound);
nbttagcompound1 = nbttagcompound;
System.out.println("loading single player");
@@ -195,7 +195,7 @@ public abstract class PlayerList {
public void c(EntityPlayer entityplayer) {
cserver.detectListNameConflict(entityplayer); // CraftBukkit
- // this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, 1000)); // CraftBukkit - replaced with loop below
+ // this.sendAll(new Packet201PlayerInfo(entityplayer.getName(), true, 1000)); // CraftBukkit - replaced with loop below
this.players.add(entityplayer);
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
@@ -206,7 +206,7 @@ public abstract class PlayerList {
String joinMessage = playerJoinEvent.getJoinMessage();
if ((joinMessage != null) && (joinMessage.length() > 0)) {
- this.server.getPlayerList().sendAll(new Packet3Chat(joinMessage));
+ this.server.getPlayerList().sendAll(new Packet3Chat(ChatMessage.d(joinMessage)));
}
this.cserver.onPlayerJoin(playerJoinEvent.getPlayer());
@@ -243,7 +243,7 @@ public abstract class PlayerList {
}
public void d(EntityPlayer entityplayer) {
- entityplayer.o().getPlayerChunkMap().movePlayer(entityplayer);
+ entityplayer.p().getPlayerChunkMap().movePlayer(entityplayer);
}
public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - return string
@@ -258,10 +258,10 @@ public abstract class PlayerList {
// CraftBukkit end
this.b(entityplayer);
- WorldServer worldserver = entityplayer.o();
+ WorldServer worldserver = entityplayer.p();
if (entityplayer.vehicle != null) {
- worldserver.kill(entityplayer.vehicle);
+ worldserver.removeEntity(entityplayer.vehicle);
System.out.println("removing player mount");
}
@@ -291,7 +291,7 @@ public abstract class PlayerList {
// Instead of kicking then returning, we need to store the kick reason
// in the event, check with plugins to see if it's ok, and THEN kick
// depending on the outcome.
- EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), s, this.server.M() ? new DemoPlayerInteractManager(this.server.getWorldServer(0)) : new PlayerInteractManager(this.server.getWorldServer(0)));
+ EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(0), s, this.server.O() ? new DemoPlayerInteractManager(this.server.getWorldServer(0)) : new PlayerInteractManager(this.server.getWorldServer(0)));
Player player = entity.getBukkitEntity();
PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, pendingconnection.getSocket().getInetAddress());
@@ -347,7 +347,7 @@ public abstract class PlayerList {
for (int i = 0; i < this.players.size(); ++i) {
entityplayer = (EntityPlayer) this.players.get(i);
- if (entityplayer.name.equalsIgnoreCase(s)) {
+ if (entityplayer.getName().equalsIgnoreCase(s)) {
arraylist.add(entityplayer);
}
}
@@ -362,7 +362,7 @@ public abstract class PlayerList {
/* CraftBukkit start
Object object;
- if (this.server.M()) {
+ if (this.server.O()) {
object = new DemoPlayerInteractManager(this.server.getWorldServer(0));
} else {
object = new PlayerInteractManager(this.server.getWorldServer(0));
@@ -381,9 +381,9 @@ public abstract class PlayerList {
public EntityPlayer moveToWorld(EntityPlayer entityplayer, int i, boolean flag, Location location, boolean avoidSuffocation) {
// CraftBukkit end
- entityplayer.o().getTracker().untrackPlayer(entityplayer);
- // entityplayer.o().getTracker().untrackEntity(entityplayer); // CraftBukkit
- entityplayer.o().getPlayerChunkMap().removePlayer(entityplayer);
+ entityplayer.p().getTracker().untrackPlayer(entityplayer);
+ // entityplayer.p().getTracker().untrackEntity(entityplayer); // CraftBukkit
+ entityplayer.p().getPlayerChunkMap().removePlayer(entityplayer);
this.players.remove(entityplayer);
this.server.getWorldServer(entityplayer.dimension).removeEntity(entityplayer);
ChunkCoordinates chunkcoordinates = entityplayer.getBed();
@@ -714,7 +714,7 @@ public abstract class PlayerList {
if (this.n < this.players.size()) {
EntityPlayer entityplayer = (EntityPlayer) this.players.get(this.n);
- this.sendAll(new Packet201PlayerInfo(entityplayer.name, true, entityplayer.ping));
+ this.sendAll(new Packet201PlayerInfo(entityplayer.getName(), true, entityplayer.ping));
}
// CraftBukkit end */
}
@@ -743,7 +743,7 @@ public abstract class PlayerList {
s = s + ", ";
}
- s = s + ((EntityPlayer) this.players.get(i)).name;
+ s = s + ((EntityPlayer) this.players.get(i)).getName();
}
return s;
@@ -753,7 +753,7 @@ public abstract class PlayerList {
String[] astring = new String[this.players.size()];
for (int i = 0; i < this.players.size(); ++i) {
- astring[i] = ((EntityPlayer) this.players.get(i)).name;
+ astring[i] = ((EntityPlayer) this.players.get(i)).getName();
}
return astring;
@@ -796,7 +796,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.m;
+ return this.operators.contains(s.trim().toLowerCase()) || this.server.K() && this.server.worlds.get(0).getWorldData().allowCommands() && this.server.J().equalsIgnoreCase(s) || this.m;
}
public EntityPlayer getPlayer(String s) {
@@ -810,62 +810,56 @@ public abstract class PlayerList {
}
entityplayer = (EntityPlayer) iterator.next();
- } while (!entityplayer.name.equalsIgnoreCase(s));
+ } while (!entityplayer.getName().equalsIgnoreCase(s));
return entityplayer;
}
- public List a(ChunkCoordinates chunkcoordinates, int i, int j, int k, int l, int i1, int j1, Map map, String s, String s1) {
+ public List a(ChunkCoordinates chunkcoordinates, int i, int j, int k, int l, int i1, int j1, Map map, String s, String s1, World world) {
if (this.players.isEmpty()) {
return null;
} else {
Object object = new ArrayList();
boolean flag = k < 0;
+ boolean flag1 = s != null && s.startsWith("!");
+ boolean flag2 = s1 != null && s1.startsWith("!");
int k1 = i * i;
int l1 = j * j;
k = MathHelper.a(k);
+ if (flag1) {
+ s = s.substring(1);
+ }
+
+ if (flag2) {
+ s1 = s1.substring(1);
+ }
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 ((world == null || entityplayer.world == world) && (s == null || flag1 != s.equalsIgnoreCase(entityplayer.getLocalizedName()))) {
+ if (s1 != null) {
+ ScoreboardTeam scoreboardteam = entityplayer.getScoreboardTeam();
+ String s2 = scoreboardteam == null ? "" : scoreboardteam.getName();
- if (s1 != null) {
- flag1 = s1.startsWith("!");
- if (flag1) {
- s1 = s1.substring(1);
+ if (flag2 == s1.equalsIgnoreCase(s2)) {
+ continue;
+ }
}
- ScoreboardTeam scoreboardteam = entityplayer.getScoreboardTeam();
- String s2 = scoreboardteam == null ? "" : scoreboardteam.getName();
+ if (chunkcoordinates != null && (i > 0 || j > 0)) {
+ float f = chunkcoordinates.e(entityplayer.b());
- if (flag1 == s1.equalsIgnoreCase(s2)) {
- continue;
+ if (i > 0 && f < (float) k1 || j > 0 && f > (float) l1) {
+ continue;
+ }
}
- }
-
- if (chunkcoordinates != null && (i > 0 || j > 0)) {
- float f = chunkcoordinates.e(entityplayer.b());
- if (i > 0 && f < (float) k1 || j > 0 && f > (float) l1) {
- continue;
+ 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);
}
}
-
- 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);
- }
}
if (chunkcoordinates != null) {
@@ -977,8 +971,8 @@ public abstract class PlayerList {
public void reloadWhitelist() {}
public void b(EntityPlayer entityplayer, WorldServer worldserver) {
- entityplayer.playerConnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime()));
- if (worldserver.P()) {
+ entityplayer.playerConnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle")));
+ if (worldserver.Q()) {
entityplayer.setPlayerWeather(org.bukkit.WeatherType.DOWNFALL, false); // CraftBukkit - handle player specific weather
}
}
@@ -1009,14 +1003,14 @@ public abstract class PlayerList {
this.hasWhitelist = flag;
}
- public List j(String s) {
+ public List i(String s) {
ArrayList arraylist = new ArrayList();
Iterator iterator = this.players.iterator();
while (iterator.hasNext()) {
EntityPlayer entityplayer = (EntityPlayer) iterator.next();
- if (entityplayer.p().equals(s)) {
+ if (entityplayer.q().equals(s)) {
arraylist.add(entityplayer);
}
}
@@ -1052,8 +1046,12 @@ public abstract class PlayerList {
}
}
- public void k(String s) {
- this.server.info(s);
- this.sendAll(new Packet3Chat(s));
+ public void sendMessage(ChatMessage chatmessage, boolean flag) {
+ this.server.sendMessage(chatmessage);
+ this.sendAll(new Packet3Chat(chatmessage, flag));
+ }
+
+ public void sendMessage(ChatMessage chatmessage) {
+ this.sendMessage(chatmessage, true);
}
}
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
index 1eea9478..03ad5dcf 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -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.R() - 1; i2 >= 0; --i2) {
+ for (int i2 = this.a.S() - 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.as();
+ int k2 = entity.ar();
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.R() - 1; k2 >= 0; --k2) {
+ for (k2 = this.a.S() - 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.R() - 1; k2 >= 0; --k2) {
+ for (k2 = this.a.S() - 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.R() - 10) {
- i1 = this.a.R() - 10;
+ if (i1 > this.a.S() - 10) {
+ i1 = this.a.S() - 10;
}
j5 = i1;
diff --git a/src/main/java/net/minecraft/server/RecipeArmorDye.java b/src/main/java/net/minecraft/server/RecipeArmorDye.java
index 38a9b461..0663e120 100644
--- a/src/main/java/net/minecraft/server/RecipeArmorDye.java
+++ b/src/main/java/net/minecraft/server/RecipeArmorDye.java
@@ -81,7 +81,7 @@ public class RecipeArmorDye extends ShapelessRecipes implements IRecipe { // Cra
return null;
}
- float[] afloat = EntitySheep.d[BlockCloth.g_(itemstack1.getData())];
+ float[] afloat = EntitySheep.bp[BlockCloth.j_(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/RecipesFurnace.java b/src/main/java/net/minecraft/server/RecipesFurnace.java
index fe56cde5..47a1a3e9 100644
--- a/src/main/java/net/minecraft/server/RecipesFurnace.java
+++ b/src/main/java/net/minecraft/server/RecipesFurnace.java
@@ -24,6 +24,7 @@ public class RecipesFurnace {
this.registerRecipe(Item.RAW_FISH.id, new ItemStack(Item.COOKED_FISH), 0.35F);
this.registerRecipe(Block.COBBLESTONE.id, new ItemStack(Block.STONE), 0.1F);
this.registerRecipe(Item.CLAY_BALL.id, new ItemStack(Item.CLAY_BRICK), 0.3F);
+ this.registerRecipe(Block.CLAY.id, new ItemStack(Block.HARDENED_CLAY), 0.35F);
this.registerRecipe(Block.CACTUS.id, new ItemStack(Item.INK_SACK, 1, 2), 0.2F);
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);
diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java
index 2a9be3de..e9cb09f9 100644
--- a/src/main/java/net/minecraft/server/RegionFile.java
+++ b/src/main/java/net/minecraft/server/RegionFile.java
@@ -21,7 +21,7 @@ public class RegionFile {
private final int[] e = new int[1024];
private ArrayList f;
private int g;
- private long h = 0L;
+ private long h;
public RegionFile(File file1) {
this.b = file1;
@@ -244,7 +244,7 @@ public class RegionFile {
}
}
- this.b(i, j, (int) (System.currentTimeMillis() / 1000L));
+ this.b(i, j, (int) (MinecraftServer.aq() / 1000L));
} catch (IOException ioexception) {
ioexception.printStackTrace();
}
diff --git a/src/main/java/net/minecraft/server/ShapedRecipes.java b/src/main/java/net/minecraft/server/ShapedRecipes.java
index a70b8285..8f4246b0 100644
--- a/src/main/java/net/minecraft/server/ShapedRecipes.java
+++ b/src/main/java/net/minecraft/server/ShapedRecipes.java
@@ -12,7 +12,7 @@ public class ShapedRecipes implements IRecipe {
private ItemStack[] items;
private ItemStack result;
public final int a;
- private boolean f = false;
+ private boolean f;
public ShapedRecipes(int i, int j, ItemStack[] aitemstack, ItemStack itemstack) {
this.a = itemstack.id;
diff --git a/src/main/java/net/minecraft/server/Slot.java b/src/main/java/net/minecraft/server/Slot.java
index 079a8270..48d13e42 100644
--- a/src/main/java/net/minecraft/server/Slot.java
+++ b/src/main/java/net/minecraft/server/Slot.java
@@ -32,7 +32,7 @@ public class Slot {
protected void b(ItemStack itemstack) {}
public void a(EntityHuman entityhuman, ItemStack itemstack) {
- this.e();
+ this.f();
}
public boolean isAllowed(ItemStack itemstack) {
@@ -43,16 +43,16 @@ public class Slot {
return this.inventory.getItem(this.index);
}
- public boolean d() {
+ public boolean e() {
return this.getItem() != null;
}
public void set(ItemStack itemstack) {
this.inventory.setItem(this.index, itemstack);
- this.e();
+ this.f();
}
- public void e() {
+ public void f() {
this.inventory.update();
}
diff --git a/src/main/java/net/minecraft/server/SlotFurnaceResult.java b/src/main/java/net/minecraft/server/SlotFurnaceResult.java
index c8812336..e0eaec94 100644
--- a/src/main/java/net/minecraft/server/SlotFurnaceResult.java
+++ b/src/main/java/net/minecraft/server/SlotFurnaceResult.java
@@ -20,7 +20,7 @@ public class SlotFurnaceResult extends Slot {
}
public ItemStack a(int i) {
- if (this.d()) {
+ if (this.e()) {
this.b += Math.min(i, this.getItem().count);
}
diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java
index 056100f5..aa7698b9 100644
--- a/src/main/java/net/minecraft/server/SpawnerCreature.java
+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java
@@ -14,23 +14,24 @@ import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason;
public final class SpawnerCreature {
- private static LongObjectHashMap<Boolean> b = new LongObjectHashMap<Boolean>(); // CraftBukkit - HashMap -> LongObjectHashMap
- protected static final Class[] a = new Class[] { EntitySpider.class, EntityZombie.class, EntitySkeleton.class};
+ private LongObjectHashMap<Boolean> a = new LongObjectHashMap<Boolean>(); // CraftBukkit - HashMap -> LongObjectHashMap
+
+ public SpawnerCreature() {}
protected static ChunkPosition getRandomPosition(World world, int i, int j) {
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.R() : chunk.h() + 16 - 1);
+ int i1 = world.random.nextInt(chunk == null ? world.S() : chunk.h() + 16 - 1);
return new ChunkPosition(k, i1, l);
}
- public static final int spawnEntities(WorldServer worldserver, boolean flag, boolean flag1, boolean flag2) {
+ public int spawnEntities(WorldServer worldserver, boolean flag, boolean flag1, boolean flag2) {
if (!flag && !flag1) {
return 0;
} else {
- b.clear();
+ this.a.clear();
int i;
int j;
@@ -50,9 +51,9 @@ public final class SpawnerCreature {
long chunkCoords = LongHash.toLong(l + k, i1 + j);
if (!flag3) {
- b.put(chunkCoords, false);
- } else if (!b.containsKey(chunkCoords)) {
- b.put(chunkCoords, true);
+ this.a.put(chunkCoords, false);
+ } else if (!this.a.containsKey(chunkCoords)) {
+ this.a.put(chunkCoords, true);
}
// CraftBukkit end
}
@@ -90,15 +91,15 @@ public final class SpawnerCreature {
}
// CraftBukkit end
- if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2) && worldserver.a(enumcreaturetype.a()) <= limit * b.size() / 256) { // CraftBukkit - use per-world limits
- Iterator iterator = b.keySet().iterator();
+ if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2) && worldserver.a(enumcreaturetype.a()) <= limit * this.a.size() / 256) { // CraftBukkit - use per-world limits
+ Iterator iterator = this.a.keySet().iterator();
label110:
while (iterator.hasNext()) {
// CraftBukkit start
long key = ((Long) iterator.next()).longValue();
- if (!b.get(key)) {
+ if (!this.a.get(key)) {
ChunkPosition chunkposition = getRandomPosition(worldserver, LongHash.msw(key), LongHash.lsw(key));
// CraftBukkit end
int k1 = chunkposition.x;
@@ -115,6 +116,7 @@ public final class SpawnerCreature {
int j3 = i2;
byte b1 = 6;
BiomeMeta biomemeta = null;
+ GroupDataEntity groupdataentity = null;
int k3 = 0;
while (true) {
@@ -142,23 +144,23 @@ public final class SpawnerCreature {
}
}
- EntityLiving entityliving;
+ EntityInsentient entityinsentient;
try {
- entityliving = (EntityLiving) biomemeta.b.getConstructor(new Class[] { World.class}).newInstance(new Object[] { worldserver});
+ entityinsentient = (EntityInsentient) biomemeta.b.getConstructor(new Class[] { World.class}).newInstance(new Object[] { worldserver});
} catch (Exception exception) {
exception.printStackTrace();
return i;
}
- entityliving.setPositionRotation((double) f, (double) f1, (double) f2, worldserver.random.nextFloat() * 360.0F, 0.0F);
- if (entityliving.canSpawn()) {
+ entityinsentient.setPositionRotation((double) f, (double) f1, (double) f2, worldserver.random.nextFloat() * 360.0F, 0.0F);
+ if (entityinsentient.canSpawn()) {
++j2;
- // CraftBukkit start - Added a reason for spawning this creature, moved a(entityliving, world...) up
- a(entityliving, worldserver, f, f1, f2);
- worldserver.addEntity(entityliving, SpawnReason.NATURAL);
+ // CraftBukkit start - Added a reason for spawning this creature, moved entityinsentient.a(groupdataentity) up
+ groupdataentity = entityinsentient.a(groupdataentity);
+ worldserver.addEntity(entityinsentient, SpawnReason.NATURAL);
// CraftBukkit end
- if (j2 >= entityliving.by()) {
+ if (j2 >= entityinsentient.br()) {
continue label110;
}
}
@@ -199,16 +201,13 @@ public final class SpawnerCreature {
}
}
- private static void a(EntityLiving entityliving, World world, float f, float f1, float f2) {
- entityliving.bJ();
- }
-
public static void a(World world, BiomeBase biomebase, int i, int j, int k, int l, Random random) {
List list = biomebase.getMobs(EnumCreatureType.CREATURE);
if (!list.isEmpty()) {
while (random.nextFloat() < biomebase.f()) {
BiomeMeta biomemeta = (BiomeMeta) WeightedRandom.a(world.random, (Collection) list);
+ GroupDataEntity groupdataentity = null;
int i1 = biomemeta.c + random.nextInt(1 + biomemeta.d - biomemeta.c);
int j1 = i + random.nextInt(k);
int k1 = j + random.nextInt(l);
@@ -226,19 +225,19 @@ public final class SpawnerCreature {
float f1 = (float) l2;
float f2 = (float) k1 + 0.5F;
- EntityLiving entityliving;
+ EntityInsentient entityinsentient;
try {
- entityliving = (EntityLiving) biomemeta.b.getConstructor(new Class[] { World.class}).newInstance(new Object[] { world});
+ entityinsentient = (EntityInsentient) biomemeta.b.getConstructor(new Class[] { World.class}).newInstance(new Object[] { world});
} catch (Exception exception) {
exception.printStackTrace();
continue;
}
- entityliving.setPositionRotation((double) f, (double) f1, (double) f2, random.nextFloat() * 360.0F, 0.0F);
- // CraftBukkit start - Added a reason for spawning this creature, moved a(entity, world...) up
- a(entityliving, world, f, f1, f2);
- world.addEntity(entityliving, SpawnReason.CHUNK_GEN);
+ entityinsentient.setPositionRotation((double) f, (double) f1, (double) f2, random.nextFloat() * 360.0F, 0.0F);
+ // CraftBukkit start - Added a reason for spawning this creature, moved entityinsentient.a(groupdataentity) up
+ groupdataentity = entityinsentient.a(groupdataentity);
+ world.addEntity(entityinsentient, SpawnReason.CHUNK_GEN);
// CraftBukkit end
flag = true;
}
diff --git a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
index 0686ba0f..2ce2e3af 100644
--- a/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
+++ b/src/main/java/net/minecraft/server/ThreadLoginVerifier.java
@@ -28,9 +28,9 @@ class ThreadLoginVerifier extends Thread {
public void run() {
try {
- String s = (new BigInteger(MinecraftEncryption.a(PendingConnection.a(this.pendingConnection), PendingConnection.b(this.pendingConnection).F().getPublic(), PendingConnection.c(this.pendingConnection)))).toString(16);
+ String s = (new BigInteger(MinecraftEncryption.a(PendingConnection.a(this.pendingConnection), PendingConnection.b(this.pendingConnection).H().getPublic(), PendingConnection.c(this.pendingConnection)))).toString(16);
URL url = new URL("http://session.minecraft.net/game/checkserver.jsp?user=" + URLEncoder.encode(PendingConnection.d(this.pendingConnection), "UTF-8") + "&serverId=" + URLEncoder.encode(s, "UTF-8"));
- BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openStream()));
+ BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(url.openConnection(PendingConnection.b(this.pendingConnection).ap()).getInputStream()));
String s1 = bufferedreader.readLine();
bufferedreader.close();
diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java
index db3fc42e..f4be980b 100644
--- a/src/main/java/net/minecraft/server/TileEntity.java
+++ b/src/main/java/net/minecraft/server/TileEntity.java
@@ -29,14 +29,14 @@ public class TileEntity {
}
}
- public void b(World world) {
- this.world = world;
- }
-
public World getWorld() {
return this.world;
}
+ public void b(World world) {
+ this.world = world;
+ }
+
public boolean o() {
return this.world != null;
}
diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java
index 36008f28..087b98fe 100644
--- a/src/main/java/net/minecraft/server/TileEntityBeacon.java
+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java
@@ -95,7 +95,7 @@ public class TileEntityBeacon extends TileEntity implements IInventory {
for (int i = 1; i <= 4; this.e = i++) {
int j = this.y - i;
- if (j < 1) {
+ if (j < 0) {
break;
}
diff --git a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
index 2d943bef..f1883f37 100644
--- a/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
+++ b/src/main/java/net/minecraft/server/TileEntityBrewingStand.java
@@ -103,7 +103,7 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor
if (this.items[3] != null && this.items[3].count > 0) {
ItemStack itemstack = this.items[3];
- if (!Item.byId[itemstack.id].w()) {
+ if (!Item.byId[itemstack.id].x()) {
return false;
} else {
boolean flag = false;
@@ -121,7 +121,8 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor
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) {
+ // CraftBukkit - list != -> !list.equals
+ if ((j <= 0 || !list.equals(list1)) && (list == null || !list.equals(list1) && list1 != null) && j != k) {
flag = true;
break;
}
@@ -166,8 +167,8 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor
}
}
- if (Item.byId[itemstack.id].t()) {
- this.items[3] = new ItemStack(Item.byId[itemstack.id].s());
+ if (Item.byId[itemstack.id].u()) {
+ this.items[3] = new ItemStack(Item.byId[itemstack.id].t());
} else {
--this.items[3].count;
if (this.items[3].count <= 0) {
@@ -178,7 +179,7 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor
}
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);
+ return itemstack == null ? i : (Item.byId[itemstack.id].x() ? PotionBrewer.a(i, Item.byId[itemstack.id].w()) : i);
}
public void a(NBTTagCompound nbttagcompound) {
@@ -268,7 +269,7 @@ public class TileEntityBrewingStand extends TileEntity implements IWorldInventor
public void g() {}
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;
+ return i == 3 ? Item.byId[itemstack.id].x() : itemstack.id == Item.POTION.id || itemstack.id == Item.GLASS_BOTTLE.id;
}
public int j() {
diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java
index e529bf47..782913f9 100644
--- a/src/main/java/net/minecraft/server/TileEntityChest.java
+++ b/src/main/java/net/minecraft/server/TileEntityChest.java
@@ -11,7 +11,7 @@ import org.bukkit.entity.HumanEntity;
public class TileEntityChest extends TileEntity implements IInventory {
private ItemStack[] items = new ItemStack[27]; // CraftBukkit - 36 -> 27
- public boolean a = false;
+ public boolean a;
public TileEntityChest b;
public TileEntityChest c;
public TileEntityChest d;
diff --git a/src/main/java/net/minecraft/server/TileEntityCommand.java b/src/main/java/net/minecraft/server/TileEntityCommand.java
index c9be36ce..e98c080f 100644
--- a/src/main/java/net/minecraft/server/TileEntityCommand.java
+++ b/src/main/java/net/minecraft/server/TileEntityCommand.java
@@ -7,7 +7,7 @@ import com.google.common.base.Joiner;
public class TileEntityCommand extends TileEntity implements ICommandListener {
- private int a = 0;
+ private int a;
public String b = ""; // CraftBukkit - private -> public
private String c = "@";
// CraftBukkit start
@@ -18,7 +18,7 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
}
// CraftBukkit end
- public void b(String s) {
+ public void a(String s) {
this.b = s;
this.update();
}
@@ -137,20 +137,16 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
return this.c;
}
- public void c(String s) {
+ public void b(String s) {
this.c = s;
}
- public void sendMessage(String s) {}
+ public void sendMessage(ChatMessage chatmessage) {}
public boolean a(int i, String s) {
return i <= 2;
}
- public String a(String s, Object... aobject) {
- return s;
- }
-
public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound);
nbttagcompound.setString("Command", this.b);
@@ -171,6 +167,10 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
return new ChunkCoordinates(this.x, this.y, this.z);
}
+ public World f_() {
+ return this.getWorld();
+ }
+
public Packet getUpdatePacket() {
NBTTagCompound nbttagcompound = new NBTTagCompound();
@@ -178,7 +178,7 @@ public class TileEntityCommand extends TileEntity implements ICommandListener {
return new Packet132TileEntityData(this.x, this.y, this.z, 2, nbttagcompound);
}
- public int d() {
+ public int f() {
return this.a;
}
diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java
index e0f6cda3..01293b60 100644
--- a/src/main/java/net/minecraft/server/TileEntityFurnace.java
+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java
@@ -16,9 +16,9 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory {
private static final int[] e = new int[] { 2, 1};
private static final int[] f = new int[] { 1};
private ItemStack[] items = new ItemStack[3];
- public int burnTime = 0;
- public int ticksForCurrentFuel = 0;
- public int cookTime = 0;
+ public int burnTime;
+ public int ticksForCurrentFuel;
+ public int cookTime;
private String h;
// CraftBukkit start
@@ -206,7 +206,7 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory {
if (this.items[1] != null) {
--this.items[1].count;
if (this.items[1].count == 0) {
- Item item = this.items[1].getItem().s();
+ Item item = this.items[1].getItem().t();
this.items[1] = item != null ? new ItemStack(item) : null;
}
@@ -300,9 +300,14 @@ public class TileEntityFurnace extends TileEntity implements IWorldInventory {
if (block.material == Material.WOOD) {
return 300;
}
+
+ if (block == Block.COAL_BLOCK) {
+ return 16000;
+ }
}
- return item instanceof ItemTool && ((ItemTool) item).g().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword) item).h().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe) item).g().equals("WOOD") ? 200 : (i == Item.STICK.id ? 100 : (i == Item.COAL.id ? 1600 : (i == Item.LAVA_BUCKET.id ? 20000 : (i == Block.SAPLING.id ? 100 : (i == Item.BLAZE_ROD.id ? 2400 : 0))))))); }
+ return item instanceof ItemTool && ((ItemTool) item).g().equals("WOOD") ? 200 : (item instanceof ItemSword && ((ItemSword) item).i().equals("WOOD") ? 200 : (item instanceof ItemHoe && ((ItemHoe) item).g().equals("WOOD") ? 200 : (i == Item.STICK.id ? 100 : (i == Item.COAL.id ? 1600 : (i == Item.LAVA_BUCKET.id ? 20000 : (i == Block.SAPLING.id ? 100 : (i == Item.BLAZE_ROD.id ? 2400 : 0)))))));
+ }
}
public static boolean isFuel(ItemStack itemstack) {
diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java
index f6d269d6..054cea49 100644
--- a/src/main/java/net/minecraft/server/TileEntityHopper.java
+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java
@@ -178,8 +178,9 @@ public class TileEntityHopper extends TileEntity implements IHopper {
public boolean j() {
if (this.world != null && !this.world.isStatic) {
if (!this.l() && BlockHopper.d(this.p())) {
- boolean flag = this.u() | suckInItems(this);
+ boolean flag = this.u();
+ flag = suckInItems(this) || flag;
if (flag) {
this.c(8);
this.update();
@@ -265,7 +266,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
}
}
} else {
- EntityItem entityitem = getEntityItemAt(ihopper.getWorld(), ihopper.aA(), ihopper.aB() + 1.0D, ihopper.aC());
+ EntityItem entityitem = getEntityItemAt(ihopper.getWorld(), ihopper.az(), ihopper.aA() + 1.0D, ihopper.aB());
if (entityitem != null) {
return addEntityItem(ihopper, entityitem);
@@ -300,7 +301,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
if (ihopper instanceof TileEntityHopper) {
((TileEntityHopper) ihopper).c(8); // Delay hopper checks
} else if (ihopper instanceof EntityMinecartHopper) {
- ((EntityMinecartHopper) ihopper).n(4); // Delay hopper minecart checks
+ ((EntityMinecartHopper) ihopper).l(4); // Delay hopper minecart checks
}
return false;
@@ -405,6 +406,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
if (flag) {
if (iinventory instanceof TileEntityHopper) {
((TileEntityHopper) iinventory).c(8);
+ iinventory.update();
}
iinventory.update();
@@ -421,7 +423,7 @@ public class TileEntityHopper extends TileEntity implements IHopper {
}
public static IInventory getSourceInventory(IHopper ihopper) {
- return getInventoryAt(ihopper.getWorld(), ihopper.aA(), ihopper.aB() + 1.0D, ihopper.aC());
+ return getInventoryAt(ihopper.getWorld(), ihopper.az(), ihopper.aA() + 1.0D, ihopper.aB());
}
public static EntityItem getEntityItemAt(World world, double d0, double d1, double d2) {
@@ -464,15 +466,15 @@ public class TileEntityHopper extends TileEntity implements IHopper {
return itemstack.id != itemstack1.id ? false : (itemstack.getData() != itemstack1.getData() ? false : (itemstack.count > itemstack.getMaxStackSize() ? false : ItemStack.equals(itemstack, itemstack1)));
}
- public double aA() {
+ public double az() {
return (double) this.x;
}
- public double aB() {
+ public double aA() {
return (double) this.y;
}
- public double aC() {
+ public double aB() {
return (double) this.z;
}
diff --git a/src/main/java/net/minecraft/server/TileEntityNote.java b/src/main/java/net/minecraft/server/TileEntityNote.java
index 121efb87..46bb08d1 100644
--- a/src/main/java/net/minecraft/server/TileEntityNote.java
+++ b/src/main/java/net/minecraft/server/TileEntityNote.java
@@ -2,8 +2,8 @@ package net.minecraft.server;
public class TileEntityNote extends TileEntity {
- public byte note = 0;
- public boolean b = false;
+ public byte note;
+ public boolean b;
public TileEntityNote() {}
diff --git a/src/main/java/net/minecraft/server/Vec3DPool.java b/src/main/java/net/minecraft/server/Vec3DPool.java
index e29889c0..f8e54c23 100644
--- a/src/main/java/net/minecraft/server/Vec3DPool.java
+++ b/src/main/java/net/minecraft/server/Vec3DPool.java
@@ -15,9 +15,9 @@ public class Vec3DPool {
private Vec3D alloclisthead = null;
private int total_size = 0;
// CraftBukkit end
- private int position = 0;
- private int largestSize = 0;
- private int resizeTime = 0;
+ private int position;
+ private int largestSize;
+ private int resizeTime;
public Vec3DPool(int i, int j) {
this.a = i;
@@ -93,9 +93,9 @@ public class Vec3DPool {
this.largestSize = 0;
// this.f = 0; // We do not reset to zero; it doubles for a flag
}
- // CraftBukkit end
this.position = 0;
+ // CraftBukkit end
}
public int c() {
diff --git a/src/main/java/net/minecraft/server/Village.java b/src/main/java/net/minecraft/server/Village.java
index 5e9336bc..02bce3d5 100644
--- a/src/main/java/net/minecraft/server/Village.java
+++ b/src/main/java/net/minecraft/server/Village.java
@@ -11,14 +11,14 @@ public class Village {
private final List doors = new ArrayList();
private final ChunkCoordinates c = new ChunkCoordinates(0, 0, 0);
private final ChunkCoordinates center = new ChunkCoordinates(0, 0, 0);
- private int size = 0;
- private int f = 0;
- private int time = 0;
- private int population = 0;
+ private int size;
+ private int f;
+ private int time;
+ private int population;
private int noBreedTicks;
private TreeMap playerStandings = new TreeMap();
private List aggressors = new ArrayList();
- private int ironGolemCount = 0;
+ private int ironGolemCount;
public Village() {}
diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java
index 18f74641..7affabd9 100644
--- a/src/main/java/net/minecraft/server/VillageSiege.java
+++ b/src/main/java/net/minecraft/server/VillageSiege.java
@@ -6,7 +6,7 @@ import java.util.List;
public class VillageSiege {
private World world;
- private boolean b = false;
+ private boolean b;
private int c = -1;
private int d;
private int e;
@@ -139,7 +139,7 @@ public class VillageSiege {
try {
entityzombie = new EntityZombie(this.world);
- entityzombie.bJ();
+ entityzombie.a((GroupDataEntity) null);
entityzombie.setVillager(false);
} catch (Exception exception) {
exception.printStackTrace();
@@ -162,6 +162,7 @@ public class VillageSiege {
int k1 = k + this.world.random.nextInt(16) - 8;
if (this.f.a(i1, j1, k1) && SpawnerCreature.a(EnumCreatureType.MONSTER, this.world, i1, j1, k1)) {
+ // CraftBukkit - add Return
return this.world.getVec3DPool().create((double) i1, (double) j1, (double) k1);
}
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 3a4ddea1..f1348562 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -27,7 +27,7 @@ import org.bukkit.event.weather.ThunderChangeEvent;
public abstract class World implements IBlockAccess {
- public boolean d = false;
+ public boolean d;
public List entityList = new ArrayList();
protected List f = new ArrayList();
public Set tileEntityList = new HashSet(); // CraftBukkit - ArrayList -> HashSet
@@ -36,14 +36,14 @@ public abstract class World implements IBlockAccess {
public List players = new ArrayList();
public List i = new ArrayList();
private long c = 16777215L;
- public int j = 0;
+ public int j;
protected int k = (new Random()).nextInt();
protected final int l = 1013904223;
protected float m;
protected float n;
protected float o;
protected float p;
- public int q = 0;
+ public int q;
public boolean callingPlaceEvent = false; // CraftBukkit
public int difficulty;
public Random random = new Random();
@@ -79,15 +79,15 @@ public abstract class World implements IBlockAccess {
Chunk chunk = this.getChunkAtWorldCoords(i, j);
if (chunk != null) {
- return chunk.a(i & 15, j & 15, this.worldProvider.d);
+ return chunk.a(i & 15, j & 15, this.worldProvider.e);
}
}
- return this.worldProvider.d.getBiome(i, j);
+ return this.worldProvider.e.getBiome(i, j);
}
public WorldChunkManager getWorldChunkManager() {
- return this.worldProvider.d;
+ return this.worldProvider.e;
}
// CraftBukkit start
@@ -118,7 +118,6 @@ public abstract class World implements IBlockAccess {
this.O = this.random.nextInt(12000);
this.H = new int['\u8000'];
- this.isStatic = false;
this.dataManager = idatamanager;
this.methodProfiler = methodprofiler;
this.worldMaps = new WorldMapCollection(idatamanager);
@@ -168,7 +167,7 @@ public abstract class World implements IBlockAccess {
this.villages.a(this);
}
- this.z();
+ this.A();
this.a();
this.getServer().addWorld(this.world); // CraftBukkit
@@ -430,7 +429,7 @@ public abstract class World implements IBlockAccess {
k = i1;
}
- if (!this.worldProvider.f) {
+ if (!this.worldProvider.g) {
for (i1 = k; i1 <= l; ++i1) {
this.c(EnumSkyBlock.SKY, i, i1, j);
}
@@ -549,7 +548,7 @@ public abstract class World implements IBlockAccess {
if (flag) {
int l = this.getTypeId(i, j, k);
- if (Block.w[l]) {
+ if (Block.x[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);
@@ -672,7 +671,7 @@ public abstract class World implements IBlockAccess {
}
public float q(int i, int j, int k) {
- return this.worldProvider.g[this.getLightLevel(i, j, k)];
+ return this.worldProvider.h[this.getLightLevel(i, j, k)];
}
public boolean v() {
@@ -1036,12 +1035,12 @@ public abstract class World implements IBlockAccess {
for (int j2 = 0; j2 < list.size(); ++j2) {
AxisAlignedBB axisalignedbb1 = ((Entity) list.get(j2)).D();
- if (axisalignedbb1 != null && axisalignedbb1.a(axisalignedbb)) {
+ if (axisalignedbb1 != null && axisalignedbb1.b(axisalignedbb)) {
this.M.add(axisalignedbb1);
}
axisalignedbb1 = entity.g((Entity) list.get(j2));
- if (axisalignedbb1 != null && axisalignedbb1.a(axisalignedbb)) {
+ if (axisalignedbb1 != null && axisalignedbb1.b(axisalignedbb)) {
this.M.add(axisalignedbb1);
}
}
@@ -1098,8 +1097,8 @@ public abstract class World implements IBlockAccess {
return this.worldProvider.a(this.worldData.getDayTime(), f);
}
- public int w() {
- return this.worldProvider.a(this.worldData.getDayTime());
+ public float x() {
+ return WorldProvider.a[this.worldProvider.a(this.worldData.getDayTime())];
}
public float d(float f) {
@@ -1550,7 +1549,7 @@ public abstract class World implements IBlockAccess {
}
}
- if (vec3d.b() > 0.0D && entity.aw()) {
+ if (vec3d.b() > 0.0D && entity.av()) {
vec3d = vec3d.a();
double d1 = 0.014D;
@@ -1836,7 +1835,7 @@ public abstract class World implements IBlockAccess {
}
}
- public void z() {
+ public void A() {
int i = this.a(1.0F);
if (i != this.j) {
@@ -1863,7 +1862,7 @@ public abstract class World implements IBlockAccess {
}
protected void o() {
- if (!this.worldProvider.f) {
+ if (!this.worldProvider.g) {
int i = this.worldData.getThunderDuration();
if (i <= 0) {
@@ -1941,11 +1940,11 @@ public abstract class World implements IBlockAccess {
}
}
- public void A() {
+ public void B() {
this.worldData.setWeatherDuration(1);
}
- protected void B() {
+ protected void C() {
// this.chunkTickList.clear(); // CraftBukkit - removed
this.methodProfiler.a("buildList");
@@ -2020,7 +2019,7 @@ public abstract class World implements IBlockAccess {
}
protected void g() {
- this.B();
+ this.C();
}
public boolean x(int i, int j, int k) {
@@ -2095,7 +2094,7 @@ public abstract class World implements IBlockAccess {
}
public void A(int i, int j, int k) {
- if (!this.worldProvider.f) {
+ if (!this.worldProvider.g) {
this.c(EnumSkyBlock.SKY, i, j, k);
}
@@ -2338,9 +2337,9 @@ public abstract class World implements IBlockAccess {
Entity entity = (Entity) this.entityList.get(j);
// CraftBukkit start - Split out persistent check, don't apply it to special persistent mobs
- if (entity instanceof EntityLiving) {
- EntityLiving entityliving = (EntityLiving) entity;
- if (entityliving.isTypeNotPersistent() && entityliving.bU()) { // Should be isPersistent
+ if (entity instanceof EntityInsentient) {
+ EntityInsentient entityinsentient = (EntityInsentient) entity;
+ if (entityinsentient.isTypeNotPersistent() && entityinsentient.bA()) { // Should be isPersistent
continue;
}
}
@@ -2566,7 +2565,7 @@ public abstract class World implements IBlockAccess {
}
if (entityhuman1.isInvisible()) {
- float f = entityhuman1.cc();
+ float f = entityhuman1.bs();
if (f < 0.1F) {
f = 0.1F;
@@ -2587,7 +2586,7 @@ public abstract class World implements IBlockAccess {
public EntityHuman a(String s) {
for (int i = 0; i < this.players.size(); ++i) {
- if (s.equals(((EntityHuman) this.players.get(i)).name)) {
+ if (s.equals(((EntityHuman) this.players.get(i)).getName())) {
return (EntityHuman) this.players.get(i);
}
}
@@ -2595,7 +2594,7 @@ public abstract class World implements IBlockAccess {
return null;
}
- public void F() throws ExceptionWorldConflict { // CraftBukkit - added throws
+ public void G() throws ExceptionWorldConflict { // CraftBukkit - added throws
this.dataManager.checkSession();
}
@@ -2625,7 +2624,7 @@ public abstract class World implements IBlockAccess {
public void broadcastEntityEffect(Entity entity, byte b0) {}
- public IChunkProvider K() {
+ public IChunkProvider L() {
return this.chunkProvider;
}
@@ -2667,16 +2666,16 @@ public abstract class World implements IBlockAccess {
return this.m + (this.n - this.m) * f;
}
- public boolean O() {
+ public boolean P() {
return (double) this.h(1.0F) > 0.9D;
}
- public boolean P() {
+ public boolean Q() {
return (double) this.i(1.0F) > 0.2D;
}
public boolean F(int i, int j, int k) {
- if (!this.P()) {
+ if (!this.Q()) {
return false;
} else if (!this.l(i, j, k)) {
return false;
@@ -2738,8 +2737,8 @@ public abstract class World implements IBlockAccess {
return 256;
}
- public int R() {
- return this.worldProvider.f ? 128 : 256;
+ public int S() {
+ return this.worldProvider.g ? 128 : 256;
}
public IUpdatePlayerListBox a(EntityMinecartAbstract entityminecartabstract) {
@@ -2754,7 +2753,7 @@ public abstract class World implements IBlockAccess {
}
public ChunkPosition b(String s, int i, int j, int k) {
- return this.K().findNearestMapFeature(this, s, i, j, k);
+ return this.L().findNearestMapFeature(this, s, i, j, k);
}
public CrashReportSystemDetails a(CrashReport crashreport) {
@@ -2785,9 +2784,9 @@ public abstract class World implements IBlockAccess {
return this.J;
}
- public Calendar V() {
+ public Calendar W() {
if (this.getTime() % 600L == 0L) {
- this.K.setTimeInMillis(System.currentTimeMillis());
+ this.K.setTimeInMillis(MinecraftServer.aq());
}
return this.K;
@@ -2824,4 +2823,26 @@ public abstract class World implements IBlockAccess {
public IConsoleLogManager getLogger() {
return this.logAgent;
}
+
+ public float b(double d0, double d1, double d2) {
+ return this.I(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2));
+ }
+
+ public float I(int i, int j, int k) {
+ float f = 0.0F;
+ boolean flag = this.difficulty == 3;
+
+ if (this.isLoaded(i, j, k)) {
+ float f1 = this.x();
+
+ f += MathHelper.a((float) this.getChunkAtWorldCoords(i, k).q / 3600000.0F, 0.0F, 1.0F) * (flag ? 1.0F : 0.75F);
+ f += f1 * 0.25F;
+ }
+
+ if (this.difficulty < 2) {
+ f *= (float) this.difficulty / 2.0F;
+ }
+
+ return MathHelper.a(f, 0.0F, flag ? 1.5F : 1.0F);
+ }
}
diff --git a/src/main/java/net/minecraft/server/WorldGenBigTree.java b/src/main/java/net/minecraft/server/WorldGenBigTree.java
index 185ea74d..2404b1d9 100644
--- a/src/main/java/net/minecraft/server/WorldGenBigTree.java
+++ b/src/main/java/net/minecraft/server/WorldGenBigTree.java
@@ -10,7 +10,7 @@ public class WorldGenBigTree extends WorldGenerator implements BlockSapling.Tree
Random b = new Random();
BlockChangeDelegate world; // CraftBukkit
int[] d = new int[] { 0, 0, 0};
- int e = 0;
+ int e;
int f;
double g = 0.618D;
double h = 1.0D;
diff --git a/src/main/java/net/minecraft/server/WorldGenGroundBush.java b/src/main/java/net/minecraft/server/WorldGenGroundBush.java
index ceb2c9fc..eb0240d5 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.s[world.getTypeId(i2, j1, k2)]) {
+ if ((Math.abs(j2) != l1 || Math.abs(l2) != l1 || random.nextInt(2) != 0) && !Block.t[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 42b19232..303644f9 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.s[world.getTypeId(i2, k1, k2)]) {
+ if ((l2 != 0 || j >= j + i1 - 1) && !Block.t[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.s[l1]) {
+ if (!Block.t[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/WorldGenSwampTree.java b/src/main/java/net/minecraft/server/WorldGenSwampTree.java
index 853bf99d..7f92b86d 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.s[world.getTypeId(l1, j2, k2)]) {
+ if ((Math.abs(i2) != k1 || Math.abs(l2) != k1 || random.nextInt(2) != 0 && j1 != 0) && !Block.t[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 65eee4ef..e9a99b7b 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.s[world.getTypeId(j2, i2, i3)]) {
+ if ((Math.abs(k2) != l2 || Math.abs(j3) != l2 || l2 <= 0) && !Block.t[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 52d5fbb5..8d9ba5e9 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.s[world.getTypeId(i3, j3, l3)]) {
+ if ((Math.abs(k3) != k2 || Math.abs(i4) != k2 || k2 <= 0) && !Block.t[world.getTypeId(i3, j3, l3)]) {
this.setTypeAndData(world, i3, j3, l3, Block.LEAVES.id, 1);
}
}
diff --git a/src/main/java/net/minecraft/server/WorldGenerator.java b/src/main/java/net/minecraft/server/WorldGenerator.java
index 5941f291..ffb18f7f 100644
--- a/src/main/java/net/minecraft/server/WorldGenerator.java
+++ b/src/main/java/net/minecraft/server/WorldGenerator.java
@@ -28,6 +28,7 @@ public abstract class WorldGenerator {
// CraftBukkit - change signature
protected void setTypeAndData(BlockChangeDelegate world, int i, int j, int k, int l, int i1) {
if (this.a) {
+ // CraftBukkit - BlockChangeDelegate doesn't have the 6th parameter
world.setTypeIdAndData(i, j, k, l, i1);
} else {
// CraftBukkit start - Layering violation :(
diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java
index fd009002..10dff050 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.z())) {
- if (!itemstack.z() && worldmaphumantracker1.trackee.dimension == this.map) {
+ if (!worldmaphumantracker1.trackee.dead && (worldmaphumantracker1.trackee.inventory.c(itemstack) || itemstack.A())) {
+ if (!itemstack.A() && 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.z()) {
- this.a(1, entityhuman.world, "frame-" + itemstack.A().id, (double) itemstack.A().x, (double) itemstack.A().z, (double) (itemstack.A().direction * 90));
+ if (itemstack.A()) {
+ this.a(1, entityhuman.world, "frame-" + itemstack.B().id, (double) itemstack.B().x, (double) itemstack.B().z, (double) (itemstack.B().direction * 90));
}
}
diff --git a/src/main/java/net/minecraft/server/WorldMapHumanTracker.java b/src/main/java/net/minecraft/server/WorldMapHumanTracker.java
index bf3e6feb..22d9c7e6 100644
--- a/src/main/java/net/minecraft/server/WorldMapHumanTracker.java
+++ b/src/main/java/net/minecraft/server/WorldMapHumanTracker.java
@@ -19,9 +19,6 @@ public class WorldMapHumanTracker {
this.worldMap = worldmap;
this.b = new int[128];
this.c = new int[128];
- this.f = 0;
- this.g = 0;
- this.i = false;
this.trackee = entityhuman;
for (int i = 0; i < this.b.length; ++i) {
@@ -60,7 +57,7 @@ public class WorldMapHumanTracker {
}
// CraftBukkit end
- boolean flag = !itemstack.z();
+ boolean flag = !itemstack.A();
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 e0ae71a8..e9134b32 100644
--- a/src/main/java/net/minecraft/server/WorldNBTStorage.java
+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java
@@ -21,7 +21,7 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
private final File baseDir;
private final File playerDir;
private final File dataDir;
- private final long sessionId = System.currentTimeMillis();
+ private final long sessionId = MinecraftServer.aq();
private final String e;
private UUID uuid = null; // CraftBukkit
@@ -174,8 +174,8 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
NBTTagCompound nbttagcompound = new NBTTagCompound();
entityhuman.e(nbttagcompound);
- File file1 = new File(this.playerDir, entityhuman.name + ".dat.tmp");
- File file2 = new File(this.playerDir, entityhuman.name + ".dat");
+ File file1 = new File(this.playerDir, entityhuman.getName() + ".dat.tmp");
+ File file2 = new File(this.playerDir, entityhuman.getName() + ".dat");
NBTCompressedStreamTools.a(nbttagcompound, (OutputStream) (new FileOutputStream(file1)));
if (file2.exists()) {
@@ -184,12 +184,12 @@ public class WorldNBTStorage implements IDataManager, IPlayerFileData {
file1.renameTo(file2);
} catch (Exception exception) {
- MinecraftServer.getServer().getLogger().warning("Failed to save player data for " + entityhuman.name);
+ MinecraftServer.getServer().getLogger().warning("Failed to save player data for " + entityhuman.getName());
}
}
public NBTTagCompound load(EntityHuman entityhuman) {
- NBTTagCompound nbttagcompound = this.getPlayerData(entityhuman.name);
+ NBTTagCompound nbttagcompound = this.getPlayerData(entityhuman.getName());
if (nbttagcompound != null) {
// CraftBukkit start
diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java
index 49360c13..e787fb1b 100644
--- a/src/main/java/net/minecraft/server/WorldServer.java
+++ b/src/main/java/net/minecraft/server/WorldServer.java
@@ -30,12 +30,13 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
public ChunkProviderServer chunkProviderServer;
public boolean savingDisabled;
private boolean N;
- private int emptyTime = 0;
+ private int emptyTime;
private final PortalTravelAgent P;
- 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 final SpawnerCreature Q = new SpawnerCreature();
+ private NoteDataList[] R = new NoteDataList[] { new NoteDataList((EmptyClass2) null), new NoteDataList((EmptyClass2) null)};
+ private int S;
+ private static final StructurePieceTreasure[] T = 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 List U = new ArrayList();
private IntHashMap entitiesById;
// CraftBukkit start
@@ -163,27 +164,22 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
this.difficulty = 3;
}
- this.worldProvider.d.b();
+ this.worldProvider.e.b();
if (this.everyoneDeeplySleeping()) {
- boolean flag = false;
-
- if (this.allowMonsters && this.difficulty >= 1) {
- ;
- }
-
- if (!flag) {
+ if (this.getGameRules().getBoolean("doDaylightCycle")) {
long i = this.worldData.getDayTime() + 24000L;
this.worldData.setDayTime(i - i % 24000L);
- this.d();
}
+
+ this.d();
}
this.methodProfiler.a("mobSpawner");
// CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals
long time = this.worldData.getTime();
if (this.getGameRules().getBoolean("doMobSpawning") && (this.allowMonsters || this.allowAnimals) && (this instanceof WorldServer && this.players.size() > 0)) {
- SpawnerCreature.spawnEntities(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L);
+ this.Q.spawnEntities(this, this.allowMonsters && (this.ticksPerMonsterSpawns != 0 && time % this.ticksPerMonsterSpawns == 0L), this.allowAnimals && (this.ticksPerAnimalSpawns != 0 && time % this.ticksPerAnimalSpawns == 0L), this.worldData.getTime() % 400L == 0L);
}
// CraftBukkit end
this.methodProfiler.c("chunkSource");
@@ -195,7 +191,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
this.worldData.setTime(this.worldData.getTime() + 1L);
- this.worldData.setDayTime(this.worldData.getDayTime() + 1L);
+ if (this.getGameRules().getBoolean("doDaylightCycle")) {
+ this.worldData.setDayTime(this.worldData.getDayTime() + 1L);
+ }
+
this.methodProfiler.c("tickPending");
this.a(false);
this.methodProfiler.c("tickTiles");
@@ -208,13 +207,13 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
this.methodProfiler.c("portalForcer");
this.P.a(this.getTime());
this.methodProfiler.b();
- this.Z();
+ this.aa();
this.getWorld().processChunkGC(); // CraftBukkit
}
public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) {
- List list = this.K().getMobsFor(enumcreaturetype, i, j, k);
+ List list = this.L().getMobsFor(enumcreaturetype, i, j, k);
return list != null && !list.isEmpty() ? (BiomeMeta) WeightedRandom.a(this.random, (Collection) list) : null;
}
@@ -245,10 +244,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
}
- this.Y();
+ this.Z();
}
- private void Y() {
+ private void Z() {
// CraftBukkit start
WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), false);
this.getServer().getPluginManager().callEvent(weather);
@@ -321,7 +320,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
int k1;
int l1;
- if (this.random.nextInt(100000) == 0 && this.P() && this.O()) {
+ if (this.random.nextInt(100000) == 0 && this.Q() && this.P()) {
this.k = this.k * 3 + 1013904223;
i1 = this.k >> 2;
j1 = k + (i1 & 15);
@@ -354,7 +353,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
// CraftBukkit end
}
- if (this.P() && this.z(j1 + k, l1, k1 + l)) {
+ if (this.Q() && 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);
@@ -367,7 +366,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
// CraftBukkit end
}
- if (this.P()) {
+ if (this.Q()) {
BiomeBase biomebase = this.getBiome(j1 + k, k1 + l);
if (biomebase.d()) {
@@ -414,7 +413,7 @@ 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);
+ return this.U.contains(nextticklistentry);
}
public void a(int i, int j, int k, int l, int i1) {
@@ -427,6 +426,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
if (this.d && l > 0) {
if (Block.byId[l].l()) {
+ b0 = 8;
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);
@@ -512,12 +512,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
this.M.remove(nextticklistentry);
this.L.remove(nextticklistentry);
- this.T.add(nextticklistentry);
+ this.U.add(nextticklistentry);
}
this.methodProfiler.b();
this.methodProfiler.a("ticking");
- Iterator iterator = this.T.iterator();
+ Iterator iterator = this.U.iterator();
while (iterator.hasNext()) {
nextticklistentry = (NextTickListEntry) iterator.next();
@@ -552,7 +552,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
this.methodProfiler.b();
- this.T.clear();
+ this.U.clear();
return !this.M.isEmpty();
}
}
@@ -571,10 +571,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
if (i1 == 0) {
iterator = this.M.iterator();
} else {
- iterator = this.T.iterator();
+ iterator = this.U.iterator();
/* CraftBukkit start - Comment out debug spam
- if (!this.T.isEmpty()) {
- System.out.println(this.T.size());
+ if (!this.U.isEmpty()) {
+ System.out.println(this.U.size());
}
// CraftBukkit end */
}
@@ -600,12 +600,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
return arraylist;
}
+ /* CraftBukkit start - We prevent spawning in general, so this butchering is not needed
public void entityJoinedWorld(Entity entity, boolean flag) {
- /* CraftBukkit start - We prevent spawning in general, so this butchering is not needed
if (!this.server.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) {
entity.die();
}
- // CraftBukkit end */
+
if (!this.server.getSpawnNPCs() && entity instanceof NPC) {
entity.die();
}
@@ -614,9 +614,18 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
super.entityJoinedWorld(entity, flag);
}
}
+ // CraftBukkit end */
public void vehicleEnteredWorld(Entity entity, boolean flag) {
- super.entityJoinedWorld(entity, flag);
+ try {
+ super.entityJoinedWorld(entity, flag);
+ } catch (Throwable throwable) {
+ CrashReport crashreport = CrashReport.a(throwable, "Forcefully ticking entity");
+ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being force ticked");
+
+ entity.a(crashreportsystemdetails);
+ throw new ReportedException(crashreport);
+ }
}
protected IChunkProvider j() {
@@ -691,7 +700,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
this.worldData.setSpawn(0, this.worldProvider.getSeaLevel(), 0);
} else {
this.isLoading = true;
- WorldChunkManager worldchunkmanager = this.worldProvider.d;
+ WorldChunkManager worldchunkmanager = this.worldProvider.e;
List list = worldchunkmanager.a();
Random random = new Random(this.getSeed());
ChunkPosition chunkposition = worldchunkmanager.a(0, 0, 256, list, random);
@@ -743,7 +752,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
protected void k() {
- WorldGenBonusChest worldgenbonuschest = new WorldGenBonusChest(S, 10);
+ WorldGenBonusChest worldgenbonuschest = new WorldGenBonusChest(T, 10);
for (int i = 0; i < 10; ++i) {
int j = this.worldData.c() + this.random.nextInt(6) - this.random.nextInt(6);
@@ -782,7 +791,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
protected void a() throws ExceptionWorldConflict { // CraftBukkit - added throws
- this.F();
+ this.G();
this.dataManager.saveWorldData(this.worldData, this.server.getPlayerList().q());
this.worldMaps.a();
}
@@ -790,7 +799,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.an();
+ Entity[] aentity = entity.am();
if (aentity != null) {
for (int i = 0; i < aentity.length; ++i) {
@@ -802,7 +811,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.an();
+ Entity[] aentity = entity.am();
if (aentity != null) {
for (int i = 0; i < aentity.length; ++i) {
@@ -874,13 +883,13 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
public void playNote(int i, int j, int k, int l, int i1, int j1) {
NoteBlockData noteblockdata = new NoteBlockData(i, j, k, l, i1, j1);
- Iterator iterator = this.Q[this.R].iterator();
+ Iterator iterator = this.R[this.S].iterator();
NoteBlockData noteblockdata1;
do {
if (!iterator.hasNext()) {
- this.Q[this.R].add(noteblockdata);
+ this.R[this.S].add(noteblockdata);
return;
}
@@ -889,12 +898,12 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
- private void Z() {
- while (!this.Q[this.R].isEmpty()) {
- int i = this.R;
+ private void aa() {
+ while (!this.R[this.S].isEmpty()) {
+ int i = this.S;
- this.R ^= 1;
- Iterator iterator = this.Q[i].iterator();
+ this.S ^= 1;
+ Iterator iterator = this.R[i].iterator();
while (iterator.hasNext()) {
NoteBlockData noteblockdata = (NoteBlockData) iterator.next();
@@ -905,7 +914,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
}
- this.Q[i].clear();
+ this.R[i].clear();
}
}
@@ -920,10 +929,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate
}
protected void o() {
- boolean flag = this.P();
+ boolean flag = this.Q();
super.o();
- if (flag != this.P()) {
+ if (flag != this.Q()) {
// CraftBukkit start - Only send weather packets to those affected
for (int i = 0; i < this.players.size(); ++i) {
if (((EntityPlayer) this.players.get(i)).world == this) {