Updated to rename revision 02
Dieser Commit ist enthalten in:
Ursprung
8524ff8ef7
Commit
33ba9f0a2f
2
pom.xml
2
pom.xml
@ -58,7 +58,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>minecraft-server</artifactId>
|
||||
<version>1.1_01</version>
|
||||
<version>1.1_02</version>
|
||||
<type>jar</type>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
@ -549,7 +549,7 @@ public class Block {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return LocaleI18n.a(this.n() + ".name");
|
||||
return LocaleI18n.get(this.n() + ".name");
|
||||
}
|
||||
|
||||
public String n() {
|
||||
|
@ -69,7 +69,7 @@ public class BlockDispenser extends BlockContainer {
|
||||
TileEntityDispenser tileentitydispenser = (TileEntityDispenser) world.getTileEntity(i, j, k);
|
||||
|
||||
if (tileentitydispenser != null) {
|
||||
entityhuman.a(tileentitydispenser);
|
||||
entityhuman.openDispenser(tileentitydispenser);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -111,7 +111,7 @@ public class BlockDispenser extends BlockContainer {
|
||||
double d2 = (double) k + (double) b1 * 0.6D + 0.5D;
|
||||
|
||||
if (itemstack == null) {
|
||||
world.f(1001, i, j, k, 0);
|
||||
world.triggerEffect(1001, i, j, k, 0);
|
||||
} else {
|
||||
// CraftBukkit start
|
||||
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.fromPlayer = true;
|
||||
world.addEntity(entityarrow);
|
||||
world.f(1002, i, j, k, 0);
|
||||
world.triggerEffect(1002, i, j, k, 0);
|
||||
} else if (itemstack.id == Item.EGG.id) {
|
||||
EntityEgg entityegg = new EntityEgg(world, d0, d1, d2);
|
||||
|
||||
entityegg.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
|
||||
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) {
|
||||
EntitySnowball entitysnowball = new EntitySnowball(world, d0, d1, d2);
|
||||
|
||||
entitysnowball.a((double) b0, 0.10000000149011612D, (double) b1, 1.1F, 6.0F);
|
||||
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())) {
|
||||
EntityPotion entitypotion = new EntityPotion(world, d0, d1, d2, itemstack.getData());
|
||||
|
||||
entitypotion.a((double) b0, 0.10000000149011612D, (double) b1, 1.375F, 3.0F);
|
||||
world.addEntity(entitypotion);
|
||||
world.f(1002, i, j, k, 0);
|
||||
world.triggerEffect(1002, i, j, k, 0);
|
||||
} else {
|
||||
EntityItem entityitem = new EntityItem(world, d0, d1 - 0.3D, d2, itemstack);
|
||||
// CraftBukkit start
|
||||
@ -176,10 +176,10 @@ public class BlockDispenser extends BlockContainer {
|
||||
entityitem.motZ = motZ;
|
||||
// CraftBukkit end
|
||||
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;
|
||||
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;
|
||||
|
||||
entityitem.motX = (double) ((float) this.a.nextGaussian() * f3);
|
||||
|
@ -62,7 +62,7 @@ public class BlockFurnace extends BlockContainer {
|
||||
TileEntityFurnace tileentityfurnace = (TileEntityFurnace) world.getTileEntity(i, j, k);
|
||||
|
||||
if (tileentityfurnace != null) {
|
||||
entityhuman.a(tileentityfurnace);
|
||||
entityhuman.openFurnace(tileentityfurnace);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -133,7 +133,8 @@ public class BlockFurnace extends BlockContainer {
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
entityitem.motX = (double) ((float) this.a.nextGaussian() * f3);
|
||||
|
@ -23,7 +23,7 @@ public class BlockPiston extends Block {
|
||||
public int a(int i, int j) {
|
||||
int k = d(j);
|
||||
|
||||
return k > 5 ? this.textureId : (i == k ? (!e(j) && this.minX <= 0.0D && this.minY <= 0.0D && this.minZ <= 0.0D && this.maxX >= 1.0D && this.maxY >= 1.0D && this.maxZ >= 1.0D ? this.textureId : 110) : (i == 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() {
|
||||
@ -218,7 +218,7 @@ public class BlockPiston extends Block {
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class BlockPistonExtension extends Block {
|
||||
super.remove(world, i, j, k);
|
||||
int l = world.getData(i, j, k);
|
||||
if (l > 5 || l < 0) return; // CraftBukkit - fixed a piston AIOOBE issue.
|
||||
int i1 = Facing.a[b(l)];
|
||||
int i1 = Facing.OPPOSITE_FACING[b(l)];
|
||||
|
||||
i += Facing.b[i1];
|
||||
j += Facing.c[i1];
|
||||
@ -36,7 +36,7 @@ public class BlockPistonExtension extends Block {
|
||||
public int a(int i, int j) {
|
||||
int k = b(j);
|
||||
|
||||
return i == k ? (this.a >= 0 ? this.a : ((j & 8) != 0 ? this.textureId - 1 : this.textureId)) : (i == 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() {
|
||||
|
@ -4,11 +4,11 @@ import java.util.Random;
|
||||
|
||||
public class BlockStem extends BlockFlower {
|
||||
|
||||
private Block a;
|
||||
private Block blockFruit;
|
||||
|
||||
protected BlockStem(int i, Block block) {
|
||||
super(i, 111);
|
||||
this.a = block;
|
||||
this.blockFruit = block;
|
||||
this.a(true);
|
||||
float f = 0.125F;
|
||||
|
||||
@ -28,21 +28,22 @@ public class BlockStem extends BlockFlower {
|
||||
int l = world.getData(i, j, k);
|
||||
|
||||
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 {
|
||||
if (world.getTypeId(i - 1, j, k) == this.a.id) {
|
||||
if (world.getTypeId(i - 1, j, k) == this.blockFruit.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (world.getTypeId(i + 1, j, k) == this.a.id) {
|
||||
if (world.getTypeId(i + 1, j, k) == this.blockFruit.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (world.getTypeId(i, j, k - 1) == this.a.id) {
|
||||
if (world.getTypeId(i, j, k - 1) == this.blockFruit.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (world.getTypeId(i, j, k + 1) == this.a.id) {
|
||||
if (world.getTypeId(i, j, k + 1) == this.blockFruit.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -69,7 +70,7 @@ public class BlockStem extends BlockFlower {
|
||||
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)) {
|
||||
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) {
|
||||
Item item = null;
|
||||
|
||||
if (this.a == Block.PUMPKIN) {
|
||||
if (this.blockFruit == Block.PUMPKIN) {
|
||||
item = Item.PUMPKIN_SEEDS;
|
||||
}
|
||||
|
||||
if (this.a == Block.MELON) {
|
||||
if (this.blockFruit == Block.MELON) {
|
||||
item = Item.MELON_SEEDS;
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.Bukkit; // CraftBukkit
|
||||
public class Chunk {
|
||||
|
||||
public static boolean a;
|
||||
public byte[] b;
|
||||
public byte[] blocks;
|
||||
public int[] c;
|
||||
public boolean[] d;
|
||||
public boolean e;
|
||||
@ -71,7 +71,7 @@ public class Chunk {
|
||||
|
||||
public Chunk(World world, byte[] abyte, int i, int j) {
|
||||
this(world, i, j);
|
||||
this.b = abyte;
|
||||
this.blocks = abyte;
|
||||
this.g = new NibbleArray(abyte.length, world.heightBits);
|
||||
this.h = new NibbleArray(abyte.length, world.heightBits);
|
||||
this.i = new NibbleArray(abyte.length, world.heightBits);
|
||||
@ -99,7 +99,7 @@ public class Chunk {
|
||||
|
||||
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;
|
||||
|
||||
do {
|
||||
j1 -= Block.lightBlock[this.b[i1 + k1] & 255];
|
||||
j1 -= Block.lightBlock[this.blocks[i1 + k1] & 255];
|
||||
if (j1 > 0) {
|
||||
this.h.a(j, k1, k, j1);
|
||||
}
|
||||
@ -208,7 +208,7 @@ public class Chunk {
|
||||
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) {
|
||||
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) {
|
||||
@ -299,7 +299,7 @@ public class Chunk {
|
||||
}
|
||||
|
||||
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) {
|
||||
return false;
|
||||
@ -307,7 +307,7 @@ public class Chunk {
|
||||
int i2 = this.x * 16 + i;
|
||||
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 (!this.world.isStatic) {
|
||||
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);
|
||||
if (!this.world.worldProvider.f) {
|
||||
@ -373,7 +373,7 @@ public class Chunk {
|
||||
}
|
||||
|
||||
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) {
|
||||
return false;
|
||||
@ -381,12 +381,12 @@ public class Chunk {
|
||||
int l1 = this.x * 16 + i;
|
||||
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) {
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -741,9 +741,9 @@ public class Chunk {
|
||||
int i2 = i1 - j;
|
||||
int j2 = j1 - k;
|
||||
|
||||
if (l1 * i2 * j2 == this.b.length) {
|
||||
System.arraycopy(this.b, 0, abyte, k1, this.b.length);
|
||||
k1 += this.b.length;
|
||||
if (l1 * i2 * j2 == this.blocks.length) {
|
||||
System.arraycopy(this.blocks, 0, abyte, k1, this.blocks.length);
|
||||
k1 += this.blocks.length;
|
||||
System.arraycopy(this.g.a, 0, abyte, k1, this.g.a.length);
|
||||
k1 += this.g.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) {
|
||||
i3 = k2 << this.world.heightBitsPlusFour | l2 << this.world.heightBits | j;
|
||||
j3 = i1 - j;
|
||||
System.arraycopy(this.b, i3, abyte, k1, j3);
|
||||
System.arraycopy(this.blocks, i3, abyte, k1, j3);
|
||||
k1 += j3;
|
||||
}
|
||||
}
|
||||
@ -806,7 +806,7 @@ public class Chunk {
|
||||
}
|
||||
|
||||
public void h() {
|
||||
BlockRegister.a(this.b);
|
||||
BlockRegister.a(this.blocks);
|
||||
}
|
||||
|
||||
public void a(IChunkProvider ichunkprovider, IChunkProvider ichunkprovider1, int i, int j) {
|
||||
|
@ -120,7 +120,7 @@ public class ChunkLoader implements IChunkLoader {
|
||||
nbttagcompound.setInt("xPos", chunk.x);
|
||||
nbttagcompound.setInt("zPos", chunk.z);
|
||||
nbttagcompound.setLong("LastUpdate", world.getTime());
|
||||
nbttagcompound.setByteArray("Blocks", chunk.b);
|
||||
nbttagcompound.setByteArray("Blocks", chunk.blocks);
|
||||
nbttagcompound.setByteArray("Data", chunk.g.a);
|
||||
nbttagcompound.setByteArray("SkyLight", chunk.h.a);
|
||||
nbttagcompound.setByteArray("BlockLight", chunk.i.a);
|
||||
@ -188,24 +188,24 @@ public class ChunkLoader implements IChunkLoader {
|
||||
int j = nbttagcompound.getInt("zPos");
|
||||
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.h = new NibbleArray(nbttagcompound.getByteArray("SkyLight"), world.heightBits);
|
||||
chunk.i = new NibbleArray(nbttagcompound.getByteArray("BlockLight"), world.heightBits);
|
||||
chunk.heightMap = nbttagcompound.getByteArray("HeightMap");
|
||||
chunk.done = nbttagcompound.getBoolean("TerrainPopulated");
|
||||
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()) {
|
||||
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();
|
||||
}
|
||||
|
||||
if (!chunk.i.a()) {
|
||||
chunk.i = new NibbleArray(chunk.b.length, world.heightBits);
|
||||
chunk.i = new NibbleArray(chunk.blocks.length, world.heightBits);
|
||||
chunk.a();
|
||||
}
|
||||
|
||||
|
@ -12,6 +12,7 @@ import org.bukkit.inventory.InventoryView;
|
||||
// CraftBukkit end
|
||||
|
||||
public abstract class Container {
|
||||
|
||||
public List d = new ArrayList();
|
||||
public List e = new ArrayList();
|
||||
public int windowId = 0;
|
||||
@ -24,10 +25,10 @@ public abstract class Container {
|
||||
public abstract InventoryView getBukkitView();
|
||||
public void transferTo(Container other, CraftHumanEntity player) {
|
||||
InventoryView source = this.getBukkitView(), destination = other.getBukkitView();
|
||||
((CraftInventory)source.getTopInventory()).getInventory().onClose(player);
|
||||
((CraftInventory)source.getBottomInventory()).getInventory().onClose(player);
|
||||
((CraftInventory)destination.getTopInventory()).getInventory().onOpen(player);
|
||||
((CraftInventory)destination.getBottomInventory()).getInventory().onOpen(player);
|
||||
((CraftInventory) source.getTopInventory()).getInventory().onClose(player);
|
||||
((CraftInventory) source.getBottomInventory()).getInventory().onClose(player);
|
||||
((CraftInventory) destination.getTopInventory()).getInventory().onOpen(player);
|
||||
((CraftInventory) destination.getBottomInventory()).getInventory().onOpen(player);
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -39,7 +40,7 @@ public abstract class Container {
|
||||
this.d.add(null);
|
||||
}
|
||||
|
||||
public void a(ICrafting icrafting) {
|
||||
public void addSlotListener(ICrafting icrafting) {
|
||||
if (this.listeners.contains(icrafting)) {
|
||||
throw new IllegalArgumentException("Listener already listening");
|
||||
} else {
|
||||
@ -91,7 +92,7 @@ public abstract class Container {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Slot b(int i) {
|
||||
public Slot getSlot(int i) {
|
||||
return (Slot) this.e.get(i);
|
||||
}
|
||||
|
||||
@ -101,7 +102,7 @@ public abstract class Container {
|
||||
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;
|
||||
|
||||
if (j > 1) {
|
||||
@ -111,16 +112,16 @@ public abstract class Container {
|
||||
PlayerInventory playerinventory = entityhuman.inventory;
|
||||
|
||||
if (i == -999) {
|
||||
if (playerinventory.l() != null && i == -999) {
|
||||
if (playerinventory.getCarried() != null && i == -999) {
|
||||
if (j == 0) {
|
||||
entityhuman.b(playerinventory.l());
|
||||
playerinventory.b((ItemStack) null);
|
||||
entityhuman.drop(playerinventory.getCarried());
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
}
|
||||
|
||||
if (j == 1) {
|
||||
entityhuman.b(playerinventory.l().a(1));
|
||||
if (playerinventory.l().count == 0) {
|
||||
playerinventory.b((ItemStack) null);
|
||||
entityhuman.drop(playerinventory.getCarried().a(1));
|
||||
if (playerinventory.getCarried().count == 0) {
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -147,7 +148,7 @@ public abstract class Container {
|
||||
if (slot1 != null) {
|
||||
slot1.d();
|
||||
ItemStack itemstack2 = slot1.getItem();
|
||||
ItemStack itemstack3 = playerinventory.l();
|
||||
ItemStack itemstack3 = playerinventory.getCarried();
|
||||
|
||||
if (itemstack2 != null) {
|
||||
itemstack = itemstack2.cloneItemStack();
|
||||
@ -162,21 +163,21 @@ public abstract class Container {
|
||||
l = slot1.a();
|
||||
}
|
||||
|
||||
slot1.c(itemstack3.a(l));
|
||||
slot1.set(itemstack3.a(l));
|
||||
if (itemstack3.count == 0) {
|
||||
playerinventory.b((ItemStack) null);
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
}
|
||||
}
|
||||
} else if (itemstack3 == null) {
|
||||
l = j == 0 ? itemstack2.count : (itemstack2.count + 1) / 2;
|
||||
ItemStack itemstack4 = slot1.a(l);
|
||||
|
||||
playerinventory.b(itemstack4);
|
||||
playerinventory.setCarried(itemstack4);
|
||||
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)) {
|
||||
if (itemstack2.id == itemstack3.id && (!itemstack2.usesData() || itemstack2.getData() == itemstack3.getData()) && ItemStack.equals(itemstack2, itemstack3)) {
|
||||
l = j == 0 ? itemstack3.count : 1;
|
||||
@ -190,13 +191,13 @@ public abstract class Container {
|
||||
|
||||
itemstack3.a(l);
|
||||
if (itemstack3.count == 0) {
|
||||
playerinventory.b((ItemStack) null);
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
}
|
||||
|
||||
itemstack2.count += l;
|
||||
} else if (itemstack3.count <= slot1.a()) {
|
||||
slot1.c(itemstack3);
|
||||
playerinventory.b(itemstack2);
|
||||
slot1.set(itemstack3);
|
||||
playerinventory.setCarried(itemstack2);
|
||||
}
|
||||
} else if (itemstack2.id == itemstack3.id && itemstack3.getMaxStackSize() > 1 && (!itemstack2.usesData() || itemstack2.getData() == itemstack3.getData()) && ItemStack.equals(itemstack2, itemstack3)) {
|
||||
l = itemstack2.count;
|
||||
@ -204,10 +205,10 @@ public abstract class Container {
|
||||
itemstack3.count += l;
|
||||
itemstack2.a(l);
|
||||
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) {
|
||||
this.a(i, j, flag, entityhuman);
|
||||
this.clickItem(i, j, flag, entityhuman);
|
||||
}
|
||||
|
||||
public void a(EntityHuman entityhuman) {
|
||||
PlayerInventory playerinventory = entityhuman.inventory;
|
||||
|
||||
if (playerinventory.l() != null) {
|
||||
entityhuman.b(playerinventory.l());
|
||||
playerinventory.b((ItemStack) null);
|
||||
if (playerinventory.getCarried() != null) {
|
||||
entityhuman.drop(playerinventory.getCarried());
|
||||
playerinventory.setCarried((ItemStack) null);
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,8 +236,8 @@ public abstract class Container {
|
||||
this.a();
|
||||
}
|
||||
|
||||
public void a(int i, ItemStack itemstack) {
|
||||
this.b(i).c(itemstack);
|
||||
public void setItem(int i, ItemStack itemstack) {
|
||||
this.getSlot(i).set(itemstack);
|
||||
}
|
||||
|
||||
public boolean c(EntityHuman entityhuman) {
|
||||
@ -303,7 +304,7 @@ public abstract class Container {
|
||||
slot = (Slot) this.e.get(k);
|
||||
itemstack1 = slot.getItem();
|
||||
if (itemstack1 == null) {
|
||||
slot.c(itemstack.cloneItemStack());
|
||||
slot.set(itemstack.cloneItemStack());
|
||||
slot.d();
|
||||
itemstack.count = 0;
|
||||
flag1 = true;
|
||||
|
@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
|
||||
public class ContainerBrewingStand extends Container {
|
||||
|
||||
private TileEntityBrewingStand a;
|
||||
private TileEntityBrewingStand brewingStand;
|
||||
private int b = 0;
|
||||
// CraftBukkit start
|
||||
private CraftInventoryView bukkitEntity = null;
|
||||
@ -16,10 +16,10 @@ public class ContainerBrewingStand extends Container {
|
||||
|
||||
public ContainerBrewingStand(PlayerInventory playerinventory, TileEntityBrewingStand tileentitybrewingstand) {
|
||||
player = playerinventory; // CraftBukkit
|
||||
this.a = tileentitybrewingstand;
|
||||
this.a(new SlotPotionBottle(this, playerinventory.d, tileentitybrewingstand, 0, 56, 46));
|
||||
this.a(new SlotPotionBottle(this, playerinventory.d, tileentitybrewingstand, 1, 79, 53));
|
||||
this.a(new SlotPotionBottle(this, playerinventory.d, tileentitybrewingstand, 2, 102, 46));
|
||||
this.brewingStand = tileentitybrewingstand;
|
||||
this.a(new SlotPotionBottle(this, playerinventory.player, tileentitybrewingstand, 0, 56, 46));
|
||||
this.a(new SlotPotionBottle(this, playerinventory.player, tileentitybrewingstand, 1, 79, 53));
|
||||
this.a(new SlotPotionBottle(this, playerinventory.player, tileentitybrewingstand, 2, 102, 46));
|
||||
this.a(new SlotBrewing(this, tileentitybrewingstand, 3, 79, 17));
|
||||
|
||||
int i;
|
||||
@ -35,9 +35,9 @@ public class ContainerBrewingStand extends Container {
|
||||
}
|
||||
}
|
||||
|
||||
public void a(ICrafting icrafting) {
|
||||
super.a(icrafting);
|
||||
icrafting.a(this, 0, this.a.h());
|
||||
public void addSlotListener(ICrafting icrafting) {
|
||||
super.addSlotListener(icrafting);
|
||||
icrafting.setContainerData(this, 0, this.brewingStand.h());
|
||||
}
|
||||
|
||||
public void a() {
|
||||
@ -46,17 +46,17 @@ public class ContainerBrewingStand extends Container {
|
||||
for (int i = 0; i < this.listeners.size(); ++i) {
|
||||
ICrafting icrafting = (ICrafting) this.listeners.get(i);
|
||||
|
||||
if (this.b != this.a.h()) {
|
||||
icrafting.a(this, 0, this.a.h());
|
||||
if (this.b != this.brewingStand.h()) {
|
||||
icrafting.setContainerData(this, 0, this.brewingStand.h());
|
||||
}
|
||||
}
|
||||
|
||||
this.b = this.a.h();
|
||||
this.b = this.brewingStand.h();
|
||||
}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
if (!this.checkReachable) return true; // CraftBukkit
|
||||
return this.a.a(entityhuman);
|
||||
return this.brewingStand.a(entityhuman);
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
@ -84,7 +84,7 @@ public class ContainerBrewingStand extends Container {
|
||||
}
|
||||
|
||||
if (itemstack1.count == 0) {
|
||||
slot.c((ItemStack) null);
|
||||
slot.set((ItemStack) null);
|
||||
} else {
|
||||
slot.d();
|
||||
}
|
||||
@ -104,8 +104,8 @@ public class ContainerBrewingStand extends Container {
|
||||
if (bukkitEntity != null) {
|
||||
return bukkitEntity;
|
||||
}
|
||||
CraftInventory inventory = new CraftInventory(this.a);
|
||||
bukkitEntity = new CraftInventoryView(this.player.d.getBukkitEntity(), inventory, this);
|
||||
CraftInventory inventory = new CraftInventory(this.brewingStand);
|
||||
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
|
||||
return bukkitEntity;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -9,15 +9,31 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
|
||||
public class ContainerChest extends Container {
|
||||
|
||||
public IInventory a; // CraftBukkit - private->public
|
||||
public IInventory container; // CraftBukkit - private->public
|
||||
private int b;
|
||||
// CraftBukkit start
|
||||
private CraftInventoryView bukkitEntity = null;
|
||||
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
|
||||
|
||||
public ContainerChest(IInventory iinventory, IInventory iinventory1) {
|
||||
this.a = iinventory1;
|
||||
this.container = iinventory1;
|
||||
this.b = iinventory1.getSize() / 9;
|
||||
iinventory1.f();
|
||||
int i = (this.b - 4) * 18;
|
||||
@ -48,7 +64,7 @@ public class ContainerChest extends Container {
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
if (!this.checkReachable) return true; // CraftBukkit
|
||||
return this.a.a(entityhuman);
|
||||
return this.container.a(entityhuman);
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
@ -68,7 +84,7 @@ public class ContainerChest extends Container {
|
||||
}
|
||||
|
||||
if (itemstack1.count == 0) {
|
||||
slot.c((ItemStack) null);
|
||||
slot.set((ItemStack) null);
|
||||
} else {
|
||||
slot.d();
|
||||
}
|
||||
@ -77,26 +93,8 @@ public class ContainerChest extends Container {
|
||||
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) {
|
||||
super.a(entityhuman);
|
||||
this.a.g();
|
||||
this.container.g();
|
||||
}
|
||||
}
|
||||
|
@ -7,14 +7,14 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
|
||||
public class ContainerDispenser extends Container {
|
||||
|
||||
public TileEntityDispenser a; // CraftBukkit - Private -> Public
|
||||
public TileEntityDispenser items; // CraftBukkit - Private -> Public
|
||||
// CraftBukkit start
|
||||
private CraftInventoryView bukkitEntity = null;
|
||||
private PlayerInventory player;
|
||||
// CraftBukkit end
|
||||
|
||||
public ContainerDispenser(IInventory iinventory, TileEntityDispenser tileentitydispenser) {
|
||||
this.a = tileentitydispenser;
|
||||
this.items = tileentitydispenser;
|
||||
// CraftBukkit start - save player
|
||||
// TODO: Should we check to make sure it really is an InventoryPlayer?
|
||||
this.player = (PlayerInventory)iinventory;
|
||||
@ -42,7 +42,7 @@ public class ContainerDispenser extends Container {
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
if (!this.checkReachable) return true; // CraftBukkit
|
||||
return this.a.a(entityhuman);
|
||||
return this.items.a(entityhuman);
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
@ -62,7 +62,7 @@ public class ContainerDispenser extends Container {
|
||||
}
|
||||
|
||||
if (itemstack1.count == 0) {
|
||||
slot.c((ItemStack) null);
|
||||
slot.set((ItemStack) null);
|
||||
} else {
|
||||
slot.d();
|
||||
}
|
||||
@ -82,8 +82,8 @@ public class ContainerDispenser extends Container {
|
||||
if (bukkitEntity != null) {
|
||||
return bukkitEntity;
|
||||
}
|
||||
CraftInventory inventory = new CraftInventory(this.a);
|
||||
bukkitEntity = new CraftInventoryView(this.player.d.getBukkitEntity(), inventory, this);
|
||||
CraftInventory inventory = new CraftInventory(this.items);
|
||||
bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this);
|
||||
return bukkitEntity;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -19,26 +19,26 @@ import org.bukkit.entity.Player;
|
||||
public class ContainerEnchantTable extends Container {
|
||||
|
||||
// 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
|
||||
private World h;
|
||||
private int i;
|
||||
private int j;
|
||||
private int k;
|
||||
private World world;
|
||||
private int x;
|
||||
private int y;
|
||||
private int z;
|
||||
private Random l = new Random();
|
||||
public long b;
|
||||
public int[] c = new int[3];
|
||||
public int[] costs = new int[3];
|
||||
// CraftBukkit start
|
||||
private CraftInventoryView bukkitEntity = null;
|
||||
private Player player;
|
||||
// CraftBukkit end
|
||||
|
||||
public ContainerEnchantTable(PlayerInventory playerinventory, World world, int i, int j, int k) {
|
||||
this.h = world;
|
||||
this.i = i;
|
||||
this.j = j;
|
||||
this.k = k;
|
||||
this.a((Slot) (new SlotEnchant(this, this.a, 0, 25, 47)));
|
||||
this.world = world;
|
||||
this.x = i;
|
||||
this.y = j;
|
||||
this.z = k;
|
||||
this.a((Slot) (new SlotEnchant(this, this.enchantSlots, 0, 25, 47)));
|
||||
|
||||
int l;
|
||||
|
||||
@ -51,14 +51,14 @@ public class ContainerEnchantTable extends Container {
|
||||
for (l = 0; l < 9; ++l) {
|
||||
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) {
|
||||
super.a(icrafting);
|
||||
icrafting.a(this, 0, this.c[0]);
|
||||
icrafting.a(this, 1, this.c[1]);
|
||||
icrafting.a(this, 2, this.c[2]);
|
||||
public void addSlotListener(ICrafting icrafting) {
|
||||
super.addSlotListener(icrafting);
|
||||
icrafting.setContainerData(this, 0, this.costs[0]);
|
||||
icrafting.setContainerData(this, 1, this.costs[1]);
|
||||
icrafting.setContainerData(this, 2, this.costs[2]);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
@ -67,49 +67,49 @@ public class ContainerEnchantTable extends Container {
|
||||
for (int i = 0; i < this.listeners.size(); ++i) {
|
||||
ICrafting icrafting = (ICrafting) this.listeners.get(i);
|
||||
|
||||
icrafting.a(this, 0, this.c[0]);
|
||||
icrafting.a(this, 1, this.c[1]);
|
||||
icrafting.a(this, 2, this.c[2]);
|
||||
icrafting.setContainerData(this, 0, this.costs[0]);
|
||||
icrafting.setContainerData(this, 1, this.costs[1]);
|
||||
icrafting.setContainerData(this, 2, this.costs[2]);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(IInventory iinventory) {
|
||||
if (iinventory == this.a) {
|
||||
if (iinventory == this.enchantSlots) {
|
||||
ItemStack itemstack = iinventory.getItem(0);
|
||||
int i;
|
||||
|
||||
if (itemstack != null && itemstack.q()) {
|
||||
this.b = this.l.nextLong();
|
||||
if (!this.h.isStatic) {
|
||||
if (!this.world.isStatic) {
|
||||
i = 0;
|
||||
|
||||
int j;
|
||||
|
||||
for (j = -1; j <= 1; ++j) {
|
||||
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 (this.h.getTypeId(this.i + k * 2, this.j, this.k + j * 2) == Block.BOOKSHELF.id) {
|
||||
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.world.getTypeId(this.x + k * 2, this.y, this.z + j * 2) == Block.BOOKSHELF.id) {
|
||||
++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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -118,16 +118,17 @@ public class ContainerEnchantTable extends Container {
|
||||
}
|
||||
|
||||
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
|
||||
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);
|
||||
h.getServer().getPluginManager().callEvent(event);
|
||||
PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(player, this.getBukkitView(), this.world.getWorld().getBlockAt(this.x, this.y, this.z), item, this.costs, i);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
for (i = 0; i < 3; ++i) {
|
||||
this.c[i] = 0;
|
||||
this.costs[i] = 0;
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -136,28 +137,29 @@ public class ContainerEnchantTable extends Container {
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < 3; ++i) {
|
||||
this.c[i] = 0;
|
||||
this.costs[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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.h.isStatic) {
|
||||
List list = EnchantmentManager.a(this.l, itemstack, this.c[i]);
|
||||
if (this.costs[i] > 0 && itemstack != null && entityhuman.expLevel >= this.costs[i]) {
|
||||
if (!this.world.isStatic) {
|
||||
List list = EnchantmentManager.a(this.l, itemstack, this.costs[i]);
|
||||
|
||||
// CraftBukkit start
|
||||
Map<org.bukkit.enchantments.Enchantment, Integer> enchants = new HashMap<org.bukkit.enchantments.Enchantment, Integer>();
|
||||
for (Object o : list) {
|
||||
EnchantmentInstance e = (EnchantmentInstance) o;
|
||||
enchants.put(org.bukkit.enchantments.Enchantment.getById(e.a.id), e.b);
|
||||
for (Object obj : list) {
|
||||
EnchantmentInstance instance = (EnchantmentInstance) obj;
|
||||
enchants.put(org.bukkit.enchantments.Enchantment.getById(instance.enchantment.id), instance.level);
|
||||
}
|
||||
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();
|
||||
if (event.isCancelled() || (level > entityhuman.expLevel)) {
|
||||
@ -165,16 +167,16 @@ public class ContainerEnchantTable extends Container {
|
||||
}
|
||||
if (enchants.isEmpty() == false) {
|
||||
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 {
|
||||
item.addEnchantment(ent.getKey(), ent.getValue());
|
||||
} catch (IllegalArgumentException iax) {
|
||||
item.addEnchantment(entry.getKey(), entry.getValue());
|
||||
} catch (IllegalArgumentException e) {
|
||||
/* 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) {
|
||||
super.a(entityhuman);
|
||||
if (!this.h.isStatic) {
|
||||
ItemStack itemstack = this.a.getItem(0);
|
||||
if (!this.world.isStatic) {
|
||||
ItemStack itemstack = this.enchantSlots.getItem(0);
|
||||
|
||||
if (itemstack != null) {
|
||||
entityhuman.b(itemstack);
|
||||
entityhuman.drop(itemstack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
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) {
|
||||
@ -217,7 +219,7 @@ public class ContainerEnchantTable extends Container {
|
||||
}
|
||||
|
||||
if (itemstack1.count == 0) {
|
||||
slot.c((ItemStack) null);
|
||||
slot.set((ItemStack) null);
|
||||
} else {
|
||||
slot.d();
|
||||
}
|
||||
@ -237,7 +239,7 @@ public class ContainerEnchantTable extends Container {
|
||||
if (bukkitEntity != null) {
|
||||
return bukkitEntity;
|
||||
}
|
||||
CraftInventoryEnchanting inventory = new CraftInventoryEnchanting(this.a);
|
||||
CraftInventoryEnchanting inventory = new CraftInventoryEnchanting(this.enchantSlots);
|
||||
bukkitEntity = new CraftInventoryView(this.player, inventory, this);
|
||||
return bukkitEntity;
|
||||
}
|
||||
|
@ -2,11 +2,11 @@ package net.minecraft.server;
|
||||
|
||||
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) {
|
||||
super(s, i);
|
||||
this.a = containerenchanttable;
|
||||
this.enchantTable = containerenchanttable;
|
||||
}
|
||||
|
||||
public int getMaxStackSize() {
|
||||
@ -15,6 +15,6 @@ public class ContainerEnchantTableInventory extends ContainerEnchantTableSubcont
|
||||
|
||||
public void update() {
|
||||
super.update();
|
||||
this.a.a((IInventory) this);
|
||||
this.enchantTable.a((IInventory) this);
|
||||
}
|
||||
}
|
||||
|
@ -10,16 +10,17 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
// CraftBukkit end
|
||||
|
||||
public class ContainerEnchantTableSubcontainer implements IInventory {
|
||||
|
||||
private String a;
|
||||
private int b;
|
||||
private ItemStack[] c;
|
||||
private ItemStack[] items;
|
||||
private List d;
|
||||
|
||||
// CraftBukkit start
|
||||
public List<HumanEntity> transaction = new ArrayList<HumanEntity>();
|
||||
|
||||
public ItemStack[] getContents() {
|
||||
return this.c;
|
||||
return this.items;
|
||||
}
|
||||
|
||||
public void onOpen(CraftHumanEntity who) {
|
||||
@ -42,26 +43,26 @@ public class ContainerEnchantTableSubcontainer implements IInventory {
|
||||
public ContainerEnchantTableSubcontainer(String s, int i) {
|
||||
this.a = s;
|
||||
this.b = i;
|
||||
this.c = new ItemStack[i];
|
||||
this.items = new ItemStack[i];
|
||||
}
|
||||
|
||||
public ItemStack getItem(int i) {
|
||||
return this.c[i];
|
||||
return this.items[i];
|
||||
}
|
||||
|
||||
public ItemStack splitStack(int i, int j) {
|
||||
if (this.c[i] != null) {
|
||||
if (this.items[i] != null) {
|
||||
ItemStack itemstack;
|
||||
|
||||
if (this.c[i].count <= j) {
|
||||
itemstack = this.c[i];
|
||||
this.c[i] = null;
|
||||
if (this.items[i].count <= j) {
|
||||
itemstack = this.items[i];
|
||||
this.items[i] = null;
|
||||
this.update();
|
||||
return itemstack;
|
||||
} else {
|
||||
itemstack = this.c[i].a(j);
|
||||
if (this.c[i].count == 0) {
|
||||
this.c[i] = null;
|
||||
itemstack = this.items[i].a(j);
|
||||
if (this.items[i].count == 0) {
|
||||
this.items[i] = null;
|
||||
}
|
||||
|
||||
this.update();
|
||||
@ -73,7 +74,7 @@ public class ContainerEnchantTableSubcontainer implements IInventory {
|
||||
}
|
||||
|
||||
public void setItem(int i, ItemStack itemstack) {
|
||||
this.c[i] = itemstack;
|
||||
this.items[i] = itemstack;
|
||||
if (itemstack != null && itemstack.count > this.getMaxStackSize()) {
|
||||
itemstack.count = this.getMaxStackSize();
|
||||
}
|
||||
|
@ -7,20 +7,30 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView;
|
||||
|
||||
public class ContainerFurnace extends Container {
|
||||
|
||||
public TileEntityFurnace a; // CraftBukkit - Private -> Public
|
||||
public TileEntityFurnace furnace; // CraftBukkit - Private -> Public
|
||||
private int b = 0;
|
||||
private int c = 0;
|
||||
private int h = 0;
|
||||
// CraftBukkit start
|
||||
private CraftInventoryView bukkitEntity = null;
|
||||
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
|
||||
|
||||
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, 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
|
||||
|
||||
int i;
|
||||
@ -36,11 +46,11 @@ public class ContainerFurnace extends Container {
|
||||
}
|
||||
}
|
||||
|
||||
public void a(ICrafting icrafting) {
|
||||
super.a(icrafting);
|
||||
icrafting.a(this, 0, this.a.cookTime);
|
||||
icrafting.a(this, 1, this.a.burnTime);
|
||||
icrafting.a(this, 2, this.a.ticksForCurrentFuel);
|
||||
public void addSlotListener(ICrafting icrafting) {
|
||||
super.addSlotListener(icrafting);
|
||||
icrafting.setContainerData(this, 0, this.furnace.cookTime);
|
||||
icrafting.setContainerData(this, 1, this.furnace.burnTime);
|
||||
icrafting.setContainerData(this, 2, this.furnace.ticksForCurrentFuel);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
@ -49,27 +59,27 @@ public class ContainerFurnace extends Container {
|
||||
for (int i = 0; i < this.listeners.size(); ++i) {
|
||||
ICrafting icrafting = (ICrafting) this.listeners.get(i);
|
||||
|
||||
if (this.b != this.a.cookTime) {
|
||||
icrafting.a(this, 0, this.a.cookTime);
|
||||
if (this.b != this.furnace.cookTime) {
|
||||
icrafting.setContainerData(this, 0, this.furnace.cookTime);
|
||||
}
|
||||
|
||||
if (this.c != this.a.burnTime) {
|
||||
icrafting.a(this, 1, this.a.burnTime);
|
||||
if (this.c != this.furnace.burnTime) {
|
||||
icrafting.setContainerData(this, 1, this.furnace.burnTime);
|
||||
}
|
||||
|
||||
if (this.h != this.a.ticksForCurrentFuel) {
|
||||
icrafting.a(this, 2, this.a.ticksForCurrentFuel);
|
||||
if (this.h != this.furnace.ticksForCurrentFuel) {
|
||||
icrafting.setContainerData(this, 2, this.furnace.ticksForCurrentFuel);
|
||||
}
|
||||
}
|
||||
|
||||
this.b = this.a.cookTime;
|
||||
this.c = this.a.burnTime;
|
||||
this.h = this.a.ticksForCurrentFuel;
|
||||
this.b = this.furnace.cookTime;
|
||||
this.c = this.furnace.burnTime;
|
||||
this.h = this.furnace.ticksForCurrentFuel;
|
||||
}
|
||||
|
||||
public boolean b(EntityHuman entityhuman) {
|
||||
if (!this.checkReachable) return true; // CraftBukkit
|
||||
return this.a.a(entityhuman);
|
||||
return this.furnace.a(entityhuman);
|
||||
}
|
||||
|
||||
public ItemStack a(int i) {
|
||||
@ -97,7 +107,7 @@ public class ContainerFurnace extends Container {
|
||||
}
|
||||
|
||||
if (itemstack1.count == 0) {
|
||||
slot.c((ItemStack) null);
|
||||
slot.set((ItemStack) null);
|
||||
} else {
|
||||
slot.d();
|
||||
}
|
||||
@ -111,15 +121,4 @@ public class ContainerFurnace extends Container {
|
||||
|
||||
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
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class ContainerPlayer extends Container {
|
||||
this.player = playerinventory; // CraftBukkit - save player
|
||||
this.c = false;
|
||||
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 j;
|
||||
@ -75,7 +75,7 @@ public class ContainerPlayer extends Container {
|
||||
ItemStack itemstack = this.craftInventory.getItem(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
entityhuman.b(itemstack);
|
||||
entityhuman.drop(itemstack);
|
||||
this.craftInventory.setItem(i, (ItemStack) null);
|
||||
}
|
||||
}
|
||||
@ -110,7 +110,7 @@ public class ContainerPlayer extends Container {
|
||||
}
|
||||
|
||||
if (itemstack1.count == 0) {
|
||||
slot.c((ItemStack) null);
|
||||
slot.set((ItemStack) null);
|
||||
} else {
|
||||
slot.d();
|
||||
}
|
||||
@ -131,7 +131,7 @@ public class ContainerPlayer extends Container {
|
||||
return bukkitEntity;
|
||||
}
|
||||
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;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -29,7 +29,7 @@ public class ContainerWorkbench extends Container {
|
||||
this.h = i;
|
||||
this.i = j;
|
||||
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 i1;
|
||||
@ -74,7 +74,7 @@ public class ContainerWorkbench extends Container {
|
||||
ItemStack itemstack = this.craftInventory.getItem(i);
|
||||
|
||||
if (itemstack != null) {
|
||||
entityhuman.b(itemstack);
|
||||
entityhuman.drop(itemstack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -110,7 +110,7 @@ public class ContainerWorkbench extends Container {
|
||||
}
|
||||
|
||||
if (itemstack1.count == 0) {
|
||||
slot.c((ItemStack) null);
|
||||
slot.set((ItemStack) null);
|
||||
} else {
|
||||
slot.d();
|
||||
}
|
||||
@ -131,7 +131,7 @@ public class ContainerWorkbench extends Container {
|
||||
return bukkitEntity;
|
||||
}
|
||||
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;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.inventory.InventoryView;
|
||||
public class 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
|
||||
public CraftingRecipe lastRecipe;
|
||||
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});
|
||||
//Collections.sort(this.b, new RecipeSorter(this)); // CraftBukkit - removed; see below
|
||||
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
|
||||
public void sort() {
|
||||
Collections.sort(this.b, new RecipeSorter(this));
|
||||
Collections.sort(this.recipies, new RecipeSorter(this));
|
||||
}
|
||||
// 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
|
||||
@ -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) {
|
||||
@ -237,8 +237,8 @@ public class CraftingManager {
|
||||
return result;
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
for (j = 0; j < this.b.size(); ++j) {
|
||||
CraftingRecipe craftingrecipe = (CraftingRecipe) this.b.get(j);
|
||||
for (j = 0; j < this.recipies.size(); ++j) {
|
||||
CraftingRecipe craftingrecipe = (CraftingRecipe) this.recipies.get(j);
|
||||
|
||||
if (craftingrecipe.a(inventorycrafting)) {
|
||||
// CraftBukkit start - INVENTORY_PRE_CRAFT event
|
||||
@ -254,7 +254,7 @@ public class CraftingManager {
|
||||
}
|
||||
}
|
||||
|
||||
public List b() {
|
||||
return this.b;
|
||||
public List getRecipies() {
|
||||
return this.recipies;
|
||||
}
|
||||
}
|
||||
|
@ -358,9 +358,9 @@ public abstract class Entity {
|
||||
|
||||
public boolean d(double d0, double d1, double 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) {
|
||||
@ -394,7 +394,7 @@ public abstract class Entity {
|
||||
if (flag) {
|
||||
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) {
|
||||
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) {
|
||||
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) {
|
||||
d1 = ((AxisAlignedBB) list.get(i)).b(this.boundingBox, d1);
|
||||
@ -469,7 +469,7 @@ public abstract class Entity {
|
||||
AxisAlignedBB axisalignedbb1 = this.boundingBox.clone();
|
||||
|
||||
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) {
|
||||
d1 = ((AxisAlignedBB) list.get(k)).b(this.boundingBox, d1);
|
||||
@ -736,7 +736,7 @@ public abstract class Entity {
|
||||
}
|
||||
|
||||
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 j = MathHelper.d((float) MathHelper.floor(d0));
|
||||
int k = MathHelper.floor(this.locZ);
|
||||
@ -752,7 +752,7 @@ public abstract class Entity {
|
||||
}
|
||||
}
|
||||
|
||||
public float y() {
|
||||
public float getHeadHeight() {
|
||||
return 0.0F;
|
||||
}
|
||||
|
||||
@ -1110,7 +1110,7 @@ public abstract class Entity {
|
||||
float f1 = ((float) ((i >> 1) % 2) - 0.5F) * 0.1F;
|
||||
float f2 = ((float) ((i >> 2) % 2) - 0.5F) * this.width * 0.8F;
|
||||
int j = MathHelper.floor(this.locX + (double) f);
|
||||
int k = MathHelper.floor(this.locY + (double) this.y() + (double) f1);
|
||||
int k = MathHelper.floor(this.locY + (double) this.getHeadHeight() + (double) f1);
|
||||
int l = MathHelper.floor(this.locZ + (double) f2);
|
||||
|
||||
if (this.world.e(j, k, l)) {
|
||||
@ -1461,7 +1461,7 @@ public abstract class Entity {
|
||||
s = "generic";
|
||||
}
|
||||
|
||||
return LocaleI18n.a("entity." + s + ".name");
|
||||
return LocaleI18n.get("entity." + s + ".name");
|
||||
}
|
||||
|
||||
public Entity[] aR() {
|
||||
|
@ -44,7 +44,7 @@ public class EntityArrow extends Entity {
|
||||
this.shooter = entityliving;
|
||||
this.fromPlayer = entityliving instanceof EntityHuman;
|
||||
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.locY -= 0.10000000149011612D;
|
||||
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);
|
||||
vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
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;
|
||||
@ -149,7 +149,7 @@ public class EntityArrow extends Entity {
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1);
|
||||
|
||||
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) {
|
||||
entity = entity1;
|
||||
@ -226,9 +226,9 @@ public class EntityArrow extends Entity {
|
||||
this.g = movingobjectposition.d;
|
||||
this.h = this.world.getTypeId(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.motY = (double) ((float) (movingobjectposition.f.b - this.locY));
|
||||
this.motZ = (double) ((float) (movingobjectposition.f.c - this.locZ));
|
||||
this.motX = (double) ((float) (movingobjectposition.pos.a - this.locX));
|
||||
this.motY = (double) ((float) (movingobjectposition.pos.b - this.locY));
|
||||
this.motZ = (double) ((float) (movingobjectposition.pos.c - this.locZ));
|
||||
f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
|
||||
this.locX -= this.motX / (double) f2 * 0.05000000074505806D;
|
||||
this.locY -= this.motY / (double) f2 * 0.05000000074505806D;
|
||||
|
@ -62,7 +62,7 @@ public class EntityBlaze extends EntityMonster {
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class EntityComplex extends EntityLiving {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class EntityEnderCrystal extends Entity {
|
||||
if (this.b <= 0) {
|
||||
if (!this.world.isStatic) {
|
||||
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 {
|
||||
this.die();
|
||||
}
|
||||
|
@ -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.u = null;
|
||||
if (damagesource.getEntity() instanceof EntityHuman || damagesource == DamageSource.EXPLOSION) {
|
||||
this.e(damagesource, i);
|
||||
this.dealDamage(damagesource, i);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -74,7 +74,7 @@ public class EntityEnderman extends EntityMonster {
|
||||
return false;
|
||||
} else {
|
||||
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();
|
||||
|
||||
vec3d1 = vec3d1.b();
|
||||
@ -187,7 +187,7 @@ public class EntityEnderman extends EntityMonster {
|
||||
}
|
||||
|
||||
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();
|
||||
double d0 = 16.0D;
|
||||
@ -229,16 +229,17 @@ public class EntityEnderman extends EntityMonster {
|
||||
// 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));
|
||||
this.world.getServer().getPluginManager().callEvent(teleport);
|
||||
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 {
|
||||
if (teleport.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Location to = teleport.getTo();
|
||||
this.setPosition(to.getX(), to.getY(), to.getZ());
|
||||
// CraftBukkit end
|
||||
|
||||
if (this.world.getCubes(this, this.boundingBox).size() == 0 && !this.world.containsLiquid(this.boundingBox)) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class EntityExperienceOrb extends Entity {
|
||||
|
||||
if (!event.isCancelled() && target != null) {
|
||||
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 d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
|
||||
double d5 = 1.0D - d4;
|
||||
|
@ -94,7 +94,7 @@ public class EntityFireball extends Entity {
|
||||
vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
|
||||
vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
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;
|
||||
@ -110,7 +110,7 @@ public class EntityFireball extends Entity {
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
|
||||
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) {
|
||||
entity = entity1;
|
||||
|
@ -151,7 +151,7 @@ public class EntityFishingHook extends Entity {
|
||||
vec3d = Vec3D.create(this.locX, this.locY, this.locZ);
|
||||
vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
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;
|
||||
@ -169,7 +169,7 @@ public class EntityFishingHook extends Entity {
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
|
||||
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) {
|
||||
entity = entity1;
|
||||
d4 = d5;
|
||||
|
@ -174,7 +174,7 @@ public class EntityGhast extends EntityFlying implements IMonster {
|
||||
|
||||
for (int i = 1; (double) i < d3; ++i) {
|
||||
axisalignedbb.d(d4, d5, d6);
|
||||
if (this.world.a((Entity) this, axisalignedbb).size() > 0) {
|
||||
if (this.world.getCubes(this, axisalignedbb).size() > 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -46,13 +46,17 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
public boolean sleeping;
|
||||
public boolean fauxSleeping;
|
||||
public String spawnWorld = "";
|
||||
|
||||
public HumanEntity getBukkitEntity() {
|
||||
return (HumanEntity) super.getBukkitEntity();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public ChunkCoordinates F;
|
||||
public int sleepTicks; // CraftBukkit - private -> public
|
||||
public float G;
|
||||
public float H;
|
||||
private ChunkCoordinates server;
|
||||
private ChunkCoordinates b;
|
||||
private ChunkCoordinates c;
|
||||
public int I = 20;
|
||||
protected boolean J = false;
|
||||
@ -233,7 +237,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
|
||||
vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
|
||||
vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.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);
|
||||
}
|
||||
|
||||
@ -395,13 +399,13 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, 1), false);
|
||||
}
|
||||
|
||||
public void b(ItemStack itemstack) {
|
||||
public void drop(ItemStack itemstack) {
|
||||
this.a(itemstack, false);
|
||||
}
|
||||
|
||||
public void a(ItemStack itemstack, boolean flag) {
|
||||
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;
|
||||
float f = 0.1F;
|
||||
@ -505,7 +509,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
// CraftBukkit end
|
||||
|
||||
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);
|
||||
@ -521,10 +525,10 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
nbttagcompound.setFloat("XpP", this.exp);
|
||||
nbttagcompound.setInt("XpLevel", this.expLevel);
|
||||
nbttagcompound.setInt("XpTotal", this.expTotal);
|
||||
if (this.server != null) {
|
||||
nbttagcompound.setInt("SpawnX", this.server.x);
|
||||
nbttagcompound.setInt("SpawnY", this.server.y);
|
||||
nbttagcompound.setInt("SpawnZ", this.server.z);
|
||||
if (this.b != null) {
|
||||
nbttagcompound.setInt("SpawnX", this.b.x);
|
||||
nbttagcompound.setInt("SpawnY", this.b.y);
|
||||
nbttagcompound.setInt("SpawnZ", this.b.z);
|
||||
nbttagcompound.setString("SpawnWorld", spawnWorld); // CraftBukkit - fixes bed spawns for multiworld worlds
|
||||
}
|
||||
|
||||
@ -532,15 +536,15 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
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 float y() {
|
||||
public float getHeadHeight() {
|
||||
return 0.12F;
|
||||
}
|
||||
|
||||
@ -707,13 +711,13 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
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(TileEntityBrewingStand tileentitybrewingstand) {}
|
||||
public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) {}
|
||||
|
||||
public void e(Entity entity) {
|
||||
if (!entity.b(this)) {
|
||||
@ -864,7 +868,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
|
||||
public void d(Entity entity) {}
|
||||
|
||||
public void a(ItemStack itemstack) {}
|
||||
public void carriedChanged(ItemStack itemstack) {}
|
||||
|
||||
public void die() {
|
||||
super.die();
|
||||
@ -1028,7 +1032,7 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
}
|
||||
|
||||
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 ChunkCoordinates getBed() {
|
||||
return this.server;
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public void a(ChunkCoordinates chunkcoordinates) {
|
||||
public void setRespawnPosition(ChunkCoordinates chunkcoordinates) {
|
||||
if (chunkcoordinates != null) {
|
||||
this.server = new ChunkCoordinates(chunkcoordinates);
|
||||
this.b = new ChunkCoordinates(chunkcoordinates);
|
||||
this.spawnWorld = this.world.worldData.name; // CraftBukkit
|
||||
} else {
|
||||
this.server = null;
|
||||
this.b = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1108,10 +1112,10 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
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) {
|
||||
int i;
|
||||
|
||||
@ -1285,10 +1289,4 @@ public abstract class EntityHuman extends EntityLiving {
|
||||
this.exp = entityhuman.exp;
|
||||
this.q = entityhuman.q;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public HumanEntity getBukkitEntity() {
|
||||
return (HumanEntity) super.getBukkitEntity();
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
@ -120,7 +120,8 @@ public class EntityItem extends Entity {
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setShort("Health", (short) ((byte) this.f));
|
||||
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) {
|
||||
@ -183,7 +184,7 @@ public class EntityItem extends Entity {
|
||||
}
|
||||
|
||||
public String getLocalizedName() {
|
||||
if (this.itemStack == null) return LocaleI18n.a("item.unknown"); // CraftBukkit - nullcheck
|
||||
return LocaleI18n.a("item." + this.itemStack.k());
|
||||
if (this.itemStack == null) return LocaleI18n.get("item.unknown"); // CraftBukkit - nullcheck
|
||||
return LocaleI18n.get("item." + this.itemStack.k());
|
||||
}
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ public abstract class EntityLiving extends 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_() {
|
||||
@ -151,7 +151,7 @@ public abstract class EntityLiving extends Entity {
|
||||
return !this.dead;
|
||||
}
|
||||
|
||||
public float y() {
|
||||
public float getHeadHeight() {
|
||||
return this.length * 0.85F;
|
||||
}
|
||||
|
||||
@ -520,7 +520,7 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
|
||||
if (flag) {
|
||||
this.world.a(this, (byte) 2);
|
||||
this.world.broadcastEntityEffect(this, (byte) 2);
|
||||
this.aM();
|
||||
if (entity != null) {
|
||||
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) {
|
||||
@ -916,7 +916,7 @@ public abstract class EntityLiving extends Entity {
|
||||
--this.aN;
|
||||
this.setPosition(d0, d1, d2);
|
||||
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) {
|
||||
double d4 = 0.0D;
|
||||
@ -1114,9 +1114,9 @@ public abstract class EntityLiving extends Entity {
|
||||
if (entity instanceof EntityLiving) {
|
||||
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 {
|
||||
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);
|
||||
@ -1160,7 +1160,7 @@ public abstract class EntityLiving extends Entity {
|
||||
public void ay() {}
|
||||
|
||||
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() {
|
||||
@ -1356,7 +1356,7 @@ public abstract class EntityLiving extends Entity {
|
||||
|
||||
vec3d1.a(-this.pitch * 3.1415927F / 180.0F);
|
||||
vec3d1.b(-this.yaw * 3.1415927F / 180.0F);
|
||||
vec3d1 = vec3d1.add(this.locX, this.locY + (double) this.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);
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ public class EntityMagmaCube extends EntitySlime {
|
||||
}
|
||||
|
||||
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() {
|
||||
|
@ -176,7 +176,8 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
entityitem.motX = (double) ((float) this.random.nextGaussian() * f3);
|
||||
@ -220,7 +221,8 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
entityitem.motX = (double) ((float) this.random.nextGaussian() * f3);
|
||||
@ -702,7 +704,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
this.items[i].b(nbttagcompound1);
|
||||
this.items[i].save(nbttagcompound1);
|
||||
nbttaglist.add(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
@ -877,7 +879,7 @@ public class EntityMinecart extends Entity implements IInventory {
|
||||
}
|
||||
} else if (this.type == 1) {
|
||||
if (!this.world.isStatic) {
|
||||
entityhuman.a((IInventory) this);
|
||||
entityhuman.openContainer(this);
|
||||
}
|
||||
} else if (this.type == 2) {
|
||||
ItemStack itemstack = entityhuman.inventory.getItemInHand();
|
||||
|
@ -138,21 +138,19 @@ public class EntityPainting extends Entity {
|
||||
PaintingBreakEvent event = new PaintingBreakEvent((Painting) this.getBukkitEntity(), cause);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled()) {
|
||||
if (event.isCancelled() || dead) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!dead) {
|
||||
this.die();
|
||||
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
this.die();
|
||||
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean survives() {
|
||||
if (this.world.a(this, this.boundingBox).size() > 0) {
|
||||
if (this.world.getCubes(this, this.boundingBox).size() > 0) {
|
||||
return false;
|
||||
} else {
|
||||
int i = this.art.B / 16;
|
||||
@ -286,14 +284,11 @@ public class EntityPainting extends Entity {
|
||||
}
|
||||
|
||||
public void b_(double d0, double d1, double d2) {
|
||||
// CraftBukkit start - not needed for paintings
|
||||
/* if (!this.world.isStatic && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
|
||||
if (dead) return; // CraftBukkit
|
||||
|
||||
/* CraftBukkit start - not needed for paintings
|
||||
if (!this.world.isStatic && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) {
|
||||
this.die();
|
||||
this.world.addEntity(new EntityItem(this.world, this.locX, this.locY, this.locZ, new ItemStack(Item.PAINTING)));
|
||||
}*/
|
||||
// CraftBukkit end
|
||||
}
|
||||
// CraftBukkit end */
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class EntityPigZombie extends EntityZombie {
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -32,11 +32,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
public int lastSentExp = -99999999; // CraftBukkit - priv to pub
|
||||
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 int cl = 0;
|
||||
private int containerCounter = 0;
|
||||
public boolean h;
|
||||
public int ping;
|
||||
public boolean viewingCredits = false;
|
||||
public int i;
|
||||
|
||||
public EntityPlayer(MinecraftServer minecraftserver, World world, String s, ItemInWorldManager iteminworldmanager) {
|
||||
super(world);
|
||||
@ -121,7 +120,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
}
|
||||
|
||||
public void syncInventory() {
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
this.activeContainer.addSlotListener(this);
|
||||
}
|
||||
|
||||
public ItemStack[] getEquipment() {
|
||||
@ -132,7 +131,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
this.height = 0.0F;
|
||||
}
|
||||
|
||||
public float y() {
|
||||
public float getHeadHeight() {
|
||||
return 1.62F;
|
||||
}
|
||||
|
||||
@ -451,91 +450,91 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
super.a(d0, flag);
|
||||
}
|
||||
|
||||
public int aS() { // CraftBukkit - private void -> public int
|
||||
this.cl = this.cl % 100 + 1;
|
||||
return this.cl; // CraftBukkit
|
||||
public int nextContainerCounter() { // CraftBukkit - private void -> public int
|
||||
this.containerCounter = this.containerCounter % 100 + 1;
|
||||
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
|
||||
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerWorkbench(this.inventory, this.world, i, j, k));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
|
||||
this.aS();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 1, "Crafting", 9));
|
||||
this.nextContainerCounter();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 1, "Crafting", 9));
|
||||
this.activeContainer = container; // CraftBukkit - Use container we passed to event
|
||||
this.activeContainer.windowId = this.cl;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
this.activeContainer.windowId = this.containerCounter;
|
||||
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
|
||||
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerEnchantTable(this.inventory, this.world, i, j, k));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
|
||||
this.aS();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 4, "Enchanting", 9));
|
||||
this.activeContainer = container;
|
||||
this.activeContainer.windowId = this.cl;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
this.nextContainerCounter();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 4, "Enchanting", 9));
|
||||
this.activeContainer = container; // CraftBukkit - Use container we passed to event
|
||||
this.activeContainer.windowId = this.containerCounter;
|
||||
this.activeContainer.addSlotListener(this);
|
||||
}
|
||||
|
||||
public void a(IInventory iinventory) {
|
||||
public void openContainer(IInventory iinventory) {
|
||||
// CraftBukkit start - INVENTORY_OPEN hook
|
||||
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerChest(this.inventory, iinventory));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
|
||||
this.aS();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 0, iinventory.getName(), iinventory.getSize()));
|
||||
this.nextContainerCounter();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 0, iinventory.getName(), iinventory.getSize()));
|
||||
this.activeContainer = container; // CraftBukkit - Use container passed to event
|
||||
this.activeContainer.windowId = this.cl;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
this.activeContainer.windowId = this.containerCounter;
|
||||
this.activeContainer.addSlotListener(this);
|
||||
}
|
||||
|
||||
public void a(TileEntityFurnace tileentityfurnace) {
|
||||
public void openFurnace(TileEntityFurnace tileentityfurnace) {
|
||||
// CraftBukkit start - INVENTORY_OPEN hook
|
||||
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerFurnace(this.inventory, tileentityfurnace));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
|
||||
this.aS();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
|
||||
this.nextContainerCounter();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 2, tileentityfurnace.getName(), tileentityfurnace.getSize()));
|
||||
this.activeContainer = container; // CraftBukkit - Use container passed to event
|
||||
this.activeContainer.windowId = this.cl;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
this.activeContainer.windowId = this.containerCounter;
|
||||
this.activeContainer.addSlotListener(this);
|
||||
}
|
||||
|
||||
public void a(TileEntityDispenser tileentitydispenser) {
|
||||
public void openDispenser(TileEntityDispenser tileentitydispenser) {
|
||||
// CraftBukkit start - INVENTORY_OPEN hook
|
||||
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerDispenser(this.inventory, tileentitydispenser));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
|
||||
this.aS();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 3, tileentitydispenser.getName(), tileentitydispenser.getSize()));
|
||||
this.nextContainerCounter();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 3, tileentitydispenser.getName(), tileentitydispenser.getSize()));
|
||||
this.activeContainer = container; // CraftBukkit - Use container passed to event
|
||||
this.activeContainer.windowId = this.cl;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
this.activeContainer.windowId = this.containerCounter;
|
||||
this.activeContainer.addSlotListener(this);
|
||||
}
|
||||
|
||||
public void a(TileEntityBrewingStand tileentitybrewingstand) {
|
||||
public void openBrewingStand(TileEntityBrewingStand tileentitybrewingstand) {
|
||||
// CraftBukkit start - INVENTORY_OPEN hook
|
||||
Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerBrewingStand(this.inventory, tileentitybrewingstand));
|
||||
if(container == null) return;
|
||||
// CraftBukkit end
|
||||
|
||||
this.aS();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.cl, 5, tileentitybrewingstand.getName(), tileentitybrewingstand.getSize()));
|
||||
this.activeContainer = container;
|
||||
this.activeContainer.windowId = this.cl;
|
||||
this.activeContainer.a((ICrafting) this);
|
||||
this.nextContainerCounter();
|
||||
this.netServerHandler.sendPacket(new Packet100OpenWindow(this.containerCounter, 5, tileentitybrewingstand.getName(), tileentitybrewingstand.getSize()));
|
||||
this.activeContainer = container; // CraftBukkit - Use container passed to event
|
||||
this.activeContainer.windowId = this.containerCounter;
|
||||
this.activeContainer.addSlotListener(this);
|
||||
}
|
||||
|
||||
public void a(Container container, int i, ItemStack itemstack) {
|
||||
if (!(container.b(i) instanceof SlotResult)) {
|
||||
if (!(container.getSlot(i) instanceof SlotResult)) {
|
||||
if (!this.h) {
|
||||
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) {
|
||||
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
|
||||
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
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
public void a(ItemStack itemstack) {}
|
||||
public void carriedChanged(ItemStack itemstack) {}
|
||||
|
||||
public void closeInventory() {
|
||||
this.netServerHandler.sendPacket(new Packet101CloseWindow(this.activeContainer.windowId));
|
||||
this.E();
|
||||
}
|
||||
|
||||
public void D() {
|
||||
public void broadcastCarriedItem() {
|
||||
if (!this.h) {
|
||||
this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.l()));
|
||||
this.netServerHandler.sendPacket(new Packet103SetSlot(-1, -1, this.inventory.getCarried()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class EntityPotion extends EntityProjectile {
|
||||
return -20.0F;
|
||||
}
|
||||
|
||||
public int f() {
|
||||
public int getPotionValue() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
@ -100,8 +100,9 @@ public class EntityPotion extends EntityProjectile {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (MobEffectList.byId[i].b()) {
|
||||
MobEffectList.byId[i].a(this.shooter, (EntityLiving) entity, mobeffect.getAmplifier(), d1, this); // CraftBukkit - added 'this'
|
||||
if (MobEffectList.byId[i].isInstant()) {
|
||||
// CraftBukkit - added 'this'
|
||||
MobEffectList.byId[i].applyInstantEffect(this.shooter, (EntityLiving) entity, mobeffect.getAmplifier(), d1, this);
|
||||
} else {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public abstract class EntityProjectile extends Entity {
|
||||
super(world);
|
||||
this.shooter = entityliving;
|
||||
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.locY -= 0.10000000149011612D;
|
||||
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);
|
||||
vec3d1 = Vec3D.create(this.locX + this.motX, this.locY + this.motY, this.locZ + this.motZ);
|
||||
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) {
|
||||
@ -137,7 +137,7 @@ public abstract class EntityProjectile extends Entity {
|
||||
MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1);
|
||||
|
||||
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) {
|
||||
entity = entity1;
|
||||
|
@ -69,7 +69,7 @@ public class EntitySheep extends EntityAnimal {
|
||||
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) {
|
||||
this.b = 40;
|
||||
this.world.a(this, (byte) 10);
|
||||
this.world.broadcastEntityEffect(this, (byte) 10);
|
||||
}
|
||||
} else if (this.b == 4) {
|
||||
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) {
|
||||
// CraftBukkit start
|
||||
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);
|
||||
flag = true;
|
||||
}
|
||||
@ -88,7 +88,7 @@ public class EntitySheep extends EntityAnimal {
|
||||
} else if (this.world.getTypeId(i, j - 1, k) == Block.GRASS.id) {
|
||||
// CraftBukkit start
|
||||
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);
|
||||
flag = true;
|
||||
}
|
||||
|
@ -75,10 +75,10 @@ public class EntitySkeleton extends EntityMonster {
|
||||
|
||||
if (this.attackTicks == 0) {
|
||||
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;
|
||||
|
||||
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
|
||||
entityarrow.shoot(d0, d2 + (double) f1, d1, 1.6F, 12.0F);
|
||||
this.attackTicks = 60;
|
||||
|
@ -65,7 +65,7 @@ public class EntitySnowman extends EntityGolem {
|
||||
|
||||
if (this.attackTicks == 0) {
|
||||
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;
|
||||
|
||||
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);
|
||||
// CraftBukkit end
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class EntityTracker {
|
||||
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
|
||||
|
||||
if (entitytrackerentry.tracker != entityplayer) {
|
||||
entitytrackerentry.b(entityplayer);
|
||||
entitytrackerentry.updatePlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
} else if (entity instanceof EntityFishingHook) {
|
||||
@ -141,7 +141,7 @@ public class EntityTracker {
|
||||
EntityTrackerEntry entitytrackerentry1 = (EntityTrackerEntry) iterator1.next();
|
||||
|
||||
if (entitytrackerentry1.tracker != entityplayer) {
|
||||
entitytrackerentry1.b(entityplayer);
|
||||
entitytrackerentry1.updatePlayer(entityplayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -149,7 +149,7 @@ public class EntityTracker {
|
||||
|
||||
// CraftBukkit - synchronized
|
||||
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) {
|
||||
entitytrackerentry.broadcast(packet);
|
||||
@ -158,7 +158,7 @@ public class EntityTracker {
|
||||
|
||||
// CraftBukkit - synchronized
|
||||
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) {
|
||||
entitytrackerentry.broadcastIncludingSelf(packet);
|
||||
@ -172,7 +172,7 @@ public class EntityTracker {
|
||||
while (iterator.hasNext()) {
|
||||
EntityTrackerEntry entitytrackerentry = (EntityTrackerEntry) iterator.next();
|
||||
|
||||
entitytrackerentry.c(entityplayer);
|
||||
entitytrackerentry.clear(entityplayer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,11 +11,11 @@ public class EntityTrackerEntry {
|
||||
public Entity tracker;
|
||||
public int b;
|
||||
public int c;
|
||||
public int d;
|
||||
public int e;
|
||||
public int f;
|
||||
public int g;
|
||||
public int h;
|
||||
public int xLoc;
|
||||
public int yLoc;
|
||||
public int zLoc;
|
||||
public int yRot;
|
||||
public int xRot;
|
||||
public double i;
|
||||
public double j;
|
||||
public double k;
|
||||
@ -34,11 +34,11 @@ public class EntityTrackerEntry {
|
||||
this.b = i;
|
||||
this.c = j;
|
||||
this.isMoving = flag;
|
||||
this.d = MathHelper.floor(entity.locX * 32.0D);
|
||||
this.e = MathHelper.floor(entity.locY * 32.0D);
|
||||
this.f = MathHelper.floor(entity.locZ * 32.0D);
|
||||
this.g = MathHelper.d(entity.yaw * 256.0F / 360.0F);
|
||||
this.h = MathHelper.d(entity.pitch * 256.0F / 360.0F);
|
||||
this.xLoc = MathHelper.floor(entity.locX * 32.0D);
|
||||
this.yLoc = MathHelper.floor(entity.locY * 32.0D);
|
||||
this.zLoc = MathHelper.floor(entity.locZ * 32.0D);
|
||||
this.yRot = MathHelper.d(entity.yaw * 256.0F / 360.0F);
|
||||
this.xRot = MathHelper.d(entity.pitch * 256.0F / 360.0F);
|
||||
}
|
||||
|
||||
public boolean equals(Object object) {
|
||||
@ -67,23 +67,23 @@ public class EntityTrackerEntry {
|
||||
int k = MathHelper.floor(this.tracker.locZ * 32.0D);
|
||||
int l = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F);
|
||||
int i1 = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F);
|
||||
int j1 = i - this.d;
|
||||
int k1 = j - this.e;
|
||||
int l1 = k - this.f;
|
||||
int j1 = i - this.xLoc;
|
||||
int k1 = j - this.yLoc;
|
||||
int l1 = k - this.zLoc;
|
||||
Object object = null;
|
||||
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
|
||||
if (flag) {
|
||||
this.d = i;
|
||||
this.e = j;
|
||||
this.f = k;
|
||||
this.xLoc = i;
|
||||
this.yLoc = j;
|
||||
this.zLoc = k;
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
this.g = l;
|
||||
this.h = i1;
|
||||
this.yRot = l;
|
||||
this.xRot = i1;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -132,18 +132,18 @@ public class EntityTrackerEntry {
|
||||
if (datawatcher.a()) {
|
||||
this.broadcastIncludingSelf(new Packet40EntityMetadata(this.tracker.id, datawatcher));
|
||||
}
|
||||
// CraftBukkit start - code moved up
|
||||
/* if (flag) {
|
||||
this.d = i;
|
||||
this.e = j;
|
||||
this.f = k;
|
||||
/* CraftBukkit start - code moved up
|
||||
if (flag) {
|
||||
this.xLoc = i;
|
||||
this.yLoc = j;
|
||||
this.zLoc = k;
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
this.g = l;
|
||||
this.h = i1;
|
||||
} */
|
||||
// CraftBukkit end
|
||||
this.yRot = l;
|
||||
this.xRot = i1;
|
||||
}
|
||||
// CraftBukkit end */
|
||||
}
|
||||
|
||||
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) {
|
||||
double d0 = entityplayer.locX - (double) (this.d / 32);
|
||||
double d1 = entityplayer.locZ - (double) (this.f / 32);
|
||||
double d0 = entityplayer.locX - (double) (this.xLoc / 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 (!this.trackedPlayers.contains(entityplayer)) {
|
||||
@ -257,7 +257,7 @@ public class EntityTrackerEntry {
|
||||
|
||||
public void scanPlayers(List list) {
|
||||
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) {
|
||||
return new Packet23VehicleSpawn(this.tracker, 61);
|
||||
} 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) {
|
||||
return new Packet23VehicleSpawn(this.tracker, 65);
|
||||
} 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)) {
|
||||
this.trackedPlayers.remove(entityplayer);
|
||||
entityplayer.netServerHandler.sendPacket(new Packet29DestroyEntity(this.tracker.id));
|
||||
|
@ -157,7 +157,7 @@ public class EntityWolf extends EntityAnimal {
|
||||
this.h = true;
|
||||
this.i = 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;
|
||||
}
|
||||
|
||||
@ -373,10 +373,10 @@ public class EntityWolf extends EntityAnimal {
|
||||
this.setHealth(20);
|
||||
this.setOwnerName(entityhuman.name);
|
||||
this.a(true);
|
||||
this.world.a(this, (byte) 7);
|
||||
this.world.broadcastEntityEffect(this, (byte) 7);
|
||||
} else {
|
||||
this.a(false);
|
||||
this.world.a(this, (byte) 6);
|
||||
this.world.broadcastEntityEffect(this, (byte) 6);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ import java.util.Map;
|
||||
public class 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() {
|
||||
return a;
|
||||
@ -31,14 +31,14 @@ public class FurnaceRecipes {
|
||||
}
|
||||
|
||||
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) {
|
||||
return (ItemStack) this.b.get(Integer.valueOf(i));
|
||||
public ItemStack getResult(int i) {
|
||||
return (ItemStack) this.recipies.get(Integer.valueOf(i));
|
||||
}
|
||||
|
||||
public Map b() {
|
||||
return this.b;
|
||||
public Map getRecipies() {
|
||||
return this.recipies;
|
||||
}
|
||||
}
|
||||
|
@ -12,12 +12,12 @@ import org.bukkit.inventory.InventoryHolder;
|
||||
public class InventoryLargeChest implements IInventory {
|
||||
|
||||
private String a;
|
||||
public IInventory b; // CraftBukkit - private -> public
|
||||
public IInventory c; // CraftBukkit - private -> public
|
||||
public IInventory left; // CraftBukkit - private -> public
|
||||
public IInventory right; // CraftBukkit - private -> public
|
||||
|
||||
// CraftBukkit start
|
||||
public List<HumanEntity> transaction = new ArrayList<HumanEntity>();
|
||||
|
||||
|
||||
public ItemStack[] getContents() {
|
||||
ItemStack[] result = new ItemStack[this.getSize()];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
@ -27,21 +27,21 @@ public class InventoryLargeChest implements IInventory {
|
||||
}
|
||||
|
||||
public void onOpen(CraftHumanEntity who) {
|
||||
b.onOpen(who);
|
||||
c.onOpen(who);
|
||||
this.left.onOpen(who);
|
||||
this.right.onOpen(who);
|
||||
transaction.add(who);
|
||||
}
|
||||
|
||||
public void onClose(CraftHumanEntity who) {
|
||||
b.onClose(who);
|
||||
c.onClose(who);
|
||||
this.left.onClose(who);
|
||||
this.right.onClose(who);
|
||||
transaction.remove(who);
|
||||
}
|
||||
|
||||
|
||||
public List<HumanEntity> getViewers() {
|
||||
return transaction;
|
||||
}
|
||||
|
||||
|
||||
public InventoryHolder getOwner() {
|
||||
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;
|
||||
}
|
||||
|
||||
this.b = iinventory;
|
||||
this.c = iinventory1;
|
||||
this.left = iinventory;
|
||||
this.right = iinventory1;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return this.b.getSize() + this.c.getSize();
|
||||
return this.left.getSize() + this.right.getSize();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
@ -70,41 +70,41 @@ public class InventoryLargeChest implements IInventory {
|
||||
}
|
||||
|
||||
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) {
|
||||
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) {
|
||||
if (i >= this.b.getSize()) {
|
||||
this.c.setItem(i - this.b.getSize(), itemstack);
|
||||
if (i >= this.left.getSize()) {
|
||||
this.right.setItem(i - this.left.getSize(), itemstack);
|
||||
} else {
|
||||
this.b.setItem(i, itemstack);
|
||||
this.left.setItem(i, itemstack);
|
||||
}
|
||||
}
|
||||
|
||||
public int getMaxStackSize() {
|
||||
return this.b.getMaxStackSize();
|
||||
return this.left.getMaxStackSize();
|
||||
}
|
||||
|
||||
public void update() {
|
||||
this.b.update();
|
||||
this.c.update();
|
||||
this.left.update();
|
||||
this.right.update();
|
||||
}
|
||||
|
||||
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() {
|
||||
this.b.f();
|
||||
this.c.f();
|
||||
this.left.f();
|
||||
this.right.f();
|
||||
}
|
||||
|
||||
public void g() {
|
||||
this.b.g();
|
||||
this.c.g();
|
||||
this.left.g();
|
||||
this.right.g();
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ public class ItemBed extends Item {
|
||||
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) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -20,7 +20,7 @@ public class ItemBlock extends Item {
|
||||
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 i1 = world.getTypeId(i, j, k);
|
||||
|
||||
|
@ -16,7 +16,7 @@ public class ItemDoor extends Item {
|
||||
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) {
|
||||
return false;
|
||||
} 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;
|
||||
|
||||
// CraftBukkit start
|
||||
if (place(world, i, j, k, i1, block, entityhuman)) {
|
||||
--itemstack.count;
|
||||
return true;
|
||||
if (!place(world, i, j, k, i1, block, entityhuman)) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
// CraftBukkit end
|
||||
|
||||
--itemstack.count;
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
|
@ -20,7 +20,7 @@ public class ItemDye extends Item {
|
||||
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)) {
|
||||
return false;
|
||||
} else {
|
||||
@ -123,9 +123,10 @@ public class ItemDye extends Item {
|
||||
return;
|
||||
}
|
||||
|
||||
int iColor = new Byte(event.getColor().getData()).intValue();
|
||||
entitysheep.setColor(iColor);
|
||||
i = (byte) event.getColor().getData();
|
||||
// CraftBukkit end
|
||||
|
||||
entitysheep.setColor(i);
|
||||
--itemstack.count;
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ public class ItemFlintAndSteel extends Item {
|
||||
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
|
||||
|
||||
if (l == 0) {
|
||||
|
@ -14,7 +14,7 @@ public class ItemHoe extends Item {
|
||||
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)) {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -16,7 +16,7 @@ public class ItemMinecart extends Item {
|
||||
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);
|
||||
|
||||
if (BlockMinecartTrack.d(i1)) {
|
||||
|
@ -8,7 +8,7 @@ public class ItemMonsterEgg extends Item {
|
||||
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
|
||||
return true;
|
||||
} else {
|
||||
@ -18,7 +18,6 @@ public class ItemMonsterEgg extends Item {
|
||||
Entity entity = EntityTypes.a(itemstack.getData(), world);
|
||||
|
||||
if (entity != null && entity instanceof EntityLiving) { // CraftBukkit
|
||||
|
||||
if (!entityhuman.abilities.canInstantlyBuild) {
|
||||
--itemstack.count;
|
||||
}
|
||||
@ -30,4 +29,4 @@ public class ItemMonsterEgg extends Item {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ public class ItemPainting extends Item {
|
||||
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) {
|
||||
return false;
|
||||
} else if (l == 1) {
|
||||
|
@ -12,7 +12,7 @@ public class ItemRedstone extends Item {
|
||||
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
|
||||
|
||||
if (world.getTypeId(i, j, k) != Block.SNOW.id) {
|
||||
|
@ -15,7 +15,7 @@ public class ItemReed extends Item {
|
||||
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 i1 = world.getTypeId(i, j, k);
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class ItemSeeds extends Item {
|
||||
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) {
|
||||
return false;
|
||||
} else if (entityhuman.d(i, j, k) && entityhuman.d(i, j + 1, k)) {
|
||||
|
@ -13,7 +13,7 @@ public class ItemSign extends Item {
|
||||
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) {
|
||||
return false;
|
||||
} else if (!world.getMaterial(i, j, k).isBuildable()) {
|
||||
|
@ -80,7 +80,7 @@ public final class ItemStack {
|
||||
}
|
||||
|
||||
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) {
|
||||
entityhuman.a(StatisticList.E[this.id], 1);
|
||||
@ -101,7 +101,7 @@ public final class ItemStack {
|
||||
return this.getItem().b(this, world, entityhuman);
|
||||
}
|
||||
|
||||
public NBTTagCompound b(NBTTagCompound nbttagcompound) {
|
||||
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
|
||||
nbttagcompound.setShort("id", (short) this.id);
|
||||
nbttagcompound.setByte("Count", (byte) this.count);
|
||||
nbttagcompound.setShort("Damage", (short) this.damage);
|
||||
@ -205,7 +205,7 @@ public final class ItemStack {
|
||||
}
|
||||
|
||||
public boolean b(Block block) {
|
||||
return Item.byId[this.id].a(block);
|
||||
return Item.byId[this.id].canDestroySpecialBlock(block);
|
||||
}
|
||||
|
||||
public void a(EntityHuman entityhuman) {}
|
||||
|
@ -22,7 +22,7 @@ public class ItemStep extends ItemBlock {
|
||||
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) {
|
||||
;
|
||||
}
|
||||
@ -36,17 +36,16 @@ public class ItemStep extends ItemBlock {
|
||||
int j1 = world.getData(i, j, k);
|
||||
|
||||
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)) {
|
||||
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;
|
||||
}
|
||||
*/
|
||||
return super.a(itemstack, entityhuman, world, i, j, k, -1);
|
||||
return super.interactWith(itemstack, entityhuman, world, i, j, k, -1);
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
return super.a(itemstack, entityhuman, world, i, j, k, l);
|
||||
return super.interactWith(itemstack, entityhuman, world, i, j, k, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ public class MinecraftServer implements Runnable, ICommandListener, IMinecraftSe
|
||||
}
|
||||
}
|
||||
|
||||
WorldType worldtype = WorldType.a(s2);
|
||||
WorldType worldtype = WorldType.getType(s2);
|
||||
|
||||
if (worldtype == null) {
|
||||
worldtype = WorldType.NORMAL;
|
||||
|
@ -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
|
||||
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
|
||||
int j;
|
||||
|
||||
@ -144,7 +144,7 @@ public class MobEffectList {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean b() {
|
||||
public boolean isInstant() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ public class MobEffectList {
|
||||
return this;
|
||||
}
|
||||
|
||||
public double d() {
|
||||
public double getDurationModifier() {
|
||||
return this.L;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ public class NetLoginHandler extends NetHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public void a(Packet packet) {
|
||||
public void onUnhandledPacket(Packet packet) {
|
||||
this.disconnect("Protocol error");
|
||||
}
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
// CraftBukkit start
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
|
||||
@ -349,7 +349,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
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) {
|
||||
this.player.c(0.2F);
|
||||
@ -357,7 +357,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
|
||||
this.player.move(d4, d6, d7);
|
||||
this.player.onGround = packet10flying.g;
|
||||
this.player.b(d4, d6, d7);
|
||||
this.player.checkMovement(d4, d6, d7);
|
||||
double d9 = d6;
|
||||
|
||||
d4 = d1 - this.player.locX;
|
||||
@ -378,7 +378,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
}
|
||||
|
||||
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()) {
|
||||
this.a(this.x, this.y, this.z, f2, f3);
|
||||
@ -682,7 +682,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
this.disconnected = true;
|
||||
}
|
||||
|
||||
public void a(Packet packet) {
|
||||
public void onUnhandledPacket(Packet packet) {
|
||||
if (this.disconnected) return; // CraftBukkit
|
||||
logger.warning(this.getClass() + " wasn\'t prepared to deal with a " + packet.getClass());
|
||||
this.disconnect("Protocol error, unexpected packet");
|
||||
@ -987,7 +987,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
public void a(Packet101CloseWindow packet101closewindow) {
|
||||
public void handleContainerClose(Packet101CloseWindow packet101closewindow) {
|
||||
if (this.player.dead) return; // CraftBukkit
|
||||
|
||||
// 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)) {
|
||||
// CraftBukkit start - fire InventoryClickEvent
|
||||
InventoryView inventory = this.player.activeContainer.getBukkitView();
|
||||
SlotType type = CraftInventoryView.getSlotType(inventory, packet102windowclick.b);
|
||||
SlotType type = CraftInventoryView.getSlotType(inventory, packet102windowclick.slot);
|
||||
|
||||
InventoryClickEvent event;
|
||||
if (inventory instanceof CraftingInventory) {
|
||||
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 {
|
||||
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);
|
||||
|
||||
@ -1021,7 +1021,7 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||
|
||||
switch(event.getResult()) {
|
||||
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;
|
||||
break;
|
||||
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
|
||||
org.bukkit.inventory.ItemStack cursor = event.getCursor();
|
||||
if (cursor == null) {
|
||||
this.player.inventory.b((ItemStack) null);
|
||||
this.player.inventory.setCarried((ItemStack) null);
|
||||
} else {
|
||||
this.player.inventory.b(CraftItemStack.createNMSItemStack(cursor));
|
||||
this.player.inventory.setCarried(CraftItemStack.createNMSItemStack(cursor));
|
||||
}
|
||||
org.bukkit.inventory.ItemStack item = event.getCurrentItem();
|
||||
if (item != null) {
|
||||
itemstack = CraftItemStack.createNMSItemStack(item);
|
||||
if(packet102windowclick.b == -999) {
|
||||
this.player.b(itemstack);
|
||||
if (packet102windowclick.slot == -999) {
|
||||
this.player.drop(itemstack);
|
||||
} else {
|
||||
this.player.activeContainer.b(packet102windowclick.b).c(itemstack);
|
||||
this.player.activeContainer.getSlot(packet102windowclick.slot).set(itemstack);
|
||||
}
|
||||
} else if (packet102windowclick.b != -999) {
|
||||
this.player.activeContainer.b(packet102windowclick.b).c((ItemStack) null);
|
||||
} else if (packet102windowclick.slot != -999) {
|
||||
this.player.activeContainer.getSlot(packet102windowclick.slot).set((ItemStack) null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// 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.h = true;
|
||||
this.player.activeContainer.a();
|
||||
this.player.D();
|
||||
this.player.broadcastCarriedItem();
|
||||
this.player.h = false;
|
||||
} else {
|
||||
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) {
|
||||
if (this.player.itemInWorldManager.isCreative()) {
|
||||
boolean flag = packet107setcreativeslot.a < 0;
|
||||
boolean flag = packet107setcreativeslot.slot < 0;
|
||||
ItemStack itemstack = packet107setcreativeslot.b;
|
||||
boolean flag1 = packet107setcreativeslot.a >= 36 && packet107setcreativeslot.a < 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
|
||||
boolean flag1 = packet107setcreativeslot.slot >= 36 && packet107setcreativeslot.slot < 36 + PlayerInventory.getHotbarSize();
|
||||
// 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;
|
||||
|
||||
// CraftBukkit start - Fire INVENTORY_CLICK event
|
||||
HumanEntity player = this.player.getBukkitEntity();
|
||||
InventoryView inventory = new CraftInventoryView(player, player.getInventory(), this.player.defaultContainer);
|
||||
SlotType slot = SlotType.QUICKBAR;
|
||||
if (packet107setcreativeslot.a == -1) {
|
||||
if (packet107setcreativeslot.slot == -1) {
|
||||
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);
|
||||
org.bukkit.inventory.ItemStack item = event.getCurrentItem();
|
||||
if (event.getResult() == Result.ALLOW) {
|
||||
|
||||
switch (event.getResult()) {
|
||||
case ALLOW:
|
||||
if (slot == SlotType.QUICKBAR) {
|
||||
if (item == null) {
|
||||
this.player.defaultContainer.a(packet107setcreativeslot.a, (ItemStack) null);
|
||||
this.player.defaultContainer.setItem(packet107setcreativeslot.slot, (ItemStack) null);
|
||||
} else {
|
||||
this.player.defaultContainer.a(packet107setcreativeslot.a, CraftItemStack.createNMSItemStack(item));
|
||||
this.player.defaultContainer.setItem(packet107setcreativeslot.slot, CraftItemStack.createNMSItemStack(item));
|
||||
}
|
||||
} 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?
|
||||
if (packet107setcreativeslot.a > -1) {
|
||||
this.player.netServerHandler.sendPacket(new Packet103SetSlot(this.player.defaultContainer.windowId, packet107setcreativeslot.a, CraftItemStack.createNMSItemStack(item)));
|
||||
if (packet107setcreativeslot.slot > -1) {
|
||||
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));
|
||||
} 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);
|
||||
} else if (flag && flag2 && flag3) {
|
||||
this.player.b(itemstack);
|
||||
return;
|
||||
case DEFAULT:
|
||||
// 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) {
|
||||
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)) {
|
||||
this.player.activeContainer.a(this.player, true);
|
||||
|
@ -8,35 +8,36 @@ class NetworkAcceptThread extends Thread {
|
||||
|
||||
final MinecraftServer a;
|
||||
|
||||
final NetworkListenThread b;
|
||||
final NetworkListenThread listenThread;
|
||||
|
||||
NetworkAcceptThread(NetworkListenThread networklistenthread, String s, MinecraftServer minecraftserver) {
|
||||
super(s);
|
||||
this.b = networklistenthread;
|
||||
this.listenThread = networklistenthread;
|
||||
this.a = minecraftserver;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
while (this.b.b) {
|
||||
while (this.listenThread.b) {
|
||||
try {
|
||||
Socket socket = NetworkListenThread.a(this.b).accept();
|
||||
Socket socket = NetworkListenThread.a(this.listenThread).accept();
|
||||
|
||||
if (socket != null) {
|
||||
synchronized (NetworkListenThread.b(this.b)) {
|
||||
synchronized (NetworkListenThread.getRecentConnectionAttempts(this.listenThread)) {
|
||||
InetAddress inetaddress = socket.getInetAddress();
|
||||
|
||||
if (NetworkListenThread.b(this.b).containsKey(inetaddress) && System.currentTimeMillis() - ((Long) NetworkListenThread.b(this.b).get(inetaddress)).longValue() < 4000L) { // CraftBukkit
|
||||
NetworkListenThread.b(this.b).put(inetaddress, Long.valueOf(System.currentTimeMillis()));
|
||||
// CraftBukkit
|
||||
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();
|
||||
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) {
|
||||
ioexception.printStackTrace();
|
||||
|
@ -93,7 +93,7 @@ public class NetworkListenThread {
|
||||
return networklistenthread.d;
|
||||
}
|
||||
|
||||
static HashMap b(NetworkListenThread networklistenthread) {
|
||||
static HashMap getRecentConnectionAttempts(NetworkListenThread networklistenthread) {
|
||||
return networklistenthread.i;
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ public abstract class Packet {
|
||||
public static IntHashMap j = new IntHashMap();
|
||||
private static Map a = new HashMap();
|
||||
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 boolean lowPriority = false;
|
||||
|
||||
@ -33,14 +33,14 @@ public abstract class Packet {
|
||||
}
|
||||
|
||||
if (flag1) {
|
||||
action.add(Integer.valueOf(i));
|
||||
c.add(Integer.valueOf(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Packet a(int i) {
|
||||
try {
|
||||
Class oclass = (Class) j.a(i);
|
||||
Class oclass = (Class) j.get(i);
|
||||
|
||||
return oclass == null ? null : (Packet) oclass.newInstance();
|
||||
} catch (Exception exception) {
|
||||
@ -67,7 +67,7 @@ public abstract class Packet {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -157,7 +157,7 @@ public abstract class Packet {
|
||||
}
|
||||
|
||||
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);
|
||||
} else {
|
||||
dataoutputstream.writeShort(itemstack.id);
|
||||
|
@ -37,7 +37,7 @@ public class Packet1Login extends Packet {
|
||||
this.c = datainputstream.readLong();
|
||||
String s = a(datainputstream, 16);
|
||||
|
||||
this.d = WorldType.a(s);
|
||||
this.d = WorldType.getType(s);
|
||||
if (this.d == null) {
|
||||
this.d = WorldType.NORMAL;
|
||||
}
|
||||
|
@ -14,13 +14,13 @@ public class PlayerInventory implements IInventory {
|
||||
public ItemStack[] items = new ItemStack[36];
|
||||
public ItemStack[] armor = new ItemStack[4];
|
||||
public int itemInHandIndex = 0;
|
||||
public EntityHuman d;
|
||||
public EntityHuman player;
|
||||
private ItemStack f;
|
||||
public boolean e = false;
|
||||
|
||||
// CraftBukkit start
|
||||
public List<HumanEntity> transaction = new ArrayList<HumanEntity>();
|
||||
|
||||
|
||||
public ItemStack[] getContents() {
|
||||
return this.items;
|
||||
}
|
||||
@ -36,18 +36,18 @@ public class PlayerInventory implements IInventory {
|
||||
public void onClose(CraftHumanEntity who) {
|
||||
transaction.remove(who);
|
||||
}
|
||||
|
||||
|
||||
public List<HumanEntity> getViewers() {
|
||||
return transaction;
|
||||
}
|
||||
|
||||
public InventoryHolder getOwner() {
|
||||
return d.getBukkitEntity();
|
||||
return this.player.getBukkitEntity();
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
public PlayerInventory(EntityHuman entityhuman) {
|
||||
this.d = entityhuman;
|
||||
this.player = entityhuman;
|
||||
}
|
||||
|
||||
public ItemStack getItemInHand() {
|
||||
@ -161,7 +161,7 @@ public class PlayerInventory implements IInventory {
|
||||
public void i() {
|
||||
for (int i = 0; i < this.items.length; ++i) {
|
||||
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;
|
||||
itemstack.count = 0;
|
||||
return true;
|
||||
} else if (this.d.abilities.canInstantlyBuild) {
|
||||
} else if (this.player.abilities.canInstantlyBuild) {
|
||||
itemstack.count = 0;
|
||||
return true;
|
||||
} else {
|
||||
@ -208,7 +208,7 @@ public class PlayerInventory implements IInventory {
|
||||
itemstack.count = this.e(itemstack);
|
||||
} 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;
|
||||
return true;
|
||||
} else {
|
||||
@ -274,7 +274,7 @@ public class PlayerInventory implements IInventory {
|
||||
if (this.items[i] != null) {
|
||||
nbttagcompound = new NBTTagCompound();
|
||||
nbttagcompound.setByte("Slot", (byte) i);
|
||||
this.items[i].b(nbttagcompound);
|
||||
this.items[i].save(nbttagcompound);
|
||||
nbttaglist.add(nbttagcompound);
|
||||
}
|
||||
}
|
||||
@ -283,7 +283,7 @@ public class PlayerInventory implements IInventory {
|
||||
if (this.armor[i] != null) {
|
||||
nbttagcompound = new NBTTagCompound();
|
||||
nbttagcompound.setByte("Slot", (byte) (i + 100));
|
||||
this.armor[i].b(nbttagcompound);
|
||||
this.armor[i].save(nbttagcompound);
|
||||
nbttaglist.add(nbttagcompound);
|
||||
}
|
||||
}
|
||||
@ -348,7 +348,7 @@ public class PlayerInventory implements IInventory {
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
if (block.material.k()) {
|
||||
if (block.material.isAlwaysDestroyable()) {
|
||||
return true;
|
||||
} else {
|
||||
ItemStack itemstack = this.getItem(this.itemInHandIndex);
|
||||
@ -379,9 +379,9 @@ public class PlayerInventory implements IInventory {
|
||||
|
||||
for (int j = 0; j < this.armor.length; ++j) {
|
||||
if (this.armor[j] != null && this.armor[j].getItem() instanceof ItemArmor) {
|
||||
this.armor[j].damage(i, this.d);
|
||||
this.armor[j].damage(i, this.player);
|
||||
if (this.armor[j].count == 0) {
|
||||
this.armor[j].a(this.d);
|
||||
this.armor[j].a(this.player);
|
||||
this.armor[j] = null;
|
||||
}
|
||||
}
|
||||
@ -393,14 +393,14 @@ public class PlayerInventory implements IInventory {
|
||||
|
||||
for (i = 0; i < this.items.length; ++i) {
|
||||
if (this.items[i] != null) {
|
||||
this.d.a(this.items[i], true);
|
||||
this.player.a(this.items[i], true);
|
||||
this.items[i] = null;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < this.armor.length; ++i) {
|
||||
if (this.armor[i] != null) {
|
||||
this.d.a(this.armor[i], true);
|
||||
this.player.a(this.armor[i], true);
|
||||
this.armor[i] = null;
|
||||
}
|
||||
}
|
||||
@ -410,17 +410,17 @@ public class PlayerInventory implements IInventory {
|
||||
this.e = true;
|
||||
}
|
||||
|
||||
public void b(ItemStack itemstack) {
|
||||
public void setCarried(ItemStack itemstack) {
|
||||
this.f = itemstack;
|
||||
this.d.a(itemstack);
|
||||
this.player.carriedChanged(itemstack);
|
||||
}
|
||||
|
||||
public ItemStack l() {
|
||||
public ItemStack getCarried() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -121,7 +121,7 @@ public class ServerConfigurationManager {
|
||||
|
||||
// CraftBukkit start
|
||||
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);
|
||||
}
|
||||
} else {
|
||||
@ -297,7 +297,7 @@ public class ServerConfigurationManager {
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -8,27 +8,27 @@ import org.bukkit.inventory.ShapedRecipe;
|
||||
|
||||
public class ShapedRecipes implements CraftingRecipe {
|
||||
|
||||
private int b;
|
||||
private int c;
|
||||
private ItemStack[] d;
|
||||
private ItemStack e;
|
||||
private int width;
|
||||
private int height;
|
||||
private ItemStack[] items;
|
||||
private ItemStack result;
|
||||
public final int a;
|
||||
|
||||
public ShapedRecipes(int i, int j, ItemStack[] aitemstack, ItemStack itemstack) {
|
||||
this.a = itemstack.id;
|
||||
this.b = i;
|
||||
this.c = j;
|
||||
this.d = aitemstack;
|
||||
this.e = itemstack;
|
||||
this.width = i;
|
||||
this.height = j;
|
||||
this.items = aitemstack;
|
||||
this.result = itemstack;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
public ShapedRecipe toBukkitRecipe() {
|
||||
CraftItemStack result = new CraftItemStack(this.e);
|
||||
CraftItemStack result = new CraftItemStack(this.result);
|
||||
CraftShapedRecipe recipe = new CraftShapedRecipe(result, this);
|
||||
switch (this.b) {
|
||||
switch (this.width) {
|
||||
case 1:
|
||||
switch (this.c) {
|
||||
switch (this.height) {
|
||||
case 1:
|
||||
recipe.shape("a");
|
||||
break;
|
||||
@ -41,7 +41,7 @@ public class ShapedRecipes implements CraftingRecipe {
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
switch (this.c) {
|
||||
switch (this.height) {
|
||||
case 1:
|
||||
recipe.shape("a","b");
|
||||
break;
|
||||
@ -54,7 +54,7 @@ public class ShapedRecipes implements CraftingRecipe {
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
switch (this.c) {
|
||||
switch (this.height) {
|
||||
case 1:
|
||||
recipe.shape("a","b","c");
|
||||
break;
|
||||
@ -68,7 +68,7 @@ public class ShapedRecipes implements CraftingRecipe {
|
||||
break;
|
||||
}
|
||||
char c = 'a';
|
||||
for (ItemStack stack : this.d) {
|
||||
for (ItemStack stack : this.items) {
|
||||
if (stack != null) {
|
||||
recipe.setIngredient(c, org.bukkit.Material.getMaterial(stack.id), stack.getData());
|
||||
}
|
||||
@ -79,12 +79,12 @@ public class ShapedRecipes implements CraftingRecipe {
|
||||
// CraftBukkit end
|
||||
|
||||
public ItemStack b() {
|
||||
return this.e;
|
||||
return this.result;
|
||||
}
|
||||
|
||||
public boolean a(InventoryCrafting inventorycrafting) {
|
||||
for (int i = 0; i <= 3 - this.b; ++i) {
|
||||
for (int j = 0; j <= 3 - this.c; ++j) {
|
||||
for (int i = 0; i <= 3 - this.width; ++i) {
|
||||
for (int j = 0; j <= 3 - this.height; ++j) {
|
||||
if (this.a(inventorycrafting, i, j, true)) {
|
||||
return true;
|
||||
}
|
||||
@ -105,11 +105,11 @@ public class ShapedRecipes implements CraftingRecipe {
|
||||
int j1 = l - j;
|
||||
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) {
|
||||
itemstack = this.d[this.b - i1 - 1 + j1 * this.b];
|
||||
itemstack = this.items[this.width - i1 - 1 + j1 * this.width];
|
||||
} 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) {
|
||||
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() {
|
||||
return this.b * this.c;
|
||||
return this.width * this.height;
|
||||
}
|
||||
}
|
||||
|
@ -12,20 +12,20 @@ import org.bukkit.inventory.ShapelessRecipe;
|
||||
|
||||
public class ShapelessRecipes implements CraftingRecipe {
|
||||
|
||||
private final ItemStack a;
|
||||
private final List b;
|
||||
private final ItemStack result;
|
||||
private final List ingredients;
|
||||
|
||||
public ShapelessRecipes(ItemStack itemstack, List list) {
|
||||
this.a = itemstack;
|
||||
this.b = list;
|
||||
this.result = itemstack;
|
||||
this.ingredients = list;
|
||||
}
|
||||
|
||||
// CraftBukkit start
|
||||
@SuppressWarnings("unchecked")
|
||||
public ShapelessRecipe toBukkitRecipe() {
|
||||
CraftItemStack result = new CraftItemStack(this.a);
|
||||
CraftItemStack result = new CraftItemStack(this.result);
|
||||
CraftShapelessRecipe recipe = new CraftShapelessRecipe(result, this);
|
||||
for (ItemStack stack : (List<ItemStack>) this.b) {
|
||||
for (ItemStack stack : (List<ItemStack>) this.ingredients) {
|
||||
if (stack != null) {
|
||||
recipe.addIngredient(org.bukkit.Material.getMaterial(stack.id), stack.getData());
|
||||
}
|
||||
@ -35,11 +35,11 @@ public class ShapelessRecipes implements CraftingRecipe {
|
||||
// CraftBukkit end
|
||||
|
||||
public ItemStack b() {
|
||||
return this.a;
|
||||
return this.result;
|
||||
}
|
||||
|
||||
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 j = 0; j < 3; ++j) {
|
||||
@ -70,10 +70,10 @@ public class ShapelessRecipes implements CraftingRecipe {
|
||||
}
|
||||
|
||||
public ItemStack b(InventoryCrafting inventorycrafting) {
|
||||
return this.a.cloneItemStack();
|
||||
return this.result.cloneItemStack();
|
||||
}
|
||||
|
||||
public int a() {
|
||||
return this.b.size();
|
||||
return this.ingredients.size();
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class Slot {
|
||||
return this.getItem() != null;
|
||||
}
|
||||
|
||||
public void c(ItemStack itemstack) {
|
||||
public void set(ItemStack itemstack) {
|
||||
this.inventory.setItem(this.index, itemstack);
|
||||
this.d();
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ import org.bukkit.inventory.BrewerInventory;
|
||||
|
||||
public class TileEntityBrewingStand extends TileEntity implements IInventory {
|
||||
|
||||
public ItemStack[] a = new ItemStack[4]; // CraftBukkit private -> public
|
||||
public int b; // CraftBukkit private -> public
|
||||
public ItemStack[] items = new ItemStack[4]; // CraftBukkit private -> public
|
||||
public int brewTime; // CraftBukkit private -> public
|
||||
private int c;
|
||||
private int d;
|
||||
|
||||
@ -37,7 +37,7 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
public ItemStack[] getContents() {
|
||||
return this.a;
|
||||
return this.items;
|
||||
}
|
||||
// CraftBukkit end
|
||||
|
||||
@ -46,25 +46,25 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return this.a.length;
|
||||
return this.items.length;
|
||||
}
|
||||
|
||||
public void l_() {
|
||||
if (this.b > 0) {
|
||||
--this.b;
|
||||
if (this.b == 0) {
|
||||
if (this.brewTime > 0) {
|
||||
--this.brewTime;
|
||||
if (this.brewTime == 0) {
|
||||
this.p();
|
||||
this.update();
|
||||
} else if (!this.o()) {
|
||||
this.b = 0;
|
||||
this.brewTime = 0;
|
||||
this.update();
|
||||
} else if (this.d != this.a[3].id) {
|
||||
this.b = 0;
|
||||
} else if (this.d != this.items[3].id) {
|
||||
this.brewTime = 0;
|
||||
this.update();
|
||||
}
|
||||
} else if (this.o()) {
|
||||
this.b = 400;
|
||||
this.d = this.a[3].id;
|
||||
this.brewTime = 400;
|
||||
this.d = this.items[3].id;
|
||||
}
|
||||
|
||||
int i = this.n();
|
||||
@ -78,12 +78,12 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
public int h() {
|
||||
return this.b;
|
||||
return this.brewTime;
|
||||
}
|
||||
|
||||
private boolean o() {
|
||||
if (this.a[3] != null && this.a[3].count > 0) {
|
||||
ItemStack itemstack = this.a[3];
|
||||
if (this.items[3] != null && this.items[3].count > 0) {
|
||||
ItemStack itemstack = this.items[3];
|
||||
|
||||
if (!Item.byId[itemstack.id].n()) {
|
||||
return false;
|
||||
@ -91,8 +91,8 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
|
||||
boolean flag = false;
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (this.a[i] != null && this.a[i].id == Item.POTION.id) {
|
||||
int j = this.a[i].getData();
|
||||
if (this.items[i] != null && this.items[i].id == Item.POTION.id) {
|
||||
int j = this.items[i].getData();
|
||||
int k = this.b(j, itemstack);
|
||||
|
||||
if (!ItemPotion.c(j) && ItemPotion.c(k)) {
|
||||
@ -119,7 +119,7 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
|
||||
|
||||
private void p() {
|
||||
if (this.o()) {
|
||||
ItemStack itemstack = this.a[3];
|
||||
ItemStack itemstack = this.items[3];
|
||||
|
||||
// CraftBukkit start - fire BREW event
|
||||
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
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (this.a[i] != null && this.a[i].id == Item.POTION.id) {
|
||||
int j = this.a[i].getData();
|
||||
if (this.items[i] != null && this.items[i].id == Item.POTION.id) {
|
||||
int j = this.items[i].getData();
|
||||
int k = this.b(j, itemstack);
|
||||
List list = Item.POTION.b(j);
|
||||
List list1 = Item.POTION.b(k);
|
||||
|
||||
if ((j <= 0 || list != list1) && (list == null || !list.equals(list1) && list1 != null)) {
|
||||
if (j != k) {
|
||||
this.a[i].setData(k);
|
||||
this.items[i].setData(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()) {
|
||||
this.a[3] = new ItemStack(Item.byId[itemstack.id].j());
|
||||
this.items[3] = new ItemStack(Item.byId[itemstack.id].j());
|
||||
} else {
|
||||
--this.a[3].count;
|
||||
if (this.a[3].count <= 0) {
|
||||
this.a[3] = null;
|
||||
--this.items[3].count;
|
||||
if (this.items[3].count <= 0) {
|
||||
this.items[3] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -163,31 +163,31 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
|
||||
super.a(nbttagcompound);
|
||||
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) {
|
||||
NBTTagCompound nbttagcompound1 = (NBTTagCompound) nbttaglist.get(i);
|
||||
byte b0 = nbttagcompound1.getByte("Slot");
|
||||
|
||||
if (b0 >= 0 && b0 < this.a.length) {
|
||||
this.a[b0] = ItemStack.a(nbttagcompound1);
|
||||
if (b0 >= 0 && b0 < this.items.length) {
|
||||
this.items[b0] = ItemStack.a(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
||||
this.b = nbttagcompound.getShort("BrewTime");
|
||||
this.brewTime = nbttagcompound.getShort("BrewTime");
|
||||
}
|
||||
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
nbttagcompound.setShort("BrewTime", (short) this.b);
|
||||
nbttagcompound.setShort("BrewTime", (short) this.brewTime);
|
||||
NBTTagList nbttaglist = new NBTTagList();
|
||||
|
||||
for (int i = 0; i < this.a.length; ++i) {
|
||||
if (this.a[i] != null) {
|
||||
for (int i = 0; i < this.items.length; ++i) {
|
||||
if (this.items[i] != null) {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
this.a[i].b(nbttagcompound1);
|
||||
this.items[i].save(nbttagcompound1);
|
||||
nbttaglist.add(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
@ -196,14 +196,14 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
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) {
|
||||
if (i >= 0 && i < this.a.length) {
|
||||
ItemStack itemstack = this.a[i];
|
||||
if (i >= 0 && i < this.items.length) {
|
||||
ItemStack itemstack = this.items[i];
|
||||
|
||||
this.a[i] = null;
|
||||
this.items[i] = null;
|
||||
return itemstack;
|
||||
} else {
|
||||
return null;
|
||||
@ -211,8 +211,8 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
|
||||
}
|
||||
|
||||
public void setItem(int i, ItemStack itemstack) {
|
||||
if (i >= 0 && i < this.a.length) {
|
||||
this.a[i] = itemstack;
|
||||
if (i >= 0 && i < this.items.length) {
|
||||
this.items[i] = itemstack;
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ public class TileEntityBrewingStand extends TileEntity implements IInventory {
|
||||
int i = 0;
|
||||
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
if (this.a[j] != null) {
|
||||
if (this.items[j] != null) {
|
||||
i |= 1 << j;
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ public class TileEntityChest extends TileEntity implements IInventory {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
this.items[i].b(nbttagcompound1);
|
||||
this.items[i].save(nbttagcompound1);
|
||||
nbttaglist.add(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public class TileEntityDispenser extends TileEntity implements IInventory {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
this.items[i].b(nbttagcompound1);
|
||||
this.items[i].save(nbttagcompound1);
|
||||
nbttaglist.add(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
|
@ -114,7 +114,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
|
||||
|
||||
nbttagcompound1.setByte("Slot", (byte) i);
|
||||
this.items[i].b(nbttagcompound1);
|
||||
this.items[i].save(nbttagcompound1);
|
||||
nbttaglist.add(nbttagcompound1);
|
||||
}
|
||||
}
|
||||
@ -210,7 +210,7 @@ public class TileEntityFurnace extends TileEntity implements IInventory {
|
||||
if (this.items[0] == null) {
|
||||
return false;
|
||||
} 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
|
||||
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() {
|
||||
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
|
||||
CraftItemStack source = new CraftItemStack(this.items[0]);
|
||||
|
@ -57,11 +57,11 @@ public class TileEntityMobSpawner extends TileEntity {
|
||||
}
|
||||
|
||||
EntityLiving entityliving = (EntityLiving) ((EntityLiving) mob);
|
||||
// CraftBukkit end
|
||||
|
||||
if (entityliving == null) {
|
||||
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();
|
||||
|
||||
@ -76,12 +76,9 @@ public class TileEntityMobSpawner extends TileEntity {
|
||||
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);
|
||||
// CraftBukkit start
|
||||
if (entityliving.canSpawn()) {
|
||||
this.world.addEntity(entityliving, SpawnReason.SPAWNER);
|
||||
// CraftBukkit end
|
||||
|
||||
this.world.f(2004, this.x, this.y, this.z, 0);
|
||||
this.world.addEntity(entityliving, SpawnReason.SPAWNER); // CraftBukkit
|
||||
this.world.triggerEffect(2004, this.x, this.y, this.z, 0);
|
||||
entityliving.ao();
|
||||
this.e();
|
||||
}
|
||||
|
@ -634,7 +634,7 @@ public class World implements IBlockAccess {
|
||||
} else {
|
||||
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 {
|
||||
return enumskyblock.c;
|
||||
@ -969,7 +969,7 @@ public class World implements IBlockAccess {
|
||||
this.z.add(iworldaccess);
|
||||
}
|
||||
|
||||
public List a(Entity entity, AxisAlignedBB axisalignedbb) {
|
||||
public List getCubes(Entity entity, AxisAlignedBB axisalignedbb) {
|
||||
this.R.clear();
|
||||
int i = MathHelper.floor(axisalignedbb.a);
|
||||
int j = MathHelper.floor(axisalignedbb.d + 1.0D);
|
||||
@ -1362,7 +1362,7 @@ public class World implements IBlockAccess {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean c(AxisAlignedBB axisalignedbb) {
|
||||
public boolean containsLiquid(AxisAlignedBB axisalignedbb) {
|
||||
int i = MathHelper.floor(axisalignedbb.a);
|
||||
int j = MathHelper.floor(axisalignedbb.d + 1.0D);
|
||||
int k = MathHelper.floor(axisalignedbb.b);
|
||||
@ -1521,7 +1521,7 @@ public class World implements IBlockAccess {
|
||||
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);
|
||||
}
|
||||
|
||||
@ -1994,7 +1994,7 @@ public class World implements IBlockAccess {
|
||||
j2 = i2 & 15;
|
||||
k2 = i2 >> 8 & 15;
|
||||
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;
|
||||
if (Block.n[i3]) {
|
||||
@ -2692,7 +2692,7 @@ public class World implements IBlockAccess {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void a(Entity entity, byte b0) {}
|
||||
public void broadcastEntityEffect(Entity entity, byte b0) {}
|
||||
|
||||
public IChunkProvider p() {
|
||||
return this.chunkProvider;
|
||||
@ -2825,7 +2825,7 @@ public class World implements IBlockAccess {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,7 @@ public class WorldData {
|
||||
if (nbttagcompound.hasKey("generatorName")) {
|
||||
String s = nbttagcompound.getString("generatorName");
|
||||
|
||||
this.type = WorldType.a(s);
|
||||
this.type = WorldType.getType(s);
|
||||
if (this.type == null) {
|
||||
this.type = WorldType.NORMAL;
|
||||
}
|
||||
@ -236,7 +236,7 @@ public class WorldData {
|
||||
return this.gameType;
|
||||
}
|
||||
|
||||
public boolean o() {
|
||||
public boolean shouldGenerateMapFeatures() {
|
||||
return this.useMapFeatures;
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ public class WorldServer extends World implements BlockChangeDelegate {
|
||||
}
|
||||
|
||||
public Entity getEntity(int i) {
|
||||
return (Entity) this.entitiesById.a(i);
|
||||
return (Entity) this.entitiesById.get(i);
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
// CraftBukkit
|
||||
|
@ -589,7 +589,7 @@ public final class CraftServer implements Server {
|
||||
ChunkGenerator generator = creator.generator();
|
||||
File folder = new File(getWorldContainer(), name);
|
||||
World world = getWorld(name);
|
||||
WorldType type = WorldType.a(creator.type().getName());
|
||||
WorldType type = WorldType.getType(creator.type().getName());
|
||||
boolean generateStructures = creator.generateStructures();
|
||||
|
||||
if (world != null) {
|
||||
@ -824,13 +824,13 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
public void clearRecipes() {
|
||||
CraftingManager.getInstance().b.clear();
|
||||
FurnaceRecipes.getInstance().b().clear();
|
||||
CraftingManager.getInstance().recipies.clear();
|
||||
FurnaceRecipes.getInstance().recipies.clear();
|
||||
}
|
||||
|
||||
public void resetRecipes() {
|
||||
CraftingManager.getInstance().b = new CraftingManager().b;
|
||||
FurnaceRecipes.getInstance().b = new FurnaceRecipes().b;
|
||||
CraftingManager.getInstance().recipies = new CraftingManager().recipies;
|
||||
FurnaceRecipes.getInstance().recipies = new FurnaceRecipes().recipies;
|
||||
}
|
||||
|
||||
public Map<String, String[]> getCommandAliases() {
|
||||
|
@ -1037,7 +1037,7 @@ public class CraftWorld implements World {
|
||||
}
|
||||
|
||||
public boolean canGenerateStructures() {
|
||||
return world.getWorldData().o();
|
||||
return world.getWorldData().shouldGenerateMapFeatures();
|
||||
}
|
||||
|
||||
public long getTicksPerAnimalSpawns() {
|
||||
|
@ -124,11 +124,11 @@ public class CraftBlock implements Block {
|
||||
}
|
||||
|
||||
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() {
|
||||
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 BIOME_MAPPING[base.K];
|
||||
return BIOME_MAPPING[base.id];
|
||||
}
|
||||
|
||||
public double getTemperature() {
|
||||
@ -326,7 +326,7 @@ public class CraftBlock implements Block {
|
||||
private boolean itemCausesDrops(ItemStack item) {
|
||||
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;
|
||||
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() {
|
||||
@ -377,32 +377,32 @@ public class CraftBlock implements Block {
|
||||
|
||||
/* Build biome index based lookup table for BiomeBase to Biome mapping */
|
||||
static {
|
||||
BIOME_MAPPING = new Biome[BiomeBase.a.length];
|
||||
BIOME_MAPPING[BiomeBase.SWAMPLAND.K] = Biome.SWAMPLAND;
|
||||
BIOME_MAPPING[BiomeBase.FOREST.K] = Biome.FOREST;
|
||||
BIOME_MAPPING[BiomeBase.TAIGA.K] = Biome.TAIGA;
|
||||
BIOME_MAPPING[BiomeBase.DESERT.K] = Biome.DESERT;
|
||||
BIOME_MAPPING[BiomeBase.PLAINS.K] = Biome.PLAINS;
|
||||
BIOME_MAPPING[BiomeBase.HELL.K] = Biome.HELL;
|
||||
BIOME_MAPPING[BiomeBase.SKY.K] = Biome.SKY;
|
||||
BIOME_MAPPING[BiomeBase.RIVER.K] = Biome.RIVER;
|
||||
BIOME_MAPPING[BiomeBase.EXTREME_HILLS.K] = Biome.EXTREME_HILLS;
|
||||
BIOME_MAPPING[BiomeBase.OCEAN.K] = Biome.OCEAN;
|
||||
BIOME_MAPPING[BiomeBase.FROZEN_OCEAN.K] = Biome.FROZEN_OCEAN;
|
||||
BIOME_MAPPING[BiomeBase.FROZEN_RIVER.K] = Biome.FROZEN_RIVER;
|
||||
BIOME_MAPPING[BiomeBase.ICE_PLAINS.K] = Biome.ICE_PLAINS;
|
||||
BIOME_MAPPING[BiomeBase.ICE_MOUNTAINS.K] = Biome.ICE_MOUNTAINS;
|
||||
BIOME_MAPPING[BiomeBase.MUSHROOM_ISLAND.K] = Biome.MUSHROOM_ISLAND;
|
||||
BIOME_MAPPING[BiomeBase.MUSHROOM_SHORE.K] = Biome.MUSHROOM_SHORE;
|
||||
BIOME_MAPPING[BiomeBase.BEACH.K] = Biome.BEACH;
|
||||
BIOME_MAPPING[BiomeBase.DESERT_HILLS.K] = Biome.DESERT_HILLS;
|
||||
BIOME_MAPPING[BiomeBase.FOREST_HILLS.K] = Biome.FOREST_HILLS;
|
||||
BIOME_MAPPING[BiomeBase.TAIGA_HILLS.K] = Biome.TAIGA_HILLS;
|
||||
BIOME_MAPPING[BiomeBase.SMALL_MOUNTAINS.K] = Biome.SMALL_MOUNTAINS;
|
||||
BIOME_MAPPING = new Biome[BiomeBase.biomes.length];
|
||||
BIOME_MAPPING[BiomeBase.SWAMPLAND.id] = Biome.SWAMPLAND;
|
||||
BIOME_MAPPING[BiomeBase.FOREST.id] = Biome.FOREST;
|
||||
BIOME_MAPPING[BiomeBase.TAIGA.id] = Biome.TAIGA;
|
||||
BIOME_MAPPING[BiomeBase.DESERT.id] = Biome.DESERT;
|
||||
BIOME_MAPPING[BiomeBase.PLAINS.id] = Biome.PLAINS;
|
||||
BIOME_MAPPING[BiomeBase.HELL.id] = Biome.HELL;
|
||||
BIOME_MAPPING[BiomeBase.SKY.id] = Biome.SKY;
|
||||
BIOME_MAPPING[BiomeBase.RIVER.id] = Biome.RIVER;
|
||||
BIOME_MAPPING[BiomeBase.EXTREME_HILLS.id] = Biome.EXTREME_HILLS;
|
||||
BIOME_MAPPING[BiomeBase.OCEAN.id] = Biome.OCEAN;
|
||||
BIOME_MAPPING[BiomeBase.FROZEN_OCEAN.id] = Biome.FROZEN_OCEAN;
|
||||
BIOME_MAPPING[BiomeBase.FROZEN_RIVER.id] = Biome.FROZEN_RIVER;
|
||||
BIOME_MAPPING[BiomeBase.ICE_PLAINS.id] = Biome.ICE_PLAINS;
|
||||
BIOME_MAPPING[BiomeBase.ICE_MOUNTAINS.id] = Biome.ICE_MOUNTAINS;
|
||||
BIOME_MAPPING[BiomeBase.MUSHROOM_ISLAND.id] = Biome.MUSHROOM_ISLAND;
|
||||
BIOME_MAPPING[BiomeBase.MUSHROOM_SHORE.id] = Biome.MUSHROOM_SHORE;
|
||||
BIOME_MAPPING[BiomeBase.BEACH.id] = Biome.BEACH;
|
||||
BIOME_MAPPING[BiomeBase.DESERT_HILLS.id] = Biome.DESERT_HILLS;
|
||||
BIOME_MAPPING[BiomeBase.FOREST_HILLS.id] = Biome.FOREST_HILLS;
|
||||
BIOME_MAPPING[BiomeBase.TAIGA_HILLS.id] = Biome.TAIGA_HILLS;
|
||||
BIOME_MAPPING[BiomeBase.SMALL_MOUNTAINS.id] = Biome.SMALL_MOUNTAINS;
|
||||
/* 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 */
|
||||
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 + "]");
|
||||
}
|
||||
}
|
||||
|
@ -34,10 +34,10 @@ public class CraftBrewingStand extends CraftBlockState implements BrewingStand {
|
||||
}
|
||||
|
||||
public int getBrewingTime() {
|
||||
return brewingStand.b;
|
||||
return brewingStand.brewTime;
|
||||
}
|
||||
|
||||
public void setBrewingTime(int brewTime) {
|
||||
brewingStand.b = brewTime;
|
||||
brewingStand.brewTime = brewTime;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public abstract class CraftComplexLivingEntity extends CraftLivingEntity impleme
|
||||
}
|
||||
|
||||
if (entity instanceof EntityComplex) {
|
||||
((EntityComplex) entity).e(reason, amount);
|
||||
((EntityComplex) entity).dealDamage(reason, amount);
|
||||
} else {
|
||||
entity.damageEntity(reason, amount);
|
||||
}
|
||||
|
@ -297,7 +297,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@ -64,14 +64,14 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
}
|
||||
|
||||
public ItemStack getItemOnCursor() {
|
||||
return new CraftItemStack(getHandle().inventory.l());
|
||||
return new CraftItemStack(getHandle().inventory.getCarried());
|
||||
}
|
||||
|
||||
public void setItemOnCursor(ItemStack item) {
|
||||
CraftItemStack stack = new CraftItemStack(item.getType(), item.getAmount(), item.getDurability());
|
||||
getHandle().inventory.b(stack.getHandle());
|
||||
getHandle().inventory.setCarried(stack.getHandle());
|
||||
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) {
|
||||
case PLAYER:
|
||||
case CHEST:
|
||||
getHandle().a(craftinv.getInventory());
|
||||
getHandle().openContainer(craftinv.getInventory());
|
||||
break;
|
||||
case DISPENSER:
|
||||
getHandle().a((TileEntityDispenser)craftinv.getInventory());
|
||||
getHandle().openDispenser((TileEntityDispenser)craftinv.getInventory());
|
||||
break;
|
||||
case FURNACE:
|
||||
getHandle().a((TileEntityFurnace)craftinv.getInventory());
|
||||
getHandle().openFurnace((TileEntityFurnace)craftinv.getInventory());
|
||||
break;
|
||||
case WORKBENCH:
|
||||
getHandle().b(getLocation().getBlockX(), getLocation().getBlockY(), getLocation().getBlockZ());
|
||||
getHandle().startCrafting(getLocation().getBlockX(), getLocation().getBlockY(), getLocation().getBlockZ());
|
||||
break;
|
||||
case BREWING:
|
||||
getHandle().a((TileEntityBrewingStand)craftinv.getInventory());
|
||||
getHandle().openBrewingStand((TileEntityBrewingStand)craftinv.getInventory());
|
||||
break;
|
||||
case ENCHANTING:
|
||||
getHandle().c(getLocation().getBlockX(), getLocation().getBlockY(), getLocation().getBlockZ());
|
||||
getHandle().startEnchanting(getLocation().getBlockX(), getLocation().getBlockY(), getLocation().getBlockZ());
|
||||
break;
|
||||
case CREATIVE:
|
||||
case CRAFTING:
|
||||
@ -209,7 +209,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
if (location == null) {
|
||||
location = getLocation();
|
||||
}
|
||||
getHandle().b(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
getHandle().startCrafting(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
if (force) {
|
||||
getHandle().activeContainer.checkReachable = false;
|
||||
}
|
||||
@ -226,7 +226,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
if (location == null) {
|
||||
location = getLocation();
|
||||
}
|
||||
getHandle().c(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
getHandle().startEnchanting(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
if (force) {
|
||||
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().activeContainer != getHandle().defaultContainer) {
|
||||
// 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();
|
||||
Container container;
|
||||
if (inventory instanceof CraftInventoryView) {
|
||||
container = ((CraftInventoryView) inventory).getHandle();
|
||||
} else {
|
||||
container = new CraftContainer(inventory, player.aS());
|
||||
container = new CraftContainer(inventory, player.nextContainerCounter());
|
||||
}
|
||||
|
||||
// Trigger an INVENTORY_OPEN event
|
||||
@ -259,7 +259,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
|
||||
// Now open the window
|
||||
player.netServerHandler.sendPacket(new Packet100OpenWindow(container.windowId, 1, "Crafting", 9));
|
||||
player.activeContainer = container;
|
||||
player.activeContainer.a((ICrafting) player);
|
||||
player.activeContainer.addSlotListener((ICrafting) player);
|
||||
}
|
||||
|
||||
public void closeInventory() {
|
||||
|
@ -576,7 +576,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
@ -587,9 +587,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
//remove this player from the hidden player's EntityTrackerEntry
|
||||
EntityTracker tracker = ((WorldServer) entity.world).tracker;
|
||||
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.c(getHandle());
|
||||
entry.clear(getHandle());
|
||||
}
|
||||
|
||||
//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;
|
||||
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())) {
|
||||
entry.b(getHandle());
|
||||
entry.updatePlayer(getHandle());
|
||||
}
|
||||
|
||||
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()) {
|
||||
return false;
|
||||
}
|
||||
getHandle().a(container, prop.getId(), value);
|
||||
getHandle().setContainerData(container, prop.getId(), value);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class CraftThrownPotion extends CraftProjectile implements ThrownPotion {
|
||||
|
||||
public Collection<PotionEffect> getEffects() {
|
||||
if (effects == null) {
|
||||
effects = Potion.getBrewer().getEffectsFromDamage(getHandle().f());
|
||||
effects = Potion.getBrewer().getEffectsFromDamage(getHandle().getPotionValue());
|
||||
}
|
||||
|
||||
return effects;
|
||||
|
@ -423,7 +423,7 @@ public class CraftEventFactory {
|
||||
|
||||
public static Container callInventoryOpenEvent(EntityPlayer player, Container container) {
|
||||
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();
|
||||
|
@ -17,15 +17,15 @@ public class CraftInventoryDoubleChest extends CraftInventory implements DoubleC
|
||||
|
||||
public CraftInventoryDoubleChest(InventoryLargeChest largeChest) {
|
||||
super(largeChest);
|
||||
if (largeChest.b instanceof InventoryLargeChest) {
|
||||
left = new CraftInventoryDoubleChest((InventoryLargeChest)largeChest.b);
|
||||
if (largeChest.left instanceof InventoryLargeChest) {
|
||||
left = new CraftInventoryDoubleChest((InventoryLargeChest) largeChest.left);
|
||||
} else {
|
||||
left = new CraftInventory(largeChest.b);
|
||||
left = new CraftInventory(largeChest.left);
|
||||
}
|
||||
if (largeChest.c instanceof InventoryLargeChest) {
|
||||
right = new CraftInventoryDoubleChest((InventoryLargeChest)largeChest.c);
|
||||
if (largeChest.right instanceof InventoryLargeChest) {
|
||||
right = new CraftInventoryDoubleChest((InventoryLargeChest) largeChest.right);
|
||||
} else {
|
||||
right = new CraftInventory(largeChest.c);
|
||||
right = new CraftInventory(largeChest.right);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,7 @@ public class CraftInventoryView extends InventoryView {
|
||||
public void setItem(int slot, ItemStack item) {
|
||||
if (slot != -999) {
|
||||
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) {
|
||||
return null;
|
||||
}
|
||||
return new CraftItemStack(container.b(slot).getItem());
|
||||
return new CraftItemStack(container.getSlot(slot).getItem());
|
||||
}
|
||||
|
||||
public boolean isInTop(int rawSlot) {
|
||||
|
@ -13,10 +13,10 @@ public class RecipeIterator implements Iterator<Recipe> {
|
||||
private Iterator<CraftingRecipe> recipes;
|
||||
private Iterator<Integer> smelting;
|
||||
private Iterator<?> removeFrom = null;
|
||||
|
||||
|
||||
public RecipeIterator() {
|
||||
this.recipes = CraftingManager.getInstance().b().iterator();
|
||||
this.smelting = FurnaceRecipes.getInstance().b().keySet().iterator();
|
||||
this.recipes = CraftingManager.getInstance().getRecipies().iterator();
|
||||
this.smelting = FurnaceRecipes.getInstance().getRecipies().keySet().iterator();
|
||||
}
|
||||
|
||||
public boolean hasNext() {
|
||||
@ -34,7 +34,7 @@ public class RecipeIterator implements Iterator<Recipe> {
|
||||
} else {
|
||||
removeFrom = smelting;
|
||||
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));
|
||||
return recipe;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ public class CraftPotionBrewer implements PotionBrewer {
|
||||
if (cache.containsKey(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>();
|
||||
if (mcEffects == null)
|
||||
return effects;
|
||||
|
@ -14,7 +14,7 @@ public class CraftPotionEffectType extends PotionEffectType {
|
||||
|
||||
@Override
|
||||
public double getDurationModifier() {
|
||||
return handle.d();
|
||||
return handle.getDurationModifier();
|
||||
}
|
||||
|
||||
public MobEffectList getHandle() {
|
||||
@ -69,6 +69,6 @@ public class CraftPotionEffectType extends PotionEffectType {
|
||||
|
||||
@Override
|
||||
public boolean isInstant() {
|
||||
return handle.b();
|
||||
return handle.isInstant();
|
||||
}
|
||||
}
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren