diff options
Diffstat (limited to 'src/main/java/net')
45 files changed, 296 insertions, 251 deletions
diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java index 73a6e83b..a93beef6 100644 --- a/src/main/java/net/minecraft/server/BlockFire.java +++ b/src/main/java/net/minecraft/server/BlockFire.java @@ -77,7 +77,7 @@ public class BlockFire extends Block { fireExtinguished(world, i, j, k); // CraftBukkit - invalid place location } - if (!flag && world.O() && (world.F(i, j, k) || world.F(i - 1, j, k) || world.F(i + 1, j, k) || world.F(i, j, k - 1) || world.F(i, j, k + 1))) { + if (!flag && world.P() && (world.F(i, j, k) || world.F(i - 1, j, k) || world.F(i + 1, j, k) || world.F(i, j, k - 1) || world.F(i, j, k + 1))) { fireExtinguished(world, i, j, k); // CraftBukkit - extinguished by rain } else { int l = world.getData(i, j, k); @@ -127,7 +127,7 @@ public class BlockFire extends Block { j2 /= 2; } - if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.O() || !world.F(i1, k1, j1)) && !world.F(i1 - 1, k1, k) && !world.F(i1 + 1, k1, j1) && !world.F(i1, k1, j1 - 1) && !world.F(i1, k1, j1 + 1)) { + if (j2 > 0 && random.nextInt(l1) <= j2 && (!world.P() || !world.F(i1, k1, j1)) && !world.F(i1 - 1, k1, k) && !world.F(i1 + 1, k1, j1) && !world.F(i1, k1, j1 - 1) && !world.F(i1, k1, j1 + 1)) { int k2 = l + random.nextInt(5) / 4; if (k2 > 15) { diff --git a/src/main/java/net/minecraft/server/BlockLeaves.java b/src/main/java/net/minecraft/server/BlockLeaves.java index 318c304d..9e4a9200 100644 --- a/src/main/java/net/minecraft/server/BlockLeaves.java +++ b/src/main/java/net/minecraft/server/BlockLeaves.java @@ -178,7 +178,7 @@ public class BlockLeaves extends BlockTransparant { } public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) { - if (!world.isStatic && entityhuman.cb() != null && entityhuman.cb().id == Item.SHEARS.id) { + if (!world.isStatic && entityhuman.cd() != null && entityhuman.cd().id == Item.SHEARS.id) { entityhuman.a(StatisticList.C[this.id], 1); this.b(world, i, j, k, new ItemStack(Block.LEAVES.id, 1, l & 3)); } else { diff --git a/src/main/java/net/minecraft/server/BlockTripwire.java b/src/main/java/net/minecraft/server/BlockTripwire.java index f020300f..ac7522ef 100644 --- a/src/main/java/net/minecraft/server/BlockTripwire.java +++ b/src/main/java/net/minecraft/server/BlockTripwire.java @@ -76,7 +76,7 @@ public class BlockTripwire extends Block { public void a(World world, int i, int j, int k, int l, EntityHuman entityhuman) { if (!world.isStatic) { - if (entityhuman.cb() != null && entityhuman.cb().id == Item.SHEARS.id) { + if (entityhuman.cd() != null && entityhuman.cd().id == Item.SHEARS.id) { world.setData(i, j, k, l | 8, 4); } } diff --git a/src/main/java/net/minecraft/server/BlockVine.java b/src/main/java/net/minecraft/server/BlockVine.java index 87da4b42..2b05ac50 100644 --- a/src/main/java/net/minecraft/server/BlockVine.java +++ b/src/main/java/net/minecraft/server/BlockVine.java @@ -300,7 +300,7 @@ public class BlockVine extends Block { } public void a(World world, EntityHuman entityhuman, int i, int j, int k, int l) { - if (!world.isStatic && entityhuman.cb() != null && entityhuman.cb().id == Item.SHEARS.id) { + if (!world.isStatic && entityhuman.cd() != null && entityhuman.cd().id == Item.SHEARS.id) { entityhuman.a(StatisticList.C[this.id], 1); this.b(world, i, j, k, new ItemStack(Block.VINE, 1, 0)); } else { diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java index 7f1c1556..7416edcf 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -88,7 +88,7 @@ public class Chunk { this.sections[k1] = new ChunkSection(k1 << 4, !world.worldProvider.f); } - this.sections[k1].a(l, j1 & 15, i1, b0); + this.sections[k1].setTypeId(l, j1 & 15, i1, b0); } } } @@ -106,7 +106,7 @@ public class Chunk { public int h() { for (int i = this.sections.length - 1; i >= 0; --i) { if (this.sections[i] != null) { - return this.sections[i].d(); + return this.sections[i].getYPosition(); } } @@ -155,7 +155,7 @@ public class Chunk { ChunkSection chunksection = this.sections[i1 >> 4]; if (chunksection != null) { - chunksection.c(j, i1 & 15, k, l); + chunksection.setSkyLight(j, i1 & 15, k, l); this.world.p((this.x << 4) + j, i1, (this.z << 4) + k); } } @@ -273,7 +273,7 @@ public class Chunk { for (l1 = i1; l1 < l; ++l1) { chunksection = this.sections[l1 >> 4]; if (chunksection != null) { - chunksection.c(i, l1 & 15, k, 15); + chunksection.setSkyLight(i, l1 & 15, k, 15); this.world.p((this.x << 4) + i, l1, (this.z << 4) + k); } } @@ -281,7 +281,7 @@ public class Chunk { for (l1 = l; l1 < i1; ++l1) { chunksection = this.sections[l1 >> 4]; if (chunksection != null) { - chunksection.c(i, l1 & 15, k, 0); + chunksection.setSkyLight(i, l1 & 15, k, 0); this.world.p((this.x << 4) + i, l1, (this.z << 4) + k); } } @@ -304,7 +304,7 @@ public class Chunk { ChunkSection chunksection1 = this.sections[i1 >> 4]; if (chunksection1 != null) { - chunksection1.c(i, i1 & 15, k, l1); + chunksection1.setSkyLight(i, i1 & 15, k, l1); } } } @@ -344,7 +344,7 @@ public class Chunk { } else { ChunkSection chunksection = this.sections[j >> 4]; - return chunksection != null ? chunksection.a(i, j & 15, k) : 0; + return chunksection != null ? chunksection.getTypeId(i, j & 15, k) : 0; } } @@ -354,7 +354,7 @@ public class Chunk { } else { ChunkSection chunksection = this.sections[j >> 4]; - return chunksection != null ? chunksection.b(i, j & 15, k) : 0; + return chunksection != null ? chunksection.getData(i, j & 15, k) : 0; } } @@ -391,7 +391,7 @@ public class Chunk { Block.byId[l1].l(this.world, j2, j, k2, i2); } - chunksection.a(i, j & 15, k, l); + chunksection.setTypeId(i, j & 15, k, l); if (l1 != 0) { if (!this.world.isStatic) { Block.byId[l1].remove(this.world, j2, j, k2, l1, i2); @@ -400,10 +400,10 @@ public class Chunk { } } - if (chunksection.a(i, j & 15, k) != l) { + if (chunksection.getTypeId(i, j & 15, k) != l) { return false; } else { - chunksection.b(i, j & 15, k, i1); + chunksection.setData(i, j & 15, k, i1); if (flag) { this.initLighting(); } else { @@ -462,14 +462,14 @@ public class Chunk { if (chunksection == null) { return false; } else { - int i1 = chunksection.b(i, j & 15, k); + int i1 = chunksection.getData(i, j & 15, k); if (i1 == l) { return false; } else { this.l = true; - chunksection.b(i, j & 15, k, l); - int j1 = chunksection.a(i, j & 15, k); + chunksection.setData(i, j & 15, k, l); + int j1 = chunksection.getTypeId(i, j & 15, k); if (j1 > 0 && Block.byId[j1] instanceof IContainer) { TileEntity tileentity = this.e(i, j, k); @@ -488,7 +488,7 @@ public class Chunk { public int getBrightness(EnumSkyBlock enumskyblock, int i, int j, int k) { ChunkSection chunksection = this.sections[j >> 4]; - return chunksection == null ? (this.d(i, j, k) ? enumskyblock.c : 0) : (enumskyblock == EnumSkyBlock.SKY ? (this.world.worldProvider.f ? 0 : chunksection.c(i, j & 15, k)) : (enumskyblock == EnumSkyBlock.BLOCK ? chunksection.d(i, j & 15, k) : enumskyblock.c)); + return chunksection == null ? (this.d(i, j, k) ? enumskyblock.c : 0) : (enumskyblock == EnumSkyBlock.SKY ? (this.world.worldProvider.f ? 0 : chunksection.getSkyLight(i, j & 15, k)) : (enumskyblock == EnumSkyBlock.BLOCK ? chunksection.getEmittedLight(i, j & 15, k) : enumskyblock.c)); } public void a(EnumSkyBlock enumskyblock, int i, int j, int k, int l) { @@ -502,10 +502,10 @@ public class Chunk { this.l = true; if (enumskyblock == EnumSkyBlock.SKY) { if (!this.world.worldProvider.f) { - chunksection.c(i, j & 15, k, l); + chunksection.setSkyLight(i, j & 15, k, l); } } else if (enumskyblock == EnumSkyBlock.BLOCK) { - chunksection.d(i, j & 15, k, l); + chunksection.setEmittedLight(i, j & 15, k, l); } } @@ -515,14 +515,14 @@ public class Chunk { if (chunksection == null) { return !this.world.worldProvider.f && l < EnumSkyBlock.SKY.c ? EnumSkyBlock.SKY.c - l : 0; } else { - int i1 = this.world.worldProvider.f ? 0 : chunksection.c(i, j & 15, k); + int i1 = this.world.worldProvider.f ? 0 : chunksection.getSkyLight(i, j & 15, k); if (i1 > 0) { a = true; } i1 -= l; - int j1 = chunksection.d(i, j & 15, k); + int j1 = chunksection.getEmittedLight(i, j & 15, k); if (j1 > i1) { i1 = j1; @@ -849,7 +849,7 @@ public class Chunk { for (int k = i; k <= j; k += 16) { ChunkSection chunksection = this.sections[k >> 4]; - if (chunksection != null && !chunksection.a()) { + if (chunksection != null && !chunksection.isEmpty()) { return false; } } @@ -903,7 +903,7 @@ public class Chunk { for (int k1 = 0; k1 < 16; ++k1) { int l1 = (j << 4) + k1; - if (this.sections[j] == null && (k1 == 0 || k1 == 15 || k == 0 || k == 15 || l == 0 || l == 15) || this.sections[j] != null && this.sections[j].a(k, k1, l) == 0) { + if (this.sections[j] == null && (k1 == 0 || k1 == 15 || k == 0 || k == 15 || l == 0 || l == 15) || this.sections[j] != null && this.sections[j].getTypeId(k, k1, l) == 0) { if (Block.lightEmission[this.world.getTypeId(i1, l1 - 1, j1)] > 0) { this.world.A(i1, l1 - 1, j1); } diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java index 8b280ab1..b73f69ca 100644 --- a/src/main/java/net/minecraft/server/ChunkProviderServer.java +++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java @@ -270,15 +270,13 @@ public class ChunkProviderServer implements IChunkProvider { } } - if (flag) { - if (this.e == null) { - return true; - } + return true; + } + public void b() { + if (this.e != null) { this.e.b(); } - - return true; } public boolean unloadChunks() { diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java index 3d0c23d6..bee715b7 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -126,7 +126,7 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader { public void a(World world, Chunk chunk) { // CraftBukkit start - "handle" exception try { - world.E(); + world.F(); } catch (ExceptionWorldConflict ex) { ex.printStackTrace(); } @@ -198,7 +198,11 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader { public void a() {} - public void b() {} + public void b() { + while (this.c()) { + ; + } + } private void a(Chunk chunk, World world, NBTTagCompound nbttagcompound) { nbttagcompound.setInt("xPos", chunk.x); @@ -219,18 +223,18 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader { if (chunksection != null) { nbttagcompound1 = new NBTTagCompound(); - nbttagcompound1.setByte("Y", (byte) (chunksection.d() >> 4 & 255)); - nbttagcompound1.setByteArray("Blocks", chunksection.g()); - if (chunksection.i() != null) { - nbttagcompound1.setByteArray("Add", chunksection.i().a); + nbttagcompound1.setByte("Y", (byte) (chunksection.getYPosition() >> 4 & 255)); + nbttagcompound1.setByteArray("Blocks", chunksection.getIdArray()); + if (chunksection.getExtendedIdArray() != null) { + nbttagcompound1.setByteArray("Add", chunksection.getExtendedIdArray().a); } - nbttagcompound1.setByteArray("Data", chunksection.j().a); - nbttagcompound1.setByteArray("BlockLight", chunksection.k().a); + nbttagcompound1.setByteArray("Data", chunksection.getDataArray().a); + nbttagcompound1.setByteArray("BlockLight", chunksection.getEmittedLightArray().a); if (flag) { - nbttagcompound1.setByteArray("SkyLight", chunksection.l().a); + nbttagcompound1.setByteArray("SkyLight", chunksection.getSkyLightArray().a); } else { - nbttagcompound1.setByteArray("SkyLight", new byte[chunksection.k().a.length]); + nbttagcompound1.setByteArray("SkyLight", new byte[chunksection.getEmittedLightArray().a.length]); } nbttaglist.add(nbttagcompound1); @@ -313,15 +317,15 @@ public class ChunkRegionLoader implements IAsyncChunkSaver, IChunkLoader { byte b1 = nbttagcompound1.getByte("Y"); ChunkSection chunksection = new ChunkSection(b1 << 4, flag); - chunksection.a(nbttagcompound1.getByteArray("Blocks")); + chunksection.setIdArray(nbttagcompound1.getByteArray("Blocks")); if (nbttagcompound1.hasKey("Add")) { - chunksection.a(new NibbleArray(nbttagcompound1.getByteArray("Add"), 4)); + chunksection.setExtendedIdArray(new NibbleArray(nbttagcompound1.getByteArray("Add"), 4)); } - chunksection.b(new NibbleArray(nbttagcompound1.getByteArray("Data"), 4)); - chunksection.c(new NibbleArray(nbttagcompound1.getByteArray("BlockLight"), 4)); + chunksection.setDataArray(new NibbleArray(nbttagcompound1.getByteArray("Data"), 4)); + chunksection.setEmittedLightArray(new NibbleArray(nbttagcompound1.getByteArray("BlockLight"), 4)); if (flag) { - chunksection.d(new NibbleArray(nbttagcompound1.getByteArray("SkyLight"), 4)); + chunksection.setSkyLightArray(new NibbleArray(nbttagcompound1.getByteArray("SkyLight"), 4)); } chunksection.recalcBlockCounts(); diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java index bac819f2..3f67a19a 100644 --- a/src/main/java/net/minecraft/server/ChunkSection.java +++ b/src/main/java/net/minecraft/server/ChunkSection.java @@ -8,14 +8,14 @@ public class ChunkSection { private byte[] blockIds; private NibbleArray extBlockIds; private NibbleArray blockData; - private NibbleArray blockLight; + private NibbleArray emittedLight; private NibbleArray skyLight; public ChunkSection(int i, boolean flag) { this.yPos = i; this.blockIds = new byte[4096]; this.blockData = new NibbleArray(this.blockIds.length, 4); - this.blockLight = new NibbleArray(this.blockIds.length, 4); + this.emittedLight = new NibbleArray(this.blockIds.length, 4); if (flag) { this.skyLight = new NibbleArray(this.blockIds.length, 4); } @@ -29,7 +29,7 @@ public class ChunkSection { this.extBlockIds = new NibbleArray(extBlkIds, 4); } this.blockData = new NibbleArray(this.blockIds.length, 4); - this.blockLight = new NibbleArray(this.blockIds.length, 4); + this.emittedLight = new NibbleArray(this.blockIds.length, 4); if (flag) { this.skyLight = new NibbleArray(this.blockIds.length, 4); } @@ -37,13 +37,13 @@ public class ChunkSection { } // CraftBukkit end - public int a(int i, int j, int k) { + public int getTypeId(int i, int j, int k) { int l = this.blockIds[j << 8 | k << 4 | i] & 255; return this.extBlockIds != null ? this.extBlockIds.a(i, j, k) << 8 | l : l; } - public void a(int i, int j, int k, int l) { + public void setTypeId(int i, int j, int k, int l) { int i1 = this.blockIds[j << 8 | k << 4 | i] & 255; if (this.extBlockIds != null) { @@ -78,40 +78,40 @@ public class ChunkSection { } } - public int b(int i, int j, int k) { + public int getData(int i, int j, int k) { return this.blockData.a(i, j, k); } - public void b(int i, int j, int k, int l) { + public void setData(int i, int j, int k, int l) { this.blockData.a(i, j, k, l); } - public boolean a() { + public boolean isEmpty() { return this.nonEmptyBlockCount == 0; } - public boolean b() { + public boolean shouldTick() { return this.tickingBlockCount > 0; } - public int d() { + public int getYPosition() { return this.yPos; } - public void c(int i, int j, int k, int l) { + public void setSkyLight(int i, int j, int k, int l) { this.skyLight.a(i, j, k, l); } - public int c(int i, int j, int k) { + public int getSkyLight(int i, int j, int k) { return this.skyLight.a(i, j, k); } - public void d(int i, int j, int k, int l) { - this.blockLight.a(i, j, k, l); + public void setEmittedLight(int i, int j, int k, int l) { + this.emittedLight.a(i, j, k, l); } - public int d(int i, int j, int k) { - return this.blockLight.a(i, j, k); + public int getEmittedLight(int i, int j, int k) { + return this.emittedLight.a(i, j, k); } public void recalcBlockCounts() { @@ -178,7 +178,7 @@ public class ChunkSection { for (int i = 0; i < 16; ++i) { for (int j = 0; j < 16; ++j) { for (int k = 0; k < 16; ++k) { - int l = this.a(i, j, k); + int l = this.getTypeId(i, j, k); if (l > 0) { if (Block.byId[l] == null) { @@ -198,31 +198,31 @@ public class ChunkSection { } } - public byte[] g() { + public byte[] getIdArray() { return this.blockIds; } - public NibbleArray i() { + public NibbleArray getExtendedIdArray() { return this.extBlockIds; } - public NibbleArray j() { + public NibbleArray getDataArray() { return this.blockData; } - public NibbleArray k() { - return this.blockLight; + public NibbleArray getEmittedLightArray() { + return this.emittedLight; } - public NibbleArray l() { + public NibbleArray getSkyLightArray() { return this.skyLight; } - public void a(byte[] abyte) { + public void setIdArray(byte[] abyte) { this.blockIds = this.validateByteArray(abyte); // CraftBukkit - Validate data } - public void a(NibbleArray nibblearray) { + public void setExtendedIdArray(NibbleArray nibblearray) { // CraftBukkit start - Don't hang on to an empty nibble array boolean empty = true; for (int i = 0; i < nibblearray.a.length; i++) { @@ -240,15 +240,15 @@ public class ChunkSection { this.extBlockIds = this.validateNibbleArray(nibblearray); // CraftBukkit - Validate data } - public void b(NibbleArray nibblearray) { + public void setDataArray(NibbleArray nibblearray) { this.blockData = this.validateNibbleArray(nibblearray); // CraftBukkit - Validate data } - public void c(NibbleArray nibblearray) { - this.blockLight = this.validateNibbleArray(nibblearray); // CraftBukkit - Validate data + public void setEmittedLightArray(NibbleArray nibblearray) { + this.emittedLight = this.validateNibbleArray(nibblearray); // CraftBukkit - Validate data } - public void d(NibbleArray nibblearray) { + public void setSkyLightArray(NibbleArray nibblearray) { this.skyLight = this.validateNibbleArray(nibblearray); // CraftBukkit - Validate data } diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java index b44c2ff1..e9ba2f42 100644 --- a/src/main/java/net/minecraft/server/Container.java +++ b/src/main/java/net/minecraft/server/Container.java @@ -310,7 +310,7 @@ public abstract class Container { if (slot2.d() && flag) { itemstack3 = slot2.getItem(); - playerinventory.setItem(j, itemstack3); + playerinventory.setItem(j, itemstack3.cloneItemStack()); if ((slot2.inventory != playerinventory || !slot2.isAllowed(itemstack1)) && itemstack1 != null) { if (k1 > -1) { playerinventory.pickup(itemstack1); @@ -337,7 +337,7 @@ public abstract class Container { } } else if (k == 4 && playerinventory.getCarried() == null && i >= 0) { slot2 = (Slot) this.c.get(i); - if (slot2 != null && slot2.d() && slot2.a(entityhuman)) { // CraftBukkit - Validate before dropping + if (slot2 != null && slot2.d() && slot2.a(entityhuman)) { itemstack1 = slot2.a(j == 0 ? 1 : slot2.getItem().count); slot2.a(entityhuman, itemstack1); entityhuman.drop(itemstack1); diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java index 9aaa8f96..d7cee91d 100644 --- a/src/main/java/net/minecraft/server/ContainerAnvil.java +++ b/src/main/java/net/minecraft/server/ContainerAnvil.java @@ -202,7 +202,7 @@ public class ContainerAnvil extends Container { } } - if (this.m != null && !this.m.equalsIgnoreCase(itemstack.getName()) && this.m.length() > 0) { + if (this.m != null && this.m.length() > 0 && !this.m.equalsIgnoreCase(this.n.getLocale().c(itemstack.a())) && !this.m.equals(itemstack.getName())) { j = itemstack.g() ? 7 : itemstack.count * 5; i += j; if (itemstack.hasName()) { diff --git a/src/main/java/net/minecraft/server/ContainerHopper.java b/src/main/java/net/minecraft/server/ContainerHopper.java index 83b95d13..68c3d68a 100644 --- a/src/main/java/net/minecraft/server/ContainerHopper.java +++ b/src/main/java/net/minecraft/server/ContainerHopper.java @@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView; public class ContainerHopper extends Container { - private final IInventory a; + private final IInventory hopper; // CraftBukkit start private CraftInventoryView bukkitEntity = null; @@ -18,14 +18,14 @@ public class ContainerHopper extends Container { return bukkitEntity; } - CraftInventory inventory = new CraftInventory(this.a); // Should be this.hopper + CraftInventory inventory = new CraftInventory(this.hopper); bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this); return bukkitEntity; } // CraftBukkit end public ContainerHopper(PlayerInventory playerinventory, IInventory iinventory) { - this.a = iinventory; + this.hopper = iinventory; this.player = playerinventory; // CraftBukkit - save player iinventory.startOpen(); byte b0 = 51; @@ -49,7 +49,7 @@ public class ContainerHopper extends Container { public boolean a(EntityHuman entityhuman) { if (!this.checkReachable) return true; // CraftBukkit - return this.a.a(entityhuman); + return this.hopper.a(entityhuman); } public ItemStack b(EntityHuman entityhuman, int i) { @@ -60,11 +60,11 @@ public class ContainerHopper extends Container { ItemStack itemstack1 = slot.getItem(); itemstack = itemstack1.cloneItemStack(); - if (i < this.a.getSize()) { - if (!this.a(itemstack1, this.a.getSize(), this.c.size(), true)) { + if (i < this.hopper.getSize()) { + if (!this.a(itemstack1, this.hopper.getSize(), this.c.size(), true)) { return null; } - } else if (!this.a(itemstack1, 0, this.a.getSize(), false)) { + } else if (!this.a(itemstack1, 0, this.hopper.getSize(), false)) { return null; } @@ -80,6 +80,6 @@ public class ContainerHopper extends Container { public void b(EntityHuman entityhuman) { super.b(entityhuman); - this.a.g(); + this.hopper.g(); } } diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java index 32bae80d..b6dc7900 100644 --- a/src/main/java/net/minecraft/server/CraftingManager.java +++ b/src/main/java/net/minecraft/server/CraftingManager.java @@ -260,7 +260,7 @@ public class CraftingManager { } } - if (i == 2 && itemstack.id == itemstack1.id && itemstack.count == 1 && itemstack1.count == 1 && Item.byId[itemstack.id].o()) { + if (i == 2 && itemstack.id == itemstack1.id && itemstack.count == 1 && itemstack1.count == 1 && Item.byId[itemstack.id].usesDurability()) { Item item = Item.byId[itemstack.id]; int k = item.getMaxDurability() - itemstack.j(); int l = item.getMaxDurability() - itemstack1.j(); diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java index bd7e41c1..7261dc92 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -48,7 +48,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer System.setErr(new PrintStream(new LoggerOutputStream(this.getLogger().getLogger(), Level.SEVERE), true)); // CraftBukkit end - this.getLogger().info("Starting minecraft server version 1.5.1"); + this.getLogger().info("Starting minecraft server version 1.5.2"); if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { this.getLogger().warning("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } @@ -68,6 +68,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer this.setAllowFlight(this.propertyManager.getBoolean("allow-flight", false)); this.setTexturePack(this.propertyManager.getString("texture-pack", "")); this.setMotd(this.propertyManager.getString("motd", "A Minecraft Server")); + this.setForceGamemode(this.propertyManager.getBoolean("force-gamemode", false)); if (this.propertyManager.getInt("difficulty", 1) < 0) { this.propertyManager.a("difficulty", Integer.valueOf(0)); } else if (this.propertyManager.getInt("difficulty", 1) > 3) { @@ -200,7 +201,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer protected void a(CrashReport crashreport) { while (this.isRunning()) { - this.am(); + this.an(); try { Thread.sleep(10L); @@ -223,7 +224,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer public void r() { // CraftBukkit - protected -> public super.r(); - this.am(); + this.an(); } public boolean getAllowNether() { @@ -235,8 +236,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } public void a(MojangStatisticsGenerator mojangstatisticsgenerator) { - mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.an().getHasWhitelist())); - mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.an().getWhitelisted().size())); + mojangstatisticsgenerator.a("whitelist_enabled", Boolean.valueOf(this.ao().getHasWhitelist())); + mojangstatisticsgenerator.a("whitelist_count", Integer.valueOf(this.ao().getWhitelisted().size())); super.a(mojangstatisticsgenerator); } @@ -248,7 +249,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer this.k.add(new ServerCommand(s, icommandlistener)); } - public void am() { + public void an() { while (!this.k.isEmpty()) { ServerCommand servercommand = (ServerCommand) this.k.remove(0); @@ -267,7 +268,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer return true; } - public DedicatedPlayerList an() { + public DedicatedPlayerList ao() { return (DedicatedPlayerList) super.getPlayerList(); } @@ -301,7 +302,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer return file1 != null ? file1.getAbsolutePath() : "No settings file"; } - public void ao() { + public void ap() { ServerGUI.a(this); this.s = true; } @@ -325,9 +326,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer public boolean a(World world, int i, int j, int k, EntityHuman entityhuman) { if (world.worldProvider.dimension != 0) { return false; - } else if (this.an().getOPs().isEmpty()) { + } else if (this.ao().getOPs().isEmpty()) { return false; - } else if (this.an().isOp(entityhuman.name)) { + } else if (this.ao().isOp(entityhuman.name)) { return false; } else if (this.getSpawnProtection() <= 0) { return false; @@ -346,6 +347,6 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } public PlayerList getPlayerList() { - return this.an(); + return this.ao(); } } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java index d510392e..943a6ab3 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -1354,7 +1354,7 @@ public abstract class Entity { public void U() { if (this.passenger != null) { - if (!(this.passenger instanceof EntityHuman) || !((EntityHuman) this.passenger).ce()) { + if (!(this.passenger instanceof EntityHuman) || !((EntityHuman) this.passenger).cg()) { this.passenger.U = this.U; this.passenger.V = this.V + this.W() + this.passenger.V(); this.passenger.W = this.W; @@ -1694,7 +1694,7 @@ public abstract class Entity { return this == entity; } - public float ao() { + public float getHeadRotation() { return 0.0F; } @@ -1747,7 +1747,7 @@ public abstract class Entity { Location exit = exitWorld != null ? minecraftserver.getPlayerList().calculateTarget(enter, minecraftserver.getWorldServer(i)) : null; boolean useTravelAgent = exitWorld != null && !(this.dimension == 1 && exitWorld.dimension == 1); // don't use agent for custom worlds or return from THE_END - TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().s() : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins + TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().t() : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins EntityPortalEvent event = new EntityPortalEvent(this.getBukkitEntity(), enter, exit, agent); event.useTravelAgent(useTravelAgent); event.getEntity().getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java index 8d6381bb..acafa6cb 100644 --- a/src/main/java/net/minecraft/server/EntityBoat.java +++ b/src/main/java/net/minecraft/server/EntityBoat.java @@ -294,7 +294,7 @@ public class EntityBoat extends Entity { this.move(this.motX, this.motY, this.motZ); if (this.positionChanged && d3 > 0.2D) { - if (!this.world.isStatic && !this.dead) { // CraftBukkit - That which is dead cannot die + if (!this.world.isStatic && !this.dead) { // CraftBukkit start Vehicle vehicle = (Vehicle) this.getBukkitEntity(); VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, null); diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java index c82487e5..e1be9b0c 100644 --- a/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java @@ -11,6 +11,7 @@ public class EntityEnderman extends EntityMonster { private static boolean[] d = new boolean[256]; private int e = 0; private int f = 0; + private boolean g; public EntityEnderman(World world) { super(world); @@ -48,6 +49,7 @@ public class EntityEnderman extends EntityMonster { if (entityhuman != null) { if (this.e(entityhuman)) { + this.g = true; if (this.f == 0) { this.world.makeSound(entityhuman, "mob.endermen.stare", 1.0F, 1.0F); } @@ -133,12 +135,13 @@ public class EntityEnderman extends EntityMonster { this.world.addParticle("portal", this.locX + (this.random.nextDouble() - 0.5D) * (double) this.width, this.locY + this.random.nextDouble() * (double) this.length - 0.25D, this.locZ + (this.random.nextDouble() - 0.5D) * (double) this.width, (this.random.nextDouble() - 0.5D) * 2.0D, -this.random.nextDouble(), (this.random.nextDouble() - 0.5D) * 2.0D); } - if (this.world.u() && !this.world.isStatic) { + if (this.world.v() && !this.world.isStatic) { float f = this.c(1.0F); if (f > 0.5F && this.world.l(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F) { this.target = null; this.a(false); + this.g = false; this.m(); } } @@ -146,9 +149,14 @@ public class EntityEnderman extends EntityMonster { if (this.F() || this.isBurning()) { this.target = null; this.a(false); + this.g = false; this.m(); } + if (this.q() && !this.g && this.random.nextInt(100) == 0) { + this.a(false); + } + this.bG = false; if (this.target != null) { this.a(this.target, 100.0F, 100.0F); @@ -319,7 +327,13 @@ public class EntityEnderman extends EntityMonster { return false; } else { this.a(true); + if (damagesource instanceof EntityDamageSource && damagesource.getEntity() instanceof EntityHuman) { + this.g = true; + } + if (damagesource instanceof EntityDamageSourceIndirect) { + this.g = false; + for (int j = 0; j < 64; ++j) { if (this.m()) { return true; diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java index a3bb5d0d..fbae2934 100644 --- a/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java @@ -93,7 +93,7 @@ public class EntityFishingHook extends Entity { this.b(this.yaw, this.pitch); } else { if (!this.world.isStatic) { - ItemStack itemstack = this.owner.cb(); + ItemStack itemstack = this.owner.cd(); if (this.owner.dead || !this.owner.isAlive() || itemstack == null || itemstack.getItem() != Item.FISHING_ROD || this.e(this.owner) > 1024.0D) { this.die(); diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java index d647d2ef..6ea27779 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -90,19 +90,19 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.datawatcher.a(18, Integer.valueOf(0)); } - public boolean bV() { + public boolean bX() { return this.f != null; } - public void bX() { + public void bZ() { if (this.f != null) { this.f.b(this.world, this, this.g); } - this.bY(); + this.ca(); } - public void bY() { + public void ca() { this.f = null; this.g = 0; if (!this.world.isStatic) { @@ -110,8 +110,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } - public boolean bk() { - return this.bV() && Item.byId[this.f.id].b_(this.f) == EnumAnimation.BLOCK; + public boolean isBlocking() { + return this.bX() && Item.byId[this.f.id].b_(this.f) == EnumAnimation.BLOCK; } public void l_() { @@ -127,7 +127,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen this.m(); } } else { - this.bY(); + this.ca(); } } @@ -144,7 +144,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen if (!this.world.isStatic) { if (!this.i()) { this.a(true, true, false); - } else if (this.world.u()) { + } else if (this.world.v()) { this.a(false, true, true); } } @@ -284,7 +284,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } - this.bY(); + this.ca(); } } @@ -747,7 +747,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return this.inventory.l(); } - public float ca() { + public float cc() { int i = 0; ItemStack[] aitemstack = this.inventory.armor; int j = aitemstack.length; @@ -765,7 +765,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen protected void d(DamageSource damagesource, int i) { if (!this.isInvulnerable()) { - if (!damagesource.ignoresArmor() && this.bk()) { + if (!damagesource.ignoresArmor() && this.isBlocking()) { i = 1 + i >> 1; } @@ -797,7 +797,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen if (entity.a_(this)) { return true; } else { - ItemStack itemstack = this.cb(); + ItemStack itemstack = this.cd(); if (itemstack != null && entity instanceof EntityLiving) { if (this.abilities.canInstantlyBuild) { @@ -807,7 +807,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen if (itemstack.a((EntityLiving) entity)) { // CraftBukkit - bypass infinite items; <= 0 -> == 0 if (itemstack.count == 0 && !this.abilities.canInstantlyBuild) { - this.cc(); + this.ce(); } return true; @@ -818,11 +818,11 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } - public ItemStack cb() { + public ItemStack cd() { return this.inventory.getItemInHand(); } - public void cc() { + public void ce() { this.inventory.setItem(this.inventory.itemInHandIndex, (ItemStack) null); } @@ -908,7 +908,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } } - ItemStack itemstack = this.cb(); + ItemStack itemstack = this.cd(); Object object = entity; if (entity instanceof EntityComplexPart) { @@ -923,7 +923,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen itemstack.a((EntityLiving) object, this); // CraftBukkit - bypass infinite items; <= 0 -> == 0 if (itemstack.count == 0) { - this.cc(); + this.ce(); } } @@ -969,7 +969,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return !this.sleeping && super.inBlock(); } - public boolean ce() { + public boolean cg() { return false; } @@ -983,7 +983,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return EnumBedResult.NOT_POSSIBLE_HERE; } - if (this.world.u()) { + if (this.world.v()) { return EnumBedResult.NOT_POSSIBLE_NOW; } @@ -1130,7 +1130,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } public static ChunkCoordinates getBed(World world, ChunkCoordinates chunkcoordinates, boolean flag) { - IChunkProvider ichunkprovider = world.J(); + IChunkProvider ichunkprovider = world.K(); ichunkprovider.getChunkAt(chunkcoordinates.x - 3 >> 4, chunkcoordinates.z - 3 >> 4); ichunkprovider.getChunkAt(chunkcoordinates.x + 3 >> 4, chunkcoordinates.z - 3 >> 4); @@ -1368,7 +1368,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return (flag || this.foodData.c()) && !this.abilities.isInvulnerable; } - public boolean cm() { + public boolean co() { return this.getHealth() > 0 && this.getHealth() < this.maxHealth; // CraftBukkit - this.getMaxHealth() -> this.maxHealth } @@ -1395,8 +1395,8 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen return true; } - if (this.cb() != null) { - ItemStack itemstack = this.cb(); + if (this.cd() != null) { + ItemStack itemstack = this.cd(); if (itemstack.b(block) || itemstack.a(block) > 1.0F) { return true; @@ -1435,7 +1435,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen } /* CraftBukkit start - We use canPickUpLoot on players, can't have this - public boolean bS() { + public boolean bT() { return false; } // CraftBukkit end */ diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index f8dd4177..965e6ce4 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -18,7 +18,7 @@ public abstract class EntityLiving extends Entity { private static final float[] b = new float[] { 0.0F, 0.0F, 0.1F, 0.2F}; private static final float[] c = new float[] { 0.0F, 0.0F, 0.25F, 0.5F}; - private static final float[] d = new float[] { 0.0F, 0.0F, 0.05F, 0.02F}; + private static final float[] d = new float[] { 0.0F, 0.0F, 0.05F, 0.07F}; public static final float[] au = new float[] { 0.0F, 0.1F, 0.15F, 0.45F}; public int maxNoDamageTicks = 20; public float aw; @@ -89,7 +89,7 @@ public abstract class EntityLiving extends Entity { public int bs = 0; public boolean canPickUpLoot = false; // CraftBukkit - protected -> public public boolean persistent = !this.isTypeNotPersistent(); // CraftBukkit - private -> public, change value - protected final CombatTracker bt = new CombatTracker(this); + protected CombatTracker bt = new CombatTracker(this); // CraftBukkit - remove final protected int bu; protected double bv; protected double bw; @@ -158,7 +158,7 @@ public abstract class EntityLiving extends Entity { return this.navigation; } - public EntitySenses aD() { + public EntitySenses getEntitySenses() { return this.bP; } @@ -184,7 +184,7 @@ public abstract class EntityLiving extends Entity { return this.bC; } - public float ao() { + public float getHeadRotation() { return this.aA; } @@ -1131,7 +1131,7 @@ public abstract class EntityLiving extends Entity { nbttagcompound.setShort("HurtTime", (short) this.hurtTicks); nbttagcompound.setShort("DeathTime", (short) this.deathTicks); nbttagcompound.setShort("AttackTime", (short) this.attackTicks); - nbttagcompound.setBoolean("CanPickUpLoot", this.bS()); + nbttagcompound.setBoolean("CanPickUpLoot", this.bT()); nbttagcompound.setBoolean("PersistenceRequired", this.persistent); NBTTagList nbttaglist = new NBTTagList(); @@ -1340,7 +1340,7 @@ public abstract class EntityLiving extends Entity { this.world.methodProfiler.b(); this.world.methodProfiler.a("looting"); // CraftBukkit - Don't run mob pickup code on players - if (!this.world.isStatic && !(this instanceof EntityPlayer) && this.bS() && !this.bd && this.world.getGameRules().getBoolean("mobGriefing")) { + if (!this.world.isStatic && !(this instanceof EntityPlayer) && this.bT() && !this.bd && this.world.getGameRules().getBoolean("mobGriefing")) { List list = this.world.a(EntityItem.class, this.boundingBox.grow(1.0D, 0.0D, 1.0D)); Iterator iterator = list.iterator(); @@ -1442,7 +1442,7 @@ public abstract class EntityLiving extends Entity { return this.health <= 0; } - public boolean bk() { + public boolean isBlocking() { return false; } @@ -1759,11 +1759,13 @@ public abstract class EntityLiving extends Entity { } public boolean hasEffect(int i) { - return this.effects.containsKey(Integer.valueOf(i)); + // CraftBukkit - Add size check for efficiency + return this.effects.size() != 0 && this.effects.containsKey(Integer.valueOf(i)); } public boolean hasEffect(MobEffectList mobeffectlist) { - return this.effects.containsKey(Integer.valueOf(mobeffectlist.id)); + // CraftBukkit - Add size check for efficiency + return this.effects.size() != 0 && this.effects.containsKey(Integer.valueOf(mobeffectlist.id)); } public MobEffect getEffect(MobEffectList mobeffectlist) { @@ -2136,11 +2138,15 @@ public abstract class EntityLiving extends Entity { this.dropChances[i] = f; } - public boolean bS() { + public boolean bT() { return this.canPickUpLoot; } public void h(boolean flag) { this.canPickUpLoot = flag; } + + public boolean bU() { + return this.persistent; + } } diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java index da9d5c6b..e9d15405 100644 --- a/src/main/java/net/minecraft/server/EntityMonster.java +++ b/src/main/java/net/minecraft/server/EntityMonster.java @@ -129,7 +129,7 @@ public abstract class EntityMonster extends EntityCreature implements IMonster { } else { int l = this.world.getLightLevel(i, j, k); - if (this.world.N()) { + if (this.world.O()) { int i1 = this.world.j; this.world.j = 10; diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java index e1589354..3b08937a 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -91,7 +91,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); if (nbttagcompound.hasKey("playerGameType")) { - this.playerInteractManager.setGameMode(EnumGamemode.a(nbttagcompound.getInt("playerGameType"))); + if (MinecraftServer.getServer().getForceGamemode()) { + this.playerInteractManager.setGameMode(MinecraftServer.getServer().getGamemode()); + } else { + this.playerInteractManager.setGameMode(EnumGamemode.a(nbttagcompound.getInt("playerGameType"))); + } } this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit } @@ -873,8 +877,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.expTotal = this.newTotalExp; this.exp = 0; this.deathTicks = 0; - effects.clear(); + this.effects.clear(); + this.updateEffects = true; this.activeContainer = this.defaultContainer; + this.killer = null; + this.lastDamager = null; + this.bt = new CombatTracker(this); // Should be combatTracker this.lastSentExp = -1; if (this.keepLevel || keepInventory) { this.exp = exp; diff --git a/src/main/java/net/minecraft/server/EntitySkeleton.java b/src/main/java/net/minecraft/server/EntitySkeleton.java index 007554a5..94946271 100644 --- a/src/main/java/net/minecraft/server/EntitySkeleton.java +++ b/src/main/java/net/minecraft/server/EntitySkeleton.java @@ -87,7 +87,7 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity { } public void c() { - if (this.world.u() && !this.world.isStatic) { + if (this.world.v() && !this.world.isStatic) { float f = this.c(1.0F); if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.l(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) { @@ -207,7 +207,7 @@ public class EntitySkeleton extends EntityMonster implements IRangedEntity { this.h(this.random.nextFloat() < au[this.world.difficulty]); if (this.getEquipment(4) == null) { - Calendar calendar = this.world.U(); + Calendar calendar = this.world.V(); if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.random.nextFloat() < 0.25F) { this.setEquipment(4, new ItemStack(this.random.nextFloat() < 0.1F ? Block.JACK_O_LANTERN : Block.PUMPKIN)); diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java index 5f12aaca..f6a0c9e6 100644 --- a/src/main/java/net/minecraft/server/EntitySlime.java +++ b/src/main/java/net/minecraft/server/EntitySlime.java @@ -241,7 +241,7 @@ public class EntitySlime extends EntityLiving implements IMonster { if (this.getSize() == 1 || this.world.difficulty > 0) { BiomeBase biomebase = this.world.getBiome(MathHelper.floor(this.locX), MathHelper.floor(this.locZ)); - if (biomebase == BiomeBase.SWAMPLAND && this.locY > 50.0D && this.locY < 70.0D && this.random.nextFloat() < 0.5F && this.random.nextFloat() < e[this.world.v()] && this.world.getLightLevel(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) <= this.random.nextInt(8)) { + if (biomebase == BiomeBase.SWAMPLAND && this.locY > 50.0D && this.locY < 70.0D && this.random.nextFloat() < 0.5F && this.random.nextFloat() < e[this.world.w()] && this.world.getLightLevel(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ)) <= this.random.nextInt(8)) { return super.canSpawn(); } diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java index 65cc4e84..5c037329 100644 --- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java +++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java @@ -46,7 +46,7 @@ public class EntityTrackerEntry { 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); - this.i = MathHelper.d(entity.ao() * 256.0F / 360.0F); + this.i = MathHelper.d(entity.getHeadRotation() * 256.0F / 360.0F); } public boolean equals(Object object) { @@ -132,7 +132,7 @@ public class EntityTrackerEntry { } // CraftBukkit end - if (this.m > 0) { + if (this.m > 0 || this.tracker instanceof EntityArrow) { if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.u <= 400 && !this.w) { if (flag && flag1) { object = new Packet33RelEntityMoveLook(this.tracker.id, (byte) j1, (byte) k1, (byte) l1, (byte) l, (byte) i1); @@ -214,7 +214,7 @@ public class EntityTrackerEntry { this.w = true; } - i = MathHelper.d(this.tracker.ao() * 256.0F / 360.0F); + i = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F); if (Math.abs(i - this.i) >= 4) { this.broadcast(new Packet35EntityHeadRotation(this.tracker.id, (byte) i)); this.i = i; @@ -345,7 +345,7 @@ public class EntityTrackerEntry { } // CraftBukkit start - Fix for nonsensical head yaw - this.i = MathHelper.d(this.tracker.ao() * 256.0F / 360.0F); // tracker.ao() should be getHeadRotation + this.i = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F); // tracker.ao() should be getHeadRotation this.broadcast(new Packet35EntityHeadRotation(this.tracker.id, (byte) i)); // CraftBukkit end @@ -468,7 +468,7 @@ public class EntityTrackerEntry { } } } else { - this.i = MathHelper.d(this.tracker.ao() * 256.0F / 360.0F); + this.i = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F); return new Packet24MobSpawn((EntityLiving) this.tracker); } } diff --git a/src/main/java/net/minecraft/server/EntityWolf.java b/src/main/java/net/minecraft/server/EntityWolf.java index 15808442..132b55f9 100644 --- a/src/main/java/net/minecraft/server/EntityWolf.java +++ b/src/main/java/net/minecraft/server/EntityWolf.java @@ -76,7 +76,6 @@ public class EntityWolf extends EntityTameableAnimal { } protected boolean isTypeNotPersistent() { - // CraftBukkit - added && !this.isTamed() return this.isAngry() && !this.isTamed(); } @@ -114,13 +113,13 @@ public class EntityWolf extends EntityTameableAnimal { public void l_() { super.l_(); this.f = this.e; - if (this.bW()) { + if (this.bY()) { this.e += (1.0F - this.e) * 0.4F; } else { this.e += (0.0F - this.e) * 0.4F; } - if (this.bW()) { + if (this.bY()) { this.bJ = 10; } @@ -329,7 +328,7 @@ public class EntityWolf extends EntityTameableAnimal { } } - public boolean bW() { + public boolean bY() { return this.datawatcher.getByte(19) == 1; } diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java index 0da473ba..7c717a60 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -81,7 +81,7 @@ public class EntityZombie extends EntityMonster { } public void c() { - if (this.world.u() && !this.world.isStatic && !this.isBaby()) { + if (this.world.v() && !this.world.isStatic && !this.isBaby()) { float f = this.c(1.0F); if (f > 0.5F && this.random.nextFloat() * 30.0F < (f - 0.4F) * 2.0F && this.world.l(MathHelper.floor(this.locX), MathHelper.floor(this.locY), MathHelper.floor(this.locZ))) { @@ -275,7 +275,7 @@ public class EntityZombie extends EntityMonster { this.bH(); this.bI(); if (this.getEquipment(4) == null) { - Calendar calendar = this.world.U(); + Calendar calendar = this.world.V(); if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.random.nextFloat() < 0.25F) { this.setEquipment(4, new ItemStack(this.random.nextFloat() < 0.1F ? Block.JACK_O_LANTERN : Block.PUMPKIN)); @@ -285,7 +285,7 @@ public class EntityZombie extends EntityMonster { } public boolean a_(EntityHuman entityhuman) { - ItemStack itemstack = entityhuman.cb(); + ItemStack itemstack = entityhuman.cd(); if (itemstack != null && itemstack.getItem() == Item.GOLDEN_APPLE && itemstack.getData() == 0 && this.isVillager() && this.hasEffect(MobEffectList.WEAKNESS)) { if (!entityhuman.abilities.canInstantlyBuild) { diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java index 80e9d938..f26d5522 100644 --- a/src/main/java/net/minecraft/server/FoodMetaData.java +++ b/src/main/java/net/minecraft/server/FoodMetaData.java @@ -44,7 +44,7 @@ public class FoodMetaData { } } - if (this.foodLevel >= 18 && entityhuman.cm()) { + if (this.foodLevel >= 18 && entityhuman.co()) { ++this.foodTickTimer; if (this.foodTickTimer >= 80) { // CraftBukkit - added RegainReason diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java index 7dc36a82..343b8cb5 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -158,7 +158,7 @@ public final class ItemStack { return; } - if (!(this.usesData() || Item.byId[this.id].o() || this.id > 255)) { // Should be usesDurability + if (!(this.usesData() || Item.byId[this.id].usesDurability() || this.id > 255)) { i = 0; } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 3ee8ddc9..3e134fb7 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -70,6 +70,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo private long Q; private String R; private boolean S; + private boolean T = false; // CraftBukkit start public List<WorldServer> worlds = new ArrayList<WorldServer>(); @@ -89,7 +90,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo // this.universe = file1; // CraftBukkit this.p = new CommandDispatcher(); // this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved to DedicatedServer.init - this.am(); + this.an(); // CraftBukkit start this.options = options; @@ -116,7 +117,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo public abstract PropertyManager getPropertyManager(); // CraftBukkit end - private void am() { + private void an() { DispenserRegistry.a(); } @@ -689,7 +690,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo } if (flag) { - dedicatedserver.ao(); + dedicatedserver.ap(); } */ @@ -746,7 +747,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo } public String getVersion() { - return "1.5.1"; + return "1.5.2"; } public int y() { @@ -1048,7 +1049,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo mojangstatisticsgenerator.a("world[" + i + "][generator_name]", worlddata.getType().name()); mojangstatisticsgenerator.a("world[" + i + "][generator_version]", Integer.valueOf(worlddata.getType().getVersion())); mojangstatisticsgenerator.a("world[" + i + "][height]", Integer.valueOf(this.C)); - mojangstatisticsgenerator.a("world[" + i + "][chunks_loaded]", Integer.valueOf(worldserver.J().getLoadedChunks())); + mojangstatisticsgenerator.a("world[" + i + "][chunks_loaded]", Integer.valueOf(worldserver.K().getLoadedChunks())); ++i; // } // CraftBukkit } @@ -1181,6 +1182,14 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo public abstract IConsoleLogManager getLogger(); + public void setForceGamemode(boolean flag) { + this.T = flag; + } + + public boolean getForceGamemode() { + return this.T; + } + public static PlayerList a(MinecraftServer minecraftserver) { return minecraftserver.s; } diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java index 36435959..1b367da9 100644 --- a/src/main/java/net/minecraft/server/Packet.java +++ b/src/main/java/net/minecraft/server/Packet.java @@ -219,7 +219,7 @@ public abstract class Packet { dataoutputstream.writeShort(itemstack.getData()); NBTTagCompound nbttagcompound = null; - if (itemstack.getItem().o() || itemstack.getItem().r()) { + if (itemstack.getItem().usesDurability() || itemstack.getItem().r()) { nbttagcompound = itemstack.tag; } diff --git a/src/main/java/net/minecraft/server/Packet51MapChunk.java b/src/main/java/net/minecraft/server/Packet51MapChunk.java index 14a62455..97c953bb 100644 --- a/src/main/java/net/minecraft/server/Packet51MapChunk.java +++ b/src/main/java/net/minecraft/server/Packet51MapChunk.java @@ -116,9 +116,9 @@ public class Packet51MapChunk extends Packet { int l; for (l = 0; l < achunksection.length; ++l) { - if (achunksection[l] != null && (!flag || !achunksection[l].a()) && (i & 1 << l) != 0) { + if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { chunkmap.b |= 1 << l; - if (achunksection[l].i() != null) { + if (achunksection[l].getExtendedIdArray() != null) { chunkmap.c |= 1 << l; ++k; } @@ -126,8 +126,8 @@ public class Packet51MapChunk extends Packet { } for (l = 0; l < achunksection.length; ++l) { - if (achunksection[l] != null && (!flag || !achunksection[l].a()) && (i & 1 << l) != 0) { - byte[] abyte1 = achunksection[l].g(); + if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { + byte[] abyte1 = achunksection[l].getIdArray(); System.arraycopy(abyte1, 0, abyte, j, abyte1.length); j += abyte1.length; @@ -137,16 +137,16 @@ public class Packet51MapChunk extends Packet { NibbleArray nibblearray; for (l = 0; l < achunksection.length; ++l) { - if (achunksection[l] != null && (!flag || !achunksection[l].a()) && (i & 1 << l) != 0) { - nibblearray = achunksection[l].j(); + if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { + nibblearray = achunksection[l].getDataArray(); System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); j += nibblearray.a.length; } } for (l = 0; l < achunksection.length; ++l) { - if (achunksection[l] != null && (!flag || !achunksection[l].a()) && (i & 1 << l) != 0) { - nibblearray = achunksection[l].k(); + if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { + nibblearray = achunksection[l].getEmittedLightArray(); System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); j += nibblearray.a.length; } @@ -154,8 +154,8 @@ public class Packet51MapChunk extends Packet { if (!chunk.world.worldProvider.f) { for (l = 0; l < achunksection.length; ++l) { - if (achunksection[l] != null && (!flag || !achunksection[l].a()) && (i & 1 << l) != 0) { - nibblearray = achunksection[l].l(); + if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && (i & 1 << l) != 0) { + nibblearray = achunksection[l].getSkyLightArray(); System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); j += nibblearray.a.length; } @@ -164,8 +164,8 @@ public class Packet51MapChunk extends Packet { if (k > 0) { for (l = 0; l < achunksection.length; ++l) { - if (achunksection[l] != null && (!flag || !achunksection[l].a()) && achunksection[l].i() != null && (i & 1 << l) != 0) { - nibblearray = achunksection[l].i(); + if (achunksection[l] != null && (!flag || !achunksection[l].isEmpty()) && achunksection[l].getExtendedIdArray() != null && (i & 1 << l) != 0) { + nibblearray = achunksection[l].getExtendedIdArray(); System.arraycopy(nibblearray.a, 0, abyte, j, nibblearray.a.length); j += nibblearray.a.length; } diff --git a/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java b/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java index 685af68e..5470591b 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalArrowAttack.java @@ -63,7 +63,7 @@ public class PathfinderGoalArrowAttack extends PathfinderGoal { public void e() { double d0 = this.a.e(this.c.locX, this.c.boundingBox.b, this.c.locZ); - boolean flag = this.a.aD().canSee(this.c); + boolean flag = this.a.getEntitySenses().canSee(this.c); if (flag) { ++this.f; diff --git a/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java index 7ccb12d6..e5d13f5f 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalMeleeAttack.java @@ -65,7 +65,7 @@ public class PathfinderGoalMeleeAttack extends PathfinderGoal { public void e() { this.b.getControllerLook().a(this.c, 30.0F, 30.0F); - if ((this.f || this.b.aD().canSee(this.c)) && --this.i <= 0) { + if ((this.f || this.b.getEntitySenses().canSee(this.c)) && --this.i <= 0) { this.i = 4 + this.b.aE().nextInt(7); this.b.getNavigation().a(this.c, this.e); } diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java index f6110a23..0dd60150 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalTarget.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalTarget.java @@ -40,7 +40,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal { return false; } else { if (this.f) { - if (this.d.aD().canSee(entityliving)) { + if (this.d.getEntitySenses().canSee(entityliving)) { this.g = 0; } else if (++this.g > 60) { return false; @@ -85,7 +85,7 @@ public abstract class PathfinderGoalTarget extends PathfinderGoal { if (!this.d.d(MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) { return false; - } else if (this.f && !this.d.aD().canSee(entityliving)) { + } else if (this.f && !this.d.getEntitySenses().canSee(entityliving)) { return false; } else { if (this.a) { diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java index eb474f5b..17cfacc9 100644 --- a/src/main/java/net/minecraft/server/PendingConnection.java +++ b/src/main/java/net/minecraft/server/PendingConnection.java @@ -72,8 +72,8 @@ public class PendingConnection extends Connection { } else { PublicKey publickey = this.server.F().getPublic(); - if (packet2handshake.d() != 60) { - if (packet2handshake.d() > 60) { + if (packet2handshake.d() != 61) { + if (packet2handshake.d() > 61) { this.disconnect("Outdated server!"); } else { this.disconnect("Outdated client!"); @@ -148,7 +148,7 @@ public class PendingConnection extends Connection { if (packet254getinfo.a == 1) { // CraftBukkit start - Fix decompile issues, don't create a list from an array - Object[] list = new Object[] { 1, 60, this.server.getVersion(), pingEvent.getMotd(), playerlist.getPlayerCount(), pingEvent.getMaxPlayers() }; + Object[] list = new Object[] { 1, 61, this.server.getVersion(), pingEvent.getMotd(), playerlist.getPlayerCount(), pingEvent.getMaxPlayers() }; for (Object object : list) { if (s == null) { diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java index c81793a1..55873f59 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -501,7 +501,7 @@ public class PlayerConnection extends Connection { } else if (packet14blockdig.e == 3) { this.player.a(true); } else if (packet14blockdig.e == 5) { - this.player.bX(); + this.player.bZ(); } else { boolean flag = false; diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java index d03174b3..1243d1d0 100644 --- a/src/main/java/net/minecraft/server/PlayerInteractManager.java +++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java @@ -308,13 +308,13 @@ public class PlayerInteractManager { if (this.isCreative()) { this.player.playerConnection.sendPacket(new Packet53BlockChange(i, j, k, this.world)); } else { - ItemStack itemstack = this.player.cb(); + ItemStack itemstack = this.player.cd(); boolean flag1 = this.player.a(Block.byId[l]); if (itemstack != null) { itemstack.a(this.world, l, i, j, k, this.player); if (itemstack.count == 0) { - this.player.cc(); + this.player.ce(); } } @@ -353,7 +353,7 @@ public class PlayerInteractManager { entityhuman.inventory.items[entityhuman.inventory.itemInHandIndex] = null; } - if (!entityhuman.bV()) { + if (!entityhuman.bX()) { ((EntityPlayer) entityhuman).updateInventory(entityhuman.defaultContainer); } diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java index ed670d92..9e574bec 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -504,7 +504,7 @@ public abstract class PlayerList { } } - TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().s() : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins + TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().t() : org.bukkit.craftbukkit.CraftTravelAgent.DEFAULT; // return arbitrary TA to compensate for implementation dependent plugins PlayerPortalEvent event = new PlayerPortalEvent(entityplayer.getBukkitEntity(), enter, exit, agent, cause); event.useTravelAgent(useTravelAgent); Bukkit.getServer().getPluginManager().callEvent(event); @@ -521,7 +521,7 @@ public abstract class PlayerList { Vector velocity = entityplayer.getBukkitEntity().getVelocity(); boolean before = exitWorld.chunkProviderServer.forceChunkLoad; exitWorld.chunkProviderServer.forceChunkLoad = true; - exitWorld.s().adjustExit(entityplayer, exit, velocity); + exitWorld.t().adjustExit(entityplayer, exit, velocity); // Should be getTravelAgent exitWorld.chunkProviderServer.forceChunkLoad = before; this.moveToWorld(entityplayer, exitWorld.dimension, true, exit, false); // Vanilla doesn't check for suffocation when handling portals, so neither should we @@ -609,7 +609,7 @@ public abstract class PlayerList { worldserver1.addEntity(entity); entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch); worldserver1.entityJoinedWorld(entity, false); - worldserver1.s().a(entity, d3, d4, d5, f); + worldserver1.t().a(entity, d3, d4, d5, f); } worldserver.methodProfiler.b(); @@ -688,7 +688,7 @@ public abstract class PlayerList { // worldserver1.s().a(entity, d3, d4, d5, f); if (portal) { Vector velocity = entity.getBukkitEntity().getVelocity(); - worldserver1.s().adjustExit(entity, exit, velocity); + worldserver1.t().adjustExit(entity, exit, velocity); // Should be getTravelAgent entity.setPositionRotation(exit.getX(), exit.getY(), exit.getZ(), exit.getYaw(), exit.getPitch()); if (entity.motX != velocity.getX() || entity.motY != velocity.getY() || entity.motZ != velocity.getZ()) { entity.getBukkitEntity().setVelocity(velocity); @@ -797,7 +797,7 @@ public abstract class PlayerList { return this.operators.contains(s.trim().toLowerCase()) || this.server.I() && this.server.worlds.get(0).getWorldData().allowCommands() && this.server.H().equalsIgnoreCase(s) || this.m; } - public EntityPlayer f(String s) { + public EntityPlayer getPlayer(String s) { Iterator iterator = this.players.iterator(); EntityPlayer entityplayer; @@ -976,7 +976,7 @@ public abstract class PlayerList { public void b(EntityPlayer entityplayer, WorldServer worldserver) { entityplayer.playerConnection.sendPacket(new Packet4UpdateTime(worldserver.getTime(), worldserver.getDayTime())); - if (worldserver.O()) { + if (worldserver.P()) { entityplayer.setPlayerWeather(org.bukkit.WeatherType.DOWNFALL, false); // CraftBukkit - handle player specific weather } } diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java index d1ff0614..1eea9478 100644 --- a/src/main/java/net/minecraft/server/PortalTravelAgent.java +++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java @@ -140,7 +140,7 @@ public class PortalTravelAgent { for (int l1 = i1 - short1; l1 <= i1 + short1; ++l1) { double d6 = (double) l1 + 0.5D - z; // CraftBukkit - for (int i2 = this.a.Q() - 1; i2 >= 0; --i2) { + for (int i2 = this.a.R() - 1; i2 >= 0; --i2) { if (this.a.getTypeId(k1, i2, l1) == Block.PORTAL.id) { while (this.a.getTypeId(k1, i2 - 1, l1) == Block.PORTAL.id) { --i2; @@ -364,7 +364,7 @@ public class PortalTravelAgent { d2 = (double) j2 + 0.5D - z; // CraftBukkit label274: - for (k2 = this.a.Q() - 1; k2 >= 0; --k2) { + for (k2 = this.a.R() - 1; k2 >= 0; --k2) { if (this.a.isEmpty(i2, k2, j2)) { while (k2 > 0 && this.a.isEmpty(i2, k2 - 1, j2)) { --k2; @@ -415,7 +415,7 @@ public class PortalTravelAgent { d2 = (double) j2 + 0.5D - z; // CraftBukkit label222: - for (k2 = this.a.Q() - 1; k2 >= 0; --k2) { + for (k2 = this.a.R() - 1; k2 >= 0; --k2) { if (this.a.isEmpty(i2, k2, j2)) { while (k2 > 0 && this.a.isEmpty(i2, k2 - 1, j2)) { --k2; @@ -471,8 +471,8 @@ public class PortalTravelAgent { i1 = 70; } - if (i1 > this.a.Q() - 10) { - i1 = this.a.Q() - 10; + if (i1 > this.a.R() - 10) { + i1 = this.a.R() - 10; } j5 = i1; diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java index b3e28185..056100f5 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -21,7 +21,7 @@ public final class SpawnerCreature { Chunk chunk = world.getChunkAt(i, j); int k = i * 16 + world.random.nextInt(16); int l = j * 16 + world.random.nextInt(16); - int i1 = world.random.nextInt(chunk == null ? world.Q() : chunk.h() + 16 - 1); + int i1 = world.random.nextInt(chunk == null ? world.R() : chunk.h() + 16 - 1); return new ChunkPosition(k, i1, l); } diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java index 4ceb57e5..36008f28 100644 --- a/src/main/java/net/minecraft/server/TileEntityBeacon.java +++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java @@ -15,14 +15,14 @@ public class TileEntityBeacon extends TileEntity implements IInventory { private int e = -1; private int f; private int g; - private ItemStack h; + private ItemStack inventorySlot; private String i; // CraftBukkit start public List<HumanEntity> transaction = new java.util.ArrayList<HumanEntity>(); private int maxStack = MAX_STACK; public ItemStack[] getContents() { - return new ItemStack[] { this.h }; // Should be inventorySlot + return new ItemStack[] { this.inventorySlot }; } public void onOpen(CraftHumanEntity who) { @@ -198,19 +198,19 @@ public class TileEntityBeacon extends TileEntity implements IInventory { } public ItemStack getItem(int i) { - return i == 0 ? this.h : null; + return i == 0 ? this.inventorySlot : null; } public ItemStack splitStack(int i, int j) { - if (i == 0 && this.h != null) { - if (j >= this.h.count) { - ItemStack itemstack = this.h; + if (i == 0 && this.inventorySlot != null) { + if (j >= this.inventorySlot.count) { + ItemStack itemstack = this.inventorySlot; - this.h = null; + this.inventorySlot = null; return itemstack; } else { - this.h.count -= j; - return new ItemStack(this.h.id, j, this.h.getData()); + this.inventorySlot.count -= j; + return new ItemStack(this.inventorySlot.id, j, this.inventorySlot.getData()); } } else { return null; @@ -218,10 +218,10 @@ public class TileEntityBeacon extends TileEntity implements IInventory { } public ItemStack splitWithoutUpdate(int i) { - if (i == 0 && this.h != null) { - ItemStack itemstack = this.h; + if (i == 0 && this.inventorySlot != null) { + ItemStack itemstack = this.inventorySlot; - this.h = null; + this.inventorySlot = null; return itemstack; } else { return null; @@ -230,7 +230,7 @@ public class TileEntityBeacon extends TileEntity implements IInventory { public void setItem(int i, ItemStack itemstack) { if (i == 0) { - this.h = itemstack; + this.inventorySlot = itemstack; } } diff --git a/src/main/java/net/minecraft/server/TileEntityCommand.java b/src/main/java/net/minecraft/server/TileEntityCommand.java index 0f9a38f7..c9be36ce 100644 --- a/src/main/java/net/minecraft/server/TileEntityCommand.java +++ b/src/main/java/net/minecraft/server/TileEntityCommand.java @@ -68,7 +68,7 @@ public class TileEntityCommand extends TileEntity implements ICommandListener { if (players != null && players.length > 0) { return players.length; } else { - EntityPlayer player = MinecraftServer.getServer().getPlayerList().f(args[1]); // Should be getPlayer + EntityPlayer player = MinecraftServer.getServer().getPlayerList().getPlayer(args[1]); if (player == null) { return 0; } else { diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java index 2deb8161..18f74641 100644 --- a/src/main/java/net/minecraft/server/VillageSiege.java +++ b/src/main/java/net/minecraft/server/VillageSiege.java @@ -28,7 +28,7 @@ public class VillageSiege { return; } } else { - if (this.world.u()) { + if (this.world.v()) { this.c = 0; return; } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java index d896f692..a7de90ee 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -168,7 +168,7 @@ public abstract class World implements IBlockAccess { this.villages.a(this); } - this.y(); + this.z(); this.a(); this.getServer().addWorld(this.world); // CraftBukkit @@ -675,7 +675,7 @@ public abstract class World implements IBlockAccess { return this.worldProvider.g[this.getLightLevel(i, j, k)]; } - public boolean u() { + public boolean v() { return this.j < 4; } @@ -1098,7 +1098,7 @@ public abstract class World implements IBlockAccess { return this.worldProvider.a(this.worldData.getDayTime(), f); } - public int v() { + public int w() { return this.worldProvider.a(this.worldData.getDayTime()); } @@ -1836,7 +1836,7 @@ public abstract class World implements IBlockAccess { } } - public void y() { + public void z() { int i = this.a(1.0F); if (i != this.j) { @@ -1850,7 +1850,7 @@ public abstract class World implements IBlockAccess { } public void doTick() { - this.n(); + this.o(); } private void a() { @@ -1862,7 +1862,7 @@ public abstract class World implements IBlockAccess { } } - protected void n() { + protected void o() { if (!this.worldProvider.f) { int i = this.worldData.getThunderDuration(); @@ -1941,11 +1941,11 @@ public abstract class World implements IBlockAccess { } } - public void z() { + public void A() { this.worldData.setWeatherDuration(1); } - protected void A() { + protected void B() { // this.chunkTickList.clear(); // CraftBukkit - removed this.methodProfiler.a("buildList"); @@ -2020,7 +2020,7 @@ public abstract class World implements IBlockAccess { } protected void g() { - this.A(); + this.B(); } public boolean x(int i, int j, int k) { @@ -2337,7 +2337,7 @@ public abstract class World implements IBlockAccess { for (int j = 0; j < this.entityList.size(); ++j) { Entity entity = (Entity) this.entityList.get(j); - if (oclass.isAssignableFrom(entity.getClass())) { + if ((!(entity instanceof EntityLiving) || !((EntityLiving) entity).bU()) && oclass.isAssignableFrom(entity.getClass())) { ++i; } } @@ -2557,7 +2557,7 @@ public abstract class World implements IBlockAccess { } if (entityhuman1.isInvisible()) { - float f = entityhuman1.ca(); + float f = entityhuman1.cc(); if (f < 0.1F) { f = 0.1F; @@ -2586,7 +2586,7 @@ public abstract class World implements IBlockAccess { return null; } - public void E() throws ExceptionWorldConflict { // CraftBukkit - added throws + public void F() throws ExceptionWorldConflict { // CraftBukkit - added throws this.dataManager.checkSession(); } @@ -2616,7 +2616,7 @@ public abstract class World implements IBlockAccess { public void broadcastEntityEffect(Entity entity, byte b0) {} - public IChunkProvider J() { + public IChunkProvider K() { return this.chunkProvider; } @@ -2658,16 +2658,16 @@ public abstract class World implements IBlockAccess { return this.m + (this.n - this.m) * f; } - public boolean N() { + public boolean O() { return (double) this.h(1.0F) > 0.9D; } - public boolean O() { + public boolean P() { return (double) this.i(1.0F) > 0.2D; } public boolean F(int i, int j, int k) { - if (!this.O()) { + if (!this.P()) { return false; } else if (!this.l(i, j, k)) { return false; @@ -2729,7 +2729,7 @@ public abstract class World implements IBlockAccess { return 256; } - public int Q() { + public int R() { return this.worldProvider.f ? 128 : 256; } @@ -2745,7 +2745,7 @@ public abstract class World implements IBlockAccess { } public ChunkPosition b(String s, int i, int j, int k) { - return this.J().findNearestMapFeature(this, s, i, j, k); + return this.K().findNearestMapFeature(this, s, i, j, k); } public CrashReportSystemDetails a(CrashReport crashreport) { @@ -2776,7 +2776,7 @@ public abstract class World implements IBlockAccess { return this.J; } - public Calendar U() { + public Calendar V() { if (this.getTime() % 600L == 0L) { this.K.setTimeInMillis(System.currentTimeMillis()); } diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java index 6d8495fa..49360c13 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -208,13 +208,13 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate this.methodProfiler.c("portalForcer"); this.P.a(this.getTime()); this.methodProfiler.b(); - this.Y(); + this.Z(); this.getWorld().processChunkGC(); // CraftBukkit } public BiomeMeta a(EnumCreatureType enumcreaturetype, int i, int j, int k) { - List list = this.J().getMobsFor(enumcreaturetype, i, j, k); + List list = this.K().getMobsFor(enumcreaturetype, i, j, k); return list != null && !list.isEmpty() ? (BiomeMeta) WeightedRandom.a(this.random, (Collection) list) : null; } @@ -245,10 +245,10 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate } } - this.X(); + this.Y(); } - private void X() { + private void Y() { // CraftBukkit start WeatherChangeEvent weather = new WeatherChangeEvent(this.getWorld(), false); this.getServer().getPluginManager().callEvent(weather); @@ -321,7 +321,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate int k1; int l1; - if (this.random.nextInt(100000) == 0 && this.O() && this.N()) { + if (this.random.nextInt(100000) == 0 && this.P() && this.O()) { this.k = this.k * 3 + 1013904223; i1 = this.k >> 2; j1 = k + (i1 & 15); @@ -354,7 +354,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate // CraftBukkit end } - if (this.O() && this.z(j1 + k, l1, k1 + l)) { + if (this.P() && this.z(j1 + k, l1, k1 + l)) { // CraftBukkit start BlockState blockState = this.getWorld().getBlockAt(j1 + k, l1, k1 + l).getState(); blockState.setTypeId(Block.SNOW.id); @@ -367,7 +367,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate // CraftBukkit end } - if (this.O()) { + if (this.P()) { BiomeBase biomebase = this.getBiome(j1 + k, k1 + l); if (biomebase.d()) { @@ -387,21 +387,21 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate for (k1 = 0; k1 < j1; ++k1) { ChunkSection chunksection = achunksection[k1]; - if (chunksection != null && chunksection.b()) { + if (chunksection != null && chunksection.shouldTick()) { for (int j2 = 0; j2 < 3; ++j2) { this.k = this.k * 3 + 1013904223; i2 = this.k >> 2; int k2 = i2 & 15; int l2 = i2 >> 8 & 15; int i3 = i2 >> 16 & 15; - int j3 = chunksection.a(k2, i3, l2); + int j3 = chunksection.getTypeId(k2, i3, l2); ++j; Block block = Block.byId[j3]; if (block != null && block.isTicking()) { ++i; - block.a(this, k2 + k, i3 + chunksection.d(), l2 + l, this.random); + block.a(this, k2 + k, i3 + chunksection.getYPosition(), l2 + l, this.random); } } } @@ -775,8 +775,14 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate } } + public void flushSave() { + if (this.chunkProvider.canSave()) { + this.chunkProvider.b(); + } + } + protected void a() throws ExceptionWorldConflict { // CraftBukkit - added throws - this.E(); + this.F(); this.dataManager.saveWorldData(this.worldData, this.server.getPlayerList().q()); this.worldMaps.a(); } @@ -883,7 +889,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate } - private void Y() { + private void Z() { while (!this.Q[this.R].isEmpty()) { int i = this.R; @@ -913,11 +919,11 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate this.dataManager.a(); } - protected void n() { - boolean flag = this.O(); + protected void o() { + boolean flag = this.P(); - super.n(); - if (flag != this.O()) { + super.o(); + if (flag != this.P()) { // CraftBukkit start - Only send weather packets to those affected for (int i = 0; i < this.players.size(); ++i) { if (((EntityPlayer) this.players.get(i)).world == this) { @@ -940,7 +946,7 @@ public class WorldServer extends World implements org.bukkit.BlockChangeDelegate return this.manager; } - public PortalTravelAgent s() { + public PortalTravelAgent t() { return this.P; } |