Updated to use mc-dev rename revision 1

This commit is contained in:
Nathan Adams 2011-11-29 23:17:43 +00:00
parent 8665161eaa
commit 8fbe78a2c3
117 changed files with 907 additions and 1161 deletions

View File

@ -51,7 +51,7 @@
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>minecraft-server</artifactId> <artifactId>minecraft-server</artifactId>
<version>1.9.RC1</version> <version>1.0.0_01</version>
<type>jar</type> <type>jar</type>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

View File

@ -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 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_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 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 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 BlockThin(102, 49, 148, Material.SHATTERABLE, false)).c(0.3F).a(j).a("thinGlass"); 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 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 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(); 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; 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) {} public void remove(World world, int i, int j, int k) {}
@ -309,7 +309,7 @@ public class Block {
return 1; return 1;
} }
public int a(int i, Random random, int j) { public int getDropType(int i, Random random, int j) {
return this.id; 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) { public void dropNaturally(World world, int i, int j, int k, int l, float f, int i1) {
if (!world.isStatic) { if (!world.isStatic) {
int j1 = this.a(i1, world.random); int j1 = this.getDropCount(i1, world.random);
for (int k1 = 0; k1 < j1; ++k1) { for (int k1 = 0; k1 < j1; ++k1) {
// CraftBukkit - <= to < to allow for plugins to completely disable block drops from explosions // CraftBukkit - <= to < to allow for plugins to completely disable block drops from explosions
if (world.random.nextFloat() < f) { if (world.random.nextFloat() < f) {
int l1 = this.a(l, world.random, i1); int l1 = this.getDropType(l, world.random, i1);
if (l1 > 0) { 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; return 0;
} }
@ -360,7 +360,7 @@ public class Block {
} }
public MovingObjectPosition a(World world, int i, int j, int k, Vec3D vec3d, Vec3D vec3d1) { 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)); vec3d = vec3d.add((double) (-i), (double) (-j), (double) (-k));
vec3d1 = vec3d1.add((double) (-i), (double) (-j), (double) (-k)); vec3d1 = vec3d1.add((double) (-i), (double) (-j), (double) (-k));
Vec3D vec3d2 = vec3d.a(vec3d1, this.minX); 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(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) { public boolean a(IBlockAccess iblockaccess, int i, int j, int k, int l) {
return false; return false;
@ -510,14 +510,14 @@ public class Block {
public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) { public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) {
entityhuman.a(StatisticList.C[this.id], 1); entityhuman.a(StatisticList.C[this.id], 1);
entityhuman.c(0.025F); 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); ItemStack itemstack = this.a_(l);
if (itemstack != null) { if (itemstack != null) {
this.a(world, i, j, k, itemstack); this.a(world, i, j, k, itemstack);
} }
} else { } else {
int i1 = EnchantmentManager.e(entityhuman.inventory); int i1 = EnchantmentManager.getBonusBlockLootEnchantmentLevel(entityhuman.inventory);
this.b(world, i, j, k, l, i1); this.b(world, i, j, k, l, i1);
} }
@ -533,7 +533,7 @@ public class Block {
return new ItemStack(this.id, 1, j); 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); return this.a(random);
} }
@ -549,7 +549,7 @@ public class Block {
} }
public String m() { public String m() {
return StatisticCollector.a(this.n() + ".name"); return LocaleI18n.a(this.n() + ".name");
} }
public String n() { public String n() {
@ -573,8 +573,8 @@ public class Block {
static { static {
Item.byId[WOOL.id] = (new ItemCloth(WOOL.id - 256)).a("cloth"); 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[LOG.id] = (new ItemWithAuxData(LOG.id - 256, LOG)).a("log");
Item.byId[SMOOTH_BRICK.id] = (new ItemLog(SMOOTH_BRICK.id - 256, SMOOTH_BRICK)).a("stonebricksmooth"); 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[STEP.id] = (new ItemStep(STEP.id - 256)).a("stoneSlab");
Item.byId[SAPLING.id] = (new ItemSapling(SAPLING.id - 256)).a("sapling"); Item.byId[SAPLING.id] = (new ItemSapling(SAPLING.id - 256)).a("sapling");
Item.byId[LEAVES.id] = (new ItemLeaves(LEAVES.id - 256)).a("leaves"); 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[WATER_LILY.id] = new ItemWaterLily(WATER_LILY.id - 256);
Item.byId[PISTON.id] = new ItemPiston(PISTON.id - 256); Item.byId[PISTON.id] = new ItemPiston(PISTON.id - 256);
Item.byId[PISTON_STICKY.id] = new ItemPiston(PISTON_STICKY.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_1.id] = new ItemWithAuxData(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_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 Item.byId[MOB_SPAWNER.id] = new ItemMobSpawner(MOB_SPAWNER.id - 256); // CraftBukkit
for (int i = 0; i < 256; ++i) { for (int i = 0; i < 256; ++i) {

View File

@ -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 l = iblockaccess.getData(i, j, k);
int i1 = l & 7; int i1 = l & 7;
boolean flag = (l & 8) > 0; boolean flag = (l & 8) > 0;

View File

@ -21,12 +21,12 @@ public class BlockDispenser extends BlockContainer {
return 4; return 4;
} }
public int a(int i, Random random, int j) { public int getDropType(int i, Random random, int j) {
return Block.DISPENSER.id; return Block.DISPENSER.id;
} }
public void a(World world, int i, int j, int k) { public void onPlace(World world, int i, int j, int k) {
super.a(world, i, j, k); super.onPlace(world, i, j, k);
this.g(world, i, j, k); this.g(world, i, j, k);
} }

View File

@ -55,11 +55,11 @@ public class BlockDoor extends Block {
} }
public AxisAlignedBB e(World world, int i, int j, int k) { 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); 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))); 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); 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) { 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); return super.a(world, i, j, k, vec3d, vec3d1);
} }

View File

@ -8,7 +8,7 @@ public class BlockDragonEgg extends Block {
super(i, j, Material.DRAGON_EGG); 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()); 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)) { if (!BlockSand.instaFall && world.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
// CraftBukkit - added data // 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 { } else {
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);

View File

@ -65,7 +65,7 @@ public class BlockFire extends Block {
public void a(World world, int i, int j, int k, Random random) { public void a(World world, int i, int j, int k, Random random) {
boolean flag = world.getTypeId(i, j - 1, k) == Block.NETHERRACK.id; 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; 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.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)) { if (!world.e(i, j - 1, k) && !this.g(world, i, j, k)) {
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);

View File

@ -298,8 +298,8 @@ public class BlockFlowing extends BlockFluids {
return material == this.material ? false : (material == Material.LAVA ? false : !this.k(world, i, j, k)); 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) { public void onPlace(World world, int i, int j, int k) {
super.a(world, i, j, k); super.onPlace(world, i, j, k);
if (world.getTypeId(i, j, k) == this.id) { if (world.getTypeId(i, j, k) == this.id) {
world.c(i, j, k, this.id, this.d()); world.c(i, j, k, this.id, this.d());
} }

View File

@ -60,7 +60,7 @@ public class BlockGrass extends Block {
} }
} }
public int a(int i, Random random, int j) { public int getDropType(int i, Random random, int j) {
return Block.DIRT.a(0, random, j); return Block.DIRT.getDropType(0, random, j);
} }
} }

View File

@ -8,7 +8,7 @@ public class BlockGravel extends BlockSand {
super(i, j); 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 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; return random.nextInt(10 - j * 3) == 0 ? Item.FLINT.id : this.id;
} }

View File

@ -3,7 +3,7 @@ package net.minecraft.server;
import java.util.Random; import java.util.Random;
import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.event.CraftEventFactory;
public class BlockIce extends BlockBreakable { public class BlockIce extends BlockHalfTransparant {
public BlockIce(int i, int j) { public BlockIce(int i, int j) {
super(i, j, Material.ICE, false); super(i, j, Material.ICE, false);

View File

@ -4,7 +4,7 @@ import java.util.Random;
import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit import org.bukkit.event.block.LeavesDecayEvent; // CraftBukkit
public class BlockLeaves extends BlockLeavesBase { public class BlockLeaves extends BlockTransparant {
private int c; private int c;
int[] a; int[] a;
@ -134,7 +134,7 @@ public class BlockLeaves extends BlockLeavesBase {
return random.nextInt(20) == 0 ? 1 : 0; 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; 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; return i & 3;
} }

View File

@ -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; int l = iblockaccess.getData(i, j, k) & 7;
float f = 0.1875F; float f = 0.1875F;

View File

@ -12,7 +12,7 @@ public class BlockMobSpawner extends BlockContainer {
return new TileEntityMobSpawner(); 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 return Block.MOB_SPAWNER.id; // CraftBukkit
} }
@ -35,7 +35,7 @@ public class BlockMobSpawner extends BlockContainer {
super.remove(world, i, j, k); super.remove(world, i, j, k);
} }
protected int c(int i) { protected int getDropData(int i) {
return i; return i;
} }
// CraftBukkit end // CraftBukkit end

View File

@ -23,7 +23,7 @@ public class BlockPiston extends Block {
public int a(int i, int j) { public int a(int i, int j) {
int k = d(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() { 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) { if (!world.isStatic && world.getTileEntity(i, j, k) == null && !b) {
this.g(world, i, j, k); this.g(world, i, j, k);
} }
@ -114,7 +114,7 @@ public class BlockPiston extends Block {
world.setRawData(i, j, k, i1); world.setRawData(i, j, k, i1);
} }
} else if (l == 1) { } 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) { if (tileentity != null && tileentity instanceof TileEntityPiston) {
((TileEntityPiston) tileentity).g(); ((TileEntityPiston) tileentity).g();
@ -123,9 +123,9 @@ public class BlockPiston extends Block {
world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, i1); world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, i1);
world.setTileEntity(i, j, k, BlockPistonMoving.a(this.id, i1, i1, false, true)); world.setTileEntity(i, j, k, BlockPistonMoving.a(this.id, i1, i1, false, true));
if (this.a) { if (this.a) {
int j1 = i + PistonBlockTextures.b[i1] * 2; int j1 = i + Facing.b[i1] * 2;
int k1 = j + PistonBlockTextures.c[i1] * 2; int k1 = j + Facing.c[i1] * 2;
int l1 = k + PistonBlockTextures.d[i1] * 2; int l1 = k + Facing.d[i1] * 2;
int i2 = world.getTypeId(j1, k1, l1); int i2 = world.getTypeId(j1, k1, l1);
int j2 = world.getData(j1, k1, l1); int j2 = world.getData(j1, k1, l1);
boolean flag = false; 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)) { 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]; i += Facing.b[i1];
j += PistonBlockTextures.c[i1]; j += Facing.c[i1];
k += PistonBlockTextures.d[i1]; k += Facing.d[i1];
world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, j2); world.setRawTypeIdAndData(i, j, k, Block.PISTON_MOVING.id, j2);
world.setTileEntity(i, j, k, BlockPistonMoving.a(i2, j2, i1, false, false)); world.setTileEntity(i, j, k, BlockPistonMoving.a(i2, j2, i1, false, false));
b = false; b = false;
@ -156,12 +156,12 @@ public class BlockPiston extends Block {
b = true; b = true;
} else if (!flag) { } else if (!flag) {
b = false; 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; b = true;
} }
} else { } else {
b = false; 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; b = true;
} }
@ -171,7 +171,7 @@ public class BlockPiston extends Block {
b = false; 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); int l = iblockaccess.getData(i, j, k);
if (e(l)) { if (e(l)) {
@ -269,9 +269,9 @@ public class BlockPiston extends Block {
// CraftBukkkit boolean -> int // CraftBukkkit boolean -> int
private static int g(World world, int i, int j, int k, int l) { private static int g(World world, int i, int j, int k, int l) {
int i1 = i + PistonBlockTextures.b[l]; int i1 = i + Facing.b[l];
int j1 = j + PistonBlockTextures.c[l]; int j1 = j + Facing.c[l];
int k1 = k + PistonBlockTextures.d[l]; int k1 = k + Facing.d[l];
int l1 = 0; int l1 = 0;
while (true) { while (true) {
@ -292,9 +292,9 @@ public class BlockPiston extends Block {
return -1; // CraftBukkit return -1; // CraftBukkit
} }
i1 += PistonBlockTextures.b[l]; i1 += Facing.b[l];
j1 += PistonBlockTextures.c[l]; j1 += Facing.c[l];
k1 += PistonBlockTextures.d[l]; k1 += Facing.d[l];
++l1; ++l1;
continue; continue;
} }
@ -306,9 +306,9 @@ public class BlockPiston extends Block {
} }
private boolean h(World world, int i, int j, int k, int l) { private boolean h(World world, int i, int j, int k, int l) {
int i1 = i + PistonBlockTextures.b[l]; int i1 = i + Facing.b[l];
int j1 = j + PistonBlockTextures.c[l]; int j1 = j + Facing.c[l];
int k1 = k + PistonBlockTextures.d[l]; int k1 = k + Facing.d[l];
int l1 = 0; int l1 = 0;
while (true) { while (true) {
@ -330,9 +330,9 @@ public class BlockPiston extends Block {
return false; return false;
} }
i1 += PistonBlockTextures.b[l]; i1 += Facing.b[l];
j1 += PistonBlockTextures.c[l]; j1 += Facing.c[l];
k1 += PistonBlockTextures.d[l]; k1 += Facing.d[l];
++l1; ++l1;
continue; continue;
} }
@ -343,9 +343,9 @@ public class BlockPiston extends Block {
} }
while (i1 != i || j1 != j || k1 != k) { while (i1 != i || j1 != j || k1 != k) {
l1 = i1 - PistonBlockTextures.b[l]; l1 = i1 - Facing.b[l];
i2 = j1 - PistonBlockTextures.c[l]; i2 = j1 - Facing.c[l];
int j2 = k1 - PistonBlockTextures.d[l]; int j2 = k1 - Facing.d[l];
int k2 = world.getTypeId(l1, i2, j2); int k2 = world.getTypeId(l1, i2, j2);
int l2 = world.getData(l1, i2, j2); int l2 = world.getData(l1, i2, j2);

View File

@ -17,11 +17,11 @@ public class BlockPistonExtension extends Block {
super.remove(world, i, j, k); super.remove(world, i, j, k);
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
if (l > 5 || l < 0) return; // CraftBukkit - fixed a piston AIOOBE issue. 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]; i += Facing.b[i1];
j += PistonBlockTextures.c[i1]; j += Facing.c[i1];
k += PistonBlockTextures.d[i1]; k += Facing.d[i1];
int j1 = world.getTypeId(i, j, k); int j1 = world.getTypeId(i, j, k);
if (j1 == Block.PISTON.id || j1 == Block.PISTON_STICKY.id) { 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) { public int a(int i, int j) {
int k = b(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() { 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); 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); int l = iblockaccess.getData(i, j, k);
switch (b(l)) { 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) { public void doPhysics(World world, int i, int j, int k, int l) {
int i1 = b(world.getData(i, j, k)); int i1 = b(world.getData(i, j, k));
if (i1 > 5 || i1 < 0) return; // CraftBukkit - fixed a piston AIOOBE issue. 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) { if (j1 != Block.PISTON.id && j1 != Block.PISTON_STICKY.id) {
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);
} else { } 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);
} }
} }

View File

@ -7,7 +7,7 @@ import org.bukkit.event.entity.EntityPortalEnterEvent;
import org.bukkit.event.world.PortalCreateEvent; import org.bukkit.event.world.PortalCreateEvent;
// CraftBukkit end // CraftBukkit end
public class BlockPortal extends BlockBreakable { public class BlockPortal extends BlockHalfTransparant {
public BlockPortal(int i, int j) { public BlockPortal(int i, int j) {
super(i, j, Material.PORTAL, false); super(i, j, Material.PORTAL, false);
@ -17,7 +17,7 @@ public class BlockPortal extends BlockBreakable {
return null; 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 f;
float f1; float f1;

View File

@ -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; 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) { public void doPhysics(World world, int i, int j, int k, int l) {
boolean flag = false; boolean flag = false;
@ -159,7 +159,7 @@ public class BlockPressurePlate extends Block {
super.remove(world, i, j, k); 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; boolean flag = iblockaccess.getData(i, j, k) == 1;
float f = 0.0625F; float f = 0.0625F;

View File

@ -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)); 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) { public void onPlace(World world, int i, int j, int k) {
super.a(world, i, j, 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.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 if (!world.isStatic && world.getServer().getServer().spawnAnimals) { // CraftBukkit - make snowmen obey spawning rules
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);

View File

@ -46,9 +46,9 @@ public class BlockRedstoneTorch extends BlockTorch {
return 2; 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) { if (world.getData(i, j, k) == 0) {
super.a(world, i, j, k); super.onPlace(world, i, j, k);
} }
if (this.isOn) { if (this.isOn) {
@ -152,7 +152,7 @@ public class BlockRedstoneTorch extends BlockTorch {
return l == 0 ? this.a(world, i, j, k, l) : false; 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; return Block.REDSTONE_TORCH_ON.id;
} }

View File

@ -195,8 +195,8 @@ public class BlockRedstoneWire extends Block {
} }
} }
public void a(World world, int i, int j, int k) { public void onPlace(World world, int i, int j, int k) {
super.a(world, i, j, k); super.onPlace(world, i, j, k);
if (!world.isStatic) { if (!world.isStatic) {
this.g(world, i, j, k); this.g(world, i, j, k);
world.applyPhysics(i, j + 1, k, this.id); 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; return Item.REDSTONE.id;
} }

View File

@ -10,7 +10,7 @@ public class BlockSand extends Block {
super(i, j, Material.SAND); 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()); 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 (!instaFall && world.a(i - b0, j - b0, k - b0, i + b0, j + b0, k + b0)) {
if (!world.isStatic) { if (!world.isStatic) {
// CraftBukkit Change call to add data // 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 { } else {
world.setTypeId(i, j, k, 0); world.setTypeId(i, j, k, 0);

View File

@ -61,7 +61,7 @@ public class BlockSapling extends BlockFlower {
// CraftBukkit end // CraftBukkit end
} }
protected int c(int i) { protected int getDropData(int i) {
return i & 3; return i & 3;
} }

View File

@ -24,7 +24,7 @@ public class BlockSign extends BlockContainer {
return null; 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) { if (!this.b) {
int l = iblockaccess.getData(i, j, k); int l = iblockaccess.getData(i, j, k);
float f = 0.28125F; 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; return Item.SIGN.id;
} }

View File

@ -25,7 +25,7 @@ public class BlockSnow extends Block {
return false; 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; int l = iblockaccess.getData(i, j, k) & 7;
float f = (float) (2 * (1 + l)) / 16.0F; float f = (float) (2 * (1 + l)) / 16.0F;
@ -66,7 +66,7 @@ public class BlockSnow extends Block {
entityhuman.a(StatisticList.C[this.id], 1); 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; return Item.SNOW_BALL.id;
} }

View File

@ -106,7 +106,7 @@ public class BlockSoil extends Block {
} }
} }
public int a(int i, Random random, int j) { public int getDropType(int i, Random random, int j) {
return Block.DIRT.a(0, random, j); return Block.DIRT.getDropType(0, random, j);
} }
} }

View File

@ -16,7 +16,7 @@ public class BlockStairs extends Block {
this.g(255); 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); 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); 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.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) { public void remove(World world, int i, int j, int k) {

View File

@ -30,11 +30,11 @@ public class BlockTrapdoor extends Block {
} }
public AxisAlignedBB e(World world, int i, int j, int k) { 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); 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)); 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) { 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); return super.a(world, i, j, k, vec3d, vec3d1);
} }

View File

@ -336,7 +336,7 @@ public class Chunk {
if (l != 0) { if (l != 0) {
if (!this.world.isStatic) { 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) { if (Block.byId[l] instanceof BlockContainer) {
@ -400,7 +400,7 @@ public class Chunk {
if (l != 0) { if (l != 0) {
if (!this.world.isStatic) { 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) { if (l > 0 && Block.byId[l] instanceof BlockContainer) {

View File

@ -6,16 +6,16 @@ public class ContainerPlayer extends Container {
public IInventory resultInventory; public IInventory resultInventory;
public boolean c; public boolean c;
public ContainerPlayer(InventoryPlayer inventoryplayer) { public ContainerPlayer(PlayerInventory playerinventory) {
this(inventoryplayer, true); this(playerinventory, true);
} }
public ContainerPlayer(InventoryPlayer inventoryplayer, boolean flag) { public ContainerPlayer(PlayerInventory playerinventory, boolean flag) {
this.craftInventory = new InventoryCrafting(this, 2, 2); this.craftInventory = new InventoryCrafting(this, 2, 2);
this.resultInventory = new InventoryCraftResult(); this.resultInventory = new InventoryCraftResult();
this.c = false; this.c = false;
this.c = flag; 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 i;
int j; int j;
@ -27,17 +27,17 @@ public class ContainerPlayer extends Container {
} }
for (i = 0; i < 4; ++i) { 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 (i = 0; i < 3; ++i) {
for (j = 0; j < 9; ++j) { 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) { 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); this.a((IInventory) this.craftInventory);

View File

@ -9,12 +9,12 @@ public class ContainerWorkbench extends Container {
private int i; private int i;
private int j; 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.c = world;
this.h = i; this.h = i;
this.i = j; this.i = j;
this.j = k; 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 l;
int i1; int i1;
@ -27,12 +27,12 @@ public class ContainerWorkbench extends Container {
for (l = 0; l < 3; ++l) { for (l = 0; l < 3; ++l) {
for (i1 = 0; i1 < 9; ++i1) { 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) { 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); this.a((IInventory) this.craftInventory);

View File

@ -10,23 +10,23 @@ import java.util.Random;
public class EnchantmentManager { public class EnchantmentManager {
private static final Random random = new Random(); private static final Random random = new Random();
private static final EnchantmentModifier1 b = new EnchantmentModifier1((EmptyClass3) null); private static final EnchantmentModifierProtection b = new EnchantmentModifierProtection((EmptyClass3) null);
private static final EnchantmentModifier2 c = new EnchantmentModifier2((EmptyClass3) null); private static final EnchantmentModifierDamage c = new EnchantmentModifierDamage((EmptyClass3) null);
public EnchantmentManager() {} 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) { if (itemstack == null) {
return 0; return 0;
} else { } else {
NBTTagList nbttaglist = itemstack.p(); NBTTagList nbttaglist = itemstack.getEnchantments();
if (nbttaglist == null) { if (nbttaglist == null) {
return 0; return 0;
} else { } else {
for (int j = 0; j < nbttaglist.d(); ++j) { for (int j = 0; j < nbttaglist.size(); ++j) {
short short1 = ((NBTTagCompound) nbttaglist.a(j)).e("id"); short short1 = ((NBTTagCompound) nbttaglist.get(j)).getShort("id");
short short2 = ((NBTTagCompound) nbttaglist.a(j)).e("lvl"); short short2 = ((NBTTagCompound) nbttaglist.get(j)).getShort("lvl");
if (short1 == i) { if (short1 == i) {
return short2; 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; int j = 0;
ItemStack[] aitemstack1 = aitemstack; ItemStack[] aitemstack1 = aitemstack;
int k = aitemstack.length; int k = aitemstack.length;
for (int l = 0; l < k; ++l) { for (int l = 0; l < k; ++l) {
ItemStack itemstack = aitemstack1[l]; ItemStack itemstack = aitemstack1[l];
int i1 = b(i, itemstack); int i1 = getEnchantmentLevel(i, itemstack);
if (i1 > j) { if (i1 > j) {
j = i1; j = i1;
@ -57,12 +57,12 @@ public class EnchantmentManager {
private static void a(EnchantmentModifier enchantmentmodifier, ItemStack itemstack) { private static void a(EnchantmentModifier enchantmentmodifier, ItemStack itemstack) {
if (itemstack != null) { if (itemstack != null) {
NBTTagList nbttaglist = itemstack.p(); NBTTagList nbttaglist = itemstack.getEnchantments();
if (nbttaglist != null) { if (nbttaglist != null) {
for (int i = 0; i < nbttaglist.d(); ++i) { for (int i = 0; i < nbttaglist.size(); ++i) {
short short1 = ((NBTTagCompound) nbttaglist.a(i)).e("id"); short short1 = ((NBTTagCompound) nbttaglist.get(i)).getShort("id");
short short2 = ((NBTTagCompound) nbttaglist.a(i)).e("lvl"); short short2 = ((NBTTagCompound) nbttaglist.get(i)).getShort("lvl");
if (Enchantment.byId[short1] != null) { if (Enchantment.byId[short1] != null) {
enchantmentmodifier.a(Enchantment.byId[short1], short2); 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.a = 0;
b.b = damagesource; b.b = damagesource;
a((EnchantmentModifier) b, inventoryplayer.armor); a((EnchantmentModifier) b, playerinventory.armor);
if (b.a > 25) { if (b.a > 25) {
b.a = 25; b.a = 25;
} }
@ -94,47 +94,47 @@ public class EnchantmentManager {
return (b.a + 1 >> 1) + random.nextInt((b.a >> 1) + 1); 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.a = 0;
c.b = entityliving; c.b = entityliving;
a((EnchantmentModifier) c, inventoryplayer.getItemInHand()); a((EnchantmentModifier) c, playerinventory.getItemInHand());
return c.a > 0 ? 1 + random.nextInt(c.a) : 0; return c.a > 0 ? 1 + random.nextInt(c.a) : 0;
} }
public static int b(InventoryPlayer inventoryplayer, EntityLiving entityliving) { public static int getKnockbackEnchantmentLevel(PlayerInventory playerinventory, EntityLiving entityliving) {
return b(Enchantment.KNOCKBACK.id, inventoryplayer.getItemInHand()); return getEnchantmentLevel(Enchantment.KNOCKBACK.id, playerinventory.getItemInHand());
} }
public static int c(InventoryPlayer inventoryplayer, EntityLiving entityliving) { public static int getFireAspectEnchantmentLevel(PlayerInventory playerinventory, EntityLiving entityliving) {
return b(Enchantment.FIRE_ASPECT.id, inventoryplayer.getItemInHand()); return getEnchantmentLevel(Enchantment.FIRE_ASPECT.id, playerinventory.getItemInHand());
} }
public static int a(InventoryPlayer inventoryplayer) { public static int getOxygenEnchantmentLevel(PlayerInventory playerinventory) {
return a(Enchantment.OXYGEN.id, inventoryplayer.armor); return getEnchantmentLevel(Enchantment.OXYGEN.id, playerinventory.armor);
} }
public static int b(InventoryPlayer inventoryplayer) { public static int getDigSpeedEnchantmentLevel(PlayerInventory playerinventory) {
return b(Enchantment.DIG_SPEED.id, inventoryplayer.getItemInHand()); return getEnchantmentLevel(Enchantment.DIG_SPEED.id, playerinventory.getItemInHand());
} }
public static int c(InventoryPlayer inventoryplayer) { public static int getDurabilityEnchantmentLevel(PlayerInventory playerinventory) {
return b(Enchantment.DURABILITY.id, inventoryplayer.getItemInHand()); return getEnchantmentLevel(Enchantment.DURABILITY.id, playerinventory.getItemInHand());
} }
public static boolean d(InventoryPlayer inventoryplayer) { public static boolean hasSilkTouchEnchantment(PlayerInventory playerinventory) {
return b(Enchantment.SILK_TOUCH.id, inventoryplayer.getItemInHand()) > 0; return getEnchantmentLevel(Enchantment.SILK_TOUCH.id, playerinventory.getItemInHand()) > 0;
} }
public static int e(InventoryPlayer inventoryplayer) { public static int getBonusBlockLootEnchantmentLevel(PlayerInventory playerinventory) {
return b(Enchantment.LOOT_BONUS_BLOCKS.id, inventoryplayer.getItemInHand()); return getEnchantmentLevel(Enchantment.LOOT_BONUS_BLOCKS.id, playerinventory.getItemInHand());
} }
public static int f(InventoryPlayer inventoryplayer) { public static int getBonusMonsterLootEnchantmentLevel(PlayerInventory playerinventory) {
return b(Enchantment.LOOT_BONUS_MOBS.id, inventoryplayer.getItemInHand()); return getEnchantmentLevel(Enchantment.LOOT_BONUS_MOBS.id, playerinventory.getItemInHand());
} }
public static boolean g(InventoryPlayer inventoryplayer) { public static boolean hasWaterWorkerEnchantment(PlayerInventory playerinventory) {
return a(Enchantment.WATER_WORKER.id, inventoryplayer.armor) > 0; return getEnchantmentLevel(Enchantment.WATER_WORKER.id, playerinventory.armor) > 0;
} }
public static int a(Random random, int i, int j, ItemStack itemstack) { public static int a(Random random, int i, int j, ItemStack itemstack) {
@ -170,11 +170,11 @@ public class EnchantmentManager {
Map map = a(l, itemstack); Map map = a(l, itemstack);
if (map != null && !map.isEmpty()) { 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 = new ArrayList();
arraylist.add(weightedrandomchoiceenchantment); arraylist.add(enchantmentinstance);
for (int i1 = l >> 1; random.nextInt(50) <= i1; i1 >>= 1) { for (int i1 = l >> 1; random.nextInt(50) <= i1; i1 >>= 1) {
Iterator iterator = map.keySet().iterator(); Iterator iterator = map.keySet().iterator();
@ -186,9 +186,9 @@ public class EnchantmentManager {
while (true) { while (true) {
if (iterator1.hasNext()) { 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; continue;
} }
@ -203,9 +203,9 @@ public class EnchantmentManager {
} }
if (!map.isEmpty()) { 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) { for (int k = 0; k < j; ++k) {
Enchantment enchantment = aenchantment[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) { for (int l = enchantment.getStartLevel(); l <= enchantment.getMaxLevel(); ++l) {
if (i >= enchantment.a(l) && i <= enchantment.b(l)) { if (i >= enchantment.a(l) && i <= enchantment.b(l)) {
if (hashmap == null) { if (hashmap == null) {
hashmap = new HashMap(); hashmap = new HashMap();
} }
hashmap.put(Integer.valueOf(enchantment.id), new WeightedRandomChoiceEnchantment(enchantment, l)); hashmap.put(Integer.valueOf(enchantment.id), new EnchantmentInstance(enchantment, l));
} }
} }
} }

View File

@ -1,17 +1,17 @@
package net.minecraft.server; package net.minecraft.server;
final class EnchantmentModifier2 implements EnchantmentModifier { final class EnchantmentModifierDamage implements EnchantmentModifier {
public int a; public int a;
public EntityLiving b; public EntityLiving b;
private EnchantmentModifier2() {} private EnchantmentModifierDamage() {}
public void a(Enchantment enchantment, int i) { public void a(Enchantment enchantment, int i) {
this.a += enchantment.a(i, this.b); this.a += enchantment.a(i, this.b);
} }
EnchantmentModifier2(EmptyClass3 emptyclass3) { EnchantmentModifierDamage(EmptyClass3 emptyclass3) {
this(); this();
} }
} }

View File

@ -1,17 +1,17 @@
package net.minecraft.server; package net.minecraft.server;
final class EnchantmentModifier1 implements EnchantmentModifier { final class EnchantmentModifierProtection implements EnchantmentModifier {
public int a; public int a;
public DamageSource b; public DamageSource b;
private EnchantmentModifier1() {} private EnchantmentModifierProtection() {}
public void a(Enchantment enchantment, int i) { public void a(Enchantment enchantment, int i) {
this.a += enchantment.a(i, this.b); this.a += enchantment.a(i, this.b);
} }
EnchantmentModifier1(EmptyClass3 emptyclass3) { EnchantmentModifierProtection(EmptyClass3 emptyclass3) {
this(); this();
} }
} }

View File

@ -55,8 +55,8 @@ public abstract class Entity {
public boolean bA; public boolean bA;
public boolean dead; public boolean dead;
public float height; public float height;
public float length;
public float width; public float width;
public float length;
public float bF; public float bF;
public float bG; public float bG;
public float fallDistance; // CraftBukkit - private -> public public float fallDistance; // CraftBukkit - private -> public
@ -72,10 +72,8 @@ public abstract class Entity {
public int ticksLived; public int ticksLived;
public int maxFireTicks; public int maxFireTicks;
public int fireTicks; // CraftBukkit - private -> public public int fireTicks; // CraftBukkit - private -> public
public int maxAirTicks; // CraftBukkit - protected -> public
protected boolean bS; protected boolean bS;
public int noDamageTicks; public int noDamageTicks;
public int airTicks;
private boolean justCreated; private boolean justCreated;
protected boolean fireProof; protected boolean fireProof;
protected DataWatcher datawatcher; protected DataWatcher datawatcher;
@ -100,8 +98,8 @@ public abstract class Entity {
this.bA = true; this.bA = true;
this.dead = false; this.dead = false;
this.height = 0.0F; this.height = 0.0F;
this.length = 0.6F; this.width = 0.6F;
this.width = 1.8F; this.length = 1.8F;
this.bF = 0.0F; this.bF = 0.0F;
this.bG = 0.0F; this.bG = 0.0F;
this.fallDistance = 0.0F; this.fallDistance = 0.0F;
@ -146,8 +144,8 @@ public abstract class Entity {
} }
protected void b(float f, float f1) { protected void b(float f, float f1) {
this.length = f; this.width = f;
this.width = f1; this.length = f1;
} }
protected void c(float f, float f1) { protected void c(float f, float f1) {
@ -186,8 +184,8 @@ public abstract class Entity {
this.locX = d0; this.locX = d0;
this.locY = d1; this.locY = d1;
this.locZ = d2; this.locZ = d2;
float f = this.length / 2.0F; float f = this.width / 2.0F;
float f1 = this.width; 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); 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); int l = this.world.getTypeId(j, k, i);
if (l > 0) { 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 f2;
float f3; float f3;
for (i = 0; (float) i < 1.0F + this.length * 20.0F; ++i) { for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) {
f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; 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); 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) { for (i = 0; (float) i < 1.0F + this.width * 20.0F; ++i) {
f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; f3 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
f2 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; 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); 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); server.getPluginManager().callEvent(combustEvent);
if (!combustEvent.isCancelled()) { if (!combustEvent.isCancelled()) {
this.j(combustEvent.getDuration()); this.setOnFire(combustEvent.getDuration());
} }
} else { } else {
// This will be called every single tick the entity is in lava, so don't throw an event. // 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; return;
} }
// CraftBukkit end - we also don't throw an event unless the object in lava is living, to save on some event calls // 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.damageEntity(DamageSource.LAVA, 4);
this.j(15); this.setOnFire(15);
} }
} }
public void j(int i) { public void setOnFire(int i) {
int j = i * 20; int j = i * 20;
if (this.fireTicks < j) { if (this.fireTicks < j) {
@ -349,7 +347,7 @@ public abstract class Entity {
} }
} }
public void aw() { public void extinguish() {
this.fireTicks = 0; this.fireTicks = 0;
} }
@ -631,11 +629,11 @@ public abstract class Entity {
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
this.j(event.getDuration()); this.setOnFire(event.getDuration());
} }
} else { } else {
// CraftBukkit end // CraftBukkit end
this.j(8); this.setOnFire(8);
} }
} }
} else if (this.fireTicks <= 0) { } else if (this.fireTicks <= 0) {
@ -699,7 +697,7 @@ public abstract class Entity {
} }
} }
public final boolean ax() { public final boolean isFireproof() {
return this.fireProof; return this.fireProof;
} }
@ -921,8 +919,8 @@ public abstract class Entity {
} }
public void d(NBTTagCompound nbttagcompound) { public void d(NBTTagCompound nbttagcompound) {
nbttagcompound.a("Pos", (NBTBase) this.a(new double[] { this.locX, this.locY + (double) this.bL, this.locZ})); nbttagcompound.set("Pos", 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("Motion", this.a(new double[] { this.motX, this.motY, this.motZ}));
// CraftBukkit start - checking for NaN pitch/yaw and resetting to zero // CraftBukkit start - checking for NaN pitch/yaw and resetting to zero
// TODO: make sure this is the best way to address this. // TODO: make sure this is the best way to address this.
@ -935,11 +933,11 @@ public abstract class Entity {
} }
// CraftBukkit end // CraftBukkit end
nbttagcompound.a("Rotation", (NBTBase) this.a(new float[] { this.yaw, this.pitch})); nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch}));
nbttagcompound.a("FallDistance", this.fallDistance); nbttagcompound.setFloat("FallDistance", this.fallDistance);
nbttagcompound.a("Fire", (short) this.fireTicks); nbttagcompound.setShort("Fire", (short) this.fireTicks);
nbttagcompound.a("Air", (short) this.getAirTicks()); nbttagcompound.setShort("Air", (short) this.getAirTicks());
nbttagcompound.a("OnGround", this.onGround); nbttagcompound.setBoolean("OnGround", this.onGround);
// CraftBukkit start // CraftBukkit start
nbttagcompound.setLong("WorldUUIDLeast", this.world.getUUID().getLeastSignificantBits()); nbttagcompound.setLong("WorldUUIDLeast", this.world.getUUID().getLeastSignificantBits());
nbttagcompound.setLong("WorldUUIDMost", this.world.getUUID().getMostSignificantBits()); nbttagcompound.setLong("WorldUUIDMost", this.world.getUUID().getMostSignificantBits());
@ -950,13 +948,13 @@ public abstract class Entity {
} }
public void e(NBTTagCompound nbttagcompound) { public void e(NBTTagCompound nbttagcompound) {
NBTTagList nbttaglist = nbttagcompound.m("Pos"); NBTTagList nbttaglist = nbttagcompound.getList("Pos");
NBTTagList nbttaglist1 = nbttagcompound.m("Motion"); NBTTagList nbttaglist1 = nbttagcompound.getList("Motion");
NBTTagList nbttaglist2 = nbttagcompound.m("Rotation"); NBTTagList nbttaglist2 = nbttagcompound.getList("Rotation");
this.motX = ((NBTTagDouble) nbttaglist1.a(0)).a; this.motX = ((NBTTagDouble) nbttaglist1.get(0)).data;
this.motY = ((NBTTagDouble) nbttaglist1.a(1)).a; this.motY = ((NBTTagDouble) nbttaglist1.get(1)).data;
this.motZ = ((NBTTagDouble) nbttaglist1.a(2)).a; this.motZ = ((NBTTagDouble) nbttaglist1.get(2)).data;
/* CraftBukkit start - moved section down /* CraftBukkit start - moved section down
if (Math.abs(this.motX) > 10.0D) { if (Math.abs(this.motX) > 10.0D) {
this.motX = 0.0D; this.motX = 0.0D;
@ -971,15 +969,15 @@ public abstract class Entity {
} }
// CraftBukkit end */ // CraftBukkit end */
this.lastX = this.bI = this.locX = ((NBTTagDouble) nbttaglist.a(0)).a; this.lastX = this.bI = this.locX = ((NBTTagDouble) nbttaglist.get(0)).data;
this.lastY = this.bJ = this.locY = ((NBTTagDouble) nbttaglist.a(1)).a; this.lastY = this.bJ = this.locY = ((NBTTagDouble) nbttaglist.get(1)).data;
this.lastZ = this.bK = this.locZ = ((NBTTagDouble) nbttaglist.a(2)).a; this.lastZ = this.bK = this.locZ = ((NBTTagDouble) nbttaglist.get(2)).data;
this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.a(0)).a; this.lastYaw = this.yaw = ((NBTTagFloat) nbttaglist2.get(0)).data;
this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.a(1)).a; this.lastPitch = this.pitch = ((NBTTagFloat) nbttaglist2.get(1)).data;
this.fallDistance = nbttagcompound.h("FallDistance"); this.fallDistance = nbttagcompound.getFloat("FallDistance");
this.fireTicks = nbttagcompound.e("Fire"); this.fireTicks = nbttagcompound.getShort("Fire");
this.setAirTicks(nbttagcompound.e("Air")); this.setAirTicks(nbttagcompound.getShort("Air"));
this.onGround = nbttagcompound.n("OnGround"); this.onGround = nbttagcompound.getBoolean("OnGround");
this.setPosition(this.locX, this.locY, this.locZ); this.setPosition(this.locX, this.locY, this.locZ);
// CraftBukkit start // CraftBukkit start
@ -1050,7 +1048,7 @@ public abstract class Entity {
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
double d0 = adouble1[j]; double d0 = adouble1[j];
nbttaglist.a((NBTBase) (new NBTTagDouble((String) null, d0))); nbttaglist.add(new NBTTagDouble((String) null, d0));
} }
return nbttaglist; return nbttaglist;
@ -1064,7 +1062,7 @@ public abstract class Entity {
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
float f = afloat1[j]; float f = afloat1[j];
nbttaglist.a((NBTBase) (new NBTTagFloat((String) null, f))); nbttaglist.add(new NBTTagFloat((String) null, f));
} }
return nbttaglist; return nbttaglist;
@ -1086,15 +1084,15 @@ public abstract class Entity {
return entityitem; return entityitem;
} }
public boolean aj() { public boolean isAlive() {
return !this.dead; return !this.dead;
} }
public boolean T() { public boolean T() {
for (int i = 0; i < 8; ++i) { 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 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 j = MathHelper.floor(this.locX + (double) f);
int k = MathHelper.floor(this.locY + (double) this.x() + (double) f1); int k = MathHelper.floor(this.locY + (double) this.x() + (double) f1);
int l = MathHelper.floor(this.locZ + (double) f2); int l = MathHelper.floor(this.locZ + (double) f2);
@ -1180,7 +1178,7 @@ public abstract class Entity {
} }
public double q() { public double q() {
return (double) this.width * 0.75D; return (double) this.length * 0.75D;
} }
public void mount(Entity entity) { public void mount(Entity entity) {
@ -1213,7 +1211,7 @@ public abstract class Entity {
} }
// CraftBukkit end // 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; this.vehicle.passenger = null;
} }
@ -1228,7 +1226,7 @@ public abstract class Entity {
this.vehicle.passenger = null; this.vehicle.passenger = null;
this.vehicle = 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 { } else {
if (this.vehicle != null) { if (this.vehicle != null) {
this.vehicle.passenger = null; this.vehicle.passenger = null;
@ -1303,10 +1301,10 @@ public abstract class Entity {
this.datawatcher.watch(1, Short.valueOf((short) i)); this.datawatcher.watch(1, Short.valueOf((short) i));
} }
public void a(EntityWeatherStorm entityweatherstorm) { public void a(EntityWeatherLighting entityweatherlighting) {
// CraftBukkit start // CraftBukkit start
final org.bukkit.entity.Entity thisBukkitEntity = this.getBukkitEntity(); 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(); final PluginManager pluginManager = Bukkit.getServer().getPluginManager();
if (thisBukkitEntity instanceof Painting) { if (thisBukkitEntity instanceof Painting) {
@ -1334,7 +1332,7 @@ public abstract class Entity {
EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8); EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8);
pluginManager.callEvent(entityCombustEvent); pluginManager.callEvent(entityCombustEvent);
if (!entityCombustEvent.isCancelled()) { if (!entityCombustEvent.isCancelled()) {
this.j(entityCombustEvent.getDuration()); this.setOnFire(entityCombustEvent.getDuration());
} }
// CraftBukkit end // CraftBukkit end
} }
@ -1433,7 +1431,7 @@ public abstract class Entity {
s = "generic"; s = "generic";
} }
return StatisticCollector.a("entity." + s + ".name"); return LocaleI18n.a("entity." + s + ".name");
} }
public Entity[] aG() { public Entity[] aG() {

View File

@ -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;
}
}

View File

@ -90,7 +90,7 @@ public class EntityArrow extends Entity {
int i = this.world.getTypeId(this.e, this.f, this.g); int i = this.world.getTypeId(this.e, this.f, this.g);
if (i > 0) { 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); 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))) { 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) { public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("xTile", (short) this.e); nbttagcompound.setShort("xTile", (short) this.e);
nbttagcompound.a("yTile", (short) this.f); nbttagcompound.setShort("yTile", (short) this.f);
nbttagcompound.a("zTile", (short) this.g); nbttagcompound.setShort("zTile", (short) this.g);
nbttagcompound.a("inTile", (byte) this.h); nbttagcompound.setByte("inTile", (byte) this.h);
nbttagcompound.a("inData", (byte) this.i); nbttagcompound.setByte("inData", (byte) this.i);
nbttagcompound.a("shake", (byte) this.shake); nbttagcompound.setByte("shake", (byte) this.shake);
nbttagcompound.a("inGround", (byte) (this.inGround ? 1 : 0)); nbttagcompound.setByte("inGround", (byte) (this.inGround ? 1 : 0));
nbttagcompound.a("player", this.fromPlayer); nbttagcompound.setBoolean("player", this.fromPlayer);
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.e = nbttagcompound.e("xTile"); this.e = nbttagcompound.getShort("xTile");
this.f = nbttagcompound.e("yTile"); this.f = nbttagcompound.getShort("yTile");
this.g = nbttagcompound.e("zTile"); this.g = nbttagcompound.getShort("zTile");
this.h = nbttagcompound.d("inTile") & 255; this.h = nbttagcompound.getByte("inTile") & 255;
this.i = nbttagcompound.d("inData") & 255; this.i = nbttagcompound.getByte("inData") & 255;
this.shake = nbttagcompound.d("shake") & 255; this.shake = nbttagcompound.getByte("shake") & 255;
this.inGround = nbttagcompound.d("inGround") == 1; this.inGround = nbttagcompound.getByte("inGround") == 1;
this.fromPlayer = nbttagcompound.n("player"); this.fromPlayer = nbttagcompound.getBoolean("player");
} }
public void a_(EntityHuman entityhuman) { public void a_(EntityHuman entityhuman) {

View File

@ -76,7 +76,7 @@ public class EntityBlaze extends EntityMonster {
} }
for (int i = 0; i < 2; ++i) { 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(); super.d();
@ -88,7 +88,7 @@ public class EntityBlaze extends EntityMonster {
this.d(entity); this.d(entity);
} else if (f < 30.0F) { } else if (f < 30.0F) {
double d0 = entity.locX - this.locX; 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; double d2 = entity.locZ - this.locZ;
if (this.attackTicks == 0) { if (this.attackTicks == 0) {
@ -112,7 +112,7 @@ public class EntityBlaze extends EntityMonster {
for (int i = 0; i < 1; ++i) { 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 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); this.world.addEntity(entitysmallfireball);
} }
} }
@ -141,7 +141,7 @@ public class EntityBlaze extends EntityMonster {
return this.A(); return this.A();
} }
protected void a(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
if (flag) { if (flag) {
// CraftBukkit start // CraftBukkit start
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();

View File

@ -48,7 +48,7 @@ public class EntityBoat extends Entity {
super(world); super(world);
this.bc = true; this.bc = true;
this.b(1.5F, 0.6F); this.b(1.5F, 0.6F);
this.height = this.width / 2.0F; this.height = this.length / 2.0F;
} }
protected boolean g_() { protected boolean g_() {
@ -87,7 +87,7 @@ public class EntityBoat extends Entity {
} }
public double q() { 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) { public boolean damageEntity(DamageSource damagesource, int i) {

View File

@ -82,7 +82,7 @@ public class EntityChicken extends EntityAnimal {
return Item.FEATHER.id; return Item.FEATHER.id;
} }
protected void a(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - whole method // CraftBukkit start - whole method
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); 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); int j = this.random.nextInt(3) + this.random.nextInt(1 + i);

View File

@ -49,7 +49,7 @@ public class EntityCow extends EntityAnimal {
return Item.LEATHER.id; return Item.LEATHER.id;
} }
protected void a(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - whole method // CraftBukkit start - whole method
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); 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); int j = this.random.nextInt(3) + this.random.nextInt(1 + i);

View File

@ -50,7 +50,7 @@ public abstract class EntityCreature extends EntityLiving {
if (this.target != null) { if (this.target != null) {
this.pathEntity = this.world.findPath(this, this.target, f); this.pathEntity = this.world.findPath(this, this.target, f);
} }
} else if (!this.target.aj()) { } else if (!this.target.isAlive()) {
// CraftBukkit start // CraftBukkit start
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED); EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), null, EntityTargetEvent.TargetReason.TARGET_DIED);
this.world.getServer().getPluginManager().callEvent(event); 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) { if (this.pathEntity != null && this.random.nextInt(100) != 0) {
// MethodProfiler.a("followpath"); // CraftBukkit -- not in production code // MethodProfiler.a("followpath"); // CraftBukkit -- not in production code
Vec3D vec3d = this.pathEntity.a(this); 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) { while (vec3d != null && vec3d.d(this.locX, vec3d.b, this.locZ) < d0 * d0) {
this.pathEntity.a(); this.pathEntity.a();

View File

@ -29,13 +29,13 @@ public class EntityCreeper extends EntityMonster {
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
if (this.datawatcher.getByte(17) == 1) { if (this.datawatcher.getByte(17) == 1) {
nbttagcompound.a("powered", true); nbttagcompound.setBoolean("powered", true);
} }
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(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) { protected void b(Entity entity, float f) {
@ -148,11 +148,11 @@ public class EntityCreeper extends EntityMonster {
this.datawatcher.watch(16, Byte.valueOf((byte) i)); this.datawatcher.watch(16, Byte.valueOf((byte) i));
} }
public void a(EntityWeatherStorm entityweatherstorm) { public void a(EntityWeatherLighting entityweatherlighting) {
super.a(entityweatherstorm); super.a(entityweatherlighting);
// CraftBukkit start // 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); this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {

View File

@ -16,7 +16,7 @@ public class EntityDamageSourceIndirect extends EntityDamageSource {
public String a(EntityHuman entityhuman) { public String a(EntityHuman entityhuman) {
// CraftBukkit start // CraftBukkit start
String source = (this.n == null) ? "Herobrine" : this.n.ad(); 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 // CraftBukkit end
} }
} }

View File

@ -37,18 +37,18 @@ public class EntityEnderman extends EntityMonster {
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.a("carried", (short) this.getCarriedId()); nbttagcompound.setShort("carried", (short) this.getCarriedId());
nbttagcompound.a("carriedData", (short) this.getCarriedData()); nbttagcompound.setShort("carriedData", (short) this.getCarriedData());
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.setCarriedId(nbttagcompound.e("carried")); this.setCarriedId(nbttagcompound.getShort("carried"));
this.setCarriedData(nbttagcompound.e("carriedData")); this.setCarriedData(nbttagcompound.getShort("carriedData"));
} }
protected Entity findTarget() { protected Entity findTarget() {
EntityHuman entityhuman = this.world.b(this, 64.0D); EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 64.0D);
if (entityhuman != null) { if (entityhuman != null) {
if (this.c(entityhuman)) { if (this.c(entityhuman)) {
@ -75,7 +75,7 @@ public class EntityEnderman extends EntityMonster {
return false; return false;
} else { } else {
Vec3D vec3d = entityhuman.d(1.0F).b(); 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(); double d0 = vec3d1.c();
vec3d1 = vec3d1.b(); vec3d1 = vec3d1.b();
@ -138,7 +138,7 @@ public class EntityEnderman extends EntityMonster {
} }
for (i = 0; i < 2; ++i) { 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) { if (this.world.e() && !this.world.isStatic) {
@ -160,7 +160,7 @@ public class EntityEnderman extends EntityMonster {
this.a(this.target, 100.0F, 100.0F); 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 != null) {
if (this.target instanceof EntityHuman && this.c((EntityHuman) this.target)) { if (this.target instanceof EntityHuman && this.c((EntityHuman) this.target)) {
this.aT = this.aU = 0.0F; this.aT = this.aU = 0.0F;
@ -190,7 +190,7 @@ public class EntityEnderman extends EntityMonster {
} }
protected boolean f(Entity entity) { 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(); vec3d = vec3d.b();
double d0 = 16.0D; double d0 = 16.0D;
@ -247,9 +247,9 @@ public class EntityEnderman extends EntityMonster {
float f = (this.random.nextFloat() - 0.5F) * 0.2F; float f = (this.random.nextFloat() - 0.5F) * 0.2F;
float f1 = (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; 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 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.width; 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.length * 2.0D; 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); 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; return Item.ENDER_PEARL.id;
} }
protected void a(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
int j = this.e(); int j = this.e();
if (j > 0) { if (j > 0) {

View File

@ -11,7 +11,7 @@ public class EntityExperienceOrb extends Entity {
public EntityExperienceOrb(World world, double d0, double d1, double d2, int i) { public EntityExperienceOrb(World world, double d0, double d1, double d2, int i) {
super(world); super(world);
this.b(0.5F, 0.5F); this.b(0.5F, 0.5F);
this.height = this.width / 2.0F; this.height = this.length / 2.0F;
this.setPosition(d0, d1, d2); this.setPosition(d0, d1, d2);
this.yaw = (float) (Math.random() * 360.0D); this.yaw = (float) (Math.random() * 360.0D);
this.motX = (double) ((float) (Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F); 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) { public EntityExperienceOrb(World world) {
super(world); super(world);
this.b(0.25F, 0.25F); this.b(0.25F, 0.25F);
this.height = this.width / 2.0F; this.height = this.length / 2.0F;
} }
protected void b() {} protected void b() {}
@ -113,15 +113,15 @@ public class EntityExperienceOrb extends Entity {
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("Health", (short) ((byte) this.d)); nbttagcompound.setShort("Health", (short) ((byte) this.d));
nbttagcompound.a("Age", (short) this.b); nbttagcompound.setShort("Age", (short) this.b);
nbttagcompound.a("Value", (short) this.value); nbttagcompound.setShort("Value", (short) this.value);
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.d = nbttagcompound.e("Health") & 255; this.d = nbttagcompound.getShort("Health") & 255;
this.b = nbttagcompound.e("Age"); this.b = nbttagcompound.getShort("Age");
this.value = nbttagcompound.e("Value"); this.value = nbttagcompound.getShort("Value");
} }
public void a_(EntityHuman entityhuman) { public void a_(EntityHuman entityhuman) {
@ -130,7 +130,7 @@ public class EntityExperienceOrb extends Entity {
entityhuman.x = 2; entityhuman.x = 2;
this.world.makeSound(this, "random.orb", 0.1F, 0.5F * ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.8F)); 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.receive(this, 1);
entityhuman.h(this.value); entityhuman.giveExp(this.value);
this.die(); this.die();
} }
} }

View File

@ -1,23 +1,23 @@
package net.minecraft.server; package net.minecraft.server;
public class EntityFallingSand extends Entity { public class EntityFallingBlock extends Entity {
public int a; public int a;
public int data; // CraftBukkit public int data; // CraftBukkit
public int b = 0; public int b = 0;
public EntityFallingSand(World world) { public EntityFallingBlock(World world) {
super(world); super(world);
} }
// CraftBukkit -- changed method signature // 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); super(world);
this.a = i; this.a = i;
this.bc = true; this.bc = true;
this.data = data; // CraftBukkit this.data = data; // CraftBukkit
this.b(0.98F, 0.98F); this.b(0.98F, 0.98F);
this.height = this.width / 2.0F; this.height = this.length / 2.0F;
this.setPosition(d0, d1, d2); this.setPosition(d0, d1, d2);
this.motX = 0.0D; this.motX = 0.0D;
this.motY = 0.0D; this.motY = 0.0D;
@ -79,12 +79,12 @@ public class EntityFallingSand extends Entity {
} }
protected void b(NBTTagCompound nbttagcompound) { protected void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("Tile", (byte) this.a); nbttagcompound.setByte("Tile", (byte) this.a);
nbttagcompound.a("Data", (byte) this.data); // CraftBukkit nbttagcompound.setByte("Data", (byte) this.data); // CraftBukkit
} }
protected void a(NBTTagCompound nbttagcompound) { protected void a(NBTTagCompound nbttagcompound) {
this.a = nbttagcompound.d("Tile") & 255; this.a = nbttagcompound.getByte("Tile") & 255;
this.data = nbttagcompound.d("Data") & 15; // CraftBukkit this.data = nbttagcompound.getByte("Data") & 15; // CraftBukkit
} }
} }

View File

@ -62,7 +62,7 @@ public class EntityFireball extends Entity {
public void w_() { public void w_() {
super.w_(); super.w_();
this.j(1); this.setOnFire(1);
if (!this.world.isStatic && (this.shooter == null || this.shooter.dead)) { if (!this.world.isStatic && (this.shooter == null || this.shooter.dead)) {
this.die(); this.die();
} }
@ -224,19 +224,19 @@ public class EntityFireball extends Entity {
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("xTile", (short) this.e); nbttagcompound.setShort("xTile", (short) this.e);
nbttagcompound.a("yTile", (short) this.f); nbttagcompound.setShort("yTile", (short) this.f);
nbttagcompound.a("zTile", (short) this.g); nbttagcompound.setShort("zTile", (short) this.g);
nbttagcompound.a("inTile", (byte) this.h); nbttagcompound.setByte("inTile", (byte) this.h);
nbttagcompound.a("inGround", (byte) (this.i ? 1 : 0)); nbttagcompound.setByte("inGround", (byte) (this.i ? 1 : 0));
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.e = nbttagcompound.e("xTile"); this.e = nbttagcompound.getShort("xTile");
this.f = nbttagcompound.e("yTile"); this.f = nbttagcompound.getShort("yTile");
this.g = nbttagcompound.e("zTile"); this.g = nbttagcompound.getShort("zTile");
this.h = nbttagcompound.d("inTile") & 255; this.h = nbttagcompound.getByte("inTile") & 255;
this.i = nbttagcompound.d("inGround") == 1; this.i = nbttagcompound.getByte("inGround") == 1;
} }
public boolean e_() { public boolean e_() {

View File

@ -105,7 +105,7 @@ public class EntityFishingHook extends Entity {
if (!this.world.isStatic) { if (!this.world.isStatic) {
ItemStack itemstack = this.owner.P(); 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.die();
this.owner.hookedFish = null; this.owner.hookedFish = null;
return; return;
@ -114,7 +114,7 @@ public class EntityFishingHook extends Entity {
if (this.c != null) { if (this.c != null) {
if (!this.c.dead) { if (!this.c.dead) {
this.locX = this.c.locX; 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; this.locZ = this.c.locZ;
return; return;
} }
@ -279,15 +279,15 @@ public class EntityFishingHook extends Entity {
int l; int l;
float f5; float f5;
for (l = 0; (float) l < 1.0F + this.length * 20.0F; ++l) { for (l = 0; (float) l < 1.0F + this.width * 20.0F; ++l) {
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; 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); 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) { for (l = 0; (float) l < 1.0F + this.width * 20.0F; ++l) {
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; f5 = (this.random.nextFloat() * 2.0F - 1.0F) * this.width;
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * this.length; 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); 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) { public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("xTile", (short) this.d); nbttagcompound.setShort("xTile", (short) this.d);
nbttagcompound.a("yTile", (short) this.e); nbttagcompound.setShort("yTile", (short) this.e);
nbttagcompound.a("zTile", (short) this.f); nbttagcompound.setShort("zTile", (short) this.f);
nbttagcompound.a("inTile", (byte) this.g); nbttagcompound.setByte("inTile", (byte) this.g);
nbttagcompound.a("shake", (byte) this.a); nbttagcompound.setByte("shake", (byte) this.a);
nbttagcompound.a("inGround", (byte) (this.h ? 1 : 0)); nbttagcompound.setByte("inGround", (byte) (this.h ? 1 : 0));
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.d = nbttagcompound.e("xTile"); this.d = nbttagcompound.getShort("xTile");
this.e = nbttagcompound.e("yTile"); this.e = nbttagcompound.getShort("yTile");
this.f = nbttagcompound.e("zTile"); this.f = nbttagcompound.getShort("zTile");
this.g = nbttagcompound.d("inTile") & 255; this.g = nbttagcompound.getByte("inTile") & 255;
this.a = nbttagcompound.d("shake") & 255; this.a = nbttagcompound.getByte("shake") & 255;
this.h = nbttagcompound.d("inGround") == 1; this.h = nbttagcompound.getByte("inGround") == 1;
} }
public int j() { public int j() {

View File

@ -101,7 +101,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
if (this.target == null || this.h-- <= 0) { if (this.target == null || this.h-- <= 0) {
// CraftBukkit start // CraftBukkit start
Entity target = this.world.b(this, 100.0D); Entity target = this.world.findNearbyVulnerablePlayer(this, 100.0D);
if (target != null) { if (target != null) {
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER); EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.CLOSEST_PLAYER);
this.world.getServer().getPluginManager().callEvent(event); 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) { if (this.target != null && this.target.i(this) < d4 * d4) {
double d5 = this.target.locX - this.locX; 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; double d7 = this.target.locZ - this.locZ;
this.V = this.yaw = -((float) Math.atan2(d5, d7)) * 180.0F / 3.1415927F; 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); Vec3D vec3d = this.d(1.0F);
entityfireball.locX = this.locX + vec3d.a * d8; 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; entityfireball.locZ = this.locZ + vec3d.c * d8;
this.world.addEntity(entityfireball); this.world.addEntity(entityfireball);
this.f = -40; this.f = -40;
@ -198,7 +198,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
return Item.SULPHUR.id; return Item.SULPHUR.id;
} }
protected void a(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start // CraftBukkit start
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); 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); int j = this.random.nextInt(2) + this.random.nextInt(1 + i);

View File

@ -20,7 +20,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
public abstract class EntityHuman extends EntityLiving { public abstract class EntityHuman extends EntityLiving {
public InventoryPlayer inventory = new InventoryPlayer(this); public PlayerInventory inventory = new PlayerInventory(this);
public Container defaultContainer; public Container defaultContainer;
public Container activeContainer; public Container activeContainer;
protected FoodMetaData foodData = new FoodMetaData(); protected FoodMetaData foodData = new FoodMetaData();
@ -56,9 +56,9 @@ public abstract class EntityHuman extends EntityLiving {
protected boolean J = false; protected boolean J = false;
public float K; public float K;
public PlayerAbilities abilities = new PlayerAbilities(); public PlayerAbilities abilities = new PlayerAbilities();
public int expLevel;
public int expTotal; public int expTotal;
public int exp; public float exp;
public float expLevel;
private ItemStack d; private ItemStack d;
private int e; private int e;
protected float P = 0.1F; protected float P = 0.1F;
@ -167,7 +167,7 @@ public abstract class EntityHuman extends EntityLiving {
} }
if (this.z() && this.abilities.isInvulnerable) { if (this.z() && this.abilities.isInvulnerable) {
this.aw(); this.extinguish();
} }
this.y = this.B; this.y = this.B;
@ -382,7 +382,7 @@ public abstract class EntityHuman extends EntityLiving {
} }
protected int f(int i) { 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); 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) { public float a(Block block) {
float f = this.inventory.a(block); float f = this.inventory.a(block);
float f1 = f; float f1 = f;
int i = EnchantmentManager.b(this.inventory); int i = EnchantmentManager.getDigSpeedEnchantmentLevel(this.inventory);
if (i > 0 && this.inventory.b(block)) { if (i > 0 && this.inventory.b(block)) {
f1 = f + (float) (i * i + 1); 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; 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; f1 /= 5.0F;
} }
@ -479,15 +479,15 @@ public abstract class EntityHuman extends EntityLiving {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
NBTTagList nbttaglist = nbttagcompound.m("Inventory"); NBTTagList nbttaglist = nbttagcompound.getList("Inventory");
this.inventory.b(nbttaglist); this.inventory.b(nbttaglist);
this.dimension = nbttagcompound.f("Dimension"); this.dimension = nbttagcompound.getInt("Dimension");
this.sleeping = nbttagcompound.n("Sleeping"); this.sleeping = nbttagcompound.getBoolean("Sleeping");
this.sleepTicks = nbttagcompound.e("SleepTimer"); this.sleepTicks = nbttagcompound.getShort("SleepTimer");
this.expLevel = nbttagcompound.h("XpP"); this.exp = nbttagcompound.getFloat("XpP");
this.expTotal = nbttagcompound.f("XpLevel"); this.expLevel = nbttagcompound.getInt("XpLevel");
this.exp = nbttagcompound.f("XpTotal"); this.expTotal = nbttagcompound.getInt("XpTotal");
if (this.sleeping) { if (this.sleeping) {
this.F = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)); this.F = new ChunkCoordinates(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ));
this.a(true, true, false); this.a(true, true, false);
@ -501,7 +501,7 @@ public abstract class EntityHuman extends EntityLiving {
// CraftBukkit end // CraftBukkit end
if (nbttagcompound.hasKey("SpawnX") && nbttagcompound.hasKey("SpawnY") && nbttagcompound.hasKey("SpawnZ")) { 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); this.foodData.a(nbttagcompound);
@ -510,17 +510,17 @@ public abstract class EntityHuman extends EntityLiving {
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.a("Inventory", (NBTBase) this.inventory.a(new NBTTagList())); nbttagcompound.set("Inventory", this.inventory.a(new NBTTagList()));
nbttagcompound.a("Dimension", this.dimension); nbttagcompound.setInt("Dimension", this.dimension);
nbttagcompound.a("Sleeping", this.sleeping); nbttagcompound.setBoolean("Sleeping", this.sleeping);
nbttagcompound.a("SleepTimer", (short) this.sleepTicks); nbttagcompound.setShort("SleepTimer", (short) this.sleepTicks);
nbttagcompound.a("XpP", this.expLevel); nbttagcompound.setFloat("XpP", this.exp);
nbttagcompound.a("XpLevel", this.expTotal); nbttagcompound.setInt("XpLevel", this.expLevel);
nbttagcompound.a("XpTotal", this.exp); nbttagcompound.setInt("XpTotal", this.expTotal);
if (this.b != null) { if (this.b != null) {
nbttagcompound.a("SpawnX", this.b.x); nbttagcompound.setInt("SpawnX", this.b.x);
nbttagcompound.a("SpawnY", this.b.y); nbttagcompound.setInt("SpawnY", this.b.y);
nbttagcompound.a("SpawnZ", this.b.z); nbttagcompound.setInt("SpawnZ", this.b.z);
nbttagcompound.setString("SpawnWorld", spawnWorld); // CraftBukkit - fixes bed spawns for multiworld worlds 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) { if (entity instanceof EntityLiving) {
k = EnchantmentManager.a(this.inventory, (EntityLiving) entity); k = EnchantmentManager.a(this.inventory, (EntityLiving) entity);
j += EnchantmentManager.b(this.inventory, (EntityLiving) entity); j += EnchantmentManager.getKnockbackEnchantmentLevel(this.inventory, (EntityLiving) entity);
} }
if (this.isSprinting()) { if (this.isSprinting()) {
@ -831,18 +831,18 @@ public abstract class EntityHuman extends EntityLiving {
} }
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
if (entity.aj()) { if (entity.isAlive()) {
this.a((EntityLiving) entity, true); this.a((EntityLiving) entity, true);
} }
this.a(StatisticList.w, i); this.a(StatisticList.w, i);
int l = EnchantmentManager.c(this.inventory, (EntityLiving) entity); int l = EnchantmentManager.getFireAspectEnchantmentLevel(this.inventory, (EntityLiving) entity);
if (l > 0) { if (l > 0) {
// CraftBukkit start - raise a combust event when somebody hits with a fire enchanted item // CraftBukkit start - raise a combust event when somebody hits with a fire enchanted item
EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), l*4); EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), l*4);
if (!combustEvent.isCancelled()) { if (!combustEvent.isCancelled()) {
entity.j(combustEvent.getDuration()); entity.setOnFire(combustEvent.getDuration());
} }
// CraftBukkit end // CraftBukkit end
} }
@ -870,22 +870,22 @@ public abstract class EntityHuman extends EntityLiving {
return !this.sleeping && super.T(); 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.world.isStatic) {
if (this.isSleeping() || !this.aj()) { if (this.isSleeping() || !this.isAlive()) {
return EnumBedError.OTHER_PROBLEM; return EnumBedResult.OTHER_PROBLEM;
} }
if (this.world.worldProvider.c) { if (this.world.worldProvider.c) {
return EnumBedError.NOT_POSSIBLE_HERE; return EnumBedResult.NOT_POSSIBLE_HERE;
} }
if (this.world.e()) { 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) { 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; 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)); 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()) { 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); this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
return EnumBedError.OTHER_PROBLEM; return EnumBedResult.OTHER_PROBLEM;
} }
} }
// CraftBukkit end // CraftBukkit end
@ -950,7 +950,7 @@ public abstract class EntityHuman extends EntityLiving {
this.world.everyoneSleeping(); this.world.everyoneSleeping();
} }
return EnumBedError.OK; return EnumBedResult.OK;
} }
private void c(int i) { 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.q += i;
this.expLevel += (float) i / (float) this.Z(); this.exp += (float) i / (float) this.getExpTolevel();
this.exp += i; this.expTotal += i;
while (this.expLevel >= 1.0F) { while (this.exp >= 1.0F) {
--this.expLevel; --this.exp;
this.D(); this.levelUp();
} }
} }
public void b(int i) { public void levelDown(int i) {
this.expTotal -= i; this.expLevel -= i;
if (this.expTotal < 0) { if (this.expLevel < 0) {
this.expTotal = 0; this.expLevel = 0;
} }
} }
public int Z() { public int getExpTolevel() {
return 7 + (this.expTotal * 7 >> 1); return 7 + (this.expLevel * 7 >> 1);
} }
private void D() { private void levelUp() {
++this.expTotal; ++this.expLevel;
} }
public void c(float f) { public void c(float f) {
@ -1248,7 +1248,7 @@ public abstract class EntityHuman extends EntityLiving {
} }
protected int a(EntityHuman entityhuman) { protected int a(EntityHuman entityhuman) {
int i = this.expTotal * 7; int i = this.expLevel * 7;
return i > 100 ? 100 : i; return i > 100 ? 100 : i;
} }
@ -1267,9 +1267,9 @@ public abstract class EntityHuman extends EntityLiving {
this.inventory.a(entityhuman.inventory); this.inventory.a(entityhuman.inventory);
this.health = entityhuman.health; this.health = entityhuman.health;
this.foodData = entityhuman.foodData; this.foodData = entityhuman.foodData;
this.expLevel = entityhuman.expLevel;
this.expTotal = entityhuman.expTotal; this.expTotal = entityhuman.expTotal;
this.exp = entityhuman.exp; this.exp = entityhuman.exp;
this.expLevel = entityhuman.expLevel;
this.q = entityhuman.q; this.q = entityhuman.q;
} }
} }

View File

@ -15,7 +15,7 @@ public class EntityItem extends Entity {
public EntityItem(World world, double d0, double d1, double d2, ItemStack itemstack) { public EntityItem(World world, double d0, double d1, double d2, ItemStack itemstack) {
super(world); super(world);
this.b(0.25F, 0.25F); this.b(0.25F, 0.25F);
this.height = this.width / 2.0F; this.height = this.length / 2.0F;
this.setPosition(d0, d1, d2); this.setPosition(d0, d1, d2);
this.itemStack = itemstack; this.itemStack = itemstack;
// CraftBukkit start - infinite item fix // CraftBukkit start - infinite item fix
@ -36,7 +36,7 @@ public class EntityItem extends Entity {
public EntityItem(World world) { public EntityItem(World world) {
super(world); super(world);
this.b(0.25F, 0.25F); this.b(0.25F, 0.25F);
this.height = this.width / 2.0F; this.height = this.length / 2.0F;
} }
protected void b() {} protected void b() {}
@ -106,15 +106,15 @@ public class EntityItem extends Entity {
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("Health", (short) ((byte) this.f)); nbttagcompound.setShort("Health", (short) ((byte) this.f));
nbttagcompound.a("Age", (short) this.b); nbttagcompound.setShort("Age", (short) this.b);
nbttagcompound.a("Item", this.itemStack.b(new NBTTagCompound())); nbttagcompound.setCompound("Item", this.itemStack.b(new NBTTagCompound()));
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.f = nbttagcompound.e("Health") & 255; this.f = nbttagcompound.getShort("Health") & 255;
this.b = nbttagcompound.e("Age"); this.b = nbttagcompound.getShort("Age");
NBTTagCompound nbttagcompound1 = nbttagcompound.l("Item"); NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Item");
this.itemStack = ItemStack.a(nbttagcompound1); this.itemStack = ItemStack.a(nbttagcompound1);
if (this.itemStack == null) { if (this.itemStack == null) {
@ -171,6 +171,6 @@ public class EntityItem extends Entity {
} }
public String ad() { public String ad() {
return StatisticCollector.a("item." + this.itemStack.k()); return LocaleI18n.a("item." + this.itemStack.k());
} }
} }

View File

@ -82,6 +82,7 @@ public abstract class EntityLiving extends Entity {
private Entity e; private Entity e;
protected int aZ = 0; protected int aZ = 0;
public int expToDrop = 0; // CraftBukkit added public int expToDrop = 0; // CraftBukkit added
public int maxAirTicks = 300; // CraftBukkit added
public EntityLiving(World world) { public EntityLiving(World world) {
super(world); super(world);
@ -110,7 +111,7 @@ public abstract class EntityLiving extends Entity {
} }
public float x() { public float x() {
return this.width * 0.85F; return this.length * 0.85F;
} }
public int h() { 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 // 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); EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), EntityDamageEvent.DamageCause.SUFFOCATION, 1);
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
@ -145,11 +146,11 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit end // CraftBukkit end
} }
if (this.ax() || this.world.isStatic) { if (this.isFireproof() || this.world.isStatic) {
this.aw(); 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())); this.setAirTicks(this.f(this.getAirTicks()));
if (this.getAirTicks() == -20) { if (this.getAirTicks() == -20) {
this.setAirTicks(0); this.setAirTicks(0);
@ -172,9 +173,9 @@ public abstract class EntityLiving extends Entity {
// CraftBukkit end // CraftBukkit end
} }
this.aw(); this.extinguish();
} else { } else {
this.setAirTicks(300); this.setAirTicks(maxAirTicks); // CraftBukkit - update maxAirTicks if no longer 300
} }
this.aw = this.ax; this.aw = this.ax;
@ -243,7 +244,7 @@ public abstract class EntityLiving extends Entity {
double d1 = this.random.nextGaussian() * 0.02D; double d1 = this.random.nextGaussian() * 0.02D;
double d2 = 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 d2 = this.random.nextGaussian() * 0.02D;
double d3 = 10.0D; 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; int i = 0;
if (entity instanceof EntityHuman) { if (entity instanceof EntityHuman) {
i = EnchantmentManager.f(((EntityHuman) entity).inventory); i = EnchantmentManager.getBonusMonsterLootEnchantmentLevel(((EntityHuman) entity).inventory);
} }
if (!this.l()) { if (!this.l()) {
this.a(this.aG > 0, i); this.dropDeathLoot(this.aG > 0, i);
} }
} }
this.world.a(this, (byte) 3); this.world.a(this, (byte) 3);
} }
protected void a(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
int j = this.e(); int j = this.e();
// CraftBukkit start - whole method // CraftBukkit start - whole method
@ -778,10 +779,10 @@ public abstract class EntityLiving extends Entity {
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("Health", (short) this.health); nbttagcompound.setShort("Health", (short) this.health);
nbttagcompound.a("HurtTime", (short) this.hurtTicks); nbttagcompound.setShort("HurtTime", (short) this.hurtTicks);
nbttagcompound.a("DeathTime", (short) this.deathTicks); nbttagcompound.setShort("DeathTime", (short) this.deathTicks);
nbttagcompound.a("AttackTime", (short) this.attackTicks); nbttagcompound.setShort("AttackTime", (short) this.attackTicks);
if (!this.effects.isEmpty()) { if (!this.effects.isEmpty()) {
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
Iterator iterator = this.effects.values().iterator(); Iterator iterator = this.effects.values().iterator();
@ -790,40 +791,40 @@ public abstract class EntityLiving extends Entity {
MobEffect mobeffect = (MobEffect) iterator.next(); MobEffect mobeffect = (MobEffect) iterator.next();
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Id", (byte) mobeffect.getEffectId()); nbttagcompound1.setByte("Id", (byte) mobeffect.getEffectId());
nbttagcompound1.a("Amplifier", (byte) mobeffect.getAmplifier()); nbttagcompound1.setByte("Amplifier", (byte) mobeffect.getAmplifier());
nbttagcompound1.a("Duration", mobeffect.getDuration()); nbttagcompound1.setInt("Duration", mobeffect.getDuration());
nbttaglist.a((NBTBase) nbttagcompound1); nbttaglist.add(nbttagcompound1);
} }
nbttagcompound.a("ActiveEffects", (NBTBase) nbttaglist); nbttagcompound.set("ActiveEffects", nbttaglist);
} }
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.health = nbttagcompound.e("Health"); this.health = nbttagcompound.getShort("Health");
if (!nbttagcompound.hasKey("Health")) { if (!nbttagcompound.hasKey("Health")) {
this.health = this.getMaxHealth(); this.health = this.getMaxHealth();
} }
this.hurtTicks = nbttagcompound.e("HurtTime"); this.hurtTicks = nbttagcompound.getShort("HurtTime");
this.deathTicks = nbttagcompound.e("DeathTime"); this.deathTicks = nbttagcompound.getShort("DeathTime");
this.attackTicks = nbttagcompound.e("AttackTime"); this.attackTicks = nbttagcompound.getShort("AttackTime");
if (nbttagcompound.hasKey("ActiveEffects")) { if (nbttagcompound.hasKey("ActiveEffects")) {
NBTTagList nbttaglist = nbttagcompound.m("ActiveEffects"); NBTTagList nbttaglist = nbttagcompound.getList("ActiveEffects");
for (int i = 0; i < nbttaglist.d(); ++i) { for (int i = 0; i < nbttaglist.size(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
byte b0 = nbttagcompound1.d("Id"); byte b0 = nbttagcompound1.getByte("Id");
byte b1 = nbttagcompound1.d("Amplifier"); byte b1 = nbttagcompound1.getByte("Amplifier");
int j = nbttagcompound1.f("Duration"); int j = nbttagcompound1.getInt("Duration");
this.effects.put(Integer.valueOf(b0), new MobEffect(b0, j, b1)); this.effects.put(Integer.valueOf(b0), new MobEffect(b0, j, b1));
} }
} }
} }
public boolean aj() { public boolean isAlive() {
return !this.dead && this.health > 0; 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 d1 = (double) (i >> 8 & 255) / 255.0D;
double d2 = (double) (i >> 0 & 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) { public boolean a(MobEffect mobeffect) {
if (this.t() == EnchantmentDamage.b) { if (this.getMonsterType() == MonsterType.UNDEAD) {
int i = mobeffect.getEffectId(); int i = mobeffect.getEffectId();
if (i == MobEffectList.REGENERATION.id || i == MobEffectList.POISON.id) { if (i == MobEffectList.REGENERATION.id || i == MobEffectList.POISON.id) {
@ -1216,7 +1217,7 @@ public abstract class EntityLiving extends Entity {
} }
public boolean at() { public boolean at() {
return this.t() == EnchantmentDamage.b; return this.getMonsterType() == MonsterType.UNDEAD;
} }
protected void b(MobEffect mobeffect) { protected void b(MobEffect mobeffect) {
@ -1253,8 +1254,8 @@ public abstract class EntityLiving extends Entity {
return false; return false;
} }
public EnchantmentDamage t() { public MonsterType getMonsterType() {
return EnchantmentDamage.a; return MonsterType.UNDEFINED;
} }
public void c(ItemStack itemstack) { public void c(ItemStack itemstack) {

View File

@ -1,8 +1,8 @@
package net.minecraft.server; package net.minecraft.server;
public class EntityLavaSlime extends EntitySlime { public class EntityMagmaCube extends EntitySlime {
public EntityLavaSlime(World world) { public EntityMagmaCube(World world) {
super(world); super(world);
this.texture = "/mob/lava.png"; this.texture = "/mob/lava.png";
this.fireProof = true; this.fireProof = true;
@ -26,7 +26,7 @@ public class EntityLavaSlime extends EntitySlime {
} }
protected EntitySlime y() { protected EntitySlime y() {
return new EntityLavaSlime(this.world); return new EntityMagmaCube(this.world);
} }
protected int e() { protected int e() {

View File

@ -53,7 +53,7 @@ public class EntityMinecart extends Entity implements IInventory {
this.f = false; this.f = false;
this.bc = true; this.bc = true;
this.b(0.98F, 0.7F); this.b(0.98F, 0.7F);
this.height = this.width / 2.0F; this.height = this.length / 2.0F;
} }
protected boolean g_() { protected boolean g_() {
@ -94,7 +94,7 @@ public class EntityMinecart extends Entity implements IInventory {
} }
public double q() { 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) { public boolean damageEntity(DamageSource damagesource, int i) {
@ -666,11 +666,11 @@ public class EntityMinecart extends Entity implements IInventory {
} }
protected void b(NBTTagCompound nbttagcompound) { protected void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("Type", this.type); nbttagcompound.setInt("Type", this.type);
if (this.type == 2) { if (this.type == 2) {
nbttagcompound.a("PushX", this.b); nbttagcompound.setDouble("PushX", this.b);
nbttagcompound.a("PushZ", this.c); nbttagcompound.setDouble("PushZ", this.c);
nbttagcompound.a("Fuel", (short) this.e); nbttagcompound.setShort("Fuel", (short) this.e);
} else if (this.type == 1) { } else if (this.type == 1) {
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
@ -678,30 +678,30 @@ public class EntityMinecart extends Entity implements IInventory {
if (this.items[i] != null) { if (this.items[i] != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Slot", (byte) i); nbttagcompound1.setByte("Slot", (byte) i);
this.items[i].b(nbttagcompound1); 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) { protected void a(NBTTagCompound nbttagcompound) {
this.type = nbttagcompound.f("Type"); this.type = nbttagcompound.getInt("Type");
if (this.type == 2) { if (this.type == 2) {
this.b = nbttagcompound.i("PushX"); this.b = nbttagcompound.getDouble("PushX");
this.c = nbttagcompound.i("PushZ"); this.c = nbttagcompound.getDouble("PushZ");
this.e = nbttagcompound.e("Fuel"); this.e = nbttagcompound.getShort("Fuel");
} else if (this.type == 1) { } else if (this.type == 1) {
NBTTagList nbttaglist = nbttagcompound.m("Items"); NBTTagList nbttaglist = nbttagcompound.getList("Items");
this.items = new ItemStack[this.getSize()]; this.items = new ItemStack[this.getSize()];
for (int i = 0; i < nbttaglist.d(); ++i) { for (int i = 0; i < nbttaglist.size(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
int j = nbttagcompound1.d("Slot") & 255; int j = nbttagcompound1.getByte("Slot") & 255;
if (j >= 0 && j < this.items.length) { if (j >= 0 && j < this.items.length) {
this.items[j] = ItemStack.a(nbttagcompound1); this.items[j] = ItemStack.a(nbttagcompound1);

View File

@ -34,7 +34,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster {
} }
protected Entity findTarget() { 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; return entityhuman != null && this.g(entityhuman) ? entityhuman : null;
} }

View File

@ -246,18 +246,18 @@ public class EntityPainting extends Entity {
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("Dir", (byte) this.a); nbttagcompound.setByte("Dir", (byte) this.a);
nbttagcompound.setString("Motive", this.e.A); nbttagcompound.setString("Motive", this.e.A);
nbttagcompound.a("TileX", this.b); nbttagcompound.setInt("TileX", this.b);
nbttagcompound.a("TileY", this.c); nbttagcompound.setInt("TileY", this.c);
nbttagcompound.a("TileZ", this.d); nbttagcompound.setInt("TileZ", this.d);
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.a = nbttagcompound.d("Dir"); this.a = nbttagcompound.getByte("Dir");
this.b = nbttagcompound.f("TileX"); this.b = nbttagcompound.getInt("TileX");
this.c = nbttagcompound.f("TileY"); this.c = nbttagcompound.getInt("TileY");
this.d = nbttagcompound.f("TileZ"); this.d = nbttagcompound.getInt("TileZ");
String s = nbttagcompound.getString("Motive"); String s = nbttagcompound.getString("Motive");
EnumArt[] aenumart = EnumArt.values(); EnumArt[] aenumart = EnumArt.values();
int i = aenumart.length; int i = aenumart.length;

View File

@ -24,12 +24,12 @@ public class EntityPig extends EntityAnimal {
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.a("Saddle", this.hasSaddle()); nbttagcompound.setBoolean("Saddle", this.hasSaddle());
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.setSaddle(nbttagcompound.n("Saddle")); this.setSaddle(nbttagcompound.getBoolean("Saddle"));
} }
protected String c_() { 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) { if (!this.world.isStatic) {
EntityPigZombie entitypigzombie = new EntityPigZombie(this.world); EntityPigZombie entitypigzombie = new EntityPigZombie(this.world);
// CraftBukkit start // 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); this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {

View File

@ -38,12 +38,12 @@ public class EntityPigZombie extends EntityZombie {
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.a("Anger", (short) this.angerLevel); nbttagcompound.setShort("Anger", (short) this.angerLevel);
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.angerLevel = nbttagcompound.e("Anger"); this.angerLevel = nbttagcompound.getShort("Anger");
} }
protected Entity findTarget() { protected Entity findTarget() {
@ -111,7 +111,7 @@ public class EntityPigZombie extends EntityZombie {
return "mob.zombiepig.zpigdeath"; return "mob.zombiepig.zpigdeath";
} }
protected void a(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start // CraftBukkit start
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int j = this.random.nextInt(2 + i); int j = this.random.nextInt(2 + i);

View File

@ -70,13 +70,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
if (nbttagcompound.hasKey("playerGameType")) { if (nbttagcompound.hasKey("playerGameType")) {
this.itemInWorldManager.a(nbttagcompound.f("playerGameType")); this.itemInWorldManager.a(nbttagcompound.getInt("playerGameType"));
} }
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.a("playerGameType", this.itemInWorldManager.a()); nbttagcompound.setInt("playerGameType", this.itemInWorldManager.a());
} }
public void spawnIn(World world) { public void spawnIn(World world) {
@ -107,8 +107,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
// CraftBukkit end // CraftBukkit end
} }
public void b(int i) { public void levelDown(int i) {
super.b(i); super.levelDown(i);
this.cf = -1; this.cf = -1;
} }
@ -278,7 +278,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
b0 = -1; b0 = -1;
} }
this.b.serverConfigurationManager.a(this, b0); this.b.serverConfigurationManager.changeDimension(this, b0);
this.cf = -1; this.cf = -1;
this.cc = -1; this.cc = -1;
this.cd = -1; this.cd = -1;
@ -309,9 +309,9 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.ce = this.foodData.c() == 0.0F; this.ce = this.foodData.c() == 0.0F;
} }
if (this.exp != this.cf) { if (this.expTotal != this.cf) {
this.cf = this.exp; this.cf = this.expTotal;
this.netServerHandler.sendPacket(new Packet43SetExperience(this.expLevel, this.exp, 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.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.cf = -1;
this.cc = -1; this.cc = -1;
this.cd = -1; this.cd = -1;
@ -379,19 +379,19 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void A() {} public void A() {}
public EnumBedError a(int i, int j, int k) { public EnumBedResult a(int i, int j, int k) {
EnumBedError enumbederror = super.a(i, j, k); EnumBedResult enumbedresult = super.a(i, j, k);
if (enumbederror == EnumBedError.OK) { if (enumbedresult == EnumBedResult.OK) {
EntityTracker entitytracker = this.b.getTracker(this.dimension); 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.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) { 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) { public void a(String s) {
StatisticStorage statisticstorage = StatisticStorage.a(); LocaleLanguage localelanguage = LocaleLanguage.a();
String s1 = statisticstorage.a(s); String s1 = localelanguage.a(s);
this.netServerHandler.sendPacket(new Packet3Chat(s1)); this.netServerHandler.sendPacket(new Packet3Chat(s1));
} }

View File

@ -203,21 +203,21 @@ public abstract class EntityProjectile extends Entity {
protected abstract void a(MovingObjectPosition movingobjectposition); protected abstract void a(MovingObjectPosition movingobjectposition);
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("xTile", (short) this.blockX); nbttagcompound.setShort("xTile", (short) this.blockX);
nbttagcompound.a("yTile", (short) this.blockY); nbttagcompound.setShort("yTile", (short) this.blockY);
nbttagcompound.a("zTile", (short) this.blockZ); nbttagcompound.setShort("zTile", (short) this.blockZ);
nbttagcompound.a("inTile", (byte) this.inBlockId); nbttagcompound.setByte("inTile", (byte) this.inBlockId);
nbttagcompound.a("shake", (byte) this.shake); nbttagcompound.setByte("shake", (byte) this.shake);
nbttagcompound.a("inGround", (byte) (this.inGround ? 1 : 0)); nbttagcompound.setByte("inGround", (byte) (this.inGround ? 1 : 0));
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
this.blockX = nbttagcompound.e("xTile"); this.blockX = nbttagcompound.getShort("xTile");
this.blockY = nbttagcompound.e("yTile"); this.blockY = nbttagcompound.getShort("yTile");
this.blockZ = nbttagcompound.e("zTile"); this.blockZ = nbttagcompound.getShort("zTile");
this.inBlockId = nbttagcompound.d("inTile") & 255; this.inBlockId = nbttagcompound.getByte("inTile") & 255;
this.shake = nbttagcompound.d("shake") & 255; this.shake = nbttagcompound.getByte("shake") & 255;
this.inGround = nbttagcompound.d("inGround") == 1; this.inGround = nbttagcompound.getByte("inGround") == 1;
} }
public void a_(EntityHuman entityhuman) {} public void a_(EntityHuman entityhuman) {}

View File

@ -22,7 +22,7 @@ public class EntitySheep extends EntityAnimal {
this.datawatcher.a(16, new Byte((byte) 0)); 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 // CraftBukkit start - whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); 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) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.a("Sheared", this.isSheared()); nbttagcompound.setBoolean("Sheared", this.isSheared());
nbttagcompound.a("Color", (byte) this.getColor()); nbttagcompound.setByte("Color", (byte) this.getColor());
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.setSheared(nbttagcompound.n("Sheared")); this.setSheared(nbttagcompound.getBoolean("Sheared"));
this.setColor(nbttagcompound.d("Color")); this.setColor(nbttagcompound.getByte("Color"));
} }
protected String c_() { protected String c_() {

View File

@ -57,7 +57,7 @@ public class EntitySkeleton extends EntityMonster {
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
this.j(event.getDuration()); this.setOnFire(event.getDuration());
} }
// CraftBukkit end // CraftBukkit end
} }
@ -99,7 +99,7 @@ public class EntitySkeleton extends EntityMonster {
return Item.ARROW.id; return Item.ARROW.id;
} }
protected void a(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - whole method // CraftBukkit start - whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); 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 // CraftBukkit end
} }
public EnchantmentDamage t() { public MonsterType getMonsterType() {
return EnchantmentDamage.b; return MonsterType.UNDEAD;
} }
} }

View File

@ -5,7 +5,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
public float a; public float a;
public float b; public float b;
public float c; public float c;
private int size = 0; private int jumpDelay = 0;
public EntitySlime(World world) { public EntitySlime(World world) {
super(world); super(world);
@ -13,7 +13,7 @@ public class EntitySlime extends EntityLiving implements IMonster {
int i = 1 << this.random.nextInt(3); int i = 1 << this.random.nextInt(3);
this.height = 0.0F; this.height = 0.0F;
this.size = this.random.nextInt(20) + 10; this.jumpDelay = this.random.nextInt(20) + 10;
this.setSize(i); this.setSize(i);
this.az = i; this.az = i;
} }
@ -42,12 +42,12 @@ public class EntitySlime extends EntityLiving implements IMonster {
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.a("Size", this.getSize() - 1); nbttagcompound.setInt("Size", this.getSize() - 1);
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.setSize(nbttagcompound.f("Size") + 1); this.setSize(nbttagcompound.getInt("Size") + 1);
} }
protected String w() { protected String w() {
@ -92,16 +92,16 @@ public class EntitySlime extends EntityLiving implements IMonster {
protected void m_() { protected void m_() {
this.ak(); this.ak();
EntityHuman entityhuman = this.world.b(this, 16.0D); EntityHuman entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D);
if (entityhuman != null) { if (entityhuman != null) {
this.a(entityhuman, 10.0F, 20.0F); this.a(entityhuman, 10.0F, 20.0F);
} }
if (this.onGround && this.size-- <= 0) { if (this.onGround && this.jumpDelay-- <= 0) {
this.size = this.A(); this.jumpDelay = this.A();
if (entityhuman != null) { if (entityhuman != null) {
this.size /= 3; this.jumpDelay /= 3;
} }
this.aW = true; this.aW = true;

View File

@ -30,7 +30,7 @@ public class EntitySmallFireball extends EntityFireball {
// CraftBukkit end // CraftBukkit end
if (movingobjectposition.entity != null) { if (movingobjectposition.entity != null) {
// CraftBukkit start - entity damage by entity event + combust event // 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; boolean stick;
org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity(); org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity();
Projectile projectile = (Projectile) this.getBukkitEntity(); Projectile projectile = (Projectile) this.getBukkitEntity();
@ -54,7 +54,7 @@ public class EntitySmallFireball extends EntityFireball {
pluginManager.callEvent(combustEvent); pluginManager.callEvent(combustEvent);
if (!combustEvent.isCancelled()) { if (!combustEvent.isCancelled()) {
movingobjectposition.entity.j(combustEvent.getDuration()); movingobjectposition.entity.setOnFire(combustEvent.getDuration());
} }
} }
// CraftBukkit end // CraftBukkit end

View File

@ -77,7 +77,7 @@ public class EntitySnowman extends EntityGolem {
return Item.SNOW_BALL.id; return Item.SNOW_BALL.id;
} }
protected void a(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start // CraftBukkit start
List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
int j = this.random.nextInt(16); int j = this.random.nextInt(16);

View File

@ -35,7 +35,7 @@ public class EntitySpider extends EntityMonster {
} }
public double q() { public double q() {
return (double) this.width * 0.75D - 0.5D; return (double) this.length * 0.75D - 0.5D;
} }
protected boolean g_() { protected boolean g_() {
@ -48,7 +48,7 @@ public class EntitySpider extends EntityMonster {
if (f < 0.5F) { if (f < 0.5F) {
double d0 = 16.0D; double d0 = 16.0D;
return this.world.b(this, d0); return this.world.findNearbyVulnerablePlayer(this, d0);
} else { } else {
return null; return null;
} }
@ -112,8 +112,8 @@ public class EntitySpider extends EntityMonster {
return Item.STRING.id; return Item.STRING.id;
} }
protected void a(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
super.a(flag, i); super.dropDeathLoot(flag, i);
if (flag && (this.random.nextInt(3) == 0 || this.random.nextInt(1 + i) > 0)) { if (flag && (this.random.nextInt(3) == 0 || this.random.nextInt(1 + i) > 0)) {
this.b(Item.SPIDER_EYE.id, 1); this.b(Item.SPIDER_EYE.id, 1);
} }
@ -125,8 +125,8 @@ public class EntitySpider extends EntityMonster {
public void s() {} public void s() {}
public EnchantmentDamage t() { public MonsterType getMonsterType() {
return EnchantmentDamage.c; return MonsterType.ARTHROPOD;
} }
public boolean a(MobEffect mobeffect) { public boolean a(MobEffect mobeffect) {

View File

@ -58,7 +58,7 @@ public class EntitySquid extends EntityWaterAnimal {
return 0; return 0;
} }
protected void a(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
// CraftBukkit start - whole method // CraftBukkit start - whole method
java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();

View File

@ -18,7 +18,7 @@ public class EntityTNTPrimed extends Entity {
this.fuseTicks = 0; this.fuseTicks = 0;
this.bc = true; this.bc = true;
this.b(0.98F, 0.98F); 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) { public EntityTNTPrimed(World world, double d0, double d1, double d2) {
@ -91,10 +91,10 @@ public class EntityTNTPrimed extends Entity {
} }
protected void b(NBTTagCompound nbttagcompound) { protected void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("Fuse", (byte) this.fuseTicks); nbttagcompound.setByte("Fuse", (byte) this.fuseTicks);
} }
protected void a(NBTTagCompound nbttagcompound) { protected void a(NBTTagCompound nbttagcompound) {
this.fuseTicks = nbttagcompound.d("Fuse"); this.fuseTicks = nbttagcompound.getByte("Fuse");
} }
} }

View File

@ -8,7 +8,7 @@ import java.util.Set;
public class EntityTracker { public class EntityTracker {
private Set a = new HashSet(); private Set a = new HashSet();
private EntityList trackedEntities = new EntityList(); private IntHashMap trackedEntities = new IntHashMap();
private MinecraftServer c; private MinecraftServer c;
private int d; private int d;
private int e; private int e;
@ -65,7 +65,7 @@ public class EntityTracker {
this.addEntity(entity, 160, 3, true); this.addEntity(entity, 160, 3, true);
} else if (entity instanceof EntityTNTPrimed) { } else if (entity instanceof EntityTNTPrimed) {
this.addEntity(entity, 160, 10, true); this.addEntity(entity, 160, 10, true);
} else if (entity instanceof EntityFallingSand) { } else if (entity instanceof EntityFallingBlock) {
this.addEntity(entity, 160, 20, true); this.addEntity(entity, 160, 20, true);
} else if (entity instanceof EntityPainting) { } else if (entity instanceof EntityPainting) {
this.addEntity(entity, 160, Integer.MAX_VALUE, false); this.addEntity(entity, 160, Integer.MAX_VALUE, false);

View File

@ -205,7 +205,7 @@ public class EntityTrackerEntry {
EntityHuman entityhuman = (EntityHuman) this.tracker; EntityHuman entityhuman = (EntityHuman) this.tracker;
if (entityhuman.isSleeping()) { 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) { } else if (this.tracker instanceof EntityEnderCrystal) {
return new Packet23VehicleSpawn(this.tracker, 51); return new Packet23VehicleSpawn(this.tracker, 51);
} else { } else {
if (this.tracker instanceof EntityFallingSand) { if (this.tracker instanceof EntityFallingBlock) {
EntityFallingSand entityfallingsand = (EntityFallingSand) this.tracker; EntityFallingBlock entityfallingsand = (EntityFallingBlock) this.tracker;
if (entityfallingsand.a == Block.SAND.id) { if (entityfallingsand.a == Block.SAND.id) {
return new Packet23VehicleSpawn(this.tracker, 70); return new Packet23VehicleSpawn(this.tracker, 70);

View File

@ -94,7 +94,7 @@ public class EntityTypes {
a(EntityEnderPearl.class, "ThrownEnderpearl", 14); a(EntityEnderPearl.class, "ThrownEnderpearl", 14);
a(EntityEnderSignal.class, "EyeOfEnderSignal", 15); a(EntityEnderSignal.class, "EyeOfEnderSignal", 15);
a(EntityTNTPrimed.class, "PrimedTnt", 20); a(EntityTNTPrimed.class, "PrimedTnt", 20);
a(EntityFallingSand.class, "FallingSand", 21); a(EntityFallingBlock.class, "FallingSand", 21);
a(EntityMinecart.class, "Minecart", 40); a(EntityMinecart.class, "Minecart", 40);
a(EntityBoat.class, "Boat", 41); a(EntityBoat.class, "Boat", 41);
a(EntityLiving.class, "Mob", 48); a(EntityLiving.class, "Mob", 48);
@ -111,7 +111,7 @@ public class EntityTypes {
a(EntityCaveSpider.class, "CaveSpider", 59); a(EntityCaveSpider.class, "CaveSpider", 59);
a(EntitySilverfish.class, "Silverfish", 60); a(EntitySilverfish.class, "Silverfish", 60);
a(EntityBlaze.class, "Blaze", 61); a(EntityBlaze.class, "Blaze", 61);
a(EntityLavaSlime.class, "LavaSlime", 62); a(EntityMagmaCube.class, "LavaSlime", 62);
a(EntityEnderDragon.class, "EnderDragon", 63); a(EntityEnderDragon.class, "EnderDragon", 63);
a(EntityPig.class, "Pig", 90); a(EntityPig.class, "Pig", 90);
a(EntitySheep.class, "Sheep", 91); a(EntitySheep.class, "Sheep", 91);

View File

@ -8,7 +8,7 @@ import org.bukkit.event.block.BlockIgniteEvent;
import org.bukkit.event.block.BlockIgniteEvent.IgniteCause; import org.bukkit.event.block.BlockIgniteEvent.IgniteCause;
// CraftBukkit end // CraftBukkit end
public class EntityWeatherStorm extends EntityWeather { public class EntityWeatherLighting extends EntityWeather {
private int lifeTicks; private int lifeTicks;
public long a = 0L; public long a = 0L;
@ -18,11 +18,11 @@ public class EntityWeatherStorm extends EntityWeather {
private CraftWorld cworld; private CraftWorld cworld;
public boolean isEffect = false; 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); 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 // CraftBukkit end
super(world); super(world);

View File

@ -46,8 +46,8 @@ public class EntityWolf extends EntityAnimal {
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.a("Angry", this.isAngry()); nbttagcompound.setBoolean("Angry", this.isAngry());
nbttagcompound.a("Sitting", this.isSitting()); nbttagcompound.setBoolean("Sitting", this.isSitting());
if (this.getOwnerName() == null) { if (this.getOwnerName() == null) {
nbttagcompound.setString("Owner", ""); nbttagcompound.setString("Owner", "");
} else { } else {
@ -57,8 +57,8 @@ public class EntityWolf extends EntityAnimal {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.setAngry(nbttagcompound.n("Angry")); this.setAngry(nbttagcompound.getBoolean("Angry"));
this.setSitting(nbttagcompound.n("Sitting")); this.setSitting(nbttagcompound.getBoolean("Sitting"));
String s = nbttagcompound.getString("Owner"); String s = nbttagcompound.getString("Owner");
if (s.length() > 0) { 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); int i = (int) (MathHelper.sin((this.i - 0.4F) * 3.1415927F) * 7.0F);
for (int j = 0; j < i; ++j) { for (int j = 0; j < i; ++j) {
float f1 = (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.length * 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); 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() { public float x() {
return this.width * 0.8F; return this.length * 0.8F;
} }
protected int q_() { protected int q_() {
@ -422,7 +422,7 @@ public class EntityWolf extends EntityAnimal {
double d1 = this.random.nextGaussian() * 0.02D; double d1 = this.random.nextGaussian() * 0.02D;
double d2 = 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);
} }
} }

View File

@ -29,7 +29,7 @@ public class EntityZombie extends EntityMonster {
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) { if (!event.isCancelled()) {
this.j(event.getDuration()); this.setOnFire(event.getDuration());
} }
// CraftBukkit end // CraftBukkit end
} }
@ -54,7 +54,7 @@ public class EntityZombie extends EntityMonster {
return Item.ROTTEN_FLESH.id; return Item.ROTTEN_FLESH.id;
} }
public EnchantmentDamage t() { public MonsterType getMonsterType() {
return EnchantmentDamage.b; return MonsterType.UNDEAD;
} }
} }

View File

@ -76,18 +76,18 @@ public class FoodMetaData {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
if (nbttagcompound.hasKey("foodLevel")) { if (nbttagcompound.hasKey("foodLevel")) {
this.foodLevel = nbttagcompound.f("foodLevel"); this.foodLevel = nbttagcompound.getInt("foodLevel");
this.foodTickTimer = nbttagcompound.f("foodTickTimer"); this.foodTickTimer = nbttagcompound.getInt("foodTickTimer");
this.saturationLevel = nbttagcompound.h("foodSaturationLevel"); this.saturationLevel = nbttagcompound.getFloat("foodSaturationLevel");
this.exhaustionLevel = nbttagcompound.h("foodExhaustionLevel"); this.exhaustionLevel = nbttagcompound.getFloat("foodExhaustionLevel");
} }
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("foodLevel", this.foodLevel); nbttagcompound.setInt("foodLevel", this.foodLevel);
nbttagcompound.a("foodTickTimer", this.foodTickTimer); nbttagcompound.setInt("foodTickTimer", this.foodTickTimer);
nbttagcompound.a("foodSaturationLevel", this.saturationLevel); nbttagcompound.setFloat("foodSaturationLevel", this.saturationLevel);
nbttagcompound.a("foodExhaustionLevel", this.exhaustionLevel); nbttagcompound.setFloat("foodExhaustionLevel", this.exhaustionLevel);
} }
public int a() { public int a() {

View File

@ -6,21 +6,21 @@ import java.util.UUID; // CraftBukkit
public interface IDataManager { 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(); void e();
File b(String s); File getDataFile(String s);
UUID getUUID(); // CraftBukkit UUID getUUID(); // CraftBukkit
} }

View File

@ -245,7 +245,7 @@ public class ItemInWorldManager {
entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = itemstack1; entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = itemstack1;
if (this.b()) { if (this.b()) {
itemstack1.count = i; itemstack1.count = i;
itemstack1.b(j); itemstack1.setData(j);
} }
if (itemstack1.count == 0) { if (itemstack1.count == 0) {
@ -283,7 +283,7 @@ public class ItemInWorldManager {
// The item count should not decrement in Creative mode. // The item count should not decrement in Creative mode.
if (this.b()) { if (this.b()) {
itemstack.b(j1); itemstack.setData(j1);
itemstack.count = k1; itemstack.count = k1;
} }
} }

View File

@ -1,7 +1,7 @@
package net.minecraft.server; package net.minecraft.server;
// CraftBukkit start - the whole file! // 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) { public ItemMobSpawner(int id) {
super(id, Block.MOB_SPAWNER); super(id, Block.MOB_SPAWNER);

View File

@ -36,7 +36,7 @@ public final class ItemStack {
this.count = 0; this.count = 0;
this.id = i; this.id = i;
this.count = j; this.count = j;
this.b(k); // CraftBukkit this.setData(k); // CraftBukkit
} }
public static ItemStack a(NBTTagCompound nbttagcompound) { public static ItemStack a(NBTTagCompound nbttagcompound) {
@ -54,7 +54,7 @@ public final class ItemStack {
ItemStack itemstack = new ItemStack(this.id, i, this.damage); ItemStack itemstack = new ItemStack(this.id, i, this.damage);
if (this.tag != null) { if (this.tag != null) {
itemstack.tag = (NBTTagCompound) this.tag.b(); itemstack.tag = (NBTTagCompound) this.tag.clone();
} }
this.count -= i; this.count -= i;
@ -88,22 +88,22 @@ public final class ItemStack {
} }
public NBTTagCompound b(NBTTagCompound nbttagcompound) { public NBTTagCompound b(NBTTagCompound nbttagcompound) {
nbttagcompound.a("id", (short) this.id); nbttagcompound.setShort("id", (short) this.id);
nbttagcompound.a("Count", (byte) this.count); nbttagcompound.setByte("Count", (byte) this.count);
nbttagcompound.a("Damage", (short) this.damage); nbttagcompound.setShort("Damage", (short) this.damage);
if (this.tag != null) { if (this.tag != null) {
nbttagcompound.a("tag", (NBTBase) this.tag); nbttagcompound.set("tag", this.tag);
} }
return nbttagcompound; return nbttagcompound;
} }
public void c(NBTTagCompound nbttagcompound) { public void c(NBTTagCompound nbttagcompound) {
this.id = nbttagcompound.e("id"); this.id = nbttagcompound.getShort("id");
this.count = nbttagcompound.d("Count"); this.count = nbttagcompound.getByte("Count");
this.damage = nbttagcompound.e("Damage"); this.damage = nbttagcompound.getShort("Damage");
if (nbttagcompound.hasKey("tag")) { 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; 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 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) { public void damage(int i, EntityLiving entityliving) {
if (this.d()) { if (this.d()) {
if (i > 0 && entityliving instanceof EntityHuman) { 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) { if (j > 0 && entityliving.world.random.nextInt(j + 1) > 0) {
return; return;
@ -204,7 +204,7 @@ public final class ItemStack {
ItemStack itemstack = new ItemStack(this.id, this.count, this.damage); ItemStack itemstack = new ItemStack(this.id, this.count, this.damage);
if (this.tag != null) { if (this.tag != null) {
itemstack.tag = (NBTTagCompound) this.tag.b(); itemstack.tag = (NBTTagCompound) this.tag.clone();
if (!itemstack.tag.equals(this.tag)) { if (!itemstack.tag.equals(this.tag)) {
return itemstack; return itemstack;
} }
@ -266,19 +266,19 @@ public final class ItemStack {
this.getItem().a(this, world, entityhuman, i); this.getItem().a(this, world, entityhuman, i);
} }
public boolean n() { public boolean hasTag() {
return this.tag != null; return this.tag != null;
} }
public NBTTagCompound o() { public NBTTagCompound getTag() {
return this.tag; return this.tag;
} }
public NBTTagList p() { public NBTTagList getEnchantments() {
return this.tag == null ? null : (NBTTagList) this.tag.b("ench"); 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) { if (Item.byId[this.id].getMaxStackSize() != 1) {
throw new IllegalArgumentException("Cannot add tag data to a stackable item"); throw new IllegalArgumentException("Cannot add tag data to a stackable item");
} else { } else {
@ -287,27 +287,27 @@ public final class ItemStack {
} }
public boolean q() { 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) { if (this.tag == null) {
this.d(new NBTTagCompound()); this.setTag(new NBTTagCompound());
} }
if (!this.tag.hasKey("ench")) { 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 nbttagcompound = new NBTTagCompound();
nbttagcompound.a("id", (short) enchantment.id); nbttagcompound.setShort("id", (short) enchantment.id);
nbttagcompound.a("lvl", (short) ((byte) i)); nbttagcompound.setShort("lvl", (short) ((byte) i));
nbttaglist.a((NBTBase) nbttagcompound); nbttaglist.add(nbttagcompound);
} }
public boolean r() { public boolean hasEnchantments() {
return this.tag != null && this.tag.hasKey("ench"); return this.tag != null && this.tag.hasKey("ench");
} }
} }

View File

@ -17,13 +17,13 @@ public class ItemWorldMap extends ItemWorldMapBase {
WorldMap worldmap = (WorldMap) world.a(WorldMap.class, "map_" + itemstack.getData()); WorldMap worldmap = (WorldMap) world.a(WorldMap.class, "map_" + itemstack.getData());
if (worldmap == null) { if (worldmap == null) {
itemstack.b(world.b("map")); itemstack.setData(world.b("map"));
String s = "map_" + itemstack.getData(); String s = "map_" + itemstack.getData();
worldmap = new WorldMap(s); worldmap = new WorldMap(s);
worldmap.b = world.r().c(); worldmap.centerX = world.getWorldData().c();
worldmap.c = world.r().e(); worldmap.centerZ = world.getWorldData().e();
worldmap.e = 3; worldmap.scale = 3;
worldmap.map = (byte) world.worldProvider.dimension; worldmap.map = (byte) world.worldProvider.dimension;
worldmap.a(); worldmap.a();
world.a(s, (WorldMapBase) worldmap); world.a(s, (WorldMapBase) worldmap);
@ -41,9 +41,9 @@ public class ItemWorldMap extends ItemWorldMapBase {
if (((WorldServer) world).dimension == worldmap.map) { // CraftBukkit if (((WorldServer) world).dimension == worldmap.map) { // CraftBukkit
short short1 = 128; short short1 = 128;
short short2 = 128; short short2 = 128;
int i = 1 << worldmap.e; int i = 1 << worldmap.scale;
int j = worldmap.b; int j = worldmap.centerX;
int k = worldmap.c; int k = worldmap.centerZ;
int l = MathHelper.floor(entity.locX - (double) j) / i + short1 / 2; int l = MathHelper.floor(entity.locX - (double) j) / i + short1 / 2;
int i1 = MathHelper.floor(entity.locZ - (double) k) / i + short2 / 2; int i1 = MathHelper.floor(entity.locZ - (double) k) / i + short2 / 2;
int j1 = 128 / i; int j1 = 128 / i;
@ -181,7 +181,7 @@ public class ItemWorldMap extends ItemWorldMapBase {
d0 = d1; d0 = d1;
if (j2 >= 0 && k2 * k2 + l2 * l2 < j1 * j1 && (!flag || (k1 + j2 & 1) != 0)) { 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); byte b5 = (byte) (i5 * 4 + b3);
if (b4 != b5) { if (b4 != b5) {
@ -193,14 +193,14 @@ public class ItemWorldMap extends ItemWorldMapBase {
i2 = j2; i2 = j2;
} }
worldmap.f[k1 + j2 * short1] = b5; worldmap.colors[k1 + j2 * short1] = b5;
} }
} }
} }
} }
if (l1 <= i2) { 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) { public void d(ItemStack itemstack, World world, EntityHuman entityhuman) {
itemstack.b(world.b("map")); itemstack.setData(world.b("map"));
String s = "map_" + itemstack.getData(); String s = "map_" + itemstack.getData();
WorldMap worldmap = new WorldMap(s); WorldMap worldmap = new WorldMap(s);
world.a(s, (WorldMapBase) worldmap); world.a(s, (WorldMapBase) worldmap);
worldmap.b = MathHelper.floor(entityhuman.locX); worldmap.centerX = MathHelper.floor(entityhuman.locX);
worldmap.c = MathHelper.floor(entityhuman.locZ); worldmap.centerZ = MathHelper.floor(entityhuman.locZ);
worldmap.e = 3; worldmap.scale = 3;
worldmap.map = (byte) world.worldProvider.dimension; worldmap.map = (byte) world.worldProvider.dimension;
worldmap.a(); worldmap.a();
} }
public Packet c(ItemStack itemstack, World world, EntityHuman entityhuman) { 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);
} }
} }

View File

@ -271,7 +271,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
world.addIWorldAccess(new WorldManager(this, world)); world.addIWorldAccess(new WorldManager(this, world));
world.difficulty = this.propertyManager.getInt("difficulty", 1); world.difficulty = this.propertyManager.getInt("difficulty", 1);
world.setSpawnFlags(this.propertyManager.getBoolean("spawn-monsters", true), this.spawnAnimals); world.setSpawnFlags(this.propertyManager.getBoolean("spawn-monsters", true), this.spawnAnimals);
world.r().setGameType(j); world.getWorldData().setGameType(j);
this.worlds.add(world); this.worlds.add(world);
this.serverConfigurationManager.setPlayerFileData(this.worlds.toArray(new WorldServer[0])); 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); 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(); worldserver.doTick();
while (true) { while (true) {
if (!worldserver.x()) { if (!worldserver.updateLights()) {
worldserver.tickEntities(); worldserver.tickEntities();
break; break;
} }
@ -514,7 +514,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
// } // CraftBukkit // } // CraftBukkit
this.networkListenThread.a(); this.networkListenThread.a();
this.serverConfigurationManager.b(); this.serverConfigurationManager.tick();
// CraftBukkit start // CraftBukkit start
for (k = 0; k < this.worlds.size(); ++k) { for (k = 0; k < this.worlds.size(); ++k) {
@ -643,11 +643,11 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
} }
public int getPlayerCount() { public int getPlayerCount() {
return this.serverConfigurationManager.j(); return this.serverConfigurationManager.getPlayerCount();
} }
public int getMaxPlayers() { public int getMaxPlayers() {
return this.serverConfigurationManager.k(); return this.serverConfigurationManager.getMaxPlayers();
} }
public String[] getPlayers() { public String[] getPlayers() {
@ -708,11 +708,11 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
} }
public String[] q() { public String[] q() {
return (String[]) this.serverConfigurationManager.f().toArray(new String[0]); return (String[]) this.serverConfigurationManager.getBannedAddresses().toArray(new String[0]);
} }
public String[] r() { 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) { public static boolean isRunning(MinecraftServer minecraftserver) {

View File

@ -85,7 +85,7 @@ public class NetLoginHandler extends NetHandler {
} }
public void b(Packet1Login packet1login) { 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) { if (entityplayer != null) {
this.server.serverConfigurationManager.b(entityplayer); this.server.serverConfigurationManager.b(entityplayer);
@ -96,11 +96,11 @@ public class NetLoginHandler extends NetHandler {
WorldServer worldserver = (WorldServer) entityplayer.world; // CraftBukkit WorldServer worldserver = (WorldServer) entityplayer.world; // CraftBukkit
ChunkCoordinates chunkcoordinates = worldserver.getSpawn(); 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); 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. // 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) { if (maxPlayers > 60) {
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. if (this.networkManager.f() == null) return; // CraftBukkit - fix NPE when a client queries a server that is unable to handle it.
try { try {
// CraftBukkit start // CraftBukkit start
ServerListPingEvent pingEvent = CraftEventFactory.callServerListPingEvent(this.server.server, getSocket().getInetAddress(), this.server.r, this.server.serverConfigurationManager.j(), this.server.serverConfigurationManager.k()); 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.j() + "\u00A7" + pingEvent.getMaxPlayers(); String s = pingEvent.getMotd() + "\u00A7" + this.server.serverConfigurationManager.getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers();
// CraftBukkit end // CraftBukkit end
this.networkManager.queue(new Packet255KickDisconnect(s)); this.networkManager.queue(new Packet255KickDisconnect(s));

View File

@ -49,7 +49,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
private double y; private double y;
private double z; private double z;
private boolean checkMovement = true; private boolean checkMovement = true;
private EntityList q = new EntityList(); private IntHashMap q = new IntHashMap();
public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { public NetServerHandler(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) {
this.minecraftServer = minecraftserver; this.minecraftServer = minecraftserver;
@ -128,8 +128,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.disconnected = true; this.disconnected = true;
} }
public void a(Packet27 packet27) { public void a(Packet27PlayerInput packet27playerinput) {
this.player.a(packet27.c(), packet27.e(), packet27.g(), packet27.h(), packet27.d(), packet27.f()); this.player.a(packet27playerinput.c(), packet27playerinput.e(), packet27playerinput.g(), packet27playerinput.h(), packet27playerinput.d(), packet27playerinput.f());
} }
public void a(Packet10Flying packet10flying) { public void a(Packet10Flying packet10flying) {
@ -684,7 +684,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit start // CraftBukkit start
if (this.player.dead) return; 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); PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex);
this.server.getPluginManager().callEvent(event); this.server.getPluginManager().callEvent(event);
// CraftBukkit end // CraftBukkit end
@ -704,7 +704,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
s = s.trim(); s = s.trim();
for (int i = 0; i < s.length(); ++i) { 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"); this.disconnect("Illegal characters in chat");
return; return;
} }
@ -968,9 +968,9 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
} }
public void a(Packet108 packet108) { public void a(Packet108ButtonClick packet108buttonclick) {
if (this.player.activeContainer.windowId == packet108.a && this.player.activeContainer.c(this.player)) { if (this.player.activeContainer.windowId == packet108buttonclick.a && this.player.activeContainer.c(this.player)) {
this.player.activeContainer.a((EntityHuman) this.player, packet108.b); this.player.activeContainer.a((EntityHuman) this.player, packet108buttonclick.b);
this.player.activeContainer.a(); this.player.activeContainer.a();
} }
} }
@ -979,7 +979,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (this.player.itemInWorldManager.b()) { if (this.player.itemInWorldManager.b()) {
boolean flag = packet107setcreativeslot.a < 0; boolean flag = packet107setcreativeslot.a < 0;
ItemStack itemstack = packet107setcreativeslot.b; 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 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; 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; flag = false;
} else { } else {
for (i = 0; i < packet130updatesign.lines[j].length(); ++i) { 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; flag = false;
} }
} }

View File

@ -240,7 +240,7 @@ public class NetworkManager {
this.a(); this.a();
this.q = true; this.q = true;
this.s.interrupt(); this.s.interrupt();
(new ThreadMonitorConnection(this)).start(); (new NetworkMonitorThread(this)).start();
} }
public int e() { public int e() {

View File

@ -11,7 +11,7 @@ import java.util.Set;
public abstract class Packet { public abstract class Packet {
public static EntityList j = new EntityList(); public static IntHashMap j = new IntHashMap();
private static Map a = new HashMap(); private static Map a = new HashMap();
private static Set b = new HashSet(); private static Set b = new HashSet();
private static Set c = new HashSet(); private static Set c = new HashSet();
@ -178,7 +178,7 @@ public abstract class Packet {
byte[] abyte = new byte[short1]; byte[] abyte = new byte[short1];
datainputstream.readFully(abyte); datainputstream.readFully(abyte);
return CompressedStreamTools.a(abyte); return NBTCompressedStreamTools.a(abyte);
} }
} }
@ -186,7 +186,7 @@ public abstract class Packet {
if (nbttagcompound == null) { if (nbttagcompound == null) {
dataoutputstream.writeShort(-1); dataoutputstream.writeShort(-1);
} else { } else {
byte[] abyte = CompressedStreamTools.a(nbttagcompound); byte[] abyte = NBTCompressedStreamTools.a(nbttagcompound);
dataoutputstream.writeShort((short) abyte.length); dataoutputstream.writeShort((short) abyte.length);
dataoutputstream.write(abyte); dataoutputstream.write(abyte);
@ -211,7 +211,7 @@ public abstract class Packet {
a(14, false, true, Packet14BlockDig.class); a(14, false, true, Packet14BlockDig.class);
a(15, false, true, Packet15Place.class); a(15, false, true, Packet15Place.class);
a(16, false, true, Packet16BlockItemSwitch.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(18, true, true, Packet18ArmAnimation.class);
a(19, false, true, Packet19EntityAction.class); a(19, false, true, Packet19EntityAction.class);
a(20, true, false, Packet20NamedEntitySpawn.class); a(20, true, false, Packet20NamedEntitySpawn.class);
@ -221,7 +221,7 @@ public abstract class Packet {
a(24, true, false, Packet24MobSpawn.class); a(24, true, false, Packet24MobSpawn.class);
a(25, true, false, Packet25EntityPainting.class); a(25, true, false, Packet25EntityPainting.class);
a(26, true, false, Packet26AddExpOrb.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(28, true, false, Packet28EntityVelocity.class);
a(29, true, false, Packet29DestroyEntity.class); a(29, true, false, Packet29DestroyEntity.class);
a(30, true, false, Packet30Entity.class); a(30, true, false, Packet30Entity.class);
@ -241,7 +241,7 @@ public abstract class Packet {
a(53, true, false, Packet53BlockChange.class); a(53, true, false, Packet53BlockChange.class);
a(54, true, false, Packet54PlayNoteBlock.class); a(54, true, false, Packet54PlayNoteBlock.class);
a(60, true, false, Packet60Explosion.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(70, true, false, Packet70Bed.class);
a(71, true, false, Packet71Weather.class); a(71, true, false, Packet71Weather.class);
a(100, true, false, Packet100OpenWindow.class); a(100, true, false, Packet100OpenWindow.class);
@ -252,9 +252,9 @@ public abstract class Packet {
a(105, true, false, Packet105CraftProgressBar.class); a(105, true, false, Packet105CraftProgressBar.class);
a(106, true, true, Packet106Transaction.class); a(106, true, true, Packet106Transaction.class);
a(107, true, true, Packet107SetCreativeSlot.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(130, true, true, Packet130UpdateSign.class);
a(131, true, false, Packet131.class); a(131, true, false, Packet131ItemData.class);
a(200, true, false, Packet200Statistic.class); a(200, true, false, Packet200Statistic.class);
a(201, true, false, Packet201PlayerInfo.class); a(201, true, false, Packet201PlayerInfo.class);
a(254, false, true, Packet254GetInfo.class); a(254, false, true, Packet254GetInfo.class);

View File

@ -1,6 +1,6 @@
package net.minecraft.server; package net.minecraft.server;
public class InventoryPlayer implements IInventory { public class PlayerInventory implements IInventory {
public ItemStack[] items = new ItemStack[36]; public ItemStack[] items = new ItemStack[36];
public ItemStack[] armor = new ItemStack[4]; public ItemStack[] armor = new ItemStack[4];
@ -19,7 +19,7 @@ public class InventoryPlayer implements IInventory {
} }
// CraftBukkit end // CraftBukkit end
public InventoryPlayer(EntityHuman entityhuman) { public PlayerInventory(EntityHuman entityhuman) {
this.d = entityhuman; this.d = entityhuman;
} }
@ -243,18 +243,18 @@ public class InventoryPlayer implements IInventory {
for (i = 0; i < this.items.length; ++i) { for (i = 0; i < this.items.length; ++i) {
if (this.items[i] != null) { if (this.items[i] != null) {
nbttagcompound = new NBTTagCompound(); nbttagcompound = new NBTTagCompound();
nbttagcompound.a("Slot", (byte) i); nbttagcompound.setByte("Slot", (byte) i);
this.items[i].b(nbttagcompound); this.items[i].b(nbttagcompound);
nbttaglist.a((NBTBase) nbttagcompound); nbttaglist.add(nbttagcompound);
} }
} }
for (i = 0; i < this.armor.length; ++i) { for (i = 0; i < this.armor.length; ++i) {
if (this.armor[i] != null) { if (this.armor[i] != null) {
nbttagcompound = new NBTTagCompound(); nbttagcompound = new NBTTagCompound();
nbttagcompound.a("Slot", (byte) (i + 100)); nbttagcompound.setByte("Slot", (byte) (i + 100));
this.armor[i].b(nbttagcompound); 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.items = new ItemStack[36];
this.armor = new ItemStack[4]; this.armor = new ItemStack[4];
for (int i = 0; i < nbttaglist.d(); ++i) { for (int i = 0; i < nbttaglist.size(); ++i) {
NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.a(i); NBTTagCompound nbttagcompound = (NBTTagCompound) nbttaglist.get(i);
int j = nbttagcompound.d("Slot") & 255; int j = nbttagcompound.getByte("Slot") & 255;
ItemStack itemstack = ItemStack.a(nbttagcompound); ItemStack itemstack = ItemStack.a(nbttagcompound);
if (itemstack != null) { if (itemstack != null) {
@ -415,15 +415,15 @@ public class InventoryPlayer implements IInventory {
public void g() {} public void g() {}
public void a(InventoryPlayer inventoryplayer) { public void a(PlayerInventory playerinventory) {
int i; int i;
for (i = 0; i < this.items.length; ++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) { for (i = 0; i < this.armor.length; ++i) {
this.armor[i] = ItemStack.b(inventoryplayer.armor[i]); this.armor[i] = ItemStack.b(playerinventory.armor[i]);
} }
} }
} }

View File

@ -6,7 +6,7 @@ import java.util.List;
public class PlayerManager { public class PlayerManager {
public List managedPlayers = new ArrayList(); public List managedPlayers = new ArrayList();
private PlayerList b = new PlayerList(); private LongHashMap b = new LongHashMap();
private List c = new ArrayList(); private List c = new ArrayList();
private MinecraftServer server; private MinecraftServer server;
private int e; private int e;
@ -175,7 +175,7 @@ public class PlayerManager {
return this.f * 16 - 16; return this.f * 16 - 16;
} }
static PlayerList a(PlayerManager playermanager) { static LongHashMap a(PlayerManager playermanager) {
return playermanager.b; return playermanager.b;
} }

View File

@ -76,7 +76,7 @@ public class ServerConfigurationManager {
public void setPlayerFileData(WorldServer[] aworldserver) { public void setPlayerFileData(WorldServer[] aworldserver) {
if (this.playerFileData != null) return; // CraftBukkit if (this.playerFileData != null) return; // CraftBukkit
this.playerFileData = aworldserver[0].q().d(); this.playerFileData = aworldserver[0].getDataManager().getPlayerFileData();
} }
public void a(EntityPlayer entityplayer) { public void a(EntityPlayer entityplayer) {
@ -170,7 +170,7 @@ public class ServerConfigurationManager {
return playerQuitEvent.getQuitMessage(); // CraftBukkit 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 // CraftBukkit start - note: this entire method needs to be changed
// Instead of kicking then returning, we need to store the kick reason // 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 // 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.fireTicks = 0;
entityplayer.fallDistance = 0; entityplayer.fallDistance = 0;
entityplayer.foodData = new FoodMetaData(); entityplayer.foodData = new FoodMetaData();
entityplayer.expLevel = 0;
entityplayer.expTotal = 0; entityplayer.expTotal = 0;
entityplayer.exp = 0; entityplayer.exp = 0;
entityplayer.expLevel = 0;
entityplayer.d(entityplayer.newExp); entityplayer.d(entityplayer.newExp);
} else { } else {
location.setWorld(this.server.getWorldServer(i).getWorld()); location.setWorld(this.server.getWorldServer(i).getWorld());
@ -303,7 +303,7 @@ public class ServerConfigurationManager {
return entityplayer1; 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. // CraftBukkit start -- Replaced the standard handling of portals with a more customised method.
int dimension = i; int dimension = i;
WorldServer fromWorld = this.server.getWorldServer(entityplayer.dimension); WorldServer fromWorld = this.server.getWorldServer(entityplayer.dimension);
@ -351,7 +351,7 @@ public class ServerConfigurationManager {
// CraftBukkit end // CraftBukkit end
} }
public void b() { public void tick() {
if (++this.p > 200) { if (++this.p > 200) {
this.p = 0; this.p = 0;
} }
@ -459,11 +459,11 @@ public class ServerConfigurationManager {
} }
} }
public Set e() { public Set getBannedPlayers() {
return this.banByName; return this.banByName;
} }
public Set f() { public Set getBannedAddresses() {
return this.banByIP; return this.banByIP;
} }
@ -710,11 +710,11 @@ public class ServerConfigurationManager {
entityplayer.s_(); entityplayer.s_();
} }
public int j() { public int getPlayerCount() {
return this.players.size(); return this.players.size();
} }
public int k() { public int getMaxPlayers() {
return this.maxPlayers; return this.maxPlayers;
} }
} }

View File

@ -99,7 +99,7 @@ public final class SpawnerCreature {
float f1 = (float) i3; float f1 = (float) i3;
float f2 = (float) j3 + 0.5F; 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 f3 = f - (float) chunkcoordinates.x;
float f4 = f1 - (float) chunkcoordinates.y; float f4 = f1 - (float) chunkcoordinates.y;
float f5 = f2 - (float) chunkcoordinates.z; float f5 = f2 - (float) chunkcoordinates.z;

View File

@ -67,13 +67,13 @@ public class TileEntityChest extends TileEntity implements IInventory {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
NBTTagList nbttaglist = nbttagcompound.m("Items"); NBTTagList nbttaglist = nbttagcompound.getList("Items");
this.items = new ItemStack[this.getSize()]; this.items = new ItemStack[this.getSize()];
for (int i = 0; i < nbttaglist.d(); ++i) { for (int i = 0; i < nbttaglist.size(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
int j = nbttagcompound1.d("Slot") & 255; int j = nbttagcompound1.getByte("Slot") & 255;
if (j >= 0 && j < this.items.length) { if (j >= 0 && j < this.items.length) {
this.items[j] = ItemStack.a(nbttagcompound1); this.items[j] = ItemStack.a(nbttagcompound1);
@ -89,13 +89,13 @@ public class TileEntityChest extends TileEntity implements IInventory {
if (this.items[i] != null) { if (this.items[i] != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Slot", (byte) i); nbttagcompound1.setByte("Slot", (byte) i);
this.items[i].b(nbttagcompound1); this.items[i].b(nbttagcompound1);
nbttaglist.a((NBTBase) nbttagcompound1); nbttaglist.add(nbttagcompound1);
} }
} }
nbttagcompound.a("Items", (NBTBase) nbttaglist); nbttagcompound.set("Items", nbttaglist);
} }
public int getMaxStackSize() { public int getMaxStackSize() {

View File

@ -88,13 +88,13 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
NBTTagList nbttaglist = nbttagcompound.m("Items"); NBTTagList nbttaglist = nbttagcompound.getList("Items");
this.items = new ItemStack[this.getSize()]; this.items = new ItemStack[this.getSize()];
for (int i = 0; i < nbttaglist.d(); ++i) { for (int i = 0; i < nbttaglist.size(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
int j = nbttagcompound1.d("Slot") & 255; int j = nbttagcompound1.getByte("Slot") & 255;
if (j >= 0 && j < this.items.length) { if (j >= 0 && j < this.items.length) {
this.items[j] = ItemStack.a(nbttagcompound1); this.items[j] = ItemStack.a(nbttagcompound1);
@ -110,13 +110,13 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
if (this.items[i] != null) { if (this.items[i] != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Slot", (byte) i); nbttagcompound1.setByte("Slot", (byte) i);
this.items[i].b(nbttagcompound1); this.items[i].b(nbttagcompound1);
nbttaglist.a((NBTBase) nbttagcompound1); nbttaglist.add(nbttagcompound1);
} }
} }
nbttagcompound.a("Items", (NBTBase) nbttaglist); nbttagcompound.set("Items", nbttaglist);
} }
public int getMaxStackSize() { public int getMaxStackSize() {

View File

@ -64,41 +64,41 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
NBTTagList nbttaglist = nbttagcompound.m("Items"); NBTTagList nbttaglist = nbttagcompound.getList("Items");
this.items = new ItemStack[this.getSize()]; this.items = new ItemStack[this.getSize()];
for (int i = 0; i < nbttaglist.d(); ++i) { for (int i = 0; i < nbttaglist.size(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.a(i); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
byte b0 = nbttagcompound1.d("Slot"); byte b0 = nbttagcompound1.getByte("Slot");
if (b0 >= 0 && b0 < this.items.length) { if (b0 >= 0 && b0 < this.items.length) {
this.items[b0] = ItemStack.a(nbttagcompound1); this.items[b0] = ItemStack.a(nbttagcompound1);
} }
} }
this.burnTime = nbttagcompound.e("BurnTime"); this.burnTime = nbttagcompound.getShort("BurnTime");
this.cookTime = nbttagcompound.e("CookTime"); this.cookTime = nbttagcompound.getShort("CookTime");
this.ticksForCurrentFuel = this.fuelTime(this.items[1]); this.ticksForCurrentFuel = this.fuelTime(this.items[1]);
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.a("BurnTime", (short) this.burnTime); nbttagcompound.setShort("BurnTime", (short) this.burnTime);
nbttagcompound.a("CookTime", (short) this.cookTime); nbttagcompound.setShort("CookTime", (short) this.cookTime);
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.items.length; ++i) { for (int i = 0; i < this.items.length; ++i) {
if (this.items[i] != null) { if (this.items[i] != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Slot", (byte) i); nbttagcompound1.setByte("Slot", (byte) i);
this.items[i].b(nbttagcompound1); this.items[i].b(nbttagcompound1);
nbttaglist.a((NBTBase) nbttagcompound1); nbttaglist.add(nbttagcompound1);
} }
} }
nbttagcompound.a("Items", (NBTBase) nbttaglist); nbttagcompound.set("Items", nbttaglist);
} }
public int getMaxStackSize() { public int getMaxStackSize() {

View File

@ -18,7 +18,7 @@ public class TileEntityMobSpawner extends TileEntity {
} }
public boolean c() { 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 // CraftBukkit start
@ -108,12 +108,12 @@ public class TileEntityMobSpawner extends TileEntity {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.mobName = nbttagcompound.getString("EntityId"); this.mobName = nbttagcompound.getString("EntityId");
this.spawnDelay = nbttagcompound.e("Delay"); this.spawnDelay = nbttagcompound.getShort("Delay");
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.setString("EntityId", this.mobName); nbttagcompound.setString("EntityId", this.mobName);
nbttagcompound.a("Delay", (short) this.spawnDelay); nbttagcompound.setShort("Delay", (short) this.spawnDelay);
} }
} }

View File

@ -68,7 +68,7 @@ public class TileEntityPiston extends TileEntity {
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next(); 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(); h.clear();
@ -112,19 +112,19 @@ public class TileEntityPiston extends TileEntity {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
super.a(nbttagcompound); super.a(nbttagcompound);
this.a = nbttagcompound.f("blockId"); this.a = nbttagcompound.getInt("blockId");
this.b = nbttagcompound.f("blockData"); this.b = nbttagcompound.getInt("blockData");
this.c = nbttagcompound.f("facing"); this.c = nbttagcompound.getInt("facing");
this.g = this.f = nbttagcompound.h("progress"); this.g = this.f = nbttagcompound.getFloat("progress");
this.d = nbttagcompound.n("extending"); this.d = nbttagcompound.getBoolean("extending");
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.a("blockId", this.a); nbttagcompound.setInt("blockId", this.a);
nbttagcompound.a("blockData", this.b); nbttagcompound.setInt("blockData", this.b);
nbttagcompound.a("facing", this.c); nbttagcompound.setInt("facing", this.c);
nbttagcompound.a("progress", this.g); nbttagcompound.setFloat("progress", this.g);
nbttagcompound.a("extending", this.d); nbttagcompound.setBoolean("extending", this.d);
} }
} }

View File

@ -65,7 +65,7 @@ public class World implements IBlockAccess {
public WorldProvider worldProvider; // CraftBukkit - remove final public WorldProvider worldProvider; // CraftBukkit - remove final
protected List z; protected List z;
public IChunkProvider chunkProvider; // CraftBukkit - protected -> public public IChunkProvider chunkProvider; // CraftBukkit - protected -> public
protected final IDataManager B; protected final IDataManager dataManager;
public WorldData worldData; // CraftBukkit - protected -> public public WorldData worldData; // CraftBukkit - protected -> public
public boolean isLoading; public boolean isLoading;
private boolean Q; private boolean Q;
@ -150,9 +150,9 @@ public class World implements IBlockAccess {
this.H = new int['\u8000']; this.H = new int['\u8000'];
this.V = new ArrayList(); this.V = new ArrayList();
this.isStatic = false; this.isStatic = false;
this.B = idatamanager; this.dataManager = idatamanager;
this.worldMaps = new WorldMapCollection(idatamanager); this.worldMaps = new WorldMapCollection(idatamanager);
this.worldData = idatamanager.c(); this.worldData = idatamanager.getWorldData();
this.x = this.worldData == null; this.x = this.worldData == null;
if (worldprovider != null) { if (worldprovider != null) {
this.worldProvider = worldprovider; this.worldProvider = worldprovider;
@ -184,7 +184,7 @@ public class World implements IBlockAccess {
} }
protected IChunkProvider b() { 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()); return new ChunkProviderLoadOrGenerate(this, ichunkloader, this.worldProvider.getChunkProvider());
} }
@ -270,7 +270,7 @@ public class World implements IBlockAccess {
private void y() { private void y() {
this.l(); this.l();
this.B.a(this.worldData, this.players); this.dataManager.saveWorldData(this.worldData, this.players);
this.worldMaps.a(); this.worldMaps.a();
} }
@ -1691,7 +1691,7 @@ public class World implements IBlockAccess {
} }
public void doTick() { public void doTick() {
if (this.r().isHardcore() && this.difficulty < 3) { if (this.getWorldData().isHardcore() && this.difficulty < 3) {
this.difficulty = 3; this.difficulty = 3;
} }
@ -1912,7 +1912,7 @@ public class World implements IBlockAccess {
i2 += k1; i2 += k1;
j2 += j; j2 += j;
if (l2 == 0 && this.k(i2, k2, j2) <= this.random.nextInt(8) && this.a(EnumSkyBlock.SKY, i2, k2, j2) <= 0) { 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) { 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); 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); j2 = j + (l1 >> 8 & 15);
k2 = this.e(i2, j2); k2 = this.e(i2, j2);
if (this.v(i2, k2, 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; this.r = 2;
} }
} }
@ -2523,10 +2523,10 @@ public class World implements IBlockAccess {
} }
public EntityHuman findNearbyPlayer(Entity entity, double d0) { 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; double d4 = -1.0D;
EntityHuman entityhuman = null; EntityHuman entityhuman = null;
@ -2548,11 +2548,11 @@ public class World implements IBlockAccess {
return entityhuman; return entityhuman;
} }
public EntityHuman b(Entity entity, double d0) { public EntityHuman findNearbyVulnerablePlayer(Entity entity, double d0) {
return this.b(entity.locX, entity.locY, entity.locZ, 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; double d4 = -1.0D;
EntityHuman entityhuman = null; EntityHuman entityhuman = null;
@ -2632,7 +2632,7 @@ public class World implements IBlockAccess {
} }
public void l() { public void l() {
this.B.b(); this.dataManager.checkSession();
} }
public void setTime(long i) { public void setTime(long i) {
@ -2681,11 +2681,11 @@ public class World implements IBlockAccess {
} }
} }
public IDataManager q() { public IDataManager getDataManager() {
return this.B; return this.dataManager;
} }
public WorldData r() { public WorldData getWorldData() {
return this.worldData; return this.worldData;
} }
@ -2811,13 +2811,13 @@ public class World implements IBlockAccess {
} }
public Random w(int i, int j, int k) { 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); this.random.setSeed(l);
return this.random; return this.random;
} }
public boolean x() { public boolean updateLights() {
return false; return false;
} }
@ -2835,7 +2835,7 @@ public class World implements IBlockAccess {
// CraftBukkit start // CraftBukkit start
public UUID getUUID() { public UUID getUUID() {
return this.B.getUUID(); return this.dataManager.getUUID();
} }
// CraftBukkit end // CraftBukkit end
} }

View File

@ -25,29 +25,29 @@ public class WorldData {
public WorldData(NBTTagCompound nbttagcompound) { public WorldData(NBTTagCompound nbttagcompound) {
this.seed = nbttagcompound.getLong("RandomSeed"); this.seed = nbttagcompound.getLong("RandomSeed");
this.gameType = nbttagcompound.f("GameType"); this.gameType = nbttagcompound.getInt("GameType");
if (nbttagcompound.hasKey("MapFeatures")) { if (nbttagcompound.hasKey("MapFeatures")) {
this.useMapFeatures = nbttagcompound.n("MapFeatures"); this.useMapFeatures = nbttagcompound.getBoolean("MapFeatures");
} else { } else {
this.useMapFeatures = true; this.useMapFeatures = true;
} }
this.spawnX = nbttagcompound.f("SpawnX"); this.spawnX = nbttagcompound.getInt("SpawnX");
this.spawnY = nbttagcompound.f("SpawnY"); this.spawnY = nbttagcompound.getInt("SpawnY");
this.spawnZ = nbttagcompound.f("SpawnZ"); this.spawnZ = nbttagcompound.getInt("SpawnZ");
this.time = nbttagcompound.getLong("Time"); this.time = nbttagcompound.getLong("Time");
this.lastPlayed = nbttagcompound.getLong("LastPlayed"); this.lastPlayed = nbttagcompound.getLong("LastPlayed");
this.sizeOnDisk = nbttagcompound.getLong("SizeOnDisk"); this.sizeOnDisk = nbttagcompound.getLong("SizeOnDisk");
this.name = nbttagcompound.getString("LevelName"); this.name = nbttagcompound.getString("LevelName");
this.version = nbttagcompound.f("version"); this.version = nbttagcompound.getInt("version");
this.rainTicks = nbttagcompound.f("rainTime"); this.rainTicks = nbttagcompound.getInt("rainTime");
this.isRaining = nbttagcompound.n("raining"); this.isRaining = nbttagcompound.getBoolean("raining");
this.thunderTicks = nbttagcompound.f("thunderTime"); this.thunderTicks = nbttagcompound.getInt("thunderTime");
this.isThundering = nbttagcompound.n("thundering"); this.isThundering = nbttagcompound.getBoolean("thundering");
this.hardcore = nbttagcompound.n("hardcore"); this.hardcore = nbttagcompound.getBoolean("hardcore");
if (nbttagcompound.hasKey("Player")) { if (nbttagcompound.hasKey("Player")) {
this.playerData = nbttagcompound.l("Player"); this.playerData = nbttagcompound.getCompound("Player");
this.dimension = this.playerData.f("Dimension"); this.dimension = this.playerData.getInt("Dimension");
} }
} }
@ -107,23 +107,23 @@ public class WorldData {
private void a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) { private void a(NBTTagCompound nbttagcompound, NBTTagCompound nbttagcompound1) {
nbttagcompound.setLong("RandomSeed", this.seed); nbttagcompound.setLong("RandomSeed", this.seed);
nbttagcompound.a("GameType", this.gameType); nbttagcompound.setInt("GameType", this.gameType);
nbttagcompound.a("MapFeatures", this.useMapFeatures); nbttagcompound.setBoolean("MapFeatures", this.useMapFeatures);
nbttagcompound.a("SpawnX", this.spawnX); nbttagcompound.setInt("SpawnX", this.spawnX);
nbttagcompound.a("SpawnY", this.spawnY); nbttagcompound.setInt("SpawnY", this.spawnY);
nbttagcompound.a("SpawnZ", this.spawnZ); nbttagcompound.setInt("SpawnZ", this.spawnZ);
nbttagcompound.setLong("Time", this.time); nbttagcompound.setLong("Time", this.time);
nbttagcompound.setLong("SizeOnDisk", this.sizeOnDisk); nbttagcompound.setLong("SizeOnDisk", this.sizeOnDisk);
nbttagcompound.setLong("LastPlayed", System.currentTimeMillis()); nbttagcompound.setLong("LastPlayed", System.currentTimeMillis());
nbttagcompound.setString("LevelName", this.name); nbttagcompound.setString("LevelName", this.name);
nbttagcompound.a("version", this.version); nbttagcompound.setInt("version", this.version);
nbttagcompound.a("rainTime", this.rainTicks); nbttagcompound.setInt("rainTime", this.rainTicks);
nbttagcompound.a("raining", this.isRaining); nbttagcompound.setBoolean("raining", this.isRaining);
nbttagcompound.a("thunderTime", this.thunderTicks); nbttagcompound.setInt("thunderTime", this.thunderTicks);
nbttagcompound.a("thundering", this.isThundering); nbttagcompound.setBoolean("thundering", this.isThundering);
nbttagcompound.a("hardcore", this.hardcore); nbttagcompound.setBoolean("hardcore", this.hardcore);
if (nbttagcompound1 != null) { if (nbttagcompound1 != null) {
nbttagcompound.a("Player", nbttagcompound1); nbttagcompound.setCompound("Player", nbttagcompound1);
} }
} }

View File

@ -35,6 +35,6 @@ public class WorldManager implements IWorldAccess {
} }
public void a(EntityHuman entityhuman, int i, int j, int k, int l, int i1) { 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
} }
} }

View File

@ -16,15 +16,15 @@ import org.bukkit.craftbukkit.map.CraftMapView;
public class WorldMap extends WorldMapBase { public class WorldMap extends WorldMapBase {
public int b; public int centerX;
public int c; public int centerZ;
public byte map; public byte map;
public byte e; public byte scale;
public byte[] f = new byte[16384]; public byte[] colors = new byte[16384];
public int g; public int g;
public List h = new ArrayList(); public List h = new ArrayList();
private Map j = new HashMap(); private Map j = new HashMap();
public List i = new ArrayList(); public List decorations = new ArrayList();
// CraftBukkit start // CraftBukkit start
public final CraftMapView mapView; public final CraftMapView mapView;
@ -42,7 +42,7 @@ public class WorldMap extends WorldMapBase {
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
// CraftBukkit start // CraftBukkit start
byte dimension = nbttagcompound.d("dimension"); byte dimension = nbttagcompound.getByte("dimension");
if (dimension >= 10) { if (dimension >= 10) {
long least = nbttagcompound.getLong("UUIDLeast"); long least = nbttagcompound.getLong("UUIDLeast");
@ -65,26 +65,26 @@ public class WorldMap extends WorldMapBase {
this.map = dimension; this.map = dimension;
// CraftBukkit end // CraftBukkit end
this.b = nbttagcompound.f("xCenter"); this.centerX = nbttagcompound.getInt("xCenter");
this.c = nbttagcompound.f("zCenter"); this.centerZ = nbttagcompound.getInt("zCenter");
this.e = nbttagcompound.d("scale"); this.scale = nbttagcompound.getByte("scale");
if (this.e < 0) { if (this.scale < 0) {
this.e = 0; this.scale = 0;
} }
if (this.e > 4) { if (this.scale > 4) {
this.e = 4; this.scale = 4;
} }
short short1 = nbttagcompound.e("width"); short short1 = nbttagcompound.getShort("width");
short short2 = nbttagcompound.e("height"); short short2 = nbttagcompound.getShort("height");
if (short1 == 128 && short2 == 128) { if (short1 == 128 && short2 == 128) {
this.f = nbttagcompound.k("colors"); this.colors = nbttagcompound.getByteArray("colors");
} else { } 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 i = (128 - short1) / 2;
int j = (128 - short2) / 2; int j = (128 - short2) / 2;
@ -96,7 +96,7 @@ public class WorldMap extends WorldMapBase {
int j1 = i1 + i; int j1 = i1 + i;
if (j1 >= 0 || j1 < 128) { 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 // CraftBukkit end
nbttagcompound.a("dimension", this.map); nbttagcompound.setByte("dimension", this.map);
nbttagcompound.a("xCenter", this.b); nbttagcompound.setInt("xCenter", this.centerX);
nbttagcompound.a("zCenter", this.c); nbttagcompound.setInt("zCenter", this.centerZ);
nbttagcompound.a("scale", this.e); nbttagcompound.setByte("scale", this.scale);
nbttagcompound.a("width", (short) 128); nbttagcompound.setShort("width", (short) 128);
nbttagcompound.a("height", (short) 128); nbttagcompound.setShort("height", (short) 128);
nbttagcompound.a("colors", this.f); nbttagcompound.setByteArray("colors", this.colors);
} }
public void a(EntityHuman entityhuman, ItemStack itemstack) { public void a(EntityHuman entityhuman, ItemStack itemstack) {
@ -141,14 +141,14 @@ public class WorldMap extends WorldMapBase {
this.h.add(worldmaphumantracker); this.h.add(worldmaphumantracker);
} }
this.i.clear(); this.decorations.clear();
for (int i = 0; i < this.h.size(); ++i) { for (int i = 0; i < this.h.size(); ++i) {
WorldMapHumanTracker worldmaphumantracker1 = (WorldMapHumanTracker) this.h.get(i); WorldMapHumanTracker worldmaphumantracker1 = (WorldMapHumanTracker) this.h.get(i);
if (!worldmaphumantracker1.trackee.dead && worldmaphumantracker1.trackee.inventory.c(itemstack)) { if (!worldmaphumantracker1.trackee.dead && worldmaphumantracker1.trackee.inventory.c(itemstack)) {
float f = (float) (worldmaphumantracker1.trackee.locX - (double) this.b) / (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.c) / (float) (1 << this.e); float f1 = (float) (worldmaphumantracker1.trackee.locZ - (double) this.centerZ) / (float) (1 << this.scale);
byte b0 = 64; byte b0 = 64;
byte b1 = 64; byte b1 = 64;
@ -166,7 +166,7 @@ public class WorldMap extends WorldMapBase {
} }
if (worldmaphumantracker1.trackee.dimension == this.map) { 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 { } 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); WorldMapHumanTracker worldmaphumantracker = (WorldMapHumanTracker) this.j.get(entityhuman);
if (worldmaphumantracker == null) { 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(); super.a();
for (int l = 0; l < this.h.size(); ++l) { for (int l = 0; l < this.h.size(); ++l) {

View File

@ -13,25 +13,25 @@ import java.util.logging.Logger;
import java.util.UUID; // CraftBukkit 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 static final Logger log = Logger.getLogger("Minecraft");
private final File b; private final File baseDir;
private final File c; private final File playerDir;
private final File d; private final File dataDir;
private final long e = System.currentTimeMillis(); private final long sessionId = System.currentTimeMillis();
private final String f; private final String f;
private UUID uuid = null; // CraftBukkit private UUID uuid = null; // CraftBukkit
public PlayerNBTManager(File file1, String s, boolean flag) { public WorldNBTStorage(File file1, String s, boolean flag) {
this.b = new File(file1, s); this.baseDir = new File(file1, s);
this.b.mkdirs(); this.baseDir.mkdirs();
this.c = new File(this.b, "players"); this.playerDir = new File(this.baseDir, "players");
this.d = new File(this.b, "data"); this.dataDir = new File(this.baseDir, "data");
this.d.mkdirs(); this.dataDir.mkdirs();
this.f = s; this.f = s;
if (flag) { if (flag) {
this.c.mkdirs(); this.playerDir.mkdirs();
} }
this.f(); this.f();
@ -39,11 +39,11 @@ public class PlayerNBTManager implements PlayerFileData, IDataManager {
private void f() { private void f() {
try { try {
File file1 = new File(this.b, "session.lock"); File file1 = new File(this.baseDir, "session.lock");
DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file1)); DataOutputStream dataoutputstream = new DataOutputStream(new FileOutputStream(file1));
try { try {
dataoutputstream.writeLong(this.e); dataoutputstream.writeLong(this.sessionId);
} finally { } finally {
dataoutputstream.close(); dataoutputstream.close();
} }
@ -53,63 +53,63 @@ public class PlayerNBTManager implements PlayerFileData, IDataManager {
} }
} }
public File a() { // CraftBukkit - prot to public. Also, hi zml2008. public File getDirectory() { // CraftBukkit - prot to public.
return this.b; return this.baseDir;
} }
public void b() { public void checkSession() {
try { try {
File file1 = new File(this.b, "session.lock"); File file1 = new File(this.baseDir, "session.lock");
DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1)); DataInputStream datainputstream = new DataInputStream(new FileInputStream(file1));
try { try {
if (datainputstream.readLong() != this.e) { if (datainputstream.readLong() != this.sessionId) {
throw new MinecraftException("The save is being accessed from another location, aborting"); throw new WorldConlictException("The save is being accessed from another location, aborting");
} }
} finally { } finally {
datainputstream.close(); datainputstream.close();
} }
} catch (IOException ioexception) { } 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; File file1;
if (worldprovider instanceof WorldProviderHell) { if (worldprovider instanceof WorldProviderHell) {
file1 = new File(this.b, "DIM-1"); file1 = new File(this.baseDir, "DIM-1");
file1.mkdirs(); file1.mkdirs();
return new ChunkLoader(file1, true); return new ChunkLoader(file1, true);
} else if (worldprovider instanceof WorldProviderSky) { } else if (worldprovider instanceof WorldProviderTheEnd) {
file1 = new File(this.b, "DIM1"); file1 = new File(this.baseDir, "DIM1");
file1.mkdirs(); file1.mkdirs();
return new ChunkLoader(file1, true); return new ChunkLoader(file1, true);
} else { } else {
return new ChunkLoader(this.b, true); return new ChunkLoader(this.baseDir, true);
} }
} }
public WorldData c() { public WorldData getWorldData() {
File file1 = new File(this.b, "level.dat"); File file1 = new File(this.baseDir, "level.dat");
NBTTagCompound nbttagcompound; NBTTagCompound nbttagcompound;
NBTTagCompound nbttagcompound1; NBTTagCompound nbttagcompound1;
if (file1.exists()) { if (file1.exists()) {
try { try {
nbttagcompound = CompressedStreamTools.a((InputStream) (new FileInputStream(file1))); nbttagcompound = NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file1)));
nbttagcompound1 = nbttagcompound.l("Data"); nbttagcompound1 = nbttagcompound.getCompound("Data");
return new WorldData(nbttagcompound1); return new WorldData(nbttagcompound1);
} catch (Exception exception) { } catch (Exception exception) {
exception.printStackTrace(); exception.printStackTrace();
} }
} }
file1 = new File(this.b, "level.dat_old"); file1 = new File(this.baseDir, "level.dat_old");
if (file1.exists()) { if (file1.exists()) {
try { try {
nbttagcompound = CompressedStreamTools.a((InputStream) (new FileInputStream(file1))); nbttagcompound = NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file1)));
nbttagcompound1 = nbttagcompound.l("Data"); nbttagcompound1 = nbttagcompound.getCompound("Data");
return new WorldData(nbttagcompound1); return new WorldData(nbttagcompound1);
} catch (Exception exception1) { } catch (Exception exception1) {
exception1.printStackTrace(); exception1.printStackTrace();
@ -119,18 +119,18 @@ public class PlayerNBTManager implements PlayerFileData, IDataManager {
return null; return null;
} }
public void a(WorldData worlddata, List list) { public void saveWorldData(WorldData worlddata, List list) {
NBTTagCompound nbttagcompound = worlddata.a(list); NBTTagCompound nbttagcompound = worlddata.a(list);
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Data", (NBTBase) nbttagcompound); nbttagcompound1.set("Data", nbttagcompound);
try { try {
File file1 = new File(this.b, "level.dat_new"); File file1 = new File(this.baseDir, "level.dat_new");
File file2 = new File(this.b, "level.dat_old"); File file2 = new File(this.baseDir, "level.dat_old");
File file3 = new File(this.b, "level.dat"); 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()) { if (file2.exists()) {
file2.delete(); 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 nbttagcompound = worlddata.a();
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.a("Data", (NBTBase) nbttagcompound); nbttagcompound1.set("Data", nbttagcompound);
try { try {
File file1 = new File(this.b, "level.dat_new"); File file1 = new File(this.baseDir, "level.dat_new");
File file2 = new File(this.b, "level.dat_old"); File file2 = new File(this.baseDir, "level.dat_old");
File file3 = new File(this.b, "level.dat"); 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()) { if (file2.exists()) {
file2.delete(); file2.delete();
} }
@ -184,57 +184,57 @@ public class PlayerNBTManager implements PlayerFileData, IDataManager {
NBTTagCompound nbttagcompound = new NBTTagCompound(); NBTTagCompound nbttagcompound = new NBTTagCompound();
entityhuman.d(nbttagcompound); entityhuman.d(nbttagcompound);
File file1 = new File(this.c, "_tmp_.dat"); File file1 = new File(this.playerDir, "_tmp_.dat");
File file2 = new File(this.c, entityhuman.name + ".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()) { if (file2.exists()) {
file2.delete(); file2.delete();
} }
file1.renameTo(file2); file1.renameTo(file2);
} catch (Exception exception) { } 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) { public void b(EntityHuman entityhuman) {
NBTTagCompound nbttagcompound = this.a(entityhuman.name); NBTTagCompound nbttagcompound = this.getPlayerData(entityhuman.name);
if (nbttagcompound != null) { if (nbttagcompound != null) {
entityhuman.e(nbttagcompound); entityhuman.e(nbttagcompound);
} }
} }
public NBTTagCompound a(String s) { public NBTTagCompound getPlayerData(String s) {
try { try {
File file1 = new File(this.c, s + ".dat"); File file1 = new File(this.playerDir, s + ".dat");
if (file1.exists()) { if (file1.exists()) {
return CompressedStreamTools.a((InputStream) (new FileInputStream(file1))); return NBTCompressedStreamTools.a((InputStream) (new FileInputStream(file1)));
} }
} catch (Exception exception) { } catch (Exception exception) {
a.warning("Failed to load player data for " + s); log.warning("Failed to load player data for " + s);
} }
return null; return null;
} }
public PlayerFileData d() { public PlayerFileData getPlayerFileData() {
return this; return this;
} }
public void e() {} public void e() {}
public File b(String s) { public File getDataFile(String s) {
return new File(this.d, s + ".dat"); return new File(this.dataDir, s + ".dat");
} }
// CraftBukkit start // CraftBukkit start
public UUID getUUID() { public UUID getUUID() {
if (uuid != null) return uuid; if (uuid != null) return uuid;
try { try {
File file1 = new File(this.b, "uid.dat"); File file1 = new File(this.baseDir, "uid.dat");
if (!file1.exists()) { if (!file1.exists()) {
DataOutputStream dos = new DataOutputStream(new FileOutputStream(file1)); DataOutputStream dos = new DataOutputStream(new FileOutputStream(file1));
uuid = UUID.randomUUID(); uuid = UUID.randomUUID();

Some files were not shown because too many files have changed in this diff Show More