diff options
Diffstat (limited to 'src/main/java/net/minecraft')
100 files changed, 838 insertions, 1091 deletions
diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java index 9ff2ccd1..96c897e3 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java @@ -123,8 +123,8 @@ public class Block { public static final Block SMOOTH_BRICK = (new BlockSmoothBrick(98)).c(1.5F).b(10.0F).a(h).a("stonebricksmooth"); public static final Block BIG_MUSHROOM_1 = (new BlockHugeMushroom(99, Material.WOOD, 142, 0)).c(0.2F).a(e).a("mushroom").i(); public static final Block BIG_MUSHROOM_2 = (new BlockHugeMushroom(100, Material.WOOD, 142, 1)).c(0.2F).a(e).a("mushroom").i(); - public static final Block IRON_FENCE = (new BlockThin(101, 85, 85, Material.ORE, true)).c(5.0F).b(10.0F).a(i).a("fenceIron"); - public static final Block THIN_GLASS = (new BlockThin(102, 49, 148, Material.SHATTERABLE, false)).c(0.3F).a(j).a("thinGlass"); + public static final Block IRON_FENCE = (new BlockThinFence(101, 85, 85, Material.ORE, true)).c(5.0F).b(10.0F).a(i).a("fenceIron"); + public static final Block THIN_GLASS = (new BlockThinFence(102, 49, 148, Material.SHATTERABLE, false)).c(0.3F).a(j).a("thinGlass"); public static final Block MELON = (new BlockMelon(103)).c(1.0F).a(e).a("melon"); public static final Block PUMPKIN_STEM = (new BlockStem(104, PUMPKIN)).c(0.0F).a(e).a("pumpkinStem").i(); public static final Block MELON_STEM = (new BlockStem(105, MELON)).c(0.0F).a(e).a("pumpkinStem").i(); @@ -301,7 +301,7 @@ public class Block { return 10; } - public void a(World world, int i, int j, int k) {} + public void onPlace(World world, int i, int j, int k) {} public void remove(World world, int i, int j, int k) {} @@ -309,7 +309,7 @@ public class Block { return 1; } - public int a(int i, Random random, int j) { + public int getDropType(int i, Random random, int j) { return this.id; } @@ -323,15 +323,15 @@ public class Block { public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) { if (!world.isStatic) { - int j1 = this.a(i1, world.random); + int j1 = this.getDropCount(i1, world.random); for (int k1 = 0; k1 < j1; ++k1) { // CraftBukkit - <= to < to allow for plugins to completely disable block drops from explosions if (world.random.nextFloat() < f) { - int l1 = this.a(l, world.random, i1); + int l1 = this.getDropType(l, world.random, i1); if (l1 > 0) { - this.a(world, i, j, k, new ItemStack(l1, 1, this.c(l))); + this.a(world, i, j, k, new ItemStack(l1, 1, this.getDropData(l))); } } } @@ -351,7 +351,7 @@ public class Block { } } - protected int c(int i) { + protected int getDropData(int i) { return 0; } @@ -360,7 +360,7 @@ public class Block { } public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) { - this.a((IBlockAccess) world, i, j, k); + this.updateShape(world, i, j, k); vec3d = vec3d.add((double) (-i), (double) (-j), (double) (-k)); vec3d1 = vec3d1.add((double) (-i), (double) (-j), (double) (-k)); Vec3D vec3d2 = vec3d.a(vec3d1, this.minX); @@ -489,7 +489,7 @@ public class Block { public void a(World world, int i, int j, int k, Entity entity, Vec3D vec3d) {} - public void a(IBlockAccess iblockaccess, int i, int j, int k) {} + public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) {} public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) { return false; @@ -510,14 +510,14 @@ 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.c(0.025F); - if (this.b() && !isTileEntity[this.id] && EnchantmentManager.d(entityhuman.inventory)) { + if (this.b() && !isTileEntity[this.id] && EnchantmentManager.hasSilkTouchEnchantment(entityhuman.inventory)) { ItemStack itemstack = this.a_(l); if (itemstack != null) { this.a(world, i, j, k, itemstack); } } else { - int i1 = EnchantmentManager.e(entityhuman.inventory); + int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman.inventory); this.b(world, i, j, k, l, i1); } @@ -533,7 +533,7 @@ public class Block { return new ItemStack(this.id, 1, j); } - public int a(int i, Random random) { + public int getDropCount(int i, Random random) { return this.a(random); } @@ -549,7 +549,7 @@ public class Block { } public String m() { - return StatisticCollector.a(this.n() + ".name"); + return LocaleI18n.a(this.n() + ".name"); } public String n() { @@ -573,8 +573,8 @@ public class Block { static { Item.byId[WOOL.id] = (new ItemCloth(WOOL.id - 256)).a("cloth"); - Item.byId[LOG.id] = (new ItemLog(LOG.id - 256, LOG)).a("log"); - Item.byId[SMOOTH_BRICK.id] = (new ItemLog(SMOOTH_BRICK.id - 256, SMOOTH_BRICK)).a("stonebricksmooth"); + Item.byId[LOG.id] = (new ItemWithAuxData(LOG.id - 256, LOG)).a("log"); + Item.byId[SMOOTH_BRICK.id] = (new ItemWithAuxData(SMOOTH_BRICK.id - 256, SMOOTH_BRICK)).a("stonebricksmooth"); Item.byId[STEP.id] = (new ItemStep(STEP.id - 256)).a("stoneSlab"); Item.byId[SAPLING.id] = (new ItemSapling(SAPLING.id - 256)).a("sapling"); Item.byId[LEAVES.id] = (new ItemLeaves(LEAVES.id - 256)).a("leaves"); @@ -583,8 +583,8 @@ public class Block { Item.byId[WATER_LILY.id] = new ItemWaterLily(WATER_LILY.id - 256); Item.byId[PISTON.id] = new ItemPiston(PISTON.id - 256); Item.byId[PISTON_STICKY.id] = new ItemPiston(PISTON_STICKY.id - 256); - Item.byId[BIG_MUSHROOM_1.id] = new ItemLog(BIG_MUSHROOM_1.id - 256, BIG_MUSHROOM_1); // CraftBukkit - Item.byId[BIG_MUSHROOM_2.id] = new ItemLog(BIG_MUSHROOM_2.id - 256, BIG_MUSHROOM_2); // CraftBukkit + Item.byId[BIG_MUSHROOM_1.id] = new ItemWithAuxData(BIG_MUSHROOM_1.id - 256, BIG_MUSHROOM_1); // CraftBukkit + Item.byId[BIG_MUSHROOM_2.id] = new ItemWithAuxData(BIG_MUSHROOM_2.id - 256, BIG_MUSHROOM_2); // CraftBukkit Item.byId[MOB_SPAWNER.id] = new ItemMobSpawner(MOB_SPAWNER.id - 256); // CraftBukkit for (int i = 0; i < 256; ++i) { diff --git a/src/main/java/net/minecraft/server/BlockButton.java b/src/main/java/net/minecraft/server/BlockButton.java index 5998675a..b9114f08 100644 --- a/src/main/java/net/minecraft/server/BlockButton.java +++ b/src/main/java/net/minecraft/server/BlockButton.java @@ -97,7 +97,7 @@ public class BlockButton extends Block { } } - public void a(IBlockAccess iblockaccess, int i, int j, int k) { + public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) { int l = iblockaccess.getData(i, j, k); int i1 = l & 7; boolean flag = (l & 8) > 0; diff --git a/src/main/java/net/minecraft/server/BlockDispenser.java b/src/main/java/net/minecraft/server/BlockDispenser.java index b954f9aa..4b7f8a3e 100644 --- a/src/main/java/net/minecraft/server/BlockDispenser.java +++ b/src/main/java/net/minecraft/server/BlockDispenser.java @@ -21,12 +21,12 @@ public class BlockDispenser extends BlockContainer { return 4; } - public int a(int i, Random random, int j) { + public int getDropType(int i, Random random, int j) { return Block.DISPENSER.id; } - public void a(World world, int i, int j, int k) { - super.a(world, i, j, k); + public void onPlace(World world, int i, int j, int k) { + super.onPlace(world, i, j, k); this.g(world, i, j, k); } diff --git a/src/main/java/net/minecraft/server/BlockDoor.java b/src/main/java/net/minecraft/server/BlockDoor.java index de1fe86c..a17f015c 100644 --- a/src/main/java/net/minecraft/server/BlockDoor.java +++ b/src/main/java/net/minecraft/server/BlockDoor.java @@ -55,11 +55,11 @@ public class BlockDoor extends Block { } public AxisAlignedBB e(World world, int i, int j, int k) { - this.a((IBlockAccess)world, i, j, k); // CraftBukkit - Make sure this points to the below method! + this.updateShape(world, i, j, k); return super.e(world, i, j, k); } - public void a(IBlockAccess iblockaccess, int i, int j, int k) { + public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) { this.d(this.e(iblockaccess.getData(i, j, k))); } @@ -188,12 +188,12 @@ public class BlockDoor extends Block { } } - public int a(int i, Random random, int j) { + public int getDropType(int i, Random random, int j) { return (i & 8) != 0 ? 0 : (this.material == Material.ORE ? Item.IRON_DOOR.id : Item.WOOD_DOOR.id); } public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) { - this.a(world, i, j, k); + this.updateShape(world, i, j, k); return super.a(world, i, j, k, vec3d, vec3d1); } diff --git a/src/main/java/net/minecraft/server/BlockDragonEgg.java b/src/main/java/net/minecraft/server/BlockDragonEgg.java index 400a7117..7fb1cfcf 100644 --- a/src/main/java/net/minecraft/server/BlockDragonEgg.java +++ b/src/main/java/net/minecraft/server/BlockDragonEgg.java @@ -8,7 +8,7 @@ public class BlockDragonEgg extends Block { super(i, j, Material.DRAGON_EGG); } - public void a(World world, int i, int j, int k) { + public void onPlace(World world, int i, int j, int k) { world.c(i, j, k, this.id, this.d()); } @@ -26,9 +26,9 @@ public class BlockDragonEgg extends Block { if (!BlockSand.instaFall && world.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) { // CraftBukkit - added data - EntityFallingSand entityfallingsand = new EntityFallingSand(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.id, world.getData(i, j, k)); + EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.id, world.getData(i, j, k)); - world.addEntity(entityfallingsand); + world.addEntity(entityfallingblock); } else { world.setTypeId(i, j, k, 0); diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java index b141828f..7fefe7eb 100644 --- a/src/main/java/net/minecraft/server/BlockFire.java +++ b/src/main/java/net/minecraft/server/BlockFire.java @@ -65,7 +65,7 @@ public class BlockFire extends Block { public void a(World world, int i, int j, int k, Random random) { boolean flag = world.getTypeId(i, j - 1, k) == Block.NETHERRACK.id; - if (world.worldProvider instanceof WorldProviderSky && world.getTypeId(i, j - 1, k) == Block.BEDROCK.id) { + if (world.worldProvider instanceof WorldProviderTheEnd && world.getTypeId(i, j - 1, k) == Block.BEDROCK.id) { flag = true; } @@ -238,7 +238,7 @@ public class BlockFire extends Block { } } - public void a(World world, int i, int j, int k) { + 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.b_(world, i, j, k)) { if (!world.e(i, j - 1, k) && !this.g(world, i, j, k)) { world.setTypeId(i, j, k, 0); diff --git a/src/main/java/net/minecraft/server/BlockFlowing.java b/src/main/java/net/minecraft/server/BlockFlowing.java index 12469a09..64a12a41 100644 --- a/src/main/java/net/minecraft/server/BlockFlowing.java +++ b/src/main/java/net/minecraft/server/BlockFlowing.java @@ -298,8 +298,8 @@ public class BlockFlowing extends BlockFluids { return material == this.material ? false : (material == Material.LAVA ? false : !this.k(world, i, j, k)); } - public void a(World world, int i, int j, int k) { - super.a(world, i, j, k); + public void onPlace(World world, int i, int j, int k) { + super.onPlace(world, i, j, k); if (world.getTypeId(i, j, k) == this.id) { world.c(i, j, k, this.id, this.d()); } diff --git a/src/main/java/net/minecraft/server/BlockGrass.java b/src/main/java/net/minecraft/server/BlockGrass.java index 7c8b2ca7..b096269b 100644 --- a/src/main/java/net/minecraft/server/BlockGrass.java +++ b/src/main/java/net/minecraft/server/BlockGrass.java @@ -60,7 +60,7 @@ public class BlockGrass extends Block { } } - public int a(int i, Random random, int j) { - return Block.DIRT.a(0, random, j); + public int getDropType(int i, Random random, int j) { + return Block.DIRT.getDropType(0, random, j); } } diff --git a/src/main/java/net/minecraft/server/BlockGravel.java b/src/main/java/net/minecraft/server/BlockGravel.java index 94163bf7..7da42695 100644 --- a/src/main/java/net/minecraft/server/BlockGravel.java +++ b/src/main/java/net/minecraft/server/BlockGravel.java @@ -8,7 +8,7 @@ public class BlockGravel extends BlockSand { super(i, j); } - public int a(int i, Random random, int j) { + public int getDropType(int i, Random random, int j) { j = Math.min(j, 3); // CraftBukkit - added to fix crash when j > 3 return random.nextInt(10 - j * 3) == 0 ? Item.FLINT.id : this.id; } diff --git a/src/main/java/net/minecraft/server/BlockIce.java b/src/main/java/net/minecraft/server/BlockIce.java index 7c22130b..07d888d7 100644 --- a/src/main/java/net/minecraft/server/BlockIce.java +++ b/src/main/java/net/minecraft/server/BlockIce.java @@ -3,7 +3,7 @@ package net.minecraft.server; import java.util.Random; import org.bukkit.craftbukkit.event.CraftEventFactory; -public class BlockIce extends BlockBreakable { +public class BlockIce extends BlockHalfTransparant { public BlockIce(int i, int j) { super(i, j, Material.ICE, false); diff --git a/src/main/java/net/minecraft/server/BlockLeaves.java b/src/main/java/net/minecraft/server/BlockLeaves.java index 4141ed19..b0e21b3e 100644 --- a/src/main/java/net/minecraft/server/BlockLeaves.java +++ b/src/main/java/net/minecraft/server/BlockLeaves.java @@ -4,7 +4,7 @@ import java.util.Random; import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit -public class BlockLeaves extends BlockLeavesBase { +public class BlockLeaves extends BlockTransparant { private int c; int[] a; @@ -134,7 +134,7 @@ public class BlockLeaves extends BlockLeavesBase { return random.nextInt(20) == 0 ? 1 : 0; } - public int a(int i, Random random, int j) { + public int getDropType(int i, Random random, int j) { return Block.SAPLING.id; } @@ -147,7 +147,7 @@ public class BlockLeaves extends BlockLeavesBase { } } - protected int c(int i) { + protected int getDropData(int i) { return i & 3; } diff --git a/src/main/java/net/minecraft/server/BlockLever.java b/src/main/java/net/minecraft/server/BlockLever.java index ad607ceb..48841339 100644 --- a/src/main/java/net/minecraft/server/BlockLever.java +++ b/src/main/java/net/minecraft/server/BlockLever.java @@ -112,7 +112,7 @@ public class BlockLever extends Block { } } - public void a(IBlockAccess iblockaccess, int i, int j, int k) { + public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) { int l = iblockaccess.getData(i, j, k) & 7; float f = 0.1875F; diff --git a/src/main/java/net/minecraft/server/BlockMobSpawner.java b/src/main/java/net/minecraft/server/BlockMobSpawner.java index d3a29ca8..e70125ae 100644 --- a/src/main/java/net/minecraft/server/BlockMobSpawner.java +++ b/src/main/java/net/minecraft/server/BlockMobSpawner.java @@ -12,7 +12,7 @@ public class BlockMobSpawner extends BlockContainer { return new TileEntityMobSpawner(); } - public int a(int i, Random random, int j) { + public int getDropType(int i, Random random, int j) { return Block.MOB_SPAWNER.id; // CraftBukkit } @@ -35,7 +35,7 @@ public class BlockMobSpawner extends BlockContainer { super.remove(world, i, j, k); } - protected int c(int i) { + protected int getDropData(int i) { return i; } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java index ed4771e8..93a7138d 100644 --- a/src/main/java/net/minecraft/server/BlockPiston.java +++ b/src/main/java/net/minecraft/server/BlockPiston.java @@ -23,7 +23,7 @@ public class BlockPiston extends Block { public int a(int i, int j) { int k = d(j); - return k > 5 ? this.textureId : (i == k ? (!e(j) && this.minX <= 0.0D && this.minY <= 0.0D && this.minZ <= 0.0D && this.maxX >= 1.0D && this.maxY >= 1.0D && this.maxZ >= 1.0D ? this.textureId : 110) : (i == PistonBlockTextures.a[k] ? 109 : 108)); + return k > 5 ? this.textureId : (i == k ? (!e(j) && this.minX <= 0.0D && this.minY <= 0.0D && this.minZ <= 0.0D && this.maxX >= 1.0D && this.maxY >= 1.0D && this.maxZ >= 1.0D ? this.textureId : 110) : (i == Facing.a[k] ? 109 : 108)); } public int c() { @@ -53,7 +53,7 @@ public class BlockPiston extends Block { } } - public void a(World world, int i, int j, int k) { + public void onPlace(World world, int i, int j, int k) { if (!world.isStatic && world.getTileEntity(i, j, k) == null && !b) { this.g(world, i, j, k); } @@ -114,7 +114,7 @@ public class BlockPiston extends Block { world.setRawData(i, j, k, i1); } } else if (l == 1) { - TileEntity tileentity = world.getTileEntity(i + PistonBlockTextures.b[i1], j + PistonBlockTextures.c[i1], k + PistonBlockTextures.d[i1]); + TileEntity tileentity = world.getTileEntity(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1]); if (tileentity != null && tileentity instanceof TileEntityPiston) { ((TileEntityPiston) tileentity).g(); @@ -123,9 +123,9 @@ public class BlockPiston extends Block { world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, i1); world.setTileEntity(i, j, k, BlockPistonMoving.a(this.id, i1, i1, false, true)); if (this.a) { - int j1 = i + PistonBlockTextures.b[i1] * 2; - int k1 = j + PistonBlockTextures.c[i1] * 2; - int l1 = k + PistonBlockTextures.d[i1] * 2; + int j1 = i + Facing.b[i1] * 2; + int k1 = j + Facing.c[i1] * 2; + int l1 = k + Facing.d[i1] * 2; int i2 = world.getTypeId(j1, k1, l1); int j2 = world.getData(j1, k1, l1); boolean flag = false; @@ -146,9 +146,9 @@ public class BlockPiston extends Block { } if (!flag && i2 > 0 && a(i2, world, j1, k1, l1, false) && (Block.byId[i2].g() == 0 || i2 == Block.PISTON.id || i2 == Block.PISTON_STICKY.id)) { - i += PistonBlockTextures.b[i1]; - j += PistonBlockTextures.c[i1]; - k += PistonBlockTextures.d[i1]; + i += Facing.b[i1]; + j += Facing.c[i1]; + k += Facing.d[i1]; world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, j2); world.setTileEntity(i, j, k, BlockPistonMoving.a(i2, j2, i1, false, false)); b = false; @@ -156,12 +156,12 @@ public class BlockPiston extends Block { b = true; } else if (!flag) { b = false; - world.setTypeId(i + PistonBlockTextures.b[i1], j + PistonBlockTextures.c[i1], k + PistonBlockTextures.d[i1], 0); + world.setTypeId(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1], 0); b = true; } } else { b = false; - world.setTypeId(i + PistonBlockTextures.b[i1], j + PistonBlockTextures.c[i1], k + PistonBlockTextures.d[i1], 0); + world.setTypeId(i + Facing.b[i1], j + Facing.c[i1], k + Facing.d[i1], 0); b = true; } @@ -171,7 +171,7 @@ public class BlockPiston extends Block { b = false; } - public void a(IBlockAccess iblockaccess, int i, int j, int k) { + public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) { int l = iblockaccess.getData(i, j, k); if (e(l)) { @@ -269,9 +269,9 @@ public class BlockPiston extends Block { // CraftBukkkit boolean -> int private static int g(World world, int i, int j, int k, int l) { - int i1 = i + PistonBlockTextures.b[l]; - int j1 = j + PistonBlockTextures.c[l]; - int k1 = k + PistonBlockTextures.d[l]; + int i1 = i + Facing.b[l]; + int j1 = j + Facing.c[l]; + int k1 = k + Facing.d[l]; int l1 = 0; while (true) { @@ -292,9 +292,9 @@ public class BlockPiston extends Block { return -1; // CraftBukkit } - i1 += PistonBlockTextures.b[l]; - j1 += PistonBlockTextures.c[l]; - k1 += PistonBlockTextures.d[l]; + i1 += Facing.b[l]; + j1 += Facing.c[l]; + k1 += Facing.d[l]; ++l1; continue; } @@ -306,9 +306,9 @@ public class BlockPiston extends Block { } private boolean h(World world, int i, int j, int k, int l) { - int i1 = i + PistonBlockTextures.b[l]; - int j1 = j + PistonBlockTextures.c[l]; - int k1 = k + PistonBlockTextures.d[l]; + int i1 = i + Facing.b[l]; + int j1 = j + Facing.c[l]; + int k1 = k + Facing.d[l]; int l1 = 0; while (true) { @@ -330,9 +330,9 @@ public class BlockPiston extends Block { return false; } - i1 += PistonBlockTextures.b[l]; - j1 += PistonBlockTextures.c[l]; - k1 += PistonBlockTextures.d[l]; + i1 += Facing.b[l]; + j1 += Facing.c[l]; + k1 += Facing.d[l]; ++l1; continue; } @@ -343,9 +343,9 @@ public class BlockPiston extends Block { } while (i1 != i || j1 != j || k1 != k) { - l1 = i1 - PistonBlockTextures.b[l]; - i2 = j1 - PistonBlockTextures.c[l]; - int j2 = k1 - PistonBlockTextures.d[l]; + l1 = i1 - Facing.b[l]; + i2 = j1 - Facing.c[l]; + int j2 = k1 - Facing.d[l]; int k2 = world.getTypeId(l1, i2, j2); int l2 = world.getData(l1, i2, j2); diff --git a/src/main/java/net/minecraft/server/BlockPistonExtension.java b/src/main/java/net/minecraft/server/BlockPistonExtension.java index 501c61ce..72363a0f 100644 --- a/src/main/java/net/minecraft/server/BlockPistonExtension.java +++ b/src/main/java/net/minecraft/server/BlockPistonExtension.java @@ -17,11 +17,11 @@ public class BlockPistonExtension extends Block { super.remove(world, i, j, k); int l = world.getData(i, j, k); if (l > 5 || l < 0) return; // CraftBukkit - fixed a piston AIOOBE issue. - int i1 = PistonBlockTextures.a[b(l)]; + int i1 = Facing.a[b(l)]; - i += PistonBlockTextures.b[i1]; - j += PistonBlockTextures.c[i1]; - k += PistonBlockTextures.d[i1]; + i += Facing.b[i1]; + j += Facing.c[i1]; + k += Facing.d[i1]; int j1 = world.getTypeId(i, j, k); if (j1 == Block.PISTON.id || j1 == Block.PISTON_STICKY.id) { @@ -36,7 +36,7 @@ public class BlockPistonExtension extends Block { public int a(int i, int j) { int k = b(j); - return i == k ? (this.a >= 0 ? this.a : ((j & 8) != 0 ? this.textureId - 1 : this.textureId)) : (i == PistonBlockTextures.a[k] ? 107 : 108); + return i == k ? (this.a >= 0 ? this.a : ((j & 8) != 0 ? this.textureId - 1 : this.textureId)) : (i == Facing.a[k] ? 107 : 108); } public int c() { @@ -112,7 +112,7 @@ public class BlockPistonExtension extends Block { this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } - public void a(IBlockAccess iblockaccess, int i, int j, int k) { + public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) { int l = iblockaccess.getData(i, j, k); switch (b(l)) { @@ -144,12 +144,12 @@ public class BlockPistonExtension extends Block { public void doPhysics(World world, int i, int j, int k, int l) { int i1 = b(world.getData(i, j, k)); if (i1 > 5 || i1 < 0) return; // CraftBukkit - fixed a piston AIOOBE issue. - int j1 = world.getTypeId(i - PistonBlockTextures.b[i1], j - PistonBlockTextures.c[i1], k - PistonBlockTextures.d[i1]); + int j1 = world.getTypeId(i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1]); if (j1 != Block.PISTON.id && j1 != Block.PISTON_STICKY.id) { world.setTypeId(i, j, k, 0); } else { - Block.byId[j1].doPhysics(world, i - PistonBlockTextures.b[i1], j - PistonBlockTextures.c[i1], k - PistonBlockTextures.d[i1], l); + Block.byId[j1].doPhysics(world, i - Facing.b[i1], j - Facing.c[i1], k - Facing.d[i1], l); } } diff --git a/src/main/java/net/minecraft/server/BlockPortal.java b/src/main/java/net/minecraft/server/BlockPortal.java index 4b9314be..e5fd92f2 100644 --- a/src/main/java/net/minecraft/server/BlockPortal.java +++ b/src/main/java/net/minecraft/server/BlockPortal.java @@ -7,7 +7,7 @@ import org.bukkit.event.entity.EntityPortalEnterEvent; import org.bukkit.event.world.PortalCreateEvent; // CraftBukkit end -public class BlockPortal extends BlockBreakable { +public class BlockPortal extends BlockHalfTransparant { public BlockPortal(int i, int j) { super(i, j, Material.PORTAL, false); @@ -17,7 +17,7 @@ public class BlockPortal extends BlockBreakable { return null; } - public void a(IBlockAccess iblockaccess, int i, int j, int k) { + public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) { float f; float f1; diff --git a/src/main/java/net/minecraft/server/BlockPressurePlate.java b/src/main/java/net/minecraft/server/BlockPressurePlate.java index f32adaa1..9c17c7e7 100644 --- a/src/main/java/net/minecraft/server/BlockPressurePlate.java +++ b/src/main/java/net/minecraft/server/BlockPressurePlate.java @@ -42,7 +42,7 @@ public class BlockPressurePlate extends Block { return world.e(i, j - 1, k) || world.getTypeId(i, j - 1, k) == Block.FENCE.id; } - public void a(World world, int i, int j, int k) {} + public void onPlace(World world, int i, int j, int k) {} public void doPhysics(World world, int i, int j, int k, int l) { boolean flag = false; @@ -159,7 +159,7 @@ public class BlockPressurePlate extends Block { super.remove(world, i, j, k); } - public void a(IBlockAccess iblockaccess, int i, int j, int k) { + public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) { boolean flag = iblockaccess.getData(i, j, k) == 1; float f = 0.0625F; diff --git a/src/main/java/net/minecraft/server/BlockPumpkin.java b/src/main/java/net/minecraft/server/BlockPumpkin.java index 27212c83..8babb968 100644 --- a/src/main/java/net/minecraft/server/BlockPumpkin.java +++ b/src/main/java/net/minecraft/server/BlockPumpkin.java @@ -33,8 +33,8 @@ public class BlockPumpkin extends Block { return i == 1 ? this.textureId : (i == 0 ? this.textureId : (i == 3 ? this.textureId + 1 + 16 : this.textureId + 16)); } - public void a(World world, int i, int j, int k) { - super.a(world, i, j, k); + public void onPlace(World world, int i, int j, int k) { + super.onPlace(world, i, j, k); if (world.getTypeId(i, j - 1, k) == Block.SNOW_BLOCK.id && world.getTypeId(i, j - 2, k) == Block.SNOW_BLOCK.id) { if (!world.isStatic && world.getServer().getServer().spawnAnimals) { // CraftBukkit - make snowmen obey spawning rules world.setTypeId(i, j, k, 0); diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java index e78cdb66..e9986db9 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java @@ -46,9 +46,9 @@ public class BlockRedstoneTorch extends BlockTorch { return 2; } - public void a(World world, int i, int j, int k) { + public void onPlace(World world, int i, int j, int k) { if (world.getData(i, j, k) == 0) { - super.a(world, i, j, k); + super.onPlace(world, i, j, k); } if (this.isOn) { @@ -152,7 +152,7 @@ public class BlockRedstoneTorch extends BlockTorch { return l == 0 ? this.a(world, i, j, k, l) : false; } - public int a(int i, Random random, int j) { + public int getDropType(int i, Random random, int j) { return Block.REDSTONE_TORCH_ON.id; } diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java index f6ee5487..f1d7f2f2 100644 --- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java +++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java @@ -195,8 +195,8 @@ public class BlockRedstoneWire extends Block { } } - public void a(World world, int i, int j, int k) { - super.a(world, i, j, k); + public void onPlace(World world, int i, int j, int k) { + super.onPlace(world, i, j, k); if (!world.isStatic) { this.g(world, i, j, k); world.applyPhysics(i, j + 1, k, this.id); @@ -294,7 +294,7 @@ public class BlockRedstoneWire extends Block { } } - public int a(int i, Random random, int j) { + public int getDropType(int i, Random random, int j) { return Item.REDSTONE.id; } diff --git a/src/main/java/net/minecraft/server/BlockSand.java b/src/main/java/net/minecraft/server/BlockSand.java index bc38fccb..938ebedc 100644 --- a/src/main/java/net/minecraft/server/BlockSand.java +++ b/src/main/java/net/minecraft/server/BlockSand.java @@ -10,7 +10,7 @@ public class BlockSand extends Block { super(i, j, Material.SAND); } - public void a(World world, int i, int j, int k) { + public void onPlace(World world, int i, int j, int k) { world.c(i, j, k, this.id, this.d()); } @@ -29,9 +29,9 @@ public class BlockSand extends Block { if (!instaFall && world.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) { if (!world.isStatic) { // CraftBukkit Change call to add data - EntityFallingSand entityfallingsand = new EntityFallingSand(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.id, world.getData(i, j, k)); + EntityFallingBlock entityfallingblock = new EntityFallingBlock(world, (double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), this.id, world.getData(i, j, k)); - world.addEntity(entityfallingsand); + world.addEntity(entityfallingblock); } } else { world.setTypeId(i, j, k, 0); diff --git a/src/main/java/net/minecraft/server/BlockSapling.java b/src/main/java/net/minecraft/server/BlockSapling.java index 4eccdee0..521810cb 100644 --- a/src/main/java/net/minecraft/server/BlockSapling.java +++ b/src/main/java/net/minecraft/server/BlockSapling.java @@ -61,7 +61,7 @@ public class BlockSapling extends BlockFlower { // CraftBukkit end } - protected int c(int i) { + protected int getDropData(int i) { return i & 3; } diff --git a/src/main/java/net/minecraft/server/BlockSign.java b/src/main/java/net/minecraft/server/BlockSign.java index 888b79f3..453cfafd 100644 --- a/src/main/java/net/minecraft/server/BlockSign.java +++ b/src/main/java/net/minecraft/server/BlockSign.java @@ -24,7 +24,7 @@ public class BlockSign extends BlockContainer { return null; } - public void a(IBlockAccess iblockaccess, int i, int j, int k) { + public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) { if (!this.b) { int l = iblockaccess.getData(i, j, k); float f = 0.28125F; @@ -72,7 +72,7 @@ public class BlockSign extends BlockContainer { } } - public int a(int i, Random random, int j) { + public int getDropType(int i, Random random, int j) { return Item.SIGN.id; } diff --git a/src/main/java/net/minecraft/server/BlockSnow.java b/src/main/java/net/minecraft/server/BlockSnow.java index 24a327cd..bb7734c4 100644 --- a/src/main/java/net/minecraft/server/BlockSnow.java +++ b/src/main/java/net/minecraft/server/BlockSnow.java @@ -25,7 +25,7 @@ public class BlockSnow extends Block { return false; } - public void a(IBlockAccess iblockaccess, int i, int j, int k) { + public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) { int l = iblockaccess.getData(i, j, k) & 7; float f = (float) (2 * (1 + l)) / 16.0F; @@ -66,7 +66,7 @@ public class BlockSnow extends Block { entityhuman.a(StatisticList.C[this.id], 1); } - public int a(int i, Random random, int j) { + public int getDropType(int i, Random random, int j) { return Item.SNOW_BALL.id; } diff --git a/src/main/java/net/minecraft/server/BlockSoil.java b/src/main/java/net/minecraft/server/BlockSoil.java index 9afaf178..f2283a76 100644 --- a/src/main/java/net/minecraft/server/BlockSoil.java +++ b/src/main/java/net/minecraft/server/BlockSoil.java @@ -106,7 +106,7 @@ public class BlockSoil extends Block { } } - public int a(int i, Random random, int j) { - return Block.DIRT.a(0, random, j); + public int getDropType(int i, Random random, int j) { + return Block.DIRT.getDropType(0, random, j); } } diff --git a/src/main/java/net/minecraft/server/BlockStairs.java b/src/main/java/net/minecraft/server/BlockStairs.java index 0adf67ac..c1973400 100644 --- a/src/main/java/net/minecraft/server/BlockStairs.java +++ b/src/main/java/net/minecraft/server/BlockStairs.java @@ -16,7 +16,7 @@ public class BlockStairs extends Block { this.g(255); } - public void a(IBlockAccess iblockaccess, int i, int j, int k) { + public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) { this.a(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); } @@ -104,9 +104,9 @@ public class BlockStairs extends Block { return this.a.canPlace(world, i, j, k); } - public void a(World world, int i, int j, int k) { + public void onPlace(World world, int i, int j, int k) { this.doPhysics(world, i, j, k, 0); - this.a.a(world, i, j, k); + this.a.onPlace(world, i, j, k); } public void remove(World world, int i, int j, int k) { diff --git a/src/main/java/net/minecraft/server/BlockTrapdoor.java b/src/main/java/net/minecraft/server/BlockTrapdoor.java index 18bcf1c7..515aaa7c 100644 --- a/src/main/java/net/minecraft/server/BlockTrapdoor.java +++ b/src/main/java/net/minecraft/server/BlockTrapdoor.java @@ -30,11 +30,11 @@ public class BlockTrapdoor extends Block { } public AxisAlignedBB e(World world, int i, int j, int k) { - this.a((IBlockAccess)world, i, j, k); // CraftBukkit - Make sure this points to the below method! + this.updateShape(world, i, j, k); return super.e(world, i, j, k); } - public void a(IBlockAccess iblockaccess, int i, int j, int k) { + public void updateShape(IBlockAccess iblockaccess, int i, int j, int k) { this.d(iblockaccess.getData(i, j, k)); } @@ -140,7 +140,7 @@ public class BlockTrapdoor extends Block { } public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) { - this.a(world, i, j, k); + this.updateShape(world, i, j, k); return super.a(world, i, j, k, vec3d, vec3d1); } diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java index 72a29a9c..7c0fde22 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -336,7 +336,7 @@ public class Chunk { if (l != 0) { if (!this.world.isStatic) { - Block.byId[l].a(this.world, i2, j, j2); + Block.byId[l].onPlace(this.world, i2, j, j2); } if (Block.byId[l] instanceof BlockContainer) { @@ -400,7 +400,7 @@ public class Chunk { if (l != 0) { if (!this.world.isStatic) { - Block.byId[l].a(this.world, l1, j, i2); + Block.byId[l].onPlace(this.world, l1, j, i2); } if (l > 0 && Block.byId[l] instanceof BlockContainer) { diff --git a/src/main/java/net/minecraft/server/ContainerPlayer.java b/src/main/java/net/minecraft/server/ContainerPlayer.java index 96f006e7..f5d995e0 100644 --- a/src/main/java/net/minecraft/server/ContainerPlayer.java +++ b/src/main/java/net/minecraft/server/ContainerPlayer.java @@ -6,16 +6,16 @@ public class ContainerPlayer extends Container { public IInventory resultInventory; public boolean c; - public ContainerPlayer(InventoryPlayer inventoryplayer) { - this(inventoryplayer, true); + public ContainerPlayer(PlayerInventory playerinventory) { + this(playerinventory, true); } - public ContainerPlayer(InventoryPlayer inventoryplayer, boolean flag) { + public ContainerPlayer(PlayerInventory playerinventory, boolean flag) { this.craftInventory = new InventoryCrafting(this, 2, 2); this.resultInventory = new InventoryCraftResult(); this.c = false; this.c = flag; - this.a((Slot) (new SlotResult(inventoryplayer.d, this.craftInventory, this.resultInventory, 0, 144, 36))); + this.a((Slot) (new SlotResult(playerinventory.d, this.craftInventory, this.resultInventory, 0, 144, 36))); int i; int j; @@ -27,17 +27,17 @@ public class ContainerPlayer extends Container { } for (i = 0; i < 4; ++i) { - this.a((Slot) (new SlotArmor(this, inventoryplayer, inventoryplayer.getSize() - 1 - i, 8, 8 + i * 18, i))); + this.a((Slot) (new SlotArmor(this, playerinventory, playerinventory.getSize() - 1 - i, 8, 8 + i * 18, i))); } for (i = 0; i < 3; ++i) { for (j = 0; j < 9; ++j) { - this.a(new Slot(inventoryplayer, j + (i + 1) * 9, 8 + j * 18, 84 + i * 18)); + this.a(new Slot(playerinventory, j + (i + 1) * 9, 8 + j * 18, 84 + i * 18)); } } for (i = 0; i < 9; ++i) { - this.a(new Slot(inventoryplayer, i, 8 + i * 18, 142)); + this.a(new Slot(playerinventory, i, 8 + i * 18, 142)); } this.a((IInventory) this.craftInventory); diff --git a/src/main/java/net/minecraft/server/ContainerWorkbench.java b/src/main/java/net/minecraft/server/ContainerWorkbench.java index 3f62b82d..46c5c074 100644 --- a/src/main/java/net/minecraft/server/ContainerWorkbench.java +++ b/src/main/java/net/minecraft/server/ContainerWorkbench.java @@ -9,12 +9,12 @@ public class ContainerWorkbench extends Container { private int i; private int j; - public ContainerWorkbench(InventoryPlayer inventoryplayer, World world, int i, int j, int k) { + public ContainerWorkbench(PlayerInventory playerinventory, World world, int i, int j, int k) { this.c = world; this.h = i; this.i = j; this.j = k; - this.a((Slot) (new SlotResult(inventoryplayer.d, this.craftInventory, this.resultInventory, 0, 124, 35))); + this.a((Slot) (new SlotResult(playerinventory.d, this.craftInventory, this.resultInventory, 0, 124, 35))); int l; int i1; @@ -27,12 +27,12 @@ public class ContainerWorkbench extends Container { for (l = 0; l < 3; ++l) { for (i1 = 0; i1 < 9; ++i1) { - this.a(new Slot(inventoryplayer, i1 + l * 9 + 9, 8 + i1 * 18, 84 + l * 18)); + this.a(new Slot(playerinventory, i1 + l * 9 + 9, 8 + i1 * 18, 84 + l * 18)); } } for (l = 0; l < 9; ++l) { - this.a(new Slot(inventoryplayer, l, 8 + l * 18, 142)); + this.a(new Slot(playerinventory, l, 8 + l * 18, 142)); } this.a((IInventory) this.craftInventory); diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java index 1a170621..123a5d63 100644 --- a/src/main/java/net/minecraft/server/EnchantmentManager.java +++ b/src/main/java/net/minecraft/server/EnchantmentManager.java @@ -10,23 +10,23 @@ import java.util.Random; public class EnchantmentManager { private static final Random random = new Random(); - private static final EnchantmentModifier1 b = new EnchantmentModifier1((EmptyClass3) null); - private static final EnchantmentModifier2 c = new EnchantmentModifier2((EmptyClass3) null); + private static final EnchantmentModifierProtection b = new EnchantmentModifierProtection((EmptyClass3) null); + private static final EnchantmentModifierDamage c = new EnchantmentModifierDamage((EmptyClass3) null); public EnchantmentManager() {} - public static int b(int i, ItemStack itemstack) { // CraftBukkit - priv to pub + public static int getEnchantmentLevel(int i, ItemStack itemstack) { // CraftBukkit - priv to pub if (itemstack == null) { return 0; } else { - NBTTagList nbttaglist = itemstack.p(); + NBTTagList nbttaglist = itemstack.getEnchantments(); if (nbttaglist == null) { return 0; } else { - for (int j = 0; j < nbttaglist.d(); ++j) { - short short1 = ((NBTTagCompound) nbttaglist.a(j)).e("id"); - short short2 = ((NBTTagCompound) nbttaglist.a(j)).e("lvl"); + for (int j = 0; j < nbttaglist.size(); ++j) { + short short1 = ((NBTTagCompound) nbttaglist.get(j)).getShort("id"); + short short2 = ((NBTTagCompound) nbttaglist.get(j)).getShort("lvl"); if (short1 == i) { return short2; @@ -38,14 +38,14 @@ public class EnchantmentManager { } } - private static int a(int i, ItemStack[] aitemstack) { + private static int getEnchantmentLevel(int i, ItemStack[] aitemstack) { int j = 0; ItemStack[] aitemstack1 = aitemstack; int k = aitemstack.length; for (int l = 0; l < k; ++l) { ItemStack itemstack = aitemstack1[l]; - int i1 = b(i, itemstack); + int i1 = getEnchantmentLevel(i, itemstack); if (i1 > j) { j = i1; @@ -57,12 +57,12 @@ public class EnchantmentManager { private static void a(EnchantmentModifier enchantmentmodifier, ItemStack itemstack) { if (itemstack != null) { - NBTTagList nbttaglist = itemstack.p(); + NBTTagList nbttaglist = itemstack.getEnchantments(); if (nbttaglist != null) { - for (int i = 0; i < nbttaglist.d(); ++i) { - short short1 = ((NBTTagCompound) nbttaglist.a(i)).e("id"); - short short2 = ((NBTTagCompound) nbttaglist.a(i)).e("lvl"); + for (int i = 0; i < nbttaglist.size(); ++i) { + short short1 = ((NBTTagCompound) nbttaglist.get(i)).getShort("id"); + short short2 = ((NBTTagCompound) nbttaglist.get(i)).getShort("lvl"); if (Enchantment.byId[short1] != null) { enchantmentmodifier.a(Enchantment.byId[short1], short2); @@ -83,10 +83,10 @@ public class EnchantmentManager { } } - public static int a(InventoryPlayer inventoryplayer, DamageSource damagesource) { + public static int a(PlayerInventory playerinventory, DamageSource damagesource) { b.a = 0; b.b = damagesource; - a((EnchantmentModifier) b, inventoryplayer.armor); + a((EnchantmentModifier) b, playerinventory.armor); if (b.a > 25) { b.a = 25; } @@ -94,47 +94,47 @@ public class EnchantmentManager { return (b.a + 1 >> 1) + random.nextInt((b.a >> 1) + 1); } - public static int a(InventoryPlayer inventoryplayer, EntityLiving entityliving) { + public static int a(PlayerInventory playerinventory, EntityLiving entityliving) { c.a = 0; c.b = entityliving; - a((EnchantmentModifier) c, inventoryplayer.getItemInHand()); + a((EnchantmentModifier) c, playerinventory.getItemInHand()); return c.a > 0 ? 1 + random.nextInt(c.a) : 0; } - public static int b(InventoryPlayer inventoryplayer, EntityLiving entityliving) { - return b(Enchantment.KNOCKBACK.id, inventoryplayer.getItemInHand()); + public static int getKnockbackEnchantmentLevel(PlayerInventory playerinventory, EntityLiving entityliving) { + return getEnchantmentLevel(Enchantment.KNOCKBACK.id, playerinventory.getItemInHand()); } - public static int c(InventoryPlayer inventoryplayer, EntityLiving entityliving) { - return b(Enchantment.FIRE_ASPECT.id, inventoryplayer.getItemInHand()); + public static int getFireAspectEnchantmentLevel(PlayerInventory playerinventory, EntityLiving entityliving) { + return getEnchantmentLevel(Enchantment.FIRE_ASPECT.id, playerinventory.getItemInHand()); } - public static int a(InventoryPlayer inventoryplayer) { - return a(Enchantment.OXYGEN.id, inventoryplayer.armor); + public static int getOxygenEnchantmentLevel(PlayerInventory playerinventory) { + return getEnchantmentLevel(Enchantment.OXYGEN.id, playerinventory.armor); } - public static int b(InventoryPlayer inventoryplayer) { - return b(Enchantment.DIG_SPEED.id, inventoryplayer.getItemInHand()); + public static int getDigSpeedEnchantmentLevel(PlayerInventory playerinventory) { + return getEnchantmentLevel(Enchantment.DIG_SPEED.id, playerinventory.getItemInHand()); } - public static int c(InventoryPlayer inventoryplayer) { - return b(Enchantment.DURABILITY.id, inventoryplayer.getItemInHand()); + public static int getDurabilityEnchantmentLevel(PlayerInventory playerinventory) { + return getEnchantmentLevel(Enchantment.DURABILITY.id, playerinventory.getItemInHand()); } - public static boolean d(InventoryPlayer inventoryplayer) { - return b(Enchantment.SILK_TOUCH.id, inventoryplayer.getItemInHand()) > 0; + public static boolean hasSilkTouchEnchantment(PlayerInventory playerinventory) { + return getEnchantmentLevel(Enchantment.SILK_TOUCH.id, playerinventory.getItemInHand()) > 0; } - public static int e(InventoryPlayer inventoryplayer) { - return b(Enchantment.LOOT_BONUS_BLOCKS.id, inventoryplayer.getItemInHand()); + public static int getBonusBlockLootEnchantmentLevel(PlayerInventory playerinventory) { + return getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS.id, playerinventory.getItemInHand()); } - public static int f(InventoryPlayer inventoryplayer) { - return b(Enchantment.LOOT_BONUS_MOBS.id, inventoryplayer.getItemInHand()); + public static int getBonusMonsterLootEnchantmentLevel(PlayerInventory playerinventory) { + return getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS.id, playerinventory.getItemInHand()); } - public static boolean g(InventoryPlayer inventoryplayer) { - return a(Enchantment.WATER_WORKER.id, inventoryplayer.armor) > 0; + public static boolean hasWaterWorkerEnchantment(PlayerInventory playerinventory) { + return getEnchantmentLevel(Enchantment.WATER_WORKER.id, playerinventory.armor) > 0; } public static int a(Random random, int i, int j, ItemStack itemstack) { @@ -170,11 +170,11 @@ public class EnchantmentManager { Map map = a(l, itemstack); if (map != null && !map.isEmpty()) { - WeightedRandomChoiceEnchantment weightedrandomchoiceenchantment = (WeightedRandomChoiceEnchantment) WeightedRandom.a(random, map.values()); + EnchantmentInstance enchantmentinstance = (EnchantmentInstance) WeightedRandom.a(random, map.values()); - if (weightedrandomchoiceenchantment != null) { + if (enchantmentinstance != null) { arraylist = new ArrayList(); - arraylist.add(weightedrandomchoiceenchantment); + arraylist.add(enchantmentinstance); for (int i1 = l >> 1; random.nextInt(50) <= i1; i1 >>= 1) { Iterator iterator = map.keySet().iterator(); @@ -186,9 +186,9 @@ public class EnchantmentManager { while (true) { if (iterator1.hasNext()) { - WeightedRandomChoiceEnchantment weightedrandomchoiceenchantment1 = (WeightedRandomChoiceEnchantment) iterator1.next(); + EnchantmentInstance enchantmentinstance1 = (EnchantmentInstance) iterator1.next(); - if (weightedrandomchoiceenchantment1.a.a(Enchantment.byId[integer.intValue()])) { + if (enchantmentinstance1.a.a(Enchantment.byId[integer.intValue()])) { continue; } @@ -203,9 +203,9 @@ public class EnchantmentManager { } if (!map.isEmpty()) { - WeightedRandomChoiceEnchantment weightedrandomchoiceenchantment2 = (WeightedRandomChoiceEnchantment) WeightedRandom.a(random, map.values()); + EnchantmentInstance enchantmentinstance2 = (EnchantmentInstance) WeightedRandom.a(random, map.values()); - arraylist.add(weightedrandomchoiceenchantment2); + arraylist.add(enchantmentinstance2); } } } @@ -224,14 +224,14 @@ public class EnchantmentManager { for (int k = 0; k < j; ++k) { Enchantment enchantment = aenchantment[k]; - if (enchantment != null && enchantment.slot.a(item)) { + if (enchantment != null && enchantment.slot.canEnchant(item)) { for (int l = enchantment.getStartLevel(); l <= enchantment.getMaxLevel(); ++l) { if (i >= enchantment.a(l) && i <= enchantment.b(l)) { if (hashmap == null) { hashmap = new HashMap(); } - hashmap.put(Integer.valueOf(enchantment.id), new WeightedRandomChoiceEnchantment(enchantment, l)); + hashmap.put(Integer.valueOf(enchantment.id), new EnchantmentInstance(enchantment, l)); } } } diff --git a/src/main/java/net/minecraft/server/EnchantmentModifier2.java b/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java index b10eff5e..41f00ad0 100644 --- a/src/main/java/net/minecraft/server/EnchantmentModifier2.java +++ b/src/main/java/net/minecraft/server/EnchantmentModifierDamage.java @@ -1,17 +1,17 @@ package net.minecraft.server; -final class EnchantmentModifier2 implements EnchantmentModifier { +final class EnchantmentModifierDamage implements EnchantmentModifier { public int a; public EntityLiving b; - private EnchantmentModifier2() {} + private EnchantmentModifierDamage() {} public void a(Enchantment enchantment, int i) { this.a += enchantment.a(i, this.b); } - EnchantmentModifier2(EmptyClass3 emptyclass3) { + EnchantmentModifierDamage(EmptyClass3 emptyclass3) { this(); } } diff --git a/src/main/java/net/minecraft/server/EnchantmentModifier1.java b/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java index 2edeacfe..4b1ec519 100644 --- a/src/main/java/net/minecraft/server/EnchantmentModifier1.java +++ b/src/main/java/net/minecraft/server/EnchantmentModifierProtection.java @@ -1,17 +1,17 @@ package net.minecraft.server; -final class EnchantmentModifier1 implements EnchantmentModifier { +final class EnchantmentModifierProtection implements EnchantmentModifier { public int a; public DamageSource b; - private EnchantmentModifier1() {} + private EnchantmentModifierProtection() {} public void a(Enchantment enchantment, int i) { this.a += enchantment.a(i, this.b); } - EnchantmentModifier1(EmptyClass3 emptyclass3) { + EnchantmentModifierProtection(EmptyClass3 emptyclass3) { this(); } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index 8cf70538..7851d560 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -55,8 +55,8 @@ public abstract class Entity { public boolean bA; public boolean dead; public float height; - public float length; public float width; + public float length; public float bF; public float bG; public float fallDistance; // CraftBukkit - private -> public @@ -72,10 +72,8 @@ public abstract class Entity { public int ticksLived; public int maxFireTicks; public int fireTicks; // CraftBukkit - private -> public - public int maxAirTicks; // CraftBukkit - protected -> public protected boolean bS; public int noDamageTicks; - public int airTicks; private boolean justCreated; protected boolean fireProof; protected DataWatcher datawatcher; @@ -100,8 +98,8 @@ public abstract class Entity { this.bA = true; this.dead = false; this.height = 0.0F; - this.length = 0.6F; - this.width = 1.8F; + this.width = 0.6F; + this.length = 1.8F; this.bF = 0.0F; this.bG = 0.0F; this.fallDistance = 0.0F; @@ -146,8 +144,8 @@ public abstract class Entity { } protected void b(float f, float f1) { - this.length = f; - this.width = f1; + this.width = f; + this.length = f1; } protected void c(float f, float f1) { @@ -186,8 +184,8 @@ public abstract class Entity { this.locX = d0; this.locY = d1; this.locZ = d2; - float f = this.length / 2.0F; - float f1 = this.width; + float f = this.width / 2.0F; + float f1 = this.length; this.boundingBox.c(d0 - (double) f, d1 - (double) this.height + (double) this.bL, d2 - (double) f, d0 + (double) f, d1 - (double) this.height + (double) this.bL + (double) f1, d2 + (double) f); } @@ -219,7 +217,7 @@ public abstract class Entity { int l = this.world.getTypeId(j, k, i); if (l > 0) { - this.world.a("tilecrack_" + l, this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.length, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.length, -this.motX * 4.0D, 1.5D, -this.motZ * 4.0D); + this.world.a("tilecrack_" + l, this.locX + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, this.boundingBox.b + 0.1D, this.locZ + ((double) this.random.nextFloat() - 0.5D) * (double) this.width, -this.motX * 4.0D, 1.5D, -this.motZ * 4.0D); } } @@ -237,15 +235,15 @@ public abstract class Entity { float f2; float f3; - for (i = 0; (float) i < 1.0F + this.length * 20.0F; ++i) { - f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; - f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) { + f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width; + f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width; this.world.a("bubble", this.locX + (double) f3, (double) (f1 + 1.0F), this.locZ + (double) f2, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ); } - for (i = 0; (float) i < 1.0F + this.length * 20.0F; ++i) { - f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; - f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) { + f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width; + f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width; this.world.a("splash", this.locX + (double) f3, (double) (f1 + 1.0F), this.locZ + (double) f2, this.motX, this.motY, this.motZ); } } @@ -326,22 +324,22 @@ public abstract class Entity { server.getPluginManager().callEvent(combustEvent); if (!combustEvent.isCancelled()) { - this.j(combustEvent.getDuration()); + this.setOnFire(combustEvent.getDuration()); } } else { // This will be called every single tick the entity is in lava, so don't throw an event. - this.j(15); + this.setOnFire(15); } return; } // CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls this.damageEntity(DamageSource.LAVA, 4); - this.j(15); + this.setOnFire(15); } } - public void j(int i) { + public void setOnFire(int i) { int j = i * 20; if (this.fireTicks < j) { @@ -349,7 +347,7 @@ public abstract class Entity { } } - public void aw() { + public void extinguish() { this.fireTicks = 0; } @@ -631,11 +629,11 @@ public abstract class Entity { this.world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { - this.j(event.getDuration()); + this.setOnFire(event.getDuration()); } } else { // CraftBukkit end - this.j(8); + this.setOnFire(8); } } } else if (this.fireTicks <= 0) { @@ -699,7 +697,7 @@ public abstract class Entity { } } - public final boolean ax() { + public final boolean isFireproof() { return this.fireProof; } @@ -921,8 +919,8 @@ public abstract class Entity { } public void d(NBTTagCompound nbttagcompound) { - nbttagcompound.a("Pos", (NBTBase) this.a(new double[] { this.locX, this.locY + (double) this.bL, this.locZ})); - nbttagcompound.a("Motion", (NBTBase) this.a(new double[] { this.motX, this.motY, this.motZ})); + nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY + (double) this.bL, this.locZ})); + nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ})); // CraftBukkit start - checking for NaN pitch/yaw and resetting to zero // TODO: make sure this is the best way to address this. @@ -935,11 +933,11 @@ public abstract class Entity { } // CraftBukkit end - nbttagcompound.a("Rotation", (NBTBase) this.a(new float[] { this.yaw, this.pitch})); - nbttagcompound.a("FallDistance", this.fallDistance); - nbttagcompound.a("Fire", (short) this.fireTicks); - nbttagcompound.a("Air", (short) this.getAirTicks()); - nbttagcompound.a("OnGround", this.onGround); + nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch})); + nbttagcompound.setFloat("FallDistance", this.fallDistance); + nbttagcompound.setShort("Fire", (short) this.fireTicks); + nbttagcompound.setShort("Air", (short) this.getAirTicks()); + nbttagcompound.setBoolean("OnGround", this.onGround); // CraftBukkit start nbttagcompound.setLong("WorldUUIDLeast", this.world.getUUID().getLeastSignificantBits()); nbttagcompound.setLong("WorldUUIDMost", this.world.getUUID().getMostSignificantBits()); @@ -950,13 +948,13 @@ public abstract class Entity { } public void e(NBTTagCompound nbttagcompound) { - NBTTagList nbttaglist = nbttagcompound.m("Pos"); - NBTTagList nbttaglist1 = nbttagcompound.m("Motion"); - NBTTagList nbttaglist2 = nbttagcompound.m("Rotation"); + NBTTagList nbttaglist = nbttagcompound.getList("Pos"); + NBTTagList nbttaglist1 = nbttagcompound.getList("Motion"); + NBTTagList nbttaglist2 = nbttagcompound.getList("Rotation"); - this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a; - this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a; - this.motZ = ((NBTTagDouble) nbttaglist1.a(2)).a; + this.motX = ((NBTTagDouble) nbttaglist1.get(0)).data; + this.motY = ((NBTTagDouble) nbttaglist1.get(1)).data; + this.motZ = ((NBTTagDouble) nbttaglist1.get(2)).data; /* CraftBukkit start - moved section down if (Math.abs(this.motX) > 10.0D) { this.motX = 0.0D; @@ -971,15 +969,15 @@ public abstract class Entity { } // CraftBukkit end */ - this.lastX = this.bI = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a; - this.lastY = this.bJ = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a; - this.lastZ = this.bK = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a; - this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a; - this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a; - this.fallDistance = nbttagcompound.h("FallDistance"); - this.fireTicks = nbttagcompound.e("Fire"); - this.setAirTicks(nbttagcompound.e("Air")); - this.onGround = nbttagcompound.n("OnGround"); + this.lastX = this.bI = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data; + this.lastY = this.bJ = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data; + this.lastZ = this.bK = this.locZ = ((NBTTagDouble) nbttaglist.get(2)).data; + this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.get(0)).data; + this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.get(1)).data; + this.fallDistance = nbttagcompound.getFloat("FallDistance"); + this.fireTicks = nbttagcompound.getShort("Fire"); + this.setAirTicks(nbttagcompound.getShort("Air")); + this.onGround = nbttagcompound.getBoolean("OnGround"); this.setPosition(this.locX, this.locY, this.locZ); // CraftBukkit start @@ -1050,7 +1048,7 @@ public abstract class Entity { for (int j = 0; j < i; ++j) { double d0 = adouble1[j]; - nbttaglist.a((NBTBase) (new NBTTagDouble((String) null, d0))); + nbttaglist.add(new NBTTagDouble((String) null, d0)); } return nbttaglist; @@ -1064,7 +1062,7 @@ public abstract class Entity { for (int j = 0; j < i; ++j) { float f = afloat1[j]; - nbttaglist.a((NBTBase) (new NBTTagFloat((String) null, f))); + nbttaglist.add(new NBTTagFloat((String) null, f)); } return nbttaglist; @@ -1086,15 +1084,15 @@ public abstract class Entity { return entityitem; } - public boolean aj() { + public boolean isAlive() { return !this.dead; } public boolean T() { for (int i = 0; i < 8; ++i) { - float f = ((float) ((i >> 0) % 2) - 0.5F) * this.length * 0.8F; + float f = ((float) ((i >> 0) % 2) - 0.5F) * this.width * 0.8F; float f1 = ((float) ((i >> 1) % 2) - 0.5F) * 0.1F; - float f2 = ((float) ((i >> 2) % 2) - 0.5F) * this.length * 0.8F; + float f2 = ((float) ((i >> 2) % 2) - 0.5F) * this.width * 0.8F; int j = MathHelper.floor(this.locX + (double) f); int k = MathHelper.floor(this.locY + (double) this.x() + (double) f1); int l = MathHelper.floor(this.locZ + (double) f2); @@ -1180,7 +1178,7 @@ public abstract class Entity { } public double q() { - return (double) this.width * 0.75D; + return (double) this.length * 0.75D; } public void mount(Entity entity) { @@ -1213,7 +1211,7 @@ public abstract class Entity { } // CraftBukkit end - this.setPositionRotation(this.vehicle.locX, this.vehicle.boundingBox.b + (double) this.vehicle.width, this.vehicle.locZ, this.yaw, this.pitch); + this.setPositionRotation(this.vehicle.locX, this.vehicle.boundingBox.b + (double) this.vehicle.length, this.vehicle.locZ, this.yaw, this.pitch); this.vehicle.passenger = null; } @@ -1228,7 +1226,7 @@ public abstract class Entity { this.vehicle.passenger = null; this.vehicle = null; - this.setPositionRotation(entity.locX, entity.boundingBox.b + (double) entity.width, entity.locZ, this.yaw, this.pitch); + this.setPositionRotation(entity.locX, entity.boundingBox.b + (double) entity.length, entity.locZ, this.yaw, this.pitch); } else { if (this.vehicle != null) { this.vehicle.passenger = null; @@ -1303,10 +1301,10 @@ public abstract class Entity { this.datawatcher.watch(1, Short.valueOf((short) i)); } - public void a(EntityWeatherStorm entityweatherstorm) { + public void a(EntityWeatherLighting entityweatherlighting) { // CraftBukkit start final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity(); - final org.bukkit.entity.Entity stormBukkitEntity = entityweatherstorm.getBukkitEntity(); + final org.bukkit.entity.Entity stormBukkitEntity = entityweatherlighting.getBukkitEntity(); final PluginManager pluginManager = Bukkit.getServer().getPluginManager(); if (thisBukkitEntity instanceof Painting) { @@ -1334,7 +1332,7 @@ public abstract class Entity { EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8); pluginManager.callEvent(entityCombustEvent); if (!entityCombustEvent.isCancelled()) { - this.j(entityCombustEvent.getDuration()); + this.setOnFire(entityCombustEvent.getDuration()); } // CraftBukkit end } @@ -1433,7 +1431,7 @@ public abstract class Entity { s = "generic"; } - return StatisticCollector.a("entity." + s + ".name"); + return LocaleI18n.a("entity." + s + ".name"); } public Entity[] aG() { diff --git a/src/main/java/net/minecraft/server/EntityAnimal.java b/src/main/java/net/minecraft/server/EntityAnimal.java deleted file mode 100644 index 49d092b3..00000000 --- a/src/main/java/net/minecraft/server/EntityAnimal.java +++ /dev/null @@ -1,252 +0,0 @@ -package net.minecraft.server; - -import java.util.List; - -public abstract class EntityAnimal extends EntityCreature implements IAnimal { - - private int love; - private int b = 0; - - public EntityAnimal(World world) { - super(world); - } - - protected void b() { - super.b(); - this.datawatcher.a(12, new Integer(0)); - } - - public int getAge() { - return this.datawatcher.getInt(12); - } - - public void setAge(int i) { - this.datawatcher.watch(12, Integer.valueOf(i)); - } - - public void d() { - super.d(); - int i = this.getAge(); - - if (i < 0) { - ++i; - this.setAge(i); - } else if (i > 0) { - --i; - this.setAge(i); - } - - if (this.love > 0) { - --this.love; - String s = "heart"; - - if (this.love % 10 == 0) { - double d0 = this.random.nextGaussian() * 0.02D; - double d1 = this.random.nextGaussian() * 0.02D; - double d2 = this.random.nextGaussian() * 0.02D; - - this.world.a(s, this.locX + (double) (this.random.nextFloat() * this.length * 2.0F) - (double) this.length, this.locY + 0.5D + (double) (this.random.nextFloat() * this.width), this.locZ + (double) (this.random.nextFloat() * this.length * 2.0F) - (double) this.length, d0, d1, d2); - } - } else { - this.b = 0; - } - } - - protected void a(Entity entity, float f) { - if (entity instanceof EntityHuman) { - if (f < 3.0F) { - double d0 = entity.locX - this.locX; - double d1 = entity.locZ - this.locZ; - - this.yaw = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F; - this.e = true; - } - - EntityHuman entityhuman = (EntityHuman) entity; - - if (entityhuman.P() == null || !this.a(entityhuman.P())) { - this.target = null; - } - } else if (entity instanceof EntityAnimal) { - EntityAnimal entityanimal = (EntityAnimal) entity; - - if (this.getAge() > 0 && entityanimal.getAge() < 0) { - if ((double) f < 2.5D) { - this.e = true; - } - } else if (this.love > 0 && entityanimal.love > 0) { - if (entityanimal.target == null) { - entityanimal.target = this; - } - - if (entityanimal.target == this && (double) f < 3.5D) { - ++entityanimal.love; - ++this.love; - ++this.b; - if (this.b % 4 == 0) { - this.world.a("heart", this.locX + (double) (this.random.nextFloat() * this.length * 2.0F) - (double) this.length, this.locY + 0.5D + (double) (this.random.nextFloat() * this.width), this.locZ + (double) (this.random.nextFloat() * this.length * 2.0F) - (double) this.length, 0.0D, 0.0D, 0.0D); - } - - if (this.b == 60) { - this.b((EntityAnimal) entity); - } - } else { - this.b = 0; - } - } else { - this.b = 0; - } - } - } - - private void b(EntityAnimal entityanimal) { - EntityAnimal entityanimal1 = this.createChild(entityanimal); - - if (entityanimal1 != null) { - this.setAge(6000); - entityanimal.setAge(6000); - this.love = 0; - this.b = 0; - this.target = null; - entityanimal.target = null; - entityanimal.b = 0; - entityanimal.love = 0; - entityanimal1.setAge(-24000); - entityanimal1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch); - - for (int i = 0; i < 7; ++i) { - double d0 = this.random.nextGaussian() * 0.02D; - double d1 = this.random.nextGaussian() * 0.02D; - double d2 = this.random.nextGaussian() * 0.02D; - - this.world.a("heart", this.locX + (double) (this.random.nextFloat() * this.length * 2.0F) - (double) this.length, this.locY + 0.5D + (double) (this.random.nextFloat() * this.width), this.locZ + (double) (this.random.nextFloat() * this.length * 2.0F) - (double) this.length, d0, d1, d2); - } - - this.world.addEntity(entityanimal1); - } - } - - protected abstract EntityAnimal createChild(EntityAnimal entityanimal); - - protected void b(Entity entity, float f) {} - - public boolean damageEntity(DamageSource damagesource, int i) { - this.f = 60; - this.target = null; - this.love = 0; - return super.damageEntity(damagesource, i); - } - - protected float a(int i, int j, int k) { - return this.world.getTypeId(i, j - 1, k) == Block.GRASS.id ? 10.0F : this.world.m(i, j, k) - 0.5F; - } - - public void b(NBTTagCompound nbttagcompound) { - super.b(nbttagcompound); - nbttagcompound.a("Age", this.getAge()); - nbttagcompound.a("InLove", this.love); - } - - public void a(NBTTagCompound nbttagcompound) { - super.a(nbttagcompound); - this.setAge(nbttagcompound.f("Age")); - this.love = nbttagcompound.f("InLove"); - } - - protected Entity findTarget() { - if (this.f > 0) { - return null; - } else { - float f = 8.0F; - List list; - int i; - EntityAnimal entityanimal; - - if (this.love > 0) { - list = this.world.a(this.getClass(), this.boundingBox.a((double) f, (double) f, (double) f)); - - for (i = 0; i < list.size(); ++i) { - entityanimal = (EntityAnimal) list.get(i); - if (entityanimal != this && entityanimal.love > 0) { - return entityanimal; - } - } - } else if (this.getAge() == 0) { - list = this.world.a(EntityHuman.class, this.boundingBox.a((double) f, (double) f, (double) f)); - - for (i = 0; i < list.size(); ++i) { - EntityHuman entityhuman = (EntityHuman) list.get(i); - - if (entityhuman.P() != null && this.a(entityhuman.P())) { - return entityhuman; - } - } - } else if (this.getAge() > 0) { - list = this.world.a(this.getClass(), this.boundingBox.a((double) f, (double) f, (double) f)); - - for (i = 0; i < list.size(); ++i) { - entityanimal = (EntityAnimal) list.get(i); - if (entityanimal != this && entityanimal.getAge() < 0) { - return entityanimal; - } - } - } - - return null; - } - } - - public boolean g() { - int i = MathHelper.floor(this.locX); - int j = MathHelper.floor(this.boundingBox.b); - int k = MathHelper.floor(this.locZ); - - return this.world.getTypeId(i, j - 1, k) == Block.GRASS.id && this.world.k(i, j, k) > 8 && super.g(); - } - - public int h() { - return 120; - } - - protected boolean d_() { - return false; - } - - protected int a(EntityHuman entityhuman) { - return 1 + this.world.random.nextInt(3); - } - - protected boolean a(ItemStack itemstack) { - return itemstack.id == Item.WHEAT.id; - } - - public boolean b(EntityHuman entityhuman) { - ItemStack itemstack = entityhuman.inventory.getItemInHand(); - - if (itemstack != null && this.a(itemstack) && this.getAge() == 0) { - --itemstack.count; - if (itemstack.count <= 0) { - entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null); - } - - this.love = 600; - this.target = null; - - for (int i = 0; i < 7; ++i) { - double d0 = this.random.nextGaussian() * 0.02D; - double d1 = this.random.nextGaussian() * 0.02D; - double d2 = this.random.nextGaussian() * 0.02D; - - this.world.a("heart", this.locX + (double) (this.random.nextFloat() * this.length * 2.0F) - (double) this.length, this.locY + 0.5D + (double) (this.random.nextFloat() * this.width), this.locZ + (double) (this.random.nextFloat() * this.length * 2.0F) - (double) this.length, d0, d1, d2); - } - - return true; - } else { - return super.b(entityhuman); - } - } - - public boolean l() { - return this.getAge() < 0; - } -} diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java index 23ad759b..64e71b9d 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -90,7 +90,7 @@ public class EntityArrow extends Entity { int i = this.world.getTypeId(this.e, this.f, this.g); if (i > 0) { - Block.byId[i].a((IBlockAccess) this.world, this.e, this.f, this.g); + Block.byId[i].updateShape(this.world, this.e, this.f, this.g); AxisAlignedBB axisalignedbb = Block.byId[i].e(this.world, this.e, this.f, this.g); if (axisalignedbb != null && axisalignedbb.a(Vec3D.create(this.locX, this.locY, this.locZ))) { @@ -292,25 +292,25 @@ public class EntityArrow extends Entity { } public void b(NBTTagCompound nbttagcompound) { - nbttagcompound.a("xTile", (short) this.e); - nbttagcompound.a("yTile", (short) this.f); - nbttagcompound.a("zTile", (short) this.g); - nbttagcompound.a("inTile", (byte) this.h); - nbttagcompound.a("inData", (byte) this.i); - nbttagcompound.a("shake", (byte) this.shake); - nbttagcompound.a("inGround", (byte) (this.inGround ? 1 : 0)); - nbttagcompound.a("player", this.fromPlayer); + nbttagcompound.setShort("xTile", (short) this.e); + nbttagcompound.setShort("yTile", (short) this.f); + nbttagcompound.setShort("zTile", (short) this.g); + nbttagcompound.setByte("inTile", (byte) this.h); + nbttagcompound.setByte("inData", (byte) this.i); + nbttagcompound.setByte("shake", (byte) this.shake); + nbttagcompound.setByte("inGround", (byte) (this.inGround ? 1 : 0)); + nbttagcompound.setBoolean("player", this.fromPlayer); } public void a(NBTTagCompound nbttagcompound) { - this.e = nbttagcompound.e("xTile"); - this.f = nbttagcompound.e("yTile"); - this.g = nbttagcompound.e("zTile"); - this.h = nbttagcompound.d("inTile") & 255; - this.i = nbttagcompound.d("inData") & 255; - this.shake = nbttagcompound.d("shake") & 255; - this.inGround = nbttagcompound.d("inGround") == 1; - this.fromPlayer = nbttagcompound.n("player"); + this.e = nbttagcompound.getShort("xTile"); + this.f = nbttagcompound.getShort("yTile"); + this.g = nbttagcompound.getShort("zTile"); + this.h = nbttagcompound.getByte("inTile") & 255; + this.i = nbttagcompound.getByte("inData") & 255; + this.shake = nbttagcompound.getByte("shake") & 255; + this.inGround = nbttagcompound.getByte("inGround") == 1; + this.fromPlayer = nbttagcompound.getBoolean("player"); } public void a_(EntityHuman entityhuman) { diff --git a/src/main/java/net/minecraft/server/EntityBlaze.java b/src/main/java/net/minecraft/server/EntityBlaze.java index beb80706..5ea66151 100644 --- a/src/main/java/net/minecraft/server/EntityBlaze.java +++ b/src/main/java/net/minecraft/server/EntityBlaze.java @@ -76,7 +76,7 @@ public class EntityBlaze extends EntityMonster { } for (int i = 0; i < 2; ++i) { - this.world.a("largesmoke", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.length, this.locY + this.random.nextDouble() * (double) this.width, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.length, 0.0D, 0.0D, 0.0D); + this.world.a("largesmoke", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, 0.0D, 0.0D, 0.0D); } super.d(); @@ -88,7 +88,7 @@ public class EntityBlaze extends EntityMonster { this.d(entity); } else if (f < 30.0F) { double d0 = entity.locX - this.locX; - double d1 = entity.boundingBox.b + (double) (entity.width / 2.0F) - (this.locY + (double) (this.width / 2.0F)); + double d1 = entity.boundingBox.b + (double) (entity.length / 2.0F) - (this.locY + (double) (this.length / 2.0F)); double d2 = entity.locZ - this.locZ; if (this.attackTicks == 0) { @@ -112,7 +112,7 @@ public class EntityBlaze extends EntityMonster { for (int i = 0; i < 1; ++i) { EntitySmallFireball entitysmallfireball = new EntitySmallFireball(this.world, this, d0 + this.random.nextGaussian() * (double) f1, d1, d2 + this.random.nextGaussian() * (double) f1); - entitysmallfireball.locY = this.locY + (double) (this.width / 2.0F) + 0.5D; + entitysmallfireball.locY = this.locY + (double) (this.length / 2.0F) + 0.5D; this.world.addEntity(entitysmallfireball); } } @@ -141,7 +141,7 @@ public class EntityBlaze extends EntityMonster { return this.A(); } - protected void a(boolean flag, int i) { + protected void dropDeathLoot(boolean flag, int i) { if (flag) { // CraftBukkit start List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java index 9bdbae6b..f3666af9 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java @@ -48,7 +48,7 @@ public class EntityBoat extends Entity { super(world); this.bc = true; this.b(1.5F, 0.6F); - this.height = this.width / 2.0F; + this.height = this.length / 2.0F; } protected boolean g_() { @@ -87,7 +87,7 @@ public class EntityBoat extends Entity { } public double q() { - return (double) this.width * 0.0D - 0.30000001192092896D; + return (double) this.length * 0.0D - 0.30000001192092896D; } public boolean damageEntity(DamageSource damagesource, int i) { diff --git a/src/main/java/net/minecraft/server/EntityChicken.java b/src/main/java/net/minecraft/server/EntityChicken.java index 11bd89f6..9b67a5cf 100644 --- a/src/main/java/net/minecraft/server/EntityChicken.java +++ b/src/main/java/net/minecraft/server/EntityChicken.java @@ -82,7 +82,7 @@ public class EntityChicken extends EntityAnimal { return Item.FEATHER.id; } - protected void a(boolean flag, int i) { + 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.random.nextInt(3) + this.random.nextInt(1 + i); diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java index 1e3cb075..ecbf4fd5 100644 --- a/src/main/java/net/minecraft/server/EntityCow.java +++ b/src/main/java/net/minecraft/server/EntityCow.java @@ -49,7 +49,7 @@ public class EntityCow extends EntityAnimal { return Item.LEATHER.id; } - protected void a(boolean flag, int i) { + 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.random.nextInt(3) + this.random.nextInt(1 + i); diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java index 1df836fe..84bf92f4 100644 --- a/src/main/java/net/minecraft/server/EntityCreature.java +++ b/src/main/java/net/minecraft/server/EntityCreature.java @@ -50,7 +50,7 @@ public abstract class EntityCreature extends EntityLiving { if (this.target != null) { this.pathEntity = this.world.findPath(this, this.target, f); } - } else if (!this.target.aj()) { + } else if (!this.target.isAlive()) { // CraftBukkit start EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED); this.world.getServer().getPluginManager().callEvent(event); @@ -88,7 +88,7 @@ public abstract class EntityCreature extends EntityLiving { if (this.pathEntity != null && this.random.nextInt(100) != 0) { // MethodProfiler.a("followpath"); // CraftBukkit -- not in production code Vec3D vec3d = this.pathEntity.a(this); - double d0 = (double) (this.length * 2.0F); + double d0 = (double) (this.width * 2.0F); while (vec3d != null && vec3d.d(this.locX, vec3d.b, this.locZ) < d0 * d0) { this.pathEntity.a(); diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java index 94ed2f4a..454c9053 100644 --- a/src/main/java/net/minecraft/server/EntityCreeper.java +++ b/src/main/java/net/minecraft/server/EntityCreeper.java @@ -29,13 +29,13 @@ public class EntityCreeper extends EntityMonster { public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); if (this.datawatcher.getByte(17) == 1) { - nbttagcompound.a("powered", true); + nbttagcompound.setBoolean("powered", true); } } public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - this.datawatcher.watch(17, Byte.valueOf((byte) (nbttagcompound.n("powered") ? 1 : 0))); + this.datawatcher.watch(17, Byte.valueOf((byte) (nbttagcompound.getBoolean("powered") ? 1 : 0))); } protected void b(Entity entity, float f) { @@ -148,11 +148,11 @@ public class EntityCreeper extends EntityMonster { this.datawatcher.watch(16, Byte.valueOf((byte) i)); } - public void a(EntityWeatherStorm entityweatherstorm) { - super.a(entityweatherstorm); + public void a(EntityWeatherLighting entityweatherlighting) { + super.a(entityweatherlighting); // CraftBukkit start - CreeperPowerEvent event = new CreeperPowerEvent(this.getBukkitEntity(), entityweatherstorm.getBukkitEntity(), CreeperPowerEvent.PowerCause.LIGHTNING); + CreeperPowerEvent event = new CreeperPowerEvent(this.getBukkitEntity(), entityweatherlighting.getBukkitEntity(), CreeperPowerEvent.PowerCause.LIGHTNING); this.world.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { diff --git a/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java b/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java index 5855df98..38daa5f6 100644 --- a/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java +++ b/src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java @@ -16,7 +16,7 @@ public class EntityDamageSourceIndirect extends EntityDamageSource { public String a(EntityHuman entityhuman) { // CraftBukkit start String source = (this.n == null) ? "Herobrine" : this.n.ad(); - return StatisticCollector.a("death." + this.m, new Object[] { entityhuman.name, source}); + return LocaleI18n.a("death." + this.m, new Object[] { entityhuman.name, source}); // CraftBukkit end } }
\ No newline at end of file diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java index 3362f41e..a3d3da62 100644 --- a/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java @@ -37,18 +37,18 @@ public class EntityEnderman extends EntityMonster { public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - nbttagcompound.a("carried", (short) this.getCarriedId()); - nbttagcompound.a("carriedData", (short) this.getCarriedData()); + nbttagcompound.setShort("carried", (short) this.getCarriedId()); + nbttagcompound.setShort("carriedData", (short) this.getCarriedData()); } public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - this.setCarriedId(nbttagcompound.e("carried")); - this.setCarriedData(nbttagcompound.e("carriedData")); + this.setCarriedId(nbttagcompound.getShort("carried")); + this.setCarriedData(nbttagcompound.getShort("carriedData")); } protected Entity findTarget() { - EntityHuman entityhuman = this.world.b(this, 64.0D); + EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 64.0D); if (entityhuman != null) { if (this.c(entityhuman)) { @@ -75,7 +75,7 @@ public class EntityEnderman extends EntityMonster { return false; } else { Vec3D vec3d = entityhuman.d(1.0F).b(); - Vec3D vec3d1 = Vec3D.create(this.locX - entityhuman.locX, this.boundingBox.b + (double) (this.width / 2.0F) - (entityhuman.locY + (double) entityhuman.x()), this.locZ - entityhuman.locZ); + Vec3D vec3d1 = Vec3D.create(this.locX - entityhuman.locX, this.boundingBox.b + (double) (this.length / 2.0F) - (entityhuman.locY + (double) entityhuman.x()), this.locZ - entityhuman.locZ); double d0 = vec3d1.c(); vec3d1 = vec3d1.b(); @@ -138,7 +138,7 @@ public class EntityEnderman extends EntityMonster { } for (i = 0; i < 2; ++i) { - this.world.a("portal", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.length, this.locY + this.random.nextDouble() * (double) this.width - 0.25D, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.length, (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D); + this.world.a("portal", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length - 0.25D, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D); } if (this.world.e() && !this.world.isStatic) { @@ -160,7 +160,7 @@ public class EntityEnderman extends EntityMonster { this.a(this.target, 100.0F, 100.0F); } - if (!this.world.isStatic && this.aj()) { + if (!this.world.isStatic && this.isAlive()) { if (this.target != null) { if (this.target instanceof EntityHuman && this.c((EntityHuman) this.target)) { this.aT = this.aU = 0.0F; @@ -190,7 +190,7 @@ public class EntityEnderman extends EntityMonster { } protected boolean f(Entity entity) { - Vec3D vec3d = Vec3D.create(this.locX - entity.locX, this.boundingBox.b + (double) (this.width / 2.0F) - entity.locY + (double) entity.x(), this.locZ - entity.locZ); + Vec3D vec3d = Vec3D.create(this.locX - entity.locX, this.boundingBox.b + (double) (this.length / 2.0F) - entity.locY + (double) entity.x(), this.locZ - entity.locZ); vec3d = vec3d.b(); double d0 = 16.0D; @@ -247,9 +247,9 @@ public class EntityEnderman extends EntityMonster { float f = (this.random.nextFloat() - 0.5F) * 0.2F; float f1 = (this.random.nextFloat() - 0.5F) * 0.2F; float f2 = (this.random.nextFloat() - 0.5F) * 0.2F; - double d7 = d3 + (this.locX - d3) * d6 + (this.random.nextDouble() - 0.5D) * (double) this.length * 2.0D; - double d8 = d4 + (this.locY - d4) * d6 + this.random.nextDouble() * (double) this.width; - double d9 = d5 + (this.locZ - d5) * d6 + (this.random.nextDouble() - 0.5D) * (double) this.length * 2.0D; + double d7 = d3 + (this.locX - d3) * d6 + (this.random.nextDouble() - 0.5D) * (double) this.width * 2.0D; + double d8 = d4 + (this.locY - d4) * d6 + this.random.nextDouble() * (double) this.length; + double d9 = d5 + (this.locZ - d5) * d6 + (this.random.nextDouble() - 0.5D) * (double) this.width * 2.0D; this.world.a("portal", d7, d8, d9, (double) f, (double) f1, (double) f2); } @@ -276,7 +276,7 @@ public class EntityEnderman extends EntityMonster { return Item.ENDER_PEARL.id; } - protected void a(boolean flag, int i) { + protected void dropDeathLoot(boolean flag, int i) { int j = this.e(); if (j > 0) { diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java index b8c0a9ae..c0bb764d 100644 --- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java +++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java @@ -11,7 +11,7 @@ public class EntityExperienceOrb extends Entity { public EntityExperienceOrb(World world, double d0, double d1, double d2, int i) { super(world); this.b(0.5F, 0.5F); - this.height = this.width / 2.0F; + this.height = this.length / 2.0F; this.setPosition(d0, d1, d2); this.yaw = (float) (Math.random() * 360.0D); this.motX = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F); @@ -27,7 +27,7 @@ public class EntityExperienceOrb extends Entity { public EntityExperienceOrb(World world) { super(world); this.b(0.25F, 0.25F); - this.height = this.width / 2.0F; + this.height = this.length / 2.0F; } protected void b() {} @@ -113,15 +113,15 @@ public class EntityExperienceOrb extends Entity { } public void b(NBTTagCompound nbttagcompound) { - nbttagcompound.a("Health", (short) ((byte) this.d)); - nbttagcompound.a("Age", (short) this.b); - nbttagcompound.a("Value", (short) this.value); + nbttagcompound.setShort("Health", (short) ((byte) this.d)); + nbttagcompound.setShort("Age", (short) this.b); + nbttagcompound.setShort("Value", (short) this.value); } public void a(NBTTagCompound nbttagcompound) { - this.d = nbttagcompound.e("Health") & 255; - this.b = nbttagcompound.e("Age"); - this.value = nbttagcompound.e("Value"); + this.d = nbttagcompound.getShort("Health") & 255; + this.b = nbttagcompound.getShort("Age"); + this.value = nbttagcompound.getShort("Value"); } public void a_(EntityHuman entityhuman) { @@ -130,7 +130,7 @@ public class EntityExperienceOrb extends Entity { entityhuman.x = 2; this.world.makeSound(this, "random.orb", 0.1F, 0.5F * ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.8F)); entityhuman.receive(this, 1); - entityhuman.h(this.value); + entityhuman.giveExp(this.value); this.die(); } } diff --git a/src/main/java/net/minecraft/server/EntityFallingSand.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java index 2546f1e6..b95d61ac 100644 --- a/src/main/java/net/minecraft/server/EntityFallingSand.java +++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java @@ -1,23 +1,23 @@ package net.minecraft.server; -public class EntityFallingSand extends Entity { +public class EntityFallingBlock extends Entity { public int a; public int data; // CraftBukkit public int b = 0; - public EntityFallingSand(World world) { + public EntityFallingBlock(World world) { super(world); } // CraftBukkit -- changed method signature - public EntityFallingSand(World world, double d0, double d1, double d2, int i, int data) { + public EntityFallingBlock(World world, double d0, double d1, double d2, int i, int data) { super(world); this.a = i; this.bc = true; this.data = data; // CraftBukkit this.b(0.98F, 0.98F); - this.height = this.width / 2.0F; + this.height = this.length / 2.0F; this.setPosition(d0, d1, d2); this.motX = 0.0D; this.motY = 0.0D; @@ -79,12 +79,12 @@ public class EntityFallingSand extends Entity { } protected void b(NBTTagCompound nbttagcompound) { - nbttagcompound.a("Tile", (byte) this.a); - nbttagcompound.a("Data", (byte) this.data); // CraftBukkit + nbttagcompound.setByte("Tile", (byte) this.a); + nbttagcompound.setByte("Data", (byte) this.data); // CraftBukkit } protected void a(NBTTagCompound nbttagcompound) { - this.a = nbttagcompound.d("Tile") & 255; - this.data = nbttagcompound.d("Data") & 15; // CraftBukkit + this.a = nbttagcompound.getByte("Tile") & 255; + this.data = nbttagcompound.getByte("Data") & 15; // CraftBukkit } } diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java index 481c9af7..6b1e9145 100644 --- a/src/main/java/net/minecraft/server/EntityFireball.java +++ b/src/main/java/net/minecraft/server/EntityFireball.java @@ -62,7 +62,7 @@ public class EntityFireball extends Entity { public void w_() { super.w_(); - this.j(1); + this.setOnFire(1); if (!this.world.isStatic && (this.shooter == null || this.shooter.dead)) { this.die(); } @@ -224,19 +224,19 @@ public class EntityFireball extends Entity { } public void b(NBTTagCompound nbttagcompound) { - nbttagcompound.a("xTile", (short) this.e); - nbttagcompound.a("yTile", (short) this.f); - nbttagcompound.a("zTile", (short) this.g); - nbttagcompound.a("inTile", (byte) this.h); - nbttagcompound.a("inGround", (byte) (this.i ? 1 : 0)); + nbttagcompound.setShort("xTile", (short) this.e); + nbttagcompound.setShort("yTile", (short) this.f); + nbttagcompound.setShort("zTile", (short) this.g); + nbttagcompound.setByte("inTile", (byte) this.h); + nbttagcompound.setByte("inGround", (byte) (this.i ? 1 : 0)); } public void a(NBTTagCompound nbttagcompound) { - this.e = nbttagcompound.e("xTile"); - this.f = nbttagcompound.e("yTile"); - this.g = nbttagcompound.e("zTile"); - this.h = nbttagcompound.d("inTile") & 255; - this.i = nbttagcompound.d("inGround") == 1; + this.e = nbttagcompound.getShort("xTile"); + this.f = nbttagcompound.getShort("yTile"); + this.g = nbttagcompound.getShort("zTile"); + this.h = nbttagcompound.getByte("inTile") & 255; + this.i = nbttagcompound.getByte("inGround") == 1; } public boolean e_() { diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java index 18467068..5a48641c 100644 --- a/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java @@ -105,7 +105,7 @@ public class EntityFishingHook extends Entity { if (!this.world.isStatic) { ItemStack itemstack = this.owner.P(); - if (this.owner.dead || !this.owner.aj() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.i(this.owner) > 1024.0D) { + if (this.owner.dead || !this.owner.isAlive() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.i(this.owner) > 1024.0D) { this.die(); this.owner.hookedFish = null; return; @@ -114,7 +114,7 @@ public class EntityFishingHook extends Entity { if (this.c != null) { if (!this.c.dead) { this.locX = this.c.locX; - this.locY = this.c.boundingBox.b + (double) this.c.width * 0.8D; + this.locY = this.c.boundingBox.b + (double) this.c.length * 0.8D; this.locZ = this.c.locZ; return; } @@ -279,15 +279,15 @@ public class EntityFishingHook extends Entity { int l; float f5; - for (l = 0; (float) l < 1.0F + this.length * 20.0F; ++l) { - f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; - f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + for (l = 0; (float) l < 1.0F + this.width * 20.0F; ++l) { + f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width; + f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width; this.world.a("bubble", this.locX + (double) f5, (double) (f3 + 1.0F), this.locZ + (double) f4, this.motX, this.motY - (double) (this.random.nextFloat() * 0.2F), this.motZ); } - for (l = 0; (float) l < 1.0F + this.length * 20.0F; ++l) { - f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; - f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; + for (l = 0; (float) l < 1.0F + this.width * 20.0F; ++l) { + f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width; + f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width; this.world.a("splash", this.locX + (double) f5, (double) (f3 + 1.0F), this.locZ + (double) f4, this.motX, this.motY, this.motZ); } } @@ -314,21 +314,21 @@ public class EntityFishingHook extends Entity { } public void b(NBTTagCompound nbttagcompound) { - nbttagcompound.a("xTile", (short) this.d); - nbttagcompound.a("yTile", (short) this.e); - nbttagcompound.a("zTile", (short) this.f); - nbttagcompound.a("inTile", (byte) this.g); - nbttagcompound.a("shake", (byte) this.a); - nbttagcompound.a("inGround", (byte) (this.h ? 1 : 0)); + nbttagcompound.setShort("xTile", (short) this.d); + nbttagcompound.setShort("yTile", (short) this.e); + nbttagcompound.setShort("zTile", (short) this.f); + nbttagcompound.setByte("inTile", (byte) this.g); + nbttagcompound.setByte("shake", (byte) this.a); + nbttagcompound.setByte("inGround", (byte) (this.h ? 1 : 0)); } public void a(NBTTagCompound nbttagcompound) { - this.d = nbttagcompound.e("xTile"); - this.e = nbttagcompound.e("yTile"); - this.f = nbttagcompound.e("zTile"); - this.g = nbttagcompound.d("inTile") & 255; - this.a = nbttagcompound.d("shake") & 255; - this.h = nbttagcompound.d("inGround") == 1; + this.d = nbttagcompound.getShort("xTile"); + this.e = nbttagcompound.getShort("yTile"); + this.f = nbttagcompound.getShort("zTile"); + this.g = nbttagcompound.getByte("inTile") & 255; + this.a = nbttagcompound.getByte("shake") & 255; + this.h = nbttagcompound.getByte("inGround") == 1; } public int j() { diff --git a/src/main/java/net/minecraft/server/EntityGhast.java b/src/main/java/net/minecraft/server/EntityGhast.java index 9cead916..119b9c87 100644 --- a/src/main/java/net/minecraft/server/EntityGhast.java +++ b/src/main/java/net/minecraft/server/EntityGhast.java @@ -101,7 +101,7 @@ public class EntityGhast extends EntityFlying implements IMonster { if (this.target == null || this.h-- <= 0) { // CraftBukkit start - Entity target = this.world.b(this, 100.0D); + Entity target = this.world.findNearbyVulnerablePlayer(this, 100.0D); if (target != null) { EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER); this.world.getServer().getPluginManager().callEvent(event); @@ -124,7 +124,7 @@ public class EntityGhast extends EntityFlying implements IMonster { if (this.target != null && this.target.i(this) < d4 * d4) { double d5 = this.target.locX - this.locX; - double d6 = this.target.boundingBox.b + (double) (this.target.width / 2.0F) - (this.locY + (double) (this.width / 2.0F)); + 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.V = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F; @@ -141,7 +141,7 @@ public class EntityGhast extends EntityFlying implements IMonster { Vec3D vec3d = this.d(1.0F); entityfireball.locX = this.locX + vec3d.a * d8; - entityfireball.locY = this.locY + (double) (this.width / 2.0F) + 0.5D; + entityfireball.locY = this.locY + (double) (this.length / 2.0F) + 0.5D; entityfireball.locZ = this.locZ + vec3d.c * d8; this.world.addEntity(entityfireball); this.f = -40; @@ -198,7 +198,7 @@ public class EntityGhast extends EntityFlying implements IMonster { return Item.SULPHUR.id; } - protected void a(boolean flag, int i) { + protected void dropDeathLoot(boolean flag, int i) { // CraftBukkit start List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); int j = this.random.nextInt(2) + this.random.nextInt(1 + i); diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index 4c127148..3a8b7f8f 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -20,7 +20,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; public abstract class EntityHuman extends EntityLiving { - public InventoryPlayer inventory = new InventoryPlayer(this); + public PlayerInventory inventory = new PlayerInventory(this); public Container defaultContainer; public Container activeContainer; protected FoodMetaData foodData = new FoodMetaData(); @@ -56,9 +56,9 @@ public abstract class EntityHuman extends EntityLiving { protected boolean J = false; public float K; public PlayerAbilities abilities = new PlayerAbilities(); + public int expLevel; public int expTotal; - public int exp; - public float expLevel; + public float exp; private ItemStack d; private int e; protected float P = 0.1F; @@ -167,7 +167,7 @@ public abstract class EntityHuman extends EntityLiving { } if (this.z() && this.abilities.isInvulnerable) { - this.aw(); + this.extinguish(); } this.y = this.B; @@ -382,7 +382,7 @@ public abstract class EntityHuman extends EntityLiving { } protected int f(int i) { - int j = EnchantmentManager.a(this.inventory); + int j = EnchantmentManager.getOxygenEnchantmentLevel(this.inventory); return j > 0 && this.random.nextInt(j + 1) > 0 ? i : super.f(i); } @@ -448,7 +448,7 @@ public abstract class EntityHuman extends EntityLiving { public float a(Block block) { float f = this.inventory.a(block); float f1 = f; - int i = EnchantmentManager.b(this.inventory); + int i = EnchantmentManager.getDigSpeedEnchantmentLevel(this.inventory); if (i > 0 && this.inventory.b(block)) { f1 = f + (float) (i * i + 1); @@ -462,7 +462,7 @@ public abstract class EntityHuman extends EntityLiving { f1 *= 1.0F - (float) (this.getEffect(MobEffectList.SLOWER_DIG).getAmplifier() + 1) * 0.2F; } - if (this.a(Material.WATER) && !EnchantmentManager.g(this.inventory)) { + if (this.a(Material.WATER) && !EnchantmentManager.hasWaterWorkerEnchantment(this.inventory)) { f1 /= 5.0F; } @@ -479,15 +479,15 @@ public abstract class EntityHuman extends EntityLiving { public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - NBTTagList nbttaglist = nbttagcompound.m("Inventory"); + NBTTagList nbttaglist = nbttagcompound.getList("Inventory"); this.inventory.b(nbttaglist); - this.dimension = nbttagcompound.f("Dimension"); - this.sleeping = nbttagcompound.n("Sleeping"); - this.sleepTicks = nbttagcompound.e("SleepTimer"); - this.expLevel = nbttagcompound.h("XpP"); - this.expTotal = nbttagcompound.f("XpLevel"); - this.exp = nbttagcompound.f("XpTotal"); + this.dimension = nbttagcompound.getInt("Dimension"); + this.sleeping = nbttagcompound.getBoolean("Sleeping"); + this.sleepTicks = nbttagcompound.getShort("SleepTimer"); + this.exp = nbttagcompound.getFloat("XpP"); + this.expLevel = nbttagcompound.getInt("XpLevel"); + this.expTotal = nbttagcompound.getInt("XpTotal"); if (this.sleeping) { this.F = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); this.a(true, true, false); @@ -501,7 +501,7 @@ public abstract class EntityHuman extends EntityLiving { // CraftBukkit end if (nbttagcompound.hasKey("SpawnX") && nbttagcompound.hasKey("SpawnY") && nbttagcompound.hasKey("SpawnZ")) { - this.b = new ChunkCoordinates(nbttagcompound.f("SpawnX"), nbttagcompound.f("SpawnY"), nbttagcompound.f("SpawnZ")); + this.b = new ChunkCoordinates(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ")); } this.foodData.a(nbttagcompound); @@ -510,17 +510,17 @@ public abstract class EntityHuman extends EntityLiving { public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - nbttagcompound.a("Inventory", (NBTBase) this.inventory.a(new NBTTagList())); - nbttagcompound.a("Dimension", this.dimension); - nbttagcompound.a("Sleeping", this.sleeping); - nbttagcompound.a("SleepTimer", (short) this.sleepTicks); - nbttagcompound.a("XpP", this.expLevel); - nbttagcompound.a("XpLevel", this.expTotal); - nbttagcompound.a("XpTotal", this.exp); + nbttagcompound.set("Inventory", this.inventory.a(new NBTTagList())); + nbttagcompound.setInt("Dimension", this.dimension); + nbttagcompound.setBoolean("Sleeping", this.sleeping); + nbttagcompound.setShort("SleepTimer", (short) this.sleepTicks); + nbttagcompound.setFloat("XpP", this.exp); + nbttagcompound.setInt("XpLevel", this.expLevel); + nbttagcompound.setInt("XpTotal", this.expTotal); if (this.b != null) { - nbttagcompound.a("SpawnX", this.b.x); - nbttagcompound.a("SpawnY", this.b.y); - nbttagcompound.a("SpawnZ", this.b.z); + nbttagcompound.setInt("SpawnX", this.b.x); + nbttagcompound.setInt("SpawnY", this.b.y); + nbttagcompound.setInt("SpawnZ", this.b.z); nbttagcompound.setString("SpawnWorld", spawnWorld); // CraftBukkit - fixes bed spawns for multiworld worlds } @@ -759,7 +759,7 @@ public abstract class EntityHuman extends EntityLiving { if (entity instanceof EntityLiving) { k = EnchantmentManager.a(this.inventory, (EntityLiving) entity); - j += EnchantmentManager.b(this.inventory, (EntityLiving) entity); + j += EnchantmentManager.getKnockbackEnchantmentLevel(this.inventory, (EntityLiving) entity); } if (this.isSprinting()) { @@ -831,18 +831,18 @@ public abstract class EntityHuman extends EntityLiving { } if (entity instanceof EntityLiving) { - if (entity.aj()) { + if (entity.isAlive()) { this.a((EntityLiving) entity, true); } this.a(StatisticList.w, i); - int l = EnchantmentManager.c(this.inventory, (EntityLiving) entity); + int l = EnchantmentManager.getFireAspectEnchantmentLevel(this.inventory, (EntityLiving) entity); if (l > 0) { // CraftBukkit start - raise a combust event when somebody hits with a fire enchanted item EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), l*4); if (!combustEvent.isCancelled()) { - entity.j(combustEvent.getDuration()); + entity.setOnFire(combustEvent.getDuration()); } // CraftBukkit end } @@ -870,22 +870,22 @@ public abstract class EntityHuman extends EntityLiving { return !this.sleeping && super.T(); } - public EnumBedError a(int i, int j, int k) { + public EnumBedResult a(int i, int j, int k) { if (!this.world.isStatic) { - if (this.isSleeping() || !this.aj()) { - return EnumBedError.OTHER_PROBLEM; + if (this.isSleeping() || !this.isAlive()) { + return EnumBedResult.OTHER_PROBLEM; } if (this.world.worldProvider.c) { - return EnumBedError.NOT_POSSIBLE_HERE; + return EnumBedResult.NOT_POSSIBLE_HERE; } if (this.world.e()) { - return EnumBedError.NOT_POSSIBLE_NOW; + return EnumBedResult.NOT_POSSIBLE_NOW; } if (Math.abs(this.locX - (double) i) > 3.0D || Math.abs(this.locY - (double) j) > 2.0D || Math.abs(this.locZ - (double) k) > 3.0D) { - return EnumBedError.TOO_FAR_AWAY; + return EnumBedResult.TOO_FAR_AWAY; } double d0 = 8.0D; @@ -893,7 +893,7 @@ public abstract class EntityHuman extends EntityLiving { List list = this.world.a(EntityMonster.class, AxisAlignedBB.b((double) i - d0, (double) j - d1, (double) k - d0, (double) i + d0, (double) j + d1, (double) k + d0)); if (!list.isEmpty()) { - return EnumBedError.NOT_SAFE; + return EnumBedResult.NOT_SAFE; } } @@ -906,7 +906,7 @@ public abstract class EntityHuman extends EntityLiving { this.world.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { - return EnumBedError.OTHER_PROBLEM; + return EnumBedResult.OTHER_PROBLEM; } } // CraftBukkit end @@ -950,7 +950,7 @@ public abstract class EntityHuman extends EntityLiving { this.world.everyoneSleeping(); } - return EnumBedError.OK; + return EnumBedResult.OK; } private void c(int i) { @@ -1187,30 +1187,30 @@ public abstract class EntityHuman extends EntityLiving { } } - public void h(int i) { + public void giveExp(int i) { this.q += i; - this.expLevel += (float) i / (float) this.Z(); - this.exp += i; + this.exp += (float) i / (float) this.getExpTolevel(); + this.expTotal += i; - while (this.expLevel >= 1.0F) { - --this.expLevel; - this.D(); + while (this.exp >= 1.0F) { + --this.exp; + this.levelUp(); } } - public void b(int i) { - this.expTotal -= i; - if (this.expTotal < 0) { - this.expTotal = 0; + public void levelDown(int i) { + this.expLevel -= i; + if (this.expLevel < 0) { + this.expLevel = 0; } } - public int Z() { - return 7 + (this.expTotal * 7 >> 1); + public int getExpTolevel() { + return 7 + (this.expLevel * 7 >> 1); } - private void D() { - ++this.expTotal; + private void levelUp() { + ++this.expLevel; } public void c(float f) { @@ -1248,7 +1248,7 @@ public abstract class EntityHuman extends EntityLiving { } protected int a(EntityHuman entityhuman) { - int i = this.expTotal * 7; + int i = this.expLevel * 7; return i > 100 ? 100 : i; } @@ -1267,9 +1267,9 @@ public abstract class EntityHuman extends EntityLiving { this.inventory.a(entityhuman.inventory); this.health = entityhuman.health; this.foodData = entityhuman.foodData; + this.expLevel = entityhuman.expLevel; this.expTotal = entityhuman.expTotal; this.exp = entityhuman.exp; - this.expLevel = entityhuman.expLevel; this.q = entityhuman.q; } } diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java index 7f82da61..5dd87b07 100644 --- a/src/main/java/net/minecraft/server/EntityItem.java +++ b/src/main/java/net/minecraft/server/EntityItem.java @@ -15,7 +15,7 @@ public class EntityItem extends Entity { public EntityItem(World world, double d0, double d1, double d2, ItemStack itemstack) { super(world); this.b(0.25F, 0.25F); - this.height = this.width / 2.0F; + this.height = this.length / 2.0F; this.setPosition(d0, d1, d2); this.itemStack = itemstack; // CraftBukkit start - infinite item fix @@ -36,7 +36,7 @@ public class EntityItem extends Entity { public EntityItem(World world) { super(world); this.b(0.25F, 0.25F); - this.height = this.width / 2.0F; + this.height = this.length / 2.0F; } protected void b() {} @@ -106,15 +106,15 @@ public class EntityItem extends Entity { } public void b(NBTTagCompound nbttagcompound) { - nbttagcompound.a("Health", (short) ((byte) this.f)); - nbttagcompound.a("Age", (short) this.b); - nbttagcompound.a("Item", this.itemStack.b(new NBTTagCompound())); + nbttagcompound.setShort("Health", (short) ((byte) this.f)); + nbttagcompound.setShort("Age", (short) this.b); + nbttagcompound.setCompound("Item", this.itemStack.b(new NBTTagCompound())); } public void a(NBTTagCompound nbttagcompound) { - this.f = nbttagcompound.e("Health") & 255; - this.b = nbttagcompound.e("Age"); - NBTTagCompound nbttagcompound1 = nbttagcompound.l("Item"); + this.f = nbttagcompound.getShort("Health") & 255; + this.b = nbttagcompound.getShort("Age"); + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Item"); this.itemStack = ItemStack.a(nbttagcompound1); if (this.itemStack == null) { @@ -171,6 +171,6 @@ public class EntityItem extends Entity { } public String ad() { - return StatisticCollector.a("item." + this.itemStack.k()); + return LocaleI18n.a("item." + this.itemStack.k()); } } diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index 2fd280b1..3f06cd56 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -82,6 +82,7 @@ public abstract class EntityLiving extends Entity { private Entity e; protected int aZ = 0; public int expToDrop = 0; // CraftBukkit added + public int maxAirTicks = 300; // CraftBukkit added public EntityLiving(World world) { super(world); @@ -110,7 +111,7 @@ public abstract class EntityLiving extends Entity { } public float x() { - return this.width * 0.85F; + return this.length * 0.85F; } public int h() { @@ -135,7 +136,7 @@ public abstract class EntityLiving extends Entity { } // CraftBukkit start - don't inline the damage, perform it with an event - if (this.aj() && this.T()) { + if (this.isAlive() && this.T()) { EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.SUFFOCATION, 1); this.world.getServer().getPluginManager().callEvent(event); @@ -145,11 +146,11 @@ public abstract class EntityLiving extends Entity { // CraftBukkit end } - if (this.ax() || this.world.isStatic) { - this.aw(); + if (this.isFireproof() || this.world.isStatic) { + this.extinguish(); } - if (this.aj() && this.a(Material.WATER) && !this.f() && !this.effects.containsKey(Integer.valueOf(MobEffectList.WATER_BREATHING.id))) { + if (this.isAlive() && this.a(Material.WATER) && !this.f() && !this.effects.containsKey(Integer.valueOf(MobEffectList.WATER_BREATHING.id))) { this.setAirTicks(this.f(this.getAirTicks())); if (this.getAirTicks() == -20) { this.setAirTicks(0); @@ -172,9 +173,9 @@ public abstract class EntityLiving extends Entity { // CraftBukkit end } - this.aw(); + this.extinguish(); } else { - this.setAirTicks(300); + this.setAirTicks(maxAirTicks); // CraftBukkit - update maxAirTicks if no longer 300 } this.aw = this.ax; @@ -243,7 +244,7 @@ public abstract class EntityLiving extends Entity { double d1 = this.random.nextGaussian() * 0.02D; double d2 = this.random.nextGaussian() * 0.02D; - this.world.a("explode", this.locX + (double) (this.random.nextFloat() * this.length * 2.0F) - (double) this.length, this.locY + (double) (this.random.nextFloat() * this.width), this.locZ + (double) (this.random.nextFloat() * this.length * 2.0F) - (double) this.length, d0, d1, d2); + this.world.a("explode", this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, d0, d1, d2); } } } @@ -267,7 +268,7 @@ public abstract class EntityLiving extends Entity { double d2 = this.random.nextGaussian() * 0.02D; double d3 = 10.0D; - this.world.a("explode", this.locX + (double) (this.random.nextFloat() * this.length * 2.0F) - (double) this.length - d0 * d3, this.locY + (double) (this.random.nextFloat() * this.width) - d1 * d3, this.locZ + (double) (this.random.nextFloat() * this.length * 2.0F) - (double) this.length - d2 * d3, d0, d1, d2); + this.world.a("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); } } @@ -596,18 +597,18 @@ public abstract class EntityLiving extends Entity { int i = 0; if (entity instanceof EntityHuman) { - i = EnchantmentManager.f(((EntityHuman) entity).inventory); + i = EnchantmentManager.getBonusMonsterLootEnchantmentLevel(((EntityHuman) entity).inventory); } if (!this.l()) { - this.a(this.aG > 0, i); + this.dropDeathLoot(this.aG > 0, i); } } this.world.a(this, (byte) 3); } - protected void a(boolean flag, int i) { + protected void dropDeathLoot(boolean flag, int i) { int j = this.e(); // CraftBukkit start - whole method @@ -778,10 +779,10 @@ public abstract class EntityLiving extends Entity { } public void b(NBTTagCompound nbttagcompound) { - nbttagcompound.a("Health", (short) this.health); - nbttagcompound.a("HurtTime", (short) this.hurtTicks); - nbttagcompound.a("DeathTime", (short) this.deathTicks); - nbttagcompound.a("AttackTime", (short) this.attackTicks); + nbttagcompound.setShort("Health", (short) this.health); + nbttagcompound.setShort("HurtTime", (short) this.hurtTicks); + nbttagcompound.setShort("DeathTime", (short) this.deathTicks); + nbttagcompound.setShort("AttackTime", (short) this.attackTicks); if (!this.effects.isEmpty()) { NBTTagList nbttaglist = new NBTTagList(); Iterator iterator = this.effects.values().iterator(); @@ -790,40 +791,40 @@ public abstract class EntityLiving extends Entity { MobEffect mobeffect = (MobEffect) iterator.next(); NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.a("Id", (byte) mobeffect.getEffectId()); - nbttagcompound1.a("Amplifier", (byte) mobeffect.getAmplifier()); - nbttagcompound1.a("Duration", mobeffect.getDuration()); - nbttaglist.a((NBTBase) nbttagcompound1); + nbttagcompound1.setByte("Id", (byte) mobeffect.getEffectId()); + nbttagcompound1.setByte("Amplifier", (byte) mobeffect.getAmplifier()); + nbttagcompound1.setInt("Duration", mobeffect.getDuration()); + nbttaglist.add(nbttagcompound1); } - nbttagcompound.a("ActiveEffects", (NBTBase) nbttaglist); + nbttagcompound.set("ActiveEffects", nbttaglist); } } public void a(NBTTagCompound nbttagcompound) { - this.health = nbttagcompound.e("Health"); + this.health = nbttagcompound.getShort("Health"); if (!nbttagcompound.hasKey("Health")) { this.health = this.getMaxHealth(); } - this.hurtTicks = nbttagcompound.e("HurtTime"); - this.deathTicks = nbttagcompound.e("DeathTime"); - this.attackTicks = nbttagcompound.e("AttackTime"); + this.hurtTicks = nbttagcompound.getShort("HurtTime"); + this.deathTicks = nbttagcompound.getShort("DeathTime"); + this.attackTicks = nbttagcompound.getShort("AttackTime"); if (nbttagcompound.hasKey("ActiveEffects")) { - NBTTagList nbttaglist = nbttagcompound.m("ActiveEffects"); + NBTTagList nbttaglist = nbttagcompound.getList("ActiveEffects"); - for (int i = 0; i < nbttaglist.d(); ++i) { - NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); - byte b0 = nbttagcompound1.d("Id"); - byte b1 = nbttagcompound1.d("Amplifier"); - int j = nbttagcompound1.f("Duration"); + for (int i = 0; i < nbttaglist.size(); ++i) { + NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i); + byte b0 = nbttagcompound1.getByte("Id"); + byte b1 = nbttagcompound1.getByte("Amplifier"); + int j = nbttagcompound1.getInt("Duration"); this.effects.put(Integer.valueOf(b0), new MobEffect(b0, j, b1)); } } } - public boolean aj() { + public boolean isAlive() { return !this.dead && this.health > 0; } @@ -1160,7 +1161,7 @@ public abstract class EntityLiving extends Entity { double d1 = (double) (i >> 8 & 255) / 255.0D; double d2 = (double) (i >> 0 & 255) / 255.0D; - this.world.a("mobSpell", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.length, this.locY + this.random.nextDouble() * (double) this.width - (double) this.height, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.length, d0, d1, d2); + this.world.a("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); } } } @@ -1204,7 +1205,7 @@ public abstract class EntityLiving extends Entity { } public boolean a(MobEffect mobeffect) { - if (this.t() == EnchantmentDamage.b) { + if (this.getMonsterType() == MonsterType.UNDEAD) { int i = mobeffect.getEffectId(); if (i == MobEffectList.REGENERATION.id || i == MobEffectList.POISON.id) { @@ -1216,7 +1217,7 @@ public abstract class EntityLiving extends Entity { } public boolean at() { - return this.t() == EnchantmentDamage.b; + return this.getMonsterType() == MonsterType.UNDEAD; } protected void b(MobEffect mobeffect) { @@ -1253,8 +1254,8 @@ public abstract class EntityLiving extends Entity { return false; } - public EnchantmentDamage t() { - return EnchantmentDamage.a; + public MonsterType getMonsterType() { + return MonsterType.UNDEFINED; } public void c(ItemStack itemstack) { diff --git a/src/main/java/net/minecraft/server/EntityLavaSlime.java b/src/main/java/net/minecraft/server/EntityMagmaCube.java index b9c61b06..9301a71b 100644 --- a/src/main/java/net/minecraft/server/EntityLavaSlime.java +++ b/src/main/java/net/minecraft/server/EntityMagmaCube.java @@ -1,8 +1,8 @@ package net.minecraft.server; -public class EntityLavaSlime extends EntitySlime { +public class EntityMagmaCube extends EntitySlime { - public EntityLavaSlime(World world) { + public EntityMagmaCube(World world) { super(world); this.texture = "/mob/lava.png"; this.fireProof = true; @@ -26,7 +26,7 @@ public class EntityLavaSlime extends EntitySlime { } protected EntitySlime y() { - return new EntityLavaSlime(this.world); + return new EntityMagmaCube(this.world); } protected int e() { diff --git a/src/main/java/net/minecraft/server/EntityMinecart.java b/src/main/java/net/minecraft/server/EntityMinecart.java index ff9e9c69..b50d5bcc 100644 --- a/src/main/java/net/minecraft/server/EntityMinecart.java +++ b/src/main/java/net/minecraft/server/EntityMinecart.java @@ -53,7 +53,7 @@ public class EntityMinecart extends Entity implements IInventory { this.f = false; this.bc = true; this.b(0.98F, 0.7F); - this.height = this.width / 2.0F; + this.height = this.length / 2.0F; } protected boolean g_() { @@ -94,7 +94,7 @@ public class EntityMinecart extends Entity implements IInventory { } public double q() { - return (double) this.width * 0.0D - 0.30000001192092896D; + return (double) this.length * 0.0D - 0.30000001192092896D; } public boolean damageEntity(DamageSource damagesource, int i) { @@ -666,11 +666,11 @@ public class EntityMinecart extends Entity implements IInventory { } protected void b(NBTTagCompound nbttagcompound) { - nbttagcompound.a("Type", this.type); + nbttagcompound.setInt("Type", this.type); if (this.type == 2) { - nbttagcompound.a("PushX", this.b); - nbttagcompound.a("PushZ", this.c); - nbttagcompound.a("Fuel", (short) this.e); + nbttagcompound.setDouble("PushX", this.b); + nbttagcompound.setDouble("PushZ", this.c); + nbttagcompound.setShort("Fuel", (short) this.e); } else if (this.type == 1) { NBTTagList nbttaglist = new NBTTagList(); @@ -678,30 +678,30 @@ public class EntityMinecart extends Entity implements IInventory { if (this.items[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.a("Slot", (byte) i); + nbttagcompound1.setByte("Slot", (byte) i); this.items[i].b(nbttagcompound1); - nbttaglist.a((NBTBase) nbttagcompound1); + nbttaglist.add(nbttagcompound1); } } - nbttagcompound.a("Items", (NBTBase) nbttaglist); + nbttagcompound.set("Items", nbttaglist); } } protected void a(NBTTagCompound nbttagcompound) { - this.type = nbttagcompound.f("Type"); + this.type = nbttagcompound.getInt("Type"); if (this.type == 2) { - this.b = nbttagcompound.i("PushX"); - this.c = nbttagcompound.i("PushZ"); - this.e = nbttagcompound.e("Fuel"); + this.b = nbttagcompound.getDouble("PushX"); + this.c = nbttagcompound.getDouble("PushZ"); + this.e = nbttagcompound.getShort("Fuel"); } else if (this.type == 1) { - NBTTagList nbttaglist = nbttagcompound.m("Items"); + NBTTagList nbttaglist = nbttagcompound.getList("Items"); this.items = new ItemStack[this.getSize()]; - for (int i = 0; i < nbttaglist.d(); ++i) { - NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); - int j = nbttagcompound1.d("Slot") & 255; + for (int i = 0; i < nbttaglist.size(); ++i) { + NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i); + int j = nbttagcompound1.getByte("Slot") & 255; if (j >= 0 && j < this.items.length) { this.items[j] = ItemStack.a(nbttagcompound1); diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java index 79600d57..c425f67c 100644 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java @@ -34,7 +34,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster { } protected Entity findTarget() { - EntityHuman entityhuman = this.world.b(this, 16.0D); + EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D); return entityhuman != null && this.g(entityhuman) ? entityhuman : null; } diff --git a/src/main/java/net/minecraft/server/EntityPainting.java b/src/main/java/net/minecraft/server/EntityPainting.java index 3a6edd7d..98a2b6ee 100644 --- a/src/main/java/net/minecraft/server/EntityPainting.java +++ b/src/main/java/net/minecraft/server/EntityPainting.java @@ -246,18 +246,18 @@ public class EntityPainting extends Entity { } public void b(NBTTagCompound nbttagcompound) { - nbttagcompound.a("Dir", (byte) this.a); + nbttagcompound.setByte("Dir", (byte) this.a); nbttagcompound.setString("Motive", this.e.A); - nbttagcompound.a("TileX", this.b); - nbttagcompound.a("TileY", this.c); - nbttagcompound.a("TileZ", this.d); + nbttagcompound.setInt("TileX", this.b); + nbttagcompound.setInt("TileY", this.c); + nbttagcompound.setInt("TileZ", this.d); } public void a(NBTTagCompound nbttagcompound) { - this.a = nbttagcompound.d("Dir"); - this.b = nbttagcompound.f("TileX"); - this.c = nbttagcompound.f("TileY"); - this.d = nbttagcompound.f("TileZ"); + this.a = nbttagcompound.getByte("Dir"); + this.b = nbttagcompound.getInt("TileX"); + this.c = nbttagcompound.getInt("TileY"); + this.d = nbttagcompound.getInt("TileZ"); String s = nbttagcompound.getString("Motive"); EnumArt[] aenumart = EnumArt.values(); int i = aenumart.length; diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java index 8c6829f8..23216072 100644 --- a/src/main/java/net/minecraft/server/EntityPig.java +++ b/src/main/java/net/minecraft/server/EntityPig.java @@ -24,12 +24,12 @@ public class EntityPig extends EntityAnimal { public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - nbttagcompound.a("Saddle", this.hasSaddle()); + nbttagcompound.setBoolean("Saddle", this.hasSaddle()); } public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - this.setSaddle(nbttagcompound.n("Saddle")); + this.setSaddle(nbttagcompound.getBoolean("Saddle")); } protected String c_() { @@ -71,12 +71,12 @@ public class EntityPig extends EntityAnimal { } } - public void a(EntityWeatherStorm entityweatherstorm) { + public void a(EntityWeatherLighting entityweatherlighting) { if (!this.world.isStatic) { EntityPigZombie entitypigzombie = new EntityPigZombie(this.world); // CraftBukkit start - PigZapEvent event = new PigZapEvent(this.getBukkitEntity(), entityweatherstorm.getBukkitEntity(), entitypigzombie.getBukkitEntity()); + PigZapEvent event = new PigZapEvent(this.getBukkitEntity(), entityweatherlighting.getBukkitEntity(), entitypigzombie.getBukkitEntity()); this.world.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java index 94936951..f773d065 100644 --- a/src/main/java/net/minecraft/server/EntityPigZombie.java +++ b/src/main/java/net/minecraft/server/EntityPigZombie.java @@ -38,12 +38,12 @@ public class EntityPigZombie extends EntityZombie { public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - nbttagcompound.a("Anger", (short) this.angerLevel); + nbttagcompound.setShort("Anger", (short) this.angerLevel); } public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - this.angerLevel = nbttagcompound.e("Anger"); + this.angerLevel = nbttagcompound.getShort("Anger"); } protected Entity findTarget() { @@ -111,7 +111,7 @@ public class EntityPigZombie extends EntityZombie { return "mob.zombiepig.zpigdeath"; } - protected void a(boolean flag, int i) { + protected void dropDeathLoot(boolean flag, int i) { // CraftBukkit start List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); int j = this.random.nextInt(2 + i); diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index 2bcef14b..c23c5fa5 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -70,13 +70,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); if (nbttagcompound.hasKey("playerGameType")) { - this.itemInWorldManager.a(nbttagcompound.f("playerGameType")); + this.itemInWorldManager.a(nbttagcompound.getInt("playerGameType")); } } public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - nbttagcompound.a("playerGameType", this.itemInWorldManager.a()); + nbttagcompound.setInt("playerGameType", this.itemInWorldManager.a()); } public void spawnIn(World world) { @@ -107,8 +107,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { // CraftBukkit end } - public void b(int i) { - super.b(i); + public void levelDown(int i) { + super.levelDown(i); this.cf = -1; } @@ -278,7 +278,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { b0 = -1; } - this.b.serverConfigurationManager.a(this, b0); + this.b.serverConfigurationManager.changeDimension(this, b0); this.cf = -1; this.cc = -1; this.cd = -1; @@ -309,9 +309,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.ce = this.foodData.c() == 0.0F; } - if (this.exp != this.cf) { - this.cf = this.exp; - this.netServerHandler.sendPacket(new Packet43SetExperience(this.expLevel, this.exp, this.expTotal)); + if (this.expTotal != this.cf) { + this.cf = this.expTotal; + this.netServerHandler.sendPacket(new Packet43SetExperience(this.exp, this.expTotal, this.expLevel)); } } @@ -329,7 +329,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.netServerHandler.a((double) chunkcoordinates.x, (double) chunkcoordinates.y, (double) chunkcoordinates.z, 0.0F, 0.0F); } - this.b.serverConfigurationManager.a(this, 1); + this.b.serverConfigurationManager.changeDimension(this, 1); this.cf = -1; this.cc = -1; this.cd = -1; @@ -379,19 +379,19 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void A() {} - public EnumBedError a(int i, int j, int k) { - EnumBedError enumbederror = super.a(i, j, k); + public EnumBedResult a(int i, int j, int k) { + EnumBedResult enumbedresult = super.a(i, j, k); - if (enumbederror == EnumBedError.OK) { + if (enumbedresult == EnumBedResult.OK) { EntityTracker entitytracker = this.b.getTracker(this.dimension); - Packet17 packet17 = new Packet17(this, 0, i, j, k); + Packet17EntityLocationAction packet17entitylocationaction = new Packet17EntityLocationAction(this, 0, i, j, k); - entitytracker.a(this, packet17); + entitytracker.a(this, packet17entitylocationaction); this.netServerHandler.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch); - this.netServerHandler.sendPacket(packet17); + this.netServerHandler.sendPacket(packet17entitylocationaction); } - return enumbederror; + return enumbedresult; } public void a(boolean flag, boolean flag1, boolean flag2) { @@ -561,8 +561,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } public void a(String s) { - StatisticStorage statisticstorage = StatisticStorage.a(); - String s1 = statisticstorage.a(s); + LocaleLanguage localelanguage = LocaleLanguage.a(); + String s1 = localelanguage.a(s); this.netServerHandler.sendPacket(new Packet3Chat(s1)); } diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java index 018580e5..c33e29a3 100644 --- a/src/main/java/net/minecraft/server/EntityProjectile.java +++ b/src/main/java/net/minecraft/server/EntityProjectile.java @@ -203,21 +203,21 @@ public abstract class EntityProjectile extends Entity { protected abstract void a(MovingObjectPosition movingobjectposition); public void b(NBTTagCompound nbttagcompound) { - nbttagcompound.a("xTile", (short) this.blockX); - nbttagcompound.a("yTile", (short) this.blockY); - nbttagcompound.a("zTile", (short) this.blockZ); - nbttagcompound.a("inTile", (byte) this.inBlockId); - nbttagcompound.a("shake", (byte) this.shake); - nbttagcompound.a("inGround", (byte) (this.inGround ? 1 : 0)); + nbttagcompound.setShort("xTile", (short) this.blockX); + nbttagcompound.setShort("yTile", (short) this.blockY); + nbttagcompound.setShort("zTile", (short) this.blockZ); + nbttagcompound.setByte("inTile", (byte) this.inBlockId); + nbttagcompound.setByte("shake", (byte) this.shake); + nbttagcompound.setByte("inGround", (byte) (this.inGround ? 1 : 0)); } public void a(NBTTagCompound nbttagcompound) { - this.blockX = nbttagcompound.e("xTile"); - this.blockY = nbttagcompound.e("yTile"); - this.blockZ = nbttagcompound.e("zTile"); - this.inBlockId = nbttagcompound.d("inTile") & 255; - this.shake = nbttagcompound.d("shake") & 255; - this.inGround = nbttagcompound.d("inGround") == 1; + this.blockX = nbttagcompound.getShort("xTile"); + this.blockY = nbttagcompound.getShort("yTile"); + this.blockZ = nbttagcompound.getShort("zTile"); + this.inBlockId = nbttagcompound.getByte("inTile") & 255; + this.shake = nbttagcompound.getByte("shake") & 255; + this.inGround = nbttagcompound.getByte("inGround") == 1; } public void a_(EntityHuman entityhuman) {} diff --git a/src/main/java/net/minecraft/server/EntitySheep.java b/src/main/java/net/minecraft/server/EntitySheep.java index 02ca25d6..466ef579 100644 --- a/src/main/java/net/minecraft/server/EntitySheep.java +++ b/src/main/java/net/minecraft/server/EntitySheep.java @@ -22,7 +22,7 @@ public class EntitySheep extends EntityAnimal { this.datawatcher.a(16, new Byte((byte) 0)); } - protected void a(boolean flag, int i) { + 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>(); @@ -63,14 +63,14 @@ public class EntitySheep extends EntityAnimal { public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - nbttagcompound.a("Sheared", this.isSheared()); - nbttagcompound.a("Color", (byte) this.getColor()); + nbttagcompound.setBoolean("Sheared", this.isSheared()); + nbttagcompound.setByte("Color", (byte) this.getColor()); } public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - this.setSheared(nbttagcompound.n("Sheared")); - this.setColor(nbttagcompound.d("Color")); + this.setSheared(nbttagcompound.getBoolean("Sheared")); + this.setColor(nbttagcompound.getByte("Color")); } protected String c_() { diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java index 82c2081c..60080957 100644 --- a/src/main/java/net/minecraft/server/EntitySkeleton.java +++ b/src/main/java/net/minecraft/server/EntitySkeleton.java @@ -57,7 +57,7 @@ public class EntitySkeleton extends EntityMonster { this.world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { - this.j(event.getDuration()); + this.setOnFire(event.getDuration()); } // CraftBukkit end } @@ -99,7 +99,7 @@ public class EntitySkeleton extends EntityMonster { return Item.ARROW.id; } - protected void a(boolean flag, int i) { + 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>(); @@ -117,7 +117,7 @@ public class EntitySkeleton extends EntityMonster { // CraftBukkit end } - public EnchantmentDamage t() { - return EnchantmentDamage.b; + public MonsterType getMonsterType() { + return MonsterType.UNDEAD; } } diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java index f4de6574..be87d373 100644 --- a/src/main/java/net/minecraft/server/EntitySlime.java +++ b/src/main/java/net/minecraft/server/EntitySlime.java @@ -5,7 +5,7 @@ public class EntitySlime extends EntityLiving implements IMonster { public float a; public float b; public float c; - private int size = 0; + private int jumpDelay = 0; public EntitySlime(World world) { super(world); @@ -13,7 +13,7 @@ public class EntitySlime extends EntityLiving implements IMonster { int i = 1 << this.random.nextInt(3); this.height = 0.0F; - this.size = this.random.nextInt(20) + 10; + this.jumpDelay = this.random.nextInt(20) + 10; this.setSize(i); this.az = i; } @@ -42,12 +42,12 @@ public class EntitySlime extends EntityLiving implements IMonster { public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - nbttagcompound.a("Size", this.getSize() - 1); + nbttagcompound.setInt("Size", this.getSize() - 1); } public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - this.setSize(nbttagcompound.f("Size") + 1); + this.setSize(nbttagcompound.getInt("Size") + 1); } protected String w() { @@ -92,16 +92,16 @@ public class EntitySlime extends EntityLiving implements IMonster { protected void m_() { this.ak(); - EntityHuman entityhuman = this.world.b(this, 16.0D); + EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D); if (entityhuman != null) { this.a(entityhuman, 10.0F, 20.0F); } - if (this.onGround && this.size-- <= 0) { - this.size = this.A(); + if (this.onGround && this.jumpDelay-- <= 0) { + this.jumpDelay = this.A(); if (entityhuman != null) { - this.size /= 3; + this.jumpDelay /= 3; } this.aW = true; diff --git a/src/main/java/net/minecraft/server/EntitySmallFireball.java b/src/main/java/net/minecraft/server/EntitySmallFireball.java index 853f32b7..426ad87b 100644 --- a/src/main/java/net/minecraft/server/EntitySmallFireball.java +++ b/src/main/java/net/minecraft/server/EntitySmallFireball.java @@ -30,7 +30,7 @@ public class EntitySmallFireball extends EntityFireball { // CraftBukkit end if (movingobjectposition.entity != null) { // CraftBukkit start - entity damage by entity event + combust event - if (!movingobjectposition.entity.ax()) { // check if not fireproof + if (!movingobjectposition.entity.isFireproof()) { // check if not fireproof boolean stick; org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity(); Projectile projectile = (Projectile) this.getBukkitEntity(); @@ -54,7 +54,7 @@ public class EntitySmallFireball extends EntityFireball { pluginManager.callEvent(combustEvent); if (!combustEvent.isCancelled()) { - movingobjectposition.entity.j(combustEvent.getDuration()); + movingobjectposition.entity.setOnFire(combustEvent.getDuration()); } } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/EntitySnowman.java b/src/main/java/net/minecraft/server/EntitySnowman.java index 39200005..a8d549e4 100644 --- a/src/main/java/net/minecraft/server/EntitySnowman.java +++ b/src/main/java/net/minecraft/server/EntitySnowman.java @@ -77,7 +77,7 @@ public class EntitySnowman extends EntityGolem { return Item.SNOW_BALL.id; } - protected void a(boolean flag, int i) { + protected void dropDeathLoot(boolean flag, int i) { // CraftBukkit start List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); int j = this.random.nextInt(16); diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java index bc724ec7..206ee185 100644 --- a/src/main/java/net/minecraft/server/EntitySpider.java +++ b/src/main/java/net/minecraft/server/EntitySpider.java @@ -35,7 +35,7 @@ public class EntitySpider extends EntityMonster { } public double q() { - return (double) this.width * 0.75D - 0.5D; + return (double) this.length * 0.75D - 0.5D; } protected boolean g_() { @@ -48,7 +48,7 @@ public class EntitySpider extends EntityMonster { if (f < 0.5F) { double d0 = 16.0D; - return this.world.b(this, d0); + return this.world.findNearbyVulnerablePlayer(this, d0); } else { return null; } @@ -112,8 +112,8 @@ public class EntitySpider extends EntityMonster { return Item.STRING.id; } - protected void a(boolean flag, int i) { - super.a(flag, i); + protected void dropDeathLoot(boolean flag, int i) { + super.dropDeathLoot(flag, i); if (flag && (this.random.nextInt(3) == 0 || this.random.nextInt(1 + i) > 0)) { this.b(Item.SPIDER_EYE.id, 1); } @@ -125,8 +125,8 @@ public class EntitySpider extends EntityMonster { public void s() {} - public EnchantmentDamage t() { - return EnchantmentDamage.c; + public MonsterType getMonsterType() { + return MonsterType.ARTHROPOD; } public boolean a(MobEffect mobeffect) { diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java index 6127b77f..f7766ee7 100644 --- a/src/main/java/net/minecraft/server/EntitySquid.java +++ b/src/main/java/net/minecraft/server/EntitySquid.java @@ -58,7 +58,7 @@ public class EntitySquid extends EntityWaterAnimal { return 0; } - protected void a(boolean flag, int i) { + 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>(); diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java index c445a03e..df280342 100644 --- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java +++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java @@ -18,7 +18,7 @@ public class EntityTNTPrimed extends Entity { this.fuseTicks = 0; this.bc = true; this.b(0.98F, 0.98F); - this.height = this.width / 2.0F; + this.height = this.length / 2.0F; } public EntityTNTPrimed(World world, double d0, double d1, double d2) { @@ -91,10 +91,10 @@ public class EntityTNTPrimed extends Entity { } protected void b(NBTTagCompound nbttagcompound) { - nbttagcompound.a("Fuse", (byte) this.fuseTicks); + nbttagcompound.setByte("Fuse", (byte) this.fuseTicks); } protected void a(NBTTagCompound nbttagcompound) { - this.fuseTicks = nbttagcompound.d("Fuse"); + this.fuseTicks = nbttagcompound.getByte("Fuse"); } } diff --git a/src/main/java/net/minecraft/server/EntityTracker.java b/src/main/java/net/minecraft/server/EntityTracker.java index 31bccaaa..a1bd3224 100644 --- a/src/main/java/net/minecraft/server/EntityTracker.java +++ b/src/main/java/net/minecraft/server/EntityTracker.java @@ -8,7 +8,7 @@ import java.util.Set; public class EntityTracker { private Set a = new HashSet(); - private EntityList trackedEntities = new EntityList(); + private IntHashMap trackedEntities = new IntHashMap(); private MinecraftServer c; private int d; private int e; @@ -65,7 +65,7 @@ public class EntityTracker { this.addEntity(entity, 160, 3, true); } else if (entity instanceof EntityTNTPrimed) { this.addEntity(entity, 160, 10, true); - } else if (entity instanceof EntityFallingSand) { + } else if (entity instanceof EntityFallingBlock) { this.addEntity(entity, 160, 20, true); } else if (entity instanceof EntityPainting) { 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 53d676ed..dcfb2e3f 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -205,7 +205,7 @@ public class EntityTrackerEntry { EntityHuman entityhuman = (EntityHuman) this.tracker; if (entityhuman.isSleeping()) { - entityplayer.netServerHandler.sendPacket(new Packet17(this.tracker, 0, MathHelper.floor(this.tracker.locX), MathHelper.floor(this.tracker.locY), MathHelper.floor(this.tracker.locZ))); + entityplayer.netServerHandler.sendPacket(new Packet17EntityLocationAction(this.tracker, 0, MathHelper.floor(this.tracker.locX), MathHelper.floor(this.tracker.locY), MathHelper.floor(this.tracker.locZ))); } } @@ -328,8 +328,8 @@ public class EntityTrackerEntry { } else if (this.tracker instanceof EntityEnderCrystal) { return new Packet23VehicleSpawn(this.tracker, 51); } else { - if (this.tracker instanceof EntityFallingSand) { - EntityFallingSand entityfallingsand = (EntityFallingSand) this.tracker; + if (this.tracker instanceof EntityFallingBlock) { + EntityFallingBlock entityfallingsand = (EntityFallingBlock) this.tracker; if (entityfallingsand.a == Block.SAND.id) { return new Packet23VehicleSpawn(this.tracker, 70); diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java index 6ce6853a..ddf5d034 100644 --- a/src/main/java/net/minecraft/server/EntityTypes.java +++ b/src/main/java/net/minecraft/server/EntityTypes.java @@ -94,7 +94,7 @@ public class EntityTypes { a(EntityEnderPearl.class, "ThrownEnderpearl", 14); a(EntityEnderSignal.class, "EyeOfEnderSignal", 15); a(EntityTNTPrimed.class, "PrimedTnt", 20); - a(EntityFallingSand.class, "FallingSand", 21); + a(EntityFallingBlock.class, "FallingSand", 21); a(EntityMinecart.class, "Minecart", 40); a(EntityBoat.class, "Boat", 41); a(EntityLiving.class, "Mob", 48); @@ -111,7 +111,7 @@ public class EntityTypes { a(EntityCaveSpider.class, "CaveSpider", 59); a(EntitySilverfish.class, "Silverfish", 60); a(EntityBlaze.class, "Blaze", 61); - a(EntityLavaSlime.class, "LavaSlime", 62); + a(EntityMagmaCube.class, "LavaSlime", 62); a(EntityEnderDragon.class, "EnderDragon", 63); a(EntityPig.class, "Pig", 90); a(EntitySheep.class, "Sheep", 91); diff --git a/src/main/java/net/minecraft/server/EntityWeatherStorm.java b/src/main/java/net/minecraft/server/EntityWeatherLighting.java index 1080fcc0..67498895 100644 --- a/src/main/java/net/minecraft/server/EntityWeatherStorm.java +++ b/src/main/java/net/minecraft/server/EntityWeatherLighting.java @@ -8,7 +8,7 @@ import org.bukkit.event.block.BlockIgniteEvent; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; // CraftBukkit end -public class EntityWeatherStorm extends EntityWeather { +public class EntityWeatherLighting extends EntityWeather { private int lifeTicks; public long a = 0L; @@ -18,11 +18,11 @@ public class EntityWeatherStorm extends EntityWeather { private CraftWorld cworld; public boolean isEffect = false; - public EntityWeatherStorm(World world, double d0, double d1, double d2) { + public EntityWeatherLighting(World world, double d0, double d1, double d2) { this(world, d0, d1, d2, false); } - public EntityWeatherStorm(World world, double d0, double d1, double d2, boolean isEffect) { + public EntityWeatherLighting(World world, double d0, double d1, double d2, boolean isEffect) { // CraftBukkit end super(world); diff --git a/src/main/java/net/minecraft/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java index 5be38edc..cd6d7a0c 100644 --- a/src/main/java/net/minecraft/server/EntityWolf.java +++ b/src/main/java/net/minecraft/server/EntityWolf.java @@ -46,8 +46,8 @@ public class EntityWolf extends EntityAnimal { public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - nbttagcompound.a("Angry", this.isAngry()); - nbttagcompound.a("Sitting", this.isSitting()); + nbttagcompound.setBoolean("Angry", this.isAngry()); + nbttagcompound.setBoolean("Sitting", this.isSitting()); if (this.getOwnerName() == null) { nbttagcompound.setString("Owner", ""); } else { @@ -57,8 +57,8 @@ public class EntityWolf extends EntityAnimal { public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - this.setAngry(nbttagcompound.n("Angry")); - this.setSitting(nbttagcompound.n("Sitting")); + this.setAngry(nbttagcompound.getBoolean("Angry")); + this.setSitting(nbttagcompound.getBoolean("Sitting")); String s = nbttagcompound.getString("Owner"); if (s.length() > 0) { @@ -197,8 +197,8 @@ public class EntityWolf extends EntityAnimal { int i = (int) (MathHelper.sin((this.i - 0.4F) * 3.1415927F) * 7.0F); for (int j = 0; j < i; ++j) { - float f1 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length * 0.5F; - float f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length * 0.5F; + float f1 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; + float f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F; this.world.a("splash", this.locX + (double) f1, (double) (f + 0.8F), this.locZ + (double) f2, this.motX, this.motY, this.motZ); } @@ -207,7 +207,7 @@ public class EntityWolf extends EntityAnimal { } public float x() { - return this.width * 0.8F; + return this.length * 0.8F; } protected int q_() { @@ -422,7 +422,7 @@ public class EntityWolf extends EntityAnimal { double d1 = this.random.nextGaussian() * 0.02D; double d2 = this.random.nextGaussian() * 0.02D; - this.world.a(s, this.locX + (double) (this.random.nextFloat() * this.length * 2.0F) - (double) this.length, this.locY + 0.5D + (double) (this.random.nextFloat() * this.width), this.locZ + (double) (this.random.nextFloat() * this.length * 2.0F) - (double) this.length, d0, d1, d2); + this.world.a(s, this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + 0.5D + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, d0, d1, d2); } } diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java index 6d78407f..bb2cd0d0 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -29,7 +29,7 @@ public class EntityZombie extends EntityMonster { this.world.getServer().getPluginManager().callEvent(event); if (!event.isCancelled()) { - this.j(event.getDuration()); + this.setOnFire(event.getDuration()); } // CraftBukkit end } @@ -54,7 +54,7 @@ public class EntityZombie extends EntityMonster { return Item.ROTTEN_FLESH.id; } - public EnchantmentDamage t() { - return EnchantmentDamage.b; + public MonsterType getMonsterType() { + return MonsterType.UNDEAD; } } diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java index 854b79cb..ad7a7a30 100644 --- a/src/main/java/net/minecraft/server/FoodMetaData.java +++ b/src/main/java/net/minecraft/server/FoodMetaData.java @@ -76,18 +76,18 @@ public class FoodMetaData { public void a(NBTTagCompound nbttagcompound) { if (nbttagcompound.hasKey("foodLevel")) { - this.foodLevel = nbttagcompound.f("foodLevel"); - this.foodTickTimer = nbttagcompound.f("foodTickTimer"); - this.saturationLevel = nbttagcompound.h("foodSaturationLevel"); - this.exhaustionLevel = nbttagcompound.h("foodExhaustionLevel"); + this.foodLevel = nbttagcompound.getInt("foodLevel"); + this.foodTickTimer = nbttagcompound.getInt("foodTickTimer"); + this.saturationLevel = nbttagcompound.getFloat("foodSaturationLevel"); + this.exhaustionLevel = nbttagcompound.getFloat("foodExhaustionLevel"); } } public void b(NBTTagCompound nbttagcompound) { - nbttagcompound.a("foodLevel", this.foodLevel); - nbttagcompound.a("foodTickTimer", this.foodTickTimer); - nbttagcompound.a("foodSaturationLevel", this.saturationLevel); - nbttagcompound.a("foodExhaustionLevel", this.exhaustionLevel); + nbttagcompound.setInt("foodLevel", this.foodLevel); + nbttagcompound.setInt("foodTickTimer", this.foodTickTimer); + nbttagcompound.setFloat("foodSaturationLevel", this.saturationLevel); + nbttagcompound.setFloat("foodExhaustionLevel", this.exhaustionLevel); } public int a() { diff --git a/src/main/java/net/minecraft/server/IDataManager.java b/src/main/java/net/minecraft/server/IDataManager.java index dc725941..87c7b03c 100644 --- a/src/main/java/net/minecraft/server/IDataManager.java +++ b/src/main/java/net/minecraft/server/IDataManager.java @@ -6,21 +6,21 @@ import java.util.UUID; // CraftBukkit public interface IDataManager { - WorldData c(); + WorldData getWorldData(); - void b(); + void checkSession(); - IChunkLoader a(WorldProvider worldprovider); + IChunkLoader createChunkLoader(WorldProvider worldprovider); - void a(WorldData worlddata, List list); + void saveWorldData(WorldData worlddata, List list); - void a(WorldData worlddata); + void saveWorldData(WorldData worlddata); - PlayerFileData d(); + PlayerFileData getPlayerFileData(); void e(); - File b(String s); + File getDataFile(String s); UUID getUUID(); // CraftBukkit } diff --git a/src/main/java/net/minecraft/server/ItemInWorldManager.java b/src/main/java/net/minecraft/server/ItemInWorldManager.java index bc560e09..f0c39a42 100644 --- a/src/main/java/net/minecraft/server/ItemInWorldManager.java +++ b/src/main/java/net/minecraft/server/ItemInWorldManager.java @@ -245,7 +245,7 @@ public class ItemInWorldManager { entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = itemstack1; if (this.b()) { itemstack1.count = i; - itemstack1.b(j); + itemstack1.setData(j); } if (itemstack1.count == 0) { @@ -283,7 +283,7 @@ public class ItemInWorldManager { // The item count should not decrement in Creative mode. if (this.b()) { - itemstack.b(j1); + itemstack.setData(j1); itemstack.count = k1; } } diff --git a/src/main/java/net/minecraft/server/ItemMobSpawner.java b/src/main/java/net/minecraft/server/ItemMobSpawner.java index 2f0a4186..ca6c1e83 100644 --- a/src/main/java/net/minecraft/server/ItemMobSpawner.java +++ b/src/main/java/net/minecraft/server/ItemMobSpawner.java @@ -1,7 +1,7 @@ package net.minecraft.server; // CraftBukkit start - the whole file! -public class ItemMobSpawner extends ItemLog { // Actually not ItemLog but 'ItemUsingMetadata' orso. +public class ItemMobSpawner extends ItemWithAuxData { public ItemMobSpawner(int id) { super(id, Block.MOB_SPAWNER); diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java index fedb9d39..9c88f416 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -36,7 +36,7 @@ public final class ItemStack { this.count = 0; this.id = i; this.count = j; - this.b(k); // CraftBukkit + this.setData(k); // CraftBukkit } public static ItemStack a(NBTTagCompound nbttagcompound) { @@ -54,7 +54,7 @@ public final class ItemStack { ItemStack itemstack = new ItemStack(this.id, i, this.damage); if (this.tag != null) { - itemstack.tag = (NBTTagCompound) this.tag.b(); + itemstack.tag = (NBTTagCompound) this.tag.clone(); } this.count -= i; @@ -88,22 +88,22 @@ public final class ItemStack { } public NBTTagCompound b(NBTTagCompound nbttagcompound) { - nbttagcompound.a("id", (short) this.id); - nbttagcompound.a("Count", (byte) this.count); - nbttagcompound.a("Damage", (short) this.damage); + nbttagcompound.setShort("id", (short) this.id); + nbttagcompound.setByte("Count", (byte) this.count); + nbttagcompound.setShort("Damage", (short) this.damage); if (this.tag != null) { - nbttagcompound.a("tag", (NBTBase) this.tag); + nbttagcompound.set("tag", this.tag); } return nbttagcompound; } public void c(NBTTagCompound nbttagcompound) { - this.id = nbttagcompound.e("id"); - this.count = nbttagcompound.d("Count"); - this.damage = nbttagcompound.e("Damage"); + this.id = nbttagcompound.getShort("id"); + this.count = nbttagcompound.getByte("Count"); + this.damage = nbttagcompound.getShort("Damage"); if (nbttagcompound.hasKey("tag")) { - this.tag = nbttagcompound.l("tag"); + this.tag = nbttagcompound.getCompound("tag"); } } @@ -135,7 +135,7 @@ public final class ItemStack { return this.damage; } - public void b(int i) { + public void setData(int i) { this.damage = (this.id > 0) && (this.id < 256) ? Item.byId[this.id].filterData(i) : i; // CraftBukkit } @@ -146,7 +146,7 @@ public final class ItemStack { public void damage(int i, EntityLiving entityliving) { if (this.d()) { if (i > 0 && entityliving instanceof EntityHuman) { - int j = EnchantmentManager.c(((EntityHuman) entityliving).inventory); + int j = EnchantmentManager.getDurabilityEnchantmentLevel(((EntityHuman) entityliving).inventory); if (j > 0 && entityliving.world.random.nextInt(j + 1) > 0) { return; @@ -204,7 +204,7 @@ public final class ItemStack { ItemStack itemstack = new ItemStack(this.id, this.count, this.damage); if (this.tag != null) { - itemstack.tag = (NBTTagCompound) this.tag.b(); + itemstack.tag = (NBTTagCompound) this.tag.clone(); if (!itemstack.tag.equals(this.tag)) { return itemstack; } @@ -266,19 +266,19 @@ public final class ItemStack { this.getItem().a(this, world, entityhuman, i); } - public boolean n() { + public boolean hasTag() { return this.tag != null; } - public NBTTagCompound o() { + public NBTTagCompound getTag() { return this.tag; } - public NBTTagList p() { - return this.tag == null ? null : (NBTTagList) this.tag.b("ench"); + public NBTTagList getEnchantments() { + return this.tag == null ? null : (NBTTagList) this.tag.get("ench"); } - public void d(NBTTagCompound nbttagcompound) { + public void setTag(NBTTagCompound nbttagcompound) { if (Item.byId[this.id].getMaxStackSize() != 1) { throw new IllegalArgumentException("Cannot add tag data to a stackable item"); } else { @@ -287,27 +287,27 @@ public final class ItemStack { } public boolean q() { - return !this.getItem().e(this) ? false : !this.r(); + return !this.getItem().e(this) ? false : !this.hasEnchantments(); } - public void a(Enchantment enchantment, int i) { + public void addEnchantment(Enchantment enchantment, int i) { if (this.tag == null) { - this.d(new NBTTagCompound()); + this.setTag(new NBTTagCompound()); } if (!this.tag.hasKey("ench")) { - this.tag.a("ench", (NBTBase) (new NBTTagList("ench"))); + this.tag.set("ench", new NBTTagList("ench")); } - NBTTagList nbttaglist = (NBTTagList) this.tag.b("ench"); + NBTTagList nbttaglist = (NBTTagList) this.tag.get("ench"); NBTTagCompound nbttagcompound = new NBTTagCompound(); - nbttagcompound.a("id", (short) enchantment.id); - nbttagcompound.a("lvl", (short) ((byte) i)); - nbttaglist.a((NBTBase) nbttagcompound); + nbttagcompound.setShort("id", (short) enchantment.id); + nbttagcompound.setShort("lvl", (short) ((byte) i)); + nbttaglist.add(nbttagcompound); } - public boolean r() { + public boolean hasEnchantments() { return this.tag != null && this.tag.hasKey("ench"); } } diff --git a/src/main/java/net/minecraft/server/ItemWorldMap.java b/src/main/java/net/minecraft/server/ItemWorldMap.java index 558a1851..5cc8ceb7 100644 --- a/src/main/java/net/minecraft/server/ItemWorldMap.java +++ b/src/main/java/net/minecraft/server/ItemWorldMap.java @@ -17,13 +17,13 @@ public class ItemWorldMap extends ItemWorldMapBase { WorldMap worldmap = (WorldMap) world.a(WorldMap.class, "map_" + itemstack.getData()); if (worldmap == null) { - itemstack.b(world.b("map")); + itemstack.setData(world.b("map")); String s = "map_" + itemstack.getData(); worldmap = new WorldMap(s); - worldmap.b = world.r().c(); - worldmap.c = world.r().e(); - worldmap.e = 3; + worldmap.centerX = world.getWorldData().c(); + worldmap.centerZ = world.getWorldData().e(); + worldmap.scale = 3; worldmap.map = (byte) world.worldProvider.dimension; worldmap.a(); world.a(s, (WorldMapBase) worldmap); @@ -41,9 +41,9 @@ public class ItemWorldMap extends ItemWorldMapBase { if (((WorldServer) world).dimension == worldmap.map) { // CraftBukkit short short1 = 128; short short2 = 128; - int i = 1 << worldmap.e; - int j = worldmap.b; - int k = worldmap.c; + int i = 1 << worldmap.scale; + int j = worldmap.centerX; + int k = worldmap.centerZ; int l = MathHelper.floor(entity.locX - (double) j) / i + short1 / 2; int i1 = MathHelper.floor(entity.locZ - (double) k) / i + short2 / 2; int j1 = 128 / i; @@ -181,7 +181,7 @@ public class ItemWorldMap extends ItemWorldMapBase { d0 = d1; if (j2 >= 0 && k2 * k2 + l2 * l2 < j1 * j1 && (!flag || (k1 + j2 & 1) != 0)) { - byte b4 = worldmap.f[k1 + j2 * short1]; + byte b4 = worldmap.colors[k1 + j2 * short1]; byte b5 = (byte) (i5 * 4 + b3); if (b4 != b5) { @@ -193,14 +193,14 @@ public class ItemWorldMap extends ItemWorldMapBase { i2 = j2; } - worldmap.f[k1 + j2 * short1] = b5; + worldmap.colors[k1 + j2 * short1] = b5; } } } } if (l1 <= i2) { - worldmap.a(k1, l1, i2); + worldmap.flagDirty(k1, l1, i2); } } } @@ -224,21 +224,21 @@ public class ItemWorldMap extends ItemWorldMapBase { } public void d(ItemStack itemstack, World world, EntityHuman entityhuman) { - itemstack.b(world.b("map")); + itemstack.setData(world.b("map")); String s = "map_" + itemstack.getData(); WorldMap worldmap = new WorldMap(s); world.a(s, (WorldMapBase) worldmap); - worldmap.b = MathHelper.floor(entityhuman.locX); - worldmap.c = MathHelper.floor(entityhuman.locZ); - worldmap.e = 3; + worldmap.centerX = MathHelper.floor(entityhuman.locX); + worldmap.centerZ = MathHelper.floor(entityhuman.locZ); + worldmap.scale = 3; worldmap.map = (byte) world.worldProvider.dimension; worldmap.a(); } public Packet c(ItemStack itemstack, World world, EntityHuman entityhuman) { - byte[] abyte = this.a(itemstack, world).a(itemstack, world, entityhuman); + byte[] abyte = this.a(itemstack, world).getUpdatePacket(itemstack, world, entityhuman); - return abyte == null ? null : new Packet131((short) Item.MAP.id, (short) itemstack.getData(), abyte); + return abyte == null ? null : new Packet131ItemData((short) Item.MAP.id, (short) itemstack.getData(), abyte); } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index fcfe6d48..9adc11b7 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -271,7 +271,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe world.addIWorldAccess(new WorldManager(this, world)); world.difficulty = this.propertyManager.getInt("difficulty", 1); world.setSpawnFlags(this.propertyManager.getBoolean("spawn-monsters", true), this.spawnAnimals); - world.r().setGameType(j); + world.getWorldData().setGameType(j); this.worlds.add(world); this.serverConfigurationManager.setPlayerFileData(this.worlds.toArray(new WorldServer[0])); } @@ -307,7 +307,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe worldserver.chunkProviderServer.getChunkAt(chunkcoordinates.x + j1 >> 4, chunkcoordinates.z + k1 >> 4); - while (worldserver.x() && this.isRunning) { + while (worldserver.updateLights() && this.isRunning) { ; } } @@ -503,7 +503,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe worldserver.doTick(); while (true) { - if (!worldserver.x()) { + if (!worldserver.updateLights()) { worldserver.tickEntities(); break; } @@ -514,7 +514,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe // } // CraftBukkit this.networkListenThread.a(); - this.serverConfigurationManager.b(); + this.serverConfigurationManager.tick(); // CraftBukkit start for (k = 0; k < this.worlds.size(); ++k) { @@ -643,11 +643,11 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe } public int getPlayerCount() { - return this.serverConfigurationManager.j(); + return this.serverConfigurationManager.getPlayerCount(); } public int getMaxPlayers() { - return this.serverConfigurationManager.k(); + return this.serverConfigurationManager.getMaxPlayers(); } public String[] getPlayers() { @@ -708,11 +708,11 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe } public String[] q() { - return (String[]) this.serverConfigurationManager.f().toArray(new String[0]); + return (String[]) this.serverConfigurationManager.getBannedAddresses().toArray(new String[0]); } public String[] r() { - return (String[]) this.serverConfigurationManager.e().toArray(new String[0]); + return (String[]) this.serverConfigurationManager.getBannedPlayers().toArray(new String[0]); } public static boolean isRunning(MinecraftServer minecraftserver) { diff --git a/src/main/java/net/minecraft/server/NetLoginHandler.java b/src/main/java/net/minecraft/server/NetLoginHandler.java index 1b00ff40..e10062ab 100644 --- a/src/main/java/net/minecraft/server/NetLoginHandler.java +++ b/src/main/java/net/minecraft/server/NetLoginHandler.java @@ -85,7 +85,7 @@ public class NetLoginHandler extends NetHandler { } public void b(Packet1Login packet1login) { - EntityPlayer entityplayer = this.server.serverConfigurationManager.a(this, packet1login.name); + EntityPlayer entityplayer = this.server.serverConfigurationManager.attemptLogin(this, packet1login.name); if (entityplayer != null) { this.server.serverConfigurationManager.b(entityplayer); @@ -96,11 +96,11 @@ public class NetLoginHandler extends NetHandler { WorldServer worldserver = (WorldServer) entityplayer.world; // CraftBukkit ChunkCoordinates chunkcoordinates = worldserver.getSpawn(); - entityplayer.itemInWorldManager.b(worldserver.r().getGameType()); + entityplayer.itemInWorldManager.b(worldserver.getWorldData().getGameType()); NetServerHandler netserverhandler = new NetServerHandler(this.server, this.networkManager, entityplayer); // CraftBukkit start -- Don't send a higher than 60 MaxPlayer size, otherwise the PlayerInfo window won't render correctly. - int maxPlayers = this.server.serverConfigurationManager.k(); + int maxPlayers = this.server.serverConfigurationManager.getMaxPlayers(); if (maxPlayers > 60) { maxPlayers = 60; } @@ -137,8 +137,8 @@ public class NetLoginHandler extends NetHandler { if (this.networkManager.f() == null) return; // CraftBukkit - fix NPE when a client queries a server that is unable to handle it. try { // CraftBukkit start - ServerListPingEvent pingEvent = CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.r, this.server.serverConfigurationManager.j(), this.server.serverConfigurationManager.k()); - String s = pingEvent.getMotd() + "\u00A7" + this.server.serverConfigurationManager.j() + "\u00A7" + pingEvent.getMaxPlayers(); + ServerListPingEvent pingEvent = CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.r, this.server.serverConfigurationManager.getPlayerCount(), this.server.serverConfigurationManager.getMaxPlayers()); + String s = pingEvent.getMotd() + "\u00A7" + this.server.serverConfigurationManager.getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers(); // CraftBukkit end this.networkManager.queue(new Packet255KickDisconnect(s)); diff --git a/src/main/java/net/minecraft/server/NetServerHandler.java b/src/main/java/net/minecraft/server/NetServerHandler.java index 2d7abfaa..9727f641 100644 --- a/src/main/java/net/minecraft/server/NetServerHandler.java +++ b/src/main/java/net/minecraft/server/NetServerHandler.java @@ -49,7 +49,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { private double y; private double z; private boolean checkMovement = true; - private EntityList q = new EntityList(); + private IntHashMap q = new IntHashMap(); public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { this.minecraftServer = minecraftserver; @@ -128,8 +128,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener { this.disconnected = true; } - public void a(Packet27 packet27) { - this.player.a(packet27.c(), packet27.e(), packet27.g(), packet27.h(), packet27.d(), packet27.f()); + public void a(Packet27PlayerInput packet27playerinput) { + this.player.a(packet27playerinput.c(), packet27playerinput.e(), packet27playerinput.g(), packet27playerinput.h(), packet27playerinput.d(), packet27playerinput.f()); } public void a(Packet10Flying packet10flying) { @@ -684,7 +684,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { // CraftBukkit start if (this.player.dead) return; - if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex < InventoryPlayer.h()) { + if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex < PlayerInventory.h()) { PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex); this.server.getPluginManager().callEvent(event); // CraftBukkit end @@ -704,7 +704,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { s = s.trim(); for (int i = 0; i < s.length(); ++i) { - if (FontAllowedCharacters.allowedCharacters.indexOf(s.charAt(i)) < 0) { + if (SharedConstants.allowedCharacters.indexOf(s.charAt(i)) < 0) { this.disconnect("Illegal characters in chat"); return; } @@ -968,9 +968,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener { } } - public void a(Packet108 packet108) { - if (this.player.activeContainer.windowId == packet108.a && this.player.activeContainer.c(this.player)) { - this.player.activeContainer.a((EntityHuman) this.player, packet108.b); + public void a(Packet108ButtonClick packet108buttonclick) { + if (this.player.activeContainer.windowId == packet108buttonclick.a && this.player.activeContainer.c(this.player)) { + this.player.activeContainer.a((EntityHuman) this.player, packet108buttonclick.b); this.player.activeContainer.a(); } } @@ -979,7 +979,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { if (this.player.itemInWorldManager.b()) { boolean flag = packet107setcreativeslot.a < 0; ItemStack itemstack = packet107setcreativeslot.b; - boolean flag1 = packet107setcreativeslot.a >= 36 && packet107setcreativeslot.a < 36 + InventoryPlayer.h(); + boolean flag1 = packet107setcreativeslot.a >= 36 && packet107setcreativeslot.a < 36 + PlayerInventory.h(); boolean flag2 = itemstack == null || itemstack.id < Item.byId.length && itemstack.id >= 0 && Item.byId[itemstack.id] != null; boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0; @@ -1035,7 +1035,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener { flag = false; } else { for (i = 0; i < packet130updatesign.lines[j].length(); ++i) { - if (FontAllowedCharacters.allowedCharacters.indexOf(packet130updatesign.lines[j].charAt(i)) < 0) { + if (SharedConstants.allowedCharacters.indexOf(packet130updatesign.lines[j].charAt(i)) < 0) { flag = false; } } diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java index f953dd5a..592d7c48 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -240,7 +240,7 @@ public class NetworkManager { this.a(); this.q = true; this.s.interrupt(); - (new ThreadMonitorConnection(this)).start(); + (new NetworkMonitorThread(this)).start(); } public int e() { diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java index 3746fb0d..1d43fd69 100644 --- a/src/main/java/net/minecraft/server/Packet.java +++ b/src/main/java/net/minecraft/server/Packet.java @@ -11,7 +11,7 @@ import java.util.Set; public abstract class Packet { - public static EntityList j = new EntityList(); + public static IntHashMap j = new IntHashMap(); private static Map a = new HashMap(); private static Set b = new HashSet(); private static Set c = new HashSet(); @@ -178,7 +178,7 @@ public abstract class Packet { byte[] abyte = new byte[short1]; datainputstream.readFully(abyte); - return CompressedStreamTools.a(abyte); + return NBTCompressedStreamTools.a(abyte); } } @@ -186,7 +186,7 @@ public abstract class Packet { if (nbttagcompound == null) { dataoutputstream.writeShort(-1); } else { - byte[] abyte = CompressedStreamTools.a(nbttagcompound); + byte[] abyte = NBTCompressedStreamTools.a(nbttagcompound); dataoutputstream.writeShort((short) abyte.length); dataoutputstream.write(abyte); @@ -211,7 +211,7 @@ public abstract class Packet { a(14, false, true, Packet14BlockDig.class); a(15, false, true, Packet15Place.class); a(16, false, true, Packet16BlockItemSwitch.class); - a(17, true, false, Packet17.class); + a(17, true, false, Packet17EntityLocationAction.class); a(18, true, true, Packet18ArmAnimation.class); a(19, false, true, Packet19EntityAction.class); a(20, true, false, Packet20NamedEntitySpawn.class); @@ -221,7 +221,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, false, Packet27.class); // CraftBukkit - true -> false; disabled unused packet. TODO -- check if needed + a(27, false, false, Packet27PlayerInput.class); // CraftBukkit - true -> false; disabled unused packet. TODO -- check if needed a(28, true, false, Packet28EntityVelocity.class); a(29, true, false, Packet29DestroyEntity.class); a(30, true, false, Packet30Entity.class); @@ -241,7 +241,7 @@ public abstract class Packet { a(53, true, false, Packet53BlockChange.class); a(54, true, false, Packet54PlayNoteBlock.class); a(60, true, false, Packet60Explosion.class); - a(61, true, false, Packet61.class); + a(61, true, false, Packet61WorldEvent.class); a(70, true, false, Packet70Bed.class); a(71, true, false, Packet71Weather.class); a(100, true, false, Packet100OpenWindow.class); @@ -252,9 +252,9 @@ public abstract class Packet { a(105, true, false, Packet105CraftProgressBar.class); a(106, true, true, Packet106Transaction.class); a(107, true, true, Packet107SetCreativeSlot.class); - a(108, false, true, Packet108.class); + a(108, false, true, Packet108ButtonClick.class); a(130, true, true, Packet130UpdateSign.class); - a(131, true, false, Packet131.class); + a(131, true, false, Packet131ItemData.class); a(200, true, false, Packet200Statistic.class); a(201, true, false, Packet201PlayerInfo.class); a(254, false, true, Packet254GetInfo.class); diff --git a/src/main/java/net/minecraft/server/InventoryPlayer.java b/src/main/java/net/minecraft/server/PlayerInventory.java index b327c58d..e0f0914a 100644 --- a/src/main/java/net/minecraft/server/InventoryPlayer.java +++ b/src/main/java/net/minecraft/server/PlayerInventory.java @@ -1,6 +1,6 @@ package net.minecraft.server; -public class InventoryPlayer implements IInventory { +public class PlayerInventory implements IInventory { public ItemStack[] items = new ItemStack[36]; public ItemStack[] armor = new ItemStack[4]; @@ -19,7 +19,7 @@ public class InventoryPlayer implements IInventory { } // CraftBukkit end - public InventoryPlayer(EntityHuman entityhuman) { + public PlayerInventory(EntityHuman entityhuman) { this.d = entityhuman; } @@ -243,18 +243,18 @@ public class InventoryPlayer implements IInventory { for (i = 0; i < this.items.length; ++i) { if (this.items[i] != null) { nbttagcompound = new NBTTagCompound(); - nbttagcompound.a("Slot", (byte) i); + nbttagcompound.setByte("Slot", (byte) i); this.items[i].b(nbttagcompound); - nbttaglist.a((NBTBase) nbttagcompound); + nbttaglist.add(nbttagcompound); } } for (i = 0; i < this.armor.length; ++i) { if (this.armor[i] != null) { nbttagcompound = new NBTTagCompound(); - nbttagcompound.a("Slot", (byte) (i + 100)); + nbttagcompound.setByte("Slot", (byte) (i + 100)); this.armor[i].b(nbttagcompound); - nbttaglist.a((NBTBase) nbttagcompound); + nbttaglist.add(nbttagcompound); } } @@ -265,9 +265,9 @@ public class InventoryPlayer implements IInventory { this.items = new ItemStack[36]; this.armor = new ItemStack[4]; - for (int i = 0; i < nbttaglist.d(); ++i) { - NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.a(i); - int j = nbttagcompound.d("Slot") & 255; + for (int i = 0; i < nbttaglist.size(); ++i) { + NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.get(i); + int j = nbttagcompound.getByte("Slot") & 255; ItemStack itemstack = ItemStack.a(nbttagcompound); if (itemstack != null) { @@ -415,15 +415,15 @@ public class InventoryPlayer implements IInventory { public void g() {} - public void a(InventoryPlayer inventoryplayer) { + public void a(PlayerInventory playerinventory) { int i; for (i = 0; i < this.items.length; ++i) { - this.items[i] = ItemStack.b(inventoryplayer.items[i]); + this.items[i] = ItemStack.b(playerinventory.items[i]); } for (i = 0; i < this.armor.length; ++i) { - this.armor[i] = ItemStack.b(inventoryplayer.armor[i]); + this.armor[i] = ItemStack.b(playerinventory.armor[i]); } } } diff --git a/src/main/java/net/minecraft/server/PlayerManager.java b/src/main/java/net/minecraft/server/PlayerManager.java index 958ed1f3..434130f7 100644 --- a/src/main/java/net/minecraft/server/PlayerManager.java +++ b/src/main/java/net/minecraft/server/PlayerManager.java @@ -6,7 +6,7 @@ import java.util.List; public class PlayerManager { public List managedPlayers = new ArrayList(); - private PlayerList b = new PlayerList(); + private LongHashMap b = new LongHashMap(); private List c = new ArrayList(); private MinecraftServer server; private int e; @@ -175,7 +175,7 @@ public class PlayerManager { return this.f * 16 - 16; } - static PlayerList a(PlayerManager playermanager) { + static LongHashMap a(PlayerManager playermanager) { return playermanager.b; } diff --git a/src/main/java/net/minecraft/server/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/ServerConfigurationManager.java index f5beefb7..3eb38170 100644 --- a/src/main/java/net/minecraft/server/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/ServerConfigurationManager.java @@ -76,7 +76,7 @@ public class ServerConfigurationManager { public void setPlayerFileData(WorldServer[] aworldserver) { if (this.playerFileData != null) return; // CraftBukkit - this.playerFileData = aworldserver[0].q().d(); + this.playerFileData = aworldserver[0].getDataManager().getPlayerFileData(); } public void a(EntityPlayer entityplayer) { @@ -170,7 +170,7 @@ public class ServerConfigurationManager { return playerQuitEvent.getQuitMessage(); // CraftBukkit } - public EntityPlayer a(NetLoginHandler netloginhandler, String s) { + public EntityPlayer attemptLogin(NetLoginHandler netloginhandler, String s) { // CraftBukkit start - note: this entire method needs to be changed // 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 @@ -264,9 +264,9 @@ public class ServerConfigurationManager { entityplayer.fireTicks = 0; entityplayer.fallDistance = 0; entityplayer.foodData = new FoodMetaData(); + entityplayer.expLevel = 0; entityplayer.expTotal = 0; entityplayer.exp = 0; - entityplayer.expLevel = 0; entityplayer.d(entityplayer.newExp); } else { location.setWorld(this.server.getWorldServer(i).getWorld()); @@ -303,7 +303,7 @@ public class ServerConfigurationManager { return entityplayer1; } - public void a(EntityPlayer entityplayer, int i) { + public void changeDimension(EntityPlayer entityplayer, int i) { // CraftBukkit start -- Replaced the standard handling of portals with a more customised method. int dimension = i; WorldServer fromWorld = this.server.getWorldServer(entityplayer.dimension); @@ -351,7 +351,7 @@ public class ServerConfigurationManager { // CraftBukkit end } - public void b() { + public void tick() { if (++this.p > 200) { this.p = 0; } @@ -459,11 +459,11 @@ public class ServerConfigurationManager { } } - public Set e() { + public Set getBannedPlayers() { return this.banByName; } - public Set f() { + public Set getBannedAddresses() { return this.banByIP; } @@ -710,11 +710,11 @@ public class ServerConfigurationManager { entityplayer.s_(); } - public int j() { + public int getPlayerCount() { return this.players.size(); } - public int k() { + public int getMaxPlayers() { return this.maxPlayers; } } diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java index 25369365..28a8b03a 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -99,7 +99,7 @@ public final class SpawnerCreature { float f1 = (float) i3; float f2 = (float) j3 + 0.5F; - if (world.a((double) f, (double) f1, (double) f2, 24.0D) == null) { + if (world.findNearbyPlayer((double) f, (double) f1, (double) f2, 24.0D) == null) { float f3 = f - (float) chunkcoordinates.x; float f4 = f1 - (float) chunkcoordinates.y; float f5 = f2 - (float) chunkcoordinates.z; diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java index a81d7dd4..bceb9d77 100644 --- a/src/main/java/net/minecraft/server/TileEntityChest.java +++ b/src/main/java/net/minecraft/server/TileEntityChest.java @@ -67,13 +67,13 @@ public class TileEntityChest extends TileEntity implements IInventory { public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - NBTTagList nbttaglist = nbttagcompound.m("Items"); + NBTTagList nbttaglist = nbttagcompound.getList("Items"); this.items = new ItemStack[this.getSize()]; - for (int i = 0; i < nbttaglist.d(); ++i) { - NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); - int j = nbttagcompound1.d("Slot") & 255; + for (int i = 0; i < nbttaglist.size(); ++i) { + NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i); + int j = nbttagcompound1.getByte("Slot") & 255; if (j >= 0 && j < this.items.length) { this.items[j] = ItemStack.a(nbttagcompound1); @@ -89,13 +89,13 @@ public class TileEntityChest extends TileEntity implements IInventory { if (this.items[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.a("Slot", (byte) i); + nbttagcompound1.setByte("Slot", (byte) i); this.items[i].b(nbttagcompound1); - nbttaglist.a((NBTBase) nbttagcompound1); + nbttaglist.add(nbttagcompound1); } } - nbttagcompound.a("Items", (NBTBase) nbttaglist); + nbttagcompound.set("Items", nbttaglist); } public int getMaxStackSize() { diff --git a/src/main/java/net/minecraft/server/TileEntityDispenser.java b/src/main/java/net/minecraft/server/TileEntityDispenser.java index 3748e060..25c9b23c 100644 --- a/src/main/java/net/minecraft/server/TileEntityDispenser.java +++ b/src/main/java/net/minecraft/server/TileEntityDispenser.java @@ -88,13 +88,13 @@ public class TileEntityDispenser extends TileEntity implements IInventory { public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - NBTTagList nbttaglist = nbttagcompound.m("Items"); + NBTTagList nbttaglist = nbttagcompound.getList("Items"); this.items = new ItemStack[this.getSize()]; - for (int i = 0; i < nbttaglist.d(); ++i) { - NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); - int j = nbttagcompound1.d("Slot") & 255; + for (int i = 0; i < nbttaglist.size(); ++i) { + NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i); + int j = nbttagcompound1.getByte("Slot") & 255; if (j >= 0 && j < this.items.length) { this.items[j] = ItemStack.a(nbttagcompound1); @@ -110,13 +110,13 @@ public class TileEntityDispenser extends TileEntity implements IInventory { if (this.items[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.a("Slot", (byte) i); + nbttagcompound1.setByte("Slot", (byte) i); this.items[i].b(nbttagcompound1); - nbttaglist.a((NBTBase) nbttagcompound1); + nbttaglist.add(nbttagcompound1); } } - nbttagcompound.a("Items", (NBTBase) nbttaglist); + nbttagcompound.set("Items", nbttaglist); } public int getMaxStackSize() { diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java index 0eda7df8..f8a7c6fb 100644 --- a/src/main/java/net/minecraft/server/TileEntityFurnace.java +++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java @@ -64,41 +64,41 @@ public class TileEntityFurnace extends TileEntity implements IInventory { public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - NBTTagList nbttaglist = nbttagcompound.m("Items"); + NBTTagList nbttaglist = nbttagcompound.getList("Items"); this.items = new ItemStack[this.getSize()]; - for (int i = 0; i < nbttaglist.d(); ++i) { - NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); - byte b0 = nbttagcompound1.d("Slot"); + for (int i = 0; i < nbttaglist.size(); ++i) { + NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i); + byte b0 = nbttagcompound1.getByte("Slot"); if (b0 >= 0 && b0 < this.items.length) { this.items[b0] = ItemStack.a(nbttagcompound1); } } - this.burnTime = nbttagcompound.e("BurnTime"); - this.cookTime = nbttagcompound.e("CookTime"); + this.burnTime = nbttagcompound.getShort("BurnTime"); + this.cookTime = nbttagcompound.getShort("CookTime"); this.ticksForCurrentFuel = this.fuelTime(this.items[1]); } public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - nbttagcompound.a("BurnTime", (short) this.burnTime); - nbttagcompound.a("CookTime", (short) this.cookTime); + nbttagcompound.setShort("BurnTime", (short) this.burnTime); + nbttagcompound.setShort("CookTime", (short) this.cookTime); NBTTagList nbttaglist = new NBTTagList(); for (int i = 0; i < this.items.length; ++i) { if (this.items[i] != null) { NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.a("Slot", (byte) i); + nbttagcompound1.setByte("Slot", (byte) i); this.items[i].b(nbttagcompound1); - nbttaglist.a((NBTBase) nbttagcompound1); + nbttaglist.add(nbttagcompound1); } } - nbttagcompound.a("Items", (NBTBase) nbttaglist); + nbttagcompound.set("Items", nbttaglist); } public int getMaxStackSize() { diff --git a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java index 1cfb838f..94a99e74 100644 --- a/src/main/java/net/minecraft/server/TileEntityMobSpawner.java +++ b/src/main/java/net/minecraft/server/TileEntityMobSpawner.java @@ -18,7 +18,7 @@ public class TileEntityMobSpawner extends TileEntity { } public boolean c() { - return this.world.a((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D, 16.0D) != null; + return this.world.findNearbyPlayer((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D, 16.0D) != null; } // CraftBukkit start @@ -108,12 +108,12 @@ public class TileEntityMobSpawner extends TileEntity { public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); this.mobName = nbttagcompound.getString("EntityId"); - this.spawnDelay = nbttagcompound.e("Delay"); + this.spawnDelay = nbttagcompound.getShort("Delay"); } public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); nbttagcompound.setString("EntityId", this.mobName); - nbttagcompound.a("Delay", (short) this.spawnDelay); + nbttagcompound.setShort("Delay", (short) this.spawnDelay); } } diff --git a/src/main/java/net/minecraft/server/TileEntityPiston.java b/src/main/java/net/minecraft/server/TileEntityPiston.java index 7467f11f..b9675126 100644 --- a/src/main/java/net/minecraft/server/TileEntityPiston.java +++ b/src/main/java/net/minecraft/server/TileEntityPiston.java @@ -68,7 +68,7 @@ public class TileEntityPiston extends TileEntity { while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); - entity.move((double) (f1 * (float) PistonBlockTextures.b[this.c]), (double) (f1 * (float) PistonBlockTextures.c[this.c]), (double) (f1 * (float) PistonBlockTextures.d[this.c])); + entity.move((double) (f1 * (float) Facing.b[this.c]), (double) (f1 * (float) Facing.c[this.c]), (double) (f1 * (float) Facing.d[this.c])); } h.clear(); @@ -112,19 +112,19 @@ public class TileEntityPiston extends TileEntity { public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); - this.a = nbttagcompound.f("blockId"); - this.b = nbttagcompound.f("blockData"); - this.c = nbttagcompound.f("facing"); - this.g = this.f = nbttagcompound.h("progress"); - this.d = nbttagcompound.n("extending"); + this.a = nbttagcompound.getInt("blockId"); + this.b = nbttagcompound.getInt("blockData"); + this.c = nbttagcompound.getInt("facing"); + this.g = this.f = nbttagcompound.getFloat("progress"); + this.d = nbttagcompound.getBoolean("extending"); } public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); - nbttagcompound.a("blockId", this.a); - nbttagcompound.a("blockData", this.b); - nbttagcompound.a("facing", this.c); - nbttagcompound.a("progress", this.g); - nbttagcompound.a("extending", this.d); + nbttagcompound.setInt("blockId", this.a); + nbttagcompound.setInt("blockData", this.b); + nbttagcompound.setInt("facing", this.c); + nbttagcompound.setFloat("progress", this.g); + nbttagcompound.setBoolean("extending", this.d); } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index 204adaf2..805bb210 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -65,7 +65,7 @@ public class World implements IBlockAccess { public WorldProvider worldProvider; // CraftBukkit - remove final protected List z; public IChunkProvider chunkProvider; // CraftBukkit - protected -> public - protected final IDataManager B; + protected final IDataManager dataManager; public WorldData worldData; // CraftBukkit - protected -> public public boolean isLoading; private boolean Q; @@ -150,9 +150,9 @@ public class World implements IBlockAccess { this.H = new int['\u8000']; this.V = new ArrayList(); this.isStatic = false; - this.B = idatamanager; + this.dataManager = idatamanager; this.worldMaps = new WorldMapCollection(idatamanager); - this.worldData = idatamanager.c(); + this.worldData = idatamanager.getWorldData(); this.x = this.worldData == null; if (worldprovider != null) { this.worldProvider = worldprovider; @@ -184,7 +184,7 @@ public class World implements IBlockAccess { } protected IChunkProvider b() { - IChunkLoader ichunkloader = this.B.a(this.worldProvider); + IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider); return new ChunkProviderLoadOrGenerate(this, ichunkloader, this.worldProvider.getChunkProvider()); } @@ -270,7 +270,7 @@ public class World implements IBlockAccess { private void y() { this.l(); - this.B.a(this.worldData, this.players); + this.dataManager.saveWorldData(this.worldData, this.players); this.worldMaps.a(); } @@ -1691,7 +1691,7 @@ public class World implements IBlockAccess { } public void doTick() { - if (this.r().isHardcore() && this.difficulty < 3) { + if (this.getWorldData().isHardcore() && this.difficulty < 3) { this.difficulty = 3; } @@ -1912,7 +1912,7 @@ public class World implements IBlockAccess { i2 += k1; j2 += j; if (l2 == 0 && this.k(i2, k2, j2) <= this.random.nextInt(8) && this.a(EnumSkyBlock.SKY, i2, k2, j2) <= 0) { - EntityHuman entityhuman1 = this.a((double) i2 + 0.5D, (double) k2 + 0.5D, (double) j2 + 0.5D, 8.0D); + EntityHuman entityhuman1 = this.findNearbyPlayer((double) i2 + 0.5D, (double) k2 + 0.5D, (double) j2 + 0.5D, 8.0D); if (entityhuman1 != null && entityhuman1.e((double) i2 + 0.5D, (double) k2 + 0.5D, (double) j2 + 0.5D) > 4.0D) { this.makeSound((double) i2 + 0.5D, (double) k2 + 0.5D, (double) j2 + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.random.nextFloat() * 0.2F); @@ -1929,7 +1929,7 @@ public class World implements IBlockAccess { j2 = j + (l1 >> 8 & 15); k2 = this.e(i2, j2); if (this.v(i2, k2, j2)) { - this.strikeLightning(new EntityWeatherStorm(this, (double) i2, (double) k2, (double) j2)); + this.strikeLightning(new EntityWeatherLighting(this, (double) i2, (double) k2, (double) j2)); this.r = 2; } } @@ -2523,10 +2523,10 @@ public class World implements IBlockAccess { } public EntityHuman findNearbyPlayer(Entity entity, double d0) { - return this.a(entity.locX, entity.locY, entity.locZ, d0); + return this.findNearbyPlayer(entity.locX, entity.locY, entity.locZ, d0); } - public EntityHuman a(double d0, double d1, double d2, double d3) { + public EntityHuman findNearbyPlayer(double d0, double d1, double d2, double d3) { double d4 = -1.0D; EntityHuman entityhuman = null; @@ -2548,11 +2548,11 @@ public class World implements IBlockAccess { return entityhuman; } - public EntityHuman b(Entity entity, double d0) { - return this.b(entity.locX, entity.locY, entity.locZ, d0); + public EntityHuman findNearbyVulnerablePlayer(Entity entity, double d0) { + return this.findNearbyVulnerablePlayer(entity.locX, entity.locY, entity.locZ, d0); } - public EntityHuman b(double d0, double d1, double d2, double d3) { + public EntityHuman findNearbyVulnerablePlayer(double d0, double d1, double d2, double d3) { double d4 = -1.0D; EntityHuman entityhuman = null; @@ -2632,7 +2632,7 @@ public class World implements IBlockAccess { } public void l() { - this.B.b(); + this.dataManager.checkSession(); } public void setTime(long i) { @@ -2681,11 +2681,11 @@ public class World implements IBlockAccess { } } - public IDataManager q() { - return this.B; + public IDataManager getDataManager() { + return this.dataManager; } - public WorldData r() { + public WorldData getWorldData() { return this.worldData; } @@ -2811,13 +2811,13 @@ public class World implements IBlockAccess { } public Random w(int i, int j, int k) { - long l = (long) i * 341873128712L + (long) j * 132897987541L + this.r().getSeed() + (long) k; + long l = (long) i * 341873128712L + (long) j * 132897987541L + this.getWorldData().getSeed() + (long) k; this.random.setSeed(l); return this.random; } - public boolean x() { + public boolean updateLights() { return false; } @@ -2835,7 +2835,7 @@ public class World implements IBlockAccess { // CraftBukkit start public UUID getUUID() { - return this.B.getUUID(); + return this.dataManager.getUUID(); } // CraftBukkit end } diff --git a/src/main/java/net/minecraft/server/WorldData.java b/src/main/java/net/minecraft/server/WorldData.java index c6b2e03a..5429aabe 100644 --- a/src/main/java/net/minecraft/server/WorldData.java +++ b/src/main/java/net/minecraft/server/WorldData.java @@ -25,29 +25,29 @@ public class WorldData { public WorldData(NBTTagCompound nbttagcompound) { this.seed = nbttagcompound.getLong("RandomSeed"); - this.gameType = nbttagcompound.f("GameType"); + this.gameType = nbttagcompound.getInt("GameType"); if (nbttagcompound.hasKey("MapFeatures")) { - this.useMapFeatures = nbttagcompound.n("MapFeatures"); + this.useMapFeatures = nbttagcompound.getBoolean("MapFeatures"); } else { this.useMapFeatures = true; } - this.spawnX = nbttagcompound.f("SpawnX"); - this.spawnY = nbttagcompound.f("SpawnY"); - this.spawnZ = nbttagcompound.f("SpawnZ"); + this.spawnX = nbttagcompound.getInt("SpawnX"); + this.spawnY = nbttagcompound.getInt("SpawnY"); + this.spawnZ = nbttagcompound.getInt("SpawnZ"); this.time = nbttagcompound.getLong("Time"); this.lastPlayed = nbttagcompound.getLong("LastPlayed"); this.sizeOnDisk = nbttagcompound.getLong("SizeOnDisk"); this.name = nbttagcompound.getString("LevelName"); - this.version = nbttagcompound.f("version"); - this.rainTicks = nbttagcompound.f("rainTime"); - this.isRaining = nbttagcompound.n("raining"); - this.thunderTicks = nbttagcompound.f("thunderTime"); - this.isThundering = nbttagcompound.n("thundering"); - this.hardcore = nbttagcompound.n("hardcore"); + this.version = nbttagcompound.getInt("version"); + this.rainTicks = nbttagcompound.getInt("rainTime"); + this.isRaining = nbttagcompound.getBoolean("raining"); + this.thunderTicks = nbttagcompound.getInt("thunderTime"); + this.isThundering = nbttagcompound.getBoolean("thundering"); + this.hardcore = nbttagcompound.getBoolean("hardcore"); if (nbttagcompound.hasKey("Player")) { - this.playerData = nbttagcompound.l("Player"); - this.dimension = this.playerData.f("Dimension"); + this.playerData = nbttagcompound.getCompound("Player"); + this.dimension = this.playerData.getInt("Dimension"); } } @@ -107,23 +107,23 @@ public class WorldData { private void a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) { nbttagcompound.setLong("RandomSeed", this.seed); - nbttagcompound.a("GameType", this.gameType); - nbttagcompound.a("MapFeatures", this.useMapFeatures); - nbttagcompound.a("SpawnX", this.spawnX); - nbttagcompound.a("SpawnY", this.spawnY); - nbttagcompound.a("SpawnZ", this.spawnZ); + nbttagcompound.setInt("GameType", this.gameType); + nbttagcompound.setBoolean("MapFeatures", this.useMapFeatures); + nbttagcompound.setInt("SpawnX", this.spawnX); + nbttagcompound.setInt("SpawnY", this.spawnY); + nbttagcompound.setInt("SpawnZ", this.spawnZ); nbttagcompound.setLong("Time", this.time); nbttagcompound.setLong("SizeOnDisk", this.sizeOnDisk); nbttagcompound.setLong("LastPlayed", System.currentTimeMillis()); nbttagcompound.setString("LevelName", this.name); - nbttagcompound.a("version", this.version); - nbttagcompound.a("rainTime", this.rainTicks); - nbttagcompound.a("raining", this.isRaining); - nbttagcompound.a("thunderTime", this.thunderTicks); - nbttagcompound.a("thundering", this.isThundering); - nbttagcompound.a("hardcore", this.hardcore); + nbttagcompound.setInt("version", this.version); + nbttagcompound.setInt("rainTime", this.rainTicks); + nbttagcompound.setBoolean("raining", this.isRaining); + nbttagcompound.setInt("thunderTime", this.thunderTicks); + nbttagcompound.setBoolean("thundering", this.isThundering); + nbttagcompound.setBoolean("hardcore", this.hardcore); if (nbttagcompound1 != null) { - nbttagcompound.a("Player", nbttagcompound1); + nbttagcompound.setCompound("Player", nbttagcompound1); } } diff --git a/src/main/java/net/minecraft/server/WorldManager.java b/src/main/java/net/minecraft/server/WorldManager.java index 5bfb7d44..74131332 100644 --- a/src/main/java/net/minecraft/server/WorldManager.java +++ b/src/main/java/net/minecraft/server/WorldManager.java @@ -35,6 +35,6 @@ public class WorldManager implements IWorldAccess { } public void a(EntityHuman entityhuman, int i, int j, int k, int l, int i1) { - this.server.serverConfigurationManager.sendPacketNearby(entityhuman, (double) j, (double) k, (double) l, 64.0D, this.world.dimension, new Packet61(i, j, k, l, i1)); // CraftBukkit + this.server.serverConfigurationManager.sendPacketNearby(entityhuman, (double) j, (double) k, (double) l, 64.0D, this.world.dimension, new Packet61WorldEvent(i, j, k, l, i1)); // CraftBukkit } } diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java index 344f954a..08914204 100644 --- a/src/main/java/net/minecraft/server/WorldMap.java +++ b/src/main/java/net/minecraft/server/WorldMap.java @@ -16,15 +16,15 @@ import org.bukkit.craftbukkit.map.CraftMapView; public class WorldMap extends WorldMapBase { - public int b; - public int c; + public int centerX; + public int centerZ; public byte map; - public byte e; - public byte[] f = new byte[16384]; + public byte scale; + public byte[] colors = new byte[16384]; public int g; public List h = new ArrayList(); private Map j = new HashMap(); - public List i = new ArrayList(); + public List decorations = new ArrayList(); // CraftBukkit start public final CraftMapView mapView; @@ -42,7 +42,7 @@ public class WorldMap extends WorldMapBase { public void a(NBTTagCompound nbttagcompound) { // CraftBukkit start - byte dimension = nbttagcompound.d("dimension"); + byte dimension = nbttagcompound.getByte("dimension"); if (dimension >= 10) { long least = nbttagcompound.getLong("UUIDLeast"); @@ -65,26 +65,26 @@ public class WorldMap extends WorldMapBase { this.map = dimension; // CraftBukkit end - this.b = nbttagcompound.f("xCenter"); - this.c = nbttagcompound.f("zCenter"); - this.e = nbttagcompound.d("scale"); - if (this.e < 0) { - this.e = 0; + this.centerX = nbttagcompound.getInt("xCenter"); + this.centerZ = nbttagcompound.getInt("zCenter"); + this.scale = nbttagcompound.getByte("scale"); + if (this.scale < 0) { + this.scale = 0; } - if (this.e > 4) { - this.e = 4; + if (this.scale > 4) { + this.scale = 4; } - short short1 = nbttagcompound.e("width"); - short short2 = nbttagcompound.e("height"); + short short1 = nbttagcompound.getShort("width"); + short short2 = nbttagcompound.getShort("height"); if (short1 == 128 && short2 == 128) { - this.f = nbttagcompound.k("colors"); + this.colors = nbttagcompound.getByteArray("colors"); } else { - byte[] abyte = nbttagcompound.k("colors"); + byte[] abyte = nbttagcompound.getByteArray("colors"); - this.f = new byte[16384]; + this.colors = new byte[16384]; int i = (128 - short1) / 2; int j = (128 - short2) / 2; @@ -96,7 +96,7 @@ public class WorldMap extends WorldMapBase { int j1 = i1 + i; if (j1 >= 0 || j1 < 128) { - this.f[j1 + l * 128] = abyte[i1 + k * short1]; + this.colors[j1 + l * 128] = abyte[i1 + k * short1]; } } } @@ -124,13 +124,13 @@ public class WorldMap extends WorldMapBase { } } // CraftBukkit end - nbttagcompound.a("dimension", this.map); - nbttagcompound.a("xCenter", this.b); - nbttagcompound.a("zCenter", this.c); - nbttagcompound.a("scale", this.e); - nbttagcompound.a("width", (short) 128); - nbttagcompound.a("height", (short) 128); - nbttagcompound.a("colors", this.f); + nbttagcompound.setByte("dimension", this.map); + nbttagcompound.setInt("xCenter", this.centerX); + nbttagcompound.setInt("zCenter", this.centerZ); + nbttagcompound.setByte("scale", this.scale); + nbttagcompound.setShort("width", (short) 128); + nbttagcompound.setShort("height", (short) 128); + nbttagcompound.setByteArray("colors", this.colors); } public void a(EntityHuman entityhuman, ItemStack itemstack) { @@ -141,14 +141,14 @@ public class WorldMap extends WorldMapBase { this.h.add(worldmaphumantracker); } - this.i.clear(); + this.decorations.clear(); for (int i = 0; i < this.h.size(); ++i) { WorldMapHumanTracker worldmaphumantracker1 = (WorldMapHumanTracker) this.h.get(i); if (!worldmaphumantracker1.trackee.dead && worldmaphumantracker1.trackee.inventory.c(itemstack)) { - float f = (float) (worldmaphumantracker1.trackee.locX - (double) this.b) / (float) (1 << this.e); - float f1 = (float) (worldmaphumantracker1.trackee.locZ - (double) this.c) / (float) (1 << this.e); + float f = (float) (worldmaphumantracker1.trackee.locX - (double) this.centerX) / (float) (1 << this.scale); + float f1 = (float) (worldmaphumantracker1.trackee.locZ - (double) this.centerZ) / (float) (1 << this.scale); byte b0 = 64; byte b1 = 64; @@ -166,7 +166,7 @@ public class WorldMap extends WorldMapBase { } if (worldmaphumantracker1.trackee.dimension == this.map) { - this.i.add(new WorldMapOrienter(this, b2, b3, b4, b5)); + this.decorations.add(new WorldMapDecoration(this, b2, b3, b4, b5)); } } } else { @@ -176,7 +176,7 @@ public class WorldMap extends WorldMapBase { } } - public byte[] a(ItemStack itemstack, World world, EntityHuman entityhuman) { + public byte[] getUpdatePacket(ItemStack itemstack, World world, EntityHuman entityhuman) { WorldMapHumanTracker worldmaphumantracker = (WorldMapHumanTracker) this.j.get(entityhuman); if (worldmaphumantracker == null) { @@ -188,7 +188,7 @@ public class WorldMap extends WorldMapBase { } } - public void a(int i, int j, int k) { + public void flagDirty(int i, int j, int k) { super.a(); for (int l = 0; l < this.h.size(); ++l) { diff --git a/src/main/java/net/minecraft/server/PlayerNBTManager.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java index 2941a587..934e777d 100644 --- a/src/main/java/net/minecraft/server/PlayerNBTManager.java +++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java @@ -13,25 +13,25 @@ import java.util.logging.Logger; import java.util.UUID; // CraftBukkit -public class PlayerNBTManager implements PlayerFileData, IDataManager { +public class WorldNBTStorage implements PlayerFileData, IDataManager { - private static final Logger a = Logger.getLogger("Minecraft"); - private final File b; - private final File c; - private final File d; - private final long e = System.currentTimeMillis(); + private static final Logger log = Logger.getLogger("Minecraft"); + private final File baseDir; + private final File playerDir; + private final File dataDir; + private final long sessionId = System.currentTimeMillis(); private final String f; private UUID uuid = null; // CraftBukkit - public PlayerNBTManager(File file1, String s, boolean flag) { - this.b = new File(file1, s); - this.b.mkdirs(); - this.c = new File(this.b, "players"); - this.d = new File(this.b, "data"); - this.d.mkdirs(); + public WorldNBTStorage(File file1, String s, boolean flag) { + this.baseDir = new File(file1, s); + this.baseDir.mkdirs(); + this.playerDir = new File(this.baseDir, "players"); + this.dataDir = new File(this.baseDir, "data"); + this.dataDir.mkdirs(); this.f = s; if (flag) { - this.c.mkdirs(); + this.playerDir.mkdirs(); } this.f(); @@ -39,11 +39,11 @@ public class PlayerNBTManager implements PlayerFileData, IDataManager { private void f() { try { - File file1 = new File(this.b, "session.lock"); + File file1 = new File(this.baseDir, "session.lock"); DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file1)); try { - dataoutputstream.writeLong(this.e); + dataoutputstream.writeLong(this.sessionId); } finally { dataoutputstream.close(); } @@ -53,63 +53,63 @@ public class PlayerNBTManager implements PlayerFileData, IDataManager { } } - public File a() { // CraftBukkit - prot to public. Also, hi zml2008. - return this.b; + public File getDirectory() { // CraftBukkit - prot to public. + return this.baseDir; } - public void b() { + public void checkSession() { try { - File file1 = new File(this.b, "session.lock"); + File file1 = new File(this.baseDir, "session.lock"); DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1)); try { - if (datainputstream.readLong() != this.e) { - throw new MinecraftException("The save is being accessed from another location, aborting"); + if (datainputstream.readLong() != this.sessionId) { + throw new WorldConlictException("The save is being accessed from another location, aborting"); } } finally { datainputstream.close(); } } catch (IOException ioexception) { - throw new MinecraftException("Failed to check session lock, aborting"); + throw new WorldConlictException("Failed to check session lock, aborting"); } } - public IChunkLoader a(WorldProvider worldprovider) { + public IChunkLoader createChunkLoader(WorldProvider worldprovider) { File file1; if (worldprovider instanceof WorldProviderHell) { - file1 = new File(this.b, "DIM-1"); + file1 = new File(this.baseDir, "DIM-1"); file1.mkdirs(); return new ChunkLoader(file1, true); - } else if (worldprovider instanceof WorldProviderSky) { - file1 = new File(this.b, "DIM1"); + } else if (worldprovider instanceof WorldProviderTheEnd) { + file1 = new File(this.baseDir, "DIM1"); file1.mkdirs(); return new ChunkLoader(file1, true); } else { - return new ChunkLoader(this.b, true); + return new ChunkLoader(this.baseDir, true); } } - public WorldData c() { - File file1 = new File(this.b, "level.dat"); + public WorldData getWorldData() { + File file1 = new File(this.baseDir, "level.dat"); NBTTagCompound nbttagcompound; NBTTagCompound nbttagcompound1; if (file1.exists()) { try { - nbttagcompound = CompressedStreamTools.a((InputStream) (new FileInputStream(file1))); - nbttagcompound1 = nbttagcompound.l("Data"); + nbttagcompound = NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file1))); + nbttagcompound1 = nbttagcompound.getCompound("Data"); return new WorldData(nbttagcompound1); } catch (Exception exception) { exception.printStackTrace(); } } - file1 = new File(this.b, "level.dat_old"); + file1 = new File(this.baseDir, "level.dat_old"); if (file1.exists()) { try { - nbttagcompound = CompressedStreamTools.a((InputStream) (new FileInputStream(file1))); - nbttagcompound1 = nbttagcompound.l("Data"); + nbttagcompound = NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file1))); + nbttagcompound1 = nbttagcompound.getCompound("Data"); return new WorldData(nbttagcompound1); } catch (Exception exception1) { exception1.printStackTrace(); @@ -119,18 +119,18 @@ public class PlayerNBTManager implements PlayerFileData, IDataManager { return null; } - public void a(WorldData worlddata, List list) { + public void saveWorldData(WorldData worlddata, List list) { NBTTagCompound nbttagcompound = worlddata.a(list); NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.a("Data", (NBTBase) nbttagcompound); + nbttagcompound1.set("Data", nbttagcompound); try { - File file1 = new File(this.b, "level.dat_new"); - File file2 = new File(this.b, "level.dat_old"); - File file3 = new File(this.b, "level.dat"); + File file1 = new File(this.baseDir, "level.dat_new"); + File file2 = new File(this.baseDir, "level.dat_old"); + File file3 = new File(this.baseDir, "level.dat"); - CompressedStreamTools.a(nbttagcompound1, (OutputStream) (new FileOutputStream(file1))); + NBTCompressedStreamTools.a(nbttagcompound1, (OutputStream) (new FileOutputStream(file1))); if (file2.exists()) { file2.delete(); } @@ -149,18 +149,18 @@ public class PlayerNBTManager implements PlayerFileData, IDataManager { } } - public void a(WorldData worlddata) { + public void saveWorldData(WorldData worlddata) { NBTTagCompound nbttagcompound = worlddata.a(); NBTTagCompound nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.a("Data", (NBTBase) nbttagcompound); + nbttagcompound1.set("Data", nbttagcompound); try { - File file1 = new File(this.b, "level.dat_new"); - File file2 = new File(this.b, "level.dat_old"); - File file3 = new File(this.b, "level.dat"); + File file1 = new File(this.baseDir, "level.dat_new"); + File file2 = new File(this.baseDir, "level.dat_old"); + File file3 = new File(this.baseDir, "level.dat"); - CompressedStreamTools.a(nbttagcompound1, (OutputStream) (new FileOutputStream(file1))); + NBTCompressedStreamTools.a(nbttagcompound1, (OutputStream) (new FileOutputStream(file1))); if (file2.exists()) { file2.delete(); } @@ -184,57 +184,57 @@ public class PlayerNBTManager implements PlayerFileData, IDataManager { NBTTagCompound nbttagcompound = new NBTTagCompound(); entityhuman.d(nbttagcompound); - File file1 = new File(this.c, "_tmp_.dat"); - File file2 = new File(this.c, entityhuman.name + ".dat"); + File file1 = new File(this.playerDir, "_tmp_.dat"); + File file2 = new File(this.playerDir, entityhuman.name + ".dat"); - CompressedStreamTools.a(nbttagcompound, (OutputStream) (new FileOutputStream(file1))); + NBTCompressedStreamTools.a(nbttagcompound, (OutputStream) (new FileOutputStream(file1))); if (file2.exists()) { file2.delete(); } file1.renameTo(file2); } catch (Exception exception) { - a.warning("Failed to save player data for " + entityhuman.name); + log.warning("Failed to save player data for " + entityhuman.name); } } public void b(EntityHuman entityhuman) { - NBTTagCompound nbttagcompound = this.a(entityhuman.name); + NBTTagCompound nbttagcompound = this.getPlayerData(entityhuman.name); if (nbttagcompound != null) { entityhuman.e(nbttagcompound); } } - public NBTTagCompound a(String s) { + public NBTTagCompound getPlayerData(String s) { try { - File file1 = new File(this.c, s + ".dat"); + File file1 = new File(this.playerDir, s + ".dat"); if (file1.exists()) { - return CompressedStreamTools.a((InputStream) (new FileInputStream(file1))); + return NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file1))); } } catch (Exception exception) { - a.warning("Failed to load player data for " + s); + log.warning("Failed to load player data for " + s); } return null; } - public PlayerFileData d() { + public PlayerFileData getPlayerFileData() { return this; } public void e() {} - public File b(String s) { - return new File(this.d, s + ".dat"); + public File getDataFile(String s) { + return new File(this.dataDir, s + ".dat"); } // CraftBukkit start public UUID getUUID() { if (uuid != null) return uuid; try { - File file1 = new File(this.b, "uid.dat"); + File file1 = new File(this.baseDir, "uid.dat"); if (!file1.exists()) { DataOutputStream dos = new DataOutputStream(new FileOutputStream(file1)); uuid = UUID.randomUUID(); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index 66b1cb38..8e333e1e 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -20,7 +20,7 @@ public class WorldServer extends World implements BlockChangeDelegate { public boolean weirdIsOpCache = false; public boolean savingDisabled; public final MinecraftServer server; // CraftBukkit - private -> public final - private EntityList N = new EntityList(); + private IntHashMap N = new IntHashMap(); // CraftBukkit start - change signature public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, String s, int i, WorldSettings worldsettings, org.bukkit.World.Environment env, ChunkGenerator gen) { @@ -110,7 +110,7 @@ public class WorldServer extends World implements BlockChangeDelegate { } protected IChunkProvider b() { - IChunkLoader ichunkloader = this.B.a(this.worldProvider); + IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider); // CraftBukkit start InternalChunkGenerator gen; @@ -119,7 +119,7 @@ public class WorldServer extends World implements BlockChangeDelegate { gen = new CustomChunkGenerator(this, this.getSeed(), this.generator); } else if (this.worldProvider instanceof WorldProviderHell) { gen = new NetherChunkGenerator(this, this.getSeed()); - } else if (this.worldProvider instanceof WorldProviderSky) { + } else if (this.worldProvider instanceof WorldProviderTheEnd) { gen = new SkyLandsChunkGenerator(this, this.getSeed()); } else { gen = new NormalChunkGenerator(this, this.getSeed()); @@ -235,7 +235,7 @@ public class WorldServer extends World implements BlockChangeDelegate { } public void saveLevel() { - this.B.e(); + this.dataManager.e(); } protected void i() { |