Updated to rename revision 02

This commit is contained in:
Erik Broes 2012-02-29 22:31:04 +01:00 committed by Nathan Adams
parent 8524ff8ef7
commit 33ba9f0a2f
100 changed files with 772 additions and 761 deletions

View file

@ -58,7 +58,7 @@
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>
<artifactId>minecraft-server</artifactId> <artifactId>minecraft-server</artifactId>
<version>1.1_01</version> <version>1.1_02</version>
<type>jar</type> <type>jar</type>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

View file

@ -549,7 +549,7 @@ public class Block {
} }
public String getName() { public String getName() {
return LocaleI18n.a(this.n() + ".name"); return LocaleI18n.get(this.n() + ".name");
} }
public String n() { public String n() {

View file

@ -69,7 +69,7 @@ public class BlockDispenser extends BlockContainer {
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k); TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);
if (tileentitydispenser != null) { if (tileentitydispenser != null) {
entityhuman.a(tileentitydispenser); entityhuman.openDispenser(tileentitydispenser);
} }
return true; return true;
@ -111,7 +111,7 @@ public class BlockDispenser extends BlockContainer {
double d2 = (double) k + (double) b1 * 0.6D + 0.5D; double d2 = (double) k + (double) b1 * 0.6D + 0.5D;
if (itemstack == null) { if (itemstack == null) {
world.f(1001, i, j, k, 0); world.triggerEffect(1001, i, j, k, 0);
} else { } else {
// CraftBukkit start // CraftBukkit start
double d3 = random.nextDouble() * 0.1D + 0.2D; double d3 = random.nextDouble() * 0.1D + 0.2D;
@ -148,25 +148,25 @@ public class BlockDispenser extends BlockContainer {
entityarrow.shoot((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F); entityarrow.shoot((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
entityarrow.fromPlayer = true; entityarrow.fromPlayer = true;
world.addEntity(entityarrow); world.addEntity(entityarrow);
world.f(1002, i, j, k, 0); world.triggerEffect(1002, i, j, k, 0);
} else if (itemstack.id == Item.EGG.id) { } else if (itemstack.id == Item.EGG.id) {
EntityEgg entityegg = new EntityEgg(world, d0, d1, d2); EntityEgg entityegg = new EntityEgg(world, d0, d1, d2);
entityegg.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F); entityegg.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
world.addEntity(entityegg); world.addEntity(entityegg);
world.f(1002, i, j, k, 0); world.triggerEffect(1002, i, j, k, 0);
} else if (itemstack.id == Item.SNOW_BALL.id) { } else if (itemstack.id == Item.SNOW_BALL.id) {
EntitySnowball entitysnowball = new EntitySnowball(world, d0, d1, d2); EntitySnowball entitysnowball = new EntitySnowball(world, d0, d1, d2);
entitysnowball.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F); entitysnowball.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
world.addEntity(entitysnowball); world.addEntity(entitysnowball);
world.f(1002, i, j, k, 0); world.triggerEffect(1002, i, j, k, 0);
} else if (itemstack.id == Item.POTION.id && ItemPotion.c(itemstack.getData())) { } else if (itemstack.id == Item.POTION.id && ItemPotion.c(itemstack.getData())) {
EntityPotion entitypotion = new EntityPotion(world, d0, d1, d2, itemstack.getData()); EntityPotion entitypotion = new EntityPotion(world, d0, d1, d2, itemstack.getData());
entitypotion.a((double) b0, 0.10000000149011612D, (double) b1, 1.375F, 3.0F); entitypotion.a((double) b0, 0.10000000149011612D, (double) b1, 1.375F, 3.0F);
world.addEntity(entitypotion); world.addEntity(entitypotion);
world.f(1002, i, j, k, 0); world.triggerEffect(1002, i, j, k, 0);
} else { } else {
EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack); EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
// CraftBukkit start // CraftBukkit start
@ -176,10 +176,10 @@ public class BlockDispenser extends BlockContainer {
entityitem.motZ = motZ; entityitem.motZ = motZ;
// CraftBukkit end // CraftBukkit end
world.addEntity(entityitem); world.addEntity(entityitem);
world.f(1000, i, j, k, 0); world.triggerEffect(1000, i, j, k, 0);
} }
world.f(2000, i, j, k, b0 + 1 + (b1 + 1) * 3); world.triggerEffect(2000, i, j, k, b0 + 1 + (b1 + 1) * 3);
} }
} }
} }
@ -244,7 +244,8 @@ public class BlockDispenser extends BlockContainer {
} }
itemstack.count -= i1; itemstack.count -= i1;
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, i1, itemstack.getData(), itemstack.getEnchantments())); // CraftBukkit - make sure enchantments are copied over // CraftBukkit - make sure enchantments are copied over
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, i1, itemstack.getData(), itemstack.getEnchantments()));
float f3 = 0.05F; float f3 = 0.05F;
entityitem.motX = (double) ((float) this.a.nextGaussian() * f3); entityitem.motX = (double) ((float) this.a.nextGaussian() * f3);

View file

@ -62,7 +62,7 @@ public class BlockFurnace extends BlockContainer {
TileEntityFurnace tileentityfurnace = (TileEntityFurnace) world.getTileEntity(i, j, k); TileEntityFurnace tileentityfurnace = (TileEntityFurnace) world.getTileEntity(i, j, k);
if (tileentityfurnace != null) { if (tileentityfurnace != null) {
entityhuman.a(tileentityfurnace); entityhuman.openFurnace(tileentityfurnace);
} }
return true; return true;
@ -133,7 +133,8 @@ public class BlockFurnace extends BlockContainer {
} }
itemstack.count -= i1; itemstack.count -= i1;
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, i1, itemstack.getData(), itemstack.getEnchantments())); // CraftBukkit - include enchantments in new itemstack // CraftBukkit - include enchantments in new itemstack
EntityItem entityitem = new EntityItem(world, (double) ((float) i + f), (double) ((float) j + f1), (double) ((float) k + f2), new ItemStack(itemstack.id, i1, itemstack.getData(), itemstack.getEnchantments()));
float f3 = 0.05F; float f3 = 0.05F;
entityitem.motX = (double) ((float) this.a.nextGaussian() * f3); entityitem.motX = (double) ((float) this.a.nextGaussian() * f3);

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 == Facing.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.OPPOSITE_FACING[k] ? 109 : 108));
} }
public int c() { public int c() {
@ -218,7 +218,7 @@ public class BlockPiston extends Block {
} }
public static int d(int i) { public static int d(int i) {
if ((i & 7) >= Facing.a.length) return 0; // CraftBukkit - check for AIOOB on piston data if ((i & 7) >= Facing.OPPOSITE_FACING.length) return 0; // CraftBukkit - check for AIOOB on piston data
return i & 7; return i & 7;
} }

View file

@ -17,7 +17,7 @@ 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 = Facing.a[b(l)]; int i1 = Facing.OPPOSITE_FACING[b(l)];
i += Facing.b[i1]; i += Facing.b[i1];
j += Facing.c[i1]; j += Facing.c[i1];
@ -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 == Facing.a[k] ? 107 : 108); return i == k ? (this.a >= 0 ? this.a : ((j & 8) != 0 ? this.textureId - 1 : this.textureId)) : (i == Facing.OPPOSITE_FACING[k] ? 107 : 108);
} }
public int c() { public int c() {

View file

@ -4,11 +4,11 @@ import java.util.Random;
public class BlockStem extends BlockFlower { public class BlockStem extends BlockFlower {
private Block a; private Block blockFruit;
protected BlockStem(int i, Block block) { protected BlockStem(int i, Block block) {
super(i, 111); super(i, 111);
this.a = block; this.blockFruit = block;
this.a(true); this.a(true);
float f = 0.125F; float f = 0.125F;
@ -28,21 +28,22 @@ public class BlockStem extends BlockFlower {
int l = world.getData(i, j, k); int l = world.getData(i, j, k);
if (l < 7) { if (l < 7) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, ++l); // CraftBukkit ++l;
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, i, j, k, this.id, l); // CraftBukkit
} else { } else {
if (world.getTypeId(i - 1, j, k) == this.a.id) { if (world.getTypeId(i - 1, j, k) == this.blockFruit.id) {
return; return;
} }
if (world.getTypeId(i + 1, j, k) == this.a.id) { if (world.getTypeId(i + 1, j, k) == this.blockFruit.id) {
return; return;
} }
if (world.getTypeId(i, j, k - 1) == this.a.id) { if (world.getTypeId(i, j, k - 1) == this.blockFruit.id) {
return; return;
} }
if (world.getTypeId(i, j, k + 1) == this.a.id) { if (world.getTypeId(i, j, k + 1) == this.blockFruit.id) {
return; return;
} }
@ -69,7 +70,7 @@ public class BlockStem extends BlockFlower {
int l1 = world.getTypeId(j1, j - 1, k1); int l1 = world.getTypeId(j1, j - 1, k1);
if (world.getTypeId(j1, j, k1) == 0 && (l1 == Block.SOIL.id || l1 == Block.DIRT.id || l1 == Block.GRASS.id)) { if (world.getTypeId(j1, j, k1) == 0 && (l1 == Block.SOIL.id || l1 == Block.DIRT.id || l1 == Block.GRASS.id)) {
org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, j1, j, k1, this.a.id, 0); // CraftBukkit org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, j1, j, k1, this.blockFruit.id, 0); // CraftBukkit
} }
} }
} }
@ -147,11 +148,11 @@ public class BlockStem extends BlockFlower {
if (!world.isStatic) { if (!world.isStatic) {
Item item = null; Item item = null;
if (this.a == Block.PUMPKIN) { if (this.blockFruit == Block.PUMPKIN) {
item = Item.PUMPKIN_SEEDS; item = Item.PUMPKIN_SEEDS;
} }
if (this.a == Block.MELON) { if (this.blockFruit == Block.MELON) {
item = Item.MELON_SEEDS; item = Item.MELON_SEEDS;
} }

View file

@ -12,7 +12,7 @@ import org.bukkit.Bukkit; // CraftBukkit
public class Chunk { public class Chunk {
public static boolean a; public static boolean a;
public byte[] b; public byte[] blocks;
public int[] c; public int[] c;
public boolean[] d; public boolean[] d;
public boolean e; public boolean e;
@ -71,7 +71,7 @@ public class Chunk {
public Chunk(World world, byte[] abyte, int i, int j) { public Chunk(World world, byte[] abyte, int i, int j) {
this(world, i, j); this(world, i, j);
this.b = abyte; this.blocks = abyte;
this.g = new NibbleArray(abyte.length, world.heightBits); this.g = new NibbleArray(abyte.length, world.heightBits);
this.h = new NibbleArray(abyte.length, world.heightBits); this.h = new NibbleArray(abyte.length, world.heightBits);
this.i = new NibbleArray(abyte.length, world.heightBits); this.i = new NibbleArray(abyte.length, world.heightBits);
@ -99,7 +99,7 @@ public class Chunk {
int i1; int i1;
for (i1 = j << this.world.heightBitsPlusFour | k << this.world.heightBits; l > 0 && Block.lightBlock[this.b[i1 + l - 1] & 255] == 0; --l) { for (i1 = j << this.world.heightBitsPlusFour | k << this.world.heightBits; l > 0 && Block.lightBlock[this.blocks[i1 + l - 1] & 255] == 0; --l) {
; ;
} }
@ -113,7 +113,7 @@ public class Chunk {
int k1 = this.world.height - 1; int k1 = this.world.height - 1;
do { do {
j1 -= Block.lightBlock[this.b[i1 + k1] & 255]; j1 -= Block.lightBlock[this.blocks[i1 + k1] & 255];
if (j1 > 0) { if (j1 > 0) {
this.h.a(j, k1, k, j1); this.h.a(j, k1, k, j1);
} }
@ -208,7 +208,7 @@ public class Chunk {
i1 = j; i1 = j;
} }
for (int j1 = i << this.world.heightBitsPlusFour | k << this.world.heightBits; i1 > 0 && Block.lightBlock[this.b[j1 + i1 - 1] & 255] == 0; --i1) { for (int j1 = i << this.world.heightBitsPlusFour | k << this.world.heightBits; i1 > 0 && Block.lightBlock[this.blocks[j1 + i1 - 1] & 255] == 0; --i1) {
; ;
} }
@ -287,7 +287,7 @@ public class Chunk {
} }
public int getTypeId(int i, int j, int k) { public int getTypeId(int i, int j, int k) {
return this.b[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] & 255; return this.blocks[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] & 255;
} }
public boolean a(int i, int j, int k, int l, int i1) { public boolean a(int i, int j, int k, int l, int i1) {
@ -299,7 +299,7 @@ public class Chunk {
} }
int k1 = this.heightMap[k << 4 | i] & 255; int k1 = this.heightMap[k << 4 | i] & 255;
int l1 = this.b[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] & 255; int l1 = this.blocks[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] & 255;
if (l1 == l && this.g.a(i, j, k) == i1) { if (l1 == l && this.g.a(i, j, k) == i1) {
return false; return false;
@ -307,7 +307,7 @@ public class Chunk {
int i2 = this.x * 16 + i; int i2 = this.x * 16 + i;
int j2 = this.z * 16 + k; int j2 = this.z * 16 + k;
this.b[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] = (byte) (b0 & 255); this.blocks[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] = (byte) (b0 & 255);
if (l1 != 0) { if (l1 != 0) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
Block.byId[l1].remove(this.world, i2, j, j2); Block.byId[l1].remove(this.world, i2, j, j2);
@ -316,7 +316,7 @@ public class Chunk {
} }
} }
if ((this.b[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] & 255) != l) return false; // CraftBukkit if ((this.blocks[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] & 255) != l) return false; // CraftBukkit
this.g.a(i, j, k, i1); this.g.a(i, j, k, i1);
if (!this.world.worldProvider.f) { if (!this.world.worldProvider.f) {
@ -373,7 +373,7 @@ public class Chunk {
} }
int j1 = this.heightMap[i1] & 255; int j1 = this.heightMap[i1] & 255;
int k1 = this.b[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] & 255; int k1 = this.blocks[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] & 255;
if (k1 == l) { if (k1 == l) {
return false; return false;
@ -381,12 +381,12 @@ public class Chunk {
int l1 = this.x * 16 + i; int l1 = this.x * 16 + i;
int i2 = this.z * 16 + k; int i2 = this.z * 16 + k;
this.b[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] = (byte) (b0 & 255); this.blocks[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] = (byte) (b0 & 255);
if (k1 != 0) { if (k1 != 0) {
Block.byId[k1].remove(this.world, l1, j, i2); Block.byId[k1].remove(this.world, l1, j, i2);
} }
if ((this.b[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] & 255) != l) return false; // CraftBukkit if ((this.blocks[i << this.world.heightBitsPlusFour | k << this.world.heightBits | j] & 255) != l) return false; // CraftBukkit
this.g.a(i, j, k, 0); this.g.a(i, j, k, 0);
if (Block.lightBlock[b0 & 255] != 0) { if (Block.lightBlock[b0 & 255] != 0) {
@ -457,7 +457,7 @@ public class Chunk {
} }
} }
public int a(EnumSkyBlock enumskyblock, int i, int j, int k) { public int getBrightness(EnumSkyBlock enumskyblock, int i, int j, int k) {
return enumskyblock == EnumSkyBlock.SKY ? this.h.a(i, j, k) : (enumskyblock == EnumSkyBlock.BLOCK ? this.i.a(i, j, k) : 0); return enumskyblock == EnumSkyBlock.SKY ? this.h.a(i, j, k) : (enumskyblock == EnumSkyBlock.BLOCK ? this.i.a(i, j, k) : 0);
} }
@ -741,9 +741,9 @@ public class Chunk {
int i2 = i1 - j; int i2 = i1 - j;
int j2 = j1 - k; int j2 = j1 - k;
if (l1 * i2 * j2 == this.b.length) { if (l1 * i2 * j2 == this.blocks.length) {
System.arraycopy(this.b, 0, abyte, k1, this.b.length); System.arraycopy(this.blocks, 0, abyte, k1, this.blocks.length);
k1 += this.b.length; k1 += this.blocks.length;
System.arraycopy(this.g.a, 0, abyte, k1, this.g.a.length); System.arraycopy(this.g.a, 0, abyte, k1, this.g.a.length);
k1 += this.g.a.length; k1 += this.g.a.length;
System.arraycopy(this.i.a, 0, abyte, k1, this.i.a.length); System.arraycopy(this.i.a, 0, abyte, k1, this.i.a.length);
@ -761,7 +761,7 @@ public class Chunk {
for (l2 = k; l2 < j1; ++l2) { for (l2 = k; l2 < j1; ++l2) {
i3 = k2 << this.world.heightBitsPlusFour | l2 << this.world.heightBits | j; i3 = k2 << this.world.heightBitsPlusFour | l2 << this.world.heightBits | j;
j3 = i1 - j; j3 = i1 - j;
System.arraycopy(this.b, i3, abyte, k1, j3); System.arraycopy(this.blocks, i3, abyte, k1, j3);
k1 += j3; k1 += j3;
} }
} }
@ -806,7 +806,7 @@ public class Chunk {
} }
public void h() { public void h() {
BlockRegister.a(this.b); BlockRegister.a(this.blocks);
} }
public void a(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) { public void a(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) {

View file

@ -120,7 +120,7 @@ public class ChunkLoader implements IChunkLoader {
nbttagcompound.setInt("xPos", chunk.x); nbttagcompound.setInt("xPos", chunk.x);
nbttagcompound.setInt("zPos", chunk.z); nbttagcompound.setInt("zPos", chunk.z);
nbttagcompound.setLong("LastUpdate", world.getTime()); nbttagcompound.setLong("LastUpdate", world.getTime());
nbttagcompound.setByteArray("Blocks", chunk.b); nbttagcompound.setByteArray("Blocks", chunk.blocks);
nbttagcompound.setByteArray("Data", chunk.g.a); nbttagcompound.setByteArray("Data", chunk.g.a);
nbttagcompound.setByteArray("SkyLight", chunk.h.a); nbttagcompound.setByteArray("SkyLight", chunk.h.a);
nbttagcompound.setByteArray("BlockLight", chunk.i.a); nbttagcompound.setByteArray("BlockLight", chunk.i.a);
@ -188,24 +188,24 @@ public class ChunkLoader implements IChunkLoader {
int j = nbttagcompound.getInt("zPos"); int j = nbttagcompound.getInt("zPos");
Chunk chunk = new Chunk(world, i, j); Chunk chunk = new Chunk(world, i, j);
chunk.b = nbttagcompound.getByteArray("Blocks"); chunk.blocks = nbttagcompound.getByteArray("Blocks");
chunk.g = new NibbleArray(nbttagcompound.getByteArray("Data"), world.heightBits); chunk.g = new NibbleArray(nbttagcompound.getByteArray("Data"), world.heightBits);
chunk.h = new NibbleArray(nbttagcompound.getByteArray("SkyLight"), world.heightBits); chunk.h = new NibbleArray(nbttagcompound.getByteArray("SkyLight"), world.heightBits);
chunk.i = new NibbleArray(nbttagcompound.getByteArray("BlockLight"), world.heightBits); chunk.i = new NibbleArray(nbttagcompound.getByteArray("BlockLight"), world.heightBits);
chunk.heightMap = nbttagcompound.getByteArray("HeightMap"); chunk.heightMap = nbttagcompound.getByteArray("HeightMap");
chunk.done = nbttagcompound.getBoolean("TerrainPopulated"); chunk.done = nbttagcompound.getBoolean("TerrainPopulated");
if (!chunk.g.a()) { if (!chunk.g.a()) {
chunk.g = new NibbleArray(chunk.b.length, world.heightBits); chunk.g = new NibbleArray(chunk.blocks.length, world.heightBits);
} }
if (chunk.heightMap == null || !chunk.h.a()) { if (chunk.heightMap == null || !chunk.h.a()) {
chunk.heightMap = new byte[256]; chunk.heightMap = new byte[256];
chunk.h = new NibbleArray(chunk.b.length, world.heightBits); chunk.h = new NibbleArray(chunk.blocks.length, world.heightBits);
chunk.initLighting(); chunk.initLighting();
} }
if (!chunk.i.a()) { if (!chunk.i.a()) {
chunk.i = new NibbleArray(chunk.b.length, world.heightBits); chunk.i = new NibbleArray(chunk.blocks.length, world.heightBits);
chunk.a(); chunk.a();
} }

View file

@ -12,6 +12,7 @@ import org.bukkit.inventory.InventoryView;
// CraftBukkit end // CraftBukkit end
public abstract class Container { public abstract class Container {
public List d = new ArrayList(); public List d = new ArrayList();
public List e = new ArrayList(); public List e = new ArrayList();
public int windowId = 0; public int windowId = 0;
@ -24,10 +25,10 @@ public abstract class Container {
public abstract InventoryView getBukkitView(); public abstract InventoryView getBukkitView();
public void transferTo(Container other, CraftHumanEntity player) { public void transferTo(Container other, CraftHumanEntity player) {
InventoryView source = this.getBukkitView(), destination = other.getBukkitView(); InventoryView source = this.getBukkitView(), destination = other.getBukkitView();
((CraftInventory)source.getTopInventory()).getInventory().onClose(player); ((CraftInventory) source.getTopInventory()).getInventory().onClose(player);
((CraftInventory)source.getBottomInventory()).getInventory().onClose(player); ((CraftInventory) source.getBottomInventory()).getInventory().onClose(player);
((CraftInventory)destination.getTopInventory()).getInventory().onOpen(player); ((CraftInventory) destination.getTopInventory()).getInventory().onOpen(player);
((CraftInventory)destination.getBottomInventory()).getInventory().onOpen(player); ((CraftInventory) destination.getBottomInventory()).getInventory().onOpen(player);
} }
// CraftBukkit end // CraftBukkit end
@ -39,7 +40,7 @@ public abstract class Container {
this.d.add(null); this.d.add(null);
} }
public void a(ICrafting icrafting) { public void addSlotListener(ICrafting icrafting) {
if (this.listeners.contains(icrafting)) { if (this.listeners.contains(icrafting)) {
throw new IllegalArgumentException("Listener already listening"); throw new IllegalArgumentException("Listener already listening");
} else { } else {
@ -91,7 +92,7 @@ public abstract class Container {
return null; return null;
} }
public Slot b(int i) { public Slot getSlot(int i) {
return (Slot) this.e.get(i); return (Slot) this.e.get(i);
} }
@ -101,7 +102,7 @@ public abstract class Container {
return slot != null ? slot.getItem() : null; return slot != null ? slot.getItem() : null;
} }
public ItemStack a(int i, int j, boolean flag, EntityHuman entityhuman) { public ItemStack clickItem(int i, int j, boolean flag, EntityHuman entityhuman) {
ItemStack itemstack = null; ItemStack itemstack = null;
if (j > 1) { if (j > 1) {
@ -111,16 +112,16 @@ public abstract class Container {
PlayerInventory playerinventory = entityhuman.inventory; PlayerInventory playerinventory = entityhuman.inventory;
if (i == -999) { if (i == -999) {
if (playerinventory.l() != null && i == -999) { if (playerinventory.getCarried() != null && i == -999) {
if (j == 0) { if (j == 0) {
entityhuman.b(playerinventory.l()); entityhuman.drop(playerinventory.getCarried());
playerinventory.b((ItemStack) null); playerinventory.setCarried((ItemStack) null);
} }
if (j == 1) { if (j == 1) {
entityhuman.b(playerinventory.l().a(1)); entityhuman.drop(playerinventory.getCarried().a(1));
if (playerinventory.l().count == 0) { if (playerinventory.getCarried().count == 0) {
playerinventory.b((ItemStack) null); playerinventory.setCarried((ItemStack) null);
} }
} }
} }
@ -147,7 +148,7 @@ public abstract class Container {
if (slot1 != null) { if (slot1 != null) {
slot1.d(); slot1.d();
ItemStack itemstack2 = slot1.getItem(); ItemStack itemstack2 = slot1.getItem();
ItemStack itemstack3 = playerinventory.l(); ItemStack itemstack3 = playerinventory.getCarried();
if (itemstack2 != null) { if (itemstack2 != null) {
itemstack = itemstack2.cloneItemStack(); itemstack = itemstack2.cloneItemStack();
@ -162,21 +163,21 @@ public abstract class Container {
l = slot1.a(); l = slot1.a();
} }
slot1.c(itemstack3.a(l)); slot1.set(itemstack3.a(l));
if (itemstack3.count == 0) { if (itemstack3.count == 0) {
playerinventory.b((ItemStack) null); playerinventory.setCarried((ItemStack) null);
} }
} }
} else if (itemstack3 == null) { } else if (itemstack3 == null) {
l = j == 0 ? itemstack2.count : (itemstack2.count + 1) / 2; l = j == 0 ? itemstack2.count : (itemstack2.count + 1) / 2;
ItemStack itemstack4 = slot1.a(l); ItemStack itemstack4 = slot1.a(l);
playerinventory.b(itemstack4); playerinventory.setCarried(itemstack4);
if (itemstack2.count == 0) { if (itemstack2.count == 0) {
slot1.c((ItemStack) null); slot1.set((ItemStack) null);
} }
slot1.b(playerinventory.l()); slot1.b(playerinventory.getCarried());
} else if (slot1.isAllowed(itemstack3)) { } else if (slot1.isAllowed(itemstack3)) {
if (itemstack2.id == itemstack3.id && (!itemstack2.usesData() || itemstack2.getData() == itemstack3.getData()) && ItemStack.equals(itemstack2, itemstack3)) { if (itemstack2.id == itemstack3.id && (!itemstack2.usesData() || itemstack2.getData() == itemstack3.getData()) && ItemStack.equals(itemstack2, itemstack3)) {
l = j == 0 ? itemstack3.count : 1; l = j == 0 ? itemstack3.count : 1;
@ -190,13 +191,13 @@ public abstract class Container {
itemstack3.a(l); itemstack3.a(l);
if (itemstack3.count == 0) { if (itemstack3.count == 0) {
playerinventory.b((ItemStack) null); playerinventory.setCarried((ItemStack) null);
} }
itemstack2.count += l; itemstack2.count += l;
} else if (itemstack3.count <= slot1.a()) { } else if (itemstack3.count <= slot1.a()) {
slot1.c(itemstack3); slot1.set(itemstack3);
playerinventory.b(itemstack2); playerinventory.setCarried(itemstack2);
} }
} else if (itemstack2.id == itemstack3.id && itemstack3.getMaxStackSize() > 1 && (!itemstack2.usesData() || itemstack2.getData() == itemstack3.getData()) && ItemStack.equals(itemstack2, itemstack3)) { } else if (itemstack2.id == itemstack3.id && itemstack3.getMaxStackSize() > 1 && (!itemstack2.usesData() || itemstack2.getData() == itemstack3.getData()) && ItemStack.equals(itemstack2, itemstack3)) {
l = itemstack2.count; l = itemstack2.count;
@ -204,10 +205,10 @@ public abstract class Container {
itemstack3.count += l; itemstack3.count += l;
itemstack2.a(l); itemstack2.a(l);
if (itemstack2.count == 0) { if (itemstack2.count == 0) {
slot1.c((ItemStack) null); slot1.set((ItemStack) null);
} }
slot1.b(playerinventory.l()); slot1.b(playerinventory.getCarried());
} }
} }
} }
@ -219,15 +220,15 @@ public abstract class Container {
} }
protected void b(int i, int j, boolean flag, EntityHuman entityhuman) { protected void b(int i, int j, boolean flag, EntityHuman entityhuman) {
this.a(i, j, flag, entityhuman); this.clickItem(i, j, flag, entityhuman);
} }
public void a(EntityHuman entityhuman) { public void a(EntityHuman entityhuman) {
PlayerInventory playerinventory = entityhuman.inventory; PlayerInventory playerinventory = entityhuman.inventory;
if (playerinventory.l() != null) { if (playerinventory.getCarried() != null) {
entityhuman.b(playerinventory.l()); entityhuman.drop(playerinventory.getCarried());
playerinventory.b((ItemStack) null); playerinventory.setCarried((ItemStack) null);
} }
} }
@ -235,8 +236,8 @@ public abstract class Container {
this.a(); this.a();
} }
public void a(int i, ItemStack itemstack) { public void setItem(int i, ItemStack itemstack) {
this.b(i).c(itemstack); this.getSlot(i).set(itemstack);
} }
public boolean c(EntityHuman entityhuman) { public boolean c(EntityHuman entityhuman) {
@ -303,7 +304,7 @@ public abstract class Container {
slot = (Slot) this.e.get(k); slot = (Slot) this.e.get(k);
itemstack1 = slot.getItem(); itemstack1 = slot.getItem();
if (itemstack1 == null) { if (itemstack1 == null) {
slot.c(itemstack.cloneItemStack()); slot.set(itemstack.cloneItemStack());
slot.d(); slot.d();
itemstack.count = 0; itemstack.count = 0;
flag1 = true; flag1 = true;

View file

@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
public class ContainerBrewingStand extends Container { public class ContainerBrewingStand extends Container {
private TileEntityBrewingStand a; private TileEntityBrewingStand brewingStand;
private int b = 0; private int b = 0;
// CraftBukkit start // CraftBukkit start
private CraftInventoryView bukkitEntity = null; private CraftInventoryView bukkitEntity = null;
@ -16,10 +16,10 @@ public class ContainerBrewingStand extends Container {
public ContainerBrewingStand(PlayerInventory playerinventory, TileEntityBrewingStand tileentitybrewingstand) { public ContainerBrewingStand(PlayerInventory playerinventory, TileEntityBrewingStand tileentitybrewingstand) {
player = playerinventory; // CraftBukkit player = playerinventory; // CraftBukkit
this.a = tileentitybrewingstand; this.brewingStand = tileentitybrewingstand;
this.a(new SlotPotionBottle(this, playerinventory.d, tileentitybrewingstand, 0, 56, 46)); this.a(new SlotPotionBottle(this, playerinventory.player, tileentitybrewingstand, 0, 56, 46));
this.a(new SlotPotionBottle(this, playerinventory.d, tileentitybrewingstand, 1, 79, 53)); this.a(new SlotPotionBottle(this, playerinventory.player, tileentitybrewingstand, 1, 79, 53));
this.a(new SlotPotionBottle(this, playerinventory.d, tileentitybrewingstand, 2, 102, 46)); this.a(new SlotPotionBottle(this, playerinventory.player, tileentitybrewingstand, 2, 102, 46));
this.a(new SlotBrewing(this, tileentitybrewingstand, 3, 79, 17)); this.a(new SlotBrewing(this, tileentitybrewingstand, 3, 79, 17));
int i; int i;
@ -35,9 +35,9 @@ public class ContainerBrewingStand extends Container {
} }
} }
public void a(ICrafting icrafting) { public void addSlotListener(ICrafting icrafting) {
super.a(icrafting); super.addSlotListener(icrafting);
icrafting.a(this, 0, this.a.h()); icrafting.setContainerData(this, 0, this.brewingStand.h());
} }
public void a() { public void a() {
@ -46,17 +46,17 @@ public class ContainerBrewingStand extends Container {
for (int i = 0; i < this.listeners.size(); ++i) { for (int i = 0; i < this.listeners.size(); ++i) {
ICrafting icrafting = (ICrafting) this.listeners.get(i); ICrafting icrafting = (ICrafting) this.listeners.get(i);
if (this.b != this.a.h()) { if (this.b != this.brewingStand.h()) {
icrafting.a(this, 0, this.a.h()); icrafting.setContainerData(this, 0, this.brewingStand.h());
} }
} }
this.b = this.a.h(); this.b = this.brewingStand.h();
} }
public boolean b(EntityHuman entityhuman) { public boolean b(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit if (!this.checkReachable) return true; // CraftBukkit
return this.a.a(entityhuman); return this.brewingStand.a(entityhuman);
} }
public ItemStack a(int i) { public ItemStack a(int i) {
@ -84,7 +84,7 @@ public class ContainerBrewingStand extends Container {
} }
if (itemstack1.count == 0) { if (itemstack1.count == 0) {
slot.c((ItemStack) null); slot.set((ItemStack) null);
} else { } else {
slot.d(); slot.d();
} }
@ -104,8 +104,8 @@ public class ContainerBrewingStand extends Container {
if (bukkitEntity != null) { if (bukkitEntity != null) {
return bukkitEntity; return bukkitEntity;
} }
CraftInventory inventory = new CraftInventory(this.a); CraftInventory inventory = new CraftInventory(this.brewingStand);
bukkitEntity = new CraftInventoryView(this.player.d.getBukkitEntity(), inventory, this); bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity; return bukkitEntity;
} }
// CraftBukkit end // CraftBukkit end

View file

@ -9,15 +9,31 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
public class ContainerChest extends Container { public class ContainerChest extends Container {
public IInventory a; // CraftBukkit - private->public public IInventory container; // CraftBukkit - private->public
private int b; private int b;
// CraftBukkit start // CraftBukkit start
private CraftInventoryView bukkitEntity = null; private CraftInventoryView bukkitEntity = null;
private PlayerInventory player; private PlayerInventory player;
public CraftInventoryView getBukkitView() {
if (bukkitEntity != null) {
return bukkitEntity;
}
CraftInventory inventory;
if (this.container instanceof PlayerInventory) {
inventory = new CraftInventoryPlayer((PlayerInventory) this.container);
} else if (this.container instanceof InventoryLargeChest) {
inventory = new CraftInventoryDoubleChest((InventoryLargeChest) this.container);
} else {
inventory = new CraftInventory(this.container);
}
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity;
}
// CraftBukkit end // CraftBukkit end
public ContainerChest(IInventory iinventory, IInventory iinventory1) { public ContainerChest(IInventory iinventory, IInventory iinventory1) {
this.a = iinventory1; this.container = iinventory1;
this.b = iinventory1.getSize() / 9; this.b = iinventory1.getSize() / 9;
iinventory1.f(); iinventory1.f();
int i = (this.b - 4) * 18; int i = (this.b - 4) * 18;
@ -48,7 +64,7 @@ public class ContainerChest extends Container {
public boolean b(EntityHuman entityhuman) { public boolean b(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit if (!this.checkReachable) return true; // CraftBukkit
return this.a.a(entityhuman); return this.container.a(entityhuman);
} }
public ItemStack a(int i) { public ItemStack a(int i) {
@ -68,7 +84,7 @@ public class ContainerChest extends Container {
} }
if (itemstack1.count == 0) { if (itemstack1.count == 0) {
slot.c((ItemStack) null); slot.set((ItemStack) null);
} else { } else {
slot.d(); slot.d();
} }
@ -77,26 +93,8 @@ public class ContainerChest extends Container {
return itemstack; return itemstack;
} }
// CraftBukkit start
public CraftInventoryView getBukkitView() {
if (bukkitEntity != null) {
return bukkitEntity;
}
CraftInventory inventory;
if (a instanceof PlayerInventory) {
inventory = new CraftInventoryPlayer((PlayerInventory)a);
} else if (a instanceof InventoryLargeChest) {
inventory = new CraftInventoryDoubleChest((InventoryLargeChest)a);
} else {
inventory = new CraftInventory(this.a);
}
bukkitEntity = new CraftInventoryView(this.player.d.getBukkitEntity(), inventory, this);
return bukkitEntity;
}
// CraftBukkit end
public void a(EntityHuman entityhuman) { public void a(EntityHuman entityhuman) {
super.a(entityhuman); super.a(entityhuman);
this.a.g(); this.container.g();
} }
} }

View file

@ -7,14 +7,14 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
public class ContainerDispenser extends Container { public class ContainerDispenser extends Container {
public TileEntityDispenser a; // CraftBukkit - Private -> Public public TileEntityDispenser items; // CraftBukkit - Private -> Public
// CraftBukkit start // CraftBukkit start
private CraftInventoryView bukkitEntity = null; private CraftInventoryView bukkitEntity = null;
private PlayerInventory player; private PlayerInventory player;
// CraftBukkit end // CraftBukkit end
public ContainerDispenser(IInventory iinventory, TileEntityDispenser tileentitydispenser) { public ContainerDispenser(IInventory iinventory, TileEntityDispenser tileentitydispenser) {
this.a = tileentitydispenser; this.items = tileentitydispenser;
// CraftBukkit start - save player // CraftBukkit start - save player
// TODO: Should we check to make sure it really is an InventoryPlayer? // TODO: Should we check to make sure it really is an InventoryPlayer?
this.player = (PlayerInventory)iinventory; this.player = (PlayerInventory)iinventory;
@ -42,7 +42,7 @@ public class ContainerDispenser extends Container {
public boolean b(EntityHuman entityhuman) { public boolean b(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit if (!this.checkReachable) return true; // CraftBukkit
return this.a.a(entityhuman); return this.items.a(entityhuman);
} }
public ItemStack a(int i) { public ItemStack a(int i) {
@ -62,7 +62,7 @@ public class ContainerDispenser extends Container {
} }
if (itemstack1.count == 0) { if (itemstack1.count == 0) {
slot.c((ItemStack) null); slot.set((ItemStack) null);
} else { } else {
slot.d(); slot.d();
} }
@ -82,8 +82,8 @@ public class ContainerDispenser extends Container {
if (bukkitEntity != null) { if (bukkitEntity != null) {
return bukkitEntity; return bukkitEntity;
} }
CraftInventory inventory = new CraftInventory(this.a); CraftInventory inventory = new CraftInventory(this.items);
bukkitEntity = new CraftInventoryView(this.player.d.getBukkitEntity(), inventory, this); bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity; return bukkitEntity;
} }
// CraftBukkit end // CraftBukkit end

View file

@ -19,26 +19,26 @@ import org.bukkit.entity.Player;
public class ContainerEnchantTable extends Container { public class ContainerEnchantTable extends Container {
// CraftBukkit start - make type specific (changed from IInventory) // CraftBukkit start - make type specific (changed from IInventory)
public ContainerEnchantTableInventory a = new ContainerEnchantTableInventory(this, "Enchant", 1); public ContainerEnchantTableInventory enchantSlots = new ContainerEnchantTableInventory(this, "Enchant", 1);
// CraftBukkit end // CraftBukkit end
private World h; private World world;
private int i; private int x;
private int j; private int y;
private int k; private int z;
private Random l = new Random(); private Random l = new Random();
public long b; public long b;
public int[] c = new int[3]; public int[] costs = new int[3];
// CraftBukkit start // CraftBukkit start
private CraftInventoryView bukkitEntity = null; private CraftInventoryView bukkitEntity = null;
private Player player; private Player player;
// CraftBukkit end // CraftBukkit end
public ContainerEnchantTable(PlayerInventory playerinventory, World world, int i, int j, int k) { public ContainerEnchantTable(PlayerInventory playerinventory, World world, int i, int j, int k) {
this.h = world; this.world = world;
this.i = i; this.x = i;
this.j = j; this.y = j;
this.k = k; this.z = k;
this.a((Slot) (new SlotEnchant(this, this.a, 0, 25, 47))); this.a((Slot) (new SlotEnchant(this, this.enchantSlots, 0, 25, 47)));
int l; int l;
@ -51,14 +51,14 @@ public class ContainerEnchantTable extends Container {
for (l = 0; l < 9; ++l) { for (l = 0; l < 9; ++l) {
this.a(new Slot(playerinventory, l, 8 + l * 18, 142)); this.a(new Slot(playerinventory, l, 8 + l * 18, 142));
} }
player = (Player) playerinventory.d.getBukkitEntity(); // CraftBukkit player = (Player) playerinventory.player.bukkitEntity; // CraftBukkit
} }
public void a(ICrafting icrafting) { public void addSlotListener(ICrafting icrafting) {
super.a(icrafting); super.addSlotListener(icrafting);
icrafting.a(this, 0, this.c[0]); icrafting.setContainerData(this, 0, this.costs[0]);
icrafting.a(this, 1, this.c[1]); icrafting.setContainerData(this, 1, this.costs[1]);
icrafting.a(this, 2, this.c[2]); icrafting.setContainerData(this, 2, this.costs[2]);
} }
public void a() { public void a() {
@ -67,49 +67,49 @@ public class ContainerEnchantTable extends Container {
for (int i = 0; i < this.listeners.size(); ++i) { for (int i = 0; i < this.listeners.size(); ++i) {
ICrafting icrafting = (ICrafting) this.listeners.get(i); ICrafting icrafting = (ICrafting) this.listeners.get(i);
icrafting.a(this, 0, this.c[0]); icrafting.setContainerData(this, 0, this.costs[0]);
icrafting.a(this, 1, this.c[1]); icrafting.setContainerData(this, 1, this.costs[1]);
icrafting.a(this, 2, this.c[2]); icrafting.setContainerData(this, 2, this.costs[2]);
} }
} }
public void a(IInventory iinventory) { public void a(IInventory iinventory) {
if (iinventory == this.a) { if (iinventory == this.enchantSlots) {
ItemStack itemstack = iinventory.getItem(0); ItemStack itemstack = iinventory.getItem(0);
int i; int i;
if (itemstack != null && itemstack.q()) { if (itemstack != null && itemstack.q()) {
this.b = this.l.nextLong(); this.b = this.l.nextLong();
if (!this.h.isStatic) { if (!this.world.isStatic) {
i = 0; i = 0;
int j; int j;
for (j = -1; j <= 1; ++j) { for (j = -1; j <= 1; ++j) {
for (int k = -1; k <= 1; ++k) { for (int k = -1; k <= 1; ++k) {
if ((j != 0 || k != 0) && this.h.isEmpty(this.i + k, this.j, this.k + j) && this.h.isEmpty(this.i + k, this.j + 1, this.k + j)) { if ((j != 0 || k != 0) && this.world.isEmpty(this.x + k, this.y, this.z + j) && this.world.isEmpty(this.x + k, this.y + 1, this.z + j)) {
if (this.h.getTypeId(this.i + k * 2, this.j, this.k + j * 2) == Block.BOOKSHELF.id) { if (this.world.getTypeId(this.x + k * 2, this.y, this.z + j * 2) == Block.BOOKSHELF.id) {
++i; ++i;
} }
if (this.h.getTypeId(this.i + k * 2, this.j + 1, this.k + j * 2) == Block.BOOKSHELF.id) { if (this.world.getTypeId(this.x + k * 2, this.y + 1, this.z + j * 2) == Block.BOOKSHELF.id) {
++i; ++i;
} }
if (k != 0 && j != 0) { if (k != 0 && j != 0) {
if (this.h.getTypeId(this.i + k * 2, this.j, this.k + j) == Block.BOOKSHELF.id) { if (this.world.getTypeId(this.x + k * 2, this.y, this.z + j) == Block.BOOKSHELF.id) {
++i; ++i;
} }
if (this.h.getTypeId(this.i + k * 2, this.j + 1, this.k + j) == Block.BOOKSHELF.id) { if (this.world.getTypeId(this.x + k * 2, this.y + 1, this.z + j) == Block.BOOKSHELF.id) {
++i; ++i;
} }
if (this.h.getTypeId(this.i + k, this.j, this.k + j * 2) == Block.BOOKSHELF.id) { if (this.world.getTypeId(this.x + k, this.y, this.z + j * 2) == Block.BOOKSHELF.id) {
++i; ++i;
} }
if (this.h.getTypeId(this.i + k, this.j + 1, this.k + j * 2) == Block.BOOKSHELF.id) { if (this.world.getTypeId(this.x + k, this.y + 1, this.z + j * 2) == Block.BOOKSHELF.id) {
++i; ++i;
} }
} }
@ -118,16 +118,17 @@ public class ContainerEnchantTable extends Container {
} }
for (j = 0; j < 3; ++j) { for (j = 0; j < 3; ++j) {
this.c[j] = EnchantmentManager.a(this.l, j, i, itemstack); this.costs[j] = EnchantmentManager.a(this.l, j, i, itemstack);
} }
// CraftBukkit start // CraftBukkit start
CraftItemStack item = new CraftItemStack(itemstack); CraftItemStack item = new CraftItemStack(itemstack);
PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(player, this.getBukkitView(), h.getWorld().getBlockAt(this.i, this.j, this.k), item, this.c, i); PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(player, this.getBukkitView(), this.world.getWorld().getBlockAt(this.x, this.y, this.z), item, this.costs, i);
h.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
for (i = 0; i < 3; ++i) { for (i = 0; i < 3; ++i) {
this.c[i] = 0; this.costs[i] = 0;
} }
return; return;
} }
@ -136,28 +137,29 @@ public class ContainerEnchantTable extends Container {
} }
} else { } else {
for (i = 0; i < 3; ++i) { for (i = 0; i < 3; ++i) {
this.c[i] = 0; this.costs[i] = 0;
} }
} }
} }
} }
public boolean a(EntityHuman entityhuman, int i) { public boolean a(EntityHuman entityhuman, int i) {
ItemStack itemstack = this.a.getItem(0); ItemStack itemstack = this.enchantSlots.getItem(0);
if (this.c[i] > 0 && itemstack != null && entityhuman.expLevel >= this.c[i]) { if (this.costs[i] > 0 && itemstack != null && entityhuman.expLevel >= this.costs[i]) {
if (!this.h.isStatic) { if (!this.world.isStatic) {
List list = EnchantmentManager.a(this.l, itemstack, this.c[i]); List list = EnchantmentManager.a(this.l, itemstack, this.costs[i]);
// CraftBukkit start // CraftBukkit start
Map<org.bukkit.enchantments.Enchantment, Integer> enchants = new HashMap<org.bukkit.enchantments.Enchantment, Integer>(); Map<org.bukkit.enchantments.Enchantment, Integer> enchants = new HashMap<org.bukkit.enchantments.Enchantment, Integer>();
for (Object o : list) { for (Object obj : list) {
EnchantmentInstance e = (EnchantmentInstance) o; EnchantmentInstance instance = (EnchantmentInstance) obj;
enchants.put(org.bukkit.enchantments.Enchantment.getById(e.a.id), e.b); enchants.put(org.bukkit.enchantments.Enchantment.getById(instance.enchantment.id), instance.level);
} }
CraftItemStack item = new CraftItemStack(itemstack); CraftItemStack item = new CraftItemStack(itemstack);
EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.bukkitEntity, this.getBukkitView(), h.getWorld().getBlockAt(this.i, this.j, this.k), item, this.c[i], enchants, i);
h.getServer().getPluginManager().callEvent(event); EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.bukkitEntity, this.getBukkitView(), this.world.getWorld().getBlockAt(this.x, this.y, this.z), item, this.costs[i], enchants, i);
this.world.getServer().getPluginManager().callEvent(event);
int level = event.getExpLevelCost(); int level = event.getExpLevelCost();
if (event.isCancelled() || (level > entityhuman.expLevel)) { if (event.isCancelled() || (level > entityhuman.expLevel)) {
@ -165,16 +167,16 @@ public class ContainerEnchantTable extends Container {
} }
if (enchants.isEmpty() == false) { if (enchants.isEmpty() == false) {
entityhuman.levelDown(level); entityhuman.levelDown(level);
for (Map.Entry<org.bukkit.enchantments.Enchantment, Integer> ent : event.getEnchantsToAdd().entrySet()) { for (Map.Entry<org.bukkit.enchantments.Enchantment, Integer> entry : event.getEnchantsToAdd().entrySet()) {
try { try {
item.addEnchantment(ent.getKey(), ent.getValue()); item.addEnchantment(entry.getKey(), entry.getValue());
} catch (IllegalArgumentException iax) { } catch (IllegalArgumentException e) {
/* Just swallow invalid enchantments */ /* Just swallow invalid enchantments */
} }
// CraftBukkit end
} }
// CraftBukkit end
this.a(this.a); this.a(this.enchantSlots);
} }
} }
@ -186,18 +188,18 @@ public class ContainerEnchantTable extends Container {
public void a(EntityHuman entityhuman) { public void a(EntityHuman entityhuman) {
super.a(entityhuman); super.a(entityhuman);
if (!this.h.isStatic) { if (!this.world.isStatic) {
ItemStack itemstack = this.a.getItem(0); ItemStack itemstack = this.enchantSlots.getItem(0);
if (itemstack != null) { if (itemstack != null) {
entityhuman.b(itemstack); entityhuman.drop(itemstack);
} }
} }
} }
public boolean b(EntityHuman entityhuman) { public boolean b(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit if (!this.checkReachable) return true; // CraftBukkit
return this.h.getTypeId(this.i, this.j, this.k) != Block.ENCHANTMENT_TABLE.id ? false : entityhuman.e((double) this.i + 0.5D, (double) this.j + 0.5D, (double) this.k + 0.5D) <= 64.0D; return this.world.getTypeId(this.x, this.y, this.z) != Block.ENCHANTMENT_TABLE.id ? false : entityhuman.e((double) this.x + 0.5D, (double) this.y + 0.5D, (double) this.z + 0.5D) <= 64.0D;
} }
public ItemStack a(int i) { public ItemStack a(int i) {
@ -217,7 +219,7 @@ public class ContainerEnchantTable extends Container {
} }
if (itemstack1.count == 0) { if (itemstack1.count == 0) {
slot.c((ItemStack) null); slot.set((ItemStack) null);
} else { } else {
slot.d(); slot.d();
} }
@ -237,7 +239,7 @@ public class ContainerEnchantTable extends Container {
if (bukkitEntity != null) { if (bukkitEntity != null) {
return bukkitEntity; return bukkitEntity;
} }
CraftInventoryEnchanting inventory = new CraftInventoryEnchanting(this.a); CraftInventoryEnchanting inventory = new CraftInventoryEnchanting(this.enchantSlots);
bukkitEntity = new CraftInventoryView(this.player, inventory, this); bukkitEntity = new CraftInventoryView(this.player, inventory, this);
return bukkitEntity; return bukkitEntity;
} }

View file

@ -2,11 +2,11 @@ package net.minecraft.server;
public class ContainerEnchantTableInventory extends ContainerEnchantTableSubcontainer { // CraftBukkit -> public public class ContainerEnchantTableInventory extends ContainerEnchantTableSubcontainer { // CraftBukkit -> public
public final ContainerEnchantTable a; // CraftBukkit -> public public final ContainerEnchantTable enchantTable; // CraftBukkit -> public
ContainerEnchantTableInventory(ContainerEnchantTable containerenchanttable, String s, int i) { ContainerEnchantTableInventory(ContainerEnchantTable containerenchanttable, String s, int i) {
super(s, i); super(s, i);
this.a = containerenchanttable; this.enchantTable = containerenchanttable;
} }
public int getMaxStackSize() { public int getMaxStackSize() {
@ -15,6 +15,6 @@ public class ContainerEnchantTableInventory extends ContainerEnchantTableSubcont
public void update() { public void update() {
super.update(); super.update();
this.a.a((IInventory) this); this.enchantTable.a((IInventory) this);
} }
} }

View file

@ -10,16 +10,17 @@ import org.bukkit.inventory.InventoryHolder;
// CraftBukkit end // CraftBukkit end
public class ContainerEnchantTableSubcontainer implements IInventory { public class ContainerEnchantTableSubcontainer implements IInventory {
private String a; private String a;
private int b; private int b;
private ItemStack[] c; private ItemStack[] items;
private List d; private List d;
// CraftBukkit start // CraftBukkit start
public List<HumanEntity> transaction = new ArrayList<HumanEntity>(); public List<HumanEntity> transaction = new ArrayList<HumanEntity>();
public ItemStack[] getContents() { public ItemStack[] getContents() {
return this.c; return this.items;
} }
public void onOpen(CraftHumanEntity who) { public void onOpen(CraftHumanEntity who) {
@ -42,26 +43,26 @@ public class ContainerEnchantTableSubcontainer implements IInventory {
public ContainerEnchantTableSubcontainer(String s, int i) { public ContainerEnchantTableSubcontainer(String s, int i) {
this.a = s; this.a = s;
this.b = i; this.b = i;
this.c = new ItemStack[i]; this.items = new ItemStack[i];
} }
public ItemStack getItem(int i) { public ItemStack getItem(int i) {
return this.c[i]; return this.items[i];
} }
public ItemStack splitStack(int i, int j) { public ItemStack splitStack(int i, int j) {
if (this.c[i] != null) { if (this.items[i] != null) {
ItemStack itemstack; ItemStack itemstack;
if (this.c[i].count <= j) { if (this.items[i].count <= j) {
itemstack = this.c[i]; itemstack = this.items[i];
this.c[i] = null; this.items[i] = null;
this.update(); this.update();
return itemstack; return itemstack;
} else { } else {
itemstack = this.c[i].a(j); itemstack = this.items[i].a(j);
if (this.c[i].count == 0) { if (this.items[i].count == 0) {
this.c[i] = null; this.items[i] = null;
} }
this.update(); this.update();
@ -73,7 +74,7 @@ public class ContainerEnchantTableSubcontainer implements IInventory {
} }
public void setItem(int i, ItemStack itemstack) { public void setItem(int i, ItemStack itemstack) {
this.c[i] = itemstack; this.items[i] = itemstack;
if (itemstack != null && itemstack.count > this.getMaxStackSize()) { if (itemstack != null && itemstack.count > this.getMaxStackSize()) {
itemstack.count = this.getMaxStackSize(); itemstack.count = this.getMaxStackSize();
} }

View file

@ -7,20 +7,30 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
public class ContainerFurnace extends Container { public class ContainerFurnace extends Container {
public TileEntityFurnace a; // CraftBukkit - Private -> Public public TileEntityFurnace furnace; // CraftBukkit - Private -> Public
private int b = 0; private int b = 0;
private int c = 0; private int c = 0;
private int h = 0; private int h = 0;
// CraftBukkit start // CraftBukkit start
private CraftInventoryView bukkitEntity = null; private CraftInventoryView bukkitEntity = null;
private PlayerInventory player; private PlayerInventory player;
public CraftInventoryView getBukkitView() {
if (bukkitEntity != null) {
return bukkitEntity;
}
CraftInventoryFurnace inventory = new CraftInventoryFurnace(this.furnace);
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity;
}
// CraftBukkit end // CraftBukkit end
public ContainerFurnace(PlayerInventory playerinventory, TileEntityFurnace tileentityfurnace) { public ContainerFurnace(PlayerInventory playerinventory, TileEntityFurnace tileentityfurnace) {
this.a = tileentityfurnace; this.furnace = tileentityfurnace;
this.a(new Slot(tileentityfurnace, 0, 56, 17)); this.a(new Slot(tileentityfurnace, 0, 56, 17));
this.a(new Slot(tileentityfurnace, 1, 56, 53)); this.a(new Slot(tileentityfurnace, 1, 56, 53));
this.a(new SlotResult2(playerinventory.d, tileentityfurnace, 2, 116, 35)); this.a(new SlotResult2(playerinventory.player, tileentityfurnace, 2, 116, 35));
this.player = playerinventory; // CraftBukkit - save player this.player = playerinventory; // CraftBukkit - save player
int i; int i;
@ -36,11 +46,11 @@ public class ContainerFurnace extends Container {
} }
} }
public void a(ICrafting icrafting) { public void addSlotListener(ICrafting icrafting) {
super.a(icrafting); super.addSlotListener(icrafting);
icrafting.a(this, 0, this.a.cookTime); icrafting.setContainerData(this, 0, this.furnace.cookTime);
icrafting.a(this, 1, this.a.burnTime); icrafting.setContainerData(this, 1, this.furnace.burnTime);
icrafting.a(this, 2, this.a.ticksForCurrentFuel); icrafting.setContainerData(this, 2, this.furnace.ticksForCurrentFuel);
} }
public void a() { public void a() {
@ -49,27 +59,27 @@ public class ContainerFurnace extends Container {
for (int i = 0; i < this.listeners.size(); ++i) { for (int i = 0; i < this.listeners.size(); ++i) {
ICrafting icrafting = (ICrafting) this.listeners.get(i); ICrafting icrafting = (ICrafting) this.listeners.get(i);
if (this.b != this.a.cookTime) { if (this.b != this.furnace.cookTime) {
icrafting.a(this, 0, this.a.cookTime); icrafting.setContainerData(this, 0, this.furnace.cookTime);
} }
if (this.c != this.a.burnTime) { if (this.c != this.furnace.burnTime) {
icrafting.a(this, 1, this.a.burnTime); icrafting.setContainerData(this, 1, this.furnace.burnTime);
} }
if (this.h != this.a.ticksForCurrentFuel) { if (this.h != this.furnace.ticksForCurrentFuel) {
icrafting.a(this, 2, this.a.ticksForCurrentFuel); icrafting.setContainerData(this, 2, this.furnace.ticksForCurrentFuel);
} }
} }
this.b = this.a.cookTime; this.b = this.furnace.cookTime;
this.c = this.a.burnTime; this.c = this.furnace.burnTime;
this.h = this.a.ticksForCurrentFuel; this.h = this.furnace.ticksForCurrentFuel;
} }
public boolean b(EntityHuman entityhuman) { public boolean b(EntityHuman entityhuman) {
if (!this.checkReachable) return true; // CraftBukkit if (!this.checkReachable) return true; // CraftBukkit
return this.a.a(entityhuman); return this.furnace.a(entityhuman);
} }
public ItemStack a(int i) { public ItemStack a(int i) {
@ -97,7 +107,7 @@ public class ContainerFurnace extends Container {
} }
if (itemstack1.count == 0) { if (itemstack1.count == 0) {
slot.c((ItemStack) null); slot.set((ItemStack) null);
} else { } else {
slot.d(); slot.d();
} }
@ -111,15 +121,4 @@ public class ContainerFurnace extends Container {
return itemstack; return itemstack;
} }
// CraftBukkit start
public CraftInventoryView getBukkitView() {
if (bukkitEntity != null) {
return bukkitEntity;
}
CraftInventoryFurnace inventory = new CraftInventoryFurnace(this.a);
bukkitEntity = new CraftInventoryView(this.player.d.getBukkitEntity(), inventory, this);
return bukkitEntity;
}
// CraftBukkit end
} }

View file

@ -26,7 +26,7 @@ public class ContainerPlayer extends Container {
this.player = playerinventory; // CraftBukkit - save player this.player = playerinventory; // CraftBukkit - save player
this.c = false; this.c = false;
this.c = flag; this.c = flag;
this.a((Slot) (new SlotResult(playerinventory.d, this.craftInventory, this.resultInventory, 0, 144, 36))); this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 144, 36)));
int i; int i;
int j; int j;
@ -75,7 +75,7 @@ public class ContainerPlayer extends Container {
ItemStack itemstack = this.craftInventory.getItem(i); ItemStack itemstack = this.craftInventory.getItem(i);
if (itemstack != null) { if (itemstack != null) {
entityhuman.b(itemstack); entityhuman.drop(itemstack);
this.craftInventory.setItem(i, (ItemStack) null); this.craftInventory.setItem(i, (ItemStack) null);
} }
} }
@ -110,7 +110,7 @@ public class ContainerPlayer extends Container {
} }
if (itemstack1.count == 0) { if (itemstack1.count == 0) {
slot.c((ItemStack) null); slot.set((ItemStack) null);
} else { } else {
slot.d(); slot.d();
} }
@ -131,7 +131,7 @@ public class ContainerPlayer extends Container {
return bukkitEntity; return bukkitEntity;
} }
CraftInventoryCrafting inventory = new CraftInventoryCrafting(this.craftInventory, this.resultInventory); CraftInventoryCrafting inventory = new CraftInventoryCrafting(this.craftInventory, this.resultInventory);
bukkitEntity = new CraftInventoryView(this.player.d.getBukkitEntity(), inventory, this); bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity; return bukkitEntity;
} }
// CraftBukkit end // CraftBukkit end

View file

@ -29,7 +29,7 @@ public class ContainerWorkbench extends Container {
this.h = i; this.h = i;
this.i = j; this.i = j;
this.j = k; this.j = k;
this.a((Slot) (new SlotResult(playerinventory.d, this.craftInventory, this.resultInventory, 0, 124, 35))); this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 124, 35)));
int l; int l;
int i1; int i1;
@ -74,7 +74,7 @@ public class ContainerWorkbench extends Container {
ItemStack itemstack = this.craftInventory.getItem(i); ItemStack itemstack = this.craftInventory.getItem(i);
if (itemstack != null) { if (itemstack != null) {
entityhuman.b(itemstack); entityhuman.drop(itemstack);
} }
} }
} }
@ -110,7 +110,7 @@ public class ContainerWorkbench extends Container {
} }
if (itemstack1.count == 0) { if (itemstack1.count == 0) {
slot.c((ItemStack) null); slot.set((ItemStack) null);
} else { } else {
slot.d(); slot.d();
} }
@ -131,7 +131,7 @@ public class ContainerWorkbench extends Container {
return bukkitEntity; return bukkitEntity;
} }
CraftInventoryCrafting inventory = new CraftInventoryCrafting(this.craftInventory, this.resultInventory); CraftInventoryCrafting inventory = new CraftInventoryCrafting(this.craftInventory, this.resultInventory);
bukkitEntity = new CraftInventoryView(this.player.d.getBukkitEntity(), inventory, this); bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
return bukkitEntity; return bukkitEntity;
} }
// CraftBukkit end // CraftBukkit end

View file

@ -12,7 +12,7 @@ import org.bukkit.inventory.InventoryView;
public class CraftingManager { public class CraftingManager {
private static final CraftingManager a = new CraftingManager(); private static final CraftingManager a = new CraftingManager();
public List b = new ArrayList(); // CraftBukkit - private -> public public List recipies = new ArrayList(); // CraftBukkit - private -> public
// CraftBukkit start // CraftBukkit start
public CraftingRecipe lastRecipe; public CraftingRecipe lastRecipe;
public InventoryView lastCraftView; public InventoryView lastCraftView;
@ -101,12 +101,12 @@ public class CraftingManager {
this.registerShapelessRecipe(new ItemStack(Item.EYE_OF_ENDER, 1), new Object[] { Item.ENDER_PEARL, Item.BLAZE_POWDER}); this.registerShapelessRecipe(new ItemStack(Item.EYE_OF_ENDER, 1), new Object[] { Item.ENDER_PEARL, Item.BLAZE_POWDER});
//Collections.sort(this.b, new RecipeSorter(this)); // CraftBukkit - removed; see below //Collections.sort(this.b, new RecipeSorter(this)); // CraftBukkit - removed; see below
this.sort(); // CraftBukkit - moved sort to a separate method this.sort(); // CraftBukkit - moved sort to a separate method
System.out.println(this.b.size() + " recipes"); System.out.println(this.recipies.size() + " recipes");
} }
// CraftBukkit start // CraftBukkit start
public void sort() { public void sort() {
Collections.sort(this.b, new RecipeSorter(this)); Collections.sort(this.recipies, new RecipeSorter(this));
} }
// CraftBukkit end // CraftBukkit end
@ -165,7 +165,7 @@ public class CraftingManager {
} }
} }
this.b.add(new ShapedRecipes(j, k, aitemstack, itemstack)); this.recipies.add(new ShapedRecipes(j, k, aitemstack, itemstack));
} }
public void registerShapelessRecipe(ItemStack itemstack, Object... aobject) { // CraftBukkit - default -> public public void registerShapelessRecipe(ItemStack itemstack, Object... aobject) { // CraftBukkit - default -> public
@ -189,7 +189,7 @@ public class CraftingManager {
} }
} }
this.b.add(new ShapelessRecipes(itemstack, arraylist)); this.recipies.add(new ShapelessRecipes(itemstack, arraylist));
} }
public ItemStack craft(InventoryCrafting inventorycrafting) { public ItemStack craft(InventoryCrafting inventorycrafting) {
@ -237,8 +237,8 @@ public class CraftingManager {
return result; return result;
// CraftBukkit end // CraftBukkit end
} else { } else {
for (j = 0; j < this.b.size(); ++j) { for (j = 0; j < this.recipies.size(); ++j) {
CraftingRecipe craftingrecipe = (CraftingRecipe) this.b.get(j); CraftingRecipe craftingrecipe = (CraftingRecipe) this.recipies.get(j);
if (craftingrecipe.a(inventorycrafting)) { if (craftingrecipe.a(inventorycrafting)) {
// CraftBukkit start - INVENTORY_PRE_CRAFT event // CraftBukkit start - INVENTORY_PRE_CRAFT event
@ -254,7 +254,7 @@ public class CraftingManager {
} }
} }
public List b() { public List getRecipies() {
return this.b; return this.recipies;
} }
} }

View file

@ -358,9 +358,9 @@ public abstract class Entity {
public boolean d(double d0, double d1, double d2) { public boolean d(double d0, double d1, double d2) {
AxisAlignedBB axisalignedbb = this.boundingBox.c(d0, d1, d2); AxisAlignedBB axisalignedbb = this.boundingBox.c(d0, d1, d2);
List list = this.world.a(this, axisalignedbb); List list = this.world.getCubes(this, axisalignedbb);
return list.size() > 0 ? false : !this.world.c(axisalignedbb); return list.size() > 0 ? false : !this.world.containsLiquid(axisalignedbb);
} }
public void move(double d0, double d1, double d2) { public void move(double d0, double d1, double d2) {
@ -394,7 +394,7 @@ public abstract class Entity {
if (flag) { if (flag) {
double d8; double d8;
for (d8 = 0.05D; d0 != 0.0D && this.world.a(this, this.boundingBox.c(d0, -1.0D, 0.0D)).size() == 0; d5 = d0) { for (d8 = 0.05D; d0 != 0.0D && this.world.getCubes(this, this.boundingBox.c(d0, -1.0D, 0.0D)).size() == 0; d5 = d0) {
if (d0 < d8 && d0 >= -d8) { if (d0 < d8 && d0 >= -d8) {
d0 = 0.0D; d0 = 0.0D;
} else if (d0 > 0.0D) { } else if (d0 > 0.0D) {
@ -404,7 +404,7 @@ public abstract class Entity {
} }
} }
for (; d2 != 0.0D && this.world.a(this, this.boundingBox.c(0.0D, -1.0D, d2)).size() == 0; d7 = d2) { for (; d2 != 0.0D && this.world.getCubes(this, this.boundingBox.c(0.0D, -1.0D, d2)).size() == 0; d7 = d2) {
if (d2 < d8 && d2 >= -d8) { if (d2 < d8 && d2 >= -d8) {
d2 = 0.0D; d2 = 0.0D;
} else if (d2 > 0.0D) { } else if (d2 > 0.0D) {
@ -415,7 +415,7 @@ public abstract class Entity {
} }
} }
List list = this.world.a(this, this.boundingBox.a(d0, d1, d2)); List list = this.world.getCubes(this, this.boundingBox.a(d0, d1, d2));
for (int i = 0; i < list.size(); ++i) { for (int i = 0; i < list.size(); ++i) {
d1 = ((AxisAlignedBB) list.get(i)).b(this.boundingBox, d1); d1 = ((AxisAlignedBB) list.get(i)).b(this.boundingBox, d1);
@ -469,7 +469,7 @@ public abstract class Entity {
AxisAlignedBB axisalignedbb1 = this.boundingBox.clone(); AxisAlignedBB axisalignedbb1 = this.boundingBox.clone();
this.boundingBox.b(axisalignedbb); this.boundingBox.b(axisalignedbb);
list = this.world.a(this, this.boundingBox.a(d5, d1, d7)); list = this.world.getCubes(this, this.boundingBox.a(d5, d1, d7));
for (k = 0; k < list.size(); ++k) { for (k = 0; k < list.size(); ++k) {
d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1); d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
@ -736,7 +736,7 @@ public abstract class Entity {
} }
public boolean a(Material material) { public boolean a(Material material) {
double d0 = this.locY + (double) this.y(); double d0 = this.locY + (double) this.getHeadHeight();
int i = MathHelper.floor(this.locX); int i = MathHelper.floor(this.locX);
int j = MathHelper.d((float) MathHelper.floor(d0)); int j = MathHelper.d((float) MathHelper.floor(d0));
int k = MathHelper.floor(this.locZ); int k = MathHelper.floor(this.locZ);
@ -752,7 +752,7 @@ public abstract class Entity {
} }
} }
public float y() { public float getHeadHeight() {
return 0.0F; return 0.0F;
} }
@ -1110,7 +1110,7 @@ public abstract class Entity {
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.width * 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.y() + (double) f1); int k = MathHelper.floor(this.locY + (double) this.getHeadHeight() + (double) f1);
int l = MathHelper.floor(this.locZ + (double) f2); int l = MathHelper.floor(this.locZ + (double) f2);
if (this.world.e(j, k, l)) { if (this.world.e(j, k, l)) {
@ -1461,7 +1461,7 @@ public abstract class Entity {
s = "generic"; s = "generic";
} }
return LocaleI18n.a("entity." + s + ".name"); return LocaleI18n.get("entity." + s + ".name");
} }
public Entity[] aR() { public Entity[] aR() {

View file

@ -44,7 +44,7 @@ public class EntityArrow extends Entity {
this.shooter = entityliving; this.shooter = entityliving;
this.fromPlayer = entityliving instanceof EntityHuman; this.fromPlayer = entityliving instanceof EntityHuman;
this.b(0.5F, 0.5F); this.b(0.5F, 0.5F);
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.y(), entityliving.locZ, entityliving.yaw, entityliving.pitch); this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D; this.locY -= 0.10000000149011612D;
this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F);
@ -130,7 +130,7 @@ public class EntityArrow extends Entity {
vec3d = Vec3D.create(this.locX, this.locY, this.locZ); vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ); vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
if (movingobjectposition != null) { if (movingobjectposition != null) {
vec3d1 = Vec3D.create(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c); vec3d1 = Vec3D.create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
} }
Entity entity = null; Entity entity = null;
@ -149,7 +149,7 @@ public class EntityArrow extends Entity {
MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1);
if (movingobjectposition1 != null) { if (movingobjectposition1 != null) {
double d1 = vec3d.c(movingobjectposition1.f); // CraftBukkit - distance efficiency double d1 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - distance efficiency
if (d1 < d0 || d0 == 0.0D) { if (d1 < d0 || d0 == 0.0D) {
entity = entity1; entity = entity1;
@ -226,9 +226,9 @@ public class EntityArrow extends Entity {
this.g = movingobjectposition.d; this.g = movingobjectposition.d;
this.h = this.world.getTypeId(this.e, this.f, this.g); this.h = this.world.getTypeId(this.e, this.f, this.g);
this.i = this.world.getData(this.e, this.f, this.g); this.i = this.world.getData(this.e, this.f, this.g);
this.motX = (double) ((float) (movingobjectposition.f.a - this.locX)); this.motX = (double) ((float) (movingobjectposition.pos.a - this.locX));
this.motY = (double) ((float) (movingobjectposition.f.b - this.locY)); this.motY = (double) ((float) (movingobjectposition.pos.b - this.locY));
this.motZ = (double) ((float) (movingobjectposition.f.c - this.locZ)); this.motZ = (double) ((float) (movingobjectposition.pos.c - this.locZ));
f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ); f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
this.locX -= this.motX / (double) f2 * 0.05000000074505806D; this.locX -= this.motX / (double) f2 * 0.05000000074505806D;
this.locY -= this.motY / (double) f2 * 0.05000000074505806D; this.locY -= this.motY / (double) f2 * 0.05000000074505806D;

View file

@ -62,7 +62,7 @@ public class EntityBlaze extends EntityMonster {
this.a = 0.5F + (float) this.random.nextGaussian() * 3.0F; this.a = 0.5F + (float) this.random.nextGaussian() * 3.0F;
} }
if (this.F() != null && this.F().locY + (double) this.F().y() > this.locY + (double) this.y() + (double) this.a) { if (this.F() != null && this.F().locY + (double) this.F().getHeadHeight() > this.locY + (double) this.getHeadHeight() + (double) this.a) {
this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D; this.motY += (0.30000001192092896D - this.motY) * 0.30000001192092896D;
} }
} }

View file

@ -20,7 +20,7 @@ public class EntityComplex extends EntityLiving {
return false; return false;
} }
public boolean e(DamageSource damagesource, int i) { // CraftBukkit - protected -> public public boolean dealDamage(DamageSource damagesource, int i) { // CraftBukkit - protected -> public
return super.damageEntity(damagesource, i); return super.damageEntity(damagesource, i);
} }
} }

View file

@ -51,7 +51,7 @@ public class EntityEnderCrystal extends Entity {
if (this.b <= 0) { if (this.b <= 0) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
this.die(); this.die();
this.world.a(this, this.locX, this.locY, this.locZ, 6.0F); // CraftBukkit - (Entity) null -> this. this.world.explode(this, this.locX, this.locY, this.locZ, 6.0F); // CraftBukkit - (Entity) null -> this.
} else { } else {
this.die(); this.die();
} }

View file

@ -536,7 +536,7 @@ public class EntityEnderDragon extends EntityComplex {
this.c = this.locZ - (double) (f2 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F); this.c = this.locZ - (double) (f2 * 5.0F) + (double) ((this.random.nextFloat() - 0.5F) * 2.0F);
this.u = null; this.u = null;
if (damagesource.getEntity() instanceof EntityHuman || damagesource == DamageSource.EXPLOSION) { if (damagesource.getEntity() instanceof EntityHuman || damagesource == DamageSource.EXPLOSION) {
this.e(damagesource, i); this.dealDamage(damagesource, i);
} }
return true; return true;

View file

@ -74,7 +74,7 @@ public class EntityEnderman extends EntityMonster {
return false; return false;
} else { } else {
Vec3D vec3d = entityhuman.e(1.0F).b(); Vec3D vec3d = entityhuman.e(1.0F).b();
Vec3D vec3d1 = Vec3D.create(this.locX - entityhuman.locX, this.boundingBox.b + (double) (this.length / 2.0F) - (entityhuman.locY + (double) entityhuman.y()), this.locZ - entityhuman.locZ); Vec3D vec3d1 = Vec3D.create(this.locX - entityhuman.locX, this.boundingBox.b + (double) (this.length / 2.0F) - (entityhuman.locY + (double) entityhuman.getHeadHeight()), this.locZ - entityhuman.locZ);
double d0 = vec3d1.c(); double d0 = vec3d1.c();
vec3d1 = vec3d1.b(); vec3d1 = vec3d1.b();
@ -187,7 +187,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.length / 2.0F) - entity.locY + (double) entity.y(), this.locZ - entity.locZ); Vec3D vec3d = Vec3D.create(this.locX - entity.locX, this.boundingBox.b + (double) (this.length / 2.0F) - entity.locY + (double) entity.getHeadHeight(), this.locZ - entity.locZ);
vec3d = vec3d.b(); vec3d = vec3d.b();
double d0 = 16.0D; double d0 = 16.0D;
@ -229,16 +229,17 @@ public class EntityEnderman extends EntityMonster {
// CraftBukkit start - teleport event // CraftBukkit start - teleport event
EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.world.getWorld(), d3, d4, d5), new Location(this.world.getWorld(), this.locX, this.locY, this.locZ)); EntityTeleportEvent teleport = new EntityTeleportEvent(this.getBukkitEntity(), new Location(this.world.getWorld(), d3, d4, d5), new Location(this.world.getWorld(), this.locX, this.locY, this.locZ));
this.world.getServer().getPluginManager().callEvent(teleport); this.world.getServer().getPluginManager().callEvent(teleport);
if (!teleport.isCancelled()) { if (teleport.isCancelled()) {
Location to = teleport.getTo();
this.setPosition(to.getX(), to.getY(), to.getZ());
if (this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox)) {
flag = true;
}
} else {
return false; return false;
} }
Location to = teleport.getTo();
this.setPosition(to.getX(), to.getY(), to.getZ());
// CraftBukkit end // CraftBukkit end
if (this.world.getCubes(this, this.boundingBox).size() == 0 && !this.world.containsLiquid(this.boundingBox)) {
flag = true;
}
} }
} }

View file

@ -62,7 +62,7 @@ public class EntityExperienceOrb extends Entity {
if (!event.isCancelled() && target != null) { if (!event.isCancelled() && target != null) {
double d1 = (target.locX - this.locX) / d0; double d1 = (target.locX - this.locX) / d0;
double d2 = (target.locY + (double) target.y() - this.locY) / d0; double d2 = (target.locY + (double) target.getHeadHeight() - this.locY) / d0;
double d3 = (target.locZ - this.locZ) / d0; double d3 = (target.locZ - this.locZ) / d0;
double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3); double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
double d5 = 1.0D - d4; double d5 = 1.0D - d4;

View file

@ -94,7 +94,7 @@ public class EntityFireball extends Entity {
vec3d = Vec3D.create(this.locX, this.locY, this.locZ); vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ); vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
if (movingobjectposition != null) { if (movingobjectposition != null) {
vec3d1 = Vec3D.create(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c); vec3d1 = Vec3D.create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
} }
Entity entity = null; Entity entity = null;
@ -110,7 +110,7 @@ public class EntityFireball extends Entity {
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
if (movingobjectposition1 != null) { if (movingobjectposition1 != null) {
double d1 = vec3d.c(movingobjectposition1.f); // CraftBukkit - distance efficiency double d1 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - distance efficiency
if (d1 < d0 || d0 == 0.0D) { if (d1 < d0 || d0 == 0.0D) {
entity = entity1; entity = entity1;

View file

@ -151,7 +151,7 @@ public class EntityFishingHook extends Entity {
vec3d = Vec3D.create(this.locX, this.locY, this.locZ); vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ); vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
if (movingobjectposition != null) { if (movingobjectposition != null) {
vec3d1 = Vec3D.create(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c); vec3d1 = Vec3D.create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
} }
Entity entity = null; Entity entity = null;
@ -169,7 +169,7 @@ public class EntityFishingHook extends Entity {
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
if (movingobjectposition1 != null) { if (movingobjectposition1 != null) {
d5 = vec3d.c(movingobjectposition1.f); // CraftBukkit - distance efficiency d5 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - distance efficiency
if (d5 < d4 || d4 == 0.0D) { if (d5 < d4 || d4 == 0.0D) {
entity = entity1; entity = entity1;
d4 = d5; d4 = d5;

View file

@ -174,7 +174,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
for (int i = 1; (double) i < d3; ++i) { for (int i = 1; (double) i < d3; ++i) {
axisalignedbb.d(d4, d5, d6); axisalignedbb.d(d4, d5, d6);
if (this.world.a((Entity) this, axisalignedbb).size() > 0) { if (this.world.getCubes(this, axisalignedbb).size() > 0) {
return false; return false;
} }
} }

View file

@ -46,13 +46,17 @@ public abstract class EntityHuman extends EntityLiving {
public boolean sleeping; public boolean sleeping;
public boolean fauxSleeping; public boolean fauxSleeping;
public String spawnWorld = ""; public String spawnWorld = "";
public HumanEntity getBukkitEntity() {
return (HumanEntity) super.getBukkitEntity();
}
// CraftBukkit end // CraftBukkit end
public ChunkCoordinates F; public ChunkCoordinates F;
public int sleepTicks; // CraftBukkit - private -> public public int sleepTicks; // CraftBukkit - private -> public
public float G; public float G;
public float H; public float H;
private ChunkCoordinates server; private ChunkCoordinates b;
private ChunkCoordinates c; private ChunkCoordinates c;
public int I = 20; public int I = 20;
protected boolean J = false; protected boolean J = false;
@ -233,7 +237,7 @@ public abstract class EntityHuman extends EntityLiving {
vec3d1.a(-this.pitch * 3.1415927F / 180.0F); vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
vec3d1.b(-this.yaw * 3.1415927F / 180.0F); vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.y(), this.locZ); vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ);
this.world.a("iconcrack_" + itemstack.getItem().id, vec3d1.a, vec3d1.b, vec3d1.c, vec3d.a, vec3d.b + 0.05D, vec3d.c); this.world.a("iconcrack_" + itemstack.getItem().id, vec3d1.a, vec3d1.b, vec3d1.c, vec3d.a, vec3d.b + 0.05D, vec3d.c);
} }
@ -395,13 +399,13 @@ public abstract class EntityHuman extends EntityLiving {
this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, 1), false); this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, 1), false);
} }
public void b(ItemStack itemstack) { public void drop(ItemStack itemstack) {
this.a(itemstack, false); this.a(itemstack, false);
} }
public void a(ItemStack itemstack, boolean flag) { public void a(ItemStack itemstack, boolean flag) {
if (itemstack != null) { if (itemstack != null) {
EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.y(), this.locZ, itemstack); EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY - 0.30000001192092896D + (double) this.getHeadHeight(), this.locZ, itemstack);
entityitem.pickupDelay = 40; entityitem.pickupDelay = 40;
float f = 0.1F; float f = 0.1F;
@ -505,7 +509,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.server = new ChunkCoordinates(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ")); this.b = new ChunkCoordinates(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ"));
} }
this.foodData.a(nbttagcompound); this.foodData.a(nbttagcompound);
@ -521,10 +525,10 @@ public abstract class EntityHuman extends EntityLiving {
nbttagcompound.setFloat("XpP", this.exp); nbttagcompound.setFloat("XpP", this.exp);
nbttagcompound.setInt("XpLevel", this.expLevel); nbttagcompound.setInt("XpLevel", this.expLevel);
nbttagcompound.setInt("XpTotal", this.expTotal); nbttagcompound.setInt("XpTotal", this.expTotal);
if (this.server != null) { if (this.b != null) {
nbttagcompound.setInt("SpawnX", this.server.x); nbttagcompound.setInt("SpawnX", this.b.x);
nbttagcompound.setInt("SpawnY", this.server.y); nbttagcompound.setInt("SpawnY", this.b.y);
nbttagcompound.setInt("SpawnZ", this.server.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
} }
@ -532,15 +536,15 @@ public abstract class EntityHuman extends EntityLiving {
this.abilities.a(nbttagcompound); this.abilities.a(nbttagcompound);
} }
public void a(IInventory iinventory) {} public void openContainer(IInventory iinventory) {}
public void c(int i, int j, int k) {} public void startEnchanting(int i, int j, int k) {}
public void b(int i, int j, int k) {} public void startCrafting(int i, int j, int k) {}
public void receive(Entity entity, int i) {} public void receive(Entity entity, int i) {}
public float y() { public float getHeadHeight() {
return 0.12F; return 0.12F;
} }
@ -707,13 +711,13 @@ public abstract class EntityHuman extends EntityLiving {
this.health -= i; this.health -= i;
} }
public void a(TileEntityFurnace tileentityfurnace) {} public void openFurnace(TileEntityFurnace tileentityfurnace) {}
public void a(TileEntityDispenser tileentitydispenser) {} public void openDispenser(TileEntityDispenser tileentitydispenser) {}
public void a(TileEntitySign tileentitysign) {} public void a(TileEntitySign tileentitysign) {}
public void a(TileEntityBrewingStand tileentitybrewingstand) {} public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) {}
public void e(Entity entity) { public void e(Entity entity) {
if (!entity.b(this)) { if (!entity.b(this)) {
@ -864,7 +868,7 @@ public abstract class EntityHuman extends EntityLiving {
public void d(Entity entity) {} public void d(Entity entity) {}
public void a(ItemStack itemstack) {} public void carriedChanged(ItemStack itemstack) {}
public void die() { public void die() {
super.die(); super.die();
@ -1028,7 +1032,7 @@ public abstract class EntityHuman extends EntityLiving {
} }
if (flag2) { if (flag2) {
this.a(this.F); this.setRespawnPosition(this.F);
} }
} }
@ -1063,15 +1067,15 @@ public abstract class EntityHuman extends EntityLiving {
public void a(String s) {} public void a(String s) {}
public ChunkCoordinates getBed() { public ChunkCoordinates getBed() {
return this.server; return this.b;
} }
public void a(ChunkCoordinates chunkcoordinates) { public void setRespawnPosition(ChunkCoordinates chunkcoordinates) {
if (chunkcoordinates != null) { if (chunkcoordinates != null) {
this.server = new ChunkCoordinates(chunkcoordinates); this.b = new ChunkCoordinates(chunkcoordinates);
this.spawnWorld = this.world.worldData.name; // CraftBukkit this.spawnWorld = this.world.worldData.name; // CraftBukkit
} else { } else {
this.server = null; this.b = null;
} }
} }
@ -1108,10 +1112,10 @@ public abstract class EntityHuman extends EntityLiving {
super.a(f, f1); super.a(f, f1);
} }
this.b(this.locX - d0, this.locY - d1, this.locZ - d2); this.checkMovement(this.locX - d0, this.locY - d1, this.locZ - d2);
} }
public void b(double d0, double d1, double d2) { public void checkMovement(double d0, double d1, double d2) {
if (this.vehicle == null) { if (this.vehicle == null) {
int i; int i;
@ -1285,10 +1289,4 @@ public abstract class EntityHuman extends EntityLiving {
this.exp = entityhuman.exp; this.exp = entityhuman.exp;
this.q = entityhuman.q; this.q = entityhuman.q;
} }
// CraftBukkit start
public HumanEntity getBukkitEntity() {
return (HumanEntity) super.getBukkitEntity();
}
// CraftBukkit end
} }

View file

@ -120,7 +120,8 @@ public class EntityItem extends Entity {
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
nbttagcompound.setShort("Health", (short) ((byte) this.f)); nbttagcompound.setShort("Health", (short) ((byte) this.f));
nbttagcompound.setShort("Age", (short) this.age); nbttagcompound.setShort("Age", (short) this.age);
if (this.itemStack != null) nbttagcompound.setCompound("Item", this.itemStack.b(new NBTTagCompound())); // CraftBukkit - Nullchex! if (this.itemStack != null) // CraftBukkit - Nullchex!
nbttagcompound.setCompound("Item", this.itemStack.save(new NBTTagCompound()));
} }
public void a(NBTTagCompound nbttagcompound) { public void a(NBTTagCompound nbttagcompound) {
@ -183,7 +184,7 @@ public class EntityItem extends Entity {
} }
public String getLocalizedName() { public String getLocalizedName() {
if (this.itemStack == null) return LocaleI18n.a("item.unknown"); // CraftBukkit - nullcheck if (this.itemStack == null) return LocaleI18n.get("item.unknown"); // CraftBukkit - nullcheck
return LocaleI18n.a("item." + this.itemStack.k()); return LocaleI18n.get("item." + this.itemStack.k());
} }
} }

View file

@ -140,7 +140,7 @@ public abstract class EntityLiving extends Entity {
} }
public boolean g(Entity entity) { public boolean g(Entity entity) {
return this.world.a(Vec3D.create(this.locX, this.locY + (double) this.y(), this.locZ), Vec3D.create(entity.locX, entity.locY + (double) entity.y(), entity.locZ)) == null; return this.world.a(Vec3D.create(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ), Vec3D.create(entity.locX, entity.locY + (double) entity.getHeadHeight(), entity.locZ)) == null;
} }
public boolean e_() { public boolean e_() {
@ -151,7 +151,7 @@ public abstract class EntityLiving extends Entity {
return !this.dead; return !this.dead;
} }
public float y() { public float getHeadHeight() {
return this.length * 0.85F; return this.length * 0.85F;
} }
@ -520,7 +520,7 @@ public abstract class EntityLiving extends Entity {
} }
if (flag) { if (flag) {
this.world.a(this, (byte) 2); this.world.broadcastEntityEffect(this, (byte) 2);
this.aM(); this.aM();
if (entity != null) { if (entity != null) {
double d0 = entity.locX - this.locX; double d0 = entity.locX - this.locX;
@ -651,7 +651,7 @@ public abstract class EntityLiving extends Entity {
} }
} }
this.world.a(this, (byte) 3); this.world.broadcastEntityEffect(this, (byte) 3);
} }
protected void dropDeathLoot(boolean flag, int i) { protected void dropDeathLoot(boolean flag, int i) {
@ -916,7 +916,7 @@ public abstract class EntityLiving extends Entity {
--this.aN; --this.aN;
this.setPosition(d0, d1, d2); this.setPosition(d0, d1, d2);
this.c(this.yaw, this.pitch); this.c(this.yaw, this.pitch);
List list = this.world.a((Entity) this, this.boundingBox.shrink(0.03125D, 0.0D, 0.03125D)); List list = this.world.getCubes(this, this.boundingBox.shrink(0.03125D, 0.0D, 0.03125D));
if (list.size() > 0) { if (list.size() > 0) {
double d4 = 0.0D; double d4 = 0.0D;
@ -1114,9 +1114,9 @@ public abstract class EntityLiving extends Entity {
if (entity instanceof EntityLiving) { if (entity instanceof EntityLiving) {
EntityLiving entityliving = (EntityLiving) entity; EntityLiving entityliving = (EntityLiving) entity;
d2 = this.locY + (double) this.y() - (entityliving.locY + (double) entityliving.y()); d2 = this.locY + (double) this.getHeadHeight() - (entityliving.locY + (double) entityliving.getHeadHeight());
} else { } else {
d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.y()); d2 = (entity.boundingBox.b + entity.boundingBox.e) / 2.0D - (this.locY + (double) this.getHeadHeight());
} }
double d3 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1); double d3 = (double) MathHelper.sqrt(d0 * d0 + d1 * d1);
@ -1160,7 +1160,7 @@ public abstract class EntityLiving extends Entity {
public void ay() {} public void ay() {}
public boolean canSpawn() { public boolean canSpawn() {
return this.world.containsEntity(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox); return this.world.containsEntity(this.boundingBox) && this.world.getCubes(this, this.boundingBox).size() == 0 && !this.world.containsLiquid(this.boundingBox);
} }
protected void az() { protected void az() {
@ -1356,7 +1356,7 @@ public abstract class EntityLiving extends Entity {
vec3d1.a(-this.pitch * 3.1415927F / 180.0F); vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
vec3d1.b(-this.yaw * 3.1415927F / 180.0F); vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.y(), this.locZ); vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ);
this.world.a("iconcrack_" + itemstack.getItem().id, vec3d1.a, vec3d1.b, vec3d1.c, vec3d.a, vec3d.b + 0.05D, vec3d.c); this.world.a("iconcrack_" + itemstack.getItem().id, vec3d1.a, vec3d1.b, vec3d1.c, vec3d.a, vec3d.b + 0.05D, vec3d.c);
} }
} }

View file

@ -13,7 +13,7 @@ public class EntityMagmaCube extends EntitySlime {
} }
public boolean canSpawn() { public boolean canSpawn() {
return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox); return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.getCubes(this, this.boundingBox).size() == 0 && !this.world.containsLiquid(this.boundingBox);
} }
public int P() { public int P() {

View file

@ -176,7 +176,8 @@ public class EntityMinecart extends Entity implements IInventory {
} }
itemstack.count -= k; itemstack.count -= k;
EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, k, itemstack.getData(), itemstack.getEnchantments())); // CraftBukkit - include enchantments in the new itemstack // CraftBukkit - include enchantments in the new itemstack
EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, k, itemstack.getData(), itemstack.getEnchantments()));
float f3 = 0.05F; float f3 = 0.05F;
entityitem.motX = (double) ((float) this.random.nextGaussian() * f3); entityitem.motX = (double) ((float) this.random.nextGaussian() * f3);
@ -220,7 +221,8 @@ public class EntityMinecart extends Entity implements IInventory {
} }
itemstack.count -= j; itemstack.count -= j;
EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, j, itemstack.getData(), itemstack.getEnchantments())); // CraftBukkit - include enchantments in the new itemstack // CraftBukkit - include enchantments in the new itemstack
EntityItem entityitem = new EntityItem(this.world, this.locX + (double) f, this.locY + (double) f1, this.locZ + (double) f2, new ItemStack(itemstack.id, j, itemstack.getData(), itemstack.getEnchantments()));
float f3 = 0.05F; float f3 = 0.05F;
entityitem.motX = (double) ((float) this.random.nextGaussian() * f3); entityitem.motX = (double) ((float) this.random.nextGaussian() * f3);
@ -702,7 +704,7 @@ public class EntityMinecart extends Entity implements IInventory {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Slot", (byte) i); nbttagcompound1.setByte("Slot", (byte) i);
this.items[i].b(nbttagcompound1); this.items[i].save(nbttagcompound1);
nbttaglist.add(nbttagcompound1); nbttaglist.add(nbttagcompound1);
} }
} }
@ -877,7 +879,7 @@ public class EntityMinecart extends Entity implements IInventory {
} }
} else if (this.type == 1) { } else if (this.type == 1) {
if (!this.world.isStatic) { if (!this.world.isStatic) {
entityhuman.a((IInventory) this); entityhuman.openContainer(this);
} }
} else if (this.type == 2) { } else if (this.type == 2) {
ItemStack itemstack = entityhuman.inventory.getItemInHand(); ItemStack itemstack = entityhuman.inventory.getItemInHand();

View file

@ -138,21 +138,19 @@ public class EntityPainting extends Entity {
PaintingBreakEvent event = new PaintingBreakEvent((Painting) this.getBukkitEntity(), cause); PaintingBreakEvent event = new PaintingBreakEvent((Painting) this.getBukkitEntity(), cause);
this.world.getServer().getPluginManager().callEvent(event); this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled() || dead) {
return; return;
} }
if (!dead) {
this.die();
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
}
// CraftBukkit end // CraftBukkit end
this.die();
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
} }
} }
} }
public boolean survives() { public boolean survives() {
if (this.world.a(this, this.boundingBox).size() > 0) { if (this.world.getCubes(this, this.boundingBox).size() > 0) {
return false; return false;
} else { } else {
int i = this.art.B / 16; int i = this.art.B / 16;
@ -286,14 +284,11 @@ public class EntityPainting extends Entity {
} }
public void b_(double d0, double d1, double d2) { public void b_(double d0, double d1, double d2) {
// CraftBukkit start - not needed for paintings /* CraftBukkit start - not needed for paintings
/* if (!this.world.isStatic && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { if (!this.world.isStatic && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
if (dead) return; // CraftBukkit
this.die(); this.die();
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING))); this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
}*/ }
// CraftBukkit end // CraftBukkit end */
} }
} }

View file

@ -37,7 +37,7 @@ public class EntityPigZombie extends EntityZombie {
} }
public boolean canSpawn() { public boolean canSpawn() {
return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.a((Entity) this, this.boundingBox).size() == 0 && !this.world.c(this.boundingBox); return this.world.difficulty > 0 && this.world.containsEntity(this.boundingBox) && this.world.getCubes(this, this.boundingBox).size() == 0 && !this.world.containsLiquid(this.boundingBox);
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {

View file

@ -32,11 +32,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public int lastSentExp = -99999999; // CraftBukkit - priv to pub public int lastSentExp = -99999999; // CraftBukkit - priv to pub
public int invulnerableTicks = 60; // CraftBukkit - private to public; temporary until we get an API out public int invulnerableTicks = 60; // CraftBukkit - private to public; temporary until we get an API out
private ItemStack[] ck = new ItemStack[] { null, null, null, null, null}; private ItemStack[] ck = new ItemStack[] { null, null, null, null, null};
private int cl = 0; private int containerCounter = 0;
public boolean h; public boolean h;
public int ping; public int ping;
public boolean viewingCredits = false; public boolean viewingCredits = false;
public int i;
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) { public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) {
super(world); super(world);
@ -121,7 +120,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
} }
public void syncInventory() { public void syncInventory() {
this.activeContainer.a((ICrafting) this); this.activeContainer.addSlotListener(this);
} }
public ItemStack[] getEquipment() { public ItemStack[] getEquipment() {
@ -132,7 +131,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
this.height = 0.0F; this.height = 0.0F;
} }
public float y() { public float getHeadHeight() {
return 1.62F; return 1.62F;
} }
@ -451,91 +450,91 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
super.a(d0, flag); super.a(d0, flag);
} }
public int aS() { // CraftBukkit - private void -> public int public int nextContainerCounter() { // CraftBukkit - private void -> public int
this.cl = this.cl % 100 + 1; this.containerCounter = this.containerCounter % 100 + 1;
return this.cl; // CraftBukkit return this.containerCounter; // CraftBukkit
} }
public void b(int i, int j, int k) { public void startCrafting(int i, int j, int k) {
// CraftBukkit start - INVENTORY_OPEN hook // CraftBukkit start - INVENTORY_OPEN hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerWorkbench(this.inventory, this.world, i, j, k)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerWorkbench(this.inventory, this.world, i, j, k));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
this.aS(); this.nextContainerCounter();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 1, "Crafting", 9)); this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 1, "Crafting", 9));
this.activeContainer = container; // CraftBukkit - Use container we passed to event this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.cl; this.activeContainer.windowId = this.containerCounter;
this.activeContainer.a((ICrafting) this); this.activeContainer.addSlotListener(this);
} }
public void c(int i, int j, int k) { public void startEnchanting(int i, int j, int k) {
// CraftBukkit start - INVENTORY_OPEN hook // CraftBukkit start - INVENTORY_OPEN hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerEnchantTable(this.inventory, this.world, i, j, k)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerEnchantTable(this.inventory, this.world, i, j, k));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
this.aS(); this.nextContainerCounter();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 4, "Enchanting", 9)); this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 4, "Enchanting", 9));
this.activeContainer = container; this.activeContainer = container; // CraftBukkit - Use container we passed to event
this.activeContainer.windowId = this.cl; this.activeContainer.windowId = this.containerCounter;
this.activeContainer.a((ICrafting) this); this.activeContainer.addSlotListener(this);
} }
public void a(IInventory iinventory) { public void openContainer(IInventory iinventory) {
// CraftBukkit start - INVENTORY_OPEN hook // CraftBukkit start - INVENTORY_OPEN hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, iinventory)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, iinventory));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
this.aS(); this.nextContainerCounter();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 0, iinventory.getName(), iinventory.getSize())); this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 0, iinventory.getName(), iinventory.getSize()));
this.activeContainer = container; // CraftBukkit - Use container passed to event this.activeContainer = container; // CraftBukkit - Use container passed to event
this.activeContainer.windowId = this.cl; this.activeContainer.windowId = this.containerCounter;
this.activeContainer.a((ICrafting) this); this.activeContainer.addSlotListener(this);
} }
public void a(TileEntityFurnace tileentityfurnace) { public void openFurnace(TileEntityFurnace tileentityfurnace) {
// CraftBukkit start - INVENTORY_OPEN hook // CraftBukkit start - INVENTORY_OPEN hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerFurnace(this.inventory, tileentityfurnace)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerFurnace(this.inventory, tileentityfurnace));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
this.aS(); this.nextContainerCounter();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 2, tileentityfurnace.getName(), tileentityfurnace.getSize())); this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
this.activeContainer = container; // CraftBukkit - Use container passed to event this.activeContainer = container; // CraftBukkit - Use container passed to event
this.activeContainer.windowId = this.cl; this.activeContainer.windowId = this.containerCounter;
this.activeContainer.a((ICrafting) this); this.activeContainer.addSlotListener(this);
} }
public void a(TileEntityDispenser tileentitydispenser) { public void openDispenser(TileEntityDispenser tileentitydispenser) {
// CraftBukkit start - INVENTORY_OPEN hook // CraftBukkit start - INVENTORY_OPEN hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerDispenser(this.inventory, tileentitydispenser)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerDispenser(this.inventory, tileentitydispenser));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
this.aS(); this.nextContainerCounter();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 3, tileentitydispenser.getName(), tileentitydispenser.getSize())); this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 3, tileentitydispenser.getName(), tileentitydispenser.getSize()));
this.activeContainer = container; // CraftBukkit - Use container passed to event this.activeContainer = container; // CraftBukkit - Use container passed to event
this.activeContainer.windowId = this.cl; this.activeContainer.windowId = this.containerCounter;
this.activeContainer.a((ICrafting) this); this.activeContainer.addSlotListener(this);
} }
public void a(TileEntityBrewingStand tileentitybrewingstand) { public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) {
// CraftBukkit start - INVENTORY_OPEN hook // CraftBukkit start - INVENTORY_OPEN hook
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBrewingStand(this.inventory, tileentitybrewingstand)); Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBrewingStand(this.inventory, tileentitybrewingstand));
if(container == null) return; if(container == null) return;
// CraftBukkit end // CraftBukkit end
this.aS(); this.nextContainerCounter();
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 5, tileentitybrewingstand.getName(), tileentitybrewingstand.getSize())); this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 5, tileentitybrewingstand.getName(), tileentitybrewingstand.getSize()));
this.activeContainer = container; this.activeContainer = container; // CraftBukkit - Use container passed to event
this.activeContainer.windowId = this.cl; this.activeContainer.windowId = this.containerCounter;
this.activeContainer.a((ICrafting) this); this.activeContainer.addSlotListener(this);
} }
public void a(Container container, int i, ItemStack itemstack) { public void a(Container container, int i, ItemStack itemstack) {
if (!(container.b(i) instanceof SlotResult)) { if (!(container.getSlot(i) instanceof SlotResult)) {
if (!this.h) { if (!this.h) {
this.netServerHandler.sendPacket(new Packet103SetSlot(container.windowId, i, itemstack)); this.netServerHandler.sendPacket(new Packet103SetSlot(container.windowId, i, itemstack));
} }
@ -548,28 +547,28 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
public void a(Container container, List list) { public void a(Container container, List list) {
this.netServerHandler.sendPacket(new Packet104WindowItems(container.windowId, list)); this.netServerHandler.sendPacket(new Packet104WindowItems(container.windowId, list));
this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.l())); this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried()));
// CraftBukkit start - send a Set Slot to update the crafting result slot // CraftBukkit start - send a Set Slot to update the crafting result slot
if (EnumSet.of(InventoryType.CRAFTING,InventoryType.WORKBENCH).contains(container.getBukkitView().getType())) { if (EnumSet.of(InventoryType.CRAFTING,InventoryType.WORKBENCH).contains(container.getBukkitView().getType())) {
this.netServerHandler.sendPacket(new Packet103SetSlot(container.windowId, 0, container.b(0).getItem())); this.netServerHandler.sendPacket(new Packet103SetSlot(container.windowId, 0, container.getSlot(0).getItem()));
} }
// CraftBukkit end // CraftBukkit end
} }
public void a(Container container, int i, int j) { public void setContainerData(Container container, int i, int j) {
this.netServerHandler.sendPacket(new Packet105CraftProgressBar(container.windowId, i, j)); this.netServerHandler.sendPacket(new Packet105CraftProgressBar(container.windowId, i, j));
} }
public void a(ItemStack itemstack) {} public void carriedChanged(ItemStack itemstack) {}
public void closeInventory() { public void closeInventory() {
this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId)); this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId));
this.E(); this.E();
} }
public void D() { public void broadcastCarriedItem() {
if (!this.h) { if (!this.h) {
this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.l())); this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried()));
} }
} }

View file

@ -43,7 +43,7 @@ public class EntityPotion extends EntityProjectile {
return -20.0F; return -20.0F;
} }
public int f() { public int getPotionValue() {
return this.d; return this.d;
} }
@ -100,8 +100,9 @@ public class EntityPotion extends EntityProjectile {
} }
// CraftBukkit end // CraftBukkit end
if (MobEffectList.byId[i].b()) { if (MobEffectList.byId[i].isInstant()) {
MobEffectList.byId[i].a(this.shooter, (EntityLiving) entity, mobeffect.getAmplifier(), d1, this); // CraftBukkit - added 'this' // CraftBukkit - added 'this'
MobEffectList.byId[i].applyInstantEffect(this.shooter, (EntityLiving) entity, mobeffect.getAmplifier(), d1, this);
} else { } else {
int j = (int) (d1 * (double) mobeffect.getDuration() + 0.5D); int j = (int) (d1 * (double) mobeffect.getDuration() + 0.5D);
@ -115,7 +116,7 @@ public class EntityPotion extends EntityProjectile {
} }
} }
this.world.f(2002, (int) Math.round(this.locX), (int) Math.round(this.locY), (int) Math.round(this.locZ), this.d); this.world.triggerEffect(2002, (int) Math.round(this.locX), (int) Math.round(this.locY), (int) Math.round(this.locZ), this.d);
this.die(); this.die();
} }
} }

View file

@ -30,7 +30,7 @@ public abstract class EntityProjectile extends Entity {
super(world); super(world);
this.shooter = entityliving; this.shooter = entityliving;
this.b(0.25F, 0.25F); this.b(0.25F, 0.25F);
this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.y(), entityliving.locZ, entityliving.yaw, entityliving.pitch); this.setPositionRotation(entityliving.locX, entityliving.locY + (double) entityliving.getHeadHeight(), entityliving.locZ, entityliving.yaw, entityliving.pitch);
this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locX -= (double) (MathHelper.cos(this.yaw / 180.0F * 3.1415927F) * 0.16F);
this.locY -= 0.10000000149011612D; this.locY -= 0.10000000149011612D;
this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F); this.locZ -= (double) (MathHelper.sin(this.yaw / 180.0F * 3.1415927F) * 0.16F);
@ -120,7 +120,7 @@ public abstract class EntityProjectile extends Entity {
vec3d = Vec3D.create(this.locX, this.locY, this.locZ); vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ); vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
if (movingobjectposition != null) { if (movingobjectposition != null) {
vec3d1 = Vec3D.create(movingobjectposition.f.a, movingobjectposition.f.b, movingobjectposition.f.c); vec3d1 = Vec3D.create(movingobjectposition.pos.a, movingobjectposition.pos.b, movingobjectposition.pos.c);
} }
if (!this.world.isStatic) { if (!this.world.isStatic) {
@ -137,7 +137,7 @@ public abstract class EntityProjectile extends Entity {
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
if (movingobjectposition1 != null) { if (movingobjectposition1 != null) {
double d1 = vec3d.c(movingobjectposition1.f); // CraftBukkit - distance efficiency double d1 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - distance efficiency
if (d1 < d0 || d0 == 0.0D) { if (d1 < d0 || d0 == 0.0D) {
entity = entity1; entity = entity1;

View file

@ -69,7 +69,7 @@ public class EntitySheep extends EntityAnimal {
k = MathHelper.floor(this.locZ); k = MathHelper.floor(this.locZ);
if (this.world.getTypeId(i, j, k) == Block.LONG_GRASS.id && this.world.getData(i, j, k) == 1 || this.world.getTypeId(i, j - 1, k) == Block.GRASS.id) { if (this.world.getTypeId(i, j, k) == Block.LONG_GRASS.id && this.world.getData(i, j, k) == 1 || this.world.getTypeId(i, j - 1, k) == Block.GRASS.id) {
this.b = 40; this.b = 40;
this.world.a(this, (byte) 10); this.world.broadcastEntityEffect(this, (byte) 10);
} }
} else if (this.b == 4) { } else if (this.b == 4) {
i = MathHelper.floor(this.locX); i = MathHelper.floor(this.locX);
@ -80,7 +80,7 @@ public class EntitySheep extends EntityAnimal {
if (this.world.getTypeId(i, j, k) == Block.LONG_GRASS.id) { if (this.world.getTypeId(i, j, k) == Block.LONG_GRASS.id) {
// CraftBukkit start // CraftBukkit start
if (!CraftEventFactory.callEntityChangeBlockEvent(this.getBukkitEntity(), this.world.getWorld().getBlockAt(i, j, k), Material.AIR).isCancelled()) { if (!CraftEventFactory.callEntityChangeBlockEvent(this.getBukkitEntity(), this.world.getWorld().getBlockAt(i, j, k), Material.AIR).isCancelled()) {
this.world.f(2001, i, j, k, Block.LONG_GRASS.id + 256); this.world.triggerEffect(2001, i, j, k, Block.LONG_GRASS.id + 256);
this.world.setTypeId(i, j, k, 0); this.world.setTypeId(i, j, k, 0);
flag = true; flag = true;
} }
@ -88,7 +88,7 @@ public class EntitySheep extends EntityAnimal {
} else if (this.world.getTypeId(i, j - 1, k) == Block.GRASS.id) { } else if (this.world.getTypeId(i, j - 1, k) == Block.GRASS.id) {
// CraftBukkit start // CraftBukkit start
if (!CraftEventFactory.callEntityChangeBlockEvent(this.getBukkitEntity(), this.world.getWorld().getBlockAt(i, j - 1, k), Material.DIRT).isCancelled()) { if (!CraftEventFactory.callEntityChangeBlockEvent(this.getBukkitEntity(), this.world.getWorld().getBlockAt(i, j - 1, k), Material.DIRT).isCancelled()) {
this.world.f(2001, i, j - 1, k, Block.GRASS.id); this.world.triggerEffect(2001, i, j - 1, k, Block.GRASS.id);
this.world.setTypeId(i, j - 1, k, Block.DIRT.id); this.world.setTypeId(i, j - 1, k, Block.DIRT.id);
flag = true; flag = true;
} }

View file

@ -75,10 +75,10 @@ public class EntitySkeleton extends EntityMonster {
if (this.attackTicks == 0) { if (this.attackTicks == 0) {
EntityArrow entityarrow = new EntityArrow(this.world, this, 1.0F); EntityArrow entityarrow = new EntityArrow(this.world, this, 1.0F);
double d2 = entity.locY + (double) entity.y() - 0.699999988079071D - entityarrow.locY; double d2 = entity.locY + (double) entity.getHeadHeight() - 0.699999988079071D - entityarrow.locY;
float f1 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 0.2F; float f1 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 0.2F;
this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F)); // CraftBukkit - moved down // this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F)); // CraftBukkit - moved down
// this.world.addEntity(entityarrow); // CraftBukkit - moved down // this.world.addEntity(entityarrow); // CraftBukkit - moved down
entityarrow.shoot(d0, d2 + (double) f1, d1, 1.6F, 12.0F); entityarrow.shoot(d0, d2 + (double) f1, d1, 1.6F, 12.0F);
this.attackTicks = 60; this.attackTicks = 60;

View file

@ -65,7 +65,7 @@ public class EntitySnowman extends EntityGolem {
if (this.attackTicks == 0) { if (this.attackTicks == 0) {
EntitySnowball entitysnowball = new EntitySnowball(this.world, this); EntitySnowball entitysnowball = new EntitySnowball(this.world, this);
double d2 = entity.locY + (double) entity.y() - 1.100000023841858D - entitysnowball.locY; double d2 = entity.locY + (double) entity.getHeadHeight() - 1.100000023841858D - entitysnowball.locY;
float f1 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 0.2F; float f1 = MathHelper.sqrt(d0 * d0 + d1 * d1) * 0.2F;
this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F)); this.world.makeSound(this, "random.bow", 1.0F, 1.0F / (this.random.nextFloat() * 0.4F + 0.8F));
@ -103,4 +103,4 @@ public class EntitySnowman extends EntityGolem {
CraftEventFactory.callEntityDeathEvent(this, loot); CraftEventFactory.callEntityDeathEvent(this, loot);
// CraftBukkit end // CraftBukkit end
} }
} }

View file

@ -30,7 +30,7 @@ public class EntityTracker {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
if (entitytrackerentry.tracker != entityplayer) { if (entitytrackerentry.tracker != entityplayer) {
entitytrackerentry.b(entityplayer); entitytrackerentry.updatePlayer(entityplayer);
} }
} }
} else if (entity instanceof EntityFishingHook) { } else if (entity instanceof EntityFishingHook) {
@ -141,7 +141,7 @@ public class EntityTracker {
EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) iterator1.next(); EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) iterator1.next();
if (entitytrackerentry1.tracker != entityplayer) { if (entitytrackerentry1.tracker != entityplayer) {
entitytrackerentry1.b(entityplayer); entitytrackerentry1.updatePlayer(entityplayer);
} }
} }
} }
@ -149,7 +149,7 @@ public class EntityTracker {
// CraftBukkit - synchronized // CraftBukkit - synchronized
public synchronized void a(Entity entity, Packet packet) { public synchronized void a(Entity entity, Packet packet) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.a(entity.id); EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.get(entity.id);
if (entitytrackerentry != null) { if (entitytrackerentry != null) {
entitytrackerentry.broadcast(packet); entitytrackerentry.broadcast(packet);
@ -158,7 +158,7 @@ public class EntityTracker {
// CraftBukkit - synchronized // CraftBukkit - synchronized
public synchronized void sendPacketToEntity(Entity entity, Packet packet) { public synchronized void sendPacketToEntity(Entity entity, Packet packet) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.a(entity.id); EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) this.trackedEntities.get(entity.id);
if (entitytrackerentry != null) { if (entitytrackerentry != null) {
entitytrackerentry.broadcastIncludingSelf(packet); entitytrackerentry.broadcastIncludingSelf(packet);
@ -172,7 +172,7 @@ public class EntityTracker {
while (iterator.hasNext()) { while (iterator.hasNext()) {
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next(); EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
entitytrackerentry.c(entityplayer); entitytrackerentry.clear(entityplayer);
} }
} }
} }

View file

@ -11,11 +11,11 @@ public class EntityTrackerEntry {
public Entity tracker; public Entity tracker;
public int b; public int b;
public int c; public int c;
public int d; public int xLoc;
public int e; public int yLoc;
public int f; public int zLoc;
public int g; public int yRot;
public int h; public int xRot;
public double i; public double i;
public double j; public double j;
public double k; public double k;
@ -34,11 +34,11 @@ public class EntityTrackerEntry {
this.b = i; this.b = i;
this.c = j; this.c = j;
this.isMoving = flag; this.isMoving = flag;
this.d = MathHelper.floor(entity.locX * 32.0D); this.xLoc = MathHelper.floor(entity.locX * 32.0D);
this.e = MathHelper.floor(entity.locY * 32.0D); this.yLoc = MathHelper.floor(entity.locY * 32.0D);
this.f = MathHelper.floor(entity.locZ * 32.0D); this.zLoc = MathHelper.floor(entity.locZ * 32.0D);
this.g = MathHelper.d(entity.yaw * 256.0F / 360.0F); this.yRot = MathHelper.d(entity.yaw * 256.0F / 360.0F);
this.h = MathHelper.d(entity.pitch * 256.0F / 360.0F); this.xRot = MathHelper.d(entity.pitch * 256.0F / 360.0F);
} }
public boolean equals(Object object) { public boolean equals(Object object) {
@ -67,23 +67,23 @@ public class EntityTrackerEntry {
int k = MathHelper.floor(this.tracker.locZ * 32.0D); int k = MathHelper.floor(this.tracker.locZ * 32.0D);
int l = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F); int l = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F);
int i1 = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F); int i1 = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F);
int j1 = i - this.d; int j1 = i - this.xLoc;
int k1 = j - this.e; int k1 = j - this.yLoc;
int l1 = k - this.f; int l1 = k - this.zLoc;
Object object = null; Object object = null;
boolean flag = Math.abs(j1) >= 4 || Math.abs(k1) >= 4 || Math.abs(l1) >= 4; boolean flag = Math.abs(j1) >= 4 || Math.abs(k1) >= 4 || Math.abs(l1) >= 4;
boolean flag1 = Math.abs(l - this.g) >= 4 || Math.abs(i1 - this.h) >= 4; boolean flag1 = Math.abs(l - this.yRot) >= 4 || Math.abs(i1 - this.xRot) >= 4;
// CraftBukkit start - code moved from below // CraftBukkit start - code moved from below
if (flag) { if (flag) {
this.d = i; this.xLoc = i;
this.e = j; this.yLoc = j;
this.f = k; this.zLoc = k;
} }
if (flag1) { if (flag1) {
this.g = l; this.yRot = l;
this.h = i1; this.xRot = i1;
} }
// CraftBukkit end // CraftBukkit end
@ -132,18 +132,18 @@ public class EntityTrackerEntry {
if (datawatcher.a()) { if (datawatcher.a()) {
this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher)); this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher));
} }
// CraftBukkit start - code moved up /* CraftBukkit start - code moved up
/* if (flag) { if (flag) {
this.d = i; this.xLoc = i;
this.e = j; this.yLoc = j;
this.f = k; this.zLoc = k;
} }
if (flag1) { if (flag1) {
this.g = l; this.yRot = l;
this.h = i1; this.xRot = i1;
} */ }
// CraftBukkit end // CraftBukkit end */
} }
this.tracker.ce = false; this.tracker.ce = false;
@ -200,10 +200,10 @@ public class EntityTrackerEntry {
} }
} }
public void b(EntityPlayer entityplayer) { public void updatePlayer(EntityPlayer entityplayer) {
if (entityplayer != this.tracker) { if (entityplayer != this.tracker) {
double d0 = entityplayer.locX - (double) (this.d / 32); double d0 = entityplayer.locX - (double) (this.xLoc / 32);
double d1 = entityplayer.locZ - (double) (this.f / 32); double d1 = entityplayer.locZ - (double) (this.zLoc / 32);
if (d0 >= (double) (-this.b) && d0 <= (double) this.b && d1 >= (double) (-this.b) && d1 <= (double) this.b) { if (d0 >= (double) (-this.b) && d0 <= (double) this.b && d1 >= (double) (-this.b) && d1 <= (double) this.b) {
if (!this.trackedPlayers.contains(entityplayer)) { if (!this.trackedPlayers.contains(entityplayer)) {
@ -257,7 +257,7 @@ public class EntityTrackerEntry {
public void scanPlayers(List list) { public void scanPlayers(List list) {
for (int i = 0; i < list.size(); ++i) { for (int i = 0; i < list.size(); ++i) {
this.b((EntityPlayer) list.get(i)); this.updatePlayer((EntityPlayer) list.get(i));
} }
} }
@ -309,7 +309,7 @@ public class EntityTrackerEntry {
} else if (this.tracker instanceof EntitySnowball) { } else if (this.tracker instanceof EntitySnowball) {
return new Packet23VehicleSpawn(this.tracker, 61); return new Packet23VehicleSpawn(this.tracker, 61);
} else if (this.tracker instanceof EntityPotion) { } else if (this.tracker instanceof EntityPotion) {
return new Packet23VehicleSpawn(this.tracker, 73, ((EntityPotion) this.tracker).f()); return new Packet23VehicleSpawn(this.tracker, 73, ((EntityPotion) this.tracker).getPotionValue());
} else if (this.tracker instanceof EntityEnderPearl) { } else if (this.tracker instanceof EntityEnderPearl) {
return new Packet23VehicleSpawn(this.tracker, 65); return new Packet23VehicleSpawn(this.tracker, 65);
} else if (this.tracker instanceof EntityEnderSignal) { } else if (this.tracker instanceof EntityEnderSignal) {
@ -380,7 +380,7 @@ public class EntityTrackerEntry {
} }
} }
public void c(EntityPlayer entityplayer) { public void clear(EntityPlayer entityplayer) {
if (this.trackedPlayers.contains(entityplayer)) { if (this.trackedPlayers.contains(entityplayer)) {
this.trackedPlayers.remove(entityplayer); this.trackedPlayers.remove(entityplayer);
entityplayer.netServerHandler.sendPacket(new Packet29DestroyEntity(this.tracker.id)); entityplayer.netServerHandler.sendPacket(new Packet29DestroyEntity(this.tracker.id));

View file

@ -157,7 +157,7 @@ public class EntityWolf extends EntityAnimal {
this.h = true; this.h = true;
this.i = 0.0F; this.i = 0.0F;
this.j = 0.0F; this.j = 0.0F;
this.world.a(this, (byte) 8); this.world.broadcastEntityEffect(this, (byte) 8);
} }
} }
@ -207,7 +207,7 @@ public class EntityWolf extends EntityAnimal {
} }
} }
public float y() { public float getHeadHeight() {
return this.length * 0.8F; return this.length * 0.8F;
} }
@ -373,10 +373,10 @@ public class EntityWolf extends EntityAnimal {
this.setHealth(20); this.setHealth(20);
this.setOwnerName(entityhuman.name); this.setOwnerName(entityhuman.name);
this.a(true); this.a(true);
this.world.a(this, (byte) 7); this.world.broadcastEntityEffect(this, (byte) 7);
} else { } else {
this.a(false); this.a(false);
this.world.a(this, (byte) 6); this.world.broadcastEntityEffect(this, (byte) 6);
} }
} }

View file

@ -6,7 +6,7 @@ import java.util.Map;
public class FurnaceRecipes { public class FurnaceRecipes {
private static final FurnaceRecipes a = new FurnaceRecipes(); private static final FurnaceRecipes a = new FurnaceRecipes();
public Map b = new HashMap(); // CraftBukkit - private -> public public Map recipies = new HashMap(); // CraftBukkit - private -> public
public static final FurnaceRecipes getInstance() { public static final FurnaceRecipes getInstance() {
return a; return a;
@ -31,14 +31,14 @@ public class FurnaceRecipes {
} }
public void registerRecipe(int i, ItemStack itemstack) { public void registerRecipe(int i, ItemStack itemstack) {
this.b.put(Integer.valueOf(i), itemstack); this.recipies.put(Integer.valueOf(i), itemstack);
} }
public ItemStack a(int i) { public ItemStack getResult(int i) {
return (ItemStack) this.b.get(Integer.valueOf(i)); return (ItemStack) this.recipies.get(Integer.valueOf(i));
} }
public Map b() { public Map getRecipies() {
return this.b; return this.recipies;
} }
} }

View file

@ -12,12 +12,12 @@ import org.bukkit.inventory.InventoryHolder;
public class InventoryLargeChest implements IInventory { public class InventoryLargeChest implements IInventory {
private String a; private String a;
public IInventory b; // CraftBukkit - private -> public public IInventory left; // CraftBukkit - private -> public
public IInventory c; // CraftBukkit - private -> public public IInventory right; // CraftBukkit - private -> public
// CraftBukkit start // CraftBukkit start
public List<HumanEntity> transaction = new ArrayList<HumanEntity>(); public List<HumanEntity> transaction = new ArrayList<HumanEntity>();
public ItemStack[] getContents() { public ItemStack[] getContents() {
ItemStack[] result = new ItemStack[this.getSize()]; ItemStack[] result = new ItemStack[this.getSize()];
for (int i = 0; i < result.length; i++) { for (int i = 0; i < result.length; i++) {
@ -27,21 +27,21 @@ public class InventoryLargeChest implements IInventory {
} }
public void onOpen(CraftHumanEntity who) { public void onOpen(CraftHumanEntity who) {
b.onOpen(who); this.left.onOpen(who);
c.onOpen(who); this.right.onOpen(who);
transaction.add(who); transaction.add(who);
} }
public void onClose(CraftHumanEntity who) { public void onClose(CraftHumanEntity who) {
b.onClose(who); this.left.onClose(who);
c.onClose(who); this.right.onClose(who);
transaction.remove(who); transaction.remove(who);
} }
public List<HumanEntity> getViewers() { public List<HumanEntity> getViewers() {
return transaction; return transaction;
} }
public InventoryHolder getOwner() { public InventoryHolder getOwner() {
return null; // Double chests technically have multiple owners, so there's no sensible way to pick one return null; // Double chests technically have multiple owners, so there's no sensible way to pick one
} }
@ -57,12 +57,12 @@ public class InventoryLargeChest implements IInventory {
iinventory1 = iinventory; iinventory1 = iinventory;
} }
this.b = iinventory; this.left = iinventory;
this.c = iinventory1; this.right = iinventory1;
} }
public int getSize() { public int getSize() {
return this.b.getSize() + this.c.getSize(); return this.left.getSize() + this.right.getSize();
} }
public String getName() { public String getName() {
@ -70,41 +70,41 @@ public class InventoryLargeChest implements IInventory {
} }
public ItemStack getItem(int i) { public ItemStack getItem(int i) {
return i >= this.b.getSize() ? this.c.getItem(i - this.b.getSize()) : this.b.getItem(i); return i >= this.left.getSize() ? this.right.getItem(i - this.left.getSize()) : this.left.getItem(i);
} }
public ItemStack splitStack(int i, int j) { public ItemStack splitStack(int i, int j) {
return i >= this.b.getSize() ? this.c.splitStack(i - this.b.getSize(), j) : this.b.splitStack(i, j); return i >= this.left.getSize() ? this.right.splitStack(i - this.left.getSize(), j) : this.left.splitStack(i, j);
} }
public void setItem(int i, ItemStack itemstack) { public void setItem(int i, ItemStack itemstack) {
if (i >= this.b.getSize()) { if (i >= this.left.getSize()) {
this.c.setItem(i - this.b.getSize(), itemstack); this.right.setItem(i - this.left.getSize(), itemstack);
} else { } else {
this.b.setItem(i, itemstack); this.left.setItem(i, itemstack);
} }
} }
public int getMaxStackSize() { public int getMaxStackSize() {
return this.b.getMaxStackSize(); return this.left.getMaxStackSize();
} }
public void update() { public void update() {
this.b.update(); this.left.update();
this.c.update(); this.right.update();
} }
public boolean a(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
return this.b.a(entityhuman) && this.c.a(entityhuman); return this.left.a(entityhuman) && this.right.a(entityhuman);
} }
public void f() { public void f() {
this.b.f(); this.left.f();
this.c.f(); this.right.f();
} }
public void g() { public void g() {
this.b.g(); this.left.g();
this.c.g(); this.right.g();
} }
} }

View file

@ -12,7 +12,7 @@ public class ItemBed extends Item {
super(i); super(i);
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
if (l != 1) { if (l != 1) {
return false; return false;
} else { } else {

View file

@ -20,7 +20,7 @@ public class ItemBlock extends Item {
return this.id; return this.id;
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
int i1 = world.getTypeId(i, j, k); int i1 = world.getTypeId(i, j, k);

View file

@ -16,7 +16,7 @@ public class ItemDoor extends Item {
this.maxStackSize = 1; this.maxStackSize = 1;
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
if (l != 1) { if (l != 1) {
return false; return false;
} else { } else {
@ -36,12 +36,13 @@ public class ItemDoor extends Item {
int i1 = MathHelper.floor((double) ((entityhuman.yaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3; int i1 = MathHelper.floor((double) ((entityhuman.yaw + 180.0F) * 4.0F / 360.0F) - 0.5D) & 3;
// CraftBukkit start // CraftBukkit start
if (place(world, i, j, k, i1, block, entityhuman)) { if (!place(world, i, j, k, i1, block, entityhuman)) {
--itemstack.count; return false;
return true;
} }
return false;
// CraftBukkit end // CraftBukkit end
--itemstack.count;
return true;
} }
} else { } else {
return false; return false;

View file

@ -20,7 +20,7 @@ public class ItemDye extends Item {
return super.getName() + "." + a[i]; return super.getName() + "." + a[i];
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
if (!entityhuman.d(i, j, k)) { if (!entityhuman.d(i, j, k)) {
return false; return false;
} else { } else {
@ -123,9 +123,10 @@ public class ItemDye extends Item {
return; return;
} }
int iColor = new Byte(event.getColor().getData()).intValue(); i = (byte) event.getColor().getData();
entitysheep.setColor(iColor);
// CraftBukkit end // CraftBukkit end
entitysheep.setColor(i);
--itemstack.count; --itemstack.count;
} }
} }

View file

@ -16,7 +16,7 @@ public class ItemFlintAndSteel extends Item {
this.setMaxDurability(64); this.setMaxDurability(64);
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
if (l == 0) { if (l == 0) {

View file

@ -14,7 +14,7 @@ public class ItemHoe extends Item {
this.setMaxDurability(enumtoolmaterial.a()); this.setMaxDurability(enumtoolmaterial.a());
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
if (!entityhuman.d(i, j, k)) { if (!entityhuman.d(i, j, k)) {
return false; return false;
} else { } else {

View file

@ -16,7 +16,7 @@ public class ItemMinecart extends Item {
this.a = j; this.a = j;
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
int i1 = world.getTypeId(i, j, k); int i1 = world.getTypeId(i, j, k);
if (BlockMinecartTrack.d(i1)) { if (BlockMinecartTrack.d(i1)) {

View file

@ -8,7 +8,7 @@ public class ItemMonsterEgg extends Item {
this.a(true); this.a(true);
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
if (world.isStatic || itemstack.getData() == 48 || itemstack.getData() == 49 || itemstack.getData() == 63) { // CraftBukkit if (world.isStatic || itemstack.getData() == 48 || itemstack.getData() == 49 || itemstack.getData() == 63) { // CraftBukkit
return true; return true;
} else { } else {
@ -18,7 +18,6 @@ public class ItemMonsterEgg extends Item {
Entity entity = EntityTypes.a(itemstack.getData(), world); Entity entity = EntityTypes.a(itemstack.getData(), world);
if (entity != null && entity instanceof EntityLiving) { // CraftBukkit if (entity != null && entity instanceof EntityLiving) { // CraftBukkit
if (!entityhuman.abilities.canInstantlyBuild) { if (!entityhuman.abilities.canInstantlyBuild) {
--itemstack.count; --itemstack.count;
} }
@ -30,4 +29,4 @@ public class ItemMonsterEgg extends Item {
return true; return true;
} }
} }
} }

View file

@ -12,7 +12,7 @@ public class ItemPainting extends Item {
super(i); super(i);
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
if (l == 0) { if (l == 0) {
return false; return false;
} else if (l == 1) { } else if (l == 1) {

View file

@ -12,7 +12,7 @@ public class ItemRedstone extends Item {
super(i); super(i);
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
if (world.getTypeId(i, j, k) != Block.SNOW.id) { if (world.getTypeId(i, j, k) != Block.SNOW.id) {

View file

@ -15,7 +15,7 @@ public class ItemReed extends Item {
this.id = block.id; this.id = block.id;
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit int clickedX = i, clickedY = j, clickedZ = k; // CraftBukkit
int i1 = world.getTypeId(i, j, k); int i1 = world.getTypeId(i, j, k);

View file

@ -17,7 +17,7 @@ public class ItemSeeds extends Item {
this.b = k; this.b = k;
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
if (l != 1) { if (l != 1) {
return false; return false;
} else if (entityhuman.d(i, j, k) && entityhuman.d(i, j + 1, k)) { } else if (entityhuman.d(i, j, k) && entityhuman.d(i, j + 1, k)) {

View file

@ -13,7 +13,7 @@ public class ItemSign extends Item {
this.maxStackSize = 1; this.maxStackSize = 1;
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
if (l == 0) { if (l == 0) {
return false; return false;
} else if (!world.getMaterial(i, j, k).isBuildable()) { } else if (!world.getMaterial(i, j, k).isBuildable()) {

View file

@ -80,7 +80,7 @@ public final class ItemStack {
} }
public boolean placeItem(EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean placeItem(EntityHuman entityhuman, World world, int i, int j, int k, int l) {
boolean flag = this.getItem().a(this, entityhuman, world, i, j, k, l); boolean flag = this.getItem().interactWith(this, entityhuman, world, i, j, k, l);
if (flag) { if (flag) {
entityhuman.a(StatisticList.E[this.id], 1); entityhuman.a(StatisticList.E[this.id], 1);
@ -101,7 +101,7 @@ public final class ItemStack {
return this.getItem().b(this, world, entityhuman); return this.getItem().b(this, world, entityhuman);
} }
public NBTTagCompound b(NBTTagCompound nbttagcompound) { public NBTTagCompound save(NBTTagCompound nbttagcompound) {
nbttagcompound.setShort("id", (short) this.id); nbttagcompound.setShort("id", (short) this.id);
nbttagcompound.setByte("Count", (byte) this.count); nbttagcompound.setByte("Count", (byte) this.count);
nbttagcompound.setShort("Damage", (short) this.damage); nbttagcompound.setShort("Damage", (short) this.damage);
@ -205,7 +205,7 @@ public final class ItemStack {
} }
public boolean b(Block block) { public boolean b(Block block) {
return Item.byId[this.id].a(block); return Item.byId[this.id].canDestroySpecialBlock(block);
} }
public void a(EntityHuman entityhuman) {} public void a(EntityHuman entityhuman) {}

View file

@ -22,7 +22,7 @@ public class ItemStep extends ItemBlock {
return super.getName() + "." + BlockStep.a[i]; return super.getName() + "." + BlockStep.a[i];
} }
public boolean a(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) { public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, int i, int j, int k, int l) {
if (l != 1) { if (l != 1) {
; ;
} }
@ -36,17 +36,16 @@ public class ItemStep extends ItemBlock {
int j1 = world.getData(i, j, k); int j1 = world.getData(i, j, k);
if (l == 1 && i1 == Block.STEP.id && j1 == itemstack.getData()) { if (l == 1 && i1 == Block.STEP.id && j1 == itemstack.getData()) {
// CraftBukkit start - handle this in super /* CraftBukkit start - handle this in super
/*
if (world.setTypeIdAndData(i, j, k, Block.DOUBLE_STEP.id, j1)) { if (world.setTypeIdAndData(i, j, k, Block.DOUBLE_STEP.id, j1)) {
world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), Block.DOUBLE_STEP.stepSound.getName(), (Block.DOUBLE_STEP.stepSound.getVolume1() + 1.0F) / 2.0F, Block.DOUBLE_STEP.stepSound.getVolume2() * 0.8F); world.makeSound((double) ((float) i + 0.5F), (double) ((float) j + 0.5F), (double) ((float) k + 0.5F), Block.DOUBLE_STEP.stepSound.getName(), (Block.DOUBLE_STEP.stepSound.getVolume1() + 1.0F) / 2.0F, Block.DOUBLE_STEP.stepSound.getVolume2() * 0.8F);
--itemstack.count; --itemstack.count;
} }
*/ */
return super.a(itemstack, entityhuman, world, i, j, k, -1); return super.interactWith(itemstack, entityhuman, world, i, j, k, -1);
// CraftBukkit end // CraftBukkit end
} else { } else {
return super.a(itemstack, entityhuman, world, i, j, k, l); return super.interactWith(itemstack, entityhuman, world, i, j, k, l);
} }
} }
} }

View file

@ -165,7 +165,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
} }
} }
WorldType worldtype = WorldType.a(s2); WorldType worldtype = WorldType.getType(s2);
if (worldtype == null) { if (worldtype == null) {
worldtype = WorldType.NORMAL; worldtype = WorldType.NORMAL;

View file

@ -111,12 +111,12 @@ public class MobEffectList {
} }
} }
public void a(EntityLiving entityliving, EntityLiving entityliving1, int i, double d0) { public void applyInstantEffect(EntityLiving entityliving, EntityLiving entityliving1, int i, double d0) {
// CraftBukkit start - delegate; we need EntityPotion // CraftBukkit start - delegate; we need EntityPotion
a(entityliving, entityliving1, i, d0, null); applyInstantEffect(entityliving, entityliving1, i, d0, null);
} }
public void a(EntityLiving entityliving, EntityLiving entityliving1, int i, double d0, EntityPotion potion) { public void applyInstantEffect(EntityLiving entityliving, EntityLiving entityliving1, int i, double d0, EntityPotion potion) {
// CraftBukkit end // CraftBukkit end
int j; int j;
@ -144,7 +144,7 @@ public class MobEffectList {
} }
} }
public boolean b() { public boolean isInstant() {
return false; return false;
} }
@ -172,7 +172,7 @@ public class MobEffectList {
return this; return this;
} }
public double d() { public double getDurationModifier() {
return this.L; return this.L;
} }

View file

@ -158,7 +158,7 @@ public class NetLoginHandler extends NetHandler {
} }
} }
public void a(Packet packet) { public void onUnhandledPacket(Packet packet) {
this.disconnect("Protocol error"); this.disconnect("Protocol error");
} }

View file

@ -1,12 +1,12 @@
package net.minecraft.server; package net.minecraft.server;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Random; import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
// CraftBukkit start // CraftBukkit start
import java.io.UnsupportedEncodingException;
import java.util.logging.Level;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
@ -349,7 +349,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
float f4 = 0.0625F; float f4 = 0.0625F;
boolean flag = worldserver.a(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).size() == 0; boolean flag = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).size() == 0;
if (this.player.onGround && !packet10flying.g && d6 > 0.0D) { if (this.player.onGround && !packet10flying.g && d6 > 0.0D) {
this.player.c(0.2F); this.player.c(0.2F);
@ -357,7 +357,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.player.move(d4, d6, d7); this.player.move(d4, d6, d7);
this.player.onGround = packet10flying.g; this.player.onGround = packet10flying.g;
this.player.b(d4, d6, d7); this.player.checkMovement(d4, d6, d7);
double d9 = d6; double d9 = d6;
d4 = d1 - this.player.locX; d4 = d1 - this.player.locX;
@ -378,7 +378,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
} }
this.player.setLocation(d1, d2, d3, f2, f3); this.player.setLocation(d1, d2, d3, f2, f3);
boolean flag2 = worldserver.a(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).size() == 0; boolean flag2 = worldserver.getCubes(this.player, this.player.boundingBox.clone().shrink((double) f4, (double) f4, (double) f4)).size() == 0;
if (flag && (flag1 || !flag2) && !this.player.isSleeping()) { if (flag && (flag1 || !flag2) && !this.player.isSleeping()) {
this.a(this.x, this.y, this.z, f2, f3); this.a(this.x, this.y, this.z, f2, f3);
@ -682,7 +682,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
this.disconnected = true; this.disconnected = true;
} }
public void a(Packet packet) { public void onUnhandledPacket(Packet packet) {
if (this.disconnected) return; // CraftBukkit if (this.disconnected) return; // CraftBukkit
logger.warning(this.getClass() + " wasn\'t prepared to deal with a " + packet.getClass()); logger.warning(this.getClass() + " wasn\'t prepared to deal with a " + packet.getClass());
this.disconnect("Protocol error, unexpected packet"); this.disconnect("Protocol error, unexpected packet");
@ -987,7 +987,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
// CraftBukkit end // CraftBukkit end
} }
public void a(Packet101CloseWindow packet101closewindow) { public void handleContainerClose(Packet101CloseWindow packet101closewindow) {
if (this.player.dead) return; // CraftBukkit if (this.player.dead) return; // CraftBukkit
// CraftBukkit start - INVENTORY_CLOSE hook // CraftBukkit start - INVENTORY_CLOSE hook
@ -1005,14 +1005,14 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.c(this.player)) { if (this.player.activeContainer.windowId == packet102windowclick.a && this.player.activeContainer.c(this.player)) {
// CraftBukkit start - fire InventoryClickEvent // CraftBukkit start - fire InventoryClickEvent
InventoryView inventory = this.player.activeContainer.getBukkitView(); InventoryView inventory = this.player.activeContainer.getBukkitView();
SlotType type = CraftInventoryView.getSlotType(inventory, packet102windowclick.b); SlotType type = CraftInventoryView.getSlotType(inventory, packet102windowclick.slot);
InventoryClickEvent event; InventoryClickEvent event;
if (inventory instanceof CraftingInventory) { if (inventory instanceof CraftingInventory) {
Recipe recipe = ((CraftingInventory)inventory.getTopInventory()).getRecipe(); Recipe recipe = ((CraftingInventory)inventory.getTopInventory()).getRecipe();
event = new CraftItemEvent(recipe, inventory, type, packet102windowclick.b, packet102windowclick.c != 0, packet102windowclick.f); event = new CraftItemEvent(recipe, inventory, type, packet102windowclick.slot, packet102windowclick.button != 0, packet102windowclick.shift);
} else { } else {
event = new InventoryClickEvent(inventory, type, packet102windowclick.b, packet102windowclick.c != 0, packet102windowclick.f); event = new InventoryClickEvent(inventory, type, packet102windowclick.slot, packet102windowclick.button != 0, packet102windowclick.shift);
} }
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
@ -1021,7 +1021,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
switch(event.getResult()) { switch(event.getResult()) {
case DEFAULT: case DEFAULT:
itemstack = this.player.activeContainer.a(packet102windowclick.b, packet102windowclick.c, packet102windowclick.f, this.player); itemstack = this.player.activeContainer.clickItem(packet102windowclick.slot, packet102windowclick.button, packet102windowclick.shift, this.player);
defaultBehaviour = true; defaultBehaviour = true;
break; break;
case DENY: // Deny any change, including changes from the event case DENY: // Deny any change, including changes from the event
@ -1029,30 +1029,30 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
case ALLOW: // Allow changes unconditionally case ALLOW: // Allow changes unconditionally
org.bukkit.inventory.ItemStack cursor = event.getCursor(); org.bukkit.inventory.ItemStack cursor = event.getCursor();
if (cursor == null) { if (cursor == null) {
this.player.inventory.b((ItemStack) null); this.player.inventory.setCarried((ItemStack) null);
} else { } else {
this.player.inventory.b(CraftItemStack.createNMSItemStack(cursor)); this.player.inventory.setCarried(CraftItemStack.createNMSItemStack(cursor));
} }
org.bukkit.inventory.ItemStack item = event.getCurrentItem(); org.bukkit.inventory.ItemStack item = event.getCurrentItem();
if (item != null) { if (item != null) {
itemstack = CraftItemStack.createNMSItemStack(item); itemstack = CraftItemStack.createNMSItemStack(item);
if(packet102windowclick.b == -999) { if (packet102windowclick.slot == -999) {
this.player.b(itemstack); this.player.drop(itemstack);
} else { } else {
this.player.activeContainer.b(packet102windowclick.b).c(itemstack); this.player.activeContainer.getSlot(packet102windowclick.slot).set(itemstack);
} }
} else if (packet102windowclick.b != -999) { } else if (packet102windowclick.slot != -999) {
this.player.activeContainer.b(packet102windowclick.b).c((ItemStack) null); this.player.activeContainer.getSlot(packet102windowclick.slot).set((ItemStack) null);
} }
break; break;
} }
// CraftBukkit end // CraftBukkit end
if (defaultBehaviour && ItemStack.matches(packet102windowclick.e, itemstack)) { // CraftBukkit - additional condition added if (defaultBehaviour && ItemStack.matches(packet102windowclick.item, itemstack)) { // CraftBukkit - additional condition added
this.player.netServerHandler.sendPacket((Packet) (new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true))); this.player.netServerHandler.sendPacket((Packet) (new Packet106Transaction(packet102windowclick.a, packet102windowclick.d, true)));
this.player.h = true; this.player.h = true;
this.player.activeContainer.a(); this.player.activeContainer.a();
this.player.D(); this.player.broadcastCarriedItem();
this.player.h = false; this.player.h = false;
} else { } else {
this.r.a(this.player.activeContainer.windowId, Short.valueOf(packet102windowclick.d)); this.r.a(this.player.activeContainer.windowId, Short.valueOf(packet102windowclick.d));
@ -1083,58 +1083,70 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
public void a(Packet107SetCreativeSlot packet107setcreativeslot) { public void a(Packet107SetCreativeSlot packet107setcreativeslot) {
if (this.player.itemInWorldManager.isCreative()) { if (this.player.itemInWorldManager.isCreative()) {
boolean flag = packet107setcreativeslot.a < 0; boolean flag = packet107setcreativeslot.slot < 0;
ItemStack itemstack = packet107setcreativeslot.b; ItemStack itemstack = packet107setcreativeslot.b;
boolean flag1 = packet107setcreativeslot.a >= 36 && packet107setcreativeslot.a < 36 + PlayerInventory.getHotbarSize(); boolean flag1 = packet107setcreativeslot.slot >= 36 && packet107setcreativeslot.slot < 36 + PlayerInventory.getHotbarSize();
boolean flag2 = itemstack == null || itemstack.id < Item.byId.length && itemstack.id >= 0 && Item.byId[itemstack.id] != null && !invalidItems.contains(itemstack.id); // CraftBukkit // CraftBukkit
boolean flag2 = itemstack == null || itemstack.id < Item.byId.length && itemstack.id >= 0 && Item.byId[itemstack.id] != null && !invalidItems.contains(itemstack.id);
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;
// CraftBukkit start - Fire INVENTORY_CLICK event // CraftBukkit start - Fire INVENTORY_CLICK event
HumanEntity player = this.player.getBukkitEntity(); HumanEntity player = this.player.getBukkitEntity();
InventoryView inventory = new CraftInventoryView(player, player.getInventory(), this.player.defaultContainer); InventoryView inventory = new CraftInventoryView(player, player.getInventory(), this.player.defaultContainer);
SlotType slot = SlotType.QUICKBAR; SlotType slot = SlotType.QUICKBAR;
if (packet107setcreativeslot.a == -1) { if (packet107setcreativeslot.slot == -1) {
slot = SlotType.OUTSIDE; slot = SlotType.OUTSIDE;
} }
InventoryClickEvent event = new InventoryClickEvent(inventory, slot, slot == SlotType.OUTSIDE ? -999 : packet107setcreativeslot.a, false, false);
InventoryClickEvent event = new InventoryClickEvent(inventory, slot, slot == SlotType.OUTSIDE ? -999 : packet107setcreativeslot.slot, false, false);
server.getPluginManager().callEvent(event); server.getPluginManager().callEvent(event);
org.bukkit.inventory.ItemStack item = event.getCurrentItem(); org.bukkit.inventory.ItemStack item = event.getCurrentItem();
if (event.getResult() == Result.ALLOW) {
switch (event.getResult()) {
case ALLOW:
if (slot == SlotType.QUICKBAR) { if (slot == SlotType.QUICKBAR) {
if (item == null) { if (item == null) {
this.player.defaultContainer.a(packet107setcreativeslot.a, (ItemStack) null); this.player.defaultContainer.setItem(packet107setcreativeslot.slot, (ItemStack) null);
} else { } else {
this.player.defaultContainer.a(packet107setcreativeslot.a, CraftItemStack.createNMSItemStack(item)); this.player.defaultContainer.setItem(packet107setcreativeslot.slot, CraftItemStack.createNMSItemStack(item));
} }
} else if (item != null) { } else if (item != null) {
this.player.b(CraftItemStack.createNMSItemStack(item)); this.player.drop(CraftItemStack.createNMSItemStack(item));
} }
} else if (event.getResult() == Result.DENY) { return;
case DENY:
// TODO: Will this actually work? // TODO: Will this actually work?
if (packet107setcreativeslot.a > -1) { if (packet107setcreativeslot.slot > -1) {
this.player.netServerHandler.sendPacket(new Packet103SetSlot(this.player.defaultContainer.windowId, packet107setcreativeslot.a, CraftItemStack.createNMSItemStack(item))); this.player.netServerHandler.sendPacket(new Packet103SetSlot(this.player.defaultContainer.windowId, packet107setcreativeslot.slot, CraftItemStack.createNMSItemStack(item)));
} }
this.player.netServerHandler.sendPacket(new Packet103SetSlot(this.player.defaultContainer.windowId, -1, null)); this.player.netServerHandler.sendPacket(new Packet103SetSlot(this.player.defaultContainer.windowId, -1, null));
} else if (event.getResult() == Result.DEFAULT) {
// CraftBukkit end
if (flag1 && flag2 && flag3) {
if (itemstack == null) {
this.player.defaultContainer.a(packet107setcreativeslot.a, (ItemStack) null);
} else {
this.player.defaultContainer.a(packet107setcreativeslot.a, itemstack);
}
this.player.defaultContainer.a(this.player, true); return;
} else if (flag && flag2 && flag3) { case DEFAULT:
this.player.b(itemstack); // We do the stuff below
break;
default:
return;
}
// CraftBukkit end
if (flag1 && flag2 && flag3) {
if (itemstack == null) {
this.player.defaultContainer.setItem(packet107setcreativeslot.slot, (ItemStack) null);
} else {
this.player.defaultContainer.setItem(packet107setcreativeslot.slot, itemstack);
} }
} // CraftBukkit closing brace
this.player.defaultContainer.a(this.player, true);
} else if (flag && flag2 && flag3) {
this.player.drop(itemstack);
}
} }
} }
public void a(Packet106Transaction packet106transaction) { public void a(Packet106Transaction packet106transaction) {
if (this.player.dead) return; // CraftBukkit if (this.player.dead) return; // CraftBukkit
Short oshort = (Short) this.r.a(this.player.activeContainer.windowId); Short oshort = (Short) this.r.get(this.player.activeContainer.windowId);
if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.windowId == packet106transaction.a && !this.player.activeContainer.c(this.player)) { if (oshort != null && packet106transaction.b == oshort.shortValue() && this.player.activeContainer.windowId == packet106transaction.a && !this.player.activeContainer.c(this.player)) {
this.player.activeContainer.a(this.player, true); this.player.activeContainer.a(this.player, true);

View file

@ -8,35 +8,36 @@ class NetworkAcceptThread extends Thread {
final MinecraftServer a; final MinecraftServer a;
final NetworkListenThread b; final NetworkListenThread listenThread;
NetworkAcceptThread(NetworkListenThread networklistenthread, String s, MinecraftServer minecraftserver) { NetworkAcceptThread(NetworkListenThread networklistenthread, String s, MinecraftServer minecraftserver) {
super(s); super(s);
this.b = networklistenthread; this.listenThread = networklistenthread;
this.a = minecraftserver; this.a = minecraftserver;
} }
public void run() { public void run() {
while (this.b.b) { while (this.listenThread.b) {
try { try {
Socket socket = NetworkListenThread.a(this.b).accept(); Socket socket = NetworkListenThread.a(this.listenThread).accept();
if (socket != null) { if (socket != null) {
synchronized (NetworkListenThread.b(this.b)) { synchronized (NetworkListenThread.getRecentConnectionAttempts(this.listenThread)) {
InetAddress inetaddress = socket.getInetAddress(); InetAddress inetaddress = socket.getInetAddress();
if (NetworkListenThread.b(this.b).containsKey(inetaddress) && System.currentTimeMillis() - ((Long) NetworkListenThread.b(this.b).get(inetaddress)).longValue() < 4000L) { // CraftBukkit // CraftBukkit
NetworkListenThread.b(this.b).put(inetaddress, Long.valueOf(System.currentTimeMillis())); if (NetworkListenThread.getRecentConnectionAttempts(this.listenThread).containsKey(inetaddress) && System.currentTimeMillis() - ((Long) NetworkListenThread.getRecentConnectionAttempts(this.listenThread).get(inetaddress)).longValue() < 4000L) {
NetworkListenThread.getRecentConnectionAttempts(this.listenThread).put(inetaddress, Long.valueOf(System.currentTimeMillis()));
socket.close(); socket.close();
continue; continue;
} }
NetworkListenThread.b(this.b).put(inetaddress, Long.valueOf(System.currentTimeMillis())); NetworkListenThread.getRecentConnectionAttempts(this.listenThread).put(inetaddress, Long.valueOf(System.currentTimeMillis()));
} }
NetLoginHandler netloginhandler = new NetLoginHandler(this.a, socket, "Connection #" + NetworkListenThread.c(this.b)); NetLoginHandler netloginhandler = new NetLoginHandler(this.a, socket, "Connection #" + NetworkListenThread.c(this.listenThread));
NetworkListenThread.a(this.b, netloginhandler); NetworkListenThread.a(this.listenThread, netloginhandler);
} }
} catch (IOException ioexception) { } catch (IOException ioexception) {
ioexception.printStackTrace(); ioexception.printStackTrace();

View file

@ -93,7 +93,7 @@ public class NetworkListenThread {
return networklistenthread.d; return networklistenthread.d;
} }
static HashMap b(NetworkListenThread networklistenthread) { static HashMap getRecentConnectionAttempts(NetworkListenThread networklistenthread) {
return networklistenthread.i; return networklistenthread.i;
} }

View file

@ -14,7 +14,7 @@ public abstract class Packet {
public static IntHashMap j = new IntHashMap(); 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 action = new HashSet(); private static Set c = new HashSet();
public final long timestamp = System.currentTimeMillis(); public final long timestamp = System.currentTimeMillis();
public boolean lowPriority = false; public boolean lowPriority = false;
@ -33,14 +33,14 @@ public abstract class Packet {
} }
if (flag1) { if (flag1) {
action.add(Integer.valueOf(i)); c.add(Integer.valueOf(i));
} }
} }
} }
public static Packet a(int i) { public static Packet a(int i) {
try { try {
Class oclass = (Class) j.a(i); Class oclass = (Class) j.get(i);
return oclass == null ? null : (Packet) oclass.newInstance(); return oclass == null ? null : (Packet) oclass.newInstance();
} catch (Exception exception) { } catch (Exception exception) {
@ -67,7 +67,7 @@ public abstract class Packet {
return null; return null;
} }
if (flag && !action.contains(Integer.valueOf(i)) || !flag && !b.contains(Integer.valueOf(i))) { if (flag && !c.contains(Integer.valueOf(i)) || !flag && !b.contains(Integer.valueOf(i))) {
throw new IOException("Bad packet id " + i); throw new IOException("Bad packet id " + i);
} }
@ -157,7 +157,7 @@ public abstract class Packet {
} }
protected void a(ItemStack itemstack, DataOutputStream dataoutputstream) throws IOException { // CraftBukkit protected void a(ItemStack itemstack, DataOutputStream dataoutputstream) throws IOException { // CraftBukkit
if (itemstack == null || itemstack.id <= 0) { if (itemstack == null || itemstack.id <= 0) { // CraftBukkit
dataoutputstream.writeShort(-1); dataoutputstream.writeShort(-1);
} else { } else {
dataoutputstream.writeShort(itemstack.id); dataoutputstream.writeShort(itemstack.id);

View file

@ -37,7 +37,7 @@ public class Packet1Login extends Packet {
this.c = datainputstream.readLong(); this.c = datainputstream.readLong();
String s = a(datainputstream, 16); String s = a(datainputstream, 16);
this.d = WorldType.a(s); this.d = WorldType.getType(s);
if (this.d == null) { if (this.d == null) {
this.d = WorldType.NORMAL; this.d = WorldType.NORMAL;
} }

View file

@ -14,13 +14,13 @@ 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];
public int itemInHandIndex = 0; public int itemInHandIndex = 0;
public EntityHuman d; public EntityHuman player;
private ItemStack f; private ItemStack f;
public boolean e = false; public boolean e = false;
// CraftBukkit start // CraftBukkit start
public List<HumanEntity> transaction = new ArrayList<HumanEntity>(); public List<HumanEntity> transaction = new ArrayList<HumanEntity>();
public ItemStack[] getContents() { public ItemStack[] getContents() {
return this.items; return this.items;
} }
@ -36,18 +36,18 @@ public class PlayerInventory implements IInventory {
public void onClose(CraftHumanEntity who) { public void onClose(CraftHumanEntity who) {
transaction.remove(who); transaction.remove(who);
} }
public List<HumanEntity> getViewers() { public List<HumanEntity> getViewers() {
return transaction; return transaction;
} }
public InventoryHolder getOwner() { public InventoryHolder getOwner() {
return d.getBukkitEntity(); return this.player.getBukkitEntity();
} }
// CraftBukkit end // CraftBukkit end
public PlayerInventory(EntityHuman entityhuman) { public PlayerInventory(EntityHuman entityhuman) {
this.d = entityhuman; this.player = entityhuman;
} }
public ItemStack getItemInHand() { public ItemStack getItemInHand() {
@ -161,7 +161,7 @@ public class PlayerInventory implements IInventory {
public void i() { public void i() {
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) {
this.items[i].a(this.d.world, this.d, i, this.itemInHandIndex == i); this.items[i].a(this.player.world, this.player, i, this.itemInHandIndex == i);
} }
} }
} }
@ -196,7 +196,7 @@ public class PlayerInventory implements IInventory {
this.items[i].b = 5; this.items[i].b = 5;
itemstack.count = 0; itemstack.count = 0;
return true; return true;
} else if (this.d.abilities.canInstantlyBuild) { } else if (this.player.abilities.canInstantlyBuild) {
itemstack.count = 0; itemstack.count = 0;
return true; return true;
} else { } else {
@ -208,7 +208,7 @@ public class PlayerInventory implements IInventory {
itemstack.count = this.e(itemstack); itemstack.count = this.e(itemstack);
} while (itemstack.count > 0 && itemstack.count < i); } while (itemstack.count > 0 && itemstack.count < i);
if (itemstack.count == i && this.d.abilities.canInstantlyBuild) { if (itemstack.count == i && this.player.abilities.canInstantlyBuild) {
itemstack.count = 0; itemstack.count = 0;
return true; return true;
} else { } else {
@ -274,7 +274,7 @@ public class PlayerInventory implements IInventory {
if (this.items[i] != null) { if (this.items[i] != null) {
nbttagcompound = new NBTTagCompound(); nbttagcompound = new NBTTagCompound();
nbttagcompound.setByte("Slot", (byte) i); nbttagcompound.setByte("Slot", (byte) i);
this.items[i].b(nbttagcompound); this.items[i].save(nbttagcompound);
nbttaglist.add(nbttagcompound); nbttaglist.add(nbttagcompound);
} }
} }
@ -283,7 +283,7 @@ public class PlayerInventory implements IInventory {
if (this.armor[i] != null) { if (this.armor[i] != null) {
nbttagcompound = new NBTTagCompound(); nbttagcompound = new NBTTagCompound();
nbttagcompound.setByte("Slot", (byte) (i + 100)); nbttagcompound.setByte("Slot", (byte) (i + 100));
this.armor[i].b(nbttagcompound); this.armor[i].save(nbttagcompound);
nbttaglist.add(nbttagcompound); nbttaglist.add(nbttagcompound);
} }
} }
@ -348,7 +348,7 @@ public class PlayerInventory implements IInventory {
} }
// CraftBukkit end // CraftBukkit end
if (block.material.k()) { if (block.material.isAlwaysDestroyable()) {
return true; return true;
} else { } else {
ItemStack itemstack = this.getItem(this.itemInHandIndex); ItemStack itemstack = this.getItem(this.itemInHandIndex);
@ -379,9 +379,9 @@ public class PlayerInventory implements IInventory {
for (int j = 0; j < this.armor.length; ++j) { for (int j = 0; j < this.armor.length; ++j) {
if (this.armor[j] != null && this.armor[j].getItem() instanceof ItemArmor) { if (this.armor[j] != null && this.armor[j].getItem() instanceof ItemArmor) {
this.armor[j].damage(i, this.d); this.armor[j].damage(i, this.player);
if (this.armor[j].count == 0) { if (this.armor[j].count == 0) {
this.armor[j].a(this.d); this.armor[j].a(this.player);
this.armor[j] = null; this.armor[j] = null;
} }
} }
@ -393,14 +393,14 @@ public class PlayerInventory 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) {
this.d.a(this.items[i], true); this.player.a(this.items[i], true);
this.items[i] = null; this.items[i] = null;
} }
} }
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) {
this.d.a(this.armor[i], true); this.player.a(this.armor[i], true);
this.armor[i] = null; this.armor[i] = null;
} }
} }
@ -410,17 +410,17 @@ public class PlayerInventory implements IInventory {
this.e = true; this.e = true;
} }
public void b(ItemStack itemstack) { public void setCarried(ItemStack itemstack) {
this.f = itemstack; this.f = itemstack;
this.d.a(itemstack); this.player.carriedChanged(itemstack);
} }
public ItemStack l() { public ItemStack getCarried() {
return this.f; return this.f;
} }
public boolean a(EntityHuman entityhuman) { public boolean a(EntityHuman entityhuman) {
return this.d.dead ? false : entityhuman.i(this.d) <= 64.0D; return this.player.dead ? false : entityhuman.i(this.player) <= 64.0D;
} }
public boolean c(ItemStack itemstack) { public boolean c(ItemStack itemstack) {

View file

@ -121,7 +121,7 @@ public class ServerConfigurationManager {
// CraftBukkit start // CraftBukkit start
if (!cserver.useExactLoginLocation()) { if (!cserver.useExactLoginLocation()) {
while (worldserver.a(entityplayer, entityplayer.boundingBox).size() != 0) { while (worldserver.getCubes(entityplayer, entityplayer.boundingBox).size() != 0) {
entityplayer.setPosition(entityplayer.locX, entityplayer.locY + 1.0D, entityplayer.locZ); entityplayer.setPosition(entityplayer.locX, entityplayer.locY + 1.0D, entityplayer.locZ);
} }
} else { } else {
@ -297,7 +297,7 @@ public class ServerConfigurationManager {
worldserver.chunkProviderServer.getChunkAt((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4); worldserver.chunkProviderServer.getChunkAt((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4);
while (worldserver.a(entityplayer1, entityplayer1.boundingBox).size() != 0) { while (worldserver.getCubes(entityplayer1, entityplayer1.boundingBox).size() != 0) {
entityplayer1.setPosition(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ); entityplayer1.setPosition(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ);
} }

View file

@ -8,27 +8,27 @@ import org.bukkit.inventory.ShapedRecipe;
public class ShapedRecipes implements CraftingRecipe { public class ShapedRecipes implements CraftingRecipe {
private int b; private int width;
private int c; private int height;
private ItemStack[] d; private ItemStack[] items;
private ItemStack e; private ItemStack result;
public final int a; public final int a;
public ShapedRecipes(int i, int j, ItemStack[] aitemstack, ItemStack itemstack) { public ShapedRecipes(int i, int j, ItemStack[] aitemstack, ItemStack itemstack) {
this.a = itemstack.id; this.a = itemstack.id;
this.b = i; this.width = i;
this.c = j; this.height = j;
this.d = aitemstack; this.items = aitemstack;
this.e = itemstack; this.result = itemstack;
} }
// CraftBukkit start // CraftBukkit start
public ShapedRecipe toBukkitRecipe() { public ShapedRecipe toBukkitRecipe() {
CraftItemStack result = new CraftItemStack(this.e); CraftItemStack result = new CraftItemStack(this.result);
CraftShapedRecipe recipe = new CraftShapedRecipe(result, this); CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
switch (this.b) { switch (this.width) {
case 1: case 1:
switch (this.c) { switch (this.height) {
case 1: case 1:
recipe.shape("a"); recipe.shape("a");
break; break;
@ -41,7 +41,7 @@ public class ShapedRecipes implements CraftingRecipe {
} }
break; break;
case 2: case 2:
switch (this.c) { switch (this.height) {
case 1: case 1:
recipe.shape("a","b"); recipe.shape("a","b");
break; break;
@ -54,7 +54,7 @@ public class ShapedRecipes implements CraftingRecipe {
} }
break; break;
case 3: case 3:
switch (this.c) { switch (this.height) {
case 1: case 1:
recipe.shape("a","b","c"); recipe.shape("a","b","c");
break; break;
@ -68,7 +68,7 @@ public class ShapedRecipes implements CraftingRecipe {
break; break;
} }
char c = 'a'; char c = 'a';
for (ItemStack stack : this.d) { for (ItemStack stack : this.items) {
if (stack != null) { if (stack != null) {
recipe.setIngredient(c, org.bukkit.Material.getMaterial(stack.id), stack.getData()); recipe.setIngredient(c, org.bukkit.Material.getMaterial(stack.id), stack.getData());
} }
@ -79,12 +79,12 @@ public class ShapedRecipes implements CraftingRecipe {
// CraftBukkit end // CraftBukkit end
public ItemStack b() { public ItemStack b() {
return this.e; return this.result;
} }
public boolean a(InventoryCrafting inventorycrafting) { public boolean a(InventoryCrafting inventorycrafting) {
for (int i = 0; i <= 3 - this.b; ++i) { for (int i = 0; i <= 3 - this.width; ++i) {
for (int j = 0; j <= 3 - this.c; ++j) { for (int j = 0; j <= 3 - this.height; ++j) {
if (this.a(inventorycrafting, i, j, true)) { if (this.a(inventorycrafting, i, j, true)) {
return true; return true;
} }
@ -105,11 +105,11 @@ public class ShapedRecipes implements CraftingRecipe {
int j1 = l - j; int j1 = l - j;
ItemStack itemstack = null; ItemStack itemstack = null;
if (i1 >= 0 && j1 >= 0 && i1 < this.b && j1 < this.c) { if (i1 >= 0 && j1 >= 0 && i1 < this.width && j1 < this.height) {
if (flag) { if (flag) {
itemstack = this.d[this.b - i1 - 1 + j1 * this.b]; itemstack = this.items[this.width - i1 - 1 + j1 * this.width];
} else { } else {
itemstack = this.d[i1 + j1 * this.b]; itemstack = this.items[i1 + j1 * this.width];
} }
} }
@ -135,10 +135,10 @@ public class ShapedRecipes implements CraftingRecipe {
} }
public ItemStack b(InventoryCrafting inventorycrafting) { public ItemStack b(InventoryCrafting inventorycrafting) {
return new ItemStack(this.e.id, this.e.count, this.e.getData(), this.e.getEnchantments()); // CraftBukkit - copy enchantments return new ItemStack(this.result.id, this.result.count, this.result.getData(), this.result.getEnchantments()); // CraftBukkit - copy enchantments
} }
public int a() { public int a() {
return this.b * this.c; return this.width * this.height;
} }
} }

View file

@ -12,20 +12,20 @@ import org.bukkit.inventory.ShapelessRecipe;
public class ShapelessRecipes implements CraftingRecipe { public class ShapelessRecipes implements CraftingRecipe {
private final ItemStack a; private final ItemStack result;
private final List b; private final List ingredients;
public ShapelessRecipes(ItemStack itemstack, List list) { public ShapelessRecipes(ItemStack itemstack, List list) {
this.a = itemstack; this.result = itemstack;
this.b = list; this.ingredients = list;
} }
// CraftBukkit start // CraftBukkit start
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public ShapelessRecipe toBukkitRecipe() { public ShapelessRecipe toBukkitRecipe() {
CraftItemStack result = new CraftItemStack(this.a); CraftItemStack result = new CraftItemStack(this.result);
CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this); CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this);
for (ItemStack stack : (List<ItemStack>) this.b) { for (ItemStack stack : (List<ItemStack>) this.ingredients) {
if (stack != null) { if (stack != null) {
recipe.addIngredient(org.bukkit.Material.getMaterial(stack.id), stack.getData()); recipe.addIngredient(org.bukkit.Material.getMaterial(stack.id), stack.getData());
} }
@ -35,11 +35,11 @@ public class ShapelessRecipes implements CraftingRecipe {
// CraftBukkit end // CraftBukkit end
public ItemStack b() { public ItemStack b() {
return this.a; return this.result;
} }
public boolean a(InventoryCrafting inventorycrafting) { public boolean a(InventoryCrafting inventorycrafting) {
ArrayList arraylist = new ArrayList(this.b); ArrayList arraylist = new ArrayList(this.ingredients);
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) { for (int j = 0; j < 3; ++j) {
@ -70,10 +70,10 @@ public class ShapelessRecipes implements CraftingRecipe {
} }
public ItemStack b(InventoryCrafting inventorycrafting) { public ItemStack b(InventoryCrafting inventorycrafting) {
return this.a.cloneItemStack(); return this.result.cloneItemStack();
} }
public int a() { public int a() {
return this.b.size(); return this.ingredients.size();
} }
} }

View file

@ -31,7 +31,7 @@ public class Slot {
return this.getItem() != null; return this.getItem() != null;
} }
public void c(ItemStack itemstack) { public void set(ItemStack itemstack) {
this.inventory.setItem(this.index, itemstack); this.inventory.setItem(this.index, itemstack);
this.d(); this.d();
} }

View file

@ -14,8 +14,8 @@ import org.bukkit.inventory.BrewerInventory;
public class TileEntityBrewingStand extends TileEntity implements IInventory { public class TileEntityBrewingStand extends TileEntity implements IInventory {
public ItemStack[] a = new ItemStack[4]; // CraftBukkit private -> public public ItemStack[] items = new ItemStack[4]; // CraftBukkit private -> public
public int b; // CraftBukkit private -> public public int brewTime; // CraftBukkit private -> public
private int c; private int c;
private int d; private int d;
@ -37,7 +37,7 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
} }
public ItemStack[] getContents() { public ItemStack[] getContents() {
return this.a; return this.items;
} }
// CraftBukkit end // CraftBukkit end
@ -46,25 +46,25 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
} }
public int getSize() { public int getSize() {
return this.a.length; return this.items.length;
} }
public void l_() { public void l_() {
if (this.b > 0) { if (this.brewTime > 0) {
--this.b; --this.brewTime;
if (this.b == 0) { if (this.brewTime == 0) {
this.p(); this.p();
this.update(); this.update();
} else if (!this.o()) { } else if (!this.o()) {
this.b = 0; this.brewTime = 0;
this.update(); this.update();
} else if (this.d != this.a[3].id) { } else if (this.d != this.items[3].id) {
this.b = 0; this.brewTime = 0;
this.update(); this.update();
} }
} else if (this.o()) { } else if (this.o()) {
this.b = 400; this.brewTime = 400;
this.d = this.a[3].id; this.d = this.items[3].id;
} }
int i = this.n(); int i = this.n();
@ -78,12 +78,12 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
} }
public int h() { public int h() {
return this.b; return this.brewTime;
} }
private boolean o() { private boolean o() {
if (this.a[3] != null && this.a[3].count > 0) { if (this.items[3] != null && this.items[3].count > 0) {
ItemStack itemstack = this.a[3]; ItemStack itemstack = this.items[3];
if (!Item.byId[itemstack.id].n()) { if (!Item.byId[itemstack.id].n()) {
return false; return false;
@ -91,8 +91,8 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
boolean flag = false; boolean flag = false;
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
if (this.a[i] != null && this.a[i].id == Item.POTION.id) { if (this.items[i] != null && this.items[i].id == Item.POTION.id) {
int j = this.a[i].getData(); int j = this.items[i].getData();
int k = this.b(j, itemstack); int k = this.b(j, itemstack);
if (!ItemPotion.c(j) && ItemPotion.c(k)) { if (!ItemPotion.c(j) && ItemPotion.c(k)) {
@ -119,7 +119,7 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
private void p() { private void p() {
if (this.o()) { if (this.o()) {
ItemStack itemstack = this.a[3]; ItemStack itemstack = this.items[3];
// CraftBukkit start - fire BREW event // CraftBukkit start - fire BREW event
BrewEvent event = new BrewEvent(world.getWorld().getBlockAt(x, y, z), (BrewerInventory) this.getOwner().getInventory()); BrewEvent event = new BrewEvent(world.getWorld().getBlockAt(x, y, z), (BrewerInventory) this.getOwner().getInventory());
@ -128,28 +128,28 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
// CraftBukkit end // CraftBukkit end
for (int i = 0; i < 3; ++i) { for (int i = 0; i < 3; ++i) {
if (this.a[i] != null && this.a[i].id == Item.POTION.id) { if (this.items[i] != null && this.items[i].id == Item.POTION.id) {
int j = this.a[i].getData(); int j = this.items[i].getData();
int k = this.b(j, itemstack); int k = this.b(j, itemstack);
List list = Item.POTION.b(j); List list = Item.POTION.b(j);
List list1 = Item.POTION.b(k); List list1 = Item.POTION.b(k);
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null)) { if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null)) {
if (j != k) { if (j != k) {
this.a[i].setData(k); this.items[i].setData(k);
} }
} else if (!ItemPotion.c(j) && ItemPotion.c(k)) { } else if (!ItemPotion.c(j) && ItemPotion.c(k)) {
this.a[i].setData(k); this.items[i].setData(k);
} }
} }
} }
if (Item.byId[itemstack.id].k()) { if (Item.byId[itemstack.id].k()) {
this.a[3] = new ItemStack(Item.byId[itemstack.id].j()); this.items[3] = new ItemStack(Item.byId[itemstack.id].j());
} else { } else {
--this.a[3].count; --this.items[3].count;
if (this.a[3].count <= 0) { if (this.items[3].count <= 0) {
this.a[3] = null; this.items[3] = null;
} }
} }
} }
@ -163,31 +163,31 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
super.a(nbttagcompound); super.a(nbttagcompound);
NBTTagList nbttaglist = nbttagcompound.getList("Items"); NBTTagList nbttaglist = nbttagcompound.getList("Items");
this.a = new ItemStack[this.getSize()]; this.items = new ItemStack[this.getSize()];
for (int i = 0; i < nbttaglist.size(); ++i) { for (int i = 0; i < nbttaglist.size(); ++i) {
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i); NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
byte b0 = nbttagcompound1.getByte("Slot"); byte b0 = nbttagcompound1.getByte("Slot");
if (b0 >= 0 && b0 < this.a.length) { if (b0 >= 0 && b0 < this.items.length) {
this.a[b0] = ItemStack.a(nbttagcompound1); this.items[b0] = ItemStack.a(nbttagcompound1);
} }
} }
this.b = nbttagcompound.getShort("BrewTime"); this.brewTime = nbttagcompound.getShort("BrewTime");
} }
public void b(NBTTagCompound nbttagcompound) { public void b(NBTTagCompound nbttagcompound) {
super.b(nbttagcompound); super.b(nbttagcompound);
nbttagcompound.setShort("BrewTime", (short) this.b); nbttagcompound.setShort("BrewTime", (short) this.brewTime);
NBTTagList nbttaglist = new NBTTagList(); NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < this.a.length; ++i) { for (int i = 0; i < this.items.length; ++i) {
if (this.a[i] != null) { if (this.items[i] != null) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Slot", (byte) i); nbttagcompound1.setByte("Slot", (byte) i);
this.a[i].b(nbttagcompound1); this.items[i].save(nbttagcompound1);
nbttaglist.add(nbttagcompound1); nbttaglist.add(nbttagcompound1);
} }
} }
@ -196,14 +196,14 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
} }
public ItemStack getItem(int i) { public ItemStack getItem(int i) {
return i >= 0 && i < this.a.length ? this.a[i] : null; return i >= 0 && i < this.items.length ? this.items[i] : null;
} }
public ItemStack splitStack(int i, int j) { public ItemStack splitStack(int i, int j) {
if (i >= 0 && i < this.a.length) { if (i >= 0 && i < this.items.length) {
ItemStack itemstack = this.a[i]; ItemStack itemstack = this.items[i];
this.a[i] = null; this.items[i] = null;
return itemstack; return itemstack;
} else { } else {
return null; return null;
@ -211,8 +211,8 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
} }
public void setItem(int i, ItemStack itemstack) { public void setItem(int i, ItemStack itemstack) {
if (i >= 0 && i < this.a.length) { if (i >= 0 && i < this.items.length) {
this.a[i] = itemstack; this.items[i] = itemstack;
} }
} }
@ -232,7 +232,7 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
int i = 0; int i = 0;
for (int j = 0; j < 3; ++j) { for (int j = 0; j < 3; ++j) {
if (this.a[j] != null) { if (this.items[j] != null) {
i |= 1 << j; i |= 1 << j;
} }
} }

View file

@ -112,7 +112,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Slot", (byte) i); nbttagcompound1.setByte("Slot", (byte) i);
this.items[i].b(nbttagcompound1); this.items[i].save(nbttagcompound1);
nbttaglist.add(nbttagcompound1); nbttaglist.add(nbttagcompound1);
} }
} }

View file

@ -133,7 +133,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Slot", (byte) i); nbttagcompound1.setByte("Slot", (byte) i);
this.items[i].b(nbttagcompound1); this.items[i].save(nbttagcompound1);
nbttaglist.add(nbttagcompound1); nbttaglist.add(nbttagcompound1);
} }
} }

View file

@ -114,7 +114,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
NBTTagCompound nbttagcompound1 = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound();
nbttagcompound1.setByte("Slot", (byte) i); nbttagcompound1.setByte("Slot", (byte) i);
this.items[i].b(nbttagcompound1); this.items[i].save(nbttagcompound1);
nbttaglist.add(nbttagcompound1); nbttaglist.add(nbttagcompound1);
} }
} }
@ -210,7 +210,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
if (this.items[0] == null) { if (this.items[0] == null) {
return false; return false;
} else { } else {
ItemStack itemstack = FurnaceRecipes.getInstance().a(this.items[0].getItem().id); ItemStack itemstack = FurnaceRecipes.getInstance().getResult(this.items[0].getItem().id);
// CraftBukkit - consider resultant count instead of current count // CraftBukkit - consider resultant count instead of current count
return itemstack == null ? false : (this.items[2] == null ? true : (!this.items[2].doMaterialsMatch(itemstack) ? false : (this.items[2].count + itemstack.count <= this.getMaxStackSize() && this.items[2].count < this.items[2].getMaxStackSize() ? true : this.items[2].count + itemstack.count <= itemstack.getMaxStackSize()))); return itemstack == null ? false : (this.items[2] == null ? true : (!this.items[2].doMaterialsMatch(itemstack) ? false : (this.items[2].count + itemstack.count <= this.getMaxStackSize() && this.items[2].count < this.items[2].getMaxStackSize() ? true : this.items[2].count + itemstack.count <= itemstack.getMaxStackSize())));
@ -219,7 +219,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
public void burn() { public void burn() {
if (this.canBurn()) { if (this.canBurn()) {
ItemStack itemstack = FurnaceRecipes.getInstance().a(this.items[0].getItem().id); ItemStack itemstack = FurnaceRecipes.getInstance().getResult(this.items[0].getItem().id);
// CraftBukkit start // CraftBukkit start
CraftItemStack source = new CraftItemStack(this.items[0]); CraftItemStack source = new CraftItemStack(this.items[0]);

View file

@ -57,11 +57,11 @@ public class TileEntityMobSpawner extends TileEntity {
} }
EntityLiving entityliving = (EntityLiving) ((EntityLiving) mob); EntityLiving entityliving = (EntityLiving) ((EntityLiving) mob);
// CraftBukkit end
if (entityliving == null) { if (entityliving == null) {
return; return;
} }
// CraftBukkit end
int j = this.world.a(entityliving.getClass(), AxisAlignedBB.b((double) this.x, (double) this.y, (double) this.z, (double) (this.x + 1), (double) (this.y + 1), (double) (this.z + 1)).grow(8.0D, 4.0D, 8.0D)).size(); int j = this.world.a(entityliving.getClass(), AxisAlignedBB.b((double) this.x, (double) this.y, (double) this.z, (double) (this.x + 1), (double) (this.y + 1), (double) (this.z + 1)).grow(8.0D, 4.0D, 8.0D)).size();
@ -76,12 +76,9 @@ public class TileEntityMobSpawner extends TileEntity {
double d5 = (double) this.z + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D; double d5 = (double) this.z + (this.world.random.nextDouble() - this.world.random.nextDouble()) * 4.0D;
entityliving.setPositionRotation(d3, d4, d5, this.world.random.nextFloat() * 360.0F, 0.0F); entityliving.setPositionRotation(d3, d4, d5, this.world.random.nextFloat() * 360.0F, 0.0F);
// CraftBukkit start
if (entityliving.canSpawn()) { if (entityliving.canSpawn()) {
this.world.addEntity(entityliving, SpawnReason.SPAWNER); this.world.addEntity(entityliving, SpawnReason.SPAWNER); // CraftBukkit
// CraftBukkit end this.world.triggerEffect(2004, this.x, this.y, this.z, 0);
this.world.f(2004, this.x, this.y, this.z, 0);
entityliving.ao(); entityliving.ao();
this.e(); this.e();
} }

View file

@ -634,7 +634,7 @@ public class World implements IBlockAccess {
} else { } else {
Chunk chunk = this.getChunkAt(l, i1); Chunk chunk = this.getChunkAt(l, i1);
return chunk.a(enumskyblock, i & 15, j, k & 15); return chunk.getBrightness(enumskyblock, i & 15, j, k & 15);
} }
} else { } else {
return enumskyblock.c; return enumskyblock.c;
@ -969,7 +969,7 @@ public class World implements IBlockAccess {
this.z.add(iworldaccess); this.z.add(iworldaccess);
} }
public List a(Entity entity, AxisAlignedBB axisalignedbb) { public List getCubes(Entity entity, AxisAlignedBB axisalignedbb) {
this.R.clear(); this.R.clear();
int i = MathHelper.floor(axisalignedbb.a); int i = MathHelper.floor(axisalignedbb.a);
int j = MathHelper.floor(axisalignedbb.d + 1.0D); int j = MathHelper.floor(axisalignedbb.d + 1.0D);
@ -1362,7 +1362,7 @@ public class World implements IBlockAccess {
return false; return false;
} }
public boolean c(AxisAlignedBB axisalignedbb) { public boolean containsLiquid(AxisAlignedBB axisalignedbb) {
int i = MathHelper.floor(axisalignedbb.a); int i = MathHelper.floor(axisalignedbb.a);
int j = MathHelper.floor(axisalignedbb.d + 1.0D); int j = MathHelper.floor(axisalignedbb.d + 1.0D);
int k = MathHelper.floor(axisalignedbb.b); int k = MathHelper.floor(axisalignedbb.b);
@ -1521,7 +1521,7 @@ public class World implements IBlockAccess {
return false; return false;
} }
public Explosion a(Entity entity, double d0, double d1, double d2, float f) { public Explosion explode(Entity entity, double d0, double d1, double d2, float f) {
return this.createExplosion(entity, d0, d1, d2, f, false); return this.createExplosion(entity, d0, d1, d2, f, false);
} }
@ -1994,7 +1994,7 @@ public class World implements IBlockAccess {
j2 = i2 & 15; j2 = i2 & 15;
k2 = i2 >> 8 & 15; k2 = i2 >> 8 & 15;
l2 = i2 >> 16 & this.heightMinusOne; l2 = i2 >> 16 & this.heightMinusOne;
int i3 = chunk.b[j2 << this.heightBitsPlusFour | k2 << this.heightBits | l2] & 255; int i3 = chunk.blocks[j2 << this.heightBitsPlusFour | k2 << this.heightBits | l2] & 255;
++j1; ++j1;
if (Block.n[i3]) { if (Block.n[i3]) {
@ -2692,7 +2692,7 @@ public class World implements IBlockAccess {
return true; return true;
} }
public void a(Entity entity, byte b0) {} public void broadcastEntityEffect(Entity entity, byte b0) {}
public IChunkProvider p() { public IChunkProvider p() {
return this.chunkProvider; return this.chunkProvider;
@ -2825,7 +2825,7 @@ public class World implements IBlockAccess {
return this.worldMaps.a(s); return this.worldMaps.a(s);
} }
public void f(int i, int j, int k, int l, int i1) { public void triggerEffect(int i, int j, int k, int l, int i1) {
this.a((EntityHuman) null, i, j, k, l, i1); this.a((EntityHuman) null, i, j, k, l, i1);
} }

View file

@ -31,7 +31,7 @@ public class WorldData {
if (nbttagcompound.hasKey("generatorName")) { if (nbttagcompound.hasKey("generatorName")) {
String s = nbttagcompound.getString("generatorName"); String s = nbttagcompound.getString("generatorName");
this.type = WorldType.a(s); this.type = WorldType.getType(s);
if (this.type == null) { if (this.type == null) {
this.type = WorldType.NORMAL; this.type = WorldType.NORMAL;
} }
@ -236,7 +236,7 @@ public class WorldData {
return this.gameType; return this.gameType;
} }
public boolean o() { public boolean shouldGenerateMapFeatures() {
return this.useMapFeatures; return this.useMapFeatures;
} }

View file

@ -196,7 +196,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
} }
public Entity getEntity(int i) { public Entity getEntity(int i) {
return (Entity) this.entitiesById.a(i); return (Entity) this.entitiesById.get(i);
} }
public boolean strikeLightning(Entity entity) { public boolean strikeLightning(Entity entity) {
@ -217,7 +217,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
} }
} }
public void a(Entity entity, byte b0) { public void broadcastEntityEffect(Entity entity, byte b0) {
Packet38EntityStatus packet38entitystatus = new Packet38EntityStatus(entity.id, b0); Packet38EntityStatus packet38entitystatus = new Packet38EntityStatus(entity.id, b0);
// CraftBukkit // CraftBukkit

View file

@ -589,7 +589,7 @@ public final class CraftServer implements Server {
ChunkGenerator generator = creator.generator(); ChunkGenerator generator = creator.generator();
File folder = new File(getWorldContainer(), name); File folder = new File(getWorldContainer(), name);
World world = getWorld(name); World world = getWorld(name);
WorldType type = WorldType.a(creator.type().getName()); WorldType type = WorldType.getType(creator.type().getName());
boolean generateStructures = creator.generateStructures(); boolean generateStructures = creator.generateStructures();
if (world != null) { if (world != null) {
@ -824,13 +824,13 @@ public final class CraftServer implements Server {
} }
public void clearRecipes() { public void clearRecipes() {
CraftingManager.getInstance().b.clear(); CraftingManager.getInstance().recipies.clear();
FurnaceRecipes.getInstance().b().clear(); FurnaceRecipes.getInstance().recipies.clear();
} }
public void resetRecipes() { public void resetRecipes() {
CraftingManager.getInstance().b = new CraftingManager().b; CraftingManager.getInstance().recipies = new CraftingManager().recipies;
FurnaceRecipes.getInstance().b = new FurnaceRecipes().b; FurnaceRecipes.getInstance().recipies = new FurnaceRecipes().recipies;
} }
public Map<String, String[]> getCommandAliases() { public Map<String, String[]> getCommandAliases() {

View file

@ -1037,7 +1037,7 @@ public class CraftWorld implements World {
} }
public boolean canGenerateStructures() { public boolean canGenerateStructures() {
return world.getWorldData().o(); return world.getWorldData().shouldGenerateMapFeatures();
} }
public long getTicksPerAnimalSpawns() { public long getTicksPerAnimalSpawns() {

View file

@ -124,11 +124,11 @@ public class CraftBlock implements Block {
} }
public byte getLightFromSky() { public byte getLightFromSky() {
return (byte) chunk.getHandle().a(EnumSkyBlock.SKY, this.x & 0xF, this.y & 0x7F, this.z & 0xF); return (byte) chunk.getHandle().getBrightness(EnumSkyBlock.SKY, this.x & 0xF, this.y & 0x7F, this.z & 0xF);
} }
public byte getLightFromBlocks() { public byte getLightFromBlocks() {
return (byte) chunk.getHandle().a(EnumSkyBlock.BLOCK, this.x & 0xF, this.y & 0x7F, this.z & 0xF); return (byte) chunk.getHandle().getBrightness(EnumSkyBlock.BLOCK, this.x & 0xF, this.y & 0x7F, this.z & 0xF);
} }
@ -253,7 +253,7 @@ public class CraftBlock implements Block {
return null; return null;
} }
return BIOME_MAPPING[base.K]; return BIOME_MAPPING[base.id];
} }
public double getTemperature() { public double getTemperature() {
@ -326,7 +326,7 @@ public class CraftBlock implements Block {
private boolean itemCausesDrops(ItemStack item) { private boolean itemCausesDrops(ItemStack item) {
net.minecraft.server.Block block = net.minecraft.server.Block.byId[this.getTypeId()]; net.minecraft.server.Block block = net.minecraft.server.Block.byId[this.getTypeId()];
net.minecraft.server.Item itemType = item != null ? net.minecraft.server.Item.byId[item.getTypeId()] : null; net.minecraft.server.Item itemType = item != null ? net.minecraft.server.Item.byId[item.getTypeId()] : null;
return block != null && (block.material.k() || (itemType != null && itemType.a(block))); return block != null && (block.material.isAlwaysDestroyable() || (itemType != null && itemType.canDestroySpecialBlock(block)));
} }
public boolean breakNaturally() { public boolean breakNaturally() {
@ -377,32 +377,32 @@ public class CraftBlock implements Block {
/* Build biome index based lookup table for BiomeBase to Biome mapping */ /* Build biome index based lookup table for BiomeBase to Biome mapping */
static { static {
BIOME_MAPPING = new Biome[BiomeBase.a.length]; BIOME_MAPPING = new Biome[BiomeBase.biomes.length];
BIOME_MAPPING[BiomeBase.SWAMPLAND.K] = Biome.SWAMPLAND; BIOME_MAPPING[BiomeBase.SWAMPLAND.id] = Biome.SWAMPLAND;
BIOME_MAPPING[BiomeBase.FOREST.K] = Biome.FOREST; BIOME_MAPPING[BiomeBase.FOREST.id] = Biome.FOREST;
BIOME_MAPPING[BiomeBase.TAIGA.K] = Biome.TAIGA; BIOME_MAPPING[BiomeBase.TAIGA.id] = Biome.TAIGA;
BIOME_MAPPING[BiomeBase.DESERT.K] = Biome.DESERT; BIOME_MAPPING[BiomeBase.DESERT.id] = Biome.DESERT;
BIOME_MAPPING[BiomeBase.PLAINS.K] = Biome.PLAINS; BIOME_MAPPING[BiomeBase.PLAINS.id] = Biome.PLAINS;
BIOME_MAPPING[BiomeBase.HELL.K] = Biome.HELL; BIOME_MAPPING[BiomeBase.HELL.id] = Biome.HELL;
BIOME_MAPPING[BiomeBase.SKY.K] = Biome.SKY; BIOME_MAPPING[BiomeBase.SKY.id] = Biome.SKY;
BIOME_MAPPING[BiomeBase.RIVER.K] = Biome.RIVER; BIOME_MAPPING[BiomeBase.RIVER.id] = Biome.RIVER;
BIOME_MAPPING[BiomeBase.EXTREME_HILLS.K] = Biome.EXTREME_HILLS; BIOME_MAPPING[BiomeBase.EXTREME_HILLS.id] = Biome.EXTREME_HILLS;
BIOME_MAPPING[BiomeBase.OCEAN.K] = Biome.OCEAN; BIOME_MAPPING[BiomeBase.OCEAN.id] = Biome.OCEAN;
BIOME_MAPPING[BiomeBase.FROZEN_OCEAN.K] = Biome.FROZEN_OCEAN; BIOME_MAPPING[BiomeBase.FROZEN_OCEAN.id] = Biome.FROZEN_OCEAN;
BIOME_MAPPING[BiomeBase.FROZEN_RIVER.K] = Biome.FROZEN_RIVER; BIOME_MAPPING[BiomeBase.FROZEN_RIVER.id] = Biome.FROZEN_RIVER;
BIOME_MAPPING[BiomeBase.ICE_PLAINS.K] = Biome.ICE_PLAINS; BIOME_MAPPING[BiomeBase.ICE_PLAINS.id] = Biome.ICE_PLAINS;
BIOME_MAPPING[BiomeBase.ICE_MOUNTAINS.K] = Biome.ICE_MOUNTAINS; BIOME_MAPPING[BiomeBase.ICE_MOUNTAINS.id] = Biome.ICE_MOUNTAINS;
BIOME_MAPPING[BiomeBase.MUSHROOM_ISLAND.K] = Biome.MUSHROOM_ISLAND; BIOME_MAPPING[BiomeBase.MUSHROOM_ISLAND.id] = Biome.MUSHROOM_ISLAND;
BIOME_MAPPING[BiomeBase.MUSHROOM_SHORE.K] = Biome.MUSHROOM_SHORE; BIOME_MAPPING[BiomeBase.MUSHROOM_SHORE.id] = Biome.MUSHROOM_SHORE;
BIOME_MAPPING[BiomeBase.BEACH.K] = Biome.BEACH; BIOME_MAPPING[BiomeBase.BEACH.id] = Biome.BEACH;
BIOME_MAPPING[BiomeBase.DESERT_HILLS.K] = Biome.DESERT_HILLS; BIOME_MAPPING[BiomeBase.DESERT_HILLS.id] = Biome.DESERT_HILLS;
BIOME_MAPPING[BiomeBase.FOREST_HILLS.K] = Biome.FOREST_HILLS; BIOME_MAPPING[BiomeBase.FOREST_HILLS.id] = Biome.FOREST_HILLS;
BIOME_MAPPING[BiomeBase.TAIGA_HILLS.K] = Biome.TAIGA_HILLS; BIOME_MAPPING[BiomeBase.TAIGA_HILLS.id] = Biome.TAIGA_HILLS;
BIOME_MAPPING[BiomeBase.SMALL_MOUNTAINS.K] = Biome.SMALL_MOUNTAINS; BIOME_MAPPING[BiomeBase.SMALL_MOUNTAINS.id] = Biome.SMALL_MOUNTAINS;
/* Sanity check - we should have a record for each record in the BiomeBase.a table */ /* Sanity check - we should have a record for each record in the BiomeBase.a table */
/* Helps avoid missed biomes when we upgrade bukkit to new code with new biomes */ /* Helps avoid missed biomes when we upgrade bukkit to new code with new biomes */
for (int i = 0; i < BIOME_MAPPING.length; i++) { for (int i = 0; i < BIOME_MAPPING.length; i++) {
if ((BiomeBase.a[i] != null) && (BIOME_MAPPING[i] == null)) { if ((BiomeBase.biomes[i] != null) && (BIOME_MAPPING[i] == null)) {
throw new IllegalArgumentException("Missing Biome mapping for BiomeBase[" + i + "]"); throw new IllegalArgumentException("Missing Biome mapping for BiomeBase[" + i + "]");
} }
} }

View file

@ -34,10 +34,10 @@ public class CraftBrewingStand extends CraftBlockState implements BrewingStand {
} }
public int getBrewingTime() { public int getBrewingTime() {
return brewingStand.b; return brewingStand.brewTime;
} }
public void setBrewingTime(int brewTime) { public void setBrewingTime(int brewTime) {
brewingStand.b = brewTime; brewingStand.brewTime = brewTime;
} }
} }

View file

@ -33,7 +33,7 @@ public abstract class CraftComplexLivingEntity extends CraftLivingEntity impleme
} }
if (entity instanceof EntityComplex) { if (entity instanceof EntityComplex) {
((EntityComplex) entity).e(reason, amount); ((EntityComplex) entity).dealDamage(reason, amount);
} else { } else {
entity.damageEntity(reason, amount); entity.damageEntity(reason, amount);
} }

View file

@ -297,7 +297,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
} }
public void playEffect(EntityEffect type) { public void playEffect(EntityEffect type) {
this.getHandle().world.a(getHandle(), type.getData()); this.getHandle().world.broadcastEntityEffect(getHandle(), type.getData());
} }
public void setHandle(final Entity entity) { public void setHandle(final Entity entity) {

View file

@ -64,14 +64,14 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
} }
public ItemStack getItemOnCursor() { public ItemStack getItemOnCursor() {
return new CraftItemStack(getHandle().inventory.l()); return new CraftItemStack(getHandle().inventory.getCarried());
} }
public void setItemOnCursor(ItemStack item) { public void setItemOnCursor(ItemStack item) {
CraftItemStack stack = new CraftItemStack(item.getType(), item.getAmount(), item.getDurability()); CraftItemStack stack = new CraftItemStack(item.getType(), item.getAmount(), item.getDurability());
getHandle().inventory.b(stack.getHandle()); getHandle().inventory.setCarried(stack.getHandle());
if (this instanceof CraftPlayer) { if (this instanceof CraftPlayer) {
((EntityPlayer)getHandle()).D(); // Send set slot for cursor ((EntityPlayer) getHandle()).broadcastCarriedItem(); // Send set slot for cursor
} }
} }
@ -174,22 +174,22 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
switch(type) { switch(type) {
case PLAYER: case PLAYER:
case CHEST: case CHEST:
getHandle().a(craftinv.getInventory()); getHandle().openContainer(craftinv.getInventory());
break; break;
case DISPENSER: case DISPENSER:
getHandle().a((TileEntityDispenser)craftinv.getInventory()); getHandle().openDispenser((TileEntityDispenser)craftinv.getInventory());
break; break;
case FURNACE: case FURNACE:
getHandle().a((TileEntityFurnace)craftinv.getInventory()); getHandle().openFurnace((TileEntityFurnace)craftinv.getInventory());
break; break;
case WORKBENCH: case WORKBENCH:
getHandle().b(getLocation().getBlockX(), getLocation().getBlockY(), getLocation().getBlockZ()); getHandle().startCrafting(getLocation().getBlockX(), getLocation().getBlockY(), getLocation().getBlockZ());
break; break;
case BREWING: case BREWING:
getHandle().a((TileEntityBrewingStand)craftinv.getInventory()); getHandle().openBrewingStand((TileEntityBrewingStand)craftinv.getInventory());
break; break;
case ENCHANTING: case ENCHANTING:
getHandle().c(getLocation().getBlockX(), getLocation().getBlockY(), getLocation().getBlockZ()); getHandle().startEnchanting(getLocation().getBlockX(), getLocation().getBlockY(), getLocation().getBlockZ());
break; break;
case CREATIVE: case CREATIVE:
case CRAFTING: case CRAFTING:
@ -209,7 +209,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
if (location == null) { if (location == null) {
location = getLocation(); location = getLocation();
} }
getHandle().b(location.getBlockX(), location.getBlockY(), location.getBlockZ()); getHandle().startCrafting(location.getBlockX(), location.getBlockY(), location.getBlockZ());
if (force) { if (force) {
getHandle().activeContainer.checkReachable = false; getHandle().activeContainer.checkReachable = false;
} }
@ -226,7 +226,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
if (location == null) { if (location == null) {
location = getLocation(); location = getLocation();
} }
getHandle().c(location.getBlockX(), location.getBlockY(), location.getBlockZ()); getHandle().startEnchanting(location.getBlockX(), location.getBlockY(), location.getBlockZ());
if (force) { if (force) {
getHandle().activeContainer.checkReachable = false; getHandle().activeContainer.checkReachable = false;
} }
@ -237,14 +237,14 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
if (!(getHandle() instanceof EntityPlayer)) return; // TODO: NPC support? if (!(getHandle() instanceof EntityPlayer)) return; // TODO: NPC support?
if (getHandle().activeContainer != getHandle().defaultContainer) { if (getHandle().activeContainer != getHandle().defaultContainer) {
// fire INVENTORY_CLOSE if one already open // fire INVENTORY_CLOSE if one already open
((EntityPlayer)getHandle()).netServerHandler.a(new Packet101CloseWindow(getHandle().activeContainer.windowId)); ((EntityPlayer)getHandle()).netServerHandler.handleContainerClose(new Packet101CloseWindow(getHandle().activeContainer.windowId));
} }
EntityPlayer player = (EntityPlayer) getHandle(); EntityPlayer player = (EntityPlayer) getHandle();
Container container; Container container;
if (inventory instanceof CraftInventoryView) { if (inventory instanceof CraftInventoryView) {
container = ((CraftInventoryView) inventory).getHandle(); container = ((CraftInventoryView) inventory).getHandle();
} else { } else {
container = new CraftContainer(inventory, player.aS()); container = new CraftContainer(inventory, player.nextContainerCounter());
} }
// Trigger an INVENTORY_OPEN event // Trigger an INVENTORY_OPEN event
@ -259,7 +259,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
// Now open the window // Now open the window
player.netServerHandler.sendPacket(new Packet100OpenWindow(container.windowId, 1, "Crafting", 9)); player.netServerHandler.sendPacket(new Packet100OpenWindow(container.windowId, 1, "Crafting", 9));
player.activeContainer = container; player.activeContainer = container;
player.activeContainer.a((ICrafting) player); player.activeContainer.addSlotListener((ICrafting) player);
} }
public void closeInventory() { public void closeInventory() {

View file

@ -576,7 +576,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public void setBedSpawnLocation(Location location) { public void setBedSpawnLocation(Location location) {
getHandle().a(new ChunkCoordinates(location.getBlockX(), location.getBlockY(), location.getBlockZ())); getHandle().setRespawnPosition(new ChunkCoordinates(location.getBlockX(), location.getBlockY(), location.getBlockZ()));
getHandle().spawnWorld = location.getWorld().getName(); getHandle().spawnWorld = location.getWorld().getName();
} }
@ -587,9 +587,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
//remove this player from the hidden player's EntityTrackerEntry //remove this player from the hidden player's EntityTrackerEntry
EntityTracker tracker = ((WorldServer) entity.world).tracker; EntityTracker tracker = ((WorldServer) entity.world).tracker;
EntityPlayer other = ((CraftPlayer) player).getHandle(); EntityPlayer other = ((CraftPlayer) player).getHandle();
EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.a(other.id); EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.get(other.id);
if (entry != null) { if (entry != null) {
entry.c(getHandle()); entry.clear(getHandle());
} }
//remove the hidden player from this player user list //remove the hidden player from this player user list
@ -602,9 +602,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
EntityTracker tracker = ((WorldServer) entity.world).tracker; EntityTracker tracker = ((WorldServer) entity.world).tracker;
EntityPlayer other = ((CraftPlayer) player).getHandle(); EntityPlayer other = ((CraftPlayer) player).getHandle();
EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.a(other.id); EntityTrackerEntry entry = (EntityTrackerEntry) tracker.trackedEntities.get(other.id);
if (entry != null && !entry.trackedPlayers.contains(getHandle())) { if (entry != null && !entry.trackedPlayers.contains(getHandle())) {
entry.b(getHandle()); entry.updatePlayer(getHandle());
} }
getHandle().netServerHandler.sendPacket(new Packet201PlayerInfo(player.getPlayerListName(), true, getHandle().ping)); getHandle().netServerHandler.sendPacket(new Packet201PlayerInfo(player.getPlayerListName(), true, getHandle().ping));
@ -764,7 +764,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (container.getBukkitView().getType() != prop.getType()) { if (container.getBukkitView().getType() != prop.getType()) {
return false; return false;
} }
getHandle().a(container, prop.getId(), value); getHandle().setContainerData(container, prop.getId(), value);
return true; return true;
} }
} }

View file

@ -20,7 +20,7 @@ public class CraftThrownPotion extends CraftProjectile implements ThrownPotion {
public Collection<PotionEffect> getEffects() { public Collection<PotionEffect> getEffects() {
if (effects == null) { if (effects == null) {
effects = Potion.getBrewer().getEffectsFromDamage(getHandle().f()); effects = Potion.getBrewer().getEffectsFromDamage(getHandle().getPotionValue());
} }
return effects; return effects;

View file

@ -423,7 +423,7 @@ public class CraftEventFactory {
public static Container callInventoryOpenEvent(EntityPlayer player, Container container) { public static Container callInventoryOpenEvent(EntityPlayer player, Container container) {
if (player.activeContainer != player.defaultContainer) { // fire INVENTORY_CLOSE if one already open if (player.activeContainer != player.defaultContainer) { // fire INVENTORY_CLOSE if one already open
player.netServerHandler.a(new Packet101CloseWindow(player.activeContainer.windowId)); player.netServerHandler.handleContainerClose(new Packet101CloseWindow(player.activeContainer.windowId));
} }
CraftServer server = ((WorldServer) player.world).getServer(); CraftServer server = ((WorldServer) player.world).getServer();

View file

@ -17,15 +17,15 @@ public class CraftInventoryDoubleChest extends CraftInventory implements DoubleC
public CraftInventoryDoubleChest(InventoryLargeChest largeChest) { public CraftInventoryDoubleChest(InventoryLargeChest largeChest) {
super(largeChest); super(largeChest);
if (largeChest.b instanceof InventoryLargeChest) { if (largeChest.left instanceof InventoryLargeChest) {
left = new CraftInventoryDoubleChest((InventoryLargeChest)largeChest.b); left = new CraftInventoryDoubleChest((InventoryLargeChest) largeChest.left);
} else { } else {
left = new CraftInventory(largeChest.b); left = new CraftInventory(largeChest.left);
} }
if (largeChest.c instanceof InventoryLargeChest) { if (largeChest.right instanceof InventoryLargeChest) {
right = new CraftInventoryDoubleChest((InventoryLargeChest)largeChest.c); right = new CraftInventoryDoubleChest((InventoryLargeChest) largeChest.right);
} else { } else {
right = new CraftInventory(largeChest.c); right = new CraftInventory(largeChest.right);
} }
} }

View file

@ -51,7 +51,7 @@ public class CraftInventoryView extends InventoryView {
public void setItem(int slot, ItemStack item) { public void setItem(int slot, ItemStack item) {
if (slot != -999) { if (slot != -999) {
CraftItemStack stack = new CraftItemStack(item); CraftItemStack stack = new CraftItemStack(item);
container.b(slot).c(stack.getHandle()); container.getSlot(slot).set(stack.getHandle());
} }
} }
@ -60,7 +60,7 @@ public class CraftInventoryView extends InventoryView {
if (slot == -999) { if (slot == -999) {
return null; return null;
} }
return new CraftItemStack(container.b(slot).getItem()); return new CraftItemStack(container.getSlot(slot).getItem());
} }
public boolean isInTop(int rawSlot) { public boolean isInTop(int rawSlot) {

View file

@ -13,10 +13,10 @@ public class RecipeIterator implements Iterator<Recipe> {
private Iterator<CraftingRecipe> recipes; private Iterator<CraftingRecipe> recipes;
private Iterator<Integer> smelting; private Iterator<Integer> smelting;
private Iterator<?> removeFrom = null; private Iterator<?> removeFrom = null;
public RecipeIterator() { public RecipeIterator() {
this.recipes = CraftingManager.getInstance().b().iterator(); this.recipes = CraftingManager.getInstance().getRecipies().iterator();
this.smelting = FurnaceRecipes.getInstance().b().keySet().iterator(); this.smelting = FurnaceRecipes.getInstance().getRecipies().keySet().iterator();
} }
public boolean hasNext() { public boolean hasNext() {
@ -34,7 +34,7 @@ public class RecipeIterator implements Iterator<Recipe> {
} else { } else {
removeFrom = smelting; removeFrom = smelting;
int id = smelting.next(); int id = smelting.next();
CraftItemStack stack = new CraftItemStack(FurnaceRecipes.getInstance().a(id)); CraftItemStack stack = new CraftItemStack(FurnaceRecipes.getInstance().getResult(id));
CraftFurnaceRecipe recipe = new CraftFurnaceRecipe(stack, new ItemStack(id, 1, (short) -1)); CraftFurnaceRecipe recipe = new CraftFurnaceRecipe(stack, new ItemStack(id, 1, (short) -1));
return recipe; return recipe;
} }

View file

@ -20,7 +20,7 @@ public class CraftPotionBrewer implements PotionBrewer {
if (cache.containsKey(damage)) if (cache.containsKey(damage))
return cache.get(damage); return cache.get(damage);
List<?> mcEffects = net.minecraft.server.PotionBrewer.a(damage, false); List<?> mcEffects = net.minecraft.server.PotionBrewer.getEffects(damage, false);
List<PotionEffect> effects = new ArrayList<PotionEffect>(); List<PotionEffect> effects = new ArrayList<PotionEffect>();
if (mcEffects == null) if (mcEffects == null)
return effects; return effects;

View file

@ -14,7 +14,7 @@ public class CraftPotionEffectType extends PotionEffectType {
@Override @Override
public double getDurationModifier() { public double getDurationModifier() {
return handle.d(); return handle.getDurationModifier();
} }
public MobEffectList getHandle() { public MobEffectList getHandle() {
@ -69,6 +69,6 @@ public class CraftPotionEffectType extends PotionEffectType {
@Override @Override
public boolean isInstant() { public boolean isInstant() {
return handle.b(); return handle.isInstant();
} }
} }