diff --git a/nms-patches/BiomeDecorator.patch b/nms-patches/BiomeDecorator.patch deleted file mode 100644 index b7929ee0ef..0000000000 --- a/nms-patches/BiomeDecorator.patch +++ /dev/null @@ -1,139 +0,0 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/BiomeDecorator.java 2014-12-12 19:26:13.625913570 +0000 -+++ src/main/java/net/minecraft/server/BiomeDecorator.java 2014-12-12 19:15:22.000000000 +0000 -@@ -132,7 +132,7 @@ - WorldGenTreeAbstract worldgentreeabstract = biomebase.a(this.b); - - worldgentreeabstract.e(); -- blockposition = this.a.getHighestBlockYAt(this.c.a(k, 0, l)); -+ blockposition = this.getHighestBlockYAt(this.c.a(k, 0, l)); // CraftBukkit - Prevent crash - if (worldgentreeabstract.generate(this.a, this.b, blockposition)) { - worldgentreeabstract.a(this.a, this.b, blockposition); - } -@@ -141,7 +141,7 @@ - for (j = 0; j < this.K; ++j) { - k = this.b.nextInt(16) + 8; - l = this.b.nextInt(16) + 8; -- this.v.generate(this.a, this.b, this.a.getHighestBlockYAt(this.c.a(k, 0, l))); -+ this.v.generate(this.a, this.b, this.getHighestBlockYAt(this.c.a(k, 0, l ))); // CraftBukkit - Prevent crash - } - - int i1; -@@ -149,7 +149,7 @@ - for (j = 0; j < this.B; ++j) { - k = this.b.nextInt(16) + 8; - l = this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() + 32); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() + 32); // CraftBukkit - Prevent crash - blockposition = this.c.a(k, i1, l); - EnumFlowerVarient enumflowervarient = biomebase.a(this.b, blockposition); - BlockFlowers blockflowers = enumflowervarient.a().a(); -@@ -163,14 +163,14 @@ - for (j = 0; j < this.C; ++j) { - k = this.b.nextInt(16) + 8; - l = this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash - biomebase.b(this.b).generate(this.a, this.b, this.c.a(k, i1, l)); - } - - for (j = 0; j < this.D; ++j) { - k = this.b.nextInt(16) + 8; - l = this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash - (new WorldGenDeadBush()).generate(this.a, this.b, this.c.a(k, i1, l)); - } - -@@ -179,7 +179,7 @@ - while (j < this.z) { - k = this.b.nextInt(16) + 8; - l = this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash - blockposition = this.c.a(k, i1, l); - - while (true) { -@@ -202,7 +202,7 @@ - if (this.b.nextInt(4) == 0) { - k = this.b.nextInt(16) + 8; - l = this.b.nextInt(16) + 8; -- BlockPosition blockposition2 = this.a.getHighestBlockYAt(this.c.a(k, 0, l)); -+ BlockPosition blockposition2 = this.getHighestBlockYAt(this.c.a(k, 0, l)); // CraftBukkit - Prevent crash - - this.t.generate(this.a, this.b, blockposition2); - } -@@ -210,7 +210,7 @@ - if (this.b.nextInt(8) == 0) { - k = this.b.nextInt(16) + 8; - l = this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash - blockposition = this.c.a(k, i1, l); - this.u.generate(this.a, this.b, blockposition); - } -@@ -219,42 +219,42 @@ - if (this.b.nextInt(4) == 0) { - j = this.b.nextInt(16) + 8; - k = this.b.nextInt(16) + 8; -- l = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); -+ l = this.b.nextInt(this.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); // CraftBukkit - Prevent crash - this.t.generate(this.a, this.b, this.c.a(j, l, k)); - } - - if (this.b.nextInt(8) == 0) { - j = this.b.nextInt(16) + 8; - k = this.b.nextInt(16) + 8; -- l = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); -+ l = this.b.nextInt(this.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); // CraftBukkit - Prevent crash - this.u.generate(this.a, this.b, this.c.a(j, l, k)); - } - - for (j = 0; j < this.F; ++j) { - k = this.b.nextInt(16) + 8; - l = this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash - this.w.generate(this.a, this.b, this.c.a(k, i1, l)); - } - - for (j = 0; j < 10; ++j) { - k = this.b.nextInt(16) + 8; - l = this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash - this.w.generate(this.a, this.b, this.c.a(k, i1, l)); - } - - if (this.b.nextInt(32) == 0) { - j = this.b.nextInt(16) + 8; - k = this.b.nextInt(16) + 8; -- l = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); -+ l = this.b.nextInt(this.getHighestBlockYAt(this.c.a(j, 0, k)).getY() * 2); // CraftBukkit - Prevent crash - (new WorldGenPumpkin()).generate(this.a, this.b, this.c.a(j, l, k)); - } - - for (j = 0; j < this.G; ++j) { - k = this.b.nextInt(16) + 8; - l = this.b.nextInt(16) + 8; -- i1 = this.b.nextInt(this.a.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); -+ i1 = this.b.nextInt(this.getHighestBlockYAt(this.c.a(k, 0, l)).getY() * 2); // CraftBukkit - Prevent crash - this.x.generate(this.a, this.b, this.c.a(k, i1, l)); - } - -@@ -274,6 +274,16 @@ - - } - -+ // CraftBukkit start - The heightMap can be wrong calculated and return Y = 0 which will crash the Server -+ private BlockPosition getHighestBlockYAt( BlockPosition blockPosition ) { -+ BlockPosition returnBlockPosition = this.a.getHighestBlockYAt( blockPosition ); -+ if ( returnBlockPosition.getY() == 0 ) { -+ returnBlockPosition = returnBlockPosition.up( 1 ); -+ } -+ return returnBlockPosition; -+ } -+ // CraftBukkit end -+ - protected void a(int i, WorldGenerator worldgenerator, int j, int k) { - int l; - diff --git a/nms-patches/BiomeTheEndDecorator.patch b/nms-patches/BiomeTheEndDecorator.patch index 3798a13943..57aaa755da 100644 --- a/nms-patches/BiomeTheEndDecorator.patch +++ b/nms-patches/BiomeTheEndDecorator.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BiomeTheEndDecorator.java 2014-11-28 17:43:42.857707440 +0000 -+++ src/main/java/net/minecraft/server/BiomeTheEndDecorator.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BiomeTheEndDecorator.java 2015-02-26 22:40:21.971608146 +0000 ++++ src/main/java/net/minecraft/server/BiomeTheEndDecorator.java 2015-02-26 22:40:21.971608146 +0000 @@ -21,7 +21,7 @@ EntityEnderDragon entityenderdragon = new EntityEnderDragon(this.a); diff --git a/nms-patches/Block.patch b/nms-patches/Block.patch index 4f137abba5..6631e445f3 100644 --- a/nms-patches/Block.patch +++ b/nms-patches/Block.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/Block.java 2014-11-28 17:43:42.913707439 +0000 -+++ src/main/java/net/minecraft/server/Block.java 2014-11-28 17:38:24.000000000 +0000 -@@ -295,7 +295,8 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/Block.java 2015-02-26 22:40:22.155608144 +0000 ++++ src/main/java/net/minecraft/server/Block.java 2015-02-26 22:40:22.159608144 +0000 +@@ -336,7 +336,8 @@ int j = this.getDropCount(i, world.random); for (int k = 0; k < j; ++k) { @@ -10,9 +10,9 @@ Item item = this.getDropType(iblockdata, world.random, i); if (item != null) { -@@ -920,4 +921,10 @@ - private static void a(int i, String s, Block block) { - a(i, new MinecraftKey(s), block); +@@ -1002,4 +1003,10 @@ + return this.getBreakSound(); + } } + + // CraftBukkit start diff --git a/nms-patches/BlockBloodStone.patch b/nms-patches/BlockBloodStone.patch index e8ebfbf7e4..f6dfde8794 100644 --- a/nms-patches/BlockBloodStone.patch +++ b/nms-patches/BlockBloodStone.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockBloodStone.java 2014-11-28 17:43:42.873707440 +0000 -+++ src/main/java/net/minecraft/server/BlockBloodStone.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockBloodStone.java 2015-02-26 22:40:22.031608145 +0000 ++++ src/main/java/net/minecraft/server/BlockBloodStone.java 2015-02-26 22:40:22.031608145 +0000 @@ -1,5 +1,7 @@ package net.minecraft.server; diff --git a/nms-patches/BlockButtonAbstract.patch b/nms-patches/BlockButtonAbstract.patch index dd7ca56ca2..18aecda77e 100644 --- a/nms-patches/BlockButtonAbstract.patch +++ b/nms-patches/BlockButtonAbstract.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockButtonAbstract.java 2014-11-28 17:43:42.877707440 +0000 -+++ src/main/java/net/minecraft/server/BlockButtonAbstract.java 2014-11-28 17:38:17.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockButtonAbstract.java 2015-02-26 22:40:22.035608145 +0000 ++++ src/main/java/net/minecraft/server/BlockButtonAbstract.java 2015-02-26 22:40:22.039608145 +0000 @@ -3,6 +3,11 @@ import java.util.List; import java.util.Random; @@ -12,7 +12,7 @@ public abstract class BlockButtonAbstract extends Block { public static final BlockStateDirection FACING = BlockStateDirection.of("facing"); -@@ -122,6 +127,19 @@ +@@ -124,6 +129,19 @@ if (((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)).booleanValue()) { return true; } else { @@ -32,8 +32,8 @@ world.setTypeAndData(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(true)), 3); world.b(blockposition, blockposition); world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "random.click", 0.3F, 0.6F); -@@ -159,6 +177,16 @@ - if (this.M) { +@@ -161,6 +179,16 @@ + if (this.N) { this.f(world, blockposition, iblockdata); } else { + // CraftBukkit start @@ -47,13 +47,12 @@ + } + // CraftBukkit end world.setTypeUpdate(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(false))); - this.b(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING)); + this.c(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING)); world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "random.click", 0.3F, 0.5F); -@@ -192,8 +220,42 @@ - List list = world.a(EntityArrow.class, new AxisAlignedBB((double) blockposition.getX() + this.minX, (double) blockposition.getY() + this.minY, (double) blockposition.getZ() + this.minZ, (double) blockposition.getX() + this.maxX, (double) blockposition.getY() + this.maxY, (double) blockposition.getZ() + this.maxZ)); +@@ -195,7 +223,41 @@ boolean flag = !list.isEmpty(); boolean flag1 = ((Boolean) iblockdata.get(BlockButtonAbstract.POWERED)).booleanValue(); -+ + + // CraftBukkit start - Call interact event when arrows turn on wooden buttons + if (flag1 != flag && flag) { + org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); @@ -77,7 +76,7 @@ + } + } + // CraftBukkit end - ++ if (flag && !flag1) { + // CraftBukkit start + org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); @@ -90,9 +89,9 @@ + } + // CraftBukkit end world.setTypeUpdate(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(true))); - this.b(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING)); + this.c(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING)); world.b(blockposition, blockposition); -@@ -201,6 +263,16 @@ +@@ -203,6 +265,16 @@ } if (!flag && flag1) { @@ -107,5 +106,5 @@ + } + // CraftBukkit end world.setTypeUpdate(blockposition, iblockdata.set(BlockButtonAbstract.POWERED, Boolean.valueOf(false))); - this.b(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING)); + this.c(world, blockposition, (EnumDirection) iblockdata.get(BlockButtonAbstract.FACING)); world.b(blockposition, blockposition); diff --git a/nms-patches/BlockCactus.patch b/nms-patches/BlockCactus.patch index 6f8728ca6d..b05798c299 100644 --- a/nms-patches/BlockCactus.patch +++ b/nms-patches/BlockCactus.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/BlockCactus.java 2014-12-11 00:44:17.652251803 +0000 -+++ src/main/java/net/minecraft/server/BlockCactus.java 2014-12-11 00:43:46.164252144 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockCactus.java 2015-02-26 22:40:22.043608145 +0000 ++++ src/main/java/net/minecraft/server/BlockCactus.java 2015-02-26 22:40:22.043608145 +0000 @@ -3,6 +3,8 @@ import java.util.Iterator; import java.util.Random; diff --git a/nms-patches/BlockCake.patch b/nms-patches/BlockCake.patch index 2664483a44..8824ae28a4 100644 --- a/nms-patches/BlockCake.patch +++ b/nms-patches/BlockCake.patch @@ -1,9 +1,9 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockCake.java 2014-11-28 17:43:42.881707440 +0000 -+++ src/main/java/net/minecraft/server/BlockCake.java 2014-11-28 17:38:19.000000000 +0000 -@@ -54,7 +54,18 @@ - +--- /home/matt/mc-dev-private//net/minecraft/server/BlockCake.java 2015-02-26 22:40:22.047608145 +0000 ++++ src/main/java/net/minecraft/server/BlockCake.java 2015-02-26 22:40:22.047608145 +0000 +@@ -55,7 +55,18 @@ private void b(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) { if (entityhuman.j(false)) { + entityhuman.b(StatisticList.H); - entityhuman.getFoodData().eat(2, 0.1F); + // CraftBukkit start + // entityhuman.getFoodData().eat(2, 0.1F); diff --git a/nms-patches/BlockCocoa.patch b/nms-patches/BlockCocoa.patch index 88a9f3bf3e..0a9b7313e5 100644 --- a/nms-patches/BlockCocoa.patch +++ b/nms-patches/BlockCocoa.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockCocoa.java 2014-11-28 17:43:42.881707440 +0000 -+++ src/main/java/net/minecraft/server/BlockCocoa.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockCocoa.java 2015-02-26 22:40:22.063608145 +0000 ++++ src/main/java/net/minecraft/server/BlockCocoa.java 2015-02-26 22:40:22.067608145 +0000 @@ -2,6 +2,8 @@ import java.util.Random; diff --git a/nms-patches/BlockCommand.patch b/nms-patches/BlockCommand.patch index 0ee5bd337b..a00302491c 100644 --- a/nms-patches/BlockCommand.patch +++ b/nms-patches/BlockCommand.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockCommand.java 2014-11-28 17:43:42.885707440 +0000 -+++ src/main/java/net/minecraft/server/BlockCommand.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockCommand.java 2015-02-26 22:40:22.071608145 +0000 ++++ src/main/java/net/minecraft/server/BlockCommand.java 2015-02-26 22:40:22.071608145 +0000 @@ -2,6 +2,8 @@ import java.util.Random; @@ -9,11 +9,11 @@ public class BlockCommand extends BlockContainer { public static final BlockStateBoolean TRIGGERED = BlockStateBoolean.of("triggered"); -@@ -19,11 +21,20 @@ - if (!world.isStatic) { +@@ -20,10 +22,19 @@ boolean flag = world.isBlockIndirectlyPowered(blockposition); boolean flag1 = ((Boolean) iblockdata.get(BlockCommand.TRIGGERED)).booleanValue(); -+ + +- if (flag && !flag1) { + // CraftBukkit start + org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + int old = flag1 ? 15 : 0; @@ -22,8 +22,7 @@ + BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, old, current); + world.getServer().getPluginManager().callEvent(eventRedstone); + // CraftBukkit end - -- if (flag && !flag1) { ++ + if (eventRedstone.getNewCurrent() > 0 && !(eventRedstone.getOldCurrent() > 0)) { // CraftBukkit world.setTypeAndData(blockposition, iblockdata.set(BlockCommand.TRIGGERED, Boolean.valueOf(true)), 4); world.a(blockposition, (Block) this, this.a(world)); diff --git a/nms-patches/BlockCrops.patch b/nms-patches/BlockCrops.patch index aeb94240de..87e85639c6 100644 --- a/nms-patches/BlockCrops.patch +++ b/nms-patches/BlockCrops.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockCrops.java 2014-11-28 17:43:42.885707440 +0000 -+++ src/main/java/net/minecraft/server/BlockCrops.java 2014-11-28 17:38:17.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockCrops.java 2015-02-26 22:40:22.083608145 +0000 ++++ src/main/java/net/minecraft/server/BlockCrops.java 2015-02-26 22:40:22.083608145 +0000 @@ -2,6 +2,8 @@ import java.util.Random; @@ -16,7 +16,7 @@ - world.setTypeAndData(blockposition, iblockdata.set(BlockCrops.AGE, Integer.valueOf(i + 1)), 2); + // CraftBukkit start + IBlockData data = iblockdata.set(AGE, Integer.valueOf(i + 1)); -+ CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data)); ++ CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data)); + // CraftBukkit end } } @@ -28,7 +28,7 @@ - world.setTypeAndData(blockposition, iblockdata.set(BlockCrops.AGE, Integer.valueOf(i)), 2); + // CraftBukkit start + IBlockData data = iblockdata.set(AGE, Integer.valueOf(i)); -+ CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data)); ++ CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(data)); + // CraftBukkit end } diff --git a/nms-patches/BlockDaylightDetector.patch b/nms-patches/BlockDaylightDetector.patch index 650cfa24ab..dea532b023 100644 --- a/nms-patches/BlockDaylightDetector.patch +++ b/nms-patches/BlockDaylightDetector.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockDaylightDetector.java 2014-11-28 17:43:42.889707440 +0000 -+++ src/main/java/net/minecraft/server/BlockDaylightDetector.java 2014-11-28 17:38:22.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockDaylightDetector.java 2015-02-26 22:40:22.091608145 +0000 ++++ src/main/java/net/minecraft/server/BlockDaylightDetector.java 2015-02-26 22:40:22.091608145 +0000 @@ -41,6 +41,7 @@ } diff --git a/nms-patches/BlockDiodeAbstract.patch b/nms-patches/BlockDiodeAbstract.patch index e9e7e385d9..7fcfe12c81 100644 --- a/nms-patches/BlockDiodeAbstract.patch +++ b/nms-patches/BlockDiodeAbstract.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockDiodeAbstract.java 2014-11-28 17:43:42.889707440 +0000 -+++ src/main/java/net/minecraft/server/BlockDiodeAbstract.java 2014-11-28 17:38:22.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockDiodeAbstract.java 2015-02-26 22:40:22.099608145 +0000 ++++ src/main/java/net/minecraft/server/BlockDiodeAbstract.java 2015-02-26 22:40:22.103608145 +0000 @@ -2,6 +2,8 @@ import java.util.Random; @@ -8,18 +8,18 @@ + public abstract class BlockDiodeAbstract extends BlockDirectional { - protected final boolean M; + protected final boolean N; @@ -31,8 +33,18 @@ boolean flag = this.e(world, blockposition, iblockdata); - if (this.M && !flag) { + if (this.N && !flag) { + // CraftBukkit start + if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) { + return; + } + // CraftBukkit end world.setTypeAndData(blockposition, this.k(iblockdata), 2); - } else if (!this.M) { + } else if (!this.N) { + // CraftBukkit start + if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) { + return; diff --git a/nms-patches/BlockDispenser.patch b/nms-patches/BlockDispenser.patch index 1c484cfe69..9cc5c12a94 100644 --- a/nms-patches/BlockDispenser.patch +++ b/nms-patches/BlockDispenser.patch @@ -1,14 +1,23 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockDispenser.java 2014-11-28 17:43:42.893707440 +0000 -+++ src/main/java/net/minecraft/server/BlockDispenser.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockDispenser.java 2015-02-26 22:40:22.103608145 +0000 ++++ src/main/java/net/minecraft/server/BlockDispenser.java 2015-02-26 22:40:22.103608145 +0000 @@ -8,6 +8,7 @@ public static final BlockStateBoolean TRIGGERED = BlockStateBoolean.of("triggered"); - public static final RegistryDefault M = new RegistryDefault(new DispenseBehaviorItem()); - protected Random N = new Random(); + public static final RegistryDefault N = new RegistryDefault(new DispenseBehaviorItem()); + protected Random O = new Random(); + public static boolean eventFired = false; // CraftBukkit protected BlockDispenser() { super(Material.STONE); -@@ -78,6 +79,7 @@ +@@ -68,7 +69,7 @@ + } + } + +- protected void dispense(World world, BlockPosition blockposition) { ++ public void dispense(World world, BlockPosition blockposition) { // CraftBukkit - public + SourceBlock sourceblock = new SourceBlock(world, blockposition); + TileEntityDispenser tileentitydispenser = (TileEntityDispenser) sourceblock.getTileEntity(); + +@@ -83,6 +84,7 @@ if (idispensebehavior != IDispenseBehavior.a) { ItemStack itemstack1 = idispensebehavior.a(sourceblock, itemstack); diff --git a/nms-patches/BlockDoor.patch b/nms-patches/BlockDoor.patch index 6af16172bc..ce0ce26116 100644 --- a/nms-patches/BlockDoor.patch +++ b/nms-patches/BlockDoor.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockDoor.java 2014-11-28 17:43:42.893707440 +0000 -+++ src/main/java/net/minecraft/server/BlockDoor.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockDoor.java 2015-02-26 22:40:22.107608145 +0000 ++++ src/main/java/net/minecraft/server/BlockDoor.java 2015-02-26 22:40:22.107608145 +0000 @@ -3,6 +3,8 @@ import com.google.common.base.Predicate; import java.util.Random; @@ -8,12 +8,14 @@ + public class BlockDoor extends Block { - public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirectionLimit.HORIZONTAL); -@@ -151,9 +153,21 @@ + public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirection.EnumDirectionLimit.HORIZONTAL); +@@ -155,9 +157,22 @@ this.b(world, blockposition, iblockdata, 0); } } else { - boolean flag1 = world.isBlockIndirectlyPowered(blockposition) || world.isBlockIndirectlyPowered(blockposition2); + +- if ((flag1 || block.isPowerSource()) && block != this && flag1 != ((Boolean) iblockdata2.get(BlockDoor.POWERED)).booleanValue()) { + // CraftBukkit start + org.bukkit.World bworld = world.getWorld(); + org.bukkit.block.Block bukkitBlock = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); @@ -27,13 +29,12 @@ + if (oldPower == 0 ^ power == 0) { + BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, oldPower, power); + world.getServer().getPluginManager().callEvent(eventRedstone); - -- if ((flag1 || block.isPowerSource()) && block != this && flag1 != ((Boolean) iblockdata2.get(BlockDoor.POWERED)).booleanValue()) { ++ + boolean flag1 = eventRedstone.getNewCurrent() > 0; world.setTypeAndData(blockposition2, iblockdata2.set(BlockDoor.POWERED, Boolean.valueOf(flag1)), 2); if (flag1 != ((Boolean) iblockdata.get(BlockDoor.OPEN)).booleanValue()) { world.setTypeAndData(blockposition, iblockdata.set(BlockDoor.OPEN, Boolean.valueOf(flag1)), 2); -@@ -161,6 +175,7 @@ +@@ -165,6 +180,7 @@ world.a((EntityHuman) null, flag1 ? 1003 : 1006, blockposition, 0); } } diff --git a/nms-patches/BlockDragonEgg.patch b/nms-patches/BlockDragonEgg.patch index e44da6d84d..33e709cfdc 100644 --- a/nms-patches/BlockDragonEgg.patch +++ b/nms-patches/BlockDragonEgg.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockDragonEgg.java 2014-11-28 17:43:42.897707439 +0000 -+++ src/main/java/net/minecraft/server/BlockDragonEgg.java 2014-11-28 17:38:19.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockDragonEgg.java 2015-02-26 22:40:22.111608145 +0000 ++++ src/main/java/net/minecraft/server/BlockDragonEgg.java 2015-02-26 22:40:22.111608145 +0000 @@ -2,6 +2,8 @@ import java.util.Random; @@ -25,6 +25,6 @@ + + blockposition1 = new BlockPosition(event.getToBlock().getX(), event.getToBlock().getY(), event.getToBlock().getZ()); + // CraftBukkit end - if (world.isStatic) { + if (world.isClientSide) { for (int j = 0; j < 128; ++j) { double d0 = world.random.nextDouble(); diff --git a/nms-patches/BlockDropper.patch b/nms-patches/BlockDropper.patch index 33a9575d4b..60af6a4ce4 100644 --- a/nms-patches/BlockDropper.patch +++ b/nms-patches/BlockDropper.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockDropper.java 2014-11-28 17:43:42.897707439 +0000 -+++ src/main/java/net/minecraft/server/BlockDropper.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockDropper.java 2015-02-26 22:40:22.115608145 +0000 ++++ src/main/java/net/minecraft/server/BlockDropper.java 2015-02-26 22:40:22.115608145 +0000 @@ -1,5 +1,10 @@ package net.minecraft.server; @@ -10,7 +10,16 @@ + public class BlockDropper extends BlockDispenser { - private final IDispenseBehavior O = new DispenseBehaviorItem(); + private final IDispenseBehavior P = new DispenseBehaviorItem(); +@@ -14,7 +19,7 @@ + return new TileEntityDropper(); + } + +- protected void dispense(World world, BlockPosition blockposition) { ++ public void dispense(World world, BlockPosition blockposition) { // CraftBukkit - public + SourceBlock sourceblock = new SourceBlock(world, blockposition); + TileEntityDispenser tileentitydispenser = (TileEntityDispenser) sourceblock.getTileEntity(); + @@ -38,8 +43,25 @@ itemstack1 = null; } diff --git a/nms-patches/BlockEnderPortal.patch b/nms-patches/BlockEnderPortal.patch index 7c11bd7405..1bd64e1e01 100644 --- a/nms-patches/BlockEnderPortal.patch +++ b/nms-patches/BlockEnderPortal.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockEnderPortal.java 2014-11-28 17:43:42.901707439 +0000 -+++ src/main/java/net/minecraft/server/BlockEnderPortal.java 2014-11-28 17:38:19.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockEnderPortal.java 2015-02-26 22:40:22.119608144 +0000 ++++ src/main/java/net/minecraft/server/BlockEnderPortal.java 2015-02-26 22:40:22.119608144 +0000 @@ -3,6 +3,8 @@ import java.util.List; import java.util.Random; @@ -12,7 +12,7 @@ @@ -36,6 +38,10 @@ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) { - if (entity.vehicle == null && entity.passenger == null && !world.isStatic) { + if (entity.vehicle == null && entity.passenger == null && !world.isClientSide) { + // CraftBukkit start - Entity in portal + EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ())); + world.getServer().getPluginManager().callEvent(event); diff --git a/nms-patches/BlockFire.patch b/nms-patches/BlockFire.patch index f02af723fd..02e3de4464 100644 --- a/nms-patches/BlockFire.patch +++ b/nms-patches/BlockFire.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockFire.java 2015-02-17 14:05:03.475599681 +0000 -+++ src/main/java/net/minecraft/server/BlockFire.java 2015-02-17 14:05:03.475599681 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockFire.java 2015-02-26 22:40:22.123608144 +0000 ++++ src/main/java/net/minecraft/server/BlockFire.java 2015-02-26 22:40:22.123608144 +0000 @@ -4,6 +4,12 @@ import java.util.Map; import java.util.Random; @@ -25,7 +25,7 @@ @@ -120,7 +126,7 @@ } - if (!flag && world.S() && this.d(world, blockposition)) { + if (!flag && world.S() && this.e(world, blockposition)) { - world.setAir(blockposition); + fireExtinguished(world, blockposition); // CraftBukkit - extinguished by rain } else { @@ -33,7 +33,7 @@ @@ -133,14 +139,14 @@ if (!flag) { - if (!this.e(world, blockposition)) { + if (!this.f(world, blockposition)) { if (!World.a((IBlockAccess) world, blockposition.down()) || i > 3) { - world.setAir(blockposition); + fireExtinguished(world, blockposition); // CraftBukkit @@ -76,11 +76,10 @@ } } } -@@ -223,6 +248,17 @@ - +@@ -224,6 +249,17 @@ if (random.nextInt(i) < k) { IBlockData iblockdata = world.getType(blockposition); -+ + + // CraftBukkit start + org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + @@ -91,9 +90,10 @@ + return; + } + // CraftBukkit end - ++ if (random.nextInt(j + 10) < 5 && !world.isRainingAt(blockposition)) { int l = j + random.nextInt(5) / 4; + @@ -233,7 +269,7 @@ world.setTypeAndData(blockposition, this.getBlockData().set(BlockFire.AGE, Integer.valueOf(l)), 3); @@ -106,7 +106,7 @@ @@ -290,7 +326,7 @@ public void doPhysics(World world, BlockPosition blockposition, IBlockData iblockdata, Block block) { - if (!World.a((IBlockAccess) world, blockposition.down()) && !this.e(world, blockposition)) { + if (!World.a((IBlockAccess) world, blockposition.down()) && !this.f(world, blockposition)) { - world.setAir(blockposition); + fireExtinguished(world, blockposition); // CraftBukkit - fuel block gone } @@ -114,8 +114,8 @@ } @@ -298,7 +334,7 @@ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { - if (world.worldProvider.getDimension() > 0 || !Blocks.PORTAL.d(world, blockposition)) { - if (!World.a((IBlockAccess) world, blockposition.down()) && !this.e(world, blockposition)) { + if (world.worldProvider.getDimension() > 0 || !Blocks.PORTAL.e(world, blockposition)) { + if (!World.a((IBlockAccess) world, blockposition.down()) && !this.f(world, blockposition)) { - world.setAir(blockposition); + fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke } else { diff --git a/nms-patches/BlockFlowing.patch b/nms-patches/BlockFlowing.patch index 458275fe23..9b22e0e18d 100644 --- a/nms-patches/BlockFlowing.patch +++ b/nms-patches/BlockFlowing.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockFlowing.java 2014-11-28 17:43:42.905707439 +0000 -+++ src/main/java/net/minecraft/server/BlockFlowing.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockFlowing.java 2015-02-26 22:40:22.127608144 +0000 ++++ src/main/java/net/minecraft/server/BlockFlowing.java 2015-02-26 22:40:22.127608144 +0000 @@ -5,6 +5,11 @@ import java.util.Random; import java.util.Set; @@ -26,54 +26,39 @@ byte b0 = 1; if (this.material == Material.LAVA && !world.worldProvider.n()) { -@@ -88,17 +98,25 @@ +@@ -88,6 +98,12 @@ IBlockData iblockdata2 = world.getType(blockposition.down()); if (this.h(world, blockposition.down(), iblockdata2)) { -- if (this.material == Material.LAVA && world.getType(blockposition.down()).getBlock().getMaterial() == Material.WATER) { -- world.setTypeUpdate(blockposition.down(), Blocks.STONE.getBlockData()); -- this.fizz(world, blockposition.down()); -- return; -- } + // CraftBukkit start - Send "down" to the server + BlockFromToEvent event = new BlockFromToEvent(source, BlockFace.DOWN); + if (server != null) { + server.getPluginManager().callEvent(event); + } + if (!event.isCancelled()) { -+ if (this.material == Material.LAVA && world.getType(blockposition.down()).getBlock().getMaterial() == Material.WATER) { -+ world.setTypeUpdate(blockposition.down(), Blocks.STONE.getBlockData()); -+ this.fizz(world, blockposition.down()); -+ return; -+ } - -- if (i >= 8) { -- this.flow(world, blockposition.down(), iblockdata2, i); -- } else { -- this.flow(world, blockposition.down(), iblockdata2, i + 8); -+ if (i >= 8) { -+ this.flow(world, blockposition.down(), iblockdata2, i); -+ } else { -+ this.flow(world, blockposition.down(), iblockdata2, i + 8); -+ } + if (this.material == Material.LAVA && world.getType(blockposition.down()).getBlock().getMaterial() == Material.WATER) { + world.setTypeUpdate(blockposition.down(), Blocks.STONE.getBlockData()); + this.fizz(world, blockposition.down()); +@@ -99,6 +115,8 @@ + } else { + this.flow(world, blockposition.down(), iblockdata2, i + 8); } ++ } + // CraftBukkit end } else if (i >= 0 && (i == 0 || this.g(world, blockposition.down(), iblockdata2))) { - Set set = this.e(world, blockposition); - -@@ -115,8 +133,17 @@ + Set set = this.f(world, blockposition); +@@ -116,7 +134,16 @@ while (iterator1.hasNext()) { EnumDirection enumdirection1 = (EnumDirection) iterator1.next(); -- + - this.flow(world, blockposition.shift(enumdirection1), world.getType(blockposition.shift(enumdirection1)), k); -+ + // CraftBukkit start + BlockFromToEvent event = new BlockFromToEvent(source, org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(enumdirection1)); + if (server != null) { + server.getPluginManager().callEvent(event); + } -+ ++ + if (!event.isCancelled()) { + this.flow(world, blockposition.shift(enumdirection1), world.getType(blockposition.shift(enumdirection1)), k); + } diff --git a/nms-patches/BlockGrass.patch b/nms-patches/BlockGrass.patch index 7d6f07dfd3..0e72746d83 100644 --- a/nms-patches/BlockGrass.patch +++ b/nms-patches/BlockGrass.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockGrass.java 2014-11-28 17:43:42.909707439 +0000 -+++ src/main/java/net/minecraft/server/BlockGrass.java 2014-11-28 17:38:17.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockGrass.java 2015-02-26 22:40:22.147608144 +0000 ++++ src/main/java/net/minecraft/server/BlockGrass.java 2015-02-26 22:40:22.147608144 +0000 @@ -2,6 +2,14 @@ import java.util.Random; @@ -17,8 +17,8 @@ public static final BlockStateBoolean SNOWY = BlockStateBoolean.of("snowy"); @@ -22,7 +30,19 @@ public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { - if (!world.isStatic) { - if (world.getLightLevel(blockposition.up()) < 4 && world.getType(blockposition.up()).getBlock().n() > 2) { + if (!world.isClientSide) { + if (world.getLightLevel(blockposition.up()) < 4 && world.getType(blockposition.up()).getBlock().p() > 2) { - world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData()); + // CraftBukkit start + // world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData()); @@ -39,7 +39,7 @@ @@ -31,7 +51,19 @@ IBlockData iblockdata1 = world.getType(blockposition1); - if (iblockdata1.getBlock() == Blocks.DIRT && iblockdata1.get(BlockDirt.VARIANT) == EnumDirtVariant.DIRT && world.getLightLevel(blockposition1.up()) >= 4 && block.n() <= 2) { + if (iblockdata1.getBlock() == Blocks.DIRT && iblockdata1.get(BlockDirt.VARIANT) == BlockDirt.EnumDirtVariant.DIRT && world.getLightLevel(blockposition1.up()) >= 4 && block.p() <= 2) { - world.setTypeUpdate(blockposition1, Blocks.GRASS.getBlockData()); + // CraftBukkit start + // world.setTypeUpdate(blockposition1, Blocks.GRASS.getBlockData()); @@ -58,7 +58,7 @@ } } @@ -74,13 +106,15 @@ - IBlockData iblockdata1 = blockflowers.getBlockData().set(blockflowers.l(), enumflowervarient); + IBlockData iblockdata1 = blockflowers.getBlockData().set(blockflowers.n(), blockflowers_enumflowervarient); if (blockflowers.f(world, blockposition2, iblockdata1)) { - world.setTypeAndData(blockposition2, iblockdata1, 3); @@ -66,11 +66,11 @@ + CraftEventFactory.handleBlockGrowEvent(world, blockposition2.getX(), blockposition2.getY(), blockposition2.getZ(), iblockdata1.getBlock(), iblockdata1.getBlock().toLegacyData(iblockdata1)); // CraftBukkit } } else { - IBlockData iblockdata2 = Blocks.TALLGRASS.getBlockData().set(BlockLongGrass.TYPE, EnumTallGrassType.GRASS); + IBlockData iblockdata2 = Blocks.TALLGRASS.getBlockData().set(BlockLongGrass.TYPE, BlockLongGrass.EnumTallGrassType.GRASS); if (Blocks.TALLGRASS.f(world, blockposition2, iblockdata2)) { - world.setTypeAndData(blockposition2, iblockdata2, 3); -+ // world.setTypeAndData(blockposition2, iblockdata2, 3); // CRaftBukkit ++ // world.setTypeAndData(blockposition2, iblockdata2, 3); // CraftBukkit + CraftEventFactory.handleBlockGrowEvent(world, blockposition2.getX(), blockposition2.getY(), blockposition2.getZ(), iblockdata2.getBlock(), iblockdata2.getBlock().toLegacyData(iblockdata2)); // CraftBukkit } } diff --git a/nms-patches/BlockIce.patch b/nms-patches/BlockIce.patch index 963c7f1e13..3fc30fc8f7 100644 --- a/nms-patches/BlockIce.patch +++ b/nms-patches/BlockIce.patch @@ -1,15 +1,15 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockIce.java 2014-11-28 17:43:42.909707439 +0000 -+++ src/main/java/net/minecraft/server/BlockIce.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockIce.java 2015-02-26 22:40:22.151608144 +0000 ++++ src/main/java/net/minecraft/server/BlockIce.java 2015-02-26 22:40:22.151608144 +0000 @@ -44,6 +44,12 @@ public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { - if (world.b(EnumSkyBlock.BLOCK, blockposition) > 11 - this.n()) { + if (world.b(EnumSkyBlock.BLOCK, blockposition) > 11 - this.p()) { + // CraftBukkit start + if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockFadeEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), world.worldProvider.n() ? Blocks.AIR : Blocks.WATER).isCancelled()) { + return; + } + // CraftBukkit end -+ ++ if (world.worldProvider.n()) { world.setAir(blockposition); } else { diff --git a/nms-patches/BlockJukeBox.patch b/nms-patches/BlockJukeBox.patch new file mode 100644 index 0000000000..9284628f6e --- /dev/null +++ b/nms-patches/BlockJukeBox.patch @@ -0,0 +1,23 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/BlockJukeBox.java 2015-02-26 22:40:22.159608144 +0000 ++++ src/main/java/net/minecraft/server/BlockJukeBox.java 2015-02-26 22:40:22.163608144 +0000 +@@ -32,7 +32,7 @@ + } + } + +- private void dropRecord(World world, BlockPosition blockposition, IBlockData iblockdata) { ++ public void dropRecord(World world, BlockPosition blockposition, IBlockData iblockdata) { // CraftBukkit - public + if (!world.isClientSide) { + TileEntity tileentity = world.getTileEntity(blockposition); + +@@ -136,6 +136,11 @@ + } + + public void setRecord(ItemStack itemstack) { ++ // CraftBukkit start - There can only be one ++ if (itemstack != null) { ++ itemstack.count = 1; ++ } ++ // CraftBukkit end + this.record = itemstack; + this.update(); + } diff --git a/nms-patches/BlockLeaves.patch b/nms-patches/BlockLeaves.patch index be0e66aa31..535f5a8578 100644 --- a/nms-patches/BlockLeaves.patch +++ b/nms-patches/BlockLeaves.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockLeaves.java 2014-11-29 22:31:45.788917956 +0000 -+++ src/main/java/net/minecraft/server/BlockLeaves.java 2014-11-29 22:27:58.604922998 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockLeaves.java 2015-02-26 22:40:22.163608144 +0000 ++++ src/main/java/net/minecraft/server/BlockLeaves.java 2015-02-26 22:40:22.167608144 +0000 @@ -2,6 +2,8 @@ import java.util.Random; @@ -9,10 +9,10 @@ public abstract class BlockLeaves extends BlockTransparent { public static final BlockStateBoolean DECAYABLE = BlockStateBoolean.of("decayable"); -@@ -128,6 +130,14 @@ +@@ -130,6 +132,14 @@ } - private void d(World world, BlockPosition blockposition) { + private void e(World world, BlockPosition blockposition) { + // CraftBukkit start + LeavesDecayEvent event = new LeavesDecayEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ())); + world.getServer().getPluginManager().callEvent(event); diff --git a/nms-patches/BlockLever.patch b/nms-patches/BlockLever.patch index 70df76d284..f3ba7ba346 100644 --- a/nms-patches/BlockLever.patch +++ b/nms-patches/BlockLever.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockLever.java 2014-11-28 17:43:42.917707439 +0000 -+++ src/main/java/net/minecraft/server/BlockLever.java 2014-11-28 17:38:24.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockLever.java 2015-02-26 22:40:22.167608144 +0000 ++++ src/main/java/net/minecraft/server/BlockLever.java 2015-02-26 22:40:22.171608144 +0000 @@ -2,6 +2,8 @@ import java.util.Iterator; @@ -8,13 +8,13 @@ + public class BlockLever extends Block { - public static final BlockStateEnum FACING = BlockStateEnum.of("facing", EnumLeverPosition.class); -@@ -144,6 +146,20 @@ - if (world.isStatic) { + public static final BlockStateEnum FACING = BlockStateEnum.of("facing", BlockLever.EnumLeverPosition.class); +@@ -155,6 +157,20 @@ + if (world.isClientSide) { return true; } else { + // CraftBukkit start - Interact Lever -+ boolean powered = (Boolean)iblockdata.get(POWERED); ++ boolean powered = iblockdata.get(POWERED); + org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + int old = (powered) ? 15 : 0; + int current = (!powered) ? 15 : 0; @@ -26,7 +26,7 @@ + return true; + } + // CraftBukkit end -+ ++ iblockdata = iblockdata.a(BlockLever.POWERED); world.setTypeAndData(blockposition, iblockdata, 3); world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "random.click", 0.3F, ((Boolean) iblockdata.get(BlockLever.POWERED)).booleanValue() ? 0.6F : 0.5F); diff --git a/nms-patches/BlockMinecartDetector.patch b/nms-patches/BlockMinecartDetector.patch index 2ac814ed0d..71085fbd86 100644 --- a/nms-patches/BlockMinecartDetector.patch +++ b/nms-patches/BlockMinecartDetector.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockMinecartDetector.java 2014-11-28 17:43:42.917707439 +0000 -+++ src/main/java/net/minecraft/server/BlockMinecartDetector.java 2014-11-28 17:38:22.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockMinecartDetector.java 2015-02-26 22:40:22.171608144 +0000 ++++ src/main/java/net/minecraft/server/BlockMinecartDetector.java 2015-02-26 22:40:22.175608144 +0000 @@ -4,6 +4,8 @@ import java.util.List; import java.util.Random; @@ -8,12 +8,11 @@ + public class BlockMinecartDetector extends BlockMinecartTrackAbstract { - public static final BlockStateEnum SHAPE = BlockStateEnum.a("shape", EnumTrackPosition.class, (Predicate) (new BlockMinecartDetectorInnerClass1())); -@@ -55,6 +57,17 @@ - if (!list.isEmpty()) { + public static final BlockStateEnum SHAPE = BlockStateEnum.a("shape", BlockMinecartTrackAbstract.EnumTrackPosition.class, new Predicate() { +@@ -64,6 +66,17 @@ flag1 = true; } -+ + + // CraftBukkit start + if (flag != flag1) { + org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); @@ -24,6 +23,7 @@ + flag1 = eventRedstone.getNewCurrent() > 0; + } + // CraftBukkit end - ++ if (flag1 && !flag) { world.setTypeAndData(blockposition, iblockdata.set(BlockMinecartDetector.POWERED, Boolean.valueOf(true)), 3); + world.applyPhysics(blockposition, this); diff --git a/nms-patches/BlockMobSpawner.patch b/nms-patches/BlockMobSpawner.patch index f07d4ccd52..9f5006c3a2 100644 --- a/nms-patches/BlockMobSpawner.patch +++ b/nms-patches/BlockMobSpawner.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockMobSpawner.java 2014-11-28 17:43:42.921707439 +0000 -+++ src/main/java/net/minecraft/server/BlockMobSpawner.java 2014-11-28 17:38:22.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockMobSpawner.java 2015-02-26 22:40:22.175608144 +0000 ++++ src/main/java/net/minecraft/server/BlockMobSpawner.java 2015-02-26 22:40:22.175608144 +0000 @@ -22,9 +22,19 @@ public void dropNaturally(World world, BlockPosition blockposition, IBlockData iblockdata, float f, int i) { diff --git a/nms-patches/BlockMonsterEggs.patch b/nms-patches/BlockMonsterEggs.patch index b764d9b793..fc1e65583d 100644 --- a/nms-patches/BlockMonsterEggs.patch +++ b/nms-patches/BlockMonsterEggs.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockMonsterEggs.java 2014-11-28 17:43:42.921707439 +0000 -+++ src/main/java/net/minecraft/server/BlockMonsterEggs.java 2014-11-28 17:38:20.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockMonsterEggs.java 2015-02-26 22:40:22.179608144 +0000 ++++ src/main/java/net/minecraft/server/BlockMonsterEggs.java 2015-02-26 22:40:22.179608144 +0000 @@ -2,6 +2,8 @@ import java.util.Random; @@ -8,7 +8,7 @@ + public class BlockMonsterEggs extends Block { - public static final BlockStateEnum VARIANT = BlockStateEnum.of("variant", EnumMonsterEggVarient.class); + public static final BlockStateEnum VARIANT = BlockStateEnum.of("variant", BlockMonsterEggs.EnumMonsterEggVarient.class); @@ -50,7 +52,7 @@ EntitySilverfish entitysilverfish = new EntitySilverfish(world); diff --git a/nms-patches/BlockMushroom.patch b/nms-patches/BlockMushroom.patch index e92c3299a6..808c520c53 100644 --- a/nms-patches/BlockMushroom.patch +++ b/nms-patches/BlockMushroom.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockMushroom.java 2014-11-28 17:43:42.925707439 +0000 -+++ src/main/java/net/minecraft/server/BlockMushroom.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockMushroom.java 2015-02-26 22:40:22.183608144 +0000 ++++ src/main/java/net/minecraft/server/BlockMushroom.java 2015-02-26 22:40:22.183608144 +0000 @@ -3,6 +3,12 @@ import java.util.Iterator; import java.util.Random; @@ -21,13 +21,11 @@ if (random.nextInt(25) == 0) { int i = 5; boolean flag = true; -@@ -39,8 +46,20 @@ - blockposition2 = blockposition.a(random.nextInt(3) - 1, random.nextInt(2) - random.nextInt(2), random.nextInt(3) - 1); +@@ -40,7 +47,19 @@ } -- if (world.isEmpty(blockposition2) && this.f(world, blockposition2, this.getBlockData())) { + if (world.isEmpty(blockposition2) && this.f(world, blockposition2, this.getBlockData())) { - world.setTypeAndData(blockposition2, this.getBlockData(), 2); -+ if (world.isEmpty(blockposition2) && this.f(world, blockposition2, this.getBlockData())) { + // CraftBukkit start + // world.setTypeAndData(blockposition2, this.getBlockData(), 2); + org.bukkit.World bworld = world.getWorld(); @@ -49,9 +47,9 @@ if (this == Blocks.BROWN_MUSHROOM) { + BlockSapling.treeType = TreeType.BROWN_MUSHROOM; // CraftBukkit - worldgenhugemushroom = new WorldGenHugeMushroom(0); + worldgenhugemushroom = new WorldGenHugeMushroom(Blocks.BROWN_MUSHROOM_BLOCK); } else if (this == Blocks.RED_MUSHROOM) { + BlockSapling.treeType = TreeType.RED_MUSHROOM; // CraftBukkit - worldgenhugemushroom = new WorldGenHugeMushroom(1); + worldgenhugemushroom = new WorldGenHugeMushroom(Blocks.RED_MUSHROOM_BLOCK); } diff --git a/nms-patches/BlockMycel.patch b/nms-patches/BlockMycel.patch index 911d1312cf..f58aa033c1 100644 --- a/nms-patches/BlockMycel.patch +++ b/nms-patches/BlockMycel.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockMycel.java 2014-11-28 17:43:42.925707439 +0000 -+++ src/main/java/net/minecraft/server/BlockMycel.java 2014-11-28 17:38:20.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockMycel.java 2015-02-26 22:40:22.187608144 +0000 ++++ src/main/java/net/minecraft/server/BlockMycel.java 2015-02-26 22:40:22.187608144 +0000 @@ -2,6 +2,13 @@ import java.util.Random; @@ -16,11 +16,11 @@ public static final BlockStateBoolean SNOWY = BlockStateBoolean.of("snowy"); @@ -22,7 +29,19 @@ public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { - if (!world.isStatic) { - if (world.getLightLevel(blockposition.up()) < 4 && world.getType(blockposition.up()).getBlock().n() > 2) { -- world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData().set(BlockDirt.VARIANT, EnumDirtVariant.DIRT)); + if (!world.isClientSide) { + if (world.getLightLevel(blockposition.up()) < 4 && world.getType(blockposition.up()).getBlock().p() > 2) { +- world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData().set(BlockDirt.VARIANT, BlockDirt.EnumDirtVariant.DIRT)); + // CraftBukkit start -+ // world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData().set(BlockDirt.VARIANT, EnumDirtVariant.DIRT)); ++ // world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData().set(BlockDirt.VARIANT, EnumDirtVariant.DIRT)); + org.bukkit.World bworld = world.getWorld(); + BlockState blockState = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()).getState(); + blockState.setType(CraftMagicNumbers.getMaterial(Blocks.DIRT)); @@ -38,7 +38,7 @@ @@ -31,7 +50,19 @@ Block block = world.getType(blockposition1.up()).getBlock(); - if (iblockdata1.getBlock() == Blocks.DIRT && iblockdata1.get(BlockDirt.VARIANT) == EnumDirtVariant.DIRT && world.getLightLevel(blockposition1.up()) >= 4 && block.n() <= 2) { + if (iblockdata1.getBlock() == Blocks.DIRT && iblockdata1.get(BlockDirt.VARIANT) == BlockDirt.EnumDirtVariant.DIRT && world.getLightLevel(blockposition1.up()) >= 4 && block.p() <= 2) { - world.setTypeUpdate(blockposition1, this.getBlockData()); + // CraftBukkit start + // world.setTypeUpdate(blockposition1, this.getBlockData()); diff --git a/nms-patches/BlockNetherWart.patch b/nms-patches/BlockNetherWart.patch index 389427bb0d..350fa18474 100644 --- a/nms-patches/BlockNetherWart.patch +++ b/nms-patches/BlockNetherWart.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockNetherWart.java 2014-11-28 17:43:42.929707439 +0000 -+++ src/main/java/net/minecraft/server/BlockNetherWart.java 2014-11-28 17:38:18.000000000 +0000 -@@ -28,7 +28,8 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/BlockNetherWart.java 2015-02-26 22:40:22.191608144 +0000 ++++ src/main/java/net/minecraft/server/BlockNetherWart.java 2015-02-26 22:40:22.191608144 +0000 +@@ -29,7 +29,8 @@ if (i < 3 && random.nextInt(10) == 0) { iblockdata = iblockdata.set(BlockNetherWart.AGE, Integer.valueOf(i + 1)); diff --git a/nms-patches/BlockOre.patch b/nms-patches/BlockOre.patch index 2f9ce3e752..a6bbfc1aa6 100644 --- a/nms-patches/BlockOre.patch +++ b/nms-patches/BlockOre.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockOre.java 2014-11-28 17:43:42.929707439 +0000 -+++ src/main/java/net/minecraft/server/BlockOre.java 2014-11-28 17:38:23.000000000 +0000 -@@ -33,6 +33,7 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/BlockOre.java 2015-02-26 22:40:22.191608144 +0000 ++++ src/main/java/net/minecraft/server/BlockOre.java 2015-02-26 22:40:22.195608144 +0000 +@@ -37,6 +37,7 @@ public void dropNaturally(World world, BlockPosition blockposition, IBlockData iblockdata, float f, int i) { super.dropNaturally(world, blockposition, iblockdata, f, i); @@ -8,13 +8,14 @@ if (this.getDropType(iblockdata, world.random, i) != Item.getItemOf(this)) { int j = 0; -@@ -50,7 +51,31 @@ +@@ -54,9 +55,34 @@ this.dropExperience(world, blockposition, j); } -+ // */ -+ } -+ ++ // */ + + } + + @Override + public int getExpDrop(World world, IBlockData iblockdata, int i) { + if (this.getDropType(iblockdata, world.random, i) != Item.getItemOf(this)) { @@ -34,9 +35,11 @@ + + return j; + } - ++ + return 0; + // CraftBukkit end - } - ++ } ++ public int getDropData(World world, BlockPosition blockposition) { + return 0; + } diff --git a/nms-patches/BlockPiston.patch b/nms-patches/BlockPiston.patch index e49c72f42c..1e7d0100c6 100644 --- a/nms-patches/BlockPiston.patch +++ b/nms-patches/BlockPiston.patch @@ -1,34 +1,30 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockPiston.java 2015-01-19 23:27:22.252538854 +0000 -+++ src/main/java/net/minecraft/server/BlockPiston.java 2015-01-19 23:27:22.252538854 +0000 -@@ -1,6 +1,17 @@ - package net.minecraft.server; +--- /home/matt/mc-dev-private//net/minecraft/server/BlockPiston.java 2015-02-26 22:40:22.195608144 +0000 ++++ src/main/java/net/minecraft/server/BlockPiston.java 2015-02-26 22:40:22.199608144 +0000 +@@ -2,6 +2,18 @@ + import java.util.List; + ++// CraftBukkit start +import java.util.AbstractList; +import java.util.Collection; +import java.util.Iterator; - import java.util.List; +import java.util.ListIterator; + -+// CraftBukkit start +import com.google.common.collect.ImmutableList; +import org.bukkit.craftbukkit.block.CraftBlock; +import org.bukkit.event.block.BlockPistonRetractEvent; +import org.bukkit.event.block.BlockPistonExtendEvent; +// CraftBukkit end - ++ public class BlockPiston extends Block { -@@ -52,10 +63,21 @@ - boolean flag = this.b(world, blockposition, enumdirection); - - if (flag && !((Boolean) iblockdata.get(BlockPiston.EXTENDED)).booleanValue()) { -- if ((new PistonExtendsChecker(world, blockposition, enumdirection, true)).a()) { -+ if ((new PistonExtendsChecker(world, blockposition, enumdirection, true)).a()) { + public static final BlockStateDirection FACING = BlockStateDirection.of("facing"); +@@ -56,6 +68,17 @@ world.playBlockAction(blockposition, this, 0, enumdirection.a()); } } else if (!flag && ((Boolean) iblockdata.get(BlockPiston.EXTENDED)).booleanValue()) { + // CraftBukkit start -+ if (!this.M) { ++ if (!this.N) { + org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, ImmutableList.of(), CraftBlock.notchToBlockFace(enumdirection)); + world.getServer().getPluginManager().callEvent(event); @@ -41,16 +37,16 @@ world.setTypeAndData(blockposition, iblockdata.set(BlockPiston.EXTENDED, Boolean.valueOf(false)), 2); world.playBlockAction(blockposition, this, 1, enumdirection.a()); } -@@ -146,7 +168,7 @@ +@@ -146,7 +169,7 @@ } } -- if (!flag1 && block.getMaterial() != Material.AIR && a(block, world, blockposition1, enumdirection.opposite(), false) && (block.i() == 0 || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) { -+ if (!flag1 && a(block, world, blockposition1, enumdirection.opposite(), false) && (block.i() == 0 || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) { // CraftBukkit - remove 'block.getMaterial() != Material.AIR' condition +- if (!flag1 && block.getMaterial() != Material.AIR && a(block, world, blockposition1, enumdirection.opposite(), false) && (block.k() == 0 || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) { ++ if (!flag1 && a(block, world, blockposition1, enumdirection.opposite(), false) && (block.k() == 0 || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) { // CraftBukkit - remove 'block.getMaterial() != Material.AIR' condition this.a(world, blockposition, enumdirection, false); } } else { -@@ -286,10 +308,46 @@ +@@ -286,10 +309,46 @@ if (!pistonextendschecker.a()) { return false; } else { diff --git a/nms-patches/BlockPlant.patch b/nms-patches/BlockPlant.patch index dd72d3a5e9..2481ab4d12 100644 --- a/nms-patches/BlockPlant.patch +++ b/nms-patches/BlockPlant.patch @@ -1,15 +1,17 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/BlockPlant.java 2015-01-31 10:09:14.372634430 +1100 -+++ src/main/java/net/minecraft/server/BlockPlant.java 2015-01-31 10:09:14.372634430 +1100 -@@ -1,6 +1,8 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/BlockPlant.java 2015-02-26 22:40:22.203608144 +0000 ++++ src/main/java/net/minecraft/server/BlockPlant.java 2015-02-26 22:40:22.203608144 +0000 +@@ -1,6 +1,10 @@ package net.minecraft.server; import java.util.Random; ++// CraftBukkit start +import org.bukkit.craftbukkit.util.CraftMagicNumbers; +import org.bukkit.event.block.BlockPhysicsEvent; ++// CraftBukkit end public class BlockPlant extends Block { -@@ -36,6 +38,15 @@ +@@ -40,6 +44,15 @@ protected void e(World world, BlockPosition blockposition, IBlockData iblockdata) { if (!this.f(world, blockposition, iblockdata)) { diff --git a/nms-patches/BlockPortal.patch b/nms-patches/BlockPortal.patch index 4cae10f160..11fc23d745 100644 --- a/nms-patches/BlockPortal.patch +++ b/nms-patches/BlockPortal.patch @@ -1,15 +1,16 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockPortal.java 2014-11-28 17:43:42.933707439 +0000 -+++ src/main/java/net/minecraft/server/BlockPortal.java 2014-11-28 17:38:18.000000000 +0000 -@@ -2,6 +2,8 @@ - +--- /home/matt/mc-dev-private//net/minecraft/server/BlockPortal.java 2015-02-26 22:40:22.207608144 +0000 ++++ src/main/java/net/minecraft/server/BlockPortal.java 2015-02-26 22:40:22.207608144 +0000 +@@ -3,6 +3,9 @@ + import com.google.common.cache.LoadingCache; import java.util.Random; +import org.bukkit.event.entity.EntityPortalEnterEvent; // CraftBukkit ++import org.bukkit.event.world.PortalCreateEvent; // CraftBukkit + public class BlockPortal extends BlockHalfTransparent { - public static final BlockStateEnum AXIS = BlockStateEnum.of("axis", EnumAxis.class, new EnumAxis[] { EnumAxis.X, EnumAxis.Z}); -@@ -24,7 +26,8 @@ + public static final BlockStateEnum AXIS = BlockStateEnum.of("axis", EnumDirection.EnumAxis.class, new EnumDirection.EnumAxis[] { EnumDirection.EnumAxis.X, EnumDirection.EnumAxis.Z}); +@@ -25,7 +28,8 @@ } if (i > 0 && !world.getType(blockposition1.up()).getBlock().isOccluding()) { @@ -18,29 +19,29 @@ + Entity entity = ItemMonsterEgg.spawnCreature(world, 57, (double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 1.1D, (double) blockposition1.getZ() + 0.5D, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL); if (entity != null) { - entity.portalCooldown = entity.ar(); -@@ -66,14 +69,16 @@ - PortalCreator portalcreator = new PortalCreator(world, blockposition, EnumAxis.X); + entity.portalCooldown = entity.aq(); +@@ -67,14 +71,16 @@ + BlockPortal.Shape blockportal_shape = new BlockPortal.Shape(world, blockposition, EnumDirection.EnumAxis.X); - if (portalcreator.b() && PortalCreator.a(portalcreator) == 0) { -- portalcreator.c(); + if (blockportal_shape.d() && blockportal_shape.e == 0) { +- blockportal_shape.e(); - return true; + // CraftBukkit start - return portalcreator -+ return portalcreator.c(); ++ return blockportal_shape.e(); + // return true; } else { - PortalCreator portalcreator1 = new PortalCreator(world, blockposition, EnumAxis.Z); + BlockPortal.Shape blockportal_shape1 = new BlockPortal.Shape(world, blockposition, EnumDirection.EnumAxis.Z); - if (portalcreator1.b() && PortalCreator.a(portalcreator1) == 0) { -- portalcreator1.c(); + if (blockportal_shape1.d() && blockportal_shape1.e == 0) { +- blockportal_shape1.e(); - return true; -+ return portalcreator1.c(); ++ return blockportal_shape1.e(); + // return true; + // CraftBukkit end } else { return false; } -@@ -104,6 +109,10 @@ +@@ -105,6 +111,10 @@ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) { if (entity.vehicle == null && entity.passenger == null) { @@ -48,6 +49,96 @@ + EntityPortalEnterEvent event = new EntityPortalEnterEvent(entity.getBukkitEntity(), new org.bukkit.Location(world.getWorld(), blockposition.getX(), blockposition.getY(), blockposition.getZ())); + world.getServer().getPluginManager().callEvent(event); + // CraftBukkit end - entity.aq(); + entity.d(blockposition); } +@@ -185,6 +195,7 @@ + private BlockPosition f; + private int g; + private int h; ++ java.util.Collection blocks = new java.util.HashSet(); // CraftBukkit - add field + + public Shape(World world, BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) { + this.a = world; +@@ -243,6 +254,10 @@ + } + + protected int c() { ++ // CraftBukkit start ++ this.blocks.clear(); ++ org.bukkit.World bworld = this.a.getWorld(); ++ // CraftBukkit end + int i; + + label56: +@@ -263,11 +278,21 @@ + block = this.a.getType(blockposition.shift(this.d)).getBlock(); + if (block != Blocks.OBSIDIAN) { + break label56; ++ // CraftBukkit start - add the block to our list ++ } else { ++ BlockPosition pos = blockposition.shift(this.d); ++ blocks.add(bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ())); ++ // CraftBukkit end + } + } else if (i == this.h - 1) { + block = this.a.getType(blockposition.shift(this.c)).getBlock(); + if (block != Blocks.OBSIDIAN) { + break label56; ++ // CraftBukkit start - add the block to our list ++ } else { ++ BlockPosition pos = blockposition.shift(this.c); ++ blocks.add(bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ())); ++ // CraftBukkit end + } + } + } +@@ -277,6 +302,11 @@ + if (this.a.getType(this.f.shift(this.c, i).up(this.g)).getBlock() != Blocks.OBSIDIAN) { + this.g = 0; + break; ++ // CraftBukkit start - add the block to our list ++ } else { ++ BlockPosition pos = this.f.shift(this.c, i).up(this.g); ++ blocks.add(bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ())); ++ // CraftBukkit end + } + } + +@@ -298,7 +328,27 @@ + return this.f != null && this.h >= 2 && this.h <= 21 && this.g >= 3 && this.g <= 21; + } + +- public void e() { ++ // CraftBukkit start - return boolean ++ public boolean e() { ++ org.bukkit.World bworld = this.a.getWorld(); ++ ++ // Copy below for loop ++ for (int i = 0; i < this.h; ++i) { ++ BlockPosition blockposition = this.f.shift(this.c, i); ++ ++ for (int j = 0; j < this.g; ++j) { ++ BlockPosition pos = blockposition.up(j); ++ blocks.add(bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ())); ++ } ++ } ++ ++ PortalCreateEvent event = new PortalCreateEvent(blocks, bworld, PortalCreateEvent.CreateReason.FIRE); ++ this.a.getServer().getPluginManager().callEvent(event); ++ ++ if (event.isCancelled()) { ++ return false; ++ } ++ // CraftBukkit end + for (int i = 0; i < this.h; ++i) { + BlockPosition blockposition = this.f.shift(this.c, i); + +@@ -307,6 +357,7 @@ + } + } + ++ return true; // CraftBukkit + } + } + } diff --git a/nms-patches/BlockPoweredRail.patch b/nms-patches/BlockPoweredRail.patch index 717f6102d3..dd3fa0b436 100644 --- a/nms-patches/BlockPoweredRail.patch +++ b/nms-patches/BlockPoweredRail.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockPoweredRail.java 2014-11-28 17:43:42.937707439 +0000 -+++ src/main/java/net/minecraft/server/BlockPoweredRail.java 2014-11-28 17:38:19.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockPoweredRail.java 2015-02-26 22:40:22.211608143 +0000 ++++ src/main/java/net/minecraft/server/BlockPoweredRail.java 2015-02-26 22:40:22.211608143 +0000 @@ -2,6 +2,8 @@ import com.google.common.base.Predicate; @@ -8,8 +8,8 @@ + public class BlockPoweredRail extends BlockMinecartTrackAbstract { - public static final BlockStateEnum SHAPE = BlockStateEnum.a("shape", EnumTrackPosition.class, (Predicate) (new BlockPoweredRailInnerClass1())); -@@ -108,6 +110,13 @@ + public static final BlockStateEnum SHAPE = BlockStateEnum.a("shape", BlockMinecartTrackAbstract.EnumTrackPosition.class, new Predicate() { +@@ -116,6 +118,13 @@ boolean flag1 = world.isBlockIndirectlyPowered(blockposition) || this.a(world, blockposition, iblockdata, true, 0) || this.a(world, blockposition, iblockdata, false, 0); if (flag1 != flag) { @@ -22,4 +22,4 @@ + // CraftBukkit end world.setTypeAndData(blockposition, iblockdata.set(BlockPoweredRail.POWERED, Boolean.valueOf(flag1)), 3); world.applyPhysics(blockposition.down(), this); - if (((EnumTrackPosition) iblockdata.get(BlockPoweredRail.SHAPE)).c()) { + if (((BlockMinecartTrackAbstract.EnumTrackPosition) iblockdata.get(BlockPoweredRail.SHAPE)).c()) { diff --git a/nms-patches/BlockPressurePlateAbstract.patch b/nms-patches/BlockPressurePlateAbstract.patch index ed6c6b2e3e..2e49b8df75 100644 --- a/nms-patches/BlockPressurePlateAbstract.patch +++ b/nms-patches/BlockPressurePlateAbstract.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockPressurePlateAbstract.java 2014-11-28 17:43:42.937707439 +0000 -+++ src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java 2014-11-28 17:38:22.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockPressurePlateAbstract.java 2015-02-26 22:40:22.211608143 +0000 ++++ src/main/java/net/minecraft/server/BlockPressurePlateAbstract.java 2015-02-26 22:40:22.215608143 +0000 @@ -2,6 +2,8 @@ import java.util.Random; @@ -9,11 +9,10 @@ public abstract class BlockPressurePlateAbstract extends Block { protected BlockPressurePlateAbstract(Material material) { -@@ -90,6 +92,19 @@ - int j = this.e(world, blockposition); +@@ -99,6 +101,19 @@ boolean flag = i > 0; boolean flag1 = j > 0; -+ + + // CraftBukkit start - Interact Pressure Plate + org.bukkit.World bworld = world.getWorld(); + org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager(); @@ -26,6 +25,7 @@ + j = eventRedstone.getNewCurrent(); + } + // CraftBukkit end - ++ if (i != j) { iblockdata = this.a(iblockdata, j); + world.setTypeAndData(blockposition, iblockdata, 2); diff --git a/nms-patches/BlockPressurePlateBinary.patch b/nms-patches/BlockPressurePlateBinary.patch index e325111162..4230b6807f 100644 --- a/nms-patches/BlockPressurePlateBinary.patch +++ b/nms-patches/BlockPressurePlateBinary.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockPressurePlateBinary.java 2014-11-28 17:43:42.941707438 +0000 -+++ src/main/java/net/minecraft/server/BlockPressurePlateBinary.java 2014-11-28 17:38:20.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockPressurePlateBinary.java 2015-02-26 22:40:22.215608143 +0000 ++++ src/main/java/net/minecraft/server/BlockPressurePlateBinary.java 2015-02-26 22:40:22.215608143 +0000 @@ -3,6 +3,8 @@ import java.util.Iterator; import java.util.List; @@ -9,11 +9,10 @@ public class BlockPressurePlateBinary extends BlockPressurePlateAbstract { public static final BlockStateBoolean POWERED = BlockStateBoolean.of("powered"); -@@ -44,6 +46,26 @@ - +@@ -45,6 +47,26 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); -+ + + // CraftBukkit start - Call interact event when turning on a pressure plate + if (this.e(world.getType(blockposition)) == 0) { + org.bukkit.World bworld = world.getWorld(); @@ -33,6 +32,7 @@ + } + } + // CraftBukkit end - - if (!entity.aH()) { ++ + if (!entity.aI()) { return 15; + } diff --git a/nms-patches/BlockPressurePlateWeighted.patch b/nms-patches/BlockPressurePlateWeighted.patch index ef6556f690..0b148cdf43 100644 --- a/nms-patches/BlockPressurePlateWeighted.patch +++ b/nms-patches/BlockPressurePlateWeighted.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockPressurePlateWeighted.java 2014-11-28 17:43:42.945707438 +0000 -+++ src/main/java/net/minecraft/server/BlockPressurePlateWeighted.java 2014-11-28 17:38:19.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockPressurePlateWeighted.java 2015-02-26 22:40:22.219608143 +0000 ++++ src/main/java/net/minecraft/server/BlockPressurePlateWeighted.java 2015-02-26 22:40:22.219608143 +0000 @@ -1,5 +1,7 @@ package net.minecraft.server; @@ -8,10 +8,10 @@ public class BlockPressurePlateWeighted extends BlockPressurePlateAbstract { public static final BlockStateInteger POWER = BlockStateInteger.of("power", 0, 15); -@@ -12,7 +14,31 @@ +@@ -16,7 +18,31 @@ } - protected int e(World world, BlockPosition blockposition) { + protected int f(World world, BlockPosition blockposition) { - int i = Math.min(world.a(Entity.class, this.a(blockposition)).size(), this.b); + // CraftBukkit start + //int i = Math.min(world.a(Entity.class, this.a(blockposition)).size(), this.b); diff --git a/nms-patches/BlockPumpkin.patch b/nms-patches/BlockPumpkin.patch index 6e9c27e2a2..77cac22aab 100644 --- a/nms-patches/BlockPumpkin.patch +++ b/nms-patches/BlockPumpkin.patch @@ -1,7 +1,8 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockPumpkin.java 2014-11-28 17:43:42.945707438 +0000 -+++ src/main/java/net/minecraft/server/BlockPumpkin.java 2014-11-28 17:38:16.000000000 +0000 -@@ -1,5 +1,11 @@ - package net.minecraft.server; +--- /home/matt/mc-dev-private//net/minecraft/server/BlockPumpkin.java 2015-02-26 22:40:22.223608143 +0000 ++++ src/main/java/net/minecraft/server/BlockPumpkin.java 2015-02-26 22:40:22.223608143 +0000 +@@ -2,6 +2,12 @@ + + import com.google.common.base.Predicate; +// CraftBukkit start +import org.bukkit.craftbukkit.util.BlockStateListPopulator; @@ -12,13 +13,13 @@ public class BlockPumpkin extends BlockDirectional { private ShapeDetector snowGolemPart; -@@ -29,31 +35,45 @@ +@@ -40,17 +46,24 @@ int j; - if ((shapedetectorcollection = this.getDetectorSnowGolem().a(world, blockposition)) != null) { + if ((shapedetector_shapedetectorcollection = this.getDetectorSnowGolem().a(world, blockposition)) != null) { + BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); // CraftBukkit - Use BlockStateListPopulator for (i = 0; i < this.getDetectorSnowGolem().b(); ++i) { - ShapeDetectorBlock shapedetectorblock = shapedetectorcollection.a(0, i, 0); + ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.a(0, i, 0); - world.setTypeAndData(shapedetectorblock.d(), Blocks.AIR.getBlockData(), 2); + // CraftBukkit start @@ -29,7 +30,7 @@ } EntitySnowman entitysnowman = new EntitySnowman(world); - BlockPosition blockposition1 = shapedetectorcollection.a(0, 2, 0).d(); + BlockPosition blockposition1 = shapedetector_shapedetectorcollection.a(0, 2, 0).d(); entitysnowman.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.05D, (double) blockposition1.getZ() + 0.5D, 0.0F, 0.0F); - world.addEntity(entitysnowman); @@ -37,81 +38,43 @@ + if (world.addEntity(entitysnowman, SpawnReason.BUILD_SNOWMAN)) { + blockList.updateList(); -- for (j = 0; j < 120; ++j) { -- world.addParticle(EnumParticle.SNOW_SHOVEL, (double) blockposition1.getX() + world.random.nextDouble(), (double) blockposition1.getY() + world.random.nextDouble() * 2.5D, (double) blockposition1.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]); -- } -+ for (j = 0; j < 120; ++j) { -+ world.addParticle(EnumParticle.SNOW_SHOVEL, (double) blockposition1.getX() + world.random.nextDouble(), (double) blockposition1.getY() + world.random.nextDouble() * 2.5D, (double) blockposition1.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]); -+ } + for (j = 0; j < 120; ++j) { + world.addParticle(EnumParticle.SNOW_SHOVEL, (double) blockposition1.getX() + world.random.nextDouble(), (double) blockposition1.getY() + world.random.nextDouble() * 2.5D, (double) blockposition1.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]); +@@ -61,10 +74,16 @@ -- for (j = 0; j < this.getDetectorSnowGolem().b(); ++j) { -- ShapeDetectorBlock shapedetectorblock1 = shapedetectorcollection.a(0, j, 0); -+ for (j = 0; j < this.getDetectorSnowGolem().b(); ++j) { -+ ShapeDetectorBlock shapedetectorblock1 = shapedetectorcollection.a(0, j, 0); - -- world.update(shapedetectorblock1.d(), Blocks.AIR); -+ world.update(shapedetectorblock1.d(), Blocks.AIR); -+ } + world.update(shapedetectorblock1.d(), Blocks.AIR); } -+ // CraftBukkit end - } else if ((shapedetectorcollection = this.getDetectorIronGolem().a(world, blockposition)) != null) { ++ } // CraftBukkit end + } else if ((shapedetector_shapedetectorcollection = this.getDetectorIronGolem().a(world, blockposition)) != null) { + BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); // CraftBukkit - Use BlockStateListPopulator for (i = 0; i < this.getDetectorIronGolem().c(); ++i) { for (int k = 0; k < this.getDetectorIronGolem().b(); ++k) { -- world.setTypeAndData(shapedetectorcollection.a(i, k, 0).d(), Blocks.AIR.getBlockData(), 2); +- world.setTypeAndData(shapedetector_shapedetectorcollection.a(i, k, 0).d(), Blocks.AIR.getBlockData(), 2); + // CraftBukkit start + // world.setTypeAndData(shapedetectorcollection.a(i, k, 0).d(), Blocks.AIR.getBlockData(), 2); -+ BlockPosition pos = shapedetectorcollection.a(i, k, 0).d(); ++ BlockPosition pos = shapedetector_shapedetectorcollection.a(i, k, 0).d(); + blockList.setTypeId(pos.getX(), pos.getY(), pos.getZ(), 0); + // CraftBukkit end } } -@@ -62,22 +82,38 @@ +@@ -73,7 +92,10 @@ entityirongolem.setPlayerCreated(true); entityirongolem.setPositionRotation((double) blockposition2.getX() + 0.5D, (double) blockposition2.getY() + 0.05D, (double) blockposition2.getZ() + 0.5D, 0.0F, 0.0F); - world.addEntity(entityirongolem); -- -- for (j = 0; j < 120; ++j) { -- world.addParticle(EnumParticle.SNOWBALL, (double) blockposition2.getX() + world.random.nextDouble(), (double) blockposition2.getY() + world.random.nextDouble() * 3.9D, (double) blockposition2.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]); -- } ++ + // CraftBukkit start -+ if (world.addEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) { ++ if (world.addEntity(entityirongolem, SpawnReason.BUILD_IRONGOLEM)) { + blockList.updateList(); -+ -+ for (j = 0; j < 120; ++j) { -+ world.addParticle(EnumParticle.SNOWBALL, (double) blockposition2.getX() + world.random.nextDouble(), (double) blockposition2.getY() + world.random.nextDouble() * 3.9D, (double) blockposition2.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]); -+ } -- for (j = 0; j < this.getDetectorIronGolem().c(); ++j) { -- for (int l = 0; l < this.getDetectorIronGolem().b(); ++l) { -- ShapeDetectorBlock shapedetectorblock2 = shapedetectorcollection.a(j, l, 0); -+ for (j = 0; j < this.getDetectorIronGolem().c(); ++j) { -+ for (int l = 0; l < this.getDetectorIronGolem().b(); ++l) { -+ ShapeDetectorBlock shapedetectorblock2 = shapedetectorcollection.a(j, l, 0); - -- world.update(shapedetectorblock2.d(), Blocks.AIR); -+ world.update(shapedetectorblock2.d(), Blocks.AIR); -+ } + for (j = 0; j < 120; ++j) { + world.addParticle(EnumParticle.SNOWBALL, (double) blockposition2.getX() + world.random.nextDouble(), (double) blockposition2.getY() + world.random.nextDouble() * 3.9D, (double) blockposition2.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]); +@@ -86,6 +108,7 @@ + world.update(shapedetectorblock2.d(), Blocks.AIR); } } -+ // CraftBukkit end ++ } // CraftBukkit end } -+ } -+ // CraftBukkit start -+ @Override -+ public void doPhysics(World world, BlockPosition position, IBlockData data, Block block) { -+ if (block != null && block.isPowerSource()) { -+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()); -+ int power = bukkitBlock.getBlockPower(); -+ -+ BlockRedstoneEvent eventRedstone = new BlockRedstoneEvent(bukkitBlock, power, power); -+ world.getServer().getPluginManager().callEvent(eventRedstone); -+ } } -+ // CraftBukkit end - - public boolean canPlace(World world, BlockPosition blockposition) { - return world.getType(blockposition).getBlock().material.isReplaceable() && World.a((IBlockAccess) world, blockposition.down()); diff --git a/nms-patches/BlockRedstoneLamp.patch b/nms-patches/BlockRedstoneLamp.patch index 9a1523957a..a784853ace 100644 --- a/nms-patches/BlockRedstoneLamp.patch +++ b/nms-patches/BlockRedstoneLamp.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockRedstoneLamp.java 2014-11-28 17:43:42.945707438 +0000 -+++ src/main/java/net/minecraft/server/BlockRedstoneLamp.java 2014-11-28 17:38:20.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockRedstoneLamp.java 2015-02-26 22:40:22.227608143 +0000 ++++ src/main/java/net/minecraft/server/BlockRedstoneLamp.java 2015-02-26 22:40:22.227608143 +0000 @@ -2,6 +2,8 @@ import java.util.Random; @@ -35,13 +35,13 @@ @@ -40,6 +52,11 @@ public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { - if (!world.isStatic) { + if (!world.isClientSide) { if (this.a && !world.isBlockIndirectlyPowered(blockposition)) { -+ // CraftBukkit start -+ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) { -+ return; -+ } -+ // CraftBukkit end ++ // CraftBukkit start ++ if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 15, 0).getNewCurrent() != 0) { ++ return; ++ } ++ // CraftBukkit end world.setTypeAndData(blockposition, Blocks.REDSTONE_LAMP.getBlockData(), 2); } diff --git a/nms-patches/BlockRedstoneOre.patch b/nms-patches/BlockRedstoneOre.patch index 0bfc945b83..afbebbc5eb 100644 --- a/nms-patches/BlockRedstoneOre.patch +++ b/nms-patches/BlockRedstoneOre.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockRedstoneOre.java 2014-11-28 17:43:42.949707438 +0000 -+++ src/main/java/net/minecraft/server/BlockRedstoneOre.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockRedstoneOre.java 2015-02-26 22:40:22.231608143 +0000 ++++ src/main/java/net/minecraft/server/BlockRedstoneOre.java 2015-02-26 22:40:22.231608143 +0000 @@ -2,6 +2,11 @@ import java.util.Random; @@ -16,44 +16,43 @@ } public void attack(World world, BlockPosition blockposition, EntityHuman entityhuman) { -- this.d(world, blockposition); -+ this.d(world, blockposition, entityhuman); // CraftBukkit - add entityhuman +- this.e(world, blockposition); ++ this.e(world, blockposition, entityhuman); // CraftBukkit - add entityhuman super.attack(world, blockposition, entityhuman); } -- public void a(World world, BlockPosition blockposition, Entity entity) { -- this.d(world, blockposition); + public void a(World world, BlockPosition blockposition, Entity entity) { +- this.e(world, blockposition); - super.a(world, blockposition, entity); -+ public void a(World world, BlockPosition blockposition, Entity entity) { + // CraftBukkit start -+ // this.d(world, blockposition); -+ // super.a(world, blockposition, entity); ++ // this.e(world, blockposition); ++ // super.a(world, blockposition, entity); + if (entity instanceof EntityHuman) { + org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent((EntityHuman) entity, org.bukkit.event.block.Action.PHYSICAL, blockposition, null, null); + if (!event.isCancelled()) { -+ this.d(world, blockposition, entity); // add entity -+ super.a(world, blockposition, entity); ++ this.e(world, blockposition, entity); // add entity ++ super.a(world, blockposition, entity); + } + } else { + EntityInteractEvent event = new EntityInteractEvent(entity.getBukkitEntity(), world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ())); + world.getServer().getPluginManager().callEvent(event); + if (!event.isCancelled()) { -+ this.d(world, blockposition, entity); // add entity -+ super.a(world, blockposition, entity); ++ this.e(world, blockposition, entity); // add entity ++ super.a(world, blockposition, entity); + } + } + // CraftBukkit end } public boolean interact(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman, EnumDirection enumdirection, float f, float f1, float f2) { -- this.d(world, blockposition); -+ this.d(world, blockposition, entityhuman); // CraftBukkit - add entityhuman +- this.e(world, blockposition); ++ this.e(world, blockposition, entityhuman); // CraftBukkit - add entityhuman return super.interact(world, blockposition, iblockdata, entityhuman, enumdirection, f, f1, f2); } -- private void d(World world, BlockPosition blockposition) { -+ private void d(World world, BlockPosition blockposition, Entity entity) { // CraftBukkit - add Entity - this.e(world, blockposition); +- private void e(World world, BlockPosition blockposition) { ++ private void e(World world, BlockPosition blockposition, Entity entity) { // CraftBukkit - add Entity + this.f(world, blockposition); if (this == Blocks.REDSTONE_ORE) { + // CraftBukkit start + if (CraftEventFactory.callEntityChangeBlockEvent(entity, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.LIT_REDSTONE_ORE, 0).isCancelled()) { @@ -99,4 +98,4 @@ + // CraftBukkit end } - private void e(World world, BlockPosition blockposition) { + private void f(World world, BlockPosition blockposition) { diff --git a/nms-patches/BlockRedstoneTorch.patch b/nms-patches/BlockRedstoneTorch.patch index 8fcee650c9..24ebe58e74 100644 --- a/nms-patches/BlockRedstoneTorch.patch +++ b/nms-patches/BlockRedstoneTorch.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockRedstoneTorch.java 2014-11-28 17:43:42.949707438 +0000 -+++ src/main/java/net/minecraft/server/BlockRedstoneTorch.java 2014-11-28 17:38:19.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockRedstoneTorch.java 2015-02-26 22:40:22.231608143 +0000 ++++ src/main/java/net/minecraft/server/BlockRedstoneTorch.java 2015-02-26 22:40:22.235608143 +0000 @@ -6,6 +6,8 @@ import java.util.Map; import java.util.Random; @@ -8,12 +8,20 @@ + public class BlockRedstoneTorch extends BlockTorch { - private static Map b = Maps.newHashMap(); -@@ -95,9 +97,26 @@ - while (list != null && !list.isEmpty() && world.getTime() - ((RedstoneUpdateInfo) list.get(0)).b > 60L) { + private static Map> b = Maps.newHashMap(); +@@ -13,7 +15,7 @@ + + private boolean a(World world, BlockPosition blockposition, boolean flag) { + if (!BlockRedstoneTorch.b.containsKey(world)) { +- BlockRedstoneTorch.b.put(world, Lists.newArrayList()); ++ BlockRedstoneTorch.b.put(world, Lists.newArrayList()); // CraftBukkit - fix decompile error + } + + List list = (List) BlockRedstoneTorch.b.get(world); +@@ -96,8 +98,25 @@ list.remove(0); } -+ + + // CraftBukkit start + org.bukkit.plugin.PluginManager manager = world.getServer().getPluginManager(); + org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); @@ -21,7 +29,7 @@ + + BlockRedstoneEvent event = new BlockRedstoneEvent(block, oldCurrent, oldCurrent); + // CraftBukkit end - ++ if (this.isOn) { if (flag) { + // CraftBukkit start @@ -36,7 +44,7 @@ world.setTypeAndData(blockposition, Blocks.UNLIT_REDSTONE_TORCH.getBlockData().set(BlockRedstoneTorch.FACING, iblockdata.get(BlockRedstoneTorch.FACING)), 3); if (this.a(world, blockposition, true)) { world.makeSound((double) ((float) blockposition.getX() + 0.5F), (double) ((float) blockposition.getY() + 0.5F), (double) ((float) blockposition.getZ() + 0.5F), "random.fizz", 0.5F, 2.6F + (world.random.nextFloat() - world.random.nextFloat()) * 0.8F); -@@ -114,6 +133,16 @@ +@@ -114,6 +133,15 @@ } } } else if (!flag && !this.a(world, blockposition, false)) { @@ -49,7 +57,6 @@ + } + } + // CraftBukkit end -+ world.setTypeAndData(blockposition, Blocks.REDSTONE_TORCH.getBlockData().set(BlockRedstoneTorch.FACING, iblockdata.get(BlockRedstoneTorch.FACING)), 3); } diff --git a/nms-patches/BlockRedstoneWire.patch b/nms-patches/BlockRedstoneWire.patch index dc1362b776..e6ec4d36d6 100644 --- a/nms-patches/BlockRedstoneWire.patch +++ b/nms-patches/BlockRedstoneWire.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockRedstoneWire.java 2014-11-28 17:43:42.953707438 +0000 -+++ src/main/java/net/minecraft/server/BlockRedstoneWire.java 2014-11-28 17:38:19.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockRedstoneWire.java 2015-02-26 22:40:22.239608143 +0000 ++++ src/main/java/net/minecraft/server/BlockRedstoneWire.java 2015-02-26 22:40:22.239608143 +0000 @@ -8,6 +8,8 @@ import java.util.Random; import java.util.Set; @@ -8,12 +8,11 @@ + public class BlockRedstoneWire extends Block { - public static final BlockStateEnum NORTH = BlockStateEnum.of("north", EnumRedstoneWireConnection.class); -@@ -123,6 +125,15 @@ - if (k > j - 1) { + public static final BlockStateEnum NORTH = BlockStateEnum.of("north", BlockRedstoneWire.EnumRedstoneWireConnection.class); +@@ -124,6 +126,15 @@ j = k; } -+ + + // CraftBukkit start + if (i != j) { + BlockRedstoneEvent event = new BlockRedstoneEvent(world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), i, j); @@ -22,6 +21,16 @@ + j = event.getNewCurrent(); + } + // CraftBukkit end - ++ if (i != j) { iblockdata = iblockdata.set(BlockRedstoneWire.POWER, Integer.valueOf(j)); + if (world.getType(blockposition) == iblockdata1) { +@@ -232,7 +243,7 @@ + } + } + +- private int getPower(World world, BlockPosition blockposition, int i) { ++ public int getPower(World world, BlockPosition blockposition, int i) { // CraftBukkit - public + if (world.getType(blockposition).getBlock() != this) { + return i; + } else { diff --git a/nms-patches/BlockReed.patch b/nms-patches/BlockReed.patch index 5a84ef6315..ab5e66ed8d 100644 --- a/nms-patches/BlockReed.patch +++ b/nms-patches/BlockReed.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/BlockReed.java 2014-12-11 00:44:17.804251801 +0000 -+++ src/main/java/net/minecraft/server/BlockReed.java 2014-12-11 00:43:36.504252249 +0000 -@@ -29,8 +29,13 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/BlockReed.java 2015-02-26 22:40:22.243608143 +0000 ++++ src/main/java/net/minecraft/server/BlockReed.java 2015-02-26 22:40:22.243608143 +0000 +@@ -29,8 +29,12 @@ int j = ((Integer) iblockdata.get(BlockReed.AGE)).intValue(); if (j == 15) { @@ -11,7 +11,6 @@ + org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockGrowEvent(world, upPos.getX(), upPos.getY(), upPos.getZ(), this, 0); world.setTypeAndData(blockposition, iblockdata.set(BlockReed.AGE, Integer.valueOf(0)), 4); + // CraftBukkit end -+ } else { world.setTypeAndData(blockposition, iblockdata.set(BlockReed.AGE, Integer.valueOf(j + 1)), 4); } diff --git a/nms-patches/BlockSapling.patch b/nms-patches/BlockSapling.patch index 2b65eaf199..366e3614d9 100644 --- a/nms-patches/BlockSapling.patch +++ b/nms-patches/BlockSapling.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockSapling.java 2014-11-28 17:43:42.957707438 +0000 -+++ src/main/java/net/minecraft/server/BlockSapling.java 2014-11-28 17:38:17.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockSapling.java 2015-02-26 22:40:22.243608143 +0000 ++++ src/main/java/net/minecraft/server/BlockSapling.java 2015-02-26 22:40:22.247608143 +0000 @@ -2,10 +2,20 @@ import java.util.Random; @@ -15,14 +15,14 @@ + public class BlockSapling extends BlockPlant implements IBlockFragilePlantElement { - public static final BlockStateEnum TYPE = BlockStateEnum.of("type", EnumLogVariant.class); + public static final BlockStateEnum TYPE = BlockStateEnum.of("type", BlockWood.EnumLogVariant.class); public static final BlockStateInteger STAGE = BlockStateInteger.of("stage", 0, 1); + public static TreeType treeType; // CraftBukkit protected BlockSapling() { - this.j(this.blockStateList.getBlockData().set(BlockSapling.TYPE, EnumLogVariant.OAK).set(BlockSapling.STAGE, Integer.valueOf(0))); -@@ -19,7 +29,30 @@ - if (!world.isStatic) { + this.j(this.blockStateList.getBlockData().set(BlockSapling.TYPE, BlockWood.EnumLogVariant.OAK).set(BlockSapling.STAGE, Integer.valueOf(0))); +@@ -23,7 +33,30 @@ + if (!world.isClientSide) { super.b(world, blockposition, iblockdata, random); if (world.getLightLevel(blockposition.up()) >= 9 && random.nextInt(7) == 0) { + // CraftBukkit start @@ -52,7 +52,7 @@ } } -@@ -35,7 +68,17 @@ +@@ -39,7 +72,17 @@ } public void e(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { @@ -71,15 +71,15 @@ int i = 0; int j = 0; boolean flag = false; -@@ -46,6 +89,7 @@ +@@ -51,6 +94,7 @@ for (i = 0; i >= -1; --i) { for (j = 0; j >= -1; --j) { - if (this.a(world, blockposition.a(i, 0, j), EnumLogVariant.SPRUCE) && this.a(world, blockposition.a(i + 1, 0, j), EnumLogVariant.SPRUCE) && this.a(world, blockposition.a(i, 0, j + 1), EnumLogVariant.SPRUCE) && this.a(world, blockposition.a(i + 1, 0, j + 1), EnumLogVariant.SPRUCE)) { + if (this.a(world, blockposition, i, j, BlockWood.EnumLogVariant.SPRUCE)) { + treeType = TreeType.MEGA_REDWOOD; // CraftBukkit object = new WorldGenMegaTree(false, random.nextBoolean()); flag = true; - break label78; -@@ -56,11 +100,13 @@ + break label66; +@@ -61,11 +105,13 @@ if (!flag) { j = 0; i = 0; @@ -93,33 +93,33 @@ object = new WorldGenForest(true, false); break; -@@ -69,6 +115,7 @@ +@@ -77,6 +123,7 @@ for (i = 0; i >= -1; --i) { for (j = 0; j >= -1; --j) { - if (this.a(world, blockposition.a(i, 0, j), EnumLogVariant.JUNGLE) && this.a(world, blockposition.a(i + 1, 0, j), EnumLogVariant.JUNGLE) && this.a(world, blockposition.a(i, 0, j + 1), EnumLogVariant.JUNGLE) && this.a(world, blockposition.a(i + 1, 0, j + 1), EnumLogVariant.JUNGLE)) { + if (this.a(world, blockposition, i, j, BlockWood.EnumLogVariant.JUNGLE)) { + treeType = TreeType.JUNGLE; // CraftBukkit - object = new WorldGenJungleTree(true, 10, 20, EnumLogVariant.JUNGLE.a(), EnumLogVariant.JUNGLE.a()); + object = new WorldGenJungleTree(true, 10, 20, iblockdata1, iblockdata2); flag = true; - break label93; -@@ -79,11 +126,13 @@ + break label78; +@@ -87,11 +134,13 @@ if (!flag) { j = 0; i = 0; + treeType = TreeType.SMALL_JUNGLE; // CraftBukkit - object = new WorldGenTrees(true, 4 + random.nextInt(7), EnumLogVariant.JUNGLE.a(), EnumLogVariant.JUNGLE.a(), false); + object = new WorldGenTrees(true, 4 + random.nextInt(7), iblockdata1, iblockdata2, false); } break; case 4: -+ treeType = TreeType.ACACIA; // CraftBukki ++ treeType = TreeType.ACACIA; // CraftBukkit object = new WorldGenAcaciaTree(true); break; -@@ -92,6 +141,7 @@ +@@ -100,6 +149,7 @@ for (i = 0; i >= -1; --i) { for (j = 0; j >= -1; --j) { - if (this.a(world, blockposition.a(i, 0, j), EnumLogVariant.DARK_OAK) && this.a(world, blockposition.a(i + 1, 0, j), EnumLogVariant.DARK_OAK) && this.a(world, blockposition.a(i, 0, j + 1), EnumLogVariant.DARK_OAK) && this.a(world, blockposition.a(i + 1, 0, j + 1), EnumLogVariant.DARK_OAK)) { + if (this.a(world, blockposition, i, j, BlockWood.EnumLogVariant.DARK_OAK)) { + treeType = TreeType.DARK_OAK; // CraftBukkit object = new WorldGenForestTree(true); flag = true; - break label108; + break label90; diff --git a/nms-patches/BlockSkull.patch b/nms-patches/BlockSkull.patch index ad1807abcf..85871527c7 100644 --- a/nms-patches/BlockSkull.patch +++ b/nms-patches/BlockSkull.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockSkull.java 2015-02-02 21:55:13.808077826 +0000 -+++ src/main/java/net/minecraft/server/BlockSkull.java 2015-02-02 21:55:13.808077826 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockSkull.java 2015-02-27 00:00:38.507555865 +0000 ++++ src/main/java/net/minecraft/server/BlockSkull.java 2015-02-27 00:00:38.507555865 +0000 @@ -4,6 +4,11 @@ import java.util.Iterator; import java.util.Random; @@ -12,12 +12,13 @@ public class BlockSkull extends BlockContainer { public static final BlockStateDirection FACING = BlockStateDirection.of("facing"); -@@ -69,8 +74,25 @@ +@@ -81,8 +86,26 @@ return tileentity instanceof TileEntitySkull ? ((TileEntitySkull) tileentity).getSkullType() : super.getDropData(world, blockposition); } + + // CraftBukkit start - Special case dropping so we can get info from the tile entity ++ @Override + public void dropNaturally(World world, BlockPosition blockposition, IBlockData iblockdata, float f, int i) { + if (world.random.nextFloat() < f) { + ItemStack itemstack = new ItemStack(Items.SKULL, 1, this.getDropData(world, blockposition)); @@ -39,10 +40,10 @@ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) { if (entityhuman.abilities.canInstantlyBuild) { -@@ -83,7 +105,10 @@ +@@ -95,7 +118,10 @@ public void remove(World world, BlockPosition blockposition, IBlockData iblockdata) { - if (!world.isStatic) { + if (!world.isClientSide) { - if (!((Boolean) iblockdata.get(BlockSkull.NODROP)).booleanValue()) { + // CraftBukkit start - Drop item in code above, not here + // if (!((Boolean) iblockdata.get(BlockSkull.NODROP)).booleanValue()) { @@ -51,22 +52,22 @@ TileEntity tileentity = world.getTileEntity(blockposition); if (tileentity instanceof TileEntitySkull) { -@@ -115,24 +140,36 @@ +@@ -127,24 +153,36 @@ } public void a(World world, BlockPosition blockposition, TileEntitySkull tileentityskull) { + if (world.captureBlockStates) return; // CraftBukkit - if (tileentityskull.getSkullType() == 1 && blockposition.getY() >= 2 && world.getDifficulty() != EnumDifficulty.PEACEFUL && !world.isStatic) { - ShapeDetector shapedetector = this.l(); - ShapeDetectorCollection shapedetectorcollection = shapedetector.a(world, blockposition); + if (tileentityskull.getSkullType() == 1 && blockposition.getY() >= 2 && world.getDifficulty() != EnumDifficulty.PEACEFUL && !world.isClientSide) { + ShapeDetector shapedetector = this.n(); + ShapeDetector.ShapeDetectorCollection shapedetector_shapedetectorcollection = shapedetector.a(world, blockposition); - if (shapedetectorcollection != null) { + if (shapedetector_shapedetectorcollection != null) { + // CraftBukkit start - Use BlockStateListPopulator + BlockStateListPopulator blockList = new BlockStateListPopulator(world.getWorld()); int i; for (i = 0; i < 3; ++i) { - ShapeDetectorBlock shapedetectorblock = shapedetectorcollection.a(i, 0, 0); + ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.a(i, 0, 0); - world.setTypeAndData(shapedetectorblock.d(), shapedetectorblock.a().set(BlockSkull.NODROP, Boolean.valueOf(true)), 2); + // CraftBukkit start @@ -79,7 +80,7 @@ for (i = 0; i < shapedetector.c(); ++i) { for (int j = 0; j < shapedetector.b(); ++j) { - ShapeDetectorBlock shapedetectorblock1 = shapedetectorcollection.a(i, j, 0); + ShapeDetectorBlock shapedetectorblock1 = shapedetector_shapedetectorcollection.a(i, j, 0); - world.setTypeAndData(shapedetectorblock1.d(), Blocks.AIR.getBlockData(), 2); + // CraftBukkit start @@ -90,50 +91,30 @@ } } -@@ -145,28 +182,31 @@ +@@ -157,14 +195,16 @@ entitywither.n(); Iterator iterator = world.a(EntityHuman.class, entitywither.getBoundingBox().grow(50.0D, 50.0D, 50.0D)).iterator(); -- while (iterator.hasNext()) { -- EntityHuman entityhuman = (EntityHuman) iterator.next(); + // CraftBukkit start -+ if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) { -+ while (iterator.hasNext()) { -+ EntityHuman entityhuman = (EntityHuman) iterator.next(); - -- entityhuman.b((Statistic) AchievementList.I); -- } -- -- world.addEntity(entitywither); -+ entityhuman.b((Statistic) AchievementList.I); -+ } -+ ++ if (world.addEntity(entitywither, SpawnReason.BUILD_WITHER)) { + blockList.updateList(); ++ + while (iterator.hasNext()) { + EntityHuman entityhuman = (EntityHuman) iterator.next(); -- int k; -+ int k; + entityhuman.b((Statistic) AchievementList.I); + } -- for (k = 0; k < 120; ++k) { -- world.addParticle(EnumParticle.SNOWBALL, (double) blockposition1.getX() + world.random.nextDouble(), (double) (blockposition1.getY() - 2) + world.random.nextDouble() * 3.9D, (double) blockposition1.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]); -- } -+ for (k = 0; k < 120; ++k) { -+ world.addParticle(EnumParticle.SNOWBALL, (double) blockposition1.getX() + world.random.nextDouble(), (double) (blockposition1.getY() - 2) + world.random.nextDouble() * 3.9D, (double) blockposition1.getZ() + world.random.nextDouble(), 0.0D, 0.0D, 0.0D, new int[0]); -+ } +- world.addEntity(entitywither); +- + int k; -- for (k = 0; k < shapedetector.c(); ++k) { -- for (int l = 0; l < shapedetector.b(); ++l) { -- ShapeDetectorBlock shapedetectorblock2 = shapedetectorcollection.a(k, l, 0); -+ for (k = 0; k < shapedetector.c(); ++k) { -+ for (int l = 0; l < shapedetector.b(); ++l) { -+ ShapeDetectorBlock shapedetectorblock2 = shapedetectorcollection.a(k, l, 0); - -- world.update(shapedetectorblock2.d(), Blocks.AIR); -+ world.update(shapedetectorblock2.d(), Blocks.AIR); -+ } + for (k = 0; k < 120; ++k) { +@@ -178,6 +218,7 @@ + world.update(shapedetectorblock2.d(), Blocks.AIR); } } -- -+ // CraftBukkit end ++ } // CraftBukkit end + } } - } diff --git a/nms-patches/BlockSnow.patch b/nms-patches/BlockSnow.patch index cfb51ffdc2..71da49d7fc 100644 --- a/nms-patches/BlockSnow.patch +++ b/nms-patches/BlockSnow.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockSnow.java 2014-11-28 17:43:42.961707438 +0000 -+++ src/main/java/net/minecraft/server/BlockSnow.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockSnow.java 2015-02-26 22:40:22.251608143 +0000 ++++ src/main/java/net/minecraft/server/BlockSnow.java 2015-02-26 22:40:22.255608143 +0000 @@ -85,6 +85,11 @@ public void b(World world, BlockPosition blockposition, IBlockData iblockdata, Random random) { diff --git a/nms-patches/BlockSoil.patch b/nms-patches/BlockSoil.patch index 2de016b191..0bd1288cbf 100644 --- a/nms-patches/BlockSoil.patch +++ b/nms-patches/BlockSoil.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/BlockSoil.java 2015-01-31 10:14:10.936280376 +1100 -+++ src/main/java/net/minecraft/server/BlockSoil.java 2015-01-31 10:14:10.936280376 +1100 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockSoil.java 2015-02-26 22:40:22.263608143 +0000 ++++ src/main/java/net/minecraft/server/BlockSoil.java 2015-02-26 22:40:22.263608143 +0000 @@ -3,6 +3,11 @@ import java.util.Iterator; import java.util.Random; @@ -15,7 +15,7 @@ @@ -34,6 +39,12 @@ if (i > 0) { world.setTypeAndData(blockposition, iblockdata.set(BlockSoil.MOISTURE, Integer.valueOf(i - 1)), 2); - } else if (!this.d(world, blockposition)) { + } else if (!this.e(world, blockposition)) { + // CraftBukkit start + org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + if (CraftEventFactory.callBlockFadeEvent(block, Blocks.DIRT).isCancelled()) { @@ -31,7 +31,7 @@ public void a(World world, BlockPosition blockposition, Entity entity, float f) { + super.a(world, blockposition, entity, f); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage. if (entity instanceof EntityLiving) { - if (!world.isStatic && world.random.nextFloat() < f - 0.5F) { + if (!world.isClientSide && world.random.nextFloat() < f - 0.5F) { if (!(entity instanceof EntityHuman) && !world.getGameRules().getBoolean("mobGriefing")) { return; } diff --git a/nms-patches/BlockStationary.patch b/nms-patches/BlockStationary.patch index 02496cbe30..9d4c778465 100644 --- a/nms-patches/BlockStationary.patch +++ b/nms-patches/BlockStationary.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockStationary.java 2014-11-28 17:43:42.965707438 +0000 -+++ src/main/java/net/minecraft/server/BlockStationary.java 2014-11-28 17:38:19.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockStationary.java 2015-02-26 22:40:22.267608143 +0000 ++++ src/main/java/net/minecraft/server/BlockStationary.java 2015-02-26 22:40:22.267608143 +0000 @@ -2,6 +2,8 @@ import java.util.Random; @@ -12,7 +12,7 @@ @@ -41,6 +43,13 @@ if (block.material == Material.AIR) { - if (this.e(world, blockposition1)) { + if (this.f(world, blockposition1)) { + // CraftBukkit start - Prevent lava putting something on fire + if (world.getType(blockposition1) != Blocks.FIRE) { + if (CraftEventFactory.callBlockIgniteEvent(world, blockposition1.getX(), blockposition1.getY(), blockposition1.getZ(), blockposition.getX(), blockposition.getY(), blockposition.getZ()).isCancelled()) { diff --git a/nms-patches/BlockStem.patch b/nms-patches/BlockStem.patch index 5db91d7502..4f65887f51 100644 --- a/nms-patches/BlockStem.patch +++ b/nms-patches/BlockStem.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockStem.java 2014-11-28 17:43:42.969707438 +0000 -+++ src/main/java/net/minecraft/server/BlockStem.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockStem.java 2015-02-26 22:40:22.271608143 +0000 ++++ src/main/java/net/minecraft/server/BlockStem.java 2015-02-26 22:40:22.271608143 +0000 @@ -4,6 +4,8 @@ import java.util.Iterator; import java.util.Random; @@ -9,7 +9,7 @@ public class BlockStem extends BlockPlant implements IBlockFragilePlantElement { public static final BlockStateInteger AGE = BlockStateInteger.of("age", 0, 7); -@@ -50,7 +52,8 @@ +@@ -58,7 +60,8 @@ if (i < 7) { iblockdata = iblockdata.set(BlockStem.AGE, Integer.valueOf(i + 1)); @@ -17,9 +17,9 @@ + // world.setTypeAndData(blockposition, iblockdata, 2); // CraftBukkit + CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, toLegacyData(iblockdata)); // CraftBukkit } else { - Iterator iterator = EnumDirectionLimit.HORIZONTAL.iterator(); + Iterator iterator = EnumDirection.EnumDirectionLimit.HORIZONTAL.iterator(); -@@ -66,7 +69,8 @@ +@@ -74,7 +77,8 @@ Block block = world.getType(blockposition.down()).getBlock(); if (world.getType(blockposition).getBlock().material == Material.AIR && (block == Blocks.FARMLAND || block == Blocks.DIRT || block == Blocks.GRASS)) { @@ -29,7 +29,7 @@ } } } -@@ -77,7 +81,8 @@ +@@ -85,7 +89,8 @@ public void g(World world, BlockPosition blockposition, IBlockData iblockdata) { int i = ((Integer) iblockdata.get(BlockStem.AGE)).intValue() + MathHelper.nextInt(world.random, 2, 5); @@ -38,4 +38,4 @@ + CraftEventFactory.handleBlockGrowEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this, Math.min(7, i)); // CraftBukkit } - public void h() { + public void j() { diff --git a/nms-patches/BlockTallPlant.patch b/nms-patches/BlockTallPlant.patch deleted file mode 100644 index 96da54d95b..0000000000 --- a/nms-patches/BlockTallPlant.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockTallPlant.java 2015-02-07 10:08:04.520216186 +0000 -+++ src/main/java/net/minecraft/server/BlockTallPlant.java 2015-02-07 10:08:04.520216186 +0000 -@@ -55,16 +55,20 @@ - Object object1 = flag ? world.getType(blockposition2).getBlock() : this; - - if (object == this) { -- world.setTypeAndData(blockposition1, Blocks.AIR.getBlockData(), 3); -+ world.setTypeAndData(blockposition1, Blocks.AIR.getBlockData(), 2); // CraftBukkit - } - - if (object1 == this) { -- world.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 3); -+ world.setTypeAndData(blockposition2, Blocks.AIR.getBlockData(), 2); // CraftBukkit - if (!flag) { - this.b(world, blockposition2, iblockdata, 0); - } - } - -+ // CraftBukkit start - delay updates -+ world.update(blockposition1, this); -+ world.update(blockposition2, this); -+ // CraftBukkit end - } - } - diff --git a/nms-patches/BlockTrapdoor.patch b/nms-patches/BlockTrapdoor.patch index 4bd9f0fe5b..8f84b0218a 100644 --- a/nms-patches/BlockTrapdoor.patch +++ b/nms-patches/BlockTrapdoor.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockTrapdoor.java 2014-11-28 17:43:42.969707438 +0000 -+++ src/main/java/net/minecraft/server/BlockTrapdoor.java 2014-11-28 17:38:22.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockTrapdoor.java 2015-02-26 22:40:22.275608143 +0000 ++++ src/main/java/net/minecraft/server/BlockTrapdoor.java 2015-02-26 22:40:22.275608143 +0000 @@ -2,6 +2,8 @@ import com.google.common.base.Predicate; @@ -8,7 +8,7 @@ + public class BlockTrapdoor extends Block { - public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirectionLimit.HORIZONTAL); + public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirection.EnumDirectionLimit.HORIZONTAL); @@ -101,6 +103,19 @@ boolean flag = world.isBlockIndirectlyPowered(blockposition); diff --git a/nms-patches/BlockTripwire.patch b/nms-patches/BlockTripwire.patch index deb34e86e8..52819f122c 100644 --- a/nms-patches/BlockTripwire.patch +++ b/nms-patches/BlockTripwire.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockTripwire.java 2014-11-28 17:43:42.977707438 +0000 -+++ src/main/java/net/minecraft/server/BlockTripwire.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockTripwire.java 2015-02-26 22:40:22.279608143 +0000 ++++ src/main/java/net/minecraft/server/BlockTripwire.java 2015-02-26 22:40:22.283608143 +0000 @@ -4,6 +4,8 @@ import java.util.List; import java.util.Random; @@ -9,11 +9,10 @@ public class BlockTripwire extends Block { public static final BlockStateBoolean POWERED = BlockStateBoolean.of("powered"); -@@ -154,6 +156,40 @@ - } +@@ -155,6 +157,40 @@ } } -+ + + // CraftBukkit start - Call interact even when triggering connected tripwire + if (flag != flag1 && flag1 && (Boolean)iblockdata.get(ATTACHED)) { + org.bukkit.World bworld = world.getWorld(); @@ -47,6 +46,7 @@ + } + } + // CraftBukkit end - ++ if (flag1 != flag) { iblockdata = iblockdata.set(BlockTripwire.POWERED, Boolean.valueOf(flag1)); + world.setTypeAndData(blockposition, iblockdata, 3); diff --git a/nms-patches/BlockTripwireHook.patch b/nms-patches/BlockTripwireHook.patch index 1f6d5ba66e..8072ba347d 100644 --- a/nms-patches/BlockTripwireHook.patch +++ b/nms-patches/BlockTripwireHook.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockTripwireHook.java 2014-11-28 17:43:42.973707438 +0000 -+++ src/main/java/net/minecraft/server/BlockTripwireHook.java 2014-11-28 17:38:17.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockTripwireHook.java 2015-02-26 22:40:22.275608143 +0000 ++++ src/main/java/net/minecraft/server/BlockTripwireHook.java 2015-02-26 22:40:22.279608143 +0000 @@ -5,6 +5,8 @@ import java.util.Iterator; import java.util.Random; @@ -8,7 +8,7 @@ + public class BlockTripwireHook extends Block { - public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirectionLimit.HORIZONTAL); + public static final BlockStateDirection FACING = BlockStateDirection.of("facing", (Predicate) EnumDirection.EnumDirectionLimit.HORIZONTAL); @@ -141,6 +143,17 @@ this.a(world, blockposition1, flag5, flag6, flag2, flag3); } diff --git a/nms-patches/BlockVine.patch b/nms-patches/BlockVine.patch index 12c6a2083f..88ed44192d 100644 --- a/nms-patches/BlockVine.patch +++ b/nms-patches/BlockVine.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/BlockVine.java 2015-01-06 23:53:23.903653254 +0000 -+++ src/main/java/net/minecraft/server/BlockVine.java 2015-01-06 23:53:23.903653254 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/BlockVine.java 2015-02-26 22:40:22.283608143 +0000 ++++ src/main/java/net/minecraft/server/BlockVine.java 2015-02-26 22:40:22.287608143 +0000 @@ -3,6 +3,8 @@ import java.util.Iterator; import java.util.Random; @@ -9,7 +9,7 @@ public class BlockVine extends Block { public static final BlockStateBoolean UP = BlockStateBoolean.of("up"); -@@ -203,7 +205,13 @@ +@@ -199,7 +201,13 @@ } if (((Boolean) iblockdata1.get(BlockVine.NORTH)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.EAST)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.SOUTH)).booleanValue() || ((Boolean) iblockdata1.get(BlockVine.WEST)).booleanValue()) { @@ -24,7 +24,7 @@ } } -@@ -223,17 +231,29 @@ +@@ -219,17 +227,29 @@ BlockPosition blockposition2 = blockposition1.shift(enumdirection1); BlockPosition blockposition3 = blockposition1.shift(enumdirection2); @@ -59,7 +59,7 @@ } else if (block.material.k() && block.d()) { world.setTypeAndData(blockposition, iblockdata.set(a(enumdirection), Boolean.valueOf(true)), 2); } -@@ -260,7 +280,12 @@ +@@ -256,7 +276,12 @@ } if (((Boolean) iblockdata3.get(BlockVine.NORTH)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.EAST)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.SOUTH)).booleanValue() || ((Boolean) iblockdata3.get(BlockVine.WEST)).booleanValue()) { diff --git a/nms-patches/ChatBaseComponent.patch b/nms-patches/ChatBaseComponent.patch index f8b1572857..014be97d87 100644 --- a/nms-patches/ChatBaseComponent.patch +++ b/nms-patches/ChatBaseComponent.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ChatBaseComponent.java 2015-01-11 18:45:55.785438005 +0000 -+++ src/main/java/net/minecraft/server/ChatBaseComponent.java 2015-01-11 18:45:55.785438005 +0000 -@@ -91,7 +91,7 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/ChatBaseComponent.java 2015-02-26 22:40:22.295608143 +0000 ++++ src/main/java/net/minecraft/server/ChatBaseComponent.java 2015-02-26 22:40:22.299608143 +0000 +@@ -111,7 +111,7 @@ } public int hashCode() { diff --git a/nms-patches/ChatModifier.patch b/nms-patches/ChatModifier.patch index b28629d23c..c60d3e07ef 100644 --- a/nms-patches/ChatModifier.patch +++ b/nms-patches/ChatModifier.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ChatModifier.java 2014-12-27 19:28:58.855157429 +0000 -+++ src/main/java/net/minecraft/server/ChatModifier.java 2014-12-27 19:28:58.855157429 +0000 -@@ -160,16 +160,18 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/ChatModifier.java 2015-02-26 22:40:22.303608142 +0000 ++++ src/main/java/net/minecraft/server/ChatModifier.java 2015-02-26 22:40:22.307608142 +0000 +@@ -254,16 +254,18 @@ } public int hashCode() { @@ -28,3 +28,17 @@ return i; } +@@ -429,11 +431,11 @@ + } + } + +- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) { ++ public JsonElement serialize(ChatModifier object, Type type, JsonSerializationContext jsonserializationcontext) { // CraftBukkit - fix decompile error + return this.a((ChatModifier) object, type, jsonserializationcontext); + } + +- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { ++ public ChatModifier deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { // CraftBukkit - fix decompile error + return this.a(jsonelement, type, jsondeserializationcontext); + } + } diff --git a/nms-patches/Chunk.patch b/nms-patches/Chunk.patch index fcb476013d..720b615516 100644 --- a/nms-patches/Chunk.patch +++ b/nms-patches/Chunk.patch @@ -1,34 +1,36 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/Chunk.java 2014-12-21 17:32:05.580576417 +0000 -+++ src/main/java/net/minecraft/server/Chunk.java 2014-12-21 17:32:05.580576417 +0000 -@@ -1,6 +1,7 @@ - package net.minecraft.server; - - import com.google.common.base.Predicate; -+import com.google.common.collect.Lists; // CraftBukkit - import com.google.common.collect.Maps; - import com.google.common.collect.Queues; - import java.util.Arrays; -@@ -14,6 +15,8 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/Chunk.java 2015-02-26 22:40:22.311608142 +0000 ++++ src/main/java/net/minecraft/server/Chunk.java 2015-02-26 22:40:22.315608142 +0000 +@@ -14,6 +14,9 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; ++import com.google.common.collect.Lists; // CraftBukkit +import org.bukkit.Bukkit; // CraftBukkit + public class Chunk { private static final Logger c = LogManager.getLogger(); -@@ -23,7 +26,7 @@ +@@ -22,13 +25,13 @@ + private final int[] f; private final boolean[] g; private boolean h; - public final World world; +- private final World world; - private final int[] heightMap; -+ public final int[] heightMap; // CraftBukkit - make public ++ public final World world; // CraftBukkit - public ++ public final int[] heightMap; // CraftBukkit - public public final int locX; public final int locZ; private boolean k; +- private final Map tileEntities; +- private final EntitySlice[] entitySlices; ++ public final Map tileEntities; ++ public final EntitySlice[] entitySlices; // CraftBukkit - public + private boolean done; + private boolean lit; + private boolean p; @@ -40,6 +43,34 @@ private int v; - private ConcurrentLinkedQueue w; + private ConcurrentLinkedQueue w; + // CraftBukkit start - Neighbor loaded cache for chunk lighting and entity ticking + private int neighbors = 0x1 << 12; @@ -79,17 +81,17 @@ public Chunk(World world, ChunkSnapshot chunksnapshot, int i, int j) { this(world, i, j); short short0 = 256; -@@ -505,7 +545,8 @@ +@@ -529,7 +569,8 @@ } } -- if (!this.world.isStatic && block1 != block) { +- if (!this.world.isClientSide && block1 != block) { + // CraftBukkit - Don't place while processing the BlockPlaceEvent, unless it's a BlockContainer. Prevents blocks such as TNT from activating when cancelled. -+ if (!this.world.isStatic && block1 != block && (!this.world.captureBlockStates || block instanceof BlockContainer)) { ++ if (!this.world.isClientSide && block1 != block && (!this.world.captureBlockStates || block instanceof BlockContainer)) { block.onPlace(this.world, blockposition, iblockdata); } -@@ -586,7 +627,11 @@ +@@ -610,7 +651,11 @@ int j = MathHelper.floor(entity.locZ / 16.0D); if (i != this.locX || j != this.locZ) { @@ -102,7 +104,7 @@ entity.die(); } -@@ -673,6 +718,13 @@ +@@ -697,6 +742,13 @@ tileentity.D(); this.tileEntities.put(blockposition, tileentity); @@ -116,7 +118,7 @@ } } -@@ -716,7 +768,21 @@ +@@ -740,7 +792,21 @@ } for (int i = 0; i < this.entitySlices.length; ++i) { @@ -139,3 +141,14 @@ } } +@@ -798,8 +864,8 @@ + while (iterator.hasNext()) { + Entity entity = (Entity) iterator.next(); + +- if (entity.getBoundingBox().b(axisalignedbb) && (predicate == null || predicate.apply(entity))) { +- list.add(entity); ++ if (entity.getBoundingBox().b(axisalignedbb) && (predicate == null || predicate.apply((T) entity))) { // CraftBukkit - fix decompile error ++ list.add((T) entity); // Fix decompile error + } + } + } diff --git a/nms-patches/ChunkProviderServer.patch b/nms-patches/ChunkProviderServer.patch index 1d497319c7..23b20f815f 100644 --- a/nms-patches/ChunkProviderServer.patch +++ b/nms-patches/ChunkProviderServer.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ChunkProviderServer.java 2014-11-28 17:43:42.985707437 +0000 -+++ src/main/java/net/minecraft/server/ChunkProviderServer.java 2014-11-28 17:38:20.000000000 +0000 -@@ -10,17 +10,28 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/ChunkProviderServer.java 2015-02-26 22:40:22.319608142 +0000 ++++ src/main/java/net/minecraft/server/ChunkProviderServer.java 2015-02-26 22:40:22.323608142 +0000 +@@ -11,17 +11,28 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -19,22 +19,24 @@ public class ChunkProviderServer implements IChunkProvider { private static final Logger b = LogManager.getLogger(); -- public Set unloadQueue = Collections.newSetFromMap(new ConcurrentHashMap()); +- private Set unloadQueue = Collections.newSetFromMap(new ConcurrentHashMap()); +- private Chunk emptyChunk; +- private IChunkProvider chunkProvider; + public LongHashSet unloadQueue = new LongHashSet(); // CraftBukkit - LongHashSet - public Chunk emptyChunk; - public IChunkProvider chunkProvider; ++ public Chunk emptyChunk; // CraftBukkit - public ++ public IChunkProvider chunkProvider; // CraftBukkit - public private IChunkLoader chunkLoader; - public boolean forceChunkLoad = true; -- public LongHashMap chunks = new LongHashMap(); -- private List chunkList = Lists.newArrayList(); +- private LongHashMap chunks = new LongHashMap(); +- private List chunkList = Lists.newArrayList(); - private WorldServer world; + public boolean forceChunkLoad = false; // CraftBukkit - true -> false + public LongObjectHashMap chunks = new LongObjectHashMap(); -+ public WorldServer world; // CraftBukkit- public ++ public WorldServer world; // CraftBukkit - public public ChunkProviderServer(WorldServer worldserver, IChunkLoader ichunkloader, IChunkProvider ichunkprovider) { this.emptyChunk = new EmptyChunk(worldserver, 0, 0); -@@ -30,40 +41,93 @@ +@@ -31,26 +42,43 @@ } public boolean isChunkLoaded(int i, int j) { @@ -42,7 +44,7 @@ + return this.chunks.containsKey(LongHash.toLong(i, j)); // CraftBukkit } -- public List a() { +- public List a() { - return this.chunkList; + // CraftBukkit start - Change return type to Collection and return the values of our chunk map + public java.util.Collection a() { @@ -57,7 +59,7 @@ - this.unloadQueue.add(Long.valueOf(ChunkCoordIntPair.a(i, j))); + // CraftBukkit start + this.unloadQueue.add(i, j); -+ ++ + Chunk c = chunks.get(LongHash.toLong(i, j)); + if (c != null) { + c.mustSave = true; @@ -68,7 +70,7 @@ - this.unloadQueue.add(Long.valueOf(ChunkCoordIntPair.a(i, j))); + // CraftBukkit start + this.unloadQueue.add(i, j); -+ ++ + Chunk c = chunks.get(LongHash.toLong(i, j)); + if (c != null) { + c.mustSave = true; @@ -84,33 +86,30 @@ while (iterator.hasNext()) { Chunk chunk = (Chunk) iterator.next(); +@@ -60,11 +88,48 @@ + + } - this.queueUnload(chunk.locX, chunk.locZ); - } -- -+ } -+ + // CraftBukkit start - Add async variant, provide compatibility + public Chunk getChunkIfLoaded(int x, int z) { + return chunks.get(LongHash.toLong(x, z)); - } - ++ } ++ public Chunk getChunkAt(int i, int j) { - long k = ChunkCoordIntPair.a(i, j); -- -- this.unloadQueue.remove(Long.valueOf(k)); -- Chunk chunk = (Chunk) this.chunks.getEntry(k); + return getChunkAt(i, j, null); + } -+ ++ + public Chunk getChunkAt(int i, int j, Runnable runnable) { + unloadQueue.remove(i, j); + Chunk chunk = chunks.get(LongHash.toLong(i, j)); + ChunkRegionLoader loader = null; -+ ++ + if (this.chunkLoader instanceof ChunkRegionLoader) { + loader = (ChunkRegionLoader) this.chunkLoader; -+ + +- this.unloadQueue.remove(Long.valueOf(k)); +- Chunk chunk = (Chunk) this.chunks.getEntry(k); + } + // We can only use the queue for already generated chunks + if (chunk == null && loader != null && loader.chunkExists(world, i, j)) { @@ -123,12 +122,12 @@ + } else if (chunk == null) { + chunk = originalGetChunkAt(i, j); + } -+ ++ + // If we didn't load the chunk async and have a callback run it now + if (runnable != null) { + runnable.run(); + } -+ ++ + return chunk; + } + public Chunk originalGetChunkAt(int i, int j) { @@ -139,7 +138,7 @@ if (chunk == null) { chunk = this.loadChunk(i, j); -@@ -78,16 +142,44 @@ +@@ -79,16 +144,43 @@ CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Chunk to be generated"); crashreportsystemdetails.a("Location", (Object) String.format("%d,%d", new Object[] { Integer.valueOf(i), Integer.valueOf(j)})); @@ -167,7 +166,7 @@ + */ + server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, newChunk)); + } -+ ++ + // Update neighbor counts + for (int x = -2; x < 3; x++) { + for (int z = -2; z < 3; z++) { @@ -183,21 +182,19 @@ + } + } + // CraftBukkit end -+ chunk.loadNearby(this, this, i, j); } -@@ -95,9 +187,22 @@ +@@ -96,12 +188,25 @@ } public Chunk getOrCreateChunk(int i, int j) { - Chunk chunk = (Chunk) this.chunks.getEntry(ChunkCoordIntPair.a(i, j)); + // CraftBukkit start + Chunk chunk = (Chunk) this.chunks.get(LongHash.toLong(i, j)); - -- return chunk == null ? (!this.world.ad() && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk; ++ + chunk = chunk == null ? (!this.world.ad() && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk; -+ ++ + if (chunk == emptyChunk) return chunk; + if (i != chunk.locX || j != chunk.locZ) { + b.error("Chunk (" + chunk.locX + ", " + chunk.locZ + ") stored at (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'"); @@ -206,32 +203,40 @@ + ex.fillInStackTrace(); + ex.printStackTrace(); + } -+ + +- return chunk == null ? (!this.world.ad() && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk; + return chunk; + // CraftBukkit end } - public Chunk loadChunk(int i, int j) { -@@ -138,10 +243,13 @@ +- private Chunk loadChunk(int i, int j) { ++ public Chunk loadChunk(int i, int j) { // CraftBukkit - public + if (this.chunkLoader == null) { + return null; + } else { +@@ -123,7 +228,7 @@ + } + } + +- private void saveChunkNOP(Chunk chunk) { ++ public void saveChunkNOP(Chunk chunk) { // CraftBukkit - public + if (this.chunkLoader != null) { + try { + this.chunkLoader.b(this.world, chunk); +@@ -134,7 +239,7 @@ + } + } + +- private void saveChunk(Chunk chunk) { ++ public void saveChunk(Chunk chunk) { // CraftBukkit - public + if (this.chunkLoader != null) { try { chunk.setLastSaved(this.world.getTime()); - this.chunkLoader.a(this.world, chunk); -- } catch (IOException ioexception) { -+ // CraftBukkit start - IOException to Exception -+ } catch (Exception ioexception) { - ChunkProviderServer.b.error("Couldn\'t save chunk", ioexception); -+ /* Remove extra exception - } catch (ExceptionWorldConflict exceptionworldconflict) { - ChunkProviderServer.b.error("Couldn\'t save chunk; already in use by another instance of Minecraft?", exceptionworldconflict); -+ // CraftBukkit end */ - } - - } -@@ -154,6 +262,30 @@ +@@ -155,6 +260,30 @@ chunk.n(); if (this.chunkProvider != null) { this.chunkProvider.getChunkAt(ichunkprovider, i, j); -+ ++ + // CraftBukkit start + BlockSand.instaFall = true; + Random random = new Random(); @@ -258,14 +263,14 @@ chunk.e(); } } -@@ -173,9 +305,12 @@ +@@ -174,10 +303,12 @@ public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) { int i = 0; -- -- for (int j = 0; j < this.chunkList.size(); ++j) { -- Chunk chunk = (Chunk) this.chunkList.get(j); -+ +- ArrayList arraylist = Lists.newArrayList(this.chunkList); + +- for (int j = 0; j < arraylist.size(); ++j) { +- Chunk chunk = (Chunk) arraylist.get(j); + // CraftBukkit start + Iterator iterator = this.chunks.values().iterator(); + while (iterator.hasNext()) { @@ -274,7 +279,7 @@ if (flag) { this.saveChunkNOP(chunk); -@@ -203,22 +338,42 @@ +@@ -205,22 +336,43 @@ public boolean unloadChunks() { if (!this.world.savingDisabled) { @@ -282,7 +287,6 @@ - if (!this.unloadQueue.isEmpty()) { - Long olong = (Long) this.unloadQueue.iterator().next(); - Chunk chunk = (Chunk) this.chunks.getEntry(olong.longValue()); -- + // CraftBukkit start + Server server = this.world.getServer(); + for (int i = 0; i < 100 && !this.unloadQueue.isEmpty(); ++i) { @@ -293,6 +297,7 @@ + ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk); + server.getPluginManager().callEvent(event); + if (!event.isCancelled()) { + if (chunk != null) { chunk.removeEntities(); this.saveChunk(chunk); @@ -304,7 +309,7 @@ - this.unloadQueue.remove(olong); + // this.unloadQueue.remove(olong); -+ ++ + // Update neighbor counts + for (int x = -2; x < 3; x++) { + for (int z = -2; z < 3; z++) { @@ -320,13 +325,12 @@ + } + } } -- } -+ } + } + // CraftBukkit end if (this.chunkLoader != null) { this.chunkLoader.a(); -@@ -233,7 +388,8 @@ +@@ -235,7 +387,8 @@ } public String getName() { @@ -335,8 +339,8 @@ + return "ServerChunkCache: " + this.chunks.size() + " Drop: " + this.unloadQueue.size(); } - public List getMobsFor(EnumCreatureType enumcreaturetype, BlockPosition blockposition) { -@@ -245,7 +401,8 @@ + public List getMobsFor(EnumCreatureType enumcreaturetype, BlockPosition blockposition) { +@@ -247,7 +400,8 @@ } public int getLoadedChunks() { diff --git a/nms-patches/ChunkRegionLoader.patch b/nms-patches/ChunkRegionLoader.patch index 75aeb037fe..d97767539c 100644 --- a/nms-patches/ChunkRegionLoader.patch +++ b/nms-patches/ChunkRegionLoader.patch @@ -1,10 +1,9 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ChunkRegionLoader.java 2014-11-29 23:25:09.296846856 +0000 -+++ src/main/java/net/minecraft/server/ChunkRegionLoader.java 2014-11-29 23:24:59.400847076 +0000 -@@ -23,8 +23,40 @@ - public ChunkRegionLoader(File file) { +--- /home/matt/mc-dev-private//net/minecraft/server/ChunkRegionLoader.java 2015-02-26 22:40:22.327608142 +0000 ++++ src/main/java/net/minecraft/server/ChunkRegionLoader.java 2015-02-26 22:40:22.331608142 +0000 +@@ -25,7 +25,39 @@ this.e = file; } -+ + + // CraftBukkit start + public boolean chunkExists(World world, int i, int j) { + ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); @@ -18,13 +17,13 @@ + } + } + } - ++ + return RegionFileCache.a(this.e, i, j).chunkExists(i & 31, j & 31); + } + // CraftBukkit end + + // CraftBukkit start - Add async variant, provide compatibility - public Chunk a(World world, int i, int j) { + public Chunk a(World world, int i, int j) throws IOException { + Object[] data = loadChunk(world, i, j); + if (data != null) { + Chunk chunk = (Chunk) data[0]; @@ -32,16 +31,16 @@ + loadEntities(chunk, nbttagcompound.getCompound("Level"), world); + return chunk; + } -+ ++ + return null; + } -+ -+ public Object[] loadChunk(World world, int i, int j) { ++ ++ public Object[] loadChunk(World world, int i, int j) throws IOException { + // CraftBukkit end NBTTagCompound nbttagcompound = null; ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); Object object = this.d; -@@ -53,7 +85,7 @@ +@@ -54,7 +86,7 @@ return this.a(world, i, j, nbttagcompound); } @@ -50,73 +49,44 @@ if (!nbttagcompound.hasKeyOfType("Level", 10)) { ChunkRegionLoader.a.error("Chunk file at " + i + "," + j + " is missing level data, skipping"); return null; -@@ -64,18 +96,42 @@ - Chunk chunk = this.a(world, nbttagcompound.getCompound("Level")); - - if (!chunk.a(i, j)) { -- ChunkRegionLoader.a.error("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.locX + ", " + chunk.locZ + ")"); -- nbttagcompound.setInt("xPos", i); -- nbttagcompound.setInt("zPos", j); -+ a.error("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.locX + ", " + chunk.locZ + ")"); -+ nbttagcompound.getCompound("Level").setInt("xPos", i); -+ nbttagcompound.getCompound("Level").setInt("zPos", j); -+ -+ // CraftBukkit start - Have to move tile entities since we don't load them at this stage -+ NBTTagList tileEntities = nbttagcompound.getCompound("Level").getList("TileEntities", 10); -+ if (tileEntities != null) { -+ for (int te = 0; te < tileEntities.size(); te++) { -+ NBTTagCompound tileEntity = (NBTTagCompound) tileEntities.get(te); -+ int x = tileEntity.getInt("x") - chunk.locX * 16; -+ int z = tileEntity.getInt("z") - chunk.locZ * 16; -+ tileEntity.setInt("x", i * 16 + x); -+ tileEntity.setInt("z", j * 16 + z); +@@ -71,10 +103,28 @@ + ChunkRegionLoader.a.error("Chunk file at " + i + "," + j + " is in the wrong location; relocating. (Expected " + i + ", " + j + ", got " + chunk.locX + ", " + chunk.locZ + ")"); + nbttagcompound1.setInt("xPos", i); + nbttagcompound1.setInt("zPos", j); ++ ++ // CraftBukkit start - Have to move tile entities since we don't load them at this stage ++ NBTTagList tileEntities = nbttagcompound.getCompound("Level").getList("TileEntities", 10); ++ if (tileEntities != null) { ++ for (int te = 0; te < tileEntities.size(); te++) { ++ NBTTagCompound tileEntity = (NBTTagCompound) tileEntities.get(te); ++ int x = tileEntity.getInt("x") - chunk.locX * 16; ++ int z = tileEntity.getInt("z") - chunk.locZ * 16; ++ tileEntity.setInt("x", i * 16 + x); ++ tileEntity.setInt("z", j * 16 + z); ++ } + } -+ } -+ // CraftBukkit end - chunk = this.a(world, nbttagcompound.getCompound("Level")); - } ++ // CraftBukkit end + chunk = this.a(world, nbttagcompound1); + } -- return chunk; -+ // CraftBukkit start -+ Object[] data = new Object[2]; -+ data[0] = chunk; -+ data[1] = nbttagcompound; -+ return data; -+ // CraftBukkit end +- return chunk; ++ // CraftBukkit start ++ Object[] data = new Object[2]; ++ data[0] = chunk; ++ data[1] = nbttagcompound; ++ return data; ++ // CraftBukkit end + } } } - - public void a(World world, Chunk chunk) { -- world.checkSession(); -+ // CraftBukkit start - "handle" exception -+ try { -+ world.checkSession(); -+ } catch (ExceptionWorldConflict ex) { -+ ex.printStackTrace(); -+ } -+ // CraftBukkit end - - try { - NBTTagCompound nbttagcompound = new NBTTagCompound(); -@@ -133,7 +189,7 @@ - return true; - } - -- public void a(PendingChunkToSave pendingchunktosave) { -+ public void a(PendingChunkToSave pendingchunktosave) throws java.io.IOException { // CraftBukkit - added throws - DataOutputStream dataoutputstream = RegionFileCache.d(this.e, pendingchunktosave.a.x, pendingchunktosave.a.z); - - NBTCompressedStreamTools.a(pendingchunktosave.b, (DataOutput) dataoutputstream); -@@ -302,8 +358,27 @@ - int j1 = l >> 8 & 15; +@@ -308,7 +358,26 @@ int k1 = l >> 4 & 15; int l1 = nibblearray1 != null ? nibblearray1.a(i1, j1, k1) : 0; -- + - achar[l] = (char) (l1 << 12 | (abyte[l] & 255) << 4 | nibblearray.a(i1, j1, k1)); -+ + // CraftBukkit start - fix broken blocks + // achar[l] = (char) (l1 << 12 | (abyte[l] & 255) << 4 | nibblearray.a(i1, j1, k1)); -+ ++ + int ex = l1; + int id = (abyte[l] & 255); + int data = nibblearray.a(i1, j1, k1); @@ -137,25 +107,26 @@ } chunksection.a(achar); -@@ -320,7 +395,13 @@ - if (nbttagcompound.hasKeyOfType("Biomes", 7)) { +@@ -326,6 +395,13 @@ chunk.a(nbttagcompound.getByteArray("Biomes")); } -+ + + // CraftBukkit start - End this method here and split off entity loading to another method + return chunk; + } - ++ + public void loadEntities(Chunk chunk, NBTTagCompound nbttagcompound, World world) { + // CraftBukkit end ++ NBTTagList nbttaglist1 = nbttagcompound.getList("Entities", 10); if (nbttaglist1 != null) { -@@ -379,6 +460,6 @@ +@@ -384,7 +460,7 @@ } } - return chunk; -+ // return chunk; // CraftBukkit ++ // return chunk; // CraftBukkit } - } + + static class PendingChunkToSave { diff --git a/nms-patches/ChunkSection.patch b/nms-patches/ChunkSection.patch index 4817eb7f69..7544ca95e3 100644 --- a/nms-patches/ChunkSection.patch +++ b/nms-patches/ChunkSection.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ChunkSection.java 2014-11-28 17:43:42.989707437 +0000 -+++ src/main/java/net/minecraft/server/ChunkSection.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ChunkSection.java 2015-02-26 22:40:22.335608142 +0000 ++++ src/main/java/net/minecraft/server/ChunkSection.java 2015-02-26 22:40:22.335608142 +0000 @@ -19,6 +19,18 @@ } diff --git a/nms-patches/CommandBlockListenerAbstract.patch b/nms-patches/CommandBlockListenerAbstract.patch index 996b3f7100..8c1005d224 100644 --- a/nms-patches/CommandBlockListenerAbstract.patch +++ b/nms-patches/CommandBlockListenerAbstract.patch @@ -1,21 +1,21 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/CommandBlockListenerAbstract.java 2015-01-25 15:16:21.156837700 +0000 -+++ src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java 2015-01-25 15:16:21.156837700 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/CommandBlockListenerAbstract.java 2015-02-27 10:25:29.434446612 +0000 ++++ src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java 2015-02-27 10:25:29.434446612 +0000 @@ -4,6 +4,13 @@ import java.util.Date; import java.util.concurrent.Callable; +// CraftBukkit start +import java.util.ArrayList; -+import org.apache.logging.log4j.Level; +import org.bukkit.craftbukkit.command.VanillaCommandWrapper; +import com.google.common.base.Joiner; ++import java.util.logging.Level; +// CraftBukkit end + public abstract class CommandBlockListenerAbstract implements ICommandListener { private static final SimpleDateFormat a = new SimpleDateFormat("HH:mm:ss"); @@ -13,6 +20,7 @@ - public String e = ""; + private String e = ""; private String f = "@"; private final CommandObjectiveExecutor g = new CommandObjectiveExecutor(); + protected org.bukkit.command.CommandSender sender; // CraftBukkit - add sender @@ -29,19 +29,16 @@ - this.b = icommandhandler.a(this, this.e); + // this.b = icommandhandler.a(this, this.e); + // CraftBukkit start - Handle command block commands using Bukkit dispatcher -+ this.b= executeCommand(this, sender, this.e); ++ this.b = executeCommand(this, sender, this.e); + // CraftBukkit end } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Executing command block"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Command to be executed"); -@@ -91,8 +102,136 @@ - } else { - this.b = 0; - } -+ } -+ +@@ -110,6 +121,130 @@ + + } + + // CraftBukkit start -+ + public static int executeCommand(ICommandListener sender, org.bukkit.command.CommandSender bSender, String command) { + org.bukkit.command.SimpleCommandMap commandMap = sender.getWorld().getServer().getCommandMap(); + Joiner joiner = Joiner.on(" "); @@ -90,40 +87,37 @@ + return 0; + } + -+ // testfor command requires special handling -+ if (args[0].equalsIgnoreCase("testfor")) { -+ if (args.length < 2) { -+ return 0; -+ } -+ -+ EntityPlayer[] players = ((java.util.List) PlayerSelector.getPlayers(sender, args[1], EntityPlayer.class)).toArray(new EntityPlayer[0]); -+ -+ if (players != null && players.length > 0) { -+ return players.length; -+ } else { -+ EntityPlayer player = MinecraftServer.getServer().getPlayerList().getPlayer(args[1]); -+ if (player == null) { -+ return 0; -+ } else { -+ return 1; -+ } -+ } -+ } -+ + commands.add(args); + -+ // Find positions of command block syntax, if any -+ ArrayList newCommands = new ArrayList(); -+ for (int i = 0; i < args.length; i++) { -+ if (PlayerSelector.isPattern(args[i])) { -+ for (int j = 0; j < commands.size(); j++) { -+ newCommands.addAll(buildCommands(sender, commands.get(j), i)); -+ } -+ ArrayList temp = commands; -+ commands = newCommands; -+ newCommands = temp; -+ newCommands.clear(); ++ // Find positions of command block syntax, if any ++ WorldServer[] prev = MinecraftServer.getServer().worldServer; ++ MinecraftServer server = MinecraftServer.getServer(); ++ server.worldServer = new WorldServer[server.worlds.size()]; ++ server.worldServer[0] = (WorldServer) sender.getWorld(); ++ int bpos = 0; ++ for (int pos = 1; pos < server.worldServer.length; pos++) { ++ WorldServer world = server.worlds.get(bpos++); ++ if (server.worldServer[0] == world) { ++ pos--; ++ continue; + } ++ server.worldServer[pos] = world; ++ } ++ try { ++ ArrayList newCommands = new ArrayList(); ++ for (int i = 0; i < args.length; i++) { ++ if (PlayerSelector.isPattern(args[i])) { ++ for (int j = 0; j < commands.size(); j++) { ++ newCommands.addAll(buildCommands(sender, commands.get(j), i)); ++ } ++ ArrayList temp = commands; ++ commands = newCommands; ++ newCommands = temp; ++ newCommands.clear(); ++ } ++ } ++ } finally { ++ MinecraftServer.getServer().worldServer = prev; + } + + int completed = 0; @@ -135,25 +129,24 @@ + completed++; + } + } catch (Throwable exception) { -+ if (sender instanceof TileEntityCommandListener) { -+ TileEntityCommandListener listener = (TileEntityCommandListener) sender; -+ MinecraftServer.getLogger().log(Level.WARN, String.format("CommandBlock at (%d,%d,%d) failed to handle command", listener.getChunkCoordinates().getX(), listener.getChunkCoordinates().getY(), listener.getChunkCoordinates().getZ()), exception); -+ } else if (sender instanceof EntityMinecartCommandBlockListener) { -+ EntityMinecartCommandBlockListener listener = (EntityMinecartCommandBlockListener) sender; -+ MinecraftServer.getLogger().log(Level.WARN, String.format("MinecartCommandBlock at (%d,%d,%d) failed to handle command", listener.getChunkCoordinates().getX(), listener.getChunkCoordinates().getY(), listener.getChunkCoordinates().getZ()), exception); ++ if (sender.f() instanceof EntityMinecartCommandBlock) { ++ MinecraftServer.getServer().server.getLogger().log(Level.WARNING, String.format("MinecartCommandBlock at (%d,%d,%d) failed to handle command", sender.getChunkCoordinates().getX(), sender.getChunkCoordinates().getY(), sender.getChunkCoordinates().getZ()), exception); ++ } else if (sender instanceof CommandBlockListenerAbstract) { ++ CommandBlockListenerAbstract listener = (CommandBlockListenerAbstract) sender; ++ MinecraftServer.getServer().server.getLogger().log(Level.WARNING, String.format("CommandBlock at (%d,%d,%d) failed to handle command", listener.getChunkCoordinates().getX(), listener.getChunkCoordinates().getY(), listener.getChunkCoordinates().getZ()), exception); + } else { -+ MinecraftServer.getLogger().log(Level.WARN, String.format("Unknown CommandBlock failed to handle command"), exception); ++ MinecraftServer.getServer().server.getLogger().log(Level.WARNING, String.format("Unknown CommandBlock failed to handle command"), exception); + } + } + } + + return completed; + } -+ ++ + private static ArrayList buildCommands(ICommandListener sender, String[] args, int pos) { + ArrayList commands = new ArrayList(); + java.util.List players = (java.util.List)PlayerSelector.getPlayers(sender, args[pos], EntityPlayer.class); -+ ++ + if (players != null) { + for (EntityPlayer player : players) { + if (player.world != sender.getWorld()) { @@ -164,10 +157,11 @@ + commands.add(command); + } + } - ++ + return commands; - } ++ } + // CraftBukkit end - ++ public String getName() { return this.f; + } diff --git a/nms-patches/CommandExecute.patch b/nms-patches/CommandExecute.patch index a0373aa54d..0a7a00326b 100644 --- a/nms-patches/CommandExecute.patch +++ b/nms-patches/CommandExecute.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/CommandExecute.java 2015-01-25 15:16:56.720837314 +0000 -+++ src/main/java/net/minecraft/server/CommandExecute.java 2015-01-25 15:16:56.720837314 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/CommandExecute.java 2015-02-26 22:40:22.343608142 +0000 ++++ src/main/java/net/minecraft/server/CommandExecute.java 2015-02-26 22:40:22.343608142 +0000 @@ -2,6 +2,10 @@ import java.util.Collection; @@ -11,27 +11,17 @@ public class CommandExecute extends CommandAbstract { -@@ -19,7 +23,7 @@ - return "commands.execute.usage"; - } - -- public void execute(ICommandListener icommandlistener, String[] astring) { -+ public void execute(ICommandListener icommandlistener, String[] astring) throws ExceptionUsage, CommandException { // CraftBukkit - added throws - if (astring.length < 5) { - throw new ExceptionUsage("commands.execute.usage", new Object[0]); - } else { -@@ -52,12 +56,30 @@ +@@ -94,12 +98,31 @@ ICommandHandler icommandhandler = MinecraftServer.getServer().getCommandHandler(); try { -- int j = icommandhandler.a(commandlistenerentity, s); -- +- int j = icommandhandler.a(icommandlistener1, s); + // CraftBukkit start + org.bukkit.command.CommandSender sender = null; + if (icommandlistener instanceof DedicatedServer) { + sender = MinecraftServer.getServer().server.getConsoleSender(); -+ } else if (icommandlistener instanceof TileEntityCommandListener) { -+ sender = ((TileEntityCommandListener) icommandlistener).sender; ++ } else if (icommandlistener instanceof CommandBlockListenerAbstract) { ++ sender = ((CommandBlockListenerAbstract) icommandlistener).sender; + } else if (VanillaCommandWrapper.lastSender != null) { + sender = VanillaCommandWrapper.lastSender; + }else if (icommandlistener.f() != null) { @@ -39,8 +29,9 @@ + } else { + throw new CommandException("Unhandled executor " + icommandlistener.getClass().getSimpleName(), new Object[0]); + } -+ int j = CommandBlockListenerAbstract.executeCommand(commandlistenerentity, new ProxiedNativeCommandSender(commandlistenerentity, sender, entity.getBukkitEntity()), s); // icommandhandler.a(commandlistenerentity, s); ++ int j = CommandBlockListenerAbstract.executeCommand(icommandlistener1, new ProxiedNativeCommandSender(icommandlistener1, sender, entity.getBukkitEntity()), s); + // CraftBukkit end + if (j < 1) { throw new CommandException("commands.execute.allInvocationsFailed", new Object[] { s}); } @@ -53,14 +44,14 @@ throw new CommandException("commands.execute.failed", new Object[] { s, entity.getName()}); } } -@@ -70,4 +92,11 @@ +@@ -112,4 +135,11 @@ public boolean isListStart(String[] astring, int i) { return i == 0; } + + // CraftBukkit start - fix decompiler error + @Override -+ public int compareTo(Object o) { ++ public int compareTo(ICommand o) { + return a((ICommand) o); + } + // CraftBukkit end diff --git a/nms-patches/CommandGamemode.patch b/nms-patches/CommandGamemode.patch index 3f4dd212df..ac389787ab 100644 --- a/nms-patches/CommandGamemode.patch +++ b/nms-patches/CommandGamemode.patch @@ -1,21 +1,11 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/CommandGamemode.java 2014-12-15 14:13:23.910966159 +0000 -+++ src/main/java/net/minecraft/server/CommandGamemode.java 2014-12-15 14:13:23.910966159 +0000 -@@ -18,7 +18,7 @@ - return "commands.gamemode.usage"; - } - -- public void execute(ICommandListener icommandlistener, String[] astring) { -+ public void execute(ICommandListener icommandlistener, String[] astring) throws ExceptionUsage { // CraftBukkit - added throws - if (astring.length <= 0) { - throw new ExceptionUsage("commands.gamemode.usage", new Object[0]); - } else { -@@ -26,6 +26,14 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/CommandGamemode.java 2015-02-26 22:40:22.343608142 +0000 ++++ src/main/java/net/minecraft/server/CommandGamemode.java 2015-02-26 22:40:22.351608142 +0000 +@@ -26,6 +26,13 @@ EntityPlayer entityplayer = astring.length >= 2 ? a(icommandlistener, astring[1]) : b(icommandlistener); - entityplayer.a(enumgamemode); -+ + entityplayer.a(worldsettings_enumgamemode); + // CraftBukkit start - handle event cancelling the change -+ if (entityplayer.playerInteractManager.getGameMode() != enumgamemode) { ++ if (entityplayer.playerInteractManager.getGameMode() != worldsettings_enumgamemode) { + icommandlistener.sendMessage(new ChatComponentText("Failed to set the gamemode of '" + entityplayer.getName() + "'")); + return; + } @@ -24,14 +14,14 @@ entityplayer.fallDistance = 0.0F; if (icommandlistener.getWorld().getGameRules().getBoolean("sendCommandFeedback")) { entityplayer.sendMessage(new ChatMessage("gameMode.changed", new Object[0])); -@@ -57,4 +65,11 @@ +@@ -57,4 +64,11 @@ public boolean isListStart(String[] astring, int i) { return i == 1; } + + // CraftBukkit start - fix decompiler error + @Override -+ public int compareTo(Object o) { ++ public int compareTo(ICommand o) { + return a((ICommand) o); + } + // CraftBukkit end diff --git a/nms-patches/CommandGamerule.patch b/nms-patches/CommandGamerule.patch index 30d67f7f89..d8e4644139 100644 --- a/nms-patches/CommandGamerule.patch +++ b/nms-patches/CommandGamerule.patch @@ -1,13 +1,11 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/CommandGamerule.java 2014-12-10 16:21:38.404579167 +0000 -+++ src/main/java/net/minecraft/server/CommandGamerule.java 2014-12-10 16:18:45.268581046 +0000 -@@ -19,8 +19,8 @@ - return "commands.gamerule.usage"; +--- /home/matt/mc-dev-private//net/minecraft/server/CommandGamerule.java 2015-02-26 22:40:22.363608142 +0000 ++++ src/main/java/net/minecraft/server/CommandGamerule.java 2015-02-26 22:40:22.363608142 +0000 +@@ -20,7 +20,7 @@ } -- public void execute(ICommandListener icommandlistener, String[] astring) { + public void execute(ICommandListener icommandlistener, String[] astring) throws CommandException { - GameRules gamerules = this.d(); -+ public void execute(ICommandListener icommandlistener, String[] astring) throws CommandException { // CraftBukkit - added throws -+ GameRules gamerules = icommandlistener.getWorld().getGameRules(); // Use current world ++ GameRules gamerules = icommandlistener.getWorld().getGameRules(); // CraftBukkit - Use current world String s = astring.length > 0 ? astring[0] : ""; String s1 = astring.length > 1 ? a(astring, 1) : ""; @@ -18,7 +16,7 @@ + + // CraftBukkit start - fix decompile error + @Override -+ public int compareTo(Object o) { ++ public int compareTo(ICommand o) { + return a((ICommand) o); + } + // CraftBukkit end diff --git a/nms-patches/CommandSpreadPlayers.patch b/nms-patches/CommandSpreadPlayers.patch new file mode 100644 index 0000000000..6901bb365b --- /dev/null +++ b/nms-patches/CommandSpreadPlayers.patch @@ -0,0 +1,47 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/CommandSpreadPlayers.java 2015-02-26 22:40:22.367608142 +0000 ++++ src/main/java/net/minecraft/server/CommandSpreadPlayers.java 2015-02-26 22:40:22.367608142 +0000 +@@ -237,6 +237,13 @@ + return astring.length >= 1 && astring.length <= 2 ? b(astring, 0, blockposition) : null; + } + ++ // CraftBukkit start - fix decompile error ++ @Override ++ public int compareTo(ICommand o) { ++ return a(o); ++ } ++ // CraftBukkit end ++ + static class Location2D { + + double a; +@@ -303,7 +310,7 @@ + } + + blockposition = blockposition.down(); +- } while (world.getType(blockposition).getBlock().getMaterial() == Material.AIR); ++ } while (getType(world, blockposition).getBlock().getMaterial() == Material.AIR); // CraftBukkit + + return blockposition.getY() + 1; + } +@@ -319,7 +326,7 @@ + } + + blockposition = blockposition.down(); +- material = world.getType(blockposition).getBlock().getMaterial(); ++ material = getType(world, blockposition).getBlock().getMaterial(); // CraftBukkit + } while (material == Material.AIR); + + return !material.isLiquid() && material != Material.FIRE; +@@ -329,5 +336,12 @@ + this.a = MathHelper.a(random, d0, d2); + this.b = MathHelper.a(random, d1, d3); + } ++ ++ // CraftBukkit start - add a version of getType which force loads chunks ++ private static IBlockData getType(World world, BlockPosition position) { ++ ((ChunkProviderServer) world.chunkProvider).getChunkAt(position.getX() >> 4, position.getZ() >> 4); ++ return world.getType(position); ++ } ++ // CraftBukkit end + } + } diff --git a/nms-patches/CommandTp.patch b/nms-patches/CommandTp.patch index a84cc67f8f..5a793ee023 100644 --- a/nms-patches/CommandTp.patch +++ b/nms-patches/CommandTp.patch @@ -1,14 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/CommandTp.java 2014-12-13 09:54:39.438309447 +1100 -+++ src/main/java/net/minecraft/server/CommandTp.java 2014-12-13 09:54:37.990309246 +1100 -@@ -19,7 +19,7 @@ - return "commands.tp.usage"; - } - -- public void execute(ICommandListener icommandlistener, String[] astring) { -+ public void execute(ICommandListener icommandlistener, String[] astring) throws CommandException { // CraftBukkit - add throws - if (astring.length < 1) { - throw new ExceptionUsage("commands.tp.usage", new Object[0]); - } else { +--- /home/matt/mc-dev-private//net/minecraft/server/CommandTp.java 2015-02-26 22:40:22.371608142 +0000 ++++ src/main/java/net/minecraft/server/CommandTp.java 2015-02-26 22:40:22.371608142 +0000 @@ -105,17 +105,11 @@ } else { Entity entity = b(icommandlistener, astring[astring.length - 1]); @@ -39,7 +30,7 @@ + + // CraftBukkit start - fix decompile error + @Override -+ public int compareTo(Object o) { ++ public int compareTo(ICommand o) { + return a((ICommand) o); + } + // CraftBukkit end diff --git a/nms-patches/Container.patch b/nms-patches/Container.patch index ec66930bc0..6ca19fac78 100644 --- a/nms-patches/Container.patch +++ b/nms-patches/Container.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/Container.java 2014-11-28 17:43:43.013707437 +0000 -+++ src/main/java/net/minecraft/server/Container.java 2014-11-28 17:38:22.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/Container.java 2015-02-26 22:40:22.415608141 +0000 ++++ src/main/java/net/minecraft/server/Container.java 2015-02-26 22:40:22.419608141 +0000 @@ -7,6 +7,17 @@ import java.util.List; import java.util.Set; @@ -17,12 +17,11 @@ + public abstract class Container { - public List b = Lists.newArrayList(); -@@ -17,6 +28,18 @@ - private final Set h = Sets.newHashSet(); - protected List listeners = Lists.newArrayList(); - private Set i = Sets.newHashSet(); -+ + public List b = Lists.newArrayList(); +@@ -18,12 +29,24 @@ + protected List listeners = Lists.newArrayList(); + private Set i = Sets.newHashSet(); + + // CraftBukkit start + public boolean checkReachable = true; + public abstract InventoryView getBukkitView(); @@ -33,10 +32,18 @@ + ((CraftInventory) destination.getTopInventory()).getInventory().onOpen(player); + ((CraftInventory) destination.getBottomInventory()).getInventory().onOpen(player); + } -+ // CraftBukkit end - ++ // CraftBukkit end ++ public Container() {} + protected Slot a(Slot slot) { + slot.rawSlotIndex = this.c.size(); + this.c.add(slot); +- this.b.add((Object) null); ++ this.b.add(null); // CraftBukkit - fix decompile error + return slot; + } + @@ -124,6 +147,7 @@ l = playerinventory.getCarried().count; Iterator iterator = this.h.iterator(); @@ -45,7 +52,7 @@ while (iterator.hasNext()) { Slot slot1 = (Slot) iterator.next(); -@@ -141,16 +165,49 @@ +@@ -141,16 +165,48 @@ } l -= itemstack2.count - j1; @@ -54,7 +61,10 @@ + draggedSlots.put(slot1.rawSlotIndex, itemstack2); // CraftBukkit - Put in map instead of setting } } -+ + +- itemstack1.count = l; +- if (itemstack1.count <= 0) { +- itemstack1 = null; + // CraftBukkit start - InventoryDragEvent + InventoryView view = getBukkitView(); + org.bukkit.inventory.ItemStack newcursor = CraftItemStack.asCraftMirror(itemstack1); @@ -63,7 +73,7 @@ + for (Map.Entry ditem : draggedSlots.entrySet()) { + eventmap.put(ditem.getKey(), CraftItemStack.asBukkitCopy(ditem.getValue())); + } -+ ++ + // It's essential that we set the cursor to the new value here to prevent item duplication if a plugin closes the inventory. + ItemStack oldCursor = playerinventory.getCarried(); + playerinventory.setCarried(CraftItemStack.asNMSCopy(newcursor)); @@ -83,10 +93,6 @@ + if (playerinventory.getCarried() != null) { + playerinventory.setCarried(CraftItemStack.asNMSCopy(event.getCursor())); + needsUpdate = true; - -- itemstack1.count = l; -- if (itemstack1.count <= 0) { -- itemstack1 = null; + } + } else { + playerinventory.setCarried(oldCursor); @@ -100,7 +106,7 @@ } this.d(); -@@ -173,8 +230,14 @@ +@@ -173,8 +229,14 @@ } if (j == 1) { @@ -117,7 +123,7 @@ playerinventory.setCarried((ItemStack) null); } } -@@ -223,7 +286,11 @@ +@@ -223,7 +285,11 @@ if (itemstack4.count == 0) { playerinventory.setCarried((ItemStack) null); @@ -129,7 +135,7 @@ } } else if (slot2.isAllowed(entityhuman)) { if (itemstack4 == null) { -@@ -249,7 +316,11 @@ +@@ -249,7 +315,11 @@ itemstack4.a(k1); if (itemstack4.count == 0) { playerinventory.setCarried((ItemStack) null); @@ -141,7 +147,7 @@ itemstack1.count += k1; } else if (itemstack4.count <= slot2.getMaxStackSize(itemstack4)) { -@@ -258,7 +329,9 @@ +@@ -258,7 +328,9 @@ } } else if (itemstack1.getItem() == itemstack4.getItem() && itemstack4.getMaxStackSize() > 1 && (!itemstack1.usesData() || itemstack1.getData() == itemstack4.getData()) && ItemStack.equals(itemstack1, itemstack4)) { k1 = itemstack1.count; @@ -152,7 +158,7 @@ itemstack4.count += k1; itemstack1 = slot2.a(k1); if (itemstack1.count == 0) { -@@ -266,11 +339,24 @@ +@@ -266,11 +338,24 @@ } slot2.a(entityhuman, playerinventory.getCarried()); @@ -173,11 +179,11 @@ + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutSetSlot(this.windowId, 0, this.getSlot(0).getItem())); + } + } -+ // CraftBukkit end ++ // CraftBukkit end } } } else if (k == 2 && j >= 0 && j < 9) { -@@ -411,17 +497,20 @@ +@@ -411,17 +496,20 @@ if (itemstack1 != null && itemstack1.getItem() == itemstack.getItem() && (!itemstack.usesData() || itemstack.getData() == itemstack1.getData()) && ItemStack.equals(itemstack, itemstack1)) { int l = itemstack1.count + itemstack.count; diff --git a/nms-patches/ContainerAnvil.patch b/nms-patches/ContainerAnvil.patch index 47af5d2b09..2c8d693f44 100644 --- a/nms-patches/ContainerAnvil.patch +++ b/nms-patches/ContainerAnvil.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ContainerAnvil.java 2014-11-28 17:43:42.993707437 +0000 -+++ src/main/java/net/minecraft/server/ContainerAnvil.java 2014-11-28 17:38:20.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ContainerAnvil.java 2015-02-26 22:40:22.375608142 +0000 ++++ src/main/java/net/minecraft/server/ContainerAnvil.java 2015-02-26 22:40:22.375608142 +0000 @@ -6,6 +6,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,21 +9,21 @@ public class ContainerAnvil extends Container { private static final Logger f = LogManager.getLogger(); -@@ -17,8 +19,13 @@ +@@ -22,8 +24,13 @@ private int k; private String l; private final EntityHuman m; + // CraftBukkit start + private CraftInventoryView bukkitEntity = null; + private PlayerInventory player; -+ // CraftBukkit end ++ // CraftBukkit end - public ContainerAnvil(PlayerInventory playerinventory, World world, BlockPosition blockposition, EntityHuman entityhuman) { + public ContainerAnvil(PlayerInventory playerinventory, final World world, final BlockPosition blockposition, EntityHuman entityhuman) { + this.player = playerinventory; // CraftBukkit this.j = blockposition; this.i = world; this.m = entityhuman; -@@ -265,6 +272,7 @@ +@@ -317,6 +324,7 @@ } public boolean a(EntityHuman entityhuman) { @@ -31,11 +31,11 @@ return this.i.getType(this.j).getBlock() != Blocks.ANVIL ? false : entityhuman.e((double) this.j.getX() + 0.5D, (double) this.j.getY() + 0.5D, (double) this.j.getZ() + 0.5D) <= 64.0D; } -@@ -328,4 +336,17 @@ - static int b(ContainerAnvil containeranvil) { - return containeranvil.k; +@@ -372,4 +380,17 @@ + + this.e(); } -+ ++ + // CraftBukkit start + @Override + public CraftInventoryView getBukkitView() { diff --git a/nms-patches/ContainerAnvilInventory.patch b/nms-patches/ContainerAnvilInventory.patch deleted file mode 100644 index 9861626f50..0000000000 --- a/nms-patches/ContainerAnvilInventory.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ContainerAnvilInventory.java 2014-11-28 17:43:42.993707437 +0000 -+++ src/main/java/net/minecraft/server/ContainerAnvilInventory.java 2014-11-28 17:38:20.000000000 +0000 -@@ -1,8 +1,43 @@ - package net.minecraft.server; - -+// CraftBukkit start -+import java.util.List; -+import org.bukkit.craftbukkit.entity.CraftHumanEntity; -+import org.bukkit.entity.HumanEntity; -+// CraftBukkit end -+ - public class ContainerAnvilInventory extends InventorySubcontainer { - - final ContainerAnvil a; -+ -+ // CraftBukkit start -+ public List transaction = new java.util.ArrayList(); -+ public org.bukkit.entity.Player player; -+ private int maxStack = MAX_STACK; -+ -+ public ItemStack[] getContents() { -+ return this.items; -+ } -+ -+ public void onOpen(CraftHumanEntity who) { -+ transaction.add(who); -+ } -+ -+ public void onClose(CraftHumanEntity who) { -+ transaction.remove(who); -+ } -+ -+ public List getViewers() { -+ return transaction; -+ } -+ -+ public org.bukkit.inventory.InventoryHolder getOwner() { -+ return this.player; -+ } -+ -+ public void setMaxStackSize(int size) { -+ maxStack = size; -+ } - - ContainerAnvilInventory(ContainerAnvil containeranvil, String s, boolean flag, int i) { - super(s, flag, i); -@@ -13,4 +48,11 @@ - super.update(); - this.a.a((IInventory) this); - } -+ -+ // CraftBukkit start - override inherited maxStack from InventorySubcontainer -+ @Override -+ public int getMaxStackSize() { -+ return maxStack; -+ } -+ // CraftBukkit end - } diff --git a/nms-patches/ContainerBeacon.patch b/nms-patches/ContainerBeacon.patch index 348689e2c9..bc61586d7a 100644 --- a/nms-patches/ContainerBeacon.patch +++ b/nms-patches/ContainerBeacon.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ContainerBeacon.java 2014-11-28 17:43:42.997707437 +0000 -+++ src/main/java/net/minecraft/server/ContainerBeacon.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ContainerBeacon.java 2015-02-26 22:40:22.379608142 +0000 ++++ src/main/java/net/minecraft/server/ContainerBeacon.java 2015-02-26 22:40:22.379608142 +0000 @@ -1,11 +1,18 @@ package net.minecraft.server; @@ -8,7 +8,7 @@ public class ContainerBeacon extends Container { private IInventory a; - private final SlotBeacon f; + private final ContainerBeacon.SlotBeacon f; + // CraftBukkit start + private CraftInventoryView bukkitEntity = null; + private PlayerInventory player; @@ -17,9 +17,9 @@ public ContainerBeacon(IInventory iinventory, IInventory iinventory1) { + player = (PlayerInventory) iinventory; // CraftBukkit - TODO: check this this.a = iinventory1; - this.a((Slot) (this.f = new SlotBeacon(this, iinventory1, 0, 136, 110))); + this.a((Slot) (this.f = new ContainerBeacon.SlotBeacon(iinventory1, 0, 136, 110))); byte b0 = 36; -@@ -35,6 +42,7 @@ +@@ -47,6 +54,7 @@ } public boolean a(EntityHuman entityhuman) { @@ -27,11 +27,11 @@ return this.a.a(entityhuman); } -@@ -83,4 +91,17 @@ - - return itemstack; +@@ -110,4 +118,17 @@ + return 1; + } } -+ ++ + // CraftBukkit start + @Override + public CraftInventoryView getBukkitView() { diff --git a/nms-patches/ContainerBrewingStand.patch b/nms-patches/ContainerBrewingStand.patch index cdccd70bea..3541c8fadc 100644 --- a/nms-patches/ContainerBrewingStand.patch +++ b/nms-patches/ContainerBrewingStand.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ContainerBrewingStand.java 2014-11-28 17:43:42.997707437 +0000 -+++ src/main/java/net/minecraft/server/ContainerBrewingStand.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ContainerBrewingStand.java 2015-02-26 22:40:22.379608142 +0000 ++++ src/main/java/net/minecraft/server/ContainerBrewingStand.java 2015-02-26 22:40:22.383608142 +0000 @@ -1,12 +1,23 @@ package net.minecraft.server; @@ -13,17 +13,17 @@ private IInventory brewingStand; private final Slot f; private int g; -+ + + // CraftBukkit start + private CraftInventoryView bukkitEntity = null; + private PlayerInventory player; + // CraftBukkit end - ++ public ContainerBrewingStand(PlayerInventory playerinventory, IInventory iinventory) { + player = playerinventory; // CraftBukkit this.brewingStand = iinventory; - this.a((Slot) (new SlotPotionBottle(playerinventory.player, iinventory, 0, 56, 46))); - this.a((Slot) (new SlotPotionBottle(playerinventory.player, iinventory, 1, 79, 53))); + this.a((Slot) (new ContainerBrewingStand.SlotPotionBottle(playerinventory.player, iinventory, 0, 56, 46))); + this.a((Slot) (new ContainerBrewingStand.SlotPotionBottle(playerinventory.player, iinventory, 1, 79, 53))); @@ -47,6 +58,7 @@ } @@ -32,11 +32,11 @@ return this.brewingStand.a(entityhuman); } -@@ -101,4 +113,17 @@ - - return itemstack; +@@ -146,4 +158,17 @@ + return itemstack != null && (itemstack.getItem() == Items.POTION || itemstack.getItem() == Items.GLASS_BOTTLE); + } } -+ ++ + // CraftBukkit start + @Override + public CraftInventoryView getBukkitView() { diff --git a/nms-patches/ContainerChest.patch b/nms-patches/ContainerChest.patch index b0cb0da50a..1e4fa8e513 100644 --- a/nms-patches/ContainerChest.patch +++ b/nms-patches/ContainerChest.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ContainerChest.java 2014-11-28 17:43:43.001707437 +0000 -+++ src/main/java/net/minecraft/server/ContainerChest.java 2014-11-28 17:38:23.000000000 +0000 -@@ -1,15 +1,48 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/ContainerChest.java 2015-02-26 22:40:22.387608142 +0000 ++++ src/main/java/net/minecraft/server/ContainerChest.java 2015-02-26 22:40:22.387608142 +0000 +@@ -1,9 +1,37 @@ package net.minecraft.server; +// CraftBukkit start @@ -10,7 +10,7 @@ + public class ContainerChest extends Container { - public IInventory container; + private IInventory container; private int f; + // CraftBukkit start + private CraftInventoryView bukkitEntity = null; @@ -38,17 +38,18 @@ public ContainerChest(IInventory iinventory, IInventory iinventory1, EntityHuman entityhuman) { this.container = iinventory1; - this.f = iinventory1.getSize() / 9; +@@ -11,6 +39,11 @@ iinventory1.startOpen(entityhuman); int i = (this.f - 4) * 18; -+ + + // CraftBukkit start - Save player + // TODO: Should we check to make sure it really is an InventoryPlayer? + this.player = (PlayerInventory) iinventory; + // CraftBukkit end - ++ int j; int k; + @@ -33,6 +66,7 @@ } diff --git a/nms-patches/ContainerDispenser.patch b/nms-patches/ContainerDispenser.patch index 40929cda3d..3263e2b7d6 100644 --- a/nms-patches/ContainerDispenser.patch +++ b/nms-patches/ContainerDispenser.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ContainerDispenser.java 2014-11-28 17:43:43.001707437 +0000 -+++ src/main/java/net/minecraft/server/ContainerDispenser.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ContainerDispenser.java 2015-02-26 22:40:22.395608141 +0000 ++++ src/main/java/net/minecraft/server/ContainerDispenser.java 2015-02-26 22:40:22.395608141 +0000 @@ -1,11 +1,24 @@ package net.minecraft.server; diff --git a/nms-patches/ContainerEnchantTable.patch b/nms-patches/ContainerEnchantTable.patch index b9a813f176..7d47a3f3d1 100644 --- a/nms-patches/ContainerEnchantTable.patch +++ b/nms-patches/ContainerEnchantTable.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ContainerEnchantTable.java Sat Jan 31 16:10:54 2015 -+++ src/main/java/net/minecraft/server/ContainerEnchantTable.java Sat Jan 31 16:10:54 2015 -@@ -3,15 +3,31 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/ContainerEnchantTable.java 2015-02-27 17:02:15.091159962 +0000 ++++ src/main/java/net/minecraft/server/ContainerEnchantTable.java 2015-02-27 17:02:15.091159962 +0000 +@@ -3,9 +3,21 @@ import java.util.List; import java.util.Random; @@ -17,12 +17,13 @@ + public class ContainerEnchantTable extends Container { -- public IInventory enchantSlots = new ContainerEnchantTableInventory(this, "Enchant", true, 2); +- public IInventory enchantSlots = new InventorySubcontainer("Enchant", true, 2) { + // CraftBukkit - make type specific (changed from IInventory) -+ public ContainerEnchantTableInventory enchantSlots = new ContainerEnchantTableInventory(this, "Enchant", true, 2); - private World world; - private BlockPosition position; - private Random k = new Random(); ++ public InventorySubcontainer enchantSlots = new InventorySubcontainer("Enchant", true, 2) { + public int getMaxStackSize() { + return 64; + } +@@ -21,6 +33,10 @@ public int f; public int[] costs = new int[3]; public int[] h = new int[] { -1, -1, -1}; @@ -33,33 +34,29 @@ public ContainerEnchantTable(PlayerInventory playerinventory, World world, BlockPosition blockposition) { this.world = world; -@@ -31,7 +47,11 @@ - for (i = 0; i < 9; ++i) { +@@ -53,6 +69,9 @@ this.a(new Slot(playerinventory, i, 8 + i * 18, 142)); } -- -+ + + // CraftBukkit start + player = (Player) playerinventory.player.getBukkitEntity(); -+ enchantSlots.player = player; + // CraftBukkit end } public void addSlotListener(ICrafting icrafting) { -@@ -67,7 +87,7 @@ +@@ -88,7 +107,7 @@ ItemStack itemstack = iinventory.getItem(0); int i; - if (itemstack != null && itemstack.v()) { + if (itemstack != null) { // CraftBukkit - relax condition - if (!this.world.isStatic) { + if (!this.world.isClientSide) { i = 0; -@@ -114,6 +134,20 @@ - this.costs[j] = 0; +@@ -136,6 +155,20 @@ } } -+ + + // CraftBukkit start + CraftItemStack item = CraftItemStack.asCraftMirror(itemstack); + PrepareItemEnchantEvent event = new PrepareItemEnchantEvent(player, this.getBukkitView(), this.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()), item, this.costs, i); @@ -73,12 +70,13 @@ + return; + } + // CraftBukkit end - ++ for (j = 0; j < 3; ++j) { if (this.costs[j] > 0) { -@@ -149,24 +183,56 @@ + List list = this.a(itemstack, j, this.costs[j]); +@@ -170,24 +203,55 @@ } else if (this.costs[i] > 0 && itemstack != null && (entityhuman.expLevel >= j && entityhuman.expLevel >= this.costs[i] || entityhuman.abilities.canInstantlyBuild)) { - if (!this.world.isStatic) { + if (!this.world.isClientSide) { List list = this.a(itemstack, i, this.costs[i]); + // CraftBukkit start - Provide an empty enchantment list + if (list == null) { @@ -96,19 +94,20 @@ + enchants.put(org.bukkit.enchantments.Enchantment.getById(instance.enchantment.id), instance.level); + } + CraftItemStack item = CraftItemStack.asCraftMirror(itemstack); -+ ++ + EnchantItemEvent event = new EnchantItemEvent((Player) entityhuman.getBukkitEntity(), this.getBukkitView(), this.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()), item, this.costs[i], enchants, i); + this.world.getServer().getPluginManager().callEvent(event); -+ ++ + int level = event.getExpLevelCost(); + if (event.isCancelled() || (level > entityhuman.expLevel && !entityhuman.abilities.canInstantlyBuild) || event.getEnchantsToAdd().isEmpty()) { + return false; + } -+ if (flag) { itemstack.setItem(Items.ENCHANTED_BOOK); } -+ + +- for (int k = 0; k < list.size(); ++k) { +- WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) list.get(k); + for (Map.Entry entry : event.getEnchantsToAdd().entrySet()) { + try { + if (flag) { @@ -117,15 +116,12 @@ + continue; + } -- for (int k = 0; k < list.size(); ++k) { -- WeightedRandomEnchant weightedrandomenchant = (WeightedRandomEnchant) list.get(k); -- - if (flag) { - Items.ENCHANTED_BOOK.a(itemstack, weightedrandomenchant); - } else { - itemstack.addEnchantment(weightedrandomenchant.enchantment, weightedrandomenchant.level); + WeightedRandomEnchant enchantment = new WeightedRandomEnchant(Enchantment.getById(enchantId), entry.getValue()); -+ Items.ENCHANTED_BOOK.a(itemstack, enchantment); ++ Items.ENCHANTED_BOOK.a(itemstack, enchantment); + } else { + item.addUnsafeEnchantment(entry.getKey(), entry.getValue()); + } @@ -133,15 +129,15 @@ + /* Just swallow invalid enchantments */ } } -+ + + entityhuman.b(j); + // CraftBukkit end - ++ + // CraftBukkit - TODO: let plugins change this if (!entityhuman.abilities.canInstantlyBuild) { itemstack1.count -= j; if (itemstack1.count <= 0) { -@@ -199,6 +265,11 @@ +@@ -221,6 +285,11 @@ public void b(EntityHuman entityhuman) { super.b(entityhuman); @@ -150,10 +146,10 @@ + this.world = entityhuman.getWorld(); + } + // CraftBukkit end - if (!this.world.isStatic) { + if (!this.world.isClientSide) { for (int i = 0; i < this.enchantSlots.getSize(); ++i) { ItemStack itemstack = this.enchantSlots.splitWithoutUpdate(i); -@@ -212,6 +283,7 @@ +@@ -234,6 +303,7 @@ } public boolean a(EntityHuman entityhuman) { @@ -161,11 +157,10 @@ return this.world.getType(this.position).getBlock() != Blocks.ENCHANTING_TABLE ? false : entityhuman.e((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D; } -@@ -263,5 +335,18 @@ - } +@@ -286,4 +356,17 @@ return itemstack; -+ } + } + + // CraftBukkit start + @Override @@ -177,6 +172,6 @@ + CraftInventoryEnchanting inventory = new CraftInventoryEnchanting(this.enchantSlots); + bukkitEntity = new CraftInventoryView(this.player, inventory, this); + return bukkitEntity; - } ++ } + // CraftBukkit end } diff --git a/nms-patches/ContainerEnchantTableInventory.patch b/nms-patches/ContainerEnchantTableInventory.patch deleted file mode 100644 index 1e3f818df7..0000000000 --- a/nms-patches/ContainerEnchantTableInventory.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ContainerEnchantTableInventory.java 2014-11-28 17:43:43.005707437 +0000 -+++ src/main/java/net/minecraft/server/ContainerEnchantTableInventory.java 2014-11-28 17:38:23.000000000 +0000 -@@ -1,8 +1,45 @@ - package net.minecraft.server; - --class ContainerEnchantTableInventory extends InventorySubcontainer { -+// CraftBukkit start -+import java.util.List; -+import org.bukkit.craftbukkit.entity.CraftHumanEntity; -+import org.bukkit.entity.HumanEntity; -+// CraftBukkit end -+ -+// CraftBukkit -> public -+public class ContainerEnchantTableInventory extends InventorySubcontainer { - - final ContainerEnchantTable enchantTable; -+ -+ // CraftBukkit start -+ public List transaction = new java.util.ArrayList(); -+ public org.bukkit.entity.Player player; -+ private int maxStack = MAX_STACK; -+ -+ public ItemStack[] getContents() { -+ return this.items; -+ } -+ -+ public void onOpen(CraftHumanEntity who) { -+ transaction.add(who); -+ } -+ -+ public void onClose(CraftHumanEntity who) { -+ transaction.remove(who); -+ } -+ -+ public List getViewers() { -+ return transaction; -+ } -+ -+ public org.bukkit.inventory.InventoryHolder getOwner() { -+ return this.player; -+ } -+ -+ public void setMaxStackSize(int size) { -+ maxStack = size; -+ } -+ // CraftBukkit end - - ContainerEnchantTableInventory(ContainerEnchantTable containerenchanttable, String s, boolean flag, int i) { - super(s, flag, i); -@@ -10,7 +47,7 @@ - } - - public int getMaxStackSize() { -- return 64; -+ return maxStack; // CraftBukkit - } - - public void update() { diff --git a/nms-patches/ContainerFurnace.patch b/nms-patches/ContainerFurnace.patch index b976033b95..780d03c2ec 100644 --- a/nms-patches/ContainerFurnace.patch +++ b/nms-patches/ContainerFurnace.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ContainerFurnace.java 2014-11-28 17:43:43.009707437 +0000 -+++ src/main/java/net/minecraft/server/ContainerFurnace.java 2014-11-28 17:38:17.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ContainerFurnace.java 2015-02-26 22:40:22.407608141 +0000 ++++ src/main/java/net/minecraft/server/ContainerFurnace.java 2015-02-26 22:40:22.407608141 +0000 @@ -1,5 +1,10 @@ package net.minecraft.server; @@ -11,11 +11,10 @@ public class ContainerFurnace extends Container { private final IInventory furnace; -@@ -7,12 +12,29 @@ - private int g; +@@ -8,11 +13,28 @@ private int h; private int i; -+ + + // CraftBukkit start + private CraftInventoryView bukkitEntity = null; + private PlayerInventory player; @@ -30,8 +29,8 @@ + bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this); + return bukkitEntity; + } -+ // CraftBukkit end - ++ // CraftBukkit end ++ public ContainerFurnace(PlayerInventory playerinventory, IInventory iinventory) { this.furnace = iinventory; this.a(new Slot(iinventory, 0, 56, 17)); diff --git a/nms-patches/ContainerHopper.patch b/nms-patches/ContainerHopper.patch index 6d7395f7ba..5842a5745b 100644 --- a/nms-patches/ContainerHopper.patch +++ b/nms-patches/ContainerHopper.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ContainerHopper.java 2014-11-28 17:43:43.009707437 +0000 -+++ src/main/java/net/minecraft/server/ContainerHopper.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ContainerHopper.java 2015-02-26 22:40:22.407608141 +0000 ++++ src/main/java/net/minecraft/server/ContainerHopper.java 2015-02-26 22:40:22.411608141 +0000 @@ -1,11 +1,33 @@ package net.minecraft.server; @@ -11,7 +11,7 @@ public class ContainerHopper extends Container { private final IInventory hopper; -+ + + // CraftBukkit start + private CraftInventoryView bukkitEntity = null; + private PlayerInventory player; @@ -27,7 +27,7 @@ + return bukkitEntity; + } + // CraftBukkit end - ++ public ContainerHopper(PlayerInventory playerinventory, IInventory iinventory, EntityHuman entityhuman) { this.hopper = iinventory; + this.player = playerinventory; // CraftBukkit - save player diff --git a/nms-patches/ContainerHorse.patch b/nms-patches/ContainerHorse.patch index 400f4436a8..aa946b517f 100644 --- a/nms-patches/ContainerHorse.patch +++ b/nms-patches/ContainerHorse.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ContainerHorse.java 2014-11-28 17:43:43.013707437 +0000 -+++ src/main/java/net/minecraft/server/ContainerHorse.java 2014-11-28 17:38:17.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ContainerHorse.java 2015-02-26 22:40:22.411608141 +0000 ++++ src/main/java/net/minecraft/server/ContainerHorse.java 2015-02-26 22:40:22.415608141 +0000 @@ -1,11 +1,33 @@ package net.minecraft.server; @@ -13,7 +13,7 @@ private IInventory a; private EntityHorse f; -+ + + // CraftBukkit start + org.bukkit.craftbukkit.inventory.CraftInventoryView bukkitEntity; + PlayerInventory player; @@ -27,8 +27,8 @@ + CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryHorse(this.a); + return bukkitEntity = new CraftInventoryView(player.player.getBukkitEntity(), inventory, this); + } - - public ContainerHorse(IInventory iinventory, IInventory iinventory1, EntityHorse entityhorse, EntityHuman entityhuman) { ++ + public ContainerHorse(IInventory iinventory, final IInventory iinventory1, final EntityHorse entityhorse, EntityHuman entityhuman) { + player = (PlayerInventory) iinventory; + // CraftBukkit end this.a = iinventory1; diff --git a/nms-patches/ContainerMerchant.patch b/nms-patches/ContainerMerchant.patch index d06f004126..fdbef6a805 100644 --- a/nms-patches/ContainerMerchant.patch +++ b/nms-patches/ContainerMerchant.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ContainerMerchant.java 2014-11-28 17:43:43.017707437 +0000 -+++ src/main/java/net/minecraft/server/ContainerMerchant.java 2014-11-28 17:38:16.000000000 +0000 -@@ -1,10 +1,25 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/ContainerMerchant.java 2015-02-26 22:40:22.423608141 +0000 ++++ src/main/java/net/minecraft/server/ContainerMerchant.java 2015-02-26 22:40:22.423608141 +0000 +@@ -1,11 +1,26 @@ package net.minecraft.server; +import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit @@ -10,7 +10,7 @@ private IMerchant merchant; private InventoryMerchant f; private final World g; -+ + + // CraftBukkit start + private CraftInventoryView bukkitEntity = null; + private PlayerInventory player; @@ -23,9 +23,10 @@ + return bukkitEntity; + } + // CraftBukkit end - ++ public ContainerMerchant(PlayerInventory playerinventory, IMerchant imerchant, World world) { this.merchant = imerchant; + this.g = world; @@ -13,6 +28,7 @@ this.a(new Slot(this.f, 0, 36, 53)); this.a(new Slot(this.f, 1, 62, 53)); diff --git a/nms-patches/ContainerPlayer.patch b/nms-patches/ContainerPlayer.patch index 1981486f04..0bfc1e161c 100644 --- a/nms-patches/ContainerPlayer.patch +++ b/nms-patches/ContainerPlayer.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ContainerPlayer.java 2014-11-28 17:43:43.021707437 +0000 -+++ src/main/java/net/minecraft/server/ContainerPlayer.java 2014-11-28 17:38:19.000000000 +0000 -@@ -1,15 +1,28 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/ContainerPlayer.java 2015-02-26 22:40:22.427608141 +0000 ++++ src/main/java/net/minecraft/server/ContainerPlayer.java 2015-02-26 22:40:22.427608141 +0000 +@@ -1,28 +1,42 @@ package net.minecraft.server; +// CraftBukkit start @@ -19,7 +19,7 @@ + private PlayerInventory player; + // CraftBukkit end - public ContainerPlayer(PlayerInventory playerinventory, boolean flag, EntityHuman entityhuman) { + public ContainerPlayer(final PlayerInventory playerinventory, boolean flag, EntityHuman entityhuman) { this.g = flag; this.h = entityhuman; + this.resultInventory = new InventoryCraftResult(); // CraftBukkit - moved to before InventoryCrafting construction @@ -28,8 +28,38 @@ + this.player = playerinventory; // CraftBukkit - save player this.a((Slot) (new SlotResult(playerinventory.player, this.craftInventory, this.resultInventory, 0, 144, 36))); - int i; -@@ -35,11 +48,22 @@ +- final int i; ++ // CraftBukkit - fixed multiple decompiler errors below, good luck + int j; + +- for (i = 0; i < 2; ++i) { ++ for (int i = 0; i < 2; ++i) { + for (j = 0; j < 2; ++j) { + this.a(new Slot(this.craftInventory, j + i * 2, 88 + j * 18, 26 + i * 18)); + } + } + +- for (i = 0; i < 4; ++i) { +- this.a(new Slot(playerinventory, playerinventory.getSize() - 1 - i, 8, 8 + i * 18) { ++ for (int ii = 0; ii < 4; ++ii) { ++ final int i = ii; ++ this.a(new Slot(playerinventory, playerinventory.getSize() - 1 - ii, 8, 8 + ii * 18) { + public int getMaxStackSize() { + return 1; + } +@@ -33,21 +47,32 @@ + }); + } + +- for (i = 0; i < 3; ++i) { ++ for (int i = 0; i < 3; ++i) { + for (j = 0; j < 9; ++j) { + this.a(new Slot(playerinventory, j + (i + 1) * 9, 8 + j * 18, 84 + i * 18)); + } + } + +- for (i = 0; i < 9; ++i) { ++ for (int i = 0; i < 9; ++i) { this.a(new Slot(playerinventory, i, 8 + i * 18, 142)); } @@ -54,7 +84,7 @@ } public void b(EntityHuman entityhuman) { -@@ -119,4 +143,17 @@ +@@ -127,4 +152,17 @@ public boolean a(ItemStack itemstack, Slot slot) { return slot.inventory != this.resultInventory && super.a(itemstack, slot); } diff --git a/nms-patches/ContainerWorkbench.patch b/nms-patches/ContainerWorkbench.patch index ea1978e95d..a6aad3bdee 100644 --- a/nms-patches/ContainerWorkbench.patch +++ b/nms-patches/ContainerWorkbench.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/ContainerWorkbench.java 2014-12-12 11:04:49.302794059 +1100 -+++ src/main/java/net/minecraft/server/ContainerWorkbench.java 2014-12-12 11:04:29.771003013 +1100 +--- /home/matt/mc-dev-private//net/minecraft/server/ContainerWorkbench.java 2015-02-26 22:40:22.427608141 +0000 ++++ src/main/java/net/minecraft/server/ContainerWorkbench.java 2015-02-26 22:40:22.431608141 +0000 @@ -1,13 +1,28 @@ package net.minecraft.server; diff --git a/nms-patches/ControllerLook.patch b/nms-patches/ControllerLook.patch deleted file mode 100644 index cc6a3806d1..0000000000 --- a/nms-patches/ControllerLook.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ControllerLook.java 2014-11-28 17:43:43.025707437 +0000 -+++ src/main/java/net/minecraft/server/ControllerLook.java 2014-11-28 17:38:21.000000000 +0000 -@@ -1,5 +1,7 @@ - package net.minecraft.server; - -+import org.bukkit.craftbukkit.TrigMath; // CraftBukkit -+ - public class ControllerLook { - - private EntityInsentient a; -@@ -45,8 +47,10 @@ - double d1 = this.f - (this.a.locY + (double) this.a.getHeadHeight()); - double d2 = this.g - this.a.locZ; - double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2); -- float f = (float) (Math.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F; -- float f1 = (float) (-(Math.atan2(d1, d3) * 180.0D / 3.1415927410125732D)); -+ // CraftBukkit start - Math -> TrigMath -+ float f = (float) (TrigMath.atan2(d2, d0) * 180.0D / 3.1415927410125732D) - 90.0F; -+ float f1 = (float) (-(TrigMath.atan2(d1, d3) * 180.0D / 3.1415927410125732D)); -+ // CraftBukkit end - - this.a.pitch = this.a(this.a.pitch, f1, this.c); - this.a.aI = this.a(this.a.aI, f, this.b); diff --git a/nms-patches/ControllerMove.patch b/nms-patches/ControllerMove.patch deleted file mode 100644 index 2f217365fc..0000000000 --- a/nms-patches/ControllerMove.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ControllerMove.java 2014-11-28 17:43:43.025707437 +0000 -+++ src/main/java/net/minecraft/server/ControllerMove.java 2014-11-28 17:38:22.000000000 +0000 -@@ -43,7 +43,8 @@ - double d3 = d0 * d0 + d2 * d2 + d1 * d1; - - if (d3 >= 2.500000277905201E-7D) { -- float f = (float) (Math.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F; -+ // CraftBukkit - Math -> TrigMath -+ float f = (float) (org.bukkit.craftbukkit.TrigMath.atan2(d1, d0) * 180.0D / 3.1415927410125732D) - 90.0F; - - this.a.yaw = this.a(this.a.yaw, f, 30.0F); - this.a.j((float) (this.e * this.a.getAttributeInstance(GenericAttributes.d).getValue())); diff --git a/nms-patches/CraftingManager.patch b/nms-patches/CraftingManager.patch index b3401ade93..e03c00bcde 100644 --- a/nms-patches/CraftingManager.patch +++ b/nms-patches/CraftingManager.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/CraftingManager.java 2014-11-28 17:43:43.029707436 +0000 -+++ src/main/java/net/minecraft/server/CraftingManager.java 2014-11-28 17:38:22.000000000 +0000 -@@ -8,10 +8,16 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/CraftingManager.java 2015-02-26 22:40:22.431608141 +0000 ++++ src/main/java/net/minecraft/server/CraftingManager.java 2015-02-26 22:40:22.435608141 +0000 +@@ -9,16 +9,22 @@ import java.util.Iterator; import java.util.List; @@ -9,7 +9,8 @@ public class CraftingManager { private static final CraftingManager a = new CraftingManager(); - public List recipes = Lists.newArrayList(); +- private final List recipes = Lists.newArrayList(); ++ public List recipes = Lists.newArrayList(); // CraftBukkit - public, removed final + // CraftBukkit start + public IRecipe lastRecipe; + public org.bukkit.inventory.InventoryView lastCraftView; @@ -17,23 +18,28 @@ public static CraftingManager getInstance() { return CraftingManager.a; -@@ -166,8 +172,15 @@ + } + +- private CraftingManager() { ++ public CraftingManager() { // CraftBukkit - public + (new RecipesTools()).a(this); + (new RecipesWeapons()).a(this); + (new RecipeIngots()).a(this); +@@ -167,7 +173,12 @@ this.registerShapedRecipe(new ItemStack(Blocks.DAYLIGHT_DETECTOR), new Object[] { "GGG", "QQQ", "WWW", Character.valueOf('G'), Blocks.GLASS, Character.valueOf('Q'), Items.QUARTZ, Character.valueOf('W'), Blocks.WOODEN_SLAB}); this.registerShapedRecipe(new ItemStack(Blocks.HOPPER), new Object[] { "I I", "ICI", " I ", Character.valueOf('I'), Items.IRON_INGOT, Character.valueOf('C'), Blocks.CHEST}); - this.registerShapedRecipe(new ItemStack(Items.ARMOR_STAND, 1), new Object[] { "///", " / ", "/_/", Character.valueOf('/'), Items.STICK, Character.valueOf('_'), new ItemStack(Blocks.STONE_SLAB, 1, EnumStoneSlabVariant.STONE.a())}); -+ // Collections.sort(this.recipes, new RecipeSorter(this)); // CraftBukkit - moved below + this.registerShapedRecipe(new ItemStack(Items.ARMOR_STAND, 1), new Object[] { "///", " / ", "/_/", Character.valueOf('/'), Items.STICK, Character.valueOf('_'), new ItemStack(Blocks.STONE_SLAB, 1, BlockDoubleStepAbstract.EnumStoneSlabVariant.STONE.a())}); +- Collections.sort(this.recipes, new Comparator() { + sort(); + } -+ ++ + // CraftBukkit start + public void sort() { - Collections.sort(this.recipes, new RecipeSorter(this)); - } -+ // CraftBukkit end - - public ShapedRecipes registerShapedRecipe(ItemStack itemstack, Object... aobject) { - String s = ""; -@@ -265,13 +278,18 @@ ++ Collections.sort(this.recipes, new Comparator() { + public int a(IRecipe irecipe, IRecipe irecipe1) { + return irecipe instanceof ShapelessRecipes && irecipe1 instanceof ShapedRecipes ? 1 : (irecipe1 instanceof ShapelessRecipes && irecipe instanceof ShapedRecipes ? -1 : (irecipe1.a() < irecipe.a() ? -1 : (irecipe1.a() > irecipe.a() ? 1 : 0))); + } +@@ -274,13 +285,18 @@ do { if (!iterator.hasNext()) { @@ -42,11 +48,9 @@ } irecipe = (IRecipe) iterator.next(); -- } while (!irecipe.a(inventorycrafting, world)); -- + } while (!irecipe.a(inventorycrafting, world)); + - return irecipe.a(inventorycrafting); -+ } while (!irecipe.a(inventorycrafting, world)); -+ + // CraftBukkit start - INVENTORY_PRE_CRAFT event + inventorycrafting.currentRecipe = irecipe; + ItemStack result = irecipe.a(inventorycrafting); diff --git a/nms-patches/CrashReport.patch b/nms-patches/CrashReport.patch index ce067cf84c..efd0ed4020 100644 --- a/nms-patches/CrashReport.patch +++ b/nms-patches/CrashReport.patch @@ -1,9 +1,9 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/CrashReport.java 2014-11-28 17:43:43.029707436 +0000 -+++ src/main/java/net/minecraft/server/CrashReport.java 2014-11-28 17:38:17.000000000 +0000 -@@ -40,6 +40,7 @@ - this.d.a("Memory", (Callable) (new CrashReportMemory(this))); - this.d.a("JVM Flags", (Callable) (new CrashReportJVMFlags(this))); - this.d.a("IntCache", (Callable) (new CrashReportIntCacheSize(this))); +--- /home/matt/mc-dev-private//net/minecraft/server/CrashReport.java 2015-02-26 22:40:22.435608141 +0000 ++++ src/main/java/net/minecraft/server/CrashReport.java 2015-02-26 22:40:22.439608141 +0000 +@@ -133,6 +133,7 @@ + return this.a(); + } + }); + this.d.a("CraftBukkit Information", (Callable) (new org.bukkit.craftbukkit.CraftCrashReport())); // CraftBukkit } diff --git a/nms-patches/DedicatedServer.patch b/nms-patches/DedicatedServer.patch index 7b6eb346c8..f84e896116 100644 --- a/nms-patches/DedicatedServer.patch +++ b/nms-patches/DedicatedServer.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/DedicatedServer.java 2014-11-28 17:43:43.033707436 +0000 -+++ src/main/java/net/minecraft/server/DedicatedServer.java 2014-11-28 17:38:22.000000000 +0000 -@@ -13,6 +13,14 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/DedicatedServer.java 2015-02-26 22:40:22.443608141 +0000 ++++ src/main/java/net/minecraft/server/DedicatedServer.java 2015-02-26 22:40:22.443608141 +0000 +@@ -15,20 +15,32 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -10,31 +10,68 @@ + +import org.bukkit.craftbukkit.LoggerOutputStream; +import org.bukkit.event.server.ServerCommandEvent; ++import org.bukkit.craftbukkit.util.Waitable; ++import org.bukkit.event.server.RemoteServerCommandEvent; +// CraftBukkit end + public class DedicatedServer extends MinecraftServer implements IMinecraftServer { private static final Logger LOGGER = LogManager.getLogger(); -@@ -25,23 +33,48 @@ - private EnumGamemode q; - private boolean r; +- private final List l = Collections.synchronizedList(Lists.newArrayList()); ++ private final List l = Collections.synchronizedList(Lists.newArrayList()); // CraftBukkit - fix decompile error + private RemoteStatusListener m; + private RemoteControlListener n; +- private PropertyManager propertyManager; ++ public PropertyManager propertyManager; // CraftBukkit - public + private EULA p; + private boolean generateStructures; + private WorldSettings.EnumGamemode r; + private boolean s; - public DedicatedServer(File file) { - super(file, Proxy.NO_PROXY, DedicatedServer.a); + // CraftBukkit start - Signature changed + public DedicatedServer(joptsimple.OptionSet options) { -+ super(options, Proxy.NO_PROXY, a); -+ // super(file, Proxy.NO_PROXY, a); ++ super(options, Proxy.NO_PROXY, DedicatedServer.a); + // CraftBukkit end - new ThreadSleepForever(this, "Server Infinisleeper"); - } + Thread thread = new Thread("Server Infinisleeper") { + { + this.setDaemon(true); +@@ -50,13 +62,27 @@ + protected boolean init() throws IOException { + Thread thread = new Thread("Server console handler") { + public void run() { +- BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in)); ++ // CraftBukkit start ++ if (!org.bukkit.craftbukkit.Main.useConsole) { ++ return; ++ } ++ // CraftBukkit end -- protected boolean init() { -+ protected boolean init() throws java.net.UnknownHostException { // CraftBukkit - throws UnknownHostException - ThreadCommandReader threadcommandreader = new ThreadCommandReader(this, "Server console handler"); ++ jline.console.ConsoleReader bufferedreader = reader; // CraftBukkit + String s; - threadcommandreader.setDaemon(true); - threadcommandreader.start(); + try { +- while (!DedicatedServer.this.isStopped() && DedicatedServer.this.isRunning() && (s = bufferedreader.readLine()) != null) { +- DedicatedServer.this.issueCommand(s, DedicatedServer.this); ++ // CraftBukkit start - JLine disabling compatibility ++ while (!isStopped() && isRunning()) { ++ if (org.bukkit.craftbukkit.Main.useJline) { ++ s = bufferedreader.readLine(">", null); ++ } else { ++ s = bufferedreader.readLine(); ++ } ++ if (s != null && s.trim().length() > 0) { // Trim to filter lines which are just spaces ++ issueCommand(s, DedicatedServer.this); ++ } ++ // CraftBukkit end + } + } catch (IOException ioexception) { + DedicatedServer.LOGGER.error("Exception handling console input", ioexception); +@@ -67,13 +93,35 @@ + + thread.setDaemon(true); + thread.start(); + + // CraftBukkit start - TODO: handle command-line logging arguments + java.util.logging.Logger global = java.util.logging.Logger.getLogger(""); @@ -57,7 +94,7 @@ + System.setErr(new PrintStream(new LoggerOutputStream(logger, Level.WARN), true)); + // CraftBukkit end + - DedicatedServer.LOGGER.info("Starting minecraft server version 1.8"); + DedicatedServer.LOGGER.info("Starting minecraft server version 1.8.3"); if (Runtime.getRuntime().maxMemory() / 1024L / 1024L < 512L) { DedicatedServer.LOGGER.warn("To start the server with more ram, launch it as \"java -Xmx1024M -Xms1024M -jar minecraft_server.jar\""); } @@ -65,18 +102,10 @@ DedicatedServer.LOGGER.info("Loading properties"); - this.propertyManager = new PropertyManager(new File("server.properties")); + this.propertyManager = new PropertyManager(this.options); // CraftBukkit - CLI argument support - this.o = new EULA(new File("eula.txt")); - if (!this.o.a()) { + this.p = new EULA(new File("eula.txt")); + if (!this.p.a()) { DedicatedServer.LOGGER.info("You need to agree to the EULA in order to run the server. Go to eula.txt for more info."); -@@ -90,13 +123,15 @@ - - try { - this.ao().a(inetaddress, this.Q()); -- } catch (IOException ioexception) { -+ } catch (Throwable ioexception) { // CraftBukkit - IOException -> Throwable - DedicatedServer.LOGGER.warn("**** FAILED TO BIND TO PORT!"); - DedicatedServer.LOGGER.warn("The exception was: {}", new Object[] { ioexception.toString()}); - DedicatedServer.LOGGER.warn("Perhaps a server is already running on that port?"); +@@ -129,6 +177,8 @@ return false; } @@ -85,23 +114,22 @@ if (!this.getOnlineMode()) { DedicatedServer.LOGGER.warn("**** SERVER IS RUNNING IN OFFLINE/INSECURE MODE!"); DedicatedServer.LOGGER.warn("The server will make no attempt to authenticate usernames. Beware."); -@@ -111,7 +146,8 @@ +@@ -143,7 +193,7 @@ if (!NameReferencingFileConverter.a(this.propertyManager)) { return false; } else { - this.a((PlayerList) (new DedicatedPlayerList(this))); -+ // this.a((PlayerList) (new DedicatedPlayerList(this))); // CraftBukkit - moved up + this.convertable = new WorldLoaderServer(server.getWorldContainer()); // CraftBukkit - moved from MinecraftServer constructor long j = System.nanoTime(); if (this.T() == null) { -@@ -166,7 +202,18 @@ +@@ -198,8 +248,19 @@ DedicatedServer.LOGGER.info("Starting remote control listener"); - this.m = new RemoteControlListener(this); - this.m.a(); + this.n = new RemoteControlListener(this); + this.n.a(); + this.remoteConsole = new org.bukkit.craftbukkit.command.CraftRemoteConsoleCommandSender(); // CraftBukkit -+ } -+ + } + + // CraftBukkit start + if (this.server.getBukkitSpawnRadius() > -1) { + DedicatedServer.LOGGER.info("'settings.spawn-radius' in bukkit.yml has been moved to 'spawn-protection' in server.properties. I will move your config for you."); @@ -109,12 +137,13 @@ + this.propertyManager.getInt("spawn-protection", this.server.getBukkitSpawnRadius()); + this.server.removeBukkitSpawnRadius(); + this.propertyManager.savePropertiesFile(); - } ++ } + // CraftBukkit end ++ + if (this.aR() > 0L) { + Thread thread1 = new Thread(new ThreadWatchdog(this)); - if (this.aQ() > 0L) { - Thread thread = new Thread(new ThreadWatchdog(this)); -@@ -181,6 +228,12 @@ +@@ -213,6 +274,12 @@ } } @@ -124,29 +153,21 @@ + } + // CraftBukkit end + - public void setGamemode(EnumGamemode enumgamemode) { - super.setGamemode(enumgamemode); - this.q = enumgamemode; -@@ -203,6 +256,7 @@ + public void setGamemode(WorldSettings.EnumGamemode worldsettings_enumgamemode) { + super.setGamemode(worldsettings_enumgamemode); + this.r = worldsettings_enumgamemode; +@@ -265,7 +332,7 @@ + System.exit(0); } - protected void a(CrashReport crashreport) { -+ /* CraftBukkit start - not sure why you would want to continue running commands once the server crashed - while (this.isRunning()) { - this.aM(); - -@@ -212,7 +266,7 @@ - ; - } - } -- -+ // CraftBukkit end */ +- protected void A() { ++ public void A() { // CraftBukkit - fix decompile error + super.A(); + this.aN(); } - - public CrashReport b(CrashReport crashreport) { -@@ -257,7 +311,14 @@ - while (!this.k.isEmpty()) { - ServerCommand servercommand = (ServerCommand) this.k.remove(0); +@@ -296,7 +363,14 @@ + while (!this.l.isEmpty()) { + ServerCommand servercommand = (ServerCommand) this.l.remove(0); - this.getCommandHandler().a(servercommand.source, servercommand.command); + // CraftBukkit start - ServerCommand for preprocessing @@ -160,3 +181,67 @@ } } +@@ -487,13 +561,57 @@ + } + + public String getPlugins() { +- return ""; +- } ++ // CraftBukkit start - Whole method ++ StringBuilder result = new StringBuilder(); ++ org.bukkit.plugin.Plugin[] plugins = server.getPluginManager().getPlugins(); ++ ++ result.append(server.getName()); ++ result.append(" on Bukkit "); ++ result.append(server.getBukkitVersion()); ++ ++ if (plugins.length > 0 && server.getQueryPlugins()) { ++ result.append(": "); ++ ++ for (int i = 0; i < plugins.length; i++) { ++ if (i > 0) { ++ result.append("; "); ++ } + +- public String executeRemoteCommand(String s) { +- RemoteControlCommandListener.getInstance().i(); +- this.b.a(RemoteControlCommandListener.getInstance(), s); +- return RemoteControlCommandListener.getInstance().j(); ++ result.append(plugins[i].getDescription().getName()); ++ result.append(" "); ++ result.append(plugins[i].getDescription().getVersion().replaceAll(";", ",")); ++ } ++ } ++ ++ return result.toString(); ++ // CraftBukkit end ++ } ++ ++ // CraftBukkit start - fire RemoteServerCommandEvent ++ public String executeRemoteCommand(final String s) { ++ Waitable waitable = new Waitable() { ++ @Override ++ protected String evaluate() { ++ RemoteControlCommandListener.getInstance().i(); ++ // Event changes start ++ RemoteServerCommandEvent event = new RemoteServerCommandEvent(remoteConsole, s); ++ server.getPluginManager().callEvent(event); ++ // Event change end ++ ServerCommand serverCommand = new ServerCommand(event.getCommand(), RemoteControlCommandListener.getInstance()); ++ server.dispatchServerCommand(remoteConsole, serverCommand); ++ return RemoteControlCommandListener.getInstance().j(); ++ } ++ }; ++ processQueue.add(waitable); ++ try { ++ return waitable.get(); ++ } catch (java.util.concurrent.ExecutionException e) { ++ throw new RuntimeException("Exception processing rcon command " + s, e.getCause()); ++ } catch (InterruptedException e) { ++ Thread.currentThread().interrupt(); // Maintain interrupted state ++ throw new RuntimeException("Interrupted processing rcon command " + s, e); ++ } ++ // CraftBukkit end + } + + public PlayerList getPlayerList() { diff --git a/nms-patches/DispenseBehaviorArmor.patch b/nms-patches/DispenseBehaviorArmor.patch deleted file mode 100644 index 55803c99c3..0000000000 --- a/nms-patches/DispenseBehaviorArmor.patch +++ /dev/null @@ -1,59 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorArmor.java 2014-11-28 17:43:43.033707436 +0000 -+++ src/main/java/net/minecraft/server/DispenseBehaviorArmor.java 2014-11-28 17:38:17.000000000 +0000 -@@ -3,6 +3,11 @@ - import com.google.common.base.Predicates; - import java.util.List; - -+// CraftBukkit start -+import org.bukkit.craftbukkit.inventory.CraftItemStack; -+import org.bukkit.event.block.BlockDispenseEvent; -+// CraftBukkit end -+ - final class DispenseBehaviorArmor extends DispenseBehaviorItem { - - DispenseBehaviorArmor() {} -@@ -19,15 +24,42 @@ - EntityLiving entityliving = (EntityLiving) list.get(0); - int l = entityliving instanceof EntityHuman ? 1 : 0; - int i1 = EntityInsentient.c(itemstack); -- ItemStack itemstack1 = itemstack.cloneItemStack(); -+ -+ // CraftBukkit start -+ ItemStack itemstack1 = itemstack.a(1); -+ World world = isourceblock.i(); -+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); -+ -+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); -+ if (!BlockDispenser.eventFired) { -+ world.getServer().getPluginManager().callEvent(event); -+ } - -+ if (event.isCancelled()) { -+ itemstack.count++; -+ return itemstack; -+ } -+ -+ if (!event.getItem().equals(craftItem)) { -+ itemstack.count++; -+ // Chain to handler for new item -+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem()); -+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { -+ idispensebehavior.a(isourceblock, eventStack); -+ return itemstack; -+ } -+ } -+ // CraftBukkit end -+ - itemstack1.count = 1; - entityliving.setEquipment(i1 - l, itemstack1); - if (entityliving instanceof EntityInsentient) { - ((EntityInsentient) entityliving).a(i1, 2.0F); - } - -- --itemstack.count; -+ // --itemstack.count; // CraftBukkit - handled above - return itemstack; - } else { - return super.b(isourceblock, itemstack); diff --git a/nms-patches/DispenseBehaviorBoat.patch b/nms-patches/DispenseBehaviorBoat.patch deleted file mode 100644 index d8ffdbe1df..0000000000 --- a/nms-patches/DispenseBehaviorBoat.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorBoat.java 2014-11-28 17:43:43.037707436 +0000 -+++ src/main/java/net/minecraft/server/DispenseBehaviorBoat.java 2014-11-28 17:38:18.000000000 +0000 -@@ -1,5 +1,10 @@ - package net.minecraft.server; - -+// CraftBukkit start -+import org.bukkit.craftbukkit.inventory.CraftItemStack; -+import org.bukkit.event.block.BlockDispenseEvent; -+// CraftBukkit end -+ - final class DispenseBehaviorBoat extends DispenseBehaviorItem { - - private final DispenseBehaviorItem b = new DispenseBehaviorItem(); -@@ -26,10 +31,38 @@ - d3 = 0.0D; - } - -- EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2); -+ // EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2); -+ // CraftBukkit start -+ ItemStack itemstack1 = itemstack.a(1); -+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); -+ -+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2)); -+ if (!BlockDispenser.eventFired) { -+ world.getServer().getPluginManager().callEvent(event); -+ } -+ -+ if (event.isCancelled()) { -+ itemstack.count++; -+ return itemstack; -+ } -+ -+ if (!event.getItem().equals(craftItem)) { -+ itemstack.count++; -+ // Chain to handler for new item -+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem()); -+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { -+ idispensebehavior.a(isourceblock, eventStack); -+ return itemstack; -+ } -+ } -+ -+ EntityBoat entityboat = new EntityBoat(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ()); -+ // CraftBukkit end - - world.addEntity(entityboat); -- itemstack.a(1); -+ // itemstack.a(1); // CraftBukkit - handled during event processing - return itemstack; - } - diff --git a/nms-patches/DispenseBehaviorBonemeal.patch b/nms-patches/DispenseBehaviorBonemeal.patch deleted file mode 100644 index 2eb139f0b3..0000000000 --- a/nms-patches/DispenseBehaviorBonemeal.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorBonemeal.java 2014-11-28 17:43:43.037707436 +0000 -+++ src/main/java/net/minecraft/server/DispenseBehaviorBonemeal.java 2014-11-28 17:38:23.000000000 +0000 -@@ -1,5 +1,10 @@ - package net.minecraft.server; - -+// CraftBukkit start -+import org.bukkit.craftbukkit.inventory.CraftItemStack; -+import org.bukkit.event.block.BlockDispenseEvent; -+// CraftBukkit end -+ - final class DispenseBehaviorBonemeal extends DispenseBehaviorItem { - - private boolean b = true; -@@ -10,6 +15,30 @@ - if (EnumColor.WHITE == EnumColor.fromInvColorIndex(itemstack.getData())) { - World world = isourceblock.i(); - BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); -+ -+ // CraftBukkit start -+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); -+ CraftItemStack craftItem = CraftItemStack.asNewCraftStack(itemstack.getItem()); -+ -+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); -+ if (!BlockDispenser.eventFired) { -+ world.getServer().getPluginManager().callEvent(event); -+ } -+ -+ if (event.isCancelled()) { -+ return itemstack; -+ } -+ -+ if (!event.getItem().equals(craftItem)) { -+ // Chain to handler for new item -+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem()); -+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { -+ idispensebehavior.a(isourceblock, eventStack); -+ return itemstack; -+ } -+ } -+ // CraftBukkit end - - if (ItemDye.a(itemstack, world, blockposition)) { - if (!world.isStatic) { diff --git a/nms-patches/DispenseBehaviorCommandBlock.patch b/nms-patches/DispenseBehaviorCommandBlock.patch deleted file mode 100644 index 479f59864f..0000000000 --- a/nms-patches/DispenseBehaviorCommandBlock.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorCommandBlock.java 2014-12-27 14:19:29.609280038 +0000 -+++ src/main/java/net/minecraft/server/DispenseBehaviorCommandBlock.java 2014-12-27 14:19:29.609280038 +0000 -@@ -8,7 +8,7 @@ - World world = isourceblock.i(); - BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); - -- if (world.isEmpty(blockposition)) { -+ if (world.isEmpty(blockposition) && false) { // Craftbukkit - yeah... no - if (!world.isStatic) { - IBlockData iblockdata = Blocks.COMMAND_BLOCK.getBlockData().set(BlockCommand.TRIGGERED, Boolean.valueOf(false)); - diff --git a/nms-patches/DispenseBehaviorEmptyBucket.patch b/nms-patches/DispenseBehaviorEmptyBucket.patch deleted file mode 100644 index 941873b56b..0000000000 --- a/nms-patches/DispenseBehaviorEmptyBucket.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorEmptyBucket.java 2014-11-28 17:43:43.041707436 +0000 -+++ src/main/java/net/minecraft/server/DispenseBehaviorEmptyBucket.java 2014-11-28 17:38:18.000000000 +0000 -@@ -1,5 +1,10 @@ - package net.minecraft.server; - -+// CraftBukkit start -+import org.bukkit.craftbukkit.inventory.CraftItemStack; -+import org.bukkit.event.block.BlockDispenseEvent; -+// CraftBukkit end -+ - final class DispenseBehaviorEmptyBucket extends DispenseBehaviorItem { - - private final DispenseBehaviorItem b = new DispenseBehaviorItem(); -@@ -23,6 +28,30 @@ - - item = Items.LAVA_BUCKET; - } -+ -+ // CraftBukkit start -+ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); -+ -+ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); -+ if (!BlockDispenser.eventFired) { -+ world.getServer().getPluginManager().callEvent(event); -+ } -+ -+ if (event.isCancelled()) { -+ return itemstack; -+ } -+ -+ if (!event.getItem().equals(craftItem)) { -+ // Chain to handler for new item -+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem()); -+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { -+ idispensebehavior.a(isourceblock, eventStack); -+ return itemstack; -+ } -+ } -+ // CraftBukkit end - - world.setAir(blockposition); - if (--itemstack.count == 0) { diff --git a/nms-patches/DispenseBehaviorFilledBucket.patch b/nms-patches/DispenseBehaviorFilledBucket.patch deleted file mode 100644 index 4fb80b2a03..0000000000 --- a/nms-patches/DispenseBehaviorFilledBucket.patch +++ /dev/null @@ -1,65 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorFilledBucket.java 2014-11-28 17:43:43.041707436 +0000 -+++ src/main/java/net/minecraft/server/DispenseBehaviorFilledBucket.java 2014-11-28 17:38:22.000000000 +0000 -@@ -1,5 +1,10 @@ - package net.minecraft.server; - -+// CraftBukkit start -+import org.bukkit.craftbukkit.inventory.CraftItemStack; -+import org.bukkit.event.block.BlockDispenseEvent; -+// CraftBukkit end -+ - final class DispenseBehaviorFilledBucket extends DispenseBehaviorItem { - - private final DispenseBehaviorItem b = new DispenseBehaviorItem(); -@@ -9,10 +14,49 @@ - public ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) { - ItemBucket itembucket = (ItemBucket) itemstack.getItem(); - BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); -+ -+ // CraftBukkit start -+ World world = isourceblock.i(); -+ int x = blockposition.getX(); -+ int y = blockposition.getY(); -+ int z = blockposition.getZ(); -+ if (world.isEmpty(blockposition) || !world.getType(blockposition).getBlock().getMaterial().isBuildable()) { -+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); -+ -+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(x, y, z)); -+ if (!BlockDispenser.eventFired) { -+ world.getServer().getPluginManager().callEvent(event); -+ } -+ -+ if (event.isCancelled()) { -+ return itemstack; -+ } -+ -+ if (!event.getItem().equals(craftItem)) { -+ // Chain to handler for new item -+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem()); -+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { -+ idispensebehavior.a(isourceblock, eventStack); -+ return itemstack; -+ } -+ } -+ -+ itembucket = (ItemBucket) CraftItemStack.asNMSCopy(event.getItem()).getItem(); -+ } -+ // CraftBukkit end - - if (itembucket.a(isourceblock.i(), blockposition)) { -- itemstack.setItem(Items.BUCKET); -- itemstack.count = 1; -+ // CraftBukkit start - Handle stacked buckets -+ Item item = Items.BUCKET; -+ if (--itemstack.count == 0) { -+ itemstack.setItem(Items.BUCKET); -+ itemstack.count = 1; -+ } else if (((TileEntityDispenser) isourceblock.getTileEntity()).addItem(new ItemStack(item)) < 0) { -+ this.b.a(isourceblock, new ItemStack(item)); -+ } -+ // CraftBukkit end - return itemstack; - } else { - return this.b.a(isourceblock, itemstack); diff --git a/nms-patches/DispenseBehaviorFireball.patch b/nms-patches/DispenseBehaviorFireball.patch deleted file mode 100644 index 1f6a692533..0000000000 --- a/nms-patches/DispenseBehaviorFireball.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorFireball.java 2014-11-28 17:43:43.045707436 +0000 -+++ src/main/java/net/minecraft/server/DispenseBehaviorFireball.java 2014-11-28 17:38:20.000000000 +0000 -@@ -2,6 +2,11 @@ - - import java.util.Random; - -+// CraftBukkit start -+import org.bukkit.craftbukkit.inventory.CraftItemStack; -+import org.bukkit.event.block.BlockDispenseEvent; -+// CraftBukkit end -+ - final class DispenseBehaviorFireball extends DispenseBehaviorItem { - - DispenseBehaviorFireball() {} -@@ -18,8 +23,38 @@ - double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentY(); - double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentZ(); - -- world.addEntity(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5)); -- itemstack.a(1); -+ // CraftBukkit start -+ ItemStack itemstack1 = itemstack.a(1); -+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); -+ -+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d3, d4, d5)); -+ if (!BlockDispenser.eventFired) { -+ world.getServer().getPluginManager().callEvent(event); -+ } -+ -+ if (event.isCancelled()) { -+ itemstack.count++; -+ return itemstack; -+ } -+ -+ if (!event.getItem().equals(craftItem)) { -+ itemstack.count++; -+ // Chain to handler for new item -+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem()); -+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { -+ idispensebehavior.a(isourceblock, eventStack); -+ return itemstack; -+ } -+ } -+ -+ EntitySmallFireball entitysmallfireball = new EntitySmallFireball(world, d0, d1, d2, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ()); -+ entitysmallfireball.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) isourceblock.getTileEntity()); -+ -+ world.addEntity(entitysmallfireball); -+ // itemstack.a(1); // Handled during event processing -+ // CraftBukkit end - return itemstack; - } - diff --git a/nms-patches/DispenseBehaviorFireworks.patch b/nms-patches/DispenseBehaviorFireworks.patch deleted file mode 100644 index b4896bbbc8..0000000000 --- a/nms-patches/DispenseBehaviorFireworks.patch +++ /dev/null @@ -1,52 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorFireworks.java Sat Dec 6 21:12:00 2014 -+++ src/main/java/net/minecraft/server/DispenseBehaviorFireworks.java Sat Dec 6 21:11:47 2014 -@@ -1,5 +1,8 @@ - package net.minecraft.server; - -+import org.bukkit.craftbukkit.inventory.CraftItemStack; -+import org.bukkit.event.block.BlockDispenseEvent; -+ - final class DispenseBehaviorFireworks extends DispenseBehaviorItem { - - DispenseBehaviorFireworks() {} -@@ -9,10 +12,38 @@ - double d0 = isourceblock.getX() + (double) enumdirection.getAdjacentX(); - double d1 = (double) ((float) isourceblock.getBlockPosition().getY() + 0.2F); - double d2 = isourceblock.getZ() + (double) enumdirection.getAdjacentZ(); -- EntityFireworks entityfireworks = new EntityFireworks(isourceblock.i(), d0, d1, d2, itemstack); - -+ // CraftBukkit start -+ World world = isourceblock.i(); -+ ItemStack itemstack1 = itemstack.a(1); -+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); -+ -+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1, d2)); -+ if (!BlockDispenser.eventFired) { -+ world.getServer().getPluginManager().callEvent(event); -+ } -+ -+ if (event.isCancelled()) { -+ itemstack.count++; -+ return itemstack; -+ } -+ -+ if (!event.getItem().equals(craftItem)) { -+ itemstack.count++; -+ // Chain to handler for new item -+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem()); -+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { -+ idispensebehavior.a(isourceblock, eventStack); -+ return itemstack; -+ } -+ } -+ -+ EntityFireworks entityfireworks = new EntityFireworks(isourceblock.i(), d0, d1, d2, itemstack); - isourceblock.i().addEntity(entityfireworks); -- itemstack.a(1); -+ // itemstack.a(1); // Handled during event processing -+ // CraftBukkit end - return itemstack; - } - diff --git a/nms-patches/DispenseBehaviorFlintAndSteel.patch b/nms-patches/DispenseBehaviorFlintAndSteel.patch deleted file mode 100644 index 4c3d490683..0000000000 --- a/nms-patches/DispenseBehaviorFlintAndSteel.patch +++ /dev/null @@ -1,57 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorFlintAndSteel.java 2014-11-28 17:43:43.045707436 +0000 -+++ src/main/java/net/minecraft/server/DispenseBehaviorFlintAndSteel.java 2014-11-28 17:38:23.000000000 +0000 -@@ -1,5 +1,10 @@ - package net.minecraft.server; - -+// CraftBukkit start -+import org.bukkit.craftbukkit.inventory.CraftItemStack; -+import org.bukkit.event.block.BlockDispenseEvent; -+// CraftBukkit end -+ - final class DispenseBehaviorFlintAndSteel extends DispenseBehaviorItem { - - private boolean b = true; -@@ -10,11 +15,39 @@ - World world = isourceblock.i(); - BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); - -- if (world.isEmpty(blockposition)) { -- world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); -- if (itemstack.isDamaged(1, world.random)) { -- itemstack.count = 0; -+ // CraftBukkit start -+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); -+ -+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); -+ if (!BlockDispenser.eventFired) { -+ world.getServer().getPluginManager().callEvent(event); -+ } -+ -+ if (event.isCancelled()) { -+ return itemstack; -+ } -+ -+ if (!event.getItem().equals(craftItem)) { -+ // Chain to handler for new item -+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem()); -+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { -+ idispensebehavior.a(isourceblock, eventStack); -+ return itemstack; -+ } -+ } -+ // CraftBukkit end -+ -+ if (world.isEmpty(blockposition)) { -+ // CraftBukkit start - Ignition by dispensing flint and steel -+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()).isCancelled()) { -+ world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); -+ if (itemstack.isDamaged(1, world.random)) { -+ itemstack.count = 0; -+ } - } -+ // CraftBukkit end - } else if (world.getType(blockposition).getBlock() == Blocks.TNT) { - Blocks.TNT.postBreak(world, blockposition, Blocks.TNT.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf(true))); - world.setAir(blockposition); diff --git a/nms-patches/DispenseBehaviorItem.patch b/nms-patches/DispenseBehaviorItem.patch index 7c3cb06db8..cbcc56bab6 100644 --- a/nms-patches/DispenseBehaviorItem.patch +++ b/nms-patches/DispenseBehaviorItem.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorItem.java 2015-01-04 20:42:23.769644196 +0000 -+++ src/main/java/net/minecraft/server/DispenseBehaviorItem.java 2015-01-04 20:42:23.769644196 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/DispenseBehaviorItem.java 2015-02-26 22:40:22.447608141 +0000 ++++ src/main/java/net/minecraft/server/DispenseBehaviorItem.java 2015-02-26 22:40:22.447608141 +0000 @@ -1,5 +1,10 @@ package net.minecraft.server; @@ -58,7 +58,7 @@ + if (!event.getItem().getType().equals(craftItem.getType())) { + // Chain to handler for new item + ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem()); ++ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.N.get(eventStack.getItem()); + if (idispensebehavior != IDispenseBehavior.a && idispensebehavior.getClass() != DispenseBehaviorItem.class) { + idispensebehavior.a(isourceblock, eventStack); + } else { @@ -68,7 +68,7 @@ + } + world.addEntity(entityitem); -+ ++ + return true; + // CraftBukkit end } diff --git a/nms-patches/DispenseBehaviorMinecart.patch b/nms-patches/DispenseBehaviorMinecart.patch deleted file mode 100644 index 286a85cbb3..0000000000 --- a/nms-patches/DispenseBehaviorMinecart.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorMinecart.java 2014-11-28 17:43:43.049707436 +0000 -+++ src/main/java/net/minecraft/server/DispenseBehaviorMinecart.java 2014-11-28 17:38:22.000000000 +0000 -@@ -1,5 +1,10 @@ - package net.minecraft.server; - -+// CraftBukkit start -+import org.bukkit.craftbukkit.inventory.CraftItemStack; -+import org.bukkit.event.block.BlockDispenseEvent; -+// CraftBukkit end -+ - final class DispenseBehaviorMinecart extends DispenseBehaviorItem { - - private final DispenseBehaviorItem b = new DispenseBehaviorItem(); -@@ -38,14 +43,42 @@ - } - } - -- EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, d0, d1 + d3, d2, ItemMinecart.a((ItemMinecart) itemstack.getItem())); -+ // CraftBukkit start -+ // EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, d0, d1 + d3, d2, ItemMinecart.a((ItemMinecart) itemstack.getItem())); -+ ItemStack itemstack1 = itemstack.a(1); -+ org.bukkit.block.Block block2 = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); -+ -+ BlockDispenseEvent event = new BlockDispenseEvent(block2, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2)); -+ if (!BlockDispenser.eventFired) { -+ world.getServer().getPluginManager().callEvent(event); -+ } -+ -+ if (event.isCancelled()) { -+ itemstack.count++; -+ return itemstack; -+ } -+ -+ if (!event.getItem().equals(craftItem)) { -+ itemstack.count++; -+ // Chain to handler for new item -+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem()); -+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { -+ idispensebehavior.a(isourceblock, eventStack); -+ return itemstack; -+ } -+ } -+ -+ itemstack1 = CraftItemStack.asNMSCopy(event.getItem()); -+ EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), ItemMinecart.a((ItemMinecart) itemstack1.getItem())); - - if (itemstack.hasName()) { - entityminecartabstract.setCustomName(itemstack.getName()); - } - - world.addEntity(entityminecartabstract); -- itemstack.a(1); -+ // itemstack.a(1); // CraftBukkit - handled during event processing - return itemstack; - } - diff --git a/nms-patches/DispenseBehaviorMonsterEgg.patch b/nms-patches/DispenseBehaviorMonsterEgg.patch deleted file mode 100644 index 185605af51..0000000000 --- a/nms-patches/DispenseBehaviorMonsterEgg.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorMonsterEgg.java 2014-11-28 17:43:43.053707436 +0000 -+++ src/main/java/net/minecraft/server/DispenseBehaviorMonsterEgg.java 2014-11-28 17:38:22.000000000 +0000 -@@ -1,5 +1,10 @@ - package net.minecraft.server; - -+// CraftBukkit start -+import org.bukkit.craftbukkit.inventory.CraftItemStack; -+import org.bukkit.event.block.BlockDispenseEvent; -+// CraftBukkit end -+ - final class DispenseBehaviorMonsterEgg extends DispenseBehaviorItem { - - DispenseBehaviorMonsterEgg() {} -@@ -9,13 +14,45 @@ - double d0 = isourceblock.getX() + (double) enumdirection.getAdjacentX(); - double d1 = (double) ((float) isourceblock.getBlockPosition().getY() + 0.2F); - double d2 = isourceblock.getZ() + (double) enumdirection.getAdjacentZ(); -- Entity entity = ItemMonsterEgg.a(isourceblock.i(), itemstack.getData(), d0, d1, d2); -+ // Entity entity = ItemMonsterEgg.a(isourceblock.i(), itemstack.getData(), d0, d1, d2); -+ -+ // CraftBukkit start -+ World world = isourceblock.i(); -+ ItemStack itemstack1 = itemstack.a(1); -+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); -+ -+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1, d2)); -+ if (!BlockDispenser.eventFired) { -+ world.getServer().getPluginManager().callEvent(event); -+ } -+ -+ if (event.isCancelled()) { -+ itemstack.count++; -+ return itemstack; -+ } -+ -+ if (!event.getItem().equals(craftItem)) { -+ itemstack.count++; -+ // Chain to handler for new item -+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem()); -+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { -+ idispensebehavior.a(isourceblock, eventStack); -+ return itemstack; -+ } -+ } -+ -+ itemstack1 = CraftItemStack.asNMSCopy(event.getItem()); -+ -+ Entity entity = ItemMonsterEgg.spawnCreature(isourceblock.i(), itemstack.getData(), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DISPENSE_EGG); - - if (entity instanceof EntityLiving && itemstack.hasName()) { - ((EntityInsentient) entity).setCustomName(itemstack.getName()); - } - -- itemstack.a(1); -+ // itemstack.a(1); // Handled during event processing -+ // CraftBukkit end - return itemstack; - } - } diff --git a/nms-patches/DispenseBehaviorProjectile.patch b/nms-patches/DispenseBehaviorProjectile.patch index 4f78ee86ad..6aab08dd16 100644 --- a/nms-patches/DispenseBehaviorProjectile.patch +++ b/nms-patches/DispenseBehaviorProjectile.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorProjectile.java 2014-11-28 17:43:43.053707436 +0000 -+++ src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/DispenseBehaviorProjectile.java 2015-02-26 22:40:22.447608141 +0000 ++++ src/main/java/net/minecraft/server/DispenseBehaviorProjectile.java 2015-02-26 22:40:22.451608141 +0000 @@ -1,5 +1,10 @@ package net.minecraft.server; @@ -36,7 +36,7 @@ + itemstack.count++; + // Chain to handler for new item + ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem()); ++ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.N.get(eventStack.getItem()); + if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { + idispensebehavior.a(isourceblock, eventStack); + return itemstack; diff --git a/nms-patches/DispenseBehaviorTNT.patch b/nms-patches/DispenseBehaviorTNT.patch deleted file mode 100644 index 6ff61d4d96..0000000000 --- a/nms-patches/DispenseBehaviorTNT.patch +++ /dev/null @@ -1,56 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/DispenseBehaviorTNT.java 2014-11-28 17:43:43.057707436 +0000 -+++ src/main/java/net/minecraft/server/DispenseBehaviorTNT.java 2014-11-28 17:38:23.000000000 +0000 -@@ -1,5 +1,10 @@ - package net.minecraft.server; - -+// CraftBukkit start -+import org.bukkit.craftbukkit.inventory.CraftItemStack; -+import org.bukkit.event.block.BlockDispenseEvent; -+// CraftBukkit end -+ - final class DispenseBehaviorTNT extends DispenseBehaviorItem { - - DispenseBehaviorTNT() {} -@@ -7,11 +12,40 @@ - protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) { - World world = isourceblock.i(); - BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); -- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null); -+ // EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null); -+ -+ // CraftBukkit start -+ ItemStack itemstack1 = itemstack.a(1); -+ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); -+ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); -+ -+ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX() + 0.5, blockposition.getY() + 0.5, blockposition.getZ() + 0.5)); -+ if (!BlockDispenser.eventFired) { -+ world.getServer().getPluginManager().callEvent(event); -+ } -+ -+ if (event.isCancelled()) { -+ itemstack.count++; -+ return itemstack; -+ } -+ -+ if (!event.getItem().equals(craftItem)) { -+ itemstack.count++; -+ // Chain to handler for new item -+ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); -+ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.M.get(eventStack.getItem()); -+ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { -+ idispensebehavior.a(isourceblock, eventStack); -+ return itemstack; -+ } -+ } -+ -+ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), (EntityLiving) null); -+ // CraftBukkit end - - world.addEntity(entitytntprimed); - world.makeSound(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F); -- --itemstack.count; -+ // --itemstack.count; // CraftBukkit - handled above - return itemstack; - } - } diff --git a/nms-patches/DispenserRegistry.patch b/nms-patches/DispenserRegistry.patch new file mode 100644 index 0000000000..25a7b87b9c --- /dev/null +++ b/nms-patches/DispenserRegistry.patch @@ -0,0 +1,392 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/DispenserRegistry.java 2015-02-26 22:40:22.451608141 +0000 ++++ src/main/java/net/minecraft/server/DispenserRegistry.java 2015-02-26 22:40:22.455608141 +0000 +@@ -7,6 +7,11 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + ++// CraftBukkit start ++import org.bukkit.craftbukkit.inventory.CraftItemStack; ++import org.bukkit.event.block.BlockDispenseEvent; ++// CraftBukkit end ++ + public class DispenserRegistry { + + private static final PrintStream a = System.out; +@@ -74,13 +79,45 @@ + double d0 = isourceblock.getX() + (double) enumdirection.getAdjacentX(); + double d1 = (double) ((float) isourceblock.getBlockPosition().getY() + 0.2F); + double d2 = isourceblock.getZ() + (double) enumdirection.getAdjacentZ(); +- Entity entity = ItemMonsterEgg.a(isourceblock.i(), itemstack.getData(), d0, d1, d2); ++ // Entity entity = ItemMonsterEgg.a(isourceblock.i(), itemstack.getData(), d0, d1, d2); ++ ++ // CraftBukkit start ++ World world = isourceblock.i(); ++ ItemStack itemstack1 = itemstack.a(1); ++ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); ++ ++ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1, d2)); ++ if (!BlockDispenser.eventFired) { ++ world.getServer().getPluginManager().callEvent(event); ++ } ++ ++ if (event.isCancelled()) { ++ itemstack.count++; ++ return itemstack; ++ } ++ ++ if (!event.getItem().equals(craftItem)) { ++ itemstack.count++; ++ // Chain to handler for new item ++ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ++ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.N.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { ++ idispensebehavior.a(isourceblock, eventStack); ++ return itemstack; ++ } ++ } ++ ++ itemstack1 = CraftItemStack.asNMSCopy(event.getItem()); ++ ++ Entity entity = ItemMonsterEgg.spawnCreature(isourceblock.i(), itemstack.getData(), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.DISPENSE_EGG); + + if (entity instanceof EntityLiving && itemstack.hasName()) { + ((EntityInsentient) entity).setCustomName(itemstack.getName()); + } + +- itemstack.a(1); ++ // itemstack.a(1); // Handled during event processing ++ // CraftBukkit end + return itemstack; + } + }); +@@ -90,10 +127,38 @@ + double d0 = isourceblock.getX() + (double) enumdirection.getAdjacentX(); + double d1 = (double) ((float) isourceblock.getBlockPosition().getY() + 0.2F); + double d2 = isourceblock.getZ() + (double) enumdirection.getAdjacentZ(); ++ // CraftBukkit start ++ World world = isourceblock.i(); ++ ItemStack itemstack1 = itemstack.a(1); ++ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); ++ ++ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1, d2)); ++ if (!BlockDispenser.eventFired) { ++ world.getServer().getPluginManager().callEvent(event); ++ } ++ ++ if (event.isCancelled()) { ++ itemstack.count++; ++ return itemstack; ++ } ++ ++ if (!event.getItem().equals(craftItem)) { ++ itemstack.count++; ++ // Chain to handler for new item ++ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ++ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.N.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { ++ idispensebehavior.a(isourceblock, eventStack); ++ return itemstack; ++ } ++ } ++ + EntityFireworks entityfireworks = new EntityFireworks(isourceblock.i(), d0, d1, d2, itemstack); + + isourceblock.i().addEntity(entityfireworks); +- itemstack.a(1); ++ // itemstack.a(1); // Handled during event processing ++ // CraftBukkit end + return itemstack; + } + +@@ -114,8 +179,38 @@ + double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentY(); + double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentZ(); + +- world.addEntity(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5)); +- itemstack.a(1); ++ // CraftBukkit start ++ ItemStack itemstack1 = itemstack.a(1); ++ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); ++ ++ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d3, d4, d5)); ++ if (!BlockDispenser.eventFired) { ++ world.getServer().getPluginManager().callEvent(event); ++ } ++ ++ if (event.isCancelled()) { ++ itemstack.count++; ++ return itemstack; ++ } ++ ++ if (!event.getItem().equals(craftItem)) { ++ itemstack.count++; ++ // Chain to handler for new item ++ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ++ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.N.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { ++ idispensebehavior.a(isourceblock, eventStack); ++ return itemstack; ++ } ++ } ++ ++ EntitySmallFireball entitysmallfireball = new EntitySmallFireball(world, d0, d1, d2, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ()); ++ entitysmallfireball.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) isourceblock.getTileEntity()); ++ ++ world.addEntity(entitysmallfireball); ++ // itemstack.a(1); // Handled during event processing ++ // CraftBukkit end + return itemstack; + } + +@@ -146,10 +241,38 @@ + d3 = 0.0D; + } + +- EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2); ++ // EntityBoat entityboat = new EntityBoat(world, d0, d1 + d3, d2); ++ // CraftBukkit start ++ ItemStack itemstack1 = itemstack.a(1); ++ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); ++ ++ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2)); ++ if (!BlockDispenser.eventFired) { ++ world.getServer().getPluginManager().callEvent(event); ++ } ++ ++ if (event.isCancelled()) { ++ itemstack.count++; ++ return itemstack; ++ } ++ ++ if (!event.getItem().equals(craftItem)) { ++ itemstack.count++; ++ // Chain to handler for new item ++ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ++ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.N.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { ++ idispensebehavior.a(isourceblock, eventStack); ++ return itemstack; ++ } ++ } ++ ++ EntityBoat entityboat = new EntityBoat(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ()); ++ // CraftBukkit end + + world.addEntity(entityboat); +- itemstack.a(1); ++ // itemstack.a(1); // CraftBukkit - handled during event processing + return itemstack; + } + +@@ -164,9 +287,48 @@ + ItemBucket itembucket = (ItemBucket) itemstack.getItem(); + BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); + ++ // CraftBukkit start ++ World world = isourceblock.i(); ++ int x = blockposition.getX(); ++ int y = blockposition.getY(); ++ int z = blockposition.getZ(); ++ if (world.isEmpty(blockposition) || !world.getType(blockposition).getBlock().getMaterial().isBuildable()) { ++ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); ++ ++ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(x, y, z)); ++ if (!BlockDispenser.eventFired) { ++ world.getServer().getPluginManager().callEvent(event); ++ } ++ ++ if (event.isCancelled()) { ++ return itemstack; ++ } ++ ++ if (!event.getItem().equals(craftItem)) { ++ // Chain to handler for new item ++ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ++ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.N.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { ++ idispensebehavior.a(isourceblock, eventStack); ++ return itemstack; ++ } ++ } ++ ++ itembucket = (ItemBucket) CraftItemStack.asNMSCopy(event.getItem()).getItem(); ++ } ++ // CraftBukkit end ++ + if (itembucket.a(isourceblock.i(), blockposition)) { +- itemstack.setItem(Items.BUCKET); +- itemstack.count = 1; ++ // CraftBukkit start - Handle stacked buckets ++ Item item = Items.BUCKET; ++ if (--itemstack.count == 0) { ++ itemstack.setItem(Items.BUCKET); ++ itemstack.count = 1; ++ } else if (((TileEntityDispenser) isourceblock.getTileEntity()).addItem(new ItemStack(item)) < 0) { ++ this.b.a(isourceblock, new ItemStack(item)); ++ } ++ // CraftBukkit end + return itemstack; + } else { + return this.b.a(isourceblock, itemstack); +@@ -197,6 +359,30 @@ + item = Items.LAVA_BUCKET; + } + ++ // CraftBukkit start ++ org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); ++ ++ BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); ++ if (!BlockDispenser.eventFired) { ++ world.getServer().getPluginManager().callEvent(event); ++ } ++ ++ if (event.isCancelled()) { ++ return itemstack; ++ } ++ ++ if (!event.getItem().equals(craftItem)) { ++ // Chain to handler for new item ++ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ++ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.N.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { ++ idispensebehavior.a(isourceblock, eventStack); ++ return itemstack; ++ } ++ } ++ // CraftBukkit end ++ + world.setAir(blockposition); + if (--itemstack.count == 0) { + itemstack.setItem(item); +@@ -215,11 +401,39 @@ + World world = isourceblock.i(); + BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); + ++ // CraftBukkit start ++ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); ++ ++ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); ++ if (!BlockDispenser.eventFired) { ++ world.getServer().getPluginManager().callEvent(event); ++ } ++ ++ if (event.isCancelled()) { ++ return itemstack; ++ } ++ ++ if (!event.getItem().equals(craftItem)) { ++ // Chain to handler for new item ++ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ++ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.N.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { ++ idispensebehavior.a(isourceblock, eventStack); ++ return itemstack; ++ } ++ } ++ // CraftBukkit end ++ + if (world.isEmpty(blockposition)) { +- world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); +- if (itemstack.isDamaged(1, world.random)) { +- itemstack.count = 0; ++ // CraftBukkit start - Ignition by dispensing flint and steel ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()).isCancelled()) { ++ world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); ++ if (itemstack.isDamaged(1, world.random)) { ++ itemstack.count = 0; ++ } + } ++ // CraftBukkit end + } else if (world.getType(blockposition).getBlock() == Blocks.TNT) { + Blocks.TNT.postBreak(world, blockposition, Blocks.TNT.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf(true))); + world.setAir(blockposition); +@@ -247,6 +461,30 @@ + World world = isourceblock.i(); + BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); + ++ // CraftBukkit start ++ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); ++ CraftItemStack craftItem = CraftItemStack.asNewCraftStack(itemstack.getItem()); ++ ++ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); ++ if (!BlockDispenser.eventFired) { ++ world.getServer().getPluginManager().callEvent(event); ++ } ++ ++ if (event.isCancelled()) { ++ return itemstack; ++ } ++ ++ if (!event.getItem().equals(craftItem)) { ++ // Chain to handler for new item ++ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ++ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.N.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { ++ idispensebehavior.a(isourceblock, eventStack); ++ return itemstack; ++ } ++ } ++ // CraftBukkit end ++ + if (ItemDye.a(itemstack, world, blockposition)) { + if (!world.isClientSide) { + world.triggerEffect(2005, blockposition, 0); +@@ -274,11 +512,40 @@ + protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) { + World world = isourceblock.i(); + BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); +- EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null); ++ // EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, (EntityLiving) null); ++ ++ // CraftBukkit start ++ ItemStack itemstack1 = itemstack.a(1); ++ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); ++ ++ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX() + 0.5, blockposition.getY() + 0.5, blockposition.getZ() + 0.5)); ++ if (!BlockDispenser.eventFired) { ++ world.getServer().getPluginManager().callEvent(event); ++ } ++ ++ if (event.isCancelled()) { ++ itemstack.count++; ++ return itemstack; ++ } ++ ++ if (!event.getItem().equals(craftItem)) { ++ itemstack.count++; ++ // Chain to handler for new item ++ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ++ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.N.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { ++ idispensebehavior.a(isourceblock, eventStack); ++ return itemstack; ++ } ++ } ++ ++ EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), (EntityLiving) null); ++ // CraftBukkit end + + world.addEntity(entitytntprimed); + world.makeSound(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F); +- --itemstack.count; ++ // --itemstack.count; // CraftBukkit - handled above + return itemstack; + } + }); +@@ -372,7 +639,7 @@ + World world = isourceblock.i(); + BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); + +- if (world.isEmpty(blockposition)) { ++ if (world.isEmpty(blockposition) && false) { // Craftbukkit - yeah... no, TODO: see if its safe to readd + if (!world.isClientSide) { + IBlockData iblockdata = Blocks.COMMAND_BLOCK.getBlockData().set(BlockCommand.TRIGGERED, Boolean.valueOf(false)); + diff --git a/nms-patches/Enchantment.patch b/nms-patches/Enchantment.patch index 0229333924..b7d3f80f86 100644 --- a/nms-patches/Enchantment.patch +++ b/nms-patches/Enchantment.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/Enchantment.java 2014-11-28 17:43:43.057707436 +0000 -+++ src/main/java/net/minecraft/server/Enchantment.java 2014-11-28 17:38:20.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/Enchantment.java 2015-02-26 22:40:22.459608141 +0000 ++++ src/main/java/net/minecraft/server/Enchantment.java 2015-02-26 22:40:22.459608141 +0000 @@ -8,6 +8,7 @@ public abstract class Enchantment { @@ -7,12 +7,12 @@ + // CraftBukkit - update CraftEnchant.getName(i) if this changes private static final Enchantment[] byId = new Enchantment[256]; public static final Enchantment[] b; - private static final Map E = Maps.newHashMap(); + private static final Map E = Maps.newHashMap(); @@ -55,6 +56,8 @@ Enchantment.byId[i] = this; Enchantment.E.put(minecraftkey, this); } -+ ++ + org.bukkit.enchantments.Enchantment.registerEnchantment(new org.bukkit.craftbukkit.enchantments.CraftEnchantment(this)); // CraftBukkit } diff --git a/nms-patches/EnchantmentThorns.patch b/nms-patches/EnchantmentThorns.patch index 13386c7608..02c026a1ba 100644 --- a/nms-patches/EnchantmentThorns.patch +++ b/nms-patches/EnchantmentThorns.patch @@ -1,11 +1,11 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/EnchantmentThorns.java 2014-12-10 15:53:01.980344940 +1100 -+++ src/main/java/net/minecraft/server/EnchantmentThorns.java 2014-12-10 15:52:50.688364236 +1100 +--- /home/matt/mc-dev-private//net/minecraft/server/EnchantmentThorns.java 2015-02-26 22:40:22.463608141 +0000 ++++ src/main/java/net/minecraft/server/EnchantmentThorns.java 2015-02-26 22:40:22.463608141 +0000 @@ -29,7 +29,7 @@ - Random random = entityliving.bb(); + Random random = entityliving.bc(); ItemStack itemstack = EnchantmentManager.a(Enchantment.THORNS, entityliving); - if (a(i, random)) { + if (entity != null && a(i, random)) { // CraftBukkit - entity.damageEntity(DamageSource.a(entityliving), (float) b(i, random)); - entity.makeSound("damage.thorns", 0.5F, 1.0F); - if (itemstack != null) { + if (entity != null) { + entity.damageEntity(DamageSource.a(entityliving), (float) b(i, random)); + entity.makeSound("damage.thorns", 0.5F, 1.0F); diff --git a/nms-patches/Entity.patch b/nms-patches/Entity.patch index 36f8960af0..405164a2e0 100644 --- a/nms-patches/Entity.patch +++ b/nms-patches/Entity.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/Entity.java 2015-01-09 16:56:08.177542854 +1100 -+++ src/main/java/net/minecraft/server/Entity.java 2015-01-09 16:56:08.181542844 +1100 +--- /home/matt/mc-dev-private//net/minecraft/server/Entity.java 2015-02-26 22:40:22.595608139 +0000 ++++ src/main/java/net/minecraft/server/Entity.java 2015-02-26 22:40:22.599608139 +0000 @@ -6,8 +6,40 @@ import java.util.UUID; import java.util.concurrent.Callable; @@ -41,26 +41,34 @@ private static final AxisAlignedBB a = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D); private static int entityCount; private int id; -@@ -77,6 +109,8 @@ +@@ -55,7 +87,7 @@ + protected Random random; + public int ticksLived; + public int maxFireTicks; +- private int fireTicks; ++ public int fireTicks; // CraftBukkit - public + protected boolean inWater; + public int noDamageTicks; + protected boolean justCreated; +@@ -79,6 +111,8 @@ private boolean invulnerable; - public UUID uniqueID; - private final CommandObjectiveExecutor as; + protected UUID uniqueID; + private final CommandObjectiveExecutor au; + public boolean valid; // CraftBukkit + public org.bukkit.projectiles.ProjectileSource projectileSource; // CraftBukkit - For projectiles only public int getId() { return this.id; -@@ -135,7 +169,8 @@ +@@ -137,7 +171,7 @@ this.dead = true; } -- protected void a(float f, float f1) { -+ // PAIL: Access + rename please -+ public void a(float f, float f1) { // CraftBukkit - protected to public +- protected void setSize(float f, float f1) { ++ public void setSize(float f, float f1) { // CraftBukkit - public if (f != this.width || f1 != this.length) { float f2 = this.width; -@@ -150,6 +185,33 @@ +@@ -152,6 +186,33 @@ } protected void setYawPitch(float f, float f1) { @@ -94,7 +102,7 @@ this.yaw = f % 360.0F; this.pitch = f1 % 360.0F; } -@@ -186,7 +248,7 @@ +@@ -188,7 +249,7 @@ int i = this.L(); if (this.ak) { @@ -102,8 +110,8 @@ + if (true || minecraftserver.getAllowNether()) { // CraftBukkit if (this.vehicle == null && this.al++ >= i) { this.al = i; - this.portalCooldown = this.ar(); -@@ -263,6 +325,27 @@ + this.portalCooldown = this.aq(); +@@ -265,6 +326,27 @@ protected void burnFromLava() { if (!this.fireProof) { this.damageEntity(DamageSource.LAVA, 4.0F); @@ -131,7 +139,7 @@ this.setOnFire(15); } } -@@ -300,6 +383,22 @@ +@@ -302,6 +384,22 @@ this.a(this.getBoundingBox().c(d0, d1, d2)); this.recalcPosition(); } else { @@ -154,7 +162,7 @@ this.world.methodProfiler.a("move"); double d3 = this.locX; double d4 = this.locY; -@@ -520,6 +619,26 @@ +@@ -522,6 +620,26 @@ block.a(this.world, this); } @@ -178,23 +186,23 @@ + } + // CraftBukkit end + - if (this.r_() && !flag && this.vehicle == null) { + if (this.s_() && !flag && this.vehicle == null) { double d21 = this.locX - d3; double d22 = this.locY - d4; -@@ -530,7 +649,7 @@ +@@ -532,7 +650,7 @@ } if (block != null && this.onGround) { - block.a(this.world, blockposition, this); -+ // block.a(this.world, blockposition, this); // CraftBukkit removed down ++ // block.a(this.world, blockposition, this); // CraftBukkit moved down } this.M = (float) ((double) this.M + (double) MathHelper.sqrt(d21 * d21 + d23 * d23) * 0.6D); -@@ -548,9 +667,12 @@ +@@ -550,9 +668,12 @@ } this.a(blockposition, block); -+ block.a(this.world, blockposition, this); // CraftBukkit - moved from above ++ block.a(this.world, blockposition, this); // CraftBukkit moved from above } } @@ -203,7 +211,7 @@ try { this.checkBlockCollisions(); } catch (Throwable throwable) { -@@ -560,6 +682,8 @@ +@@ -562,6 +683,8 @@ this.appendEntityCrashDetails(crashreportsystemdetails); throw new ReportedException(crashreport); } @@ -212,7 +220,7 @@ boolean flag2 = this.U(); -@@ -567,7 +691,16 @@ +@@ -569,7 +692,16 @@ this.burn(1); if (!flag2) { ++this.fireTicks; @@ -230,7 +238,7 @@ this.setOnFire(8); } } -@@ -673,7 +806,7 @@ +@@ -675,7 +807,7 @@ return null; } @@ -239,7 +247,7 @@ if (!this.fireProof) { this.damageEntity(DamageSource.FIRE, (float) i); } -@@ -823,6 +956,13 @@ +@@ -818,6 +950,13 @@ } public void spawnIn(World world) { @@ -253,7 +261,7 @@ this.world = world; } -@@ -1015,6 +1155,18 @@ +@@ -1010,6 +1149,18 @@ try { nbttagcompound.set("Pos", this.a(new double[] { this.locX, this.locY, this.locZ})); nbttagcompound.set("Motion", this.a(new double[] { this.motX, this.motY, this.motZ})); @@ -272,7 +280,7 @@ nbttagcompound.set("Rotation", this.a(new float[] { this.yaw, this.pitch})); nbttagcompound.setFloat("FallDistance", this.fallDistance); nbttagcompound.setShort("Fire", (short) this.fireTicks); -@@ -1025,6 +1177,11 @@ +@@ -1020,6 +1171,11 @@ nbttagcompound.setInt("PortalCooldown", this.portalCooldown); nbttagcompound.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits()); nbttagcompound.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits()); @@ -284,15 +292,16 @@ if (this.getCustomName() != null && this.getCustomName().length() > 0) { nbttagcompound.setString("CustomName", this.getCustomName()); nbttagcompound.setBoolean("CustomNameVisible", this.getCustomNameVisible()); -@@ -1062,6 +1219,7 @@ +@@ -1057,6 +1213,8 @@ this.motX = nbttaglist1.d(0); this.motY = nbttaglist1.d(1); this.motZ = nbttaglist1.d(2); ++ + /* CraftBukkit start - Moved section down if (Math.abs(this.motX) > 10.0D) { this.motX = 0.0D; } -@@ -1073,6 +1231,7 @@ +@@ -1068,6 +1226,7 @@ if (Math.abs(this.motZ) > 10.0D) { this.motZ = 0.0D; } @@ -300,10 +309,10 @@ this.lastX = this.P = this.locX = nbttaglist.d(0); this.lastY = this.Q = this.locY = nbttaglist.d(1); -@@ -1105,7 +1264,57 @@ - if (this.af()) { +@@ -1103,6 +1262,58 @@ this.setPosition(this.locX, this.locY, this.locZ); } + + // CraftBukkit start + if (this instanceof EntityLiving) { + EntityLiving entity = (EntityLiving) this; @@ -315,7 +324,7 @@ + } + } + // CraftBukkit end - ++ + // CraftBukkit start - Exempt Vehicles from notch's sanity check + if (!(getBukkitEntity() instanceof Vehicle)) { + if (Math.abs(this.motX) > 10.0D) { @@ -355,10 +364,11 @@ + spawnIn(bworld == null? null : ((CraftWorld) bworld).getHandle()); + } + // CraftBukkit end ++ } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded"); -@@ -1167,6 +1376,12 @@ +@@ -1164,6 +1375,12 @@ public EntityItem a(ItemStack itemstack, float f) { if (itemstack.count != 0 && itemstack.getItem() != null) { @@ -371,7 +381,7 @@ EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY + (double) f, this.locZ, itemstack); entityitem.p(); -@@ -1275,17 +1490,70 @@ +@@ -1277,17 +1494,70 @@ return (double) this.length * 0.75D; } @@ -391,8 +401,8 @@ + PluginManager pluginManager = Bukkit.getPluginManager(); + getBukkitEntity(); // make sure bukkitEntity is initialised + // CraftBukkit end - this.ap = 0.0D; - this.aq = 0.0D; + this.ar = 0.0D; + this.as = 0.0D; if (entity == null) { if (this.vehicle != null) { + // CraftBukkit start @@ -442,7 +452,7 @@ if (this.vehicle != null) { this.vehicle.passenger = null; } -@@ -1406,10 +1674,50 @@ +@@ -1406,10 +1676,49 @@ } public void onLightningStrike(EntityLightning entitylightning) { @@ -483,7 +493,7 @@ + // CraftBukkit end ++this.fireTicks; if (this.fireTicks == 0) { - this.setOnFire(8); +- this.setOnFire(8); + // CraftBukkit start - Call a combust event when lightning strikes + EntityCombustByEntityEvent entityCombustEvent = new EntityCombustByEntityEvent(stormBukkitEntity, thisBukkitEntity, 8); + pluginManager.callEvent(entityCombustEvent); @@ -494,8 +504,8 @@ } } -@@ -1546,32 +1854,82 @@ - if (!this.world.isStatic && !this.dead) { +@@ -1550,32 +1859,83 @@ + if (!this.world.isClientSide && !this.dead) { this.world.methodProfiler.a("changeDimension"); MinecraftServer minecraftserver = MinecraftServer.getServer(); - int j = this.dimension; @@ -568,8 +578,8 @@ entity.setPositionRotation(blockposition, entity.yaw, entity.pitch); } -- + // CraftBukkit end */ + worldserver1.addEntity(entity); + // CraftBukkit start - Forward the CraftEntity to the new entity + this.getBukkitEntity().setHandle(entity); @@ -582,13 +592,11 @@ } this.dead = true; -@@ -1680,8 +2038,27 @@ - return this.boundingBox; +@@ -1721,7 +2081,26 @@ } -- public void a(AxisAlignedBB axisalignedbb) { + public void a(AxisAlignedBB axisalignedbb) { - this.boundingBox = axisalignedbb; -+ public void a(AxisAlignedBB axisalignedbb) { + // CraftBukkit start - block invalid bounding boxes + double a = axisalignedbb.a, + b = axisalignedbb.b, diff --git a/nms-patches/EntityAgeable.patch b/nms-patches/EntityAgeable.patch index 4abc0cf733..85cc5dbc80 100644 --- a/nms-patches/EntityAgeable.patch +++ b/nms-patches/EntityAgeable.patch @@ -1,9 +1,9 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityAgeable.java Thu Dec 4 19:00:43 2014 -+++ src/main/java/net/minecraft/server/EntityAgeable.java Thu Dec 4 18:45:16 2014 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityAgeable.java 2015-02-26 22:40:22.467608141 +0000 ++++ src/main/java/net/minecraft/server/EntityAgeable.java 2015-02-26 22:40:22.467608141 +0000 @@ -7,6 +7,7 @@ protected int c; - private float bk = -1.0F; - private float bl; + private float bm = -1.0F; + private float bn; + public boolean ageLocked = false; // CraftBukkit public EntityAgeable(World world) { @@ -41,8 +41,8 @@ public void m() { super.m(); -- if (this.world.isStatic) { -+ if (this.world.isStatic || ageLocked) { // CraftBukkit +- if (this.world.isClientSide) { ++ if (this.world.isClientSide || ageLocked) { // CraftBukkit if (this.c > 0) { if (this.c % 4 == 0) { this.world.addParticle(EnumParticle.VILLAGER_HAPPY, this.locX + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, this.locY + 0.5D + (double) (this.random.nextFloat() * this.length), this.locZ + (double) (this.random.nextFloat() * this.width * 2.0F) - (double) this.width, 0.0D, 0.0D, 0.0D, new int[0]); @@ -50,8 +50,8 @@ this.a(flag ? 0.5F : 1.0F); } -- protected final void a(float f, float f1) { -+ public final void a(float f, float f1) { // CraftBukkit - protected to public - boolean flag = this.bk > 0.0F; +- protected final void setSize(float f, float f1) { ++ public final void setSize(float f, float f1) { // CraftBukkit - protected to public + boolean flag = this.bm > 0.0F; - this.bk = f; + this.bm = f; diff --git a/nms-patches/EntityAnimal.patch b/nms-patches/EntityAnimal.patch index 4b90e467ba..a1280c4f10 100644 --- a/nms-patches/EntityAnimal.patch +++ b/nms-patches/EntityAnimal.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/EntityAnimal.java 2014-12-10 18:34:37.064492562 +0000 -+++ src/main/java/net/minecraft/server/EntityAnimal.java 2014-12-10 18:31:55.772494313 +0000 -@@ -38,14 +38,19 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityAnimal.java 2015-02-26 22:40:22.471608141 +0000 ++++ src/main/java/net/minecraft/server/EntityAnimal.java 2015-02-26 22:40:22.471608141 +0000 +@@ -38,6 +38,9 @@ } @@ -10,10 +10,7 @@ public boolean damageEntity(DamageSource damagesource, float f) { if (this.isInvulnerable(damagesource)) { return false; - } else { -- this.bk = 0; -+ //CraftBukkit - moved into EntityLiving.d(DamageSource, float) -+ //this.bk = 0; +@@ -46,6 +49,7 @@ return super.damageEntity(damagesource, f); } } diff --git a/nms-patches/EntityArmorStand.patch b/nms-patches/EntityArmorStand.patch index 44c63adcaf..e912eb7fb3 100644 --- a/nms-patches/EntityArmorStand.patch +++ b/nms-patches/EntityArmorStand.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/EntityArmorStand.java 2015-02-15 12:48:44.653310353 +1100 -+++ src/main/java/net/minecraft/server/EntityArmorStand.java 2015-02-15 12:48:44.653310353 +1100 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityArmorStand.java 2015-02-26 22:40:22.475608141 +0000 ++++ src/main/java/net/minecraft/server/EntityArmorStand.java 2015-02-26 22:40:22.475608141 +0000 @@ -2,6 +2,15 @@ import java.util.List; @@ -16,7 +16,28 @@ public class EntityArmorStand extends EntityLiving { private static final Vector3f a = new Vector3f(0.0F, 0.0F, 0.0F); -@@ -323,6 +332,22 @@ +@@ -15,12 +24,14 @@ + private long i; + private int bi; + private boolean bj; +- private Vector3f headPose; +- private Vector3f bodyPose; +- private Vector3f leftArmPose; +- private Vector3f rightArmPose; +- private Vector3f leftLegPose; +- private Vector3f rightLegPose; ++ // CraftBukkit start - public all the things! ++ public Vector3f headPose; ++ public Vector3f bodyPose; ++ public Vector3f leftArmPose; ++ public Vector3f rightArmPose; ++ public Vector3f leftLegPose; ++ public Vector3f rightLegPose; ++ // CraftBukkit end + + public EntityArmorStand(World world) { + super(world); +@@ -332,6 +343,22 @@ ItemStack itemstack1 = entityhuman.inventory.getItem(j); ItemStack itemstack2; @@ -39,7 +60,7 @@ if (entityhuman.abilities.canInstantlyBuild && (itemstack == null || itemstack.getItem() == Item.getItemOf(Blocks.AIR)) && itemstack1 != null) { itemstack2 = itemstack1.cloneItemStack(); itemstack2.count = 1; -@@ -343,6 +368,11 @@ +@@ -352,6 +379,11 @@ } public boolean damageEntity(DamageSource damagesource, float f) { @@ -48,15 +69,50 @@ + return false; + } + // CraftBukkit end - if (!this.world.isStatic && !this.h) { - if (DamageSource.OUT_OF_WORLD.equals(damagesource)) { - this.die(); -@@ -542,6 +572,8 @@ + if (this.world.isClientSide) { + return false; + } else if (DamageSource.OUT_OF_WORLD.equals(damagesource)) { +@@ -552,7 +584,7 @@ + return this.isInvisible(); + } + +- private void setSmall(boolean flag) { ++ public void setSmall(boolean flag) { // CraftBukkit - public + byte b0 = this.datawatcher.getByte(10); + + if (flag) { +@@ -562,13 +594,15 @@ } this.datawatcher.watch(10, Byte.valueOf(b0)); + -+ this.T = flag; // CraftBukkit. // PAIL: Rename (noclip) ++ this.noclip = flag; // CraftBukkit. } - public boolean hasGravity() { + public boolean isSmall() { + return (this.datawatcher.getByte(10) & 1) != 0; + } + +- private void setGravity(boolean flag) { ++ public void setGravity(boolean flag) { // CraftBukkit - public + byte b0 = this.datawatcher.getByte(10); + + if (flag) { +@@ -584,7 +618,7 @@ + return (this.datawatcher.getByte(10) & 2) != 0; + } + +- private void setArms(boolean flag) { ++ public void setArms(boolean flag) { // CraftBukkit - public + byte b0 = this.datawatcher.getByte(10); + + if (flag) { +@@ -600,7 +634,7 @@ + return (this.datawatcher.getByte(10) & 4) != 0; + } + +- private void setBasePlate(boolean flag) { ++ public void setBasePlate(boolean flag) { // CraftBukkit - public + byte b0 = this.datawatcher.getByte(10); + + if (flag) { diff --git a/nms-patches/EntityArrow.patch b/nms-patches/EntityArrow.patch index fcd2199376..8fdf2073fe 100644 --- a/nms-patches/EntityArrow.patch +++ b/nms-patches/EntityArrow.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityArrow.java 2014-11-28 17:43:43.061707436 +0000 -+++ src/main/java/net/minecraft/server/EntityArrow.java 2014-11-28 17:38:20.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityArrow.java 2015-02-26 22:40:22.479608141 +0000 ++++ src/main/java/net/minecraft/server/EntityArrow.java 2015-02-26 22:40:22.483608141 +0000 @@ -2,6 +2,12 @@ import java.util.List; @@ -13,6 +13,15 @@ public class EntityArrow extends Entity implements IProjectile { private int d = -1; +@@ -16,7 +22,7 @@ + private int ar; + private int as; + private double damage = 2.0D; +- private int knockbackStrength; ++ public int knockbackStrength; // CraftBukkit - public + + public EntityArrow(World world) { + super(world); @@ -35,6 +41,7 @@ super(world); this.j = 10.0D; @@ -29,37 +38,25 @@ if (entityliving instanceof EntityHuman) { this.fromPlayer = 1; } -@@ -175,7 +183,7 @@ - MovingObjectPosition movingobjectposition1 = axisalignedbb1.a(vec3d, vec3d1); - - if (movingobjectposition1 != null) { -- double d1 = vec3d.f(movingobjectposition1.pos); -+ double d1 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - - if (d1 < d0 || d0 == 0.0D) { - entity = entity1; -@@ -202,6 +210,8 @@ - float f4; +@@ -201,6 +209,7 @@ + float f3; if (movingobjectposition != null) { + org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event -+ if (movingobjectposition.entity != null) { f2 = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ); int k = MathHelper.f((double) f2 * this.damage); -@@ -217,12 +227,20 @@ - } else { +@@ -217,11 +226,18 @@ damagesource = DamageSource.arrow(this, this.shooter); } -+ + +- if (this.isBurning() && !(movingobjectposition.entity instanceof EntityEnderman)) { +- movingobjectposition.entity.setOnFire(5); + // CraftBukkit start - Moved damage call + if (movingobjectposition.entity.damageEntity(damagesource, (float) k)) { + if (this.isBurning() && !(movingobjectposition.entity instanceof EntityEnderman) && (!(movingobjectposition.entity instanceof EntityPlayer) || !(this.shooter instanceof EntityPlayer) || this.world.pvpMode)) { // CraftBukkit - abide by pvp setting if destination is a player + EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 5); + org.bukkit.Bukkit.getPluginManager().callEvent(combustEvent); - -- if (this.isBurning() && !(movingobjectposition.entity instanceof EntityEnderman)) { -- movingobjectposition.entity.setOnFire(5); + if (!combustEvent.isCancelled()) { + movingobjectposition.entity.setOnFire(combustEvent.getDuration()); + } @@ -71,10 +68,10 @@ if (movingobjectposition.entity instanceof EntityLiving) { EntityLiving entityliving = (EntityLiving) movingobjectposition.entity; -@@ -382,6 +400,21 @@ +@@ -383,6 +399,20 @@ public void d(EntityHuman entityhuman) { - if (!this.world.isStatic && this.inGround && this.shake <= 0) { + if (!this.world.isClientSide && this.inGround && this.shake <= 0) { + // CraftBukkit start + ItemStack itemstack = new ItemStack(Items.ARROW); + if (this.fromPlayer == 1 && entityhuman.inventory.canHold(itemstack) > 0) { @@ -89,11 +86,10 @@ + } + } + // CraftBukkit end -+ boolean flag = this.fromPlayer == 1 || this.fromPlayer == 2 && entityhuman.abilities.canInstantlyBuild; if (this.fromPlayer == 1 && !entityhuman.inventory.pickup(new ItemStack(Items.ARROW, 1))) { -@@ -433,4 +466,10 @@ +@@ -438,4 +468,10 @@ return (b0 & 1) != 0; } diff --git a/nms-patches/EntityBoat.patch b/nms-patches/EntityBoat.patch index 24d0ba8272..d8caf34c87 100644 --- a/nms-patches/EntityBoat.patch +++ b/nms-patches/EntityBoat.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityBoat.java 2014-11-28 17:43:43.065707436 +0000 -+++ src/main/java/net/minecraft/server/EntityBoat.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityBoat.java 2015-02-26 22:40:22.483608141 +0000 ++++ src/main/java/net/minecraft/server/EntityBoat.java 2015-02-26 22:40:22.487608140 +0000 @@ -2,6 +2,16 @@ import java.util.List; @@ -17,11 +17,10 @@ public class EntityBoat extends Entity { private boolean a; -@@ -12,6 +22,27 @@ - private double f; +@@ -13,12 +23,35 @@ private double g; private double h; -+ + + // CraftBukkit start + public double maxSpeed = 0.4D; + public double occupiedDeceleration = 0.2D; @@ -42,18 +41,18 @@ + super.collide(entity); + } + // CraftBukkit end - ++ public EntityBoat(World world) { super(world); -@@ -52,6 +83,8 @@ - this.lastX = d0; - this.lastY = d1; - this.lastZ = d2; + this.a = true; + this.b = 0.07D; + this.k = true; + this.setSize(1.5F, 0.6F); + + this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit } - public double an() { + protected boolean s_() { @@ -65,6 +98,19 @@ if (this.passenger != null && this.passenger == damagesource.getEntity() && damagesource instanceof EntityDamageSourceIndirect) { return false; @@ -70,7 +69,7 @@ + } + // f = event.getDamage(); // TODO Why don't we do this? + // CraftBukkit end -+ ++ this.b(-this.m()); this.a(10); this.setDamage(this.j() + f * 10.0F); @@ -93,7 +92,7 @@ @@ -95,6 +150,13 @@ } - public void s_() { + public void t_() { + // CraftBukkit start + double prevX = this.locX; + double prevY = this.locY; @@ -101,12 +100,12 @@ + float prevYaw = this.yaw; + float prevPitch = this.pitch; + // CraftBukkit end - super.s_(); + super.t_(); if (this.l() > 0) { this.a(this.l() - 1); @@ -196,6 +258,19 @@ - this.motX += -Math.sin((double) (f * 3.1415927F / 180.0F)) * this.b * (double) entityliving.aY * 0.05000000074505806D; - this.motZ += Math.cos((double) (f * 3.1415927F / 180.0F)) * this.b * (double) entityliving.aY * 0.05000000074505806D; + this.motX += -Math.sin((double) (f * 3.1415927F / 180.0F)) * this.b * (double) entityliving.ba * 0.05000000074505806D; + this.motZ += Math.cos((double) (f * 3.1415927F / 180.0F)) * this.b * (double) entityliving.ba * 0.05000000074505806D; } + // CraftBukkit start - Support unoccupied deceleration + else if (unoccupiedDeceleration >= 0) { @@ -152,38 +151,27 @@ this.motX *= 0.5D; this.motY *= 0.5D; this.motZ *= 0.5D; -@@ -247,16 +332,23 @@ - +@@ -248,6 +333,11 @@ this.move(this.motX, this.motY, this.motZ); - if (this.positionChanged && d3 > 0.2D) { -- if (!this.world.isStatic && !this.dead) { -- this.die(); -+ if (!this.world.isStatic && !this.dead) { + if (this.positionChanged && d3 > 0.2975D) { + if (!this.world.isClientSide && !this.dead) { + // CraftBukkit start + Vehicle vehicle = (Vehicle) this.getBukkitEntity(); + VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, null); + this.world.getServer().getPluginManager().callEvent(destroyEvent); + if (!destroyEvent.isCancelled()) { -+ this.die(); - -- for (k = 0; k < 3; ++k) { -- this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F); -- } -+ for (k = 0; k < 3; ++k) { -+ this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F); -+ } - -- for (k = 0; k < 2; ++k) { -- this.a(Items.STICK, 1, 0.0F); -+ for (k = 0; k < 2; ++k) { -+ this.a(Items.STICK, 1, 0.0F); -+ } + this.die(); + if (this.world.getGameRules().getBoolean("doEntityDrops")) { + for (k = 0; k < 3; ++k) { +@@ -258,6 +348,7 @@ + this.a(Items.STICK, 1, 0.0F); + } } -+ // CraftBukkit end ++ } // CraftBukkit end } } else { this.motX *= 0.9900000095367432D; -@@ -284,6 +376,23 @@ +@@ -285,6 +376,22 @@ this.yaw = (float) ((double) this.yaw + d12); this.setYawPitch(this.yaw, this.pitch); @@ -203,11 +191,10 @@ + server.getPluginManager().callEvent(event); + } + // CraftBukkit end -+ - if (!this.world.isStatic) { + if (!this.world.isClientSide) { List list = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)); -@@ -298,6 +407,7 @@ +@@ -299,6 +406,7 @@ } if (this.passenger != null && this.passenger.dead) { @@ -215,35 +202,23 @@ this.passenger = null; } -@@ -335,17 +445,24 @@ +@@ -336,6 +444,11 @@ if (this.fallDistance > 3.0F) { this.e(this.fallDistance, 1.0F); - if (!this.world.isStatic && !this.dead) { -- this.die(); + if (!this.world.isClientSide && !this.dead) { + // CraftBukkit start + Vehicle vehicle = (Vehicle) this.getBukkitEntity(); + VehicleDestroyEvent destroyEvent = new VehicleDestroyEvent(vehicle, null); + this.world.getServer().getPluginManager().callEvent(destroyEvent); + if (!destroyEvent.isCancelled()) { -+ this.die(); - -- int i; -+ int i; - -- for (i = 0; i < 3; ++i) { -- this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F); -- } -+ for (i = 0; i < 3; ++i) { -+ this.a(Item.getItemOf(Blocks.PLANKS), 1, 0.0F); -+ } - -- for (i = 0; i < 2; ++i) { -- this.a(Items.STICK, 1, 0.0F); -+ for (i = 0; i < 2; ++i) { -+ this.a(Items.STICK, 1, 0.0F); -+ } + this.die(); + if (this.world.getGameRules().getBoolean("doEntityDrops")) { + int i; +@@ -348,6 +461,7 @@ + this.a(Items.STICK, 1, 0.0F); + } } -+ // CraftBukkit end ++ } // CraftBukkit end } this.fallDistance = 0.0F; diff --git a/nms-patches/EntityChicken.patch b/nms-patches/EntityChicken.patch index 2c12bdfb19..a27939f81d 100644 --- a/nms-patches/EntityChicken.patch +++ b/nms-patches/EntityChicken.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityChicken.java 2014-11-28 17:43:43.065707436 +0000 -+++ src/main/java/net/minecraft/server/EntityChicken.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityChicken.java 2015-02-26 22:40:22.491608140 +0000 ++++ src/main/java/net/minecraft/server/EntityChicken.java 2015-02-26 22:40:22.491608140 +0000 @@ -35,6 +35,11 @@ } @@ -10,5 +10,5 @@ + } + // CraftBukkit end super.m(); - this.bo = this.bk; - this.bn = this.bm; + this.bq = this.bm; + this.bp = this.bo; diff --git a/nms-patches/EntityCow.patch b/nms-patches/EntityCow.patch index 175a8e79cc..ec09d8ed87 100644 --- a/nms-patches/EntityCow.patch +++ b/nms-patches/EntityCow.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityCow.java 2014-11-28 17:43:43.069707436 +0000 -+++ src/main/java/net/minecraft/server/EntityCow.java 2014-11-28 17:38:19.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityCow.java 2015-02-26 22:40:22.491608140 +0000 ++++ src/main/java/net/minecraft/server/EntityCow.java 2015-02-26 22:40:22.495608140 +0000 @@ -1,5 +1,10 @@ package net.minecraft.server; @@ -11,13 +11,10 @@ public class EntityCow extends EntityAnimal { public EntityCow(World world) { -@@ -69,13 +74,23 @@ - - public boolean a(EntityHuman entityhuman) { +@@ -71,11 +76,21 @@ ItemStack itemstack = entityhuman.inventory.getItemInHand(); -- -+ - if (itemstack != null && itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild) { + + if (itemstack != null && itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) { - if (itemstack.count-- == 1) { - entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, new ItemStack(Items.MILK_BUCKET)); - } else if (!entityhuman.inventory.pickup(new ItemStack(Items.MILK_BUCKET))) { diff --git a/nms-patches/EntityCreature.patch b/nms-patches/EntityCreature.patch index d448534f5a..9ff5dc8f42 100644 --- a/nms-patches/EntityCreature.patch +++ b/nms-patches/EntityCreature.patch @@ -1,19 +1,17 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityCreature.java 2014-11-28 17:43:43.069707436 +0000 -+++ src/main/java/net/minecraft/server/EntityCreature.java 2014-11-28 17:38:19.000000000 +0000 -@@ -2,6 +2,12 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityCreature.java 2015-02-26 22:40:22.495608140 +0000 ++++ src/main/java/net/minecraft/server/EntityCreature.java 2015-02-26 22:40:22.495608140 +0000 +@@ -2,6 +2,10 @@ import java.util.UUID; +// CraftBukkit start -+import org.bukkit.craftbukkit.entity.CraftEntity; -+import org.bukkit.event.entity.EntityTargetEvent; +import org.bukkit.event.entity.EntityUnleashEvent; +// CraftBukkit end + public abstract class EntityCreature extends EntityInsentient { - public static final UUID bi = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A"); -@@ -69,6 +75,7 @@ + public static final UUID bk = UUID.fromString("E199AD21-BA8A-4C53-8D13-6182D5C69D3A"); +@@ -69,6 +73,7 @@ if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) { if (f > 10.0F) { @@ -21,11 +19,11 @@ this.unleash(true, true); } -@@ -100,6 +107,7 @@ +@@ -100,6 +105,7 @@ } if (f > 10.0F) { + this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit this.unleash(true, true); } - } else if (!this.cb() && this.bk) { + } else if (!this.cc() && this.bm) { diff --git a/nms-patches/EntityCreeper.patch b/nms-patches/EntityCreeper.patch index 2c130bbb9b..a359edcb4e 100644 --- a/nms-patches/EntityCreeper.patch +++ b/nms-patches/EntityCreeper.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityCreeper.java 2014-11-28 17:43:43.073707436 +0000 -+++ src/main/java/net/minecraft/server/EntityCreeper.java 2014-11-28 17:38:20.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityCreeper.java 2015-02-26 22:40:22.499608140 +0000 ++++ src/main/java/net/minecraft/server/EntityCreeper.java 2015-02-26 22:40:22.499608140 +0000 @@ -1,5 +1,10 @@ package net.minecraft.server; @@ -10,16 +10,16 @@ + public class EntityCreeper extends EntityMonster { - private int b; + private int a; @@ -7,6 +12,7 @@ private int maxFuseTicks = 30; private int explosionRadius = 3; - private int bm = 0; + private int bn = 0; + private int record = -1; // CraftBukkit public EntityCreeper(World world) { super(world); -@@ -111,19 +117,36 @@ +@@ -110,19 +116,36 @@ } public void die(DamageSource damagesource) { @@ -35,20 +35,19 @@ + // this.a(Item.getById(k), 1); + this.record = k; + // CraftBukkit end - } else if (damagesource.getEntity() instanceof EntityCreeper && damagesource.getEntity() != this && ((EntityCreeper) damagesource.getEntity()).isPowered() && ((EntityCreeper) damagesource.getEntity()).cn()) { - ((EntityCreeper) damagesource.getEntity()).co(); + } else if (damagesource.getEntity() instanceof EntityCreeper && damagesource.getEntity() != this && ((EntityCreeper) damagesource.getEntity()).isPowered() && ((EntityCreeper) damagesource.getEntity()).cp()) { + ((EntityCreeper) damagesource.getEntity()).cq(); this.a(new ItemStack(Items.SKULL, 1, 4), 0.0F); } -- + + super.die(damagesource); // CraftBukkit - Moved from above + } -+ ++ + // CraftBukkit start - Whole method + @Override + protected void dropDeathLoot(boolean flag, int i) { + super.dropDeathLoot(flag, i); -+ + + // Drop a music disc? + if (this.record != -1) { + this.a(Item.getById(this.record), 1); @@ -59,7 +58,7 @@ public boolean r(Entity entity) { return true; -@@ -147,7 +170,21 @@ +@@ -146,7 +169,21 @@ public void onLightningStrike(EntityLightning entitylightning) { super.onLightningStrike(entitylightning); @@ -82,14 +81,12 @@ } protected boolean a(EntityHuman entityhuman) { -@@ -170,9 +207,16 @@ - if (!this.world.isStatic) { +@@ -170,8 +207,15 @@ boolean flag = this.world.getGameRules().getBoolean("mobGriefing"); float f = this.isPowered() ? 2.0F : 1.0F; -- + - this.world.explode(this, this.locX, this.locY, this.locZ, (float) this.explosionRadius * f, flag); - this.die(); -+ + ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), this.explosionRadius * f, false); + this.world.getServer().getPluginManager().callEvent(event); + if (!event.isCancelled()) { diff --git a/nms-patches/EntityDamageSourceIndirect.patch b/nms-patches/EntityDamageSourceIndirect.patch index 1991e18c66..352f4974b7 100644 --- a/nms-patches/EntityDamageSourceIndirect.patch +++ b/nms-patches/EntityDamageSourceIndirect.patch @@ -1,14 +1,13 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityDamageSourceIndirect.java 2014-11-28 17:43:43.073707436 +0000 -+++ src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java 2014-11-28 17:38:18.000000000 +0000 -@@ -24,5 +24,11 @@ - String s1 = s + ".item"; +--- /home/matt/mc-dev-private//net/minecraft/server/EntityDamageSourceIndirect.java 2015-02-26 22:40:22.503608140 +0000 ++++ src/main/java/net/minecraft/server/EntityDamageSourceIndirect.java 2015-02-26 22:40:22.503608140 +0000 +@@ -25,4 +25,10 @@ return itemstack != null && itemstack.hasName() && LocaleI18n.c(s1) ? new ChatMessage(s1, new Object[] { entityliving.getScoreboardDisplayName(), ichatbasecomponent, itemstack.C()}) : new ChatMessage(s, new Object[] { entityliving.getScoreboardDisplayName(), ichatbasecomponent}); -+ } -+ + } ++ + // CraftBukkit start + public Entity getProximateDamageSource() { + return super.getEntity(); - } ++ } + // CraftBukkit end } diff --git a/nms-patches/EntityEgg.patch b/nms-patches/EntityEgg.patch index 138b4775ae..6340c22725 100644 --- a/nms-patches/EntityEgg.patch +++ b/nms-patches/EntityEgg.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityEgg.java 2014-11-28 17:43:43.077707435 +0000 -+++ src/main/java/net/minecraft/server/EntityEgg.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityEgg.java 2015-02-26 22:40:22.507608140 +0000 ++++ src/main/java/net/minecraft/server/EntityEgg.java 2015-02-26 22:40:22.507608140 +0000 @@ -1,5 +1,12 @@ package net.minecraft.server; @@ -17,16 +17,28 @@ movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.getShooter()), 0.0F); } -- if (!this.world.isStatic && this.random.nextInt(8) == 0) { +- if (!this.world.isClientSide && this.random.nextInt(8) == 0) { - byte b0 = 1; + // CraftBukkit start - Fire PlayerEggThrowEvent -+ boolean hatching = !this.world.isStatic && this.random.nextInt(8) == 0; ++ boolean hatching = !this.world.isClientSide && this.random.nextInt(8) == 0; + int numHatching = (this.random.nextInt(32) == 0) ? 4 : 1; + if (!hatching) { + numHatching = 0; + } -+ ++ + EntityType hatchingType = EntityType.CHICKEN; ++ ++ Entity shooter = this.getShooter(); ++ if (shooter instanceof EntityPlayer) { ++ Player player = (shooter == null) ? null : (Player) shooter.getBukkitEntity(); ++ ++ PlayerEggThrowEvent event = new PlayerEggThrowEvent(player, (org.bukkit.entity.Egg) this.getBukkitEntity(), hatching, (byte) numHatching, hatchingType); ++ this.world.getServer().getPluginManager().callEvent(event); ++ ++ hatching = event.isHatching(); ++ numHatching = event.getNumHatches(); ++ hatchingType = event.getHatchingType(); ++ } - if (this.random.nextInt(32) == 0) { - b0 = 4; @@ -39,18 +51,6 @@ - entitychicken.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F); - this.world.addEntity(entitychicken); - } -+ Entity shooter = this.getShooter(); -+ if (shooter instanceof EntityPlayer) { -+ Player player = (shooter == null) ? null : (Player) shooter.getBukkitEntity(); -+ -+ PlayerEggThrowEvent event = new PlayerEggThrowEvent(player, (org.bukkit.entity.Egg) this.getBukkitEntity(), hatching, (byte) numHatching, hatchingType); -+ this.world.getServer().getPluginManager().callEvent(event); -+ -+ hatching = event.isHatching(); -+ numHatching = event.getNumHatches(); -+ hatchingType = event.getHatchingType(); -+ } -+ + if (hatching) { + for (int k = 0; k < numHatching; k++) { + org.bukkit.entity.Entity entity = world.getWorld().spawn(new org.bukkit.Location(world.getWorld(), this.locX, this.locY, this.locZ, this.yaw, 0.0F), hatchingType.getEntityClass(), org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.EGG); diff --git a/nms-patches/EntityEnderCrystal.patch b/nms-patches/EntityEnderCrystal.patch index 3a95eb74a4..9ee8b88f8f 100644 --- a/nms-patches/EntityEnderCrystal.patch +++ b/nms-patches/EntityEnderCrystal.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityEnderCrystal.java 2014-12-05 23:41:59.577572184 +0000 -+++ src/main/java/net/minecraft/server/EntityEnderCrystal.java 2014-12-05 23:41:54.069572306 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityEnderCrystal.java 2015-02-26 22:40:22.511608140 +0000 ++++ src/main/java/net/minecraft/server/EntityEnderCrystal.java 2015-02-26 22:40:22.511608140 +0000 @@ -1,5 +1,10 @@ package net.minecraft.server; @@ -24,20 +24,19 @@ } } -@@ -50,11 +59,25 @@ +@@ -50,11 +59,24 @@ return false; } else { - if (!this.dead && !this.world.isStatic) { + if (!this.dead && !this.world.isClientSide) { + // CraftBukkit start - All non-living entities need this + if (CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f)) { + return false; + } + // CraftBukkit end -+ this.b = 0; if (this.b <= 0) { this.die(); - if (!this.world.isStatic) { + if (!this.world.isClientSide) { - this.world.explode((Entity) null, this.locX, this.locY, this.locZ, 6.0F, true); + // CraftBukkit start + ExplosionPrimeEvent event = new ExplosionPrimeEvent(this.getBukkitEntity(), 6.0F, false); diff --git a/nms-patches/EntityEnderDragon.patch b/nms-patches/EntityEnderDragon.patch index a80d464726..86bda9c102 100644 --- a/nms-patches/EntityEnderDragon.patch +++ b/nms-patches/EntityEnderDragon.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityEnderDragon.java 2014-11-28 17:43:43.081707435 +0000 -+++ src/main/java/net/minecraft/server/EntityEnderDragon.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityEnderDragon.java 2015-02-26 22:40:22.515608140 +0000 ++++ src/main/java/net/minecraft/server/EntityEnderDragon.java 2015-02-26 22:40:22.515608140 +0000 @@ -5,6 +5,17 @@ import java.util.Iterator; import java.util.List; @@ -18,78 +18,28 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMonster { public double a; -@@ -27,6 +38,7 @@ - private Entity by; - public int bw; - public EntityEnderCrystal bx; +@@ -24,9 +35,10 @@ + public float bv; + public boolean bw; + public boolean bx; +- private Entity bA; ++ public Entity bA; // CraftBukkit - public + public int by; + public EntityEnderCrystal bz; + private Explosion explosionSource = new Explosion(null, this, Double.NaN, Double.NaN, Double.NaN, Float.NaN, true, true); // CraftBukkit - reusable source for CraftTNTPrimed.getSource() public EntityEnderDragon(World world) { super(world); -@@ -120,21 +132,21 @@ - - if (this.world.isStatic) { - if (this.ba > 0) { -- d3 = this.locX + (this.bb - this.locX) / (double) this.ba; -- d0 = this.locY + (this.bc - this.locY) / (double) this.ba; -- d1 = this.locZ + (this.bd - this.locZ) / (double) this.ba; -- d2 = MathHelper.g(this.be - (double) this.yaw); -- this.yaw = (float) ((double) this.yaw + d2 / (double) this.ba); -+ d0 = this.locX + (this.bb - this.locX) / (double) this.ba; -+ d1 = this.locY + (this.bc - this.locY) / (double) this.ba; -+ d2 = this.locZ + (this.bd - this.locZ) / (double) this.ba; -+ d3 = MathHelper.g(this.be - (double) this.yaw); -+ this.yaw = (float) ((double) this.yaw + d3 / (double) this.ba); - this.pitch = (float) ((double) this.pitch + (this.bf - (double) this.pitch) / (double) this.ba); - --this.ba; -- this.setPosition(d3, d0, d1); -+ this.setPosition(d0, d1, d2); - this.setYawPitch(this.yaw, this.pitch); - } - } else { -- d3 = this.a - this.locX; -- d0 = this.b - this.locY; -- d1 = this.c - this.locZ; -- d2 = d3 * d3 + d0 * d0 + d1 * d1; -+ d0 = this.a - this.locX; -+ d1 = this.b - this.locY; -+ d2 = this.c - this.locZ; -+ d3 = d0 * d0 + d1 * d1 + d2 * d2; - double d4; - - if (this.by != null) { -@@ -155,16 +167,16 @@ - this.c += this.random.nextGaussian() * 2.0D; - } - -- if (this.bu || d2 < 100.0D || d2 > 22500.0D || this.positionChanged || this.E) { -+ if (this.bu || d3 < 100.0D || d3 > 22500.0D || this.positionChanged || this.E) { - this.cd(); - } - -- d0 /= (double) MathHelper.sqrt(d3 * d3 + d1 * d1); -+ d1 /= (double) MathHelper.sqrt(d0 * d0 + d2 * d2); - f3 = 0.6F; -- d0 = MathHelper.a(d0, (double) (-f3), (double) f3); -- this.motY += d0 * 0.10000000149011612D; -+ d1 = MathHelper.a(d1, (double) (-f3), (double) f3); -+ this.motY += d1 * 0.10000000149011612D; - this.yaw = MathHelper.g(this.yaw); -- double d8 = 180.0D - Math.atan2(d3, d1) * 180.0D / 3.1415927410125732D; -+ double d8 = 180.0D - Math.atan2(d0, d2) * 180.0D / 3.1415927410125732D; - double d9 = MathHelper.g(d8 - (double) this.yaw); - - if (d9 > 50.0D) { -@@ -290,12 +302,21 @@ - if (this.bx != null) { - if (this.bx.dead) { - if (!this.world.isStatic) { -+ CraftEventFactory.entityDamage = this.bx; // CraftBukkit - this.a(this.bl, DamageSource.explosion((Explosion) null), 10.0F); +@@ -294,12 +306,21 @@ + if (this.bz != null) { + if (this.bz.dead) { + if (!this.world.isClientSide) { ++ CraftEventFactory.entityDamage = this.bz; // CraftBukkit + this.a(this.bn, DamageSource.explosion((Explosion) null), 10.0F); + CraftEventFactory.entityDamage = null; // CraftBukkit } - this.bx = null; + this.bz = null; } else if (this.ticksLived % 10 == 0 && this.getHealth() < this.getMaxHealth()) { - this.setHealth(this.getHealth() + 1.0F); + // CraftBukkit start @@ -103,11 +53,11 @@ } } -@@ -364,7 +385,19 @@ +@@ -368,7 +389,19 @@ } if (this.random.nextInt(2) == 0 && !arraylist.isEmpty()) { -- this.by = (Entity) arraylist.get(this.random.nextInt(arraylist.size())); +- this.bA = (Entity) arraylist.get(this.random.nextInt(arraylist.size())); + // CraftBukkit start + Entity target = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size())); + EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.RANDOM_TARGET); @@ -115,41 +65,41 @@ + + if (!event.isCancelled()) { + if (event.getTarget() == null) { -+ this.by = null; ++ this.bA = null; + } else { -+ this.by = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle(); ++ this.bA = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle(); + } + } + // CraftBukkit end } else { boolean flag; -@@ -399,6 +432,11 @@ - int j1 = MathHelper.floor(axisalignedbb.f); +@@ -404,6 +437,11 @@ boolean flag = false; boolean flag1 = false; -+ + + // CraftBukkit start - Create a list to hold all the destroyed blocks + List destroyedBlocks = new java.util.ArrayList(); + org.bukkit.craftbukkit.CraftWorld craftWorld = this.world.getWorld(); + // CraftBukkit end - ++ for (int k1 = i; k1 <= l; ++k1) { for (int l1 = j; l1 <= i1; ++l1) { -@@ -407,7 +445,11 @@ + for (int i2 = k; i2 <= j1; ++i2) { +@@ -412,7 +450,11 @@ if (block.getMaterial() != Material.AIR) { if (block != Blocks.BARRIER && block != Blocks.OBSIDIAN && block != Blocks.END_STONE && block != Blocks.BEDROCK && block != Blocks.COMMAND_BLOCK && this.world.getGameRules().getBoolean("mobGriefing")) { -- flag1 = this.world.setAir(new BlockPosition(k1, l1, i2)) || flag1; +- flag1 = this.world.setAir(blockposition) || flag1; + // CraftBukkit start - Add blocks to list rather than destroying them -+ // flag1 = this.world.setAir(new BlockPosition(k1, l1, i2)) || flag1; ++ // flag1 = this.world.setAir(new BlockPosition(blockposition)) || flag1; + flag1 = true; + destroyedBlocks.add(craftWorld.getBlockAt(k1, l1, i2)); + // CraftBukkit end } else { flag = true; } -@@ -417,6 +459,40 @@ +@@ -422,6 +464,40 @@ } if (flag1) { @@ -186,36 +136,36 @@ + this.world.setAir(new BlockPosition(blockX, blockY, blockZ)); + } + } -+ // CraftBukkit end ++ // CraftBukkit end double d0 = axisalignedbb.a + (axisalignedbb.d - axisalignedbb.a) * (double) this.random.nextFloat(); double d1 = axisalignedbb.b + (axisalignedbb.e - axisalignedbb.b) * (double) this.random.nextFloat(); double d2 = axisalignedbb.c + (axisalignedbb.f - axisalignedbb.c) * (double) this.random.nextFloat(); -@@ -464,6 +540,7 @@ +@@ -469,6 +545,7 @@ } - protected void aY() { + protected void aZ() { + if (this.dead) return; // CraftBukkit - can't kill what's already dead - ++this.bw; - if (this.bw >= 180 && this.bw <= 200) { + ++this.by; + if (this.by >= 180 && this.by <= 200) { float f = (this.random.nextFloat() - 0.5F) * 8.0F; -@@ -478,7 +555,7 @@ +@@ -484,7 +561,7 @@ - if (!this.world.isStatic) { - if (this.bw > 150 && this.bw % 5 == 0 && this.world.getGameRules().getBoolean("doMobLoot")) { + if (!this.world.isClientSide) { + if (this.by > 150 && this.by % 5 == 0 && flag) { - i = 1000; + i = this.expToDrop / 12; // CraftBukkit - drop experience as dragon falls from sky. use experience drop from death event. This is now set in getExpReward() while (i > 0) { j = EntityExperienceOrb.getOrbValue(i); -@@ -488,14 +565,30 @@ +@@ -494,7 +571,23 @@ } - if (this.bw == 1) { + if (this.by == 1) { - this.world.a(1018, new BlockPosition(this), 0); + // CraftBukkit start - Use relative location for far away sounds + // this.world.a(1018, new BlockPosition(this), 0); + int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; -+ for (EntityPlayer player : (List) this.world.players) { ++ for (EntityPlayer player : (List) (List) this.world.players) { + double deltaX = this.locX - player.locX; + double deltaZ = this.locZ - player.locZ; + double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; @@ -232,25 +182,26 @@ } } - this.move(0.0D, 0.10000000149011612D, 0.0D); - this.aG = this.yaw += 20.0F; - if (this.bw == 200 && !this.world.isStatic) { -- i = 2000; -+ i = this.expToDrop - (10 * this.expToDrop / 12); // CraftBukkit - drop the remaining experience +@@ -502,7 +595,7 @@ + this.aI = this.yaw += 20.0F; + if (this.by == 200 && !this.world.isClientSide) { + if (flag) { +- i = 2000; ++ i = this.expToDrop - (10 * this.expToDrop / 12); // CraftBukkit - drop the remaining experience - while (i > 0) { - j = EntityExperienceOrb.getOrbValue(i); -@@ -513,6 +606,9 @@ - boolean flag = true; + while (i > 0) { + j = EntityExperienceOrb.getOrbValue(i); +@@ -522,6 +615,9 @@ double d0 = 12.25D; double d1 = 6.25D; -+ + + // CraftBukkit start - Replace any "this.world" in the following with just "world"! + BlockStateListPopulator world = new BlockStateListPopulator(this.world.getWorld()); - ++ for (int i = -1; i <= 32; ++i) { for (int j = -4; j <= 4; ++j) { -@@ -524,31 +620,51 @@ + for (int k = -4; k <= 4; ++k) { +@@ -532,31 +628,51 @@ if (i < 0) { if (d2 <= 6.25D) { @@ -315,8 +266,8 @@ } protected void D() {} -@@ -576,4 +692,12 @@ - protected float bA() { +@@ -584,4 +700,12 @@ + protected float bB() { return 5.0F; } + diff --git a/nms-patches/EntityEnderPearl.patch b/nms-patches/EntityEnderPearl.patch index 1eeddb3a1c..645715b868 100644 --- a/nms-patches/EntityEnderPearl.patch +++ b/nms-patches/EntityEnderPearl.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/EntityEnderPearl.java 2015-01-05 10:11:38.333916086 +1100 -+++ src/main/java/net/minecraft/server/EntityEnderPearl.java 2015-01-05 10:11:38.333916086 +1100 -@@ -1,7 +1,20 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityEnderPearl.java 2015-02-26 22:40:22.523608140 +0000 ++++ src/main/java/net/minecraft/server/EntityEnderPearl.java 2015-02-26 22:40:22.523608140 +0000 +@@ -1,5 +1,11 @@ package net.minecraft.server; +// CraftBukkit start @@ -11,24 +11,13 @@ + public class EntityEnderPearl extends EntityProjectile { -+ // CraftBukkit start -+ // This is backported from 1.8.1 -+ public EntityEnderPearl(World world) { -+ super(world); -+ } -+ // CraftBukkit end -+ - public EntityEnderPearl(World world, EntityLiving entityliving) { - super(world, entityliving); - } -@@ -29,14 +42,28 @@ - entityendermite.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch); + private EntityLiving c; +@@ -41,13 +47,27 @@ this.world.addEntity(entityendermite); } -- -- if (entityliving.av()) { + +- if (entityliving.au()) { - entityliving.mount((Entity) null); -+ + // CraftBukkit start - Fire PlayerTeleportEvent + org.bukkit.craftbukkit.entity.CraftPlayer player = entityplayer.getBukkitEntity(); + org.bukkit.Location location = getBukkitEntity().getLocation(); @@ -39,7 +28,7 @@ + Bukkit.getPluginManager().callEvent(teleEvent); + + if (!teleEvent.isCancelled() && !entityplayer.playerConnection.isDisconnected()) { -+ if (entityliving.av()) { ++ if (entityliving.au()) { + entityliving.mount((Entity) null); + } + @@ -55,5 +44,5 @@ - entityliving.damageEntity(DamageSource.FALL, 5.0F); + // CraftBukkit end } - } - + } else if (entityliving != null) { + entityliving.enderTeleportTo(this.locX, this.locY, this.locZ); diff --git a/nms-patches/EntityEnderman.patch b/nms-patches/EntityEnderman.patch index 7ae2611f81..95914e9110 100644 --- a/nms-patches/EntityEnderman.patch +++ b/nms-patches/EntityEnderman.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityEnderman.java 2014-11-28 17:43:43.085707435 +0000 -+++ src/main/java/net/minecraft/server/EntityEnderman.java 2014-11-28 17:38:21.000000000 +0000 -@@ -4,6 +4,12 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityEnderman.java 2015-02-26 22:40:22.519608140 +0000 ++++ src/main/java/net/minecraft/server/EntityEnderman.java 2015-02-26 22:40:22.519608140 +0000 +@@ -8,6 +8,12 @@ import java.util.Set; import java.util.UUID; @@ -12,8 +12,8 @@ + public class EntityEnderman extends EntityMonster { - private static final UUID b = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0"); -@@ -165,7 +171,17 @@ + private static final UUID a = UUID.fromString("020E0DFB-87AE-4653-9556-831010E291A0"); +@@ -177,7 +183,17 @@ } if (flag1) { @@ -32,3 +32,31 @@ if (this.world.getCubes(this, this.getBoundingBox()).isEmpty() && !this.world.containsLiquid(this.getBoundingBox())) { flag = true; } +@@ -333,8 +349,12 @@ + Block block = iblockdata.getBlock(); + + if (EntityEnderman.c.contains(block)) { +- this.enderman.setCarried(iblockdata); +- world.setTypeUpdate(blockposition, Blocks.AIR.getBlockData()); ++ // CraftBukkit start - Pickup event ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, this.enderman.world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), org.bukkit.Material.AIR).isCancelled()) { ++ this.enderman.setCarried(iblockdata); ++ world.setTypeUpdate(blockposition, Blocks.AIR.getBlockData()); ++ } ++ // CraftBukkit end + } + + } +@@ -363,8 +383,12 @@ + Block block1 = world.getType(blockposition.down()).getBlock(); + + if (this.a(world, blockposition, this.a.getCarried().getBlock(), block, block1)) { ++ // CraftBukkit start - Place event ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.a.getCarried().getBlock(), this.a.getCarried().getBlock().toLegacyData(this.a.getCarried())).isCancelled()) { + world.setTypeAndData(blockposition, this.a.getCarried(), 3); + this.a.setCarried(Blocks.AIR.getBlockData()); ++ } ++ // CraftBukkit end + } + + } diff --git a/nms-patches/EntityExperienceOrb.patch b/nms-patches/EntityExperienceOrb.patch index 8e2a316c66..b1ff63adef 100644 --- a/nms-patches/EntityExperienceOrb.patch +++ b/nms-patches/EntityExperienceOrb.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityExperienceOrb.java 2014-11-28 17:43:43.089707435 +0000 -+++ src/main/java/net/minecraft/server/EntityExperienceOrb.java 2014-11-28 17:38:20.000000000 +0000 -@@ -1,5 +1,11 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityExperienceOrb.java 2015-02-26 22:40:22.527608140 +0000 ++++ src/main/java/net/minecraft/server/EntityExperienceOrb.java 2015-02-26 22:40:22.527608140 +0000 +@@ -1,12 +1,18 @@ package net.minecraft.server; +// CraftBukkit start @@ -12,10 +12,18 @@ public class EntityExperienceOrb extends Entity { public int a; + public int b; + public int c; + private int d = 5; +- private int value; ++ public int value; // CraftBukkit - public + private EntityHuman targetPlayer; + private int targetTime; + @@ -34,6 +40,7 @@ - public void s_() { - super.s_(); + public void t_() { + super.t_(); + EntityHuman prevTarget = this.targetPlayer;// CraftBukkit - store old target if (this.c > 0) { --this.c; @@ -47,7 +55,7 @@ this.move(this.motX, this.motY, this.motZ); @@ -141,7 +160,7 @@ - entityhuman.bn = 2; + entityhuman.bp = 2; this.world.makeSound(entityhuman, "random.orb", 0.1F, 0.5F * ((this.random.nextFloat() - this.random.nextFloat()) * 0.7F + 1.8F)); entityhuman.receive(this, 1); - entityhuman.giveExp(this.value); diff --git a/nms-patches/EntityFallingBlock.patch b/nms-patches/EntityFallingBlock.patch index 94dd8f8a80..69e41ab077 100644 --- a/nms-patches/EntityFallingBlock.patch +++ b/nms-patches/EntityFallingBlock.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityFallingBlock.java 2014-11-28 17:43:43.089707435 +0000 -+++ src/main/java/net/minecraft/server/EntityFallingBlock.java 2014-11-28 17:38:20.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityFallingBlock.java 2015-02-26 22:40:22.531608140 +0000 ++++ src/main/java/net/minecraft/server/EntityFallingBlock.java 2015-02-26 22:40:22.531608140 +0000 @@ -4,6 +4,8 @@ import java.util.ArrayList; import java.util.Iterator; @@ -8,7 +8,7 @@ + public class EntityFallingBlock extends Entity { - public IBlockData block; + private IBlockData block; @@ -56,7 +58,7 @@ if (this.ticksLived++ == 0) { @@ -16,23 +16,23 @@ - if (this.world.getType(blockposition).getBlock() == block) { + if (this.world.getType(blockposition).getBlock() == block && !CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) { this.world.setAir(blockposition); - } else if (!this.world.isStatic) { + } else if (!this.world.isClientSide) { this.die(); -@@ -77,7 +79,12 @@ - this.motY *= -0.5D; +@@ -78,7 +80,12 @@ if (this.world.getType(blockposition).getBlock() != Blocks.PISTON_EXTENSION) { this.die(); -- if (!this.e && this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null, (ItemStack) null) && !BlockFalling.canFall(this.world, blockposition.down()) && this.world.setTypeAndData(blockposition, this.block, 3)) { -+ if (!this.e && this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null, (ItemStack) null) && !BlockFalling.canFall(this.world, blockposition.down()) /* mimic the false conditions of setTypeIdAndData */ && blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000 && blockposition.getY() >= 0 && blockposition.getY() < 256 && this.world.getType(blockposition) != this.block) { -+ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.block.getBlock(), this.block.getBlock().toLegacyData(this.block)).isCancelled()) { -+ return; -+ } -+ this.world.setTypeAndData(blockposition, this.block, 3); -+ // CraftBukkit end - if (block instanceof BlockFalling) { - ((BlockFalling) block).a_(this.world, blockposition); - } -@@ -135,7 +142,9 @@ + if (!this.e) { +- if (this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null, (ItemStack) null) && !BlockFalling.canFall(this.world, blockposition.down()) && this.world.setTypeAndData(blockposition, this.block, 3)) { ++ if (this.world.a(block, blockposition, true, EnumDirection.UP, (Entity) null, (ItemStack) null) && !BlockFalling.canFall(this.world, blockposition.down()) /* mimic the false conditions of setTypeIdAndData */ && blockposition.getX() >= -30000000 && blockposition.getZ() >= -30000000 && blockposition.getX() < 30000000 && blockposition.getZ() < 30000000 && blockposition.getY() >= 0 && blockposition.getY() < 256 && this.world.getType(blockposition) != this.block) { ++ if (CraftEventFactory.callEntityChangeBlockEvent(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.block.getBlock(), this.block.getBlock().toLegacyData(this.block)).isCancelled()) { ++ return; ++ } ++ this.world.setTypeAndData(blockposition, this.block, 3); ++ // CraftBukkit end + if (block instanceof BlockFalling) { + ((BlockFalling) block).a_(this.world, blockposition); + } +@@ -137,7 +144,9 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); diff --git a/nms-patches/EntityFireball.patch b/nms-patches/EntityFireball.patch index baa9bf9ca9..574080a2a5 100644 --- a/nms-patches/EntityFireball.patch +++ b/nms-patches/EntityFireball.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/EntityFireball.java 2014-12-13 12:33:58.972937612 +0000 -+++ src/main/java/net/minecraft/server/EntityFireball.java 2014-12-13 12:33:51.392937694 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityFireball.java 2015-02-26 22:40:22.535608140 +0000 ++++ src/main/java/net/minecraft/server/EntityFireball.java 2015-02-26 22:40:22.535608140 +0000 @@ -2,6 +2,8 @@ import java.util.List; @@ -23,7 +23,7 @@ super(world); this.shooter = entityliving; + this.projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit - this.a(1.0F, 1.0F); + this.setSize(1.0F, 1.0F); this.setPositionRotation(entityliving.locX, entityliving.locY, entityliving.locZ, entityliving.yaw, entityliving.pitch); this.setPosition(this.locX, this.locY, this.locZ); this.motX = this.motY = this.motZ = 0.0D; @@ -36,15 +36,6 @@ d0 += this.random.nextGaussian() * 0.4D; d1 += this.random.nextGaussian() * 0.4D; d2 += this.random.nextGaussian() * 0.4D; -@@ -101,7 +112,7 @@ - MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); - - if (movingobjectposition1 != null) { -- double d1 = vec3d.f(movingobjectposition1.pos); -+ double d1 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - distance efficiency - - if (d1 < d0 || d0 == 0.0D) { - entity = entity1; @@ -117,6 +128,12 @@ if (movingobjectposition != null) { @@ -79,7 +70,7 @@ + this.dirX = nbttaglist.d(0); + this.dirY = nbttaglist.d(1); + this.dirZ = nbttaglist.d(2); -+ } else if (nbttagcompound.hasKeyOfType("direction", 9)) { ++ } else if (nbttagcompound.hasKeyOfType("direction", 9)) { NBTTagList nbttaglist = nbttagcompound.getList("direction", 6); this.motX = nbttaglist.d(0); diff --git a/nms-patches/EntityFireworks.patch b/nms-patches/EntityFireworks.patch new file mode 100644 index 0000000000..b581aa35a9 --- /dev/null +++ b/nms-patches/EntityFireworks.patch @@ -0,0 +1,11 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityFireworks.java 2015-02-26 22:40:22.539608140 +0000 ++++ src/main/java/net/minecraft/server/EntityFireworks.java 2015-02-26 22:40:22.539608140 +0000 +@@ -3,7 +3,7 @@ + public class EntityFireworks extends Entity { + + private int ticksFlown; +- private int expectedLifespan; ++ public int expectedLifespan; // CraftBukkit - public + + public EntityFireworks(World world) { + super(world); diff --git a/nms-patches/EntityFishingHook.patch b/nms-patches/EntityFishingHook.patch index cf4c57277b..995168809d 100644 --- a/nms-patches/EntityFishingHook.patch +++ b/nms-patches/EntityFishingHook.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityFishingHook.java 2014-11-28 17:43:43.093707435 +0000 -+++ src/main/java/net/minecraft/server/EntityFishingHook.java 2014-11-28 17:38:20.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityFishingHook.java 2015-02-26 22:40:22.543608140 +0000 ++++ src/main/java/net/minecraft/server/EntityFishingHook.java 2015-02-26 22:40:22.543608140 +0000 @@ -3,6 +3,12 @@ import java.util.Arrays; import java.util.List; @@ -12,16 +12,7 @@ + public class EntityFishingHook extends Entity { - private static final List d = Arrays.asList(new PossibleFishingResult[] { (new PossibleFishingResult(new ItemStack(Items.LEATHER_BOOTS), 10)).a(0.9F), new PossibleFishingResult(new ItemStack(Items.LEATHER), 10), new PossibleFishingResult(new ItemStack(Items.BONE), 10), new PossibleFishingResult(new ItemStack(Items.POTION), 10), new PossibleFishingResult(new ItemStack(Items.STRING), 5), (new PossibleFishingResult(new ItemStack(Items.FISHING_ROD), 2)).a(0.9F), new PossibleFishingResult(new ItemStack(Items.BOWL), 10), new PossibleFishingResult(new ItemStack(Items.STICK), 5), new PossibleFishingResult(new ItemStack(Items.DYE, 10, EnumColor.BLACK.getInvColorIndex()), 1), new PossibleFishingResult(new ItemStack(Blocks.TRIPWIRE_HOOK), 10), new PossibleFishingResult(new ItemStack(Items.ROTTEN_FLESH), 10)}); -@@ -168,7 +174,7 @@ - MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); - - if (movingobjectposition1 != null) { -- d6 = vec3d.f(movingobjectposition1.pos); -+ d6 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - distance efficiency - if (d6 < d5 || d5 == 0.0D) { - entity = entity1; - d5 = d6; + private static final List d = Arrays.asList(new PossibleFishingResult[] { (new PossibleFishingResult(new ItemStack(Items.LEATHER_BOOTS), 10)).a(0.9F), new PossibleFishingResult(new ItemStack(Items.LEATHER), 10), new PossibleFishingResult(new ItemStack(Items.BONE), 10), new PossibleFishingResult(new ItemStack(Items.POTION), 10), new PossibleFishingResult(new ItemStack(Items.STRING), 5), (new PossibleFishingResult(new ItemStack(Items.FISHING_ROD), 2)).a(0.9F), new PossibleFishingResult(new ItemStack(Items.BOWL), 10), new PossibleFishingResult(new ItemStack(Items.STICK), 5), new PossibleFishingResult(new ItemStack(Items.DYE, 10, EnumColor.BLACK.getInvColorIndex()), 1), new PossibleFishingResult(new ItemStack(Blocks.TRIPWIRE_HOOK), 10), new PossibleFishingResult(new ItemStack(Items.ROTTEN_FLESH), 10)}); @@ -182,6 +188,7 @@ } @@ -30,67 +21,7 @@ if (movingobjectposition.entity != null) { if (movingobjectposition.entity.damageEntity(DamageSource.projectile(this, this.owner), 0.0F)) { this.hooked = movingobjectposition.entity; -@@ -261,8 +268,8 @@ - } else { - float f3; - float f4; -- double d11; - float f5; -+ double d11; - double d12; - - if (this.av > 0) { -@@ -277,20 +284,20 @@ - } else { - this.aw = (float) ((double) this.aw + this.random.nextGaussian() * 4.0D); - f3 = this.aw * 0.017453292F; -- f5 = MathHelper.sin(f3); -- f4 = MathHelper.cos(f3); -- d8 = this.locX + (double) (f5 * (float) this.av * 0.1F); -- d12 = (double) ((float) MathHelper.floor(this.getBoundingBox().b) + 1.0F); -- d11 = this.locZ + (double) (f4 * (float) this.av * 0.1F); -+ f4 = MathHelper.sin(f3); -+ f5 = MathHelper.cos(f3); -+ d8 = this.locX + (double) (f4 * (float) this.av * 0.1F); -+ d11 = (double) ((float) MathHelper.floor(this.getBoundingBox().b) + 1.0F); -+ d12 = this.locZ + (double) (f5 * (float) this.av * 0.1F); - if (this.random.nextFloat() < 0.15F) { -- worldserver.a(EnumParticle.WATER_BUBBLE, d8, d12 - 0.10000000149011612D, d11, 1, (double) f5, 0.1D, (double) f4, 0.0D, new int[0]); -+ worldserver.a(EnumParticle.WATER_BUBBLE, d8, d11 - 0.10000000149011612D, d12, 1, (double) f4, 0.1D, (double) f5, 0.0D, new int[0]); - } - -- float f6 = f5 * 0.04F; -- float f7 = f4 * 0.04F; -+ float f6 = f4 * 0.04F; -+ float f7 = f5 * 0.04F; - -- worldserver.a(EnumParticle.WATER_WAKE, d8, d12, d11, 0, (double) f7, 0.01D, (double) (-f6), 1.0D, new int[0]); -- worldserver.a(EnumParticle.WATER_WAKE, d8, d12, d11, 0, (double) (-f7), 0.01D, (double) f6, 1.0D, new int[0]); -+ worldserver.a(EnumParticle.WATER_WAKE, d8, d11, d12, 0, (double) f7, 0.01D, (double) (-f6), 1.0D, new int[0]); -+ worldserver.a(EnumParticle.WATER_WAKE, d8, d11, d12, 0, (double) (-f7), 0.01D, (double) f6, 1.0D, new int[0]); - } - } else if (this.au > 0) { - this.au -= k; -@@ -304,12 +311,12 @@ - } - - if (this.random.nextFloat() < f3) { -- f5 = MathHelper.a(this.random, 0.0F, 360.0F) * 0.017453292F; -- f4 = MathHelper.a(this.random, 25.0F, 60.0F); -- d8 = this.locX + (double) (MathHelper.sin(f5) * f4 * 0.1F); -- d12 = (double) ((float) MathHelper.floor(this.getBoundingBox().b) + 1.0F); -- d11 = this.locZ + (double) (MathHelper.cos(f5) * f4 * 0.1F); -- worldserver.a(EnumParticle.WATER_SPLASH, d8, d12, d11, 2 + this.random.nextInt(2), 0.10000000149011612D, 0.0D, 0.10000000149011612D, 0.0D, new int[0]); -+ f4 = MathHelper.a(this.random, 0.0F, 360.0F) * 0.017453292F; -+ f5 = MathHelper.a(this.random, 25.0F, 60.0F); -+ d8 = this.locX + (double) (MathHelper.sin(f4) * f5 * 0.1F); -+ d11 = (double) ((float) MathHelper.floor(this.getBoundingBox().b) + 1.0F); -+ d12 = this.locZ + (double) (MathHelper.cos(f4) * f5 * 0.1F); -+ worldserver.a(EnumParticle.WATER_SPLASH, d8, d11, d12, 2 + this.random.nextInt(2), 0.10000000149011612D, 0.0D, 0.10000000149011612D, 0.0D, new int[0]); - } - - if (this.au <= 0) { -@@ -374,6 +381,15 @@ +@@ -381,6 +388,15 @@ byte b0 = 0; if (this.hooked != null) { @@ -106,9 +37,9 @@ double d0 = this.owner.locX - this.locX; double d1 = this.owner.locY - this.locY; double d2 = this.owner.locZ - this.locZ; -@@ -386,6 +402,16 @@ +@@ -393,6 +409,15 @@ b0 = 3; - } else if (this.at > 0) { + } else if (this.av > 0) { EntityItem entityitem = new EntityItem(this.world, this.locX, this.locY, this.locZ, this.m()); + // CraftBukkit start + PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), entityitem.getBukkitEntity(), (Fish) this.getBukkitEntity(), PlayerFishEvent.State.CAUGHT_FISH); @@ -119,11 +50,10 @@ + return 0; + } + // CraftBukkit end -+ double d5 = this.owner.locX - this.locX; double d6 = this.owner.locY - this.locY; double d7 = this.owner.locZ - this.locZ; -@@ -396,13 +422,32 @@ +@@ -403,14 +428,33 @@ entityitem.motY = d6 * d9 + (double) MathHelper.sqrt(d8) * 0.08D; entityitem.motZ = d7 * d9; this.world.addEntity(entityitem); @@ -133,7 +63,7 @@ b0 = 1; } - if (this.aq) { + if (this.as) { + // CraftBukkit start + PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.IN_GROUND); + this.world.getServer().getPluginManager().callEvent(playerFishEvent); @@ -144,7 +74,7 @@ + // CraftBukkit end b0 = 2; } -+ + + // CraftBukkit start + if (b0 == 0) { + PlayerFishEvent playerFishEvent = new PlayerFishEvent((Player) this.owner.getBukkitEntity(), null, (Fish) this.getBukkitEntity(), PlayerFishEvent.State.FAILED_ATTEMPT); @@ -154,6 +84,7 @@ + } + } + // CraftBukkit end - ++ this.die(); this.owner.hookedFish = null; + return b0; diff --git a/nms-patches/EntityGhast.patch b/nms-patches/EntityGhast.patch new file mode 100644 index 0000000000..696243a557 --- /dev/null +++ b/nms-patches/EntityGhast.patch @@ -0,0 +1,13 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityGhast.java 2015-02-26 22:40:22.547608140 +0000 ++++ src/main/java/net/minecraft/server/EntityGhast.java 2015-02-26 22:40:22.547608140 +0000 +@@ -162,7 +162,9 @@ + world.a((EntityHuman) null, 1008, new BlockPosition(this.b), 0); + EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.b, d2, d3, d4); + +- entitylargefireball.yield = this.b.cf(); ++ ++ // CraftBukkit - set bukkitYield when setting explosionpower ++ entitylargefireball.bukkitYield = entitylargefireball.yield = this.b.cf(); + entitylargefireball.locX = this.b.locX + vec3d.a * d1; + entitylargefireball.locY = this.b.locY + (double) (this.b.length / 2.0F) + 0.5D; + entitylargefireball.locZ = this.b.locZ + vec3d.c * d1; diff --git a/nms-patches/EntityGuardian.patch b/nms-patches/EntityGuardian.patch index 8c419e560c..cd30ff32d7 100644 --- a/nms-patches/EntityGuardian.patch +++ b/nms-patches/EntityGuardian.patch @@ -1,21 +1,29 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityGuardian.java Thu Dec 11 13:57:14 2014 -+++ src/main/java/net/minecraft/server/EntityGuardian.java Thu Dec 11 13:55:14 2014 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityGuardian.java 2015-02-26 22:40:22.551608140 +0000 ++++ src/main/java/net/minecraft/server/EntityGuardian.java 2015-02-26 22:40:22.551608140 +0000 @@ -14,7 +14,7 @@ - private EntityLiving bn; - private int bo; - private boolean bp; -- private PathfinderGoalRandomStroll bq; -+ public PathfinderGoalRandomStroll bq; // CraftBukkit - private to public + private EntityLiving bo; + private int bp; + private boolean bq; +- private PathfinderGoalRandomStroll br; ++ public PathfinderGoalRandomStroll br; // CraftBukkit - public public EntityGuardian(World world) { super(world); -@@ -35,7 +35,8 @@ - this.c = this.b = this.random.nextFloat(); +@@ -35,7 +35,7 @@ + this.b = this.a = this.random.nextFloat(); } -- protected void aW() { -+ // PAIL: Access + rename please -+ public void aW() { // CraftBukkit - protected to public - super.aW(); +- protected void initAttributes() { ++ public void initAttributes() { // CraftBukkit - public + super.initAttributes(); this.getAttributeInstance(GenericAttributes.e).setValue(6.0D); this.getAttributeInstance(GenericAttributes.d).setValue(0.5D); +@@ -516,7 +516,7 @@ + return (entityliving instanceof EntityHuman || entityliving instanceof EntitySquid) && entityliving.h(this.a) > 9.0D; + } + +- public boolean apply(Object object) { ++ public boolean apply(EntityLiving object) { // CraftBukkit - fix decompile error + return this.a((EntityLiving) object); + } + } diff --git a/nms-patches/EntityHanging.patch b/nms-patches/EntityHanging.patch index 1bdeaf3522..101b73358f 100644 --- a/nms-patches/EntityHanging.patch +++ b/nms-patches/EntityHanging.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityHanging.java Mon Dec 15 15:33:27 2014 -+++ src/main/java/net/minecraft/server/EntityHanging.java Mon Dec 15 15:33:27 2014 -@@ -4,6 +4,13 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityHanging.java 2015-02-26 22:40:22.555608140 +0000 ++++ src/main/java/net/minecraft/server/EntityHanging.java 2015-02-26 22:40:22.555608140 +0000 +@@ -4,10 +4,17 @@ import java.util.List; import org.apache.commons.lang3.Validate; @@ -14,11 +14,25 @@ public abstract class EntityHanging extends Entity { private int c; -@@ -30,30 +37,35 @@ - this.o(); +- protected BlockPosition blockPosition; ++ public BlockPosition blockPosition; // CraftBukkit - public + public EnumDirection direction; + + public EntityHanging(World world) { +@@ -22,7 +29,7 @@ + + protected void h() {} + +- protected void setDirection(EnumDirection enumdirection) { ++ public void setDirection(EnumDirection enumdirection) { // CraftBukkit - public + Validate.notNull(enumdirection); + Validate.isTrue(enumdirection.k().c()); + this.direction = enumdirection; +@@ -30,30 +37,34 @@ + this.updateBoundingBox(); } -- private void o() { +- private void updateBoundingBox() { - if (this.direction != null) { - double d0 = (double) this.blockPosition.getX() + 0.5D; - double d1 = (double) this.blockPosition.getY() + 0.5D; @@ -57,30 +71,27 @@ - double d6 = (double) this.l(); - double d7 = (double) this.m(); - double d8 = (double) this.l(); - -- if (this.direction.k() == EnumAxis.Z) { + double d6 = (double) width; + double d7 = (double) height; + double d8 = (double) width; -+ -+ if (direction.k() == EnumAxis.Z) { + +- if (this.direction.k() == EnumDirection.EnumAxis.Z) { ++ if (direction.k() == EnumDirection.EnumAxis.Z) { d8 = 1.0D; } else { d6 = 1.0D; -@@ -62,7 +74,20 @@ +@@ -62,7 +73,18 @@ d6 /= 32.0D; d7 /= 32.0D; d8 /= 32.0D; - this.a(new AxisAlignedBB(d0 - d6, d1 - d7, d2 - d8, d0 + d6, d1 + d7, d2 + d8)); + return new AxisAlignedBB(d0 - d6, d1 - d7, d2 - d8, d0 + d6, d1 + d7, d2 + d8); + } -+ // CraftBukkit end + -+ // PAIL: rename -+ private void o() { ++ private void updateBoundingBox() { + if (this.direction != null) { + // CraftBukkit start code moved in to calculateBoundingBox -+ AxisAlignedBB bb = calculateBoundingBox(this.blockPosition,this.direction,this.l(),this.m()); ++ AxisAlignedBB bb = calculateBoundingBox(this.blockPosition, this.direction, this.l(), this.m()); + this.locX = (bb.a + bb.d) / 2.0D; + this.locY = (bb.b + bb.e) / 2.0D; + this.locZ = (bb.c + bb.f) / 2.0D; @@ -89,8 +100,8 @@ } } -@@ -77,6 +102,33 @@ - if (this.c++ == 100 && !this.world.isStatic) { +@@ -77,6 +99,32 @@ + if (this.c++ == 100 && !this.world.isClientSide) { this.c = 0; if (!this.dead && !this.survives()) { + // CraftBukkit start - fire break events @@ -119,14 +130,13 @@ + return; + } + // CraftBukkit end -+ this.die(); this.b((Entity) null); } -@@ -138,6 +190,32 @@ +@@ -138,6 +186,32 @@ return false; } else { - if (!this.dead && !this.world.isStatic) { + if (!this.dead && !this.world.isClientSide) { + // CraftBukkit start - fire break events + HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.DEFAULT); + PaintingBreakEvent paintingEvent = null; @@ -156,10 +166,10 @@ this.die(); this.ac(); this.b(damagesource.getEntity()); -@@ -149,6 +227,18 @@ +@@ -149,6 +223,18 @@ public void move(double d0, double d1, double d2) { - if (!this.world.isStatic && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { + if (!this.world.isClientSide && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { + if (this.dead) return; // CraftBukkit + + // CraftBukkit start - fire break events @@ -171,16 +181,16 @@ + return; + } + // CraftBukkit end -+ ++ this.die(); this.b((Entity) null); } -@@ -156,7 +246,7 @@ +@@ -156,7 +242,7 @@ } public void g(double d0, double d1, double d2) { -- if (!this.world.isStatic && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { -+ if (false && !this.world.isStatic && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { // CraftBukkit - not needed +- if (!this.world.isClientSide && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { ++ if (false && !this.world.isClientSide && !this.dead && d0 * d0 + d1 * d1 + d2 * d2 > 0.0D) { // CraftBukkit - not needed this.die(); this.b((Entity) null); } diff --git a/nms-patches/EntityHorse.patch b/nms-patches/EntityHorse.patch index 048f5af27d..64ea2f24d5 100644 --- a/nms-patches/EntityHorse.patch +++ b/nms-patches/EntityHorse.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityHorse.java 2014-12-02 17:52:23.625823043 +0000 -+++ src/main/java/net/minecraft/server/EntityHorse.java 2014-12-02 17:51:30.837824215 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityHorse.java 2015-02-26 22:40:22.559608140 +0000 ++++ src/main/java/net/minecraft/server/EntityHorse.java 2015-02-26 22:40:22.563608140 +0000 @@ -4,6 +4,8 @@ import java.util.Iterator; import java.util.List; @@ -8,32 +8,51 @@ + public class EntityHorse extends EntityAnimal implements IInventoryListener { - private static final Predicate bq = new EntitySelectorHorse(); -@@ -36,6 +38,7 @@ - private String bM; - private String[] bN = new String[3]; - private boolean bO = false; + private static final Predicate bs = new Predicate() { +@@ -15,7 +17,7 @@ + return this.a((Entity) object); + } + }; +- private static final IAttribute attributeJumpStrength = (new AttributeRanged((IAttribute) null, "horse.jumpStrength", 0.7D, 0.0D, 2.0D)).a("Jump Strength").a(true); ++ public static final IAttribute attributeJumpStrength = (new AttributeRanged((IAttribute) null, "horse.jumpStrength", 0.7D, 0.0D, 2.0D)).a("Jump Strength").a(true); // CraftBukkit - public + private static final String[] bu = new String[] { null, "textures/entity/horse/armor/horse_armor_iron.png", "textures/entity/horse/armor/horse_armor_gold.png", "textures/entity/horse/armor/horse_armor_diamond.png"}; + private static final String[] bv = new String[] { "", "meo", "goo", "dio"}; + private static final int[] bw = new int[] { 0, 5, 7, 11}; +@@ -29,7 +31,7 @@ + public int bm; + public int bo; + protected boolean bp; +- private InventoryHorseChest inventoryChest; ++ public InventoryHorseChest inventoryChest; // CraftBukkit - public + private boolean bF; + protected int bq; + protected float br; +@@ -44,6 +46,7 @@ + private String bO; + private String[] bP = new String[3]; + private boolean bQ = false; + public int maxDomestication = 100; // CraftBukkit - store max domestication value public EntityHorse(World world) { super(world); -@@ -314,13 +317,13 @@ - private int cX() { +@@ -320,13 +323,13 @@ + private int cZ() { int i = this.getType(); - return this.hasChest() && (i == 1 || i == 2) ? 17 : 2; + return this.hasChest() /* && (i == 1 || i == 2) */ ? 17 : 2; // CraftBukkit - Remove type check } - public void loadChest() { +- private void loadChest() { ++ public void loadChest() { // CraftBukkit - public InventoryHorseChest inventoryhorsechest = this.inventoryChest; -- this.inventoryChest = new InventoryHorseChest("HorseChest", this.cX()); -+ this.inventoryChest = new InventoryHorseChest("HorseChest", this.cX(), this); // CraftBukkit - add this horse +- this.inventoryChest = new InventoryHorseChest("HorseChest", this.cZ()); ++ this.inventoryChest = new InventoryHorseChest("HorseChest", this.cZ(), this); // CraftBukkit - add this horse this.inventoryChest.a(this.getName()); if (inventoryhorsechest != null) { inventoryhorsechest.b(this); -@@ -485,7 +488,7 @@ +@@ -491,7 +494,7 @@ } public int getMaxDomestication() { @@ -41,8 +60,8 @@ + return this.maxDomestication; // CraftBukkit - return stored max domestication instead of 100 } - protected float bA() { -@@ -585,7 +588,7 @@ + protected float bB() { +@@ -591,7 +594,7 @@ } if (this.getHealth() < this.getMaxHealth() && f > 0.0F) { @@ -51,12 +70,12 @@ flag = true; } -@@ -692,11 +695,24 @@ +@@ -698,11 +701,24 @@ public void die(DamageSource damagesource) { super.die(damagesource); + /* CraftBukkit start - Handle chest dropping in dropDeathLoot below - if (!this.world.isStatic) { + if (!this.world.isClientSide) { this.dropChest(); } + // CraftBukkit end */ @@ -68,7 +87,7 @@ + super.dropDeathLoot(flag, i); + + // Moved from die method above -+ if (!this.world.isStatic) { ++ if (!this.world.isClientSide) { + this.dropChest(); + } } @@ -76,16 +95,16 @@ public void m() { if (this.random.nextInt(200) == 0) { -@@ -706,7 +722,7 @@ +@@ -712,7 +728,7 @@ super.m(); - if (!this.world.isStatic) { + if (!this.world.isClientSide) { if (this.random.nextInt(900) == 0 && this.deathTicks == 0) { - this.heal(1.0F); + this.heal(1.0F, RegainReason.REGEN); // CraftBukkit } - if (!this.cw() && this.passenger == null && this.random.nextInt(300) == 0 && this.world.getType(new BlockPosition(MathHelper.floor(this.locX), MathHelper.floor(this.locY) - 1, MathHelper.floor(this.locZ))).getBlock() == Blocks.GRASS) { -@@ -949,6 +965,7 @@ + if (!this.cy() && this.passenger == null && this.random.nextInt(300) == 0 && this.world.getType(new BlockPosition(MathHelper.floor(this.locX), MathHelper.floor(this.locY) - 1, MathHelper.floor(this.locZ))).getBlock() == Blocks.GRASS) { +@@ -955,6 +971,7 @@ nbttagcompound.setInt("Temper", this.getTemper()); nbttagcompound.setBoolean("Tame", this.isTame()); nbttagcompound.setString("OwnerUUID", this.getOwnerUUID()); @@ -93,7 +112,7 @@ if (this.hasChest()) { NBTTagList nbttaglist = new NBTTagList(); -@@ -1001,6 +1018,12 @@ +@@ -1007,6 +1024,12 @@ this.setOwnerUUID(s); } @@ -106,35 +125,34 @@ AttributeInstance attributeinstance = this.getAttributeMap().a("Speed"); if (attributeinstance != null) { -@@ -1166,18 +1189,25 @@ +@@ -1172,18 +1195,25 @@ public void v(int i) { - if (this.cE()) { + if (this.cG()) { + // CraftBukkit start - fire HorseJumpEvent, use event power if (i < 0) { i = 0; - } else { -- this.bE = true; -- this.df(); +- this.bG = true; +- this.dh(); } -- -+ + + float power; if (i >= 90) { -- this.bp = 1.0F; +- this.br = 1.0F; + power = 1.0F; } else { -- this.bp = 0.4F + 0.4F * (float) i / 90.0F; +- this.br = 0.4F + 0.4F * (float) i / 90.0F; + power = 0.4F + 0.4F * (float) i / 90.0F; + } -+ ++ + org.bukkit.event.entity.HorseJumpEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callHorseJumpEvent(this, power); -+ if (!event.isCancelled()) { -+ this.bE = true; -+ this.df(); -+ this.bp = power; ++ if (!event.isCancelled()) { ++ this.bG = true; ++ this.dh(); ++ this.br = power; } -+ // CraftBukkit end ++ // CraftBukkit end } } diff --git a/nms-patches/EntityHuman.patch b/nms-patches/EntityHuman.patch index ba6c4d5ae9..0fa09eba5d 100644 --- a/nms-patches/EntityHuman.patch +++ b/nms-patches/EntityHuman.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/EntityHuman.java 2014-12-13 22:35:14.800546027 +0000 -+++ src/main/java/net/minecraft/server/EntityHuman.java 2014-12-13 22:34:55.728546234 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityHuman.java 2015-02-26 22:40:22.567608140 +0000 ++++ src/main/java/net/minecraft/server/EntityHuman.java 2015-02-26 22:40:22.571608140 +0000 @@ -8,13 +8,27 @@ import java.util.List; import java.util.UUID; @@ -26,10 +26,21 @@ public Container activeContainer; - protected FoodMetaData foodData = new FoodMetaData(); + protected FoodMetaData foodData = new FoodMetaData(this); // CraftBukkit - add "this" to constructor - protected int bk; - public float bl; - public float bm; -@@ -34,6 +48,7 @@ + protected int bm; + public float bn; + public float bo; +@@ -25,15 +39,16 @@ + public double bt; + public double bu; + public double bv; +- protected boolean sleeping; ++ public boolean sleeping; // CraftBukkit - public + public BlockPosition bx; +- private int sleepTicks; ++ public int sleepTicks; // CraftBukkit - public + public float by; + public float bz; + private BlockPosition c; private boolean d; private BlockPosition e; public PlayerAbilities abilities = new PlayerAbilities(); @@ -37,11 +48,10 @@ public int expLevel; public int expTotal; public float exp; -@@ -46,6 +61,16 @@ - private final GameProfile bF; - private boolean bG = false; +@@ -47,6 +62,16 @@ + private boolean bI = false; public EntityFishingHook hookedFish; -+ + + // CraftBukkit start + public boolean fauxSleeping; + public String spawnWorld = ""; @@ -51,14 +61,15 @@ + return (CraftHumanEntity) super.getBukkitEntity(); + } + // CraftBukkit end - ++ public EntityHuman(World world, GameProfile gameprofile) { super(world); + this.uniqueID = a(gameprofile); @@ -265,6 +290,32 @@ if (this.g != null) { this.b(this.g, 16); int i = this.g.count; -+ ++ + // CraftBukkit start - fire PlayerItemConsumeEvent + org.bukkit.inventory.ItemStack craftItem = CraftItemStack.asBukkitCopy(this.g); + PlayerItemConsumeEvent event = new PlayerItemConsumeEvent((Player) this.getBukkitEntity(), craftItem); @@ -83,10 +94,19 @@ + return; + } + // CraftBukkit end -+ ++ ItemStack itemstack = this.g.b(this.world, this); if (itemstack != this.g || itemstack != null && itemstack.count != i) { +@@ -283,7 +334,7 @@ + return this.getHealth() <= 0.0F || this.isSleeping(); + } + +- protected void closeInventory() { ++ public void closeInventory() { // CraftBukkit - public + this.activeContainer = this.defaultContainer; + } + @@ -324,7 +375,8 @@ if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL && this.world.getGameRules().getBoolean("naturalRegeneration")) { @@ -99,21 +119,20 @@ if (this.foodData.c() && this.ticksLived % 10 == 0) { @@ -348,7 +400,7 @@ - this.j((float) attributeinstance.getValue()); + this.k((float) attributeinstance.getValue()); float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ); - float f1 = (float) (Math.atan(-this.motY * 0.20000000298023224D) * 15.0D); + float f1 = (float) ( org.bukkit.craftbukkit.TrigMath.atan(-this.motY * 0.20000000298023224D) * 15.0D); // CraftBukkit if (f > 0.1F) { f = 0.1F; -@@ -438,11 +490,14 @@ +@@ -438,11 +490,13 @@ public void b(Entity entity, int i) { this.addScore(i); - Collection collection = this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.f); + // CraftBukkit - Get our scores instead + Collection collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.f, this.getName(), new java.util.ArrayList()); -+ if (entity instanceof EntityHuman) { this.b(StatisticList.B); @@ -123,7 +142,7 @@ collection.addAll(this.e(entity)); } else { this.b(StatisticList.z); -@@ -451,8 +506,7 @@ +@@ -451,15 +505,14 @@ Iterator iterator = collection.iterator(); while (iterator.hasNext()) { @@ -133,7 +152,15 @@ scoreboardscore.incrementScore(); } -@@ -491,6 +545,7 @@ + + } + +- private Collection e(Entity entity) { ++ private Collection e(Entity entity) { // CraftBukkit - TODO: Check me? + ScoreboardTeam scoreboardteam = this.getScoreboard().getPlayerTeam(this.getName()); + + if (scoreboardteam != null) { +@@ -491,6 +544,7 @@ } public EntityItem a(boolean flag) { @@ -141,11 +168,10 @@ return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && this.inventory.getItemInHand() != null ? this.inventory.getItemInHand().count : 1), false, true); } -@@ -532,6 +587,30 @@ - entityitem.motY += (double) ((this.random.nextFloat() - this.random.nextFloat()) * 0.1F); +@@ -533,6 +587,30 @@ entityitem.motZ += Math.sin((double) f1) * (double) f; } -+ + + // CraftBukkit start - fire PlayerDropItemEvent + Player player = (Player) this.getBukkitEntity(); + CraftItem drop = new CraftItem(this.world.getServer(), entityitem); @@ -169,24 +195,25 @@ + return null; + } + // CraftBukkit end - ++ this.a(entityitem); if (flag1) { -@@ -623,6 +702,13 @@ - this.bv = new BlockPosition(this); + this.b(StatisticList.v); +@@ -624,6 +702,13 @@ this.a(true, true, false); } -+ + + // CraftBukkit start + this.spawnWorld = nbttagcompound.getString("SpawnWorld"); + if ("".equals(spawnWorld)) { + this.spawnWorld = this.world.getServer().getWorlds().get(0).getName(); + } + // CraftBukkit end - ++ if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) { this.c = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ")); -@@ -665,6 +751,7 @@ + this.d = nbttagcompound.getBoolean("SpawnForced"); +@@ -665,6 +750,7 @@ if (itemstack != null && itemstack.getItem() != null) { nbttagcompound.set("SelectedItem", itemstack.save(new NBTTagCompound())); } @@ -194,7 +221,7 @@ } -@@ -684,7 +771,7 @@ +@@ -684,7 +770,7 @@ if (damagesource.r()) { if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL) { @@ -203,7 +230,7 @@ } if (this.world.getDifficulty() == EnumDifficulty.EASY) { -@@ -696,7 +783,7 @@ +@@ -696,7 +782,7 @@ } } @@ -212,7 +239,7 @@ return false; } else { Entity entity = damagesource.getEntity(); -@@ -712,10 +799,29 @@ +@@ -712,10 +798,29 @@ } public boolean a(EntityHuman entityhuman) { @@ -245,7 +272,7 @@ } protected void damageArmor(float f) { -@@ -742,7 +848,12 @@ +@@ -742,7 +847,12 @@ return (float) i / (float) this.inventory.armor.length; } @@ -259,7 +286,7 @@ if (!this.isInvulnerable(damagesource)) { if (!damagesource.ignoresArmor() && this.isBlocking() && f > 0.0F) { f = (1.0F + f) * 0.5F; -@@ -766,6 +877,7 @@ +@@ -766,6 +876,7 @@ } } @@ -267,17 +294,17 @@ } public void openSign(TileEntitySign tileentitysign) {} -@@ -800,7 +912,8 @@ +@@ -800,7 +911,8 @@ } if (itemstack.a(this, (EntityLiving) entity)) { - if (itemstack.count <= 0 && !this.abilities.canInstantlyBuild) { + // CraftBukkit - bypass infinite items; <= 0 -> == 0 + if (itemstack.count == 0 && !this.abilities.canInstantlyBuild) { - this.bZ(); + this.ca(); } -@@ -866,8 +979,15 @@ +@@ -866,8 +978,15 @@ int j = EnchantmentManager.getFireAspectEnchantmentLevel(this); if (entity instanceof EntityLiving && j > 0 && !entity.isBurning()) { @@ -295,7 +322,7 @@ } double d0 = entity.motX; -@@ -884,11 +1004,28 @@ +@@ -884,11 +1003,28 @@ } if (entity instanceof EntityPlayer && entity.velocityChanged) { @@ -329,17 +356,17 @@ } if (flag) { -@@ -922,7 +1059,8 @@ +@@ -922,7 +1058,8 @@ if (itemstack != null && object instanceof EntityLiving) { itemstack.a((EntityLiving) object, this); - if (itemstack.count <= 0) { + // CraftBukkit - bypass infinite items; <= 0 -> == 0 + if (itemstack.count == 0) { - this.bZ(); + this.ca(); } } -@@ -930,7 +1068,14 @@ +@@ -930,7 +1067,14 @@ if (entity instanceof EntityLiving) { this.a(StatisticList.w, Math.round(f * 10.0F)); if (j > 0) { @@ -355,11 +382,10 @@ } } -@@ -995,6 +1140,20 @@ - if (this.av()) { +@@ -996,6 +1140,20 @@ this.mount((Entity) null); } -+ + + // CraftBukkit start - fire PlayerBedEnterEvent + if (this.getBukkitEntity() instanceof Player) { + Player player = (Player) this.getBukkitEntity(); @@ -373,20 +399,20 @@ + } + } + // CraftBukkit end - - this.a(0.2F, 0.2F); ++ + this.setSize(0.2F, 0.2F); if (this.world.isLoaded(blockposition)) { -@@ -1077,6 +1236,23 @@ - if (!this.world.isStatic && flag1) { + EnumDirection enumdirection = (EnumDirection) this.world.getType(blockposition).get(BlockDirectional.FACING); +@@ -1078,6 +1236,23 @@ this.world.everyoneSleeping(); } -+ + + // CraftBukkit start - fire PlayerBedLeaveEvent + if (this.getBukkitEntity() instanceof Player) { + Player player = (Player) this.getBukkitEntity(); + + org.bukkit.block.Block bed; -+ BlockPosition blockposition = this.bv; ++ BlockPosition blockposition = this.bx; + if (blockposition != null) { + bed = this.world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + } else { @@ -397,18 +423,19 @@ + this.world.getServer().getPluginManager().callEvent(event); + } + // CraftBukkit end - ++ this.sleepTicks = flag ? 0 : 100; if (flag2) { -@@ -1090,6 +1266,7 @@ + this.setRespawnPosition(this.bx, false); +@@ -1090,6 +1265,7 @@ } public static BlockPosition getBed(World world, BlockPosition blockposition, boolean flag) { + ((ChunkProviderServer) world.chunkProvider).getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4); // CraftBukkit - if (world.getType(blockposition).getBlock() != Blocks.BED) { - if (!flag) { - return null; -@@ -1128,9 +1305,11 @@ + Block block = world.getType(blockposition).getBlock(); + + if (block != Blocks.BED) { +@@ -1128,9 +1304,11 @@ if (blockposition != null) { this.c = blockposition; this.d = flag; @@ -420,11 +447,11 @@ } } -@@ -1477,6 +1656,7 @@ +@@ -1480,6 +1658,7 @@ } public IChatBaseComponent getScoreboardDisplayName() { + // CraftBukkit - todo: fun ChatComponentText chatcomponenttext = new ChatComponentText(ScoreboardTeam.getPlayerDisplayName(this.getScoreboardTeam(), this.getName())); - chatcomponenttext.getChatModifier().setChatClickable(new ChatClickable(EnumClickAction.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); + chatcomponenttext.getChatModifier().setChatClickable(new ChatClickable(ChatClickable.EnumClickAction.SUGGEST_COMMAND, "/msg " + this.getName() + " ")); diff --git a/nms-patches/EntityInsentient.patch b/nms-patches/EntityInsentient.patch index 36f6f715b0..8c7b3b3108 100644 --- a/nms-patches/EntityInsentient.patch +++ b/nms-patches/EntityInsentient.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityInsentient.java Sat Dec 6 21:48:11 2014 -+++ src/main/java/net/minecraft/server/EntityInsentient.java Sat Dec 6 21:18:38 2014 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityInsentient.java 2015-02-26 22:40:22.575608140 +0000 ++++ src/main/java/net/minecraft/server/EntityInsentient.java 2015-02-26 22:40:22.579608139 +0000 @@ -4,6 +4,15 @@ import java.util.List; import java.util.UUID; @@ -16,36 +16,44 @@ public abstract class EntityInsentient extends EntityLiving { public int a_; -@@ -13,8 +22,8 @@ +@@ -13,14 +22,14 @@ protected ControllerJump g; private EntityAIBodyControl b; protected NavigationAbstract navigation; - protected final PathfinderGoalSelector goalSelector; - protected final PathfinderGoalSelector targetSelector; -+ public PathfinderGoalSelector goalSelector; // PAIL protected final to public -+ public PathfinderGoalSelector targetSelector; // PAIL protected final to public ++ public PathfinderGoalSelector goalSelector; // CraftBukkit - public ++ public PathfinderGoalSelector targetSelector; // CraftBukkit - public private EntityLiving goalTarget; - private EntitySenses bi; + private EntitySenses bk; private ItemStack[] equipment = new ItemStack[5]; -@@ -39,7 +48,9 @@ - for (int i = 0; i < this.dropChances.length; ++i) { +- protected float[] dropChances = new float[5]; +- private boolean canPickUpLoot; +- private boolean persistent; ++ public float[] dropChances = new float[5]; // CraftBukkit - public ++ public boolean canPickUpLoot; // CraftBukkit - public ++ public boolean persistent; // CraftBukkit - public + private boolean bo; + private Entity bp; + private NBTTagCompound bq; +@@ -40,6 +49,9 @@ this.dropChances[i] = 0.085F; } -- + + // CraftBukkit start - default persistance to type's persistance value + this.persistent = !isTypeNotPersistent(); + // CraftBukkit end } - protected void aW() { -@@ -76,7 +87,37 @@ + protected void initAttributes() { +@@ -76,7 +88,37 @@ } public void setGoalTarget(EntityLiving entityliving) { + // CraftBukkit start - fire event + setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true); + } -+ ++ + public void setGoalTarget(EntityLiving entityliving, EntityTargetEvent.TargetReason reason, boolean fireEvent) { + if (getGoalTarget() == entityliving) return; + if (fireEvent) { @@ -64,7 +72,7 @@ + if (event.isCancelled()) { + return; + } -+ ++ + if (event.getTarget() != null) { + entityliving = ((CraftLivingEntity) event.getTarget()).getHandle(); + } else { @@ -75,12 +83,12 @@ + // CraftBukkit end } - public boolean a(Class oclass) { -@@ -235,11 +276,21 @@ + public boolean a(Class oclass) { +@@ -235,11 +277,20 @@ public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); -+ ++ + // CraftBukkit start - If looting or persistence is false only use it if it was set after we started using it if (nbttagcompound.hasKeyOfType("CanPickUpLoot", 1)) { - this.j(nbttagcompound.getBoolean("CanPickUpLoot")); @@ -96,7 +104,6 @@ + this.persistent = data; + } + // CraftBukkit end -+ NBTTagList nbttaglist; int i; @@ -109,15 +116,15 @@ this.die(); } -- if (this.aO > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D && this.isTypeNotPersistent()) { -+ if (this.aO > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check +- if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D && this.isTypeNotPersistent()) { ++ if (this.ticksFarFromPlayer > 600 && this.random.nextInt(800) == 0 && d3 > 1024.0D) { // CraftBukkit - remove isTypeNotPersistent() check this.die(); } else if (d3 < 1024.0D) { - this.aO = 0; + this.ticksFarFromPlayer = 0; @@ -707,6 +758,12 @@ public final boolean e(EntityHuman entityhuman) { - if (this.cb() && this.getLeashHolder() == entityhuman) { + if (this.cc() && this.getLeashHolder() == entityhuman) { + // CraftBukkit start - fire PlayerUnleashEntityEvent + if (CraftEventFactory.callPlayerUnleashEntityEvent(this, entityhuman).isCancelled()) { + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, this, this.getLeashHolder())); @@ -129,7 +136,7 @@ } else { @@ -714,12 +771,24 @@ - if (itemstack != null && itemstack.getItem() == Items.LEAD && this.ca()) { + if (itemstack != null && itemstack.getItem() == Items.LEAD && this.cb()) { if (!(this instanceof EntityTameableAnimal) || !((EntityTameableAnimal) this).isTamed()) { + // CraftBukkit start - fire PlayerLeashEntityEvent + if (CraftEventFactory.callPlayerLeashEntityEvent(this, entityhuman, entityhuman).isCancelled()) { @@ -154,22 +161,22 @@ return true; @@ -741,10 +810,12 @@ - if (this.bm) { + if (this.bo) { if (!this.isAlive()) { + this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.PLAYER_UNLEASH)); // CraftBukkit this.unleash(true, true); } - if (this.bn == null || this.bn.dead) { + if (this.bp == null || this.bp.dead) { + this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.HOLDER_GONE)); // CraftBukkit this.unleash(true, true); } } @@ -811,6 +882,7 @@ - this.bn = entityleash; + this.bp = entityleash; } else { + this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit this.unleash(false, true); } - } \ No newline at end of file + } diff --git a/nms-patches/EntityIronGolem.patch b/nms-patches/EntityIronGolem.patch index 671bac846a..14d0ca4034 100644 --- a/nms-patches/EntityIronGolem.patch +++ b/nms-patches/EntityIronGolem.patch @@ -1,11 +1,20 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityIronGolem.java 2014-11-28 17:43:43.109707435 +0000 -+++ src/main/java/net/minecraft/server/EntityIronGolem.java 2014-11-28 17:38:17.000000000 +0000 -@@ -57,7 +57,7 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityIronGolem.java 2015-02-26 22:40:22.579608139 +0000 ++++ src/main/java/net/minecraft/server/EntityIronGolem.java 2015-02-26 22:40:22.583608139 +0000 +@@ -59,7 +59,7 @@ protected void s(Entity entity) { - if (entity instanceof IMonster && this.bb().nextInt(20) == 0) { + if (entity instanceof IMonster && !(entity instanceof EntityCreeper) && this.bc().nextInt(20) == 0) { - this.setGoalTarget((EntityLiving) entity); + this.setGoalTarget((EntityLiving) entity, org.bukkit.event.entity.EntityTargetLivingEntityEvent.TargetReason.COLLISION, true); // CraftBukkit - set reason } super.s(entity); +@@ -220,7 +220,7 @@ + } + + public boolean apply(Object object) { +- return this.a((EntityLiving) object); ++ return this.a((T) object); // CraftBukkit - fix decompiler error + } + }; + } diff --git a/nms-patches/EntityItem.patch b/nms-patches/EntityItem.patch index 2716ccd16f..16bccf29ae 100644 --- a/nms-patches/EntityItem.patch +++ b/nms-patches/EntityItem.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/EntityItem.java 2015-01-07 09:58:20.976505660 +1100 -+++ src/main/java/net/minecraft/server/EntityItem.java 2015-01-07 09:58:20.976505660 +1100 -@@ -4,6 +4,8 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityItem.java 2015-02-26 22:40:22.587608139 +0000 ++++ src/main/java/net/minecraft/server/EntityItem.java 2015-02-26 22:40:22.591608139 +0000 +@@ -4,15 +4,18 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,7 +9,10 @@ public class EntityItem extends Entity { private static final Logger b = LogManager.getLogger(); -@@ -13,6 +15,7 @@ + private int age; +- private int pickupDelay; ++ public int pickupDelay; // CraftBukkit - public + private int e; private String f; private String g; public float a; @@ -32,20 +35,20 @@ @@ -52,9 +60,12 @@ this.die(); } else { - super.s_(); + super.t_(); - if (this.pickupDelay > 0 && this.pickupDelay != 32767) { - --this.pickupDelay; - } + // CraftBukkit start - Use wall time for pickup and despawn timers + int elapsedTicks = MinecraftServer.currentTick - this.lastTick; -+ this.pickupDelay -= elapsedTicks; -+ this.age += elapsedTicks; ++ if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks; ++ if (this.age != -32768) this.age += elapsedTicks; + this.lastTick = MinecraftServer.currentTick; + // CraftBukkit end this.lastX = this.locX; this.lastY = this.locY; -@@ -90,12 +101,20 @@ +@@ -90,12 +101,21 @@ this.motY *= -0.5D; } @@ -54,9 +57,10 @@ ++this.age; } + // Craftbukkit end */ ++ this.W(); - if (!this.world.isStatic && this.age >= 6000) { + if (!this.world.isClientSide && this.age >= 6000) { + // CraftBukkit start - fire ItemDespawnEvent + if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { + this.age = 0; @@ -66,7 +70,7 @@ this.die(); } -@@ -183,6 +202,11 @@ +@@ -183,6 +203,11 @@ } else if (this.getItemStack() != null && this.getItemStack().getItem() == Items.NETHER_STAR && damagesource.isExplosion()) { return false; } else { @@ -78,7 +82,7 @@ this.ac(); this.e = (int) ((float) this.e - f); if (this.e <= 0) { -@@ -228,7 +252,18 @@ +@@ -228,7 +253,18 @@ NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Item"); @@ -98,11 +102,10 @@ if (this.getItemStack() == null) { this.die(); } -@@ -239,6 +274,26 @@ - if (!this.world.isStatic) { +@@ -240,6 +276,26 @@ ItemStack itemstack = this.getItemStack(); int i = itemstack.count; -+ + + // CraftBukkit start - fire PlayerPickupItemEvent + int canHold = entityhuman.inventory.canHold(itemstack); + int remaining = itemstack.count - canHold; @@ -122,6 +125,7 @@ + this.pickupDelay = 0; + } + // CraftBukkit end - ++ if (this.pickupDelay == 0 && (this.g == null || 6000 - this.age <= 200 || this.g.equals(entityhuman.getName())) && entityhuman.inventory.pickup(itemstack)) { if (itemstack.getItem() == Item.getItemOf(Blocks.LOG)) { + entityhuman.b((Statistic) AchievementList.g); diff --git a/nms-patches/EntityItemFrame.patch b/nms-patches/EntityItemFrame.patch index 753d8ff6cd..05b65d9504 100644 --- a/nms-patches/EntityItemFrame.patch +++ b/nms-patches/EntityItemFrame.patch @@ -1,15 +1,14 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityItemFrame.java 2014-11-28 17:43:43.113707435 +0000 -+++ src/main/java/net/minecraft/server/EntityItemFrame.java 2014-11-28 17:38:20.000000000 +0000 -@@ -27,6 +27,12 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityItemFrame.java 2015-02-26 22:40:22.583608139 +0000 ++++ src/main/java/net/minecraft/server/EntityItemFrame.java 2015-02-26 22:40:22.587608139 +0000 +@@ -27,6 +27,11 @@ return false; } else if (!damagesource.isExplosion() && this.getItem() != null) { - if (!this.world.isStatic) { + if (!this.world.isClientSide) { + // CraftBukkit start - fire EntityDamageEvent + if (org.bukkit.craftbukkit.event.CraftEventFactory.handleNonLivingEntityDamageEvent(this, damagesource, f, false) || this.dead) { + return true; + } + // CraftBukkit end -+ this.a(damagesource.getEntity(), false); this.setItem((ItemStack) null); } diff --git a/nms-patches/EntityLargeFireball.patch b/nms-patches/EntityLargeFireball.patch index b64b31f39f..8680c54d22 100644 --- a/nms-patches/EntityLargeFireball.patch +++ b/nms-patches/EntityLargeFireball.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityLargeFireball.java 2014-11-28 17:43:43.121707434 +0000 -+++ src/main/java/net/minecraft/server/EntityLargeFireball.java 2014-11-28 17:38:19.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityLargeFireball.java 2015-02-26 22:40:22.603608139 +0000 ++++ src/main/java/net/minecraft/server/EntityLargeFireball.java 2015-02-26 22:40:22.603608139 +0000 @@ -1,5 +1,7 @@ package net.minecraft.server; @@ -8,7 +8,7 @@ public class EntityLargeFireball extends EntityFireball { public int yield = 1; -@@ -21,7 +23,16 @@ +@@ -21,7 +23,15 @@ boolean flag = this.world.getGameRules().getBoolean("mobGriefing"); @@ -22,11 +22,10 @@ + this.world.createExplosion(this, this.locX, this.locY, this.locZ, event.getRadius(), event.getFire(), flag); + } + // CraftBukkit end -+ this.die(); } -@@ -35,7 +46,8 @@ +@@ -35,7 +45,8 @@ public void a(NBTTagCompound nbttagcompound) { super.a(nbttagcompound); if (nbttagcompound.hasKeyOfType("ExplosionPower", 99)) { diff --git a/nms-patches/EntityLeash.patch b/nms-patches/EntityLeash.patch index 834e5600c9..d3ae3bd7dc 100644 --- a/nms-patches/EntityLeash.patch +++ b/nms-patches/EntityLeash.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityLeash.java 2014-11-28 17:43:43.121707434 +0000 -+++ src/main/java/net/minecraft/server/EntityLeash.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityLeash.java 2015-02-26 22:40:22.607608139 +0000 ++++ src/main/java/net/minecraft/server/EntityLeash.java 2015-02-26 22:40:22.607608139 +0000 @@ -3,6 +3,8 @@ import java.util.Iterator; import java.util.List; @@ -12,7 +12,7 @@ @@ -63,6 +65,12 @@ while (iterator.hasNext()) { entityinsentient = (EntityInsentient) iterator.next(); - if (entityinsentient.cb() && entityinsentient.getLeashHolder() == entityhuman) { + if (entityinsentient.cc() && entityinsentient.getLeashHolder() == entityhuman) { + // CraftBukkit start + if (CraftEventFactory.callPlayerLeashEntityEvent(entityinsentient, this, entityhuman).isCancelled()) { + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutAttachEntity(1, entityinsentient, entityinsentient.getLeashHolder())); @@ -25,7 +25,7 @@ @@ -70,8 +78,11 @@ } - if (!this.world.isStatic && !flag) { + if (!this.world.isClientSide && !flag) { - this.die(); - if (entityhuman.abilities.canInstantlyBuild) { + // CraftBukkit start - Move below @@ -39,7 +39,7 @@ @@ -79,10 +90,21 @@ while (iterator.hasNext()) { entityinsentient = (EntityInsentient) iterator.next(); - if (entityinsentient.cb() && entityinsentient.getLeashHolder() == this) { + if (entityinsentient.cc() && entityinsentient.getLeashHolder() == this) { - entityinsentient.unleash(true, false); + // CraftBukkit start + if (CraftEventFactory.callPlayerUnleashEntityEvent(entityinsentient, entityhuman).isCancelled()) { diff --git a/nms-patches/EntityLightning.patch b/nms-patches/EntityLightning.patch index f560108e85..44a2436fae 100644 --- a/nms-patches/EntityLightning.patch +++ b/nms-patches/EntityLightning.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityLightning.java 2014-11-28 17:43:43.125707434 +0000 -+++ src/main/java/net/minecraft/server/EntityLightning.java 2014-11-28 17:38:20.000000000 +0000 -@@ -2,30 +2,54 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityLightning.java 2015-02-26 22:40:22.607608139 +0000 ++++ src/main/java/net/minecraft/server/EntityLightning.java 2015-02-26 22:40:22.611608139 +0000 +@@ -2,30 +2,53 @@ import java.util.List; @@ -11,34 +11,32 @@ private int lifeTicks; public long a; private int c; -+ + + // CraftBukkit start + public boolean isEffect = false; - ++ public EntityLightning(World world, double d0, double d1, double d2) { + this(world, d0, d1, d2, false); + } + + public EntityLightning(World world, double d0, double d1, double d2, boolean isEffect) { + // CraftBukkit end -+ super(world); + + // CraftBukkit - Set isEffect + this.isEffect = isEffect; -+ ++ this.setPositionRotation(d0, d1, d2, 0.0F, 0.0F); this.lifeTicks = 2; this.a = this.random.nextLong(); this.c = this.random.nextInt(3) + 1; -- if (!world.isStatic && world.getGameRules().getBoolean("doFireTick") && (world.getDifficulty() == EnumDifficulty.NORMAL || world.getDifficulty() == EnumDifficulty.HARD) && world.areChunksLoaded(new BlockPosition(this), 10)) { -+ // CraftBukkit - add "!isEffect" -+ if (!isEffect && !world.isStatic && world.getGameRules().getBoolean("doFireTick") && (world.getDifficulty() == EnumDifficulty.NORMAL || world.getDifficulty() == EnumDifficulty.HARD) && world.areChunksLoaded(new BlockPosition(this), 10)) { - BlockPosition blockposition = new BlockPosition(this); + BlockPosition blockposition = new BlockPosition(this); -- if (world.getType(blockposition).getBlock().getMaterial() == Material.AIR && Blocks.FIRE.canPlace(world, blockposition)) { +- if (!world.isClientSide && world.getGameRules().getBoolean("doFireTick") && (world.getDifficulty() == EnumDifficulty.NORMAL || world.getDifficulty() == EnumDifficulty.HARD) && world.areChunksLoaded(blockposition, 10)) { ++ // CraftBukkit - add "!isEffect" ++ if (!isEffect && !world.isClientSide && world.getGameRules().getBoolean("doFireTick") && (world.getDifficulty() == EnumDifficulty.NORMAL || world.getDifficulty() == EnumDifficulty.HARD) && world.areChunksLoaded(blockposition, 10)) { + if (world.getType(blockposition).getBlock().getMaterial() == Material.AIR && Blocks.FIRE.canPlace(world, blockposition)) { - world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); -+ if (world.getType(blockposition).getBlock().getMaterial() == Material.AIR && Blocks.FIRE.canPlace(world, blockposition)) { + // CraftBukkit start + if (!CraftEventFactory.callBlockIgniteEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this).isCancelled()) { + world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); @@ -49,9 +47,8 @@ for (int i = 0; i < 4; ++i) { BlockPosition blockposition1 = blockposition.a(this.random.nextInt(3) - 1, this.random.nextInt(3) - 1, this.random.nextInt(3) - 1); -- if (world.getType(blockposition1).getBlock().getMaterial() == Material.AIR && Blocks.FIRE.canPlace(world, blockposition1)) { + if (world.getType(blockposition1).getBlock().getMaterial() == Material.AIR && Blocks.FIRE.canPlace(world, blockposition1)) { - world.setTypeUpdate(blockposition1, Blocks.FIRE.getBlockData()); -+ if (world.getType(blockposition1).getBlock().getMaterial() == Material.AIR && Blocks.FIRE.canPlace(world, blockposition1)) { + // CraftBukkit start + if (!CraftEventFactory.callBlockIgniteEvent(world, blockposition1.getX(), blockposition1.getY(), blockposition1.getZ(), this).isCancelled()) { + world.setTypeUpdate(blockposition1, Blocks.FIRE.getBlockData()); @@ -60,16 +57,16 @@ } } } -@@ -35,7 +59,24 @@ - public void s_() { - super.s_(); +@@ -35,7 +58,24 @@ + public void t_() { + super.t_(); if (this.lifeTicks == 2) { - this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); + // CraftBukkit start - Use relative location for far away sounds + //this.world.makeSound(this.locX, this.locY, this.locZ, "ambient.weather.thunder", 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); + float pitch = 0.8F + this.random.nextFloat() * 0.2F; + int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; -+ for (EntityPlayer player : (List) this.world.players) { ++ for (EntityPlayer player : (List) (List) this.world.players) { + double deltaX = this.locX - player.locX; + double deltaZ = this.locZ - player.locZ; + double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; @@ -86,17 +83,15 @@ this.world.makeSound(this.locX, this.locY, this.locZ, "random.explode", 2.0F, 0.5F + this.random.nextFloat() * 0.2F); } -@@ -48,14 +89,18 @@ - this.lifeTicks = 1; +@@ -49,13 +89,18 @@ this.a = this.random.nextLong(); BlockPosition blockposition = new BlockPosition(this); -- -- if (!this.world.isStatic && this.world.getGameRules().getBoolean("doFireTick") && this.world.areChunksLoaded(blockposition, 10) && this.world.getType(blockposition).getBlock().getMaterial() == Material.AIR && Blocks.FIRE.canPlace(this.world, blockposition)) { -- this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); + + // CraftBukkit - add "!isEffect" -+ if (!isEffect && !this.world.isStatic && this.world.getGameRules().getBoolean("doFireTick") && this.world.areChunksLoaded(blockposition, 10) && this.world.getType(blockposition).getBlock().getMaterial() == Material.AIR && Blocks.FIRE.canPlace(this.world, blockposition)) { + if (!this.world.isClientSide && this.world.getGameRules().getBoolean("doFireTick") && this.world.areChunksLoaded(blockposition, 10) && this.world.getType(blockposition).getBlock().getMaterial() == Material.AIR && Blocks.FIRE.canPlace(this.world, blockposition)) { +- this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); + // CraftBukkit start -+ if (!CraftEventFactory.callBlockIgniteEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this).isCancelled()) { ++ if (!isEffect && !CraftEventFactory.callBlockIgniteEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this).isCancelled()) { + this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); + } + // CraftBukkit end @@ -106,6 +101,6 @@ - if (this.lifeTicks >= 0) { + if (this.lifeTicks >= 0 && !this.isEffect) { // CraftBukkit - add !this.isEffect - if (this.world.isStatic) { - this.world.c(2); + if (this.world.isClientSide) { + this.world.d(2); } else { diff --git a/nms-patches/EntityLiving.patch b/nms-patches/EntityLiving.patch index 1a0a628799..6b3173c286 100644 --- a/nms-patches/EntityLiving.patch +++ b/nms-patches/EntityLiving.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityLiving.java 2015-02-12 14:00:06.621316929 +0000 -+++ src/main/java/net/minecraft/server/EntityLiving.java 2015-02-12 14:00:06.621316929 +0000 -@@ -8,6 +8,19 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityLiving.java 2015-02-26 22:40:22.615608139 +0000 ++++ src/main/java/net/minecraft/server/EntityLiving.java 2015-02-26 22:40:22.619608139 +0000 +@@ -10,13 +10,26 @@ import java.util.Random; import java.util.UUID; @@ -20,10 +20,48 @@ public abstract class EntityLiving extends Entity { private static final UUID a = UUID.fromString("662A6B8D-DA3E-4C1C-8813-96EA6097278D"); -@@ -67,6 +80,11 @@ - private float bk; + private static final AttributeModifier b = (new AttributeModifier(EntityLiving.a, "Sprinting speed boost", 0.30000001192092896D, 2)).a(false); + private AttributeMapBase c; +- private final CombatTracker combatTracker = new CombatTracker(this); +- private final Map effects = Maps.newHashMap(); ++ public CombatTracker combatTracker = new CombatTracker(this); // CraftBukkit - public ++ public final Map effects = Maps.newHashMap(); // CraftBukkit - public + private final ItemStack[] h = new ItemStack[5]; + public boolean ar; + public int as; +@@ -40,7 +53,7 @@ + public float aK; + public float aL; + public float aM = 0.02F; +- protected EntityHuman killer; ++ public EntityHuman killer; + protected int lastDamageByPlayerTime; + protected boolean aP; + protected int ticksFarFromPlayer; +@@ -50,7 +63,7 @@ + protected float aU; + protected float aV; + protected int aW; +- protected float lastDamage; ++ public float lastDamage; // CraftBukkit - public + protected boolean aY; + public float aZ; + public float ba; +@@ -61,14 +74,19 @@ + protected double bf; + protected double bg; + protected double bh; +- private boolean updateEffects = true; +- private EntityLiving lastDamager; +- private int hurtTimestamp; ++ public boolean updateEffects = true; // CraftBukkit - public ++ public EntityLiving lastDamager; // CraftBukkit - public ++ public int hurtTimestamp; // CraftBukkit - public + private EntityLiving bk; private int bl; private float bm; + private int bn; + private float bo; + // CraftBukkit start + public int expToDrop; + public int maxAirTicks = 300; @@ -32,74 +70,71 @@ public void G() { this.damageEntity(DamageSource.OUT_OF_WORLD, Float.MAX_VALUE); -@@ -75,7 +93,8 @@ +@@ -77,7 +95,8 @@ public EntityLiving(World world) { super(world); - this.aW(); + this.initAttributes(); - this.setHealth(this.getMaxHealth()); + // CraftBukkit - setHealth(getMaxHealth()) inlined and simplified to skip the instanceof check for EntityPlayer, as getBukkitEntity() is not initialized in constructor + this.datawatcher.watch(6, (float) this.getAttributeInstance(GenericAttributes.maxHealth).getValue()); this.k = true; - this.aF = (float) ((Math.random() + 1.0D) * 0.009999999776482582D); + this.aH = (float) ((Math.random() + 1.0D) * 0.009999999776482582D); this.setPosition(this.locX, this.locY, this.locZ); -@@ -116,8 +135,14 @@ - } +@@ -119,7 +138,13 @@ int i = (int) (150.0D * d1); -- + - ((WorldServer) this.world).a(EnumParticle.BLOCK_DUST, this.locX, this.locY, this.locZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] { Block.getCombinedId(iblockdata)}); -+ + // CraftBukkit start - visiblity api + if (this instanceof EntityPlayer) { + ((WorldServer) this.world).sendParticles((EntityPlayer) this, EnumParticle.BLOCK_DUST, false, this.locX, this.locY, this.locZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] { Block.getCombinedId(iblockdata)}); + } else { -+ ((WorldServer) this.world).a(EnumParticle.BLOCK_DUST, this.locX, this.locY, this.locZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] { Block.getCombinedId(iblockdata)}); ++ ((WorldServer) this.world).a(EnumParticle.BLOCK_DUST, this.locX, this.locY, this.locZ, i, 0.0D, 0.0D, 0.0D, 0.15000000596046448D, new int[] { Block.getCombinedId(iblockdata)}); + } + // CraftBukkit end } } -@@ -174,7 +199,11 @@ - this.mount((Entity) null); +@@ -177,7 +202,11 @@ + this.mount((Entity) null); + } + } else { +- this.setAirTicks(300); ++ // CraftBukkit start - Only set if needed to work around a DataWatcher inefficiency ++ if (this.getAirTicks() != 300) { ++ this.setAirTicks(maxAirTicks); ++ } ++ // CraftBukkit end } - } else { -- this.setAirTicks(300); -+ // CraftBukkit start - Only set if needed to work around a DataWatcher inefficiency -+ if (this.getAirTicks() != 300) { -+ this.setAirTicks(maxAirTicks); -+ } -+ // CraftBukkit end } - if (this.isAlive() && this.U()) { -@@ -220,6 +249,18 @@ - this.lastPitch = this.pitch; +@@ -225,25 +254,36 @@ this.world.methodProfiler.b(); } -+ + + // CraftBukkit start + public int getExpReward() { + int exp = this.getExpValue(this.killer); + -+ if (!this.world.isStatic && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && this.aZ() && this.world.getGameRules().getBoolean("doMobLoot")) { ++ if (!this.world.isClientSide && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && this.ba() && this.world.getGameRules().getBoolean("doMobLoot")) { + return exp; + } else { + return 0; + } + } -+ // CraftBukkit end - ++ // CraftBukkit end ++ public boolean isBaby() { return false; -@@ -227,19 +268,18 @@ + } - protected void aY() { + protected void aZ() { ++this.deathTicks; - if (this.deathTicks == 20) { + if (this.deathTicks >= 20 && !this.dead) { // CraftBukkit - (this.deathTicks == 20) -> (this.deathTicks >= 20 && !this.dead) int i; -- if (!this.world.isStatic && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && this.aZ() && this.world.getGameRules().getBoolean("doMobLoot")) { +- if (!this.world.isClientSide && (this.lastDamageByPlayerTime > 0 || this.alwaysGivesExp()) && this.ba() && this.world.getGameRules().getBoolean("doMobLoot")) { - i = this.getExpValue(this.killer); - - while (i > 0) { @@ -120,11 +155,10 @@ this.die(); -@@ -375,6 +415,17 @@ - } +@@ -380,6 +420,17 @@ } } -+ + + // CraftBukkit start + if (nbttagcompound.hasKey("Bukkit.MaxHealth")) { + NBTBase nbtbase = nbttagcompound.get("Bukkit.MaxHealth"); @@ -135,10 +169,11 @@ + } + } + // CraftBukkit end - ++ if (nbttagcompound.hasKeyOfType("HealF", 99)) { this.setHealth(nbttagcompound.getFloat("HealF")); -@@ -395,9 +446,14 @@ + } else { +@@ -399,9 +450,15 @@ this.hurtTimestamp = nbttagcompound.getInt("HurtByTimestamp"); } @@ -147,14 +182,14 @@ + private List effectsToProcess = Lists.newArrayList(); + // CraftBukkit end + - protected void bh() { + protected void bi() { Iterator iterator = this.effects.keySet().iterator(); -- + + isTickingEffects = true; // CraftBukkit while (iterator.hasNext()) { Integer integer = (Integer) iterator.next(); MobEffect mobeffect = (MobEffect) this.effects.get(integer); -@@ -411,6 +467,16 @@ +@@ -415,6 +472,16 @@ this.a(mobeffect, false); } } @@ -170,8 +205,8 @@ + // CraftBukkit end if (this.updateEffects) { - if (!this.world.isStatic) { -@@ -486,7 +552,8 @@ + if (!this.world.isClientSide) { +@@ -490,7 +557,8 @@ } public boolean hasEffect(int i) { @@ -181,7 +216,7 @@ } public boolean hasEffect(MobEffectList mobeffectlist) { -@@ -498,6 +565,12 @@ +@@ -502,6 +570,12 @@ } public void addEffect(MobEffect mobeffect) { @@ -194,7 +229,7 @@ if (this.d(mobeffect)) { if (this.effects.containsKey(Integer.valueOf(mobeffect.getEffectId()))) { ((MobEffect) this.effects.get(Integer.valueOf(mobeffect.getEffectId()))).a(mobeffect); -@@ -527,6 +600,12 @@ +@@ -531,6 +605,12 @@ } public void removeEffect(int i) { @@ -207,7 +242,7 @@ MobEffect mobeffect = (MobEffect) this.effects.remove(Integer.valueOf(i)); if (mobeffect != null) { -@@ -560,20 +639,52 @@ +@@ -564,20 +644,52 @@ } @@ -215,7 +250,7 @@ public void heal(float f) { + heal(f, EntityRegainHealthEvent.RegainReason.CUSTOM); + } -+ ++ + public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason) { float f1 = this.getHealth(); @@ -261,7 +296,7 @@ this.datawatcher.watch(6, Float.valueOf(MathHelper.a(f, 0.0F, this.getMaxHealth()))); } -@@ -589,7 +700,8 @@ +@@ -593,7 +705,8 @@ } else if (damagesource.o() && this.hasEffect(MobEffectList.FIRE_RESISTANCE)) { return false; } else { @@ -271,7 +306,7 @@ this.getEquipment(4).damage((int) (f * 4.0F + this.random.nextFloat() * f * 2.0F), this); f *= 0.75F; } -@@ -602,16 +714,34 @@ +@@ -606,16 +719,34 @@ return false; } @@ -293,7 +328,7 @@ this.noDamageTicks = this.maxNoDamageTicks; - this.d(damagesource, f); + // CraftBukkit end - this.hurtTicks = this.at = 10; + this.hurtTicks = this.av = 10; } + // CraftBukkit start @@ -305,21 +340,20 @@ + } + // CraftBukkit end + - this.au = 0.0F; + this.aw = 0.0F; Entity entity = damagesource.getEntity(); -@@ -717,11 +847,19 @@ +@@ -721,11 +852,19 @@ } - if (this.aZ() && this.world.getGameRules().getBoolean("doMobLoot")) { + if (this.ba() && this.world.getGameRules().getBoolean("doMobLoot")) { + this.drops = new ArrayList(); // CraftBukkit - Setup drop capture -+ ++ this.dropDeathLoot(this.lastDamageByPlayerTime > 0, i); this.dropEquipment(this.lastDamageByPlayerTime > 0, i); if (this.lastDamageByPlayerTime > 0 && this.random.nextFloat() < 0.025F + (float) i * 0.01F) { this.getRareDrop(); -- } -+ } + } + // CraftBukkit start - Call death event + CraftEventFactory.callEntityDeathEvent(this, this.drops); + this.drops = null; @@ -329,7 +363,7 @@ } } -@@ -781,8 +919,13 @@ +@@ -785,8 +924,13 @@ int i = MathHelper.f((f - 3.0F - f2) * f1); if (i > 0) { @@ -344,8 +378,8 @@ int j = MathHelper.floor(this.locX); int k = MathHelper.floor(this.locY - 0.20000000298023224D); int l = MathHelper.floor(this.locZ); -@@ -826,7 +969,7 @@ - int i = 25 - this.bq(); +@@ -830,7 +974,7 @@ + int i = 25 - this.br(); float f1 = f * (float) i; - this.damageArmor(f); @@ -353,29 +387,30 @@ f = f1 / 25.0F; } -@@ -840,8 +983,9 @@ +@@ -844,8 +988,9 @@ int i; int j; float f1; - - if (this.hasEffect(MobEffectList.RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) { -+ ++ + // CraftBukkit - Moved to d(DamageSource, float) + if (false && this.hasEffect(MobEffectList.RESISTANCE) && damagesource != DamageSource.OUT_OF_WORLD) { i = (this.getEffect(MobEffectList.RESISTANCE).getAmplifier() + 1) * 5; j = 25 - i; f1 = f * (float) j; -@@ -867,22 +1011,117 @@ +@@ -871,22 +1016,117 @@ } } - protected void d(DamageSource damagesource, float f) { -+ // CraftBukkit start -+ protected boolean d(final DamageSource damagesource, float f) { // void -> boolean, add final - if (!this.isInvulnerable(damagesource)) { +- if (!this.isInvulnerable(damagesource)) { - f = this.applyArmorModifier(damagesource, f); - f = this.applyMagicModifier(damagesource, f); - float f1 = f; ++ // CraftBukkit start ++ protected boolean d(final DamageSource damagesource, float f) { // void -> boolean, add final ++ if (!this.isInvulnerable(damagesource)) { + final boolean human = this instanceof EntityHuman; + float originalDamage = f; + Function hardHat = new Function() { @@ -444,7 +479,9 @@ + } + }; + float absorptionModifier = absorption.apply((double) f).floatValue(); -+ + +- f = Math.max(f - this.getAbsorptionHearts(), 0.0F); +- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f)); + EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption); + if (event.isCancelled()) { + return false; @@ -456,15 +493,13 @@ + if ((damagesource == DamageSource.ANVIL || damagesource == DamageSource.FALLING_BLOCK) && this.getEquipment(4) != null) { + this.getEquipment(4).damage((int) (event.getDamage() * 4.0F + this.random.nextFloat() * event.getDamage() * 2.0F), this); + } -+ ++ + // Apply damage to armor + if (!damagesource.ignoresArmor()) { + float armorDamage = (float) (event.getDamage() + event.getDamage(DamageModifier.BLOCKING) + event.getDamage(DamageModifier.HARD_HAT)); + this.damageArmor(armorDamage); + } - -- f = Math.max(f - this.getAbsorptionHearts(), 0.0F); -- this.setAbsorptionHearts(this.getAbsorptionHearts() - (f1 - f)); ++ + absorptionModifier = (float) -event.getDamage(DamageModifier.ABSORPTION); + this.setAbsorptionHearts(Math.max(this.getAbsorptionHearts() - absorptionModifier, 0.0F)); if (f != 0.0F) { @@ -475,7 +510,7 @@ float f2 = this.getHealth(); this.setHealth(f2 - f); - this.br().a(damagesource, f2, f); + this.bs().a(damagesource, f2, f); + // CraftBukkit start + if (human) { + return true; @@ -488,32 +523,32 @@ + return false; // CraftBukkit } - public CombatTracker br() { -@@ -1236,7 +1475,8 @@ + public CombatTracker bs() { +@@ -1240,7 +1480,8 @@ if (f > 0.0025000002F) { f3 = 1.0F; f2 = (float) Math.sqrt((double) f) * 3.0F; -- f1 = (float) Math.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F; +- f1 = (float) MathHelper.b(d1, d0) * 180.0F / 3.1415927F - 90.0F; + // CraftBukkit - Math -> TrigMath + f1 = (float) org.bukkit.craftbukkit.TrigMath.atan2(d1, d0) * 180.0F / 3.1415927F - 90.0F; } - if (this.ax > 0.0F) { -@@ -1400,6 +1640,13 @@ - if (list != null && !list.isEmpty()) { + if (this.az > 0.0F) { +@@ -1413,6 +1654,13 @@ for (int i = 0; i < list.size(); ++i) { Entity entity = (Entity) list.get(i); -+ + + // TODO better check now? + // CraftBukkit start - Only handle mob (non-player) collisions every other tick + if (entity instanceof EntityLiving && !(this instanceof EntityPlayer) && this.ticksLived % 2 == 0) { + continue; + } + // CraftBukkit end - - if (entity.ae()) { - this.s(entity); -@@ -1415,6 +1662,18 @@ ++ + this.s(entity); + } + } +@@ -1425,6 +1673,18 @@ public void mount(Entity entity) { if (this.vehicle != null && entity == null) { @@ -528,7 +563,7 @@ + } + } + // CraftBukkit end -+ - if (!this.world.isStatic) { ++ + if (!this.world.isClientSide) { this.q(this.vehicle); } diff --git a/nms-patches/EntityMinecartAbstract.patch b/nms-patches/EntityMinecartAbstract.patch index c53c24bf6b..0efee0f152 100644 --- a/nms-patches/EntityMinecartAbstract.patch +++ b/nms-patches/EntityMinecartAbstract.patch @@ -1,8 +1,8 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityMinecartAbstract.java 2014-11-28 17:43:43.129707434 +0000 -+++ src/main/java/net/minecraft/server/EntityMinecartAbstract.java 2014-11-28 17:38:18.000000000 +0000 -@@ -2,6 +2,15 @@ - +--- /home/matt/mc-dev-private//net/minecraft/server/EntityMinecartAbstract.java 2015-02-26 22:40:22.623608139 +0000 ++++ src/main/java/net/minecraft/server/EntityMinecartAbstract.java 2015-02-26 22:40:22.623608139 +0000 +@@ -4,6 +4,15 @@ import java.util.Iterator; + import java.util.Map; +// CraftBukkit start +import org.bukkit.Location; @@ -16,11 +16,10 @@ public abstract class EntityMinecartAbstract extends Entity implements INamableTileEntity { private boolean a; -@@ -13,6 +22,17 @@ - private double g; +@@ -16,10 +25,23 @@ private double h; private double i; -+ + + // CraftBukkit start + public boolean slowWhenEmpty = true; + private double derailedX = 0.5; @@ -31,19 +30,17 @@ + private double flyingZ = 0.95; + public double maxSpeed = 0.4D; + // CraftBukkit end - ++ public EntityMinecartAbstract(World world) { super(world); -@@ -79,6 +99,8 @@ - this.lastX = d0; - this.lastY = d1; - this.lastZ = d2; -+ + this.k = true; + this.setSize(0.98F, 0.7F); ++ + this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleCreateEvent((Vehicle) this.getBukkitEntity())); // CraftBukkit } - public double an() { -@@ -90,16 +112,39 @@ + public static EntityMinecartAbstract a(World world, double d0, double d1, double d2, EntityMinecartAbstract.EnumMinecartType entityminecartabstract_enumminecarttype) { +@@ -92,6 +114,19 @@ if (this.isInvulnerable(damagesource)) { return false; } else { @@ -60,15 +57,10 @@ + + f = (float) event.getDamage(); + // CraftBukkit end -+ this.k(-this.r()); this.j(10); this.ac(); - this.setDamage(this.getDamage() + f * 10.0F); - boolean flag = damagesource.getEntity() instanceof EntityHuman && ((EntityHuman) damagesource.getEntity()).abilities.canInstantlyBuild; - -- if (flag || this.getDamage() > 40.0F) { -+ if (flag || this.getDamage() > 40.0F) { // CraftBukkit - multi-world should still allow teleport even if default vanilla nether disabled +@@ -102,6 +137,15 @@ if (this.passenger != null) { this.passenger.mount((Entity) null); } @@ -84,10 +76,10 @@ if (flag && !this.hasCustomName()) { this.die(); -@@ -135,6 +180,14 @@ +@@ -140,6 +184,14 @@ } - public void s_() { + public void t_() { + // CraftBukkit start + double prevX = this.locX; + double prevY = this.locY; @@ -99,16 +91,16 @@ if (this.getType() > 0) { this.j(this.getType() - 1); } -@@ -155,7 +208,7 @@ +@@ -160,7 +212,7 @@ i = this.L(); if (this.ak) { - if (minecraftserver.getAllowNether()) { -+ if (true || minecraftserver.getAllowNether()) { ++ if (true || minecraftserver.getAllowNether()) { // CraftBukkit - multi-world should still allow teleport even if default vanilla nether disabled if (this.vehicle == null && this.al++ >= i) { this.al = i; - this.portalCooldown = this.ar(); -@@ -252,6 +305,20 @@ + this.portalCooldown = this.aq(); +@@ -257,6 +309,20 @@ } this.setYawPitch(this.yaw, this.pitch); @@ -125,11 +117,11 @@ + this.world.getServer().getPluginManager().callEvent(new org.bukkit.event.vehicle.VehicleMoveEvent(vehicle, from, to)); + } + // CraftBukkit end -+ ++ Iterator iterator = this.world.getEntities(this, this.getBoundingBox().grow(0.20000000298023224D, 0.0D, 0.20000000298023224D)).iterator(); while (iterator.hasNext()) { -@@ -275,7 +342,7 @@ +@@ -280,7 +346,7 @@ } protected double m() { @@ -138,7 +130,7 @@ } public void a(int i, int j, int k, boolean flag) {} -@@ -286,16 +353,20 @@ +@@ -291,16 +357,20 @@ this.motX = MathHelper.a(this.motX, -d0, d0); this.motZ = MathHelper.a(this.motZ, -d0, d0); if (this.onGround) { @@ -165,7 +157,7 @@ } } -@@ -483,7 +554,7 @@ +@@ -488,7 +558,7 @@ } protected void o() { @@ -174,9 +166,9 @@ this.motX *= 0.996999979019165D; this.motY *= 0.0D; this.motZ *= 0.996999979019165D; -@@ -611,6 +682,17 @@ - if (!this.world.isStatic) { - if (!entity.T && !this.T) { +@@ -616,6 +686,17 @@ + if (!this.world.isClientSide) { + if (!entity.noclip && !this.noclip) { if (entity != this.passenger) { + // CraftBukkit start + Vehicle vehicle = (Vehicle) this.getBukkitEntity(); @@ -189,10 +181,10 @@ + return; + } + // CraftBukkit end - if (entity instanceof EntityLiving && !(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && this.s() == EnumMinecartType.RIDEABLE && this.motX * this.motX + this.motZ * this.motZ > 0.01D && this.passenger == null && entity.vehicle == null) { + if (entity instanceof EntityLiving && !(entity instanceof EntityHuman) && !(entity instanceof EntityIronGolem) && this.s() == EntityMinecartAbstract.EnumMinecartType.RIDEABLE && this.motX * this.motX + this.motZ * this.motZ > 0.01D && this.passenger == null && entity.vehicle == null) { entity.mount(this); } -@@ -619,7 +701,8 @@ +@@ -624,7 +705,8 @@ double d1 = entity.locZ - this.locZ; double d2 = d0 * d0 + d1 * d1; @@ -202,8 +194,8 @@ d2 = (double) MathHelper.sqrt(d2); d0 /= d2; d1 /= d2; -@@ -775,4 +858,26 @@ - return chatmessage; +@@ -891,4 +973,26 @@ + } } + diff --git a/nms-patches/EntityMinecartCommandBlock.patch b/nms-patches/EntityMinecartCommandBlock.patch new file mode 100644 index 0000000000..1b6e40488a --- /dev/null +++ b/nms-patches/EntityMinecartCommandBlock.patch @@ -0,0 +1,12 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityMinecartCommandBlock.java 2015-02-26 22:40:22.627608139 +0000 ++++ src/main/java/net/minecraft/server/EntityMinecartCommandBlock.java 2015-02-26 22:40:22.627608139 +0000 +@@ -3,6 +3,9 @@ + public class EntityMinecartCommandBlock extends EntityMinecartAbstract { + + private final CommandBlockListenerAbstract a = new CommandBlockListenerAbstract() { ++ { ++ this.sender = (org.bukkit.craftbukkit.entity.CraftMinecartCommand) EntityMinecartCommandBlock.this.getBukkitEntity(); // CraftBukkit - Set the sender ++ } + public void h() { + EntityMinecartCommandBlock.this.getDataWatcher().watch(23, this.getCommand()); + EntityMinecartCommandBlock.this.getDataWatcher().watch(24, IChatBaseComponent.ChatSerializer.a(this.k())); diff --git a/nms-patches/EntityMinecartCommandBlockListener.patch b/nms-patches/EntityMinecartCommandBlockListener.patch deleted file mode 100644 index 7581585ce4..0000000000 --- a/nms-patches/EntityMinecartCommandBlockListener.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityMinecartCommandBlockListener.java 2014-11-28 17:43:43.133707434 +0000 -+++ src/main/java/net/minecraft/server/EntityMinecartCommandBlockListener.java 2014-11-28 17:38:18.000000000 +0000 -@@ -6,6 +6,7 @@ - - EntityMinecartCommandBlockListener(EntityMinecartCommandBlock entityminecartcommandblock) { - this.a = entityminecartcommandblock; -+ this.sender = (org.bukkit.craftbukkit.entity.CraftMinecartCommand) entityminecartcommandblock.getBukkitEntity(); // CraftBukkit - Set the sender - } - - public void h() { diff --git a/nms-patches/EntityMinecartContainer.patch b/nms-patches/EntityMinecartContainer.patch index 7818e31a08..29b8589260 100644 --- a/nms-patches/EntityMinecartContainer.patch +++ b/nms-patches/EntityMinecartContainer.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityMinecartContainer.java 2014-11-28 17:43:43.133707434 +0000 -+++ src/main/java/net/minecraft/server/EntityMinecartContainer.java 2014-11-28 17:38:16.000000000 +0000 -@@ -1,9 +1,48 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityMinecartContainer.java 2015-02-26 22:40:22.631608139 +0000 ++++ src/main/java/net/minecraft/server/EntityMinecartContainer.java 2015-02-26 22:40:22.631608139 +0000 +@@ -1,10 +1,49 @@ package net.minecraft.server; +// CraftBukkit start @@ -16,7 +16,7 @@ - private ItemStack[] items = new ItemStack[36]; + private ItemStack[] items = new ItemStack[27]; // CraftBukkit - 36 -> 27 private boolean b = true; -+ + + // CraftBukkit start + public List transaction = new java.util.ArrayList(); + private int maxStack = MAX_STACK; @@ -47,10 +47,11 @@ + maxStack = size; + } + // CraftBukkit end - ++ public EntityMinecartContainer(World world) { super(world); -@@ -81,7 +120,7 @@ + } +@@ -84,7 +123,7 @@ } public int getMaxStackSize() { diff --git a/nms-patches/EntityMonster.patch b/nms-patches/EntityMonster.patch index a284785cc8..940ded50a6 100644 --- a/nms-patches/EntityMonster.patch +++ b/nms-patches/EntityMonster.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityMonster.java 2014-11-28 17:43:43.137707434 +0000 -+++ src/main/java/net/minecraft/server/EntityMonster.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityMonster.java 2015-02-26 22:40:22.635608139 +0000 ++++ src/main/java/net/minecraft/server/EntityMonster.java 2015-02-26 22:40:22.635608139 +0000 @@ -1,5 +1,7 @@ package net.minecraft.server; @@ -7,8 +7,8 @@ + public abstract class EntityMonster extends EntityCreature implements IMonster { - protected final PathfinderGoal a = new PathfinderGoalAvoidTarget(this, new EntitySelectorExplodingCreeper(this), 4.0F, 1.0D, 2.0D); -@@ -81,7 +83,14 @@ + public EntityMonster(World world) { +@@ -79,7 +81,14 @@ int j = EnchantmentManager.getFireAspectEnchantmentLevel(this); if (j > 0) { diff --git a/nms-patches/EntityMushroomCow.patch b/nms-patches/EntityMushroomCow.patch index a57f1e05fc..424dddb182 100644 --- a/nms-patches/EntityMushroomCow.patch +++ b/nms-patches/EntityMushroomCow.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityMushroomCow.java 2014-11-28 17:43:43.137707434 +0000 -+++ src/main/java/net/minecraft/server/EntityMushroomCow.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityMushroomCow.java 2015-02-26 22:40:22.639608139 +0000 ++++ src/main/java/net/minecraft/server/EntityMushroomCow.java 2015-02-26 22:40:22.639608139 +0000 @@ -1,5 +1,7 @@ package net.minecraft.server; @@ -8,7 +8,7 @@ public class EntityMushroomCow extends EntityCow { public EntityMushroomCow(World world) { -@@ -24,6 +26,15 @@ +@@ -24,6 +26,14 @@ } if (itemstack != null && itemstack.getItem() == Items.SHEARS && this.getAge() >= 0) { @@ -20,7 +20,6 @@ + return false; + } + // CraftBukkit end -+ this.die(); this.world.addParticle(EnumParticle.EXPLOSION_LARGE, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, 0.0D, 0.0D, 0.0D, new int[0]); - if (!this.world.isStatic) { + if (!this.world.isClientSide) { diff --git a/nms-patches/EntityOcelot.patch b/nms-patches/EntityOcelot.patch index 0ec9bbaacb..00c97fdb36 100644 --- a/nms-patches/EntityOcelot.patch +++ b/nms-patches/EntityOcelot.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/EntityOcelot.java 2014-12-10 18:34:37.228492560 +0000 -+++ src/main/java/net/minecraft/server/EntityOcelot.java 2014-12-10 18:33:29.824493292 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityOcelot.java 2015-02-26 22:40:22.643608139 +0000 ++++ src/main/java/net/minecraft/server/EntityOcelot.java 2015-02-26 22:40:22.643608139 +0000 @@ -51,7 +51,7 @@ } @@ -8,23 +8,18 @@ + return !this.isTamed() /*&& this.ticksLived > 2400*/; // CraftBukkit } - protected void aW() { -@@ -95,15 +95,20 @@ - public boolean r(Entity entity) { + protected void initAttributes() { +@@ -96,6 +96,9 @@ return entity.damageEntity(DamageSource.mobAttack(this), 3.0F); } -- -+ + + /* CraftBukkit start + // Function disabled as it has no special function anymore after + // setSitting is disabled. public boolean damageEntity(DamageSource damagesource, float f) { if (this.isInvulnerable(damagesource)) { return false; - } else { -- this.bk.setSitting(false); -+ // CraftBukkit - moved into EntityLiving.d(DamageSource, float) -+ // this.bk.setSitting(false); +@@ -104,6 +107,7 @@ return super.damageEntity(damagesource, f); } } @@ -32,17 +27,17 @@ protected void dropDeathLoot(boolean flag, int i) {} -@@ -124,7 +129,8 @@ +@@ -124,7 +128,8 @@ } - if (!this.world.isStatic) { + if (!this.world.isClientSide) { - if (this.random.nextInt(3) == 0) { + // CraftBukkit - added event call and isCancelled check + if (this.random.nextInt(3) == 0 && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { this.setTamed(true); this.setCatType(1 + this.world.random.nextInt(3)); this.setOwnerUUID(entityhuman.getUniqueID().toString()); -@@ -231,7 +237,7 @@ +@@ -231,7 +236,7 @@ entityocelot.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F); entityocelot.setAgeRaw(-24000); diff --git a/nms-patches/EntityPainting.patch b/nms-patches/EntityPainting.patch index b6ee06ebd9..2e9180978c 100644 --- a/nms-patches/EntityPainting.patch +++ b/nms-patches/EntityPainting.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityPainting.java 2014-11-28 17:43:43.141707434 +0000 -+++ src/main/java/net/minecraft/server/EntityPainting.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityPainting.java 2015-02-26 22:40:22.643608139 +0000 ++++ src/main/java/net/minecraft/server/EntityPainting.java 2015-02-26 22:40:22.647608139 +0000 @@ -9,6 +9,7 @@ public EntityPainting(World world) { diff --git a/nms-patches/EntityPig.patch b/nms-patches/EntityPig.patch index a24a5846fa..ba054dda94 100644 --- a/nms-patches/EntityPig.patch +++ b/nms-patches/EntityPig.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityPig.java 2014-11-28 17:43:43.145707434 +0000 -+++ src/main/java/net/minecraft/server/EntityPig.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityPig.java 2015-02-26 22:40:22.647608139 +0000 ++++ src/main/java/net/minecraft/server/EntityPig.java 2015-02-26 22:40:22.647608139 +0000 @@ -1,5 +1,7 @@ package net.minecraft.server; @@ -7,20 +7,24 @@ + public class EntityPig extends EntityAnimal { - private final PathfinderGoalPassengerCarrotStick bk; -@@ -111,10 +113,17 @@ - public void onLightningStrike(EntityLightning entitylightning) { - if (!this.world.isStatic) { + private final PathfinderGoalPassengerCarrotStick bm; +@@ -112,6 +114,12 @@ + if (!this.world.isClientSide && !this.dead) { EntityPigZombie entitypigzombie = new EntityPigZombie(this.world); -+ + + // CraftBukkit start + if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) { + return; + } + // CraftBukkit end - ++ entitypigzombie.setEquipment(0, new ItemStack(Items.GOLDEN_SWORD)); entitypigzombie.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch); + entitypigzombie.k(this.ce()); +@@ -120,7 +128,8 @@ + entitypigzombie.setCustomNameVisible(this.getCustomNameVisible()); + } + - this.world.addEntity(entitypigzombie); + // CraftBukkit - added a reason for spawning this creature + this.world.addEntity(entitypigzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.LIGHTNING); diff --git a/nms-patches/EntityPigZombie.patch b/nms-patches/EntityPigZombie.patch new file mode 100644 index 0000000000..e3513f3987 --- /dev/null +++ b/nms-patches/EntityPigZombie.patch @@ -0,0 +1,11 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityPigZombie.java 2015-02-26 22:40:22.651608139 +0000 ++++ src/main/java/net/minecraft/server/EntityPigZombie.java 2015-02-26 22:40:22.651608139 +0000 +@@ -6,7 +6,7 @@ + + private static final UUID b = UUID.fromString("49455A49-7EC5-45BA-B886-3B90B23A1718"); + private static final AttributeModifier c = (new AttributeModifier(EntityPigZombie.b, "Attacking speed boost", 0.05D, 0)).a(false); +- private int angerLevel; ++ public int angerLevel; // CraftBukkit - public + private int soundDelay; + private UUID hurtBy; + diff --git a/nms-patches/EntityPlayer.patch b/nms-patches/EntityPlayer.patch index f10389d248..e8c0af4c30 100644 --- a/nms-patches/EntityPlayer.patch +++ b/nms-patches/EntityPlayer.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/EntityPlayer.java 2015-02-20 15:35:53.244364933 +1100 -+++ src/main/java/net/minecraft/server/EntityPlayer.java 2015-02-20 15:35:53.248364925 +1100 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityPlayer.java 2015-02-26 22:40:22.655608139 +0000 ++++ src/main/java/net/minecraft/server/EntityPlayer.java 2015-02-26 22:40:22.659608139 +0000 @@ -13,6 +13,17 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -17,12 +17,29 @@ + public class EntityPlayer extends EntityHuman implements ICrafting { - private static final Logger bF = LogManager.getLogger(); -@@ -39,6 +50,18 @@ - public boolean g; + private static final Logger bH = LogManager.getLogger(); +@@ -23,14 +34,14 @@ + public double d; + public double e; + public final List chunkCoordIntPairQueue = Lists.newLinkedList(); +- private final List removeQueue = Lists.newLinkedList(); ++ public final List removeQueue = Lists.newLinkedList(); // CraftBukkit - public + private final ServerStatisticManager bK; + private float bL = Float.MIN_VALUE; + private float bM = -1.0E8F; + private int bN = -99999999; + private boolean bO = true; +- private int lastSentExp = -99999999; +- private int invulnerableTicks = 60; ++ public int lastSentExp = -99999999; // CraftBukkit - public ++ public int invulnerableTicks = 60; // CraftBukkit - public + private EntityHuman.EnumChatVisibility bR; + private boolean bS = true; + private long bT = System.currentTimeMillis(); +@@ -40,6 +51,18 @@ public int ping; public boolean viewingCredits; -+ + + // CraftBukkit start + public String displayName; + public IChatBaseComponent listName; @@ -34,14 +51,14 @@ + public double maxHealthCache; + public boolean joining = true; + // CraftBukkit end - ++ public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { super(worldserver, gameprofile); -@@ -69,7 +92,11 @@ - while (!worldserver.getCubes(this, this.getBoundingBox()).isEmpty() && this.locY < 255.0D) { + playerinteractmanager.player = this; +@@ -70,6 +93,11 @@ this.setPosition(this.locX, this.locY + 1.0D, this.locZ); } -- + + // CraftBukkit start + this.displayName = this.getName(); + // this.canPickUpLoot = true; TODO @@ -50,20 +67,20 @@ } public void a(NBTTagCompound nbttagcompound) { -@@ -81,14 +108,40 @@ - this.playerInteractManager.setGameMode(EnumGamemode.getById(nbttagcompound.getInt("playerGameType"))); +@@ -82,12 +110,40 @@ } } -- + + this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit } public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); nbttagcompound.setInt("playerGameType", this.playerInteractManager.getGameMode().getId()); ++ + this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit - } - ++ } ++ + // CraftBukkit start - World fallback code, either respawn location or global spawn + public void spawnIn(World world) { + super.spawnIn(world); @@ -86,16 +103,15 @@ + } + this.dimension = ((WorldServer) this.world).dimension; + this.playerInteractManager.a((WorldServer) world); -+ } + } + // CraftBukkit end -+ + public void levelDown(int i) { super.levelDown(i); - this.lastSentExp = -1; -@@ -114,6 +167,11 @@ +@@ -114,6 +170,11 @@ } - public void s_() { + public void t_() { + // CraftBukkit start + if (this.joining) { + this.joining = false; @@ -104,7 +120,7 @@ this.playerInteractManager.a(); --this.invulnerableTicks; if (this.noDamageTicks > 0) { -@@ -155,7 +213,7 @@ +@@ -155,7 +216,7 @@ chunk = this.world.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z); if (chunk.isReady()) { arraylist.add(chunk); @@ -113,29 +129,21 @@ iterator1.remove(); } } -@@ -220,8 +278,9 @@ +@@ -220,8 +281,9 @@ } } + // CraftBukkit - Optionally scale health - if (this.getHealth() != this.bK || this.bL != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.bM) { + if (this.getHealth() != this.bM || this.bN != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.bO) { - this.playerConnection.sendPacket(new PacketPlayOutUpdateHealth(this.getHealth(), this.foodData.getFoodLevel(), this.foodData.getSaturationLevel())); + this.playerConnection.sendPacket(new PacketPlayOutUpdateHealth(this.getBukkitEntity().getScaledHealth(), this.foodData.getFoodLevel(), this.foodData.getSaturationLevel())); - this.bK = this.getHealth(); - this.bL = this.foodData.getFoodLevel(); - this.bM = this.foodData.getSaturationLevel() == 0.0F; -@@ -229,15 +288,14 @@ + this.bM = this.getHealth(); + this.bN = this.foodData.getFoodLevel(); + this.bO = this.foodData.getSaturationLevel() == 0.0F; +@@ -237,7 +299,14 @@ - if (this.getHealth() + this.getAbsorptionHearts() != this.bJ) { - this.bJ = this.getHealth() + this.getAbsorptionHearts(); -- Collection collection = this.getScoreboard().getObjectivesForCriteria(IScoreboardCriteria.g); -- Iterator iterator = collection.iterator(); -- -- while (iterator.hasNext()) { -- ScoreboardObjective scoreboardobjective = (ScoreboardObjective) iterator.next(); -- -- this.getScoreboard().getPlayerScoreForObjective(this.getName(), scoreboardobjective).updateForList(Arrays.asList(new EntityHuman[] { this})); -- } + this.getScoreboard().getPlayerScoreForObjective(this.getName(), scoreboardobjective).updateForList(Arrays.asList(new EntityHuman[] { this})); + } + // CraftBukkit - Update ALL the scores! + this.world.getServer().getScoreboardManager().updateAllScoresForList(IScoreboardCriteria.g, this.getName(), com.google.common.collect.ImmutableList.of(this)); + } @@ -147,25 +155,24 @@ if (this.expTotal != this.lastSentExp) { this.lastSentExp = this.expTotal; -@@ -247,7 +305,17 @@ - if (this.ticksLived % 20 * 5 == 0 && !this.getStatisticManager().hasAchievement(AchievementList.L)) { - this.h_(); +@@ -248,6 +317,16 @@ + this.i_(); } -+ + + // CraftBukkit start - initialize oldLevel and fire PlayerLevelChangeEvent + if (this.oldLevel == -1) { + this.oldLevel = this.expLevel; + } - ++ + if (this.oldLevel != this.expLevel) { + CraftEventFactory.callPlayerLevelChangeEvent(this.world.getServer().getPlayer((EntityPlayer) this), this.oldLevel, this.expLevel); + this.oldLevel = this.expLevel; + } -+ // CraftBukkit end ++ // CraftBukkit end } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Ticking player"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Player being ticked"); -@@ -296,30 +364,64 @@ +@@ -296,30 +375,63 @@ } public void die(DamageSource damagesource) { @@ -175,12 +182,6 @@ + if (this.dead) { + return; + } - -- if (scoreboardteambase != null && scoreboardteambase.j() != EnumNameTagVisibility.ALWAYS) { -- if (scoreboardteambase.j() == EnumNameTagVisibility.HIDE_FOR_OTHER_TEAMS) { -- this.server.getPlayerList().a((EntityHuman) this, this.br().b()); -- } else if (scoreboardteambase.j() == EnumNameTagVisibility.HIDE_FOR_OWN_TEAM) { -- this.server.getPlayerList().b((EntityHuman) this, this.br().b()); + java.util.List loot = new java.util.ArrayList(); + boolean keepInventory = this.world.getGameRules().getBoolean("keepInventory"); + @@ -188,17 +189,22 @@ + for (int i = 0; i < this.inventory.items.length; ++i) { + if (this.inventory.items[i] != null) { + loot.add(CraftItemStack.asCraftMirror(this.inventory.items[i])); - } ++ } + } -+ + +- if (scoreboardteambase != null && scoreboardteambase.j() != ScoreboardTeamBase.EnumNameTagVisibility.ALWAYS) { +- if (scoreboardteambase.j() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OTHER_TEAMS) { +- this.server.getPlayerList().a((EntityHuman) this, this.bs().b()); +- } else if (scoreboardteambase.j() == ScoreboardTeamBase.EnumNameTagVisibility.HIDE_FOR_OWN_TEAM) { +- this.server.getPlayerList().b((EntityHuman) this, this.bs().b()); + for (int i = 0; i < this.inventory.armor.length; ++i) { + if (this.inventory.armor[i] != null) { + loot.add(CraftItemStack.asCraftMirror(this.inventory.armor[i])); -+ } + } + } + } + -+ IChatBaseComponent chatmessage = this.br().b(); ++ IChatBaseComponent chatmessage = this.bs().b(); + + String deathmessage = chatmessage.c(); + org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory); @@ -209,19 +215,19 @@ + if (deathMessage.equals(deathmessage)) { + this.server.getPlayerList().sendMessage(chatmessage); } else { -- this.server.getPlayerList().sendMessage(this.br().b()); +- this.server.getPlayerList().sendMessage(this.bs().b()); + this.server.getPlayerList().sendMessage(org.bukkit.craftbukkit.util.CraftChatMessage.fromString(deathMessage)); } } -+ + +- if (!this.world.getGameRules().getBoolean("keepInventory")) { +- this.inventory.n(); + // we clean the player's inventory after the EntityDeathEvent is called so plugins can get the exact state of the inventory. + if (!event.getKeepInventory()) { + for (int i = 0; i < this.inventory.items.length; ++i) { + this.inventory.items[i] = null; + } - -- if (!this.world.getGameRules().getBoolean("keepInventory")) { -- this.inventory.n(); ++ + for (int i = 0; i < this.inventory.armor.length; ++i) { + this.inventory.armor[i] = null; + } @@ -231,7 +237,7 @@ + this.closeInventory(); + this.e((Entity) this); // Remove spectated target + // CraftBukkit end -+ ++ + // CraftBukkit - Get our scores instead + Collection collection = this.world.getServer().getScoreboardManager().getScoreboardScores(IScoreboardCriteria.d, this.getName(), new java.util.ArrayList()); Iterator iterator = collection.iterator(); @@ -243,17 +249,17 @@ scoreboardscore.incrementScore(); } -@@ -376,7 +478,8 @@ +@@ -376,7 +488,8 @@ } - private boolean cq() { + private boolean cr() { - return this.server.getPVP(); + // CraftBukkit - this.server.getPvP() -> this.world.pvpMode + return this.world.pvpMode; } public void c(int i) { -@@ -388,6 +491,8 @@ +@@ -388,6 +501,8 @@ } else { if (this.dimension == 0 && i == 1) { this.b((Statistic) AchievementList.C); @@ -262,7 +268,7 @@ BlockPosition blockposition = this.server.getWorldServer(i).getDimensionSpawn(); if (blockposition != null) { -@@ -395,11 +500,16 @@ +@@ -395,11 +510,16 @@ } i = 1; @@ -278,18 +284,17 @@ + this.server.getPlayerList().changeDimension(this, i, cause); + // CraftBukkit end this.lastSentExp = -1; - this.bK = -1.0F; - this.bL = -1; -@@ -442,6 +552,8 @@ + this.bM = -1.0F; + this.bN = -1; +@@ -442,6 +562,7 @@ } public void a(boolean flag, boolean flag1, boolean flag2) { + if (!this.sleeping) return; // CraftBukkit - Can't leave bed if not in one! -+ if (this.isSleeping()) { this.u().getTracker().sendPacketToEntity(this, new PacketPlayOutAnimation(this, 2)); } -@@ -457,7 +569,7 @@ +@@ -457,7 +578,7 @@ Entity entity1 = this.vehicle; super.mount(entity); @@ -298,11 +303,11 @@ this.playerConnection.sendPacket(new PacketPlayOutAttachEntity(0, this, this.vehicle)); this.playerConnection.a(this.locX, this.locY, this.locZ, this.yaw, this.pitch); } -@@ -490,19 +602,46 @@ +@@ -490,19 +611,46 @@ this.playerConnection.sendPacket(new PacketPlayOutOpenSignEditor(tileentitysign.getPosition())); } -- public void nextContainerCounter() { +- private void nextContainerCounter() { + public int nextContainerCounter() { // CraftBukkit - private void -> public int this.containerCounter = this.containerCounter % 100 + 1; + return containerCounter; // CraftBukkit @@ -318,7 +323,7 @@ this.nextContainerCounter(); this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, itileentitycontainer.getContainerName(), itileentitycontainer.getScoreboardDisplayName())); - this.activeContainer = itileentitycontainer.createContainer(this.inventory, this); -+ this.activeContainer = container; // CraftBukkit ++ this.activeContainer = container; // CraftBukkit this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); } @@ -329,7 +334,7 @@ + boolean cancelled = false; + if (iinventory instanceof ITileInventory) { + ITileInventory itileinventory = (ITileInventory) iinventory; -+ cancelled = itileinventory.q_() && !this.a(itileinventory.i()) && !this.v(); ++ cancelled = itileinventory.r_() && !this.a(itileinventory.i()) && !this.v(); + } + + Container container; @@ -347,12 +352,12 @@ if (this.activeContainer != this.defaultContainer) { this.closeInventory(); } -@@ -510,9 +649,11 @@ +@@ -510,9 +658,11 @@ if (iinventory instanceof ITileInventory) { ITileInventory itileinventory = (ITileInventory) iinventory; -- if (itileinventory.q_() && !this.a(itileinventory.i()) && !this.v()) { -+ if (itileinventory.q_() && !this.a(itileinventory.i()) && !this.v() && container == null) { // CraftBukkit - allow plugins to uncancel the lock +- if (itileinventory.r_() && !this.a(itileinventory.i()) && !this.v()) { ++ if (itileinventory.r_() && !this.a(itileinventory.i()) && !this.v() && container == null) { // CraftBukkit - allow plugins to uncancel the lock this.playerConnection.sendPacket(new PacketPlayOutChat(new ChatMessage("container.isLocked", new Object[] { iinventory.getScoreboardDisplayName()}), (byte) 2)); this.playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect("random.door_close", this.locX, this.locY, this.locZ, 1.0F, 1.0F)); + @@ -360,20 +365,20 @@ return; } } -@@ -520,10 +661,10 @@ +@@ -520,10 +670,10 @@ this.nextContainerCounter(); if (iinventory instanceof ITileEntityContainer) { this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, ((ITileEntityContainer) iinventory).getContainerName(), iinventory.getScoreboardDisplayName(), iinventory.getSize())); - this.activeContainer = ((ITileEntityContainer) iinventory).createContainer(this.inventory, this); -+ this.activeContainer = container; // CraftBukkit ++ this.activeContainer = container; // CraftBukkit } else { this.playerConnection.sendPacket(new PacketPlayOutOpenWindow(this.containerCounter, "minecraft:container", iinventory.getScoreboardDisplayName(), iinventory.getSize())); - this.activeContainer = new ContainerChest(this.inventory, iinventory, this); -+ this.activeContainer = container; // CraftBukkit ++ this.activeContainer = container; // CraftBukkit } this.activeContainer.windowId = this.containerCounter; -@@ -531,8 +672,14 @@ +@@ -531,8 +681,14 @@ } public void openTrade(IMerchant imerchant) { @@ -385,11 +390,11 @@ + // CraftBukkit end this.nextContainerCounter(); - this.activeContainer = new ContainerMerchant(this.inventory, imerchant, this.world); -+ this.activeContainer = container; // CraftBukkit ++ this.activeContainer = container; // CraftBukkit this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); InventoryMerchant inventorymerchant = ((ContainerMerchant) this.activeContainer).e(); -@@ -552,13 +699,20 @@ +@@ -552,13 +708,20 @@ } public void openHorseInventory(EntityHorse entityhorse, IInventory iinventory) { @@ -399,7 +404,7 @@ + iinventory.closeContainer(this); + return; + } -+ // CraftBukkit end ++ // CraftBukkit end if (this.activeContainer != this.defaultContainer) { this.closeInventory(); } @@ -411,8 +416,8 @@ this.activeContainer.windowId = this.containerCounter; this.activeContainer.addSlotListener(this); } -@@ -587,6 +741,11 @@ - public void a(Container container, List list) { +@@ -587,6 +750,11 @@ + public void a(Container container, List list) { this.playerConnection.sendPacket(new PacketPlayOutWindowItems(container.windowId, list)); this.playerConnection.sendPacket(new PacketPlayOutSetSlot(-1, -1, this.inventory.getCarried())); + // CraftBukkit start - Send a Set Slot to update the crafting result slot @@ -423,7 +428,7 @@ } public void setContainerData(Container container, int i, int j) { -@@ -601,6 +760,7 @@ +@@ -601,6 +769,7 @@ } public void closeInventory() { @@ -431,41 +436,42 @@ this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId)); this.p(); } -@@ -681,7 +841,16 @@ +@@ -681,8 +850,17 @@ public void triggerHealthUpdate() { - this.bK = -1.0E8F; + this.bM = -1.0E8F; + this.lastSentExp = -1; // CraftBukkit - Added to reset -+ } -+ + } + + // CraftBukkit start - Support multi-line messages + public void sendMessage(IChatBaseComponent[] ichatbasecomponent) { + for (IChatBaseComponent component : ichatbasecomponent) { + this.sendMessage(component); + } - } ++ } + // CraftBukkit end - ++ public void b(IChatBaseComponent ichatbasecomponent) { this.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent)); -@@ -747,6 +916,8 @@ + } +@@ -747,6 +925,8 @@ } - public void a(EnumGamemode enumgamemode) { -+ getBukkitEntity().setGameMode(org.bukkit.GameMode.getByValue(enumgamemode.getId())); + public void a(WorldSettings.EnumGamemode worldsettings_enumgamemode) { ++ getBukkitEntity().setGameMode(org.bukkit.GameMode.getByValue(worldsettings_enumgamemode.getId())); + /* CraftBukkit start - defer to our setGameMode - this.playerInteractManager.setGameMode(enumgamemode); - this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) enumgamemode.getId())); - if (enumgamemode == EnumGamemode.SPECTATOR) { -@@ -757,6 +928,7 @@ + this.playerInteractManager.setGameMode(worldsettings_enumgamemode); + this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(3, (float) worldsettings_enumgamemode.getId())); + if (worldsettings_enumgamemode == WorldSettings.EnumGamemode.SPECTATOR) { +@@ -757,6 +937,7 @@ this.updateAbilities(); - this.bO(); + this.bP(); + // CraftBukkit end */ } public boolean v() { -@@ -768,6 +940,7 @@ +@@ -768,6 +949,7 @@ } public boolean a(int i, String s) { @@ -473,7 +479,7 @@ if ("seed".equals(s) && !this.server.ad()) { return true; } else if (!"tell".equals(s) && !"help".equals(s) && !"me".equals(s) && !"trigger".equals(s)) { -@@ -781,6 +954,9 @@ +@@ -781,6 +963,9 @@ } else { return true; } @@ -483,7 +489,7 @@ } public String w() { -@@ -867,6 +1043,129 @@ +@@ -867,6 +1052,129 @@ } public IChatBaseComponent getPlayerListName() { @@ -526,21 +532,21 @@ + this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(1, 0)); + } + } -+ ++ + private float pluginRainPosition; + private float pluginRainPositionPrevious; -+ ++ + public void updateWeather(float oldRain, float newRain, float oldThunder, float newThunder) { + if (this.weather == null) { + // Vanilla + if (oldRain != newRain) { + this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, newRain)); -+ } ++ } + } else { + // Plugin + if (pluginRainPositionPrevious != pluginRainPosition) { + this.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, pluginRainPosition)); -+ } ++ } + } + + if (oldThunder != newThunder) { @@ -551,7 +557,7 @@ + } + } + } -+ ++ + public void tickWeather() { + if (this.weather == null) return; + diff --git a/nms-patches/EntityPotion.patch b/nms-patches/EntityPotion.patch index b29dbc175e..5d169e6544 100644 --- a/nms-patches/EntityPotion.patch +++ b/nms-patches/EntityPotion.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityPotion.java 2014-11-28 17:43:43.149707434 +0000 -+++ src/main/java/net/minecraft/server/EntityPotion.java 2014-11-28 17:38:21.000000000 +0000 -@@ -3,6 +3,13 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityPotion.java 2015-02-26 22:40:22.663608139 +0000 ++++ src/main/java/net/minecraft/server/EntityPotion.java 2015-02-26 22:40:22.663608139 +0000 +@@ -3,9 +3,16 @@ import java.util.Iterator; import java.util.List; @@ -13,9 +13,13 @@ + public class EntityPotion extends EntityProjectile { - public ItemStack item; -@@ -57,12 +64,15 @@ - if (!this.world.isStatic) { +- private ItemStack item; ++ public ItemStack item; // CraftBukkit - public + + public EntityPotion(World world) { + super(world); +@@ -57,13 +64,16 @@ + if (!this.world.isClientSide) { List list = Items.POTION.h(this.item); - if (list != null && !list.isEmpty()) { @@ -24,19 +28,19 @@ List list1 = this.world.a(EntityLiving.class, axisalignedbb); - if (!list1.isEmpty()) { -+ if (true || !list1.isEmpty()) { // CraftBukkit - Run code even if there are no entities around ++ if (true || !list1.isEmpty()) { // CraftBukkit - Run code even if there are no entities around Iterator iterator = list1.iterator(); -+ + + // CraftBukkit + HashMap affected = new HashMap(); - ++ while (iterator.hasNext()) { EntityLiving entityliving = (EntityLiving) iterator.next(); -@@ -74,12 +84,35 @@ - if (entityliving == movingobjectposition.entity) { + double d0 = this.h(entityliving); +@@ -75,12 +85,35 @@ d1 = 1.0D; } -+ + + // CraftBukkit start + affected.put((LivingEntity) entityliving.getBukkitEntity(), d1); + } @@ -52,19 +56,20 @@ + EntityLiving entityliving = ((CraftLivingEntity) victim).getHandle(); + double d1 = event.getIntensity(victim); + // CraftBukkit end - ++ Iterator iterator1 = list.iterator(); while (iterator1.hasNext()) { MobEffect mobeffect = (MobEffect) iterator1.next(); int i = mobeffect.getEffectId(); -+ + + // CraftBukkit start - Abide by PVP settings - for players only! + if (!this.world.pvpMode && this.getShooter() instanceof EntityPlayer && entityliving instanceof EntityPlayer && entityliving != this.getShooter()) { + // Block SLOWER_MOVEMENT, SLOWER_DIG, HARM, BLINDNESS, HUNGER, WEAKNESS and POISON potions + if (i == 2 || i == 4 || i == 7 || i == 15 || i == 17 || i == 18 || i == 19) continue; + } + // CraftBukkit end - ++ if (MobEffectList.byId[i].isInstant()) { MobEffectList.byId[i].applyInstantEffect(this, this.getShooter(), entityliving, mobeffect.getAmplifier(), d1); + } else { diff --git a/nms-patches/EntityProjectile.patch b/nms-patches/EntityProjectile.patch index 2a7c41f72b..b81796eff3 100644 --- a/nms-patches/EntityProjectile.patch +++ b/nms-patches/EntityProjectile.patch @@ -1,24 +1,26 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityProjectile.java 2014-11-28 17:43:43.153707434 +0000 -+++ src/main/java/net/minecraft/server/EntityProjectile.java 2014-11-28 17:38:23.000000000 +0000 -@@ -25,6 +25,7 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityProjectile.java 2015-02-26 22:40:22.667608139 +0000 ++++ src/main/java/net/minecraft/server/EntityProjectile.java 2015-02-26 22:40:22.667608139 +0000 +@@ -11,8 +11,8 @@ + private Block inBlockId; + protected boolean inGround; + public int shake; +- private EntityLiving shooter; +- private String shooterName; ++ public EntityLiving shooter; // CraftBukkit - public ++ public String shooterName; // CraftBukkit - public + private int i; + private int ar; + +@@ -26,6 +26,7 @@ public EntityProjectile(World world, EntityLiving entityliving) { super(world); this.shooter = entityliving; + this.projectileSource = (org.bukkit.entity.LivingEntity) entityliving.getBukkitEntity(); // CraftBukkit - this.a(0.25F, 0.25F); + this.setSize(0.25F, 0.25F); 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); -@@ -130,7 +131,7 @@ - MovingObjectPosition movingobjectposition1 = axisalignedbb.a(vec3d, vec3d1); - - if (movingobjectposition1 != null) { -- double d1 = vec3d.f(movingobjectposition1.pos); -+ double d1 = vec3d.distanceSquared(movingobjectposition1.pos); // CraftBukkit - distance efficiency - - if (d1 < d0 || d0 == 0.0D) { - entity = entity1; -@@ -150,6 +151,11 @@ - this.aq(); +@@ -151,6 +152,11 @@ + this.d(movingobjectposition.a()); } else { this.a(movingobjectposition); + // CraftBukkit start diff --git a/nms-patches/EntityRabbit.patch b/nms-patches/EntityRabbit.patch index 278933755c..f794164eee 100644 --- a/nms-patches/EntityRabbit.patch +++ b/nms-patches/EntityRabbit.patch @@ -1,25 +1,25 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityRabbit.java Sat Dec 6 21:44:10 2014 -+++ src/main/java/net/minecraft/server/EntityRabbit.java Sat Dec 6 21:33:23 2014 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityRabbit.java 2015-02-26 22:40:22.671608138 +0000 ++++ src/main/java/net/minecraft/server/EntityRabbit.java 2015-02-26 22:40:22.675608138 +0000 @@ -21,6 +21,12 @@ - this.g = new ControllerJumpRabbit(this, this); - this.moveController = new ControllerMoveRabbit(this); + this.g = new EntityRabbit.ControllerJumpRabbit(this); + this.moveController = new EntityRabbit.ControllerMoveRabbit(this); ((Navigation) this.getNavigation()).a(true); + this.initializePathFinderGoals(); // CraftBukkit - moved code + this.b(0.0D); + } -+ ++ + // CraftBukkit start - code from constructor + public void initializePathFinderGoals(){ this.navigation.a(2.5F); this.goalSelector.a(1, new PathfinderGoalFloat(this)); - this.goalSelector.a(1, new PathfinderGoalRabbitPanic(this, 1.33D)); -@@ -31,8 +37,8 @@ + this.goalSelector.a(1, new EntityRabbit.PathfinderGoalRabbitPanic(this, 1.33D)); +@@ -33,8 +39,8 @@ this.goalSelector.a(11, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 10.0F)); - this.bk = new PathfinderGoalRabbitAvoidTarget(this, new EntitySelectorRabbitWolf(this), 16.0F, 1.33D, 1.33D); - this.goalSelector.a(4, this.bk); + this.bm = new EntityRabbit.PathfinderGoalRabbitAvoidTarget(this, EntityWolf.class, 16.0F, 1.33D, 1.33D); + this.goalSelector.a(4, this.bm); - this.b(0.0D); } + // CraftBukkit end - protected float bD() { - return this.moveController.a() && this.moveController.e() > this.locY + 0.5D ? 0.5F : this.br.b(); \ No newline at end of file + protected float bE() { + return this.moveController.a() && this.moveController.e() > this.locY + 0.5D ? 0.5F : this.bt.b(); diff --git a/nms-patches/EntitySheep.patch b/nms-patches/EntitySheep.patch index 4f94f9dc19..347dc5446a 100644 --- a/nms-patches/EntitySheep.patch +++ b/nms-patches/EntitySheep.patch @@ -1,29 +1,43 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntitySheep.java 2014-11-28 17:43:43.153707434 +0000 -+++ src/main/java/net/minecraft/server/EntitySheep.java 2014-11-28 17:38:19.000000000 +0000 -@@ -4,6 +4,11 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntitySheep.java 2015-02-26 22:40:22.675608138 +0000 ++++ src/main/java/net/minecraft/server/EntitySheep.java 2015-02-26 22:40:22.679608138 +0000 +@@ -4,12 +4,25 @@ import java.util.Map; import java.util.Random; +// CraftBukkit start +import org.bukkit.event.entity.SheepRegrowWoolEvent; +import org.bukkit.event.player.PlayerShearEntityEvent; ++import org.bukkit.inventory.InventoryView; +// CraftBukkit end + public class EntitySheep extends EntityAnimal { - private final InventoryCrafting bk = new InventoryCrafting(new ContainerSheepBreed(this), 2, 1); -@@ -30,6 +35,7 @@ + private final InventoryCrafting bm = new InventoryCrafting(new Container() { + public boolean a(EntityHuman entityhuman) { + return false; + } ++ ++ // CraftBukkit start ++ @Override ++ public InventoryView getBukkitView() { ++ return null; // TODO: O.O ++ } ++ // CraftBukkit end + }, 2, 1); + private static final Map bo = Maps.newEnumMap(EnumColor.class); + private int bp; +@@ -34,6 +47,7 @@ this.goalSelector.a(8, new PathfinderGoalRandomLookaround(this)); - this.bk.setItem(0, new ItemStack(Items.DYE, 1, 0)); - this.bk.setItem(1, new ItemStack(Items.DYE, 1, 0)); -+ this.bk.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event + this.bm.setItem(0, new ItemStack(Items.DYE, 1, 0)); + this.bm.setItem(1, new ItemStack(Items.DYE, 1, 0)); ++ this.bm.resultInventory = new InventoryCraftResult(); // CraftBukkit - add result slot for event } protected void E() { -@@ -82,6 +88,15 @@ +@@ -86,6 +100,15 @@ if (itemstack != null && itemstack.getItem() == Items.SHEARS && !this.isSheared() && !this.isBaby()) { - if (!this.world.isStatic) { + if (!this.world.isClientSide) { + // CraftBukkit start + PlayerShearEntityEvent event = new PlayerShearEntityEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), this.getBukkitEntity()); + this.world.getServer().getPluginManager().callEvent(event); @@ -32,11 +46,11 @@ + return false; + } + // CraftBukkit end -+ ++ this.setSheared(true); int i = 1 + this.random.nextInt(3); -@@ -169,7 +184,14 @@ +@@ -173,7 +196,14 @@ } public void v() { diff --git a/nms-patches/EntitySilverfish.patch b/nms-patches/EntitySilverfish.patch new file mode 100644 index 0000000000..098e5be2d5 --- /dev/null +++ b/nms-patches/EntitySilverfish.patch @@ -0,0 +1,26 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntitySilverfish.java 2015-02-26 22:40:22.679608138 +0000 ++++ src/main/java/net/minecraft/server/EntitySilverfish.java 2015-02-26 22:40:22.683608138 +0000 +@@ -144,6 +144,11 @@ + IBlockData iblockdata = world.getType(blockposition); + + if (BlockMonsterEggs.d(iblockdata)) { ++ // CraftBukkit start ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.MONSTER_EGG, Block.getId(BlockMonsterEggs.getById(iblockdata.getBlock().toLegacyData(iblockdata)))).isCancelled()) { ++ return; ++ } ++ // CraftBukkit end + world.setTypeAndData(blockposition, Blocks.MONSTER_EGG.getBlockData().set(BlockMonsterEggs.VARIANT, BlockMonsterEggs.EnumMonsterEggVarient.a(iblockdata)), 3); + this.silverfish.y(); + this.silverfish.die(); +@@ -187,6 +192,11 @@ + IBlockData iblockdata = world.getType(blockposition1); + + if (iblockdata.getBlock() == Blocks.MONSTER_EGG) { ++ // CraftBukkit start ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1.getX(), blockposition1.getY(), blockposition1.getZ(), Blocks.AIR, 0).isCancelled()) { ++ continue; ++ } ++ // CraftBukkit end + if (world.getGameRules().getBoolean("mobGriefing")) { + world.setAir(blockposition1, true); + } else { diff --git a/nms-patches/EntitySkeleton.patch b/nms-patches/EntitySkeleton.patch index 17b86073a5..4f5402ef4f 100644 --- a/nms-patches/EntitySkeleton.patch +++ b/nms-patches/EntitySkeleton.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntitySkeleton.java 2014-11-28 17:43:43.157707434 +0000 -+++ src/main/java/net/minecraft/server/EntitySkeleton.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntitySkeleton.java 2015-02-26 22:40:22.683608138 +0000 ++++ src/main/java/net/minecraft/server/EntitySkeleton.java 2015-02-26 22:40:22.687608138 +0000 @@ -2,6 +2,8 @@ import java.util.Calendar; @@ -8,8 +8,8 @@ + public class EntitySkeleton extends EntityMonster implements IRangedEntity { - private PathfinderGoalArrowAttack b = new PathfinderGoalArrowAttack(this, 1.0D, 20, 60, 15.0F); -@@ -90,7 +92,14 @@ + private PathfinderGoalArrowAttack a = new PathfinderGoalArrowAttack(this, 1.0D, 20, 60, 15.0F); +@@ -89,7 +91,14 @@ } if (flag) { @@ -25,10 +25,10 @@ } } } -@@ -225,11 +234,30 @@ +@@ -224,11 +233,30 @@ } - if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bz()) > 0 || this.getSkeletonType() == 1) { + if (EnchantmentManager.getEnchantmentLevel(Enchantment.ARROW_FIRE.id, this.bA()) > 0 || this.getSkeletonType() == 1) { - entityarrow.setOnFire(100); + // CraftBukkit start - call EntityCombustEvent + EntityCombustEvent event = new EntityCombustEvent(entityarrow.getBukkitEntity(), 100); @@ -41,7 +41,7 @@ + } + + // CraftBukkit start -+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.bz(), entityarrow, 0.8F); ++ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.bA(), entityarrow, 0.8F); + if (event.isCancelled()) { + event.getProjectile().remove(); + return; @@ -52,7 +52,7 @@ } + // CraftBukkit end - this.makeSound("random.bow", 1.0F, 1.0F / (this.bb().nextFloat() * 0.4F + 0.8F)); + this.makeSound("random.bow", 1.0F, 1.0F / (this.bc().nextFloat() * 0.4F + 0.8F)); - this.world.addEntity(entityarrow); + // this.world.addEntity(entityarrow); // CraftBukkit - moved up } diff --git a/nms-patches/EntitySlice.patch b/nms-patches/EntitySlice.patch deleted file mode 100644 index 5e898280de..0000000000 --- a/nms-patches/EntitySlice.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/EntitySlice.java 2015-02-20 10:18:42.025023871 +0000 -+++ src/main/java/net/minecraft/server/EntitySlice.java 2015-02-20 10:18:42.057023871 +0000 -@@ -4,6 +4,7 @@ - import com.google.common.collect.Multimap; - import com.google.common.collect.Sets; - import java.util.AbstractSet; -+import java.util.Collections; - import java.util.Iterator; - import java.util.Set; - import org.apache.commons.lang3.ClassUtils; -@@ -89,6 +90,11 @@ - } - - public Iterator iterator() { -+ // CraftBukkit start -+ if (!this.a.containsKey(this.c)) { -+ return Collections.EMPTY_LIST.iterator(); -+ } -+ // CraftBukkit end - Iterator iterator = this.a.get(this.c).iterator(); - - return new EntitySliceInnerClass2(this, iterator); diff --git a/nms-patches/EntitySliceInnerClass1.patch b/nms-patches/EntitySliceInnerClass1.patch deleted file mode 100644 index c4cf2192f7..0000000000 --- a/nms-patches/EntitySliceInnerClass1.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/EntitySliceInnerClass1.java 2015-02-20 10:18:41.853023875 +0000 -+++ src/main/java/net/minecraft/server/EntitySliceInnerClass1.java 2015-02-20 10:18:41.853023875 +0000 -@@ -3,6 +3,7 @@ - import com.google.common.collect.Iterators; - import java.util.Iterator; - -+// PAIL: Access transform - class EntitySliceInnerClass1 implements Iterable { - - final Class a; diff --git a/nms-patches/EntitySliceInnerClass2.patch b/nms-patches/EntitySliceInnerClass2.patch deleted file mode 100644 index bd7f1184e7..0000000000 --- a/nms-patches/EntitySliceInnerClass2.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/EntitySliceInnerClass2.java 2015-02-20 10:18:41.945023873 +0000 -+++ src/main/java/net/minecraft/server/EntitySliceInnerClass2.java 2015-02-20 10:18:41.965023873 +0000 -@@ -3,6 +3,7 @@ - import com.google.common.collect.AbstractIterator; - import java.util.Iterator; - -+// PAIL: Access transform - class EntitySliceInnerClass2 extends AbstractIterator { - - final Iterator a; diff --git a/nms-patches/EntitySlime.patch b/nms-patches/EntitySlime.patch index 537fef64a3..6b752069ce 100644 --- a/nms-patches/EntitySlime.patch +++ b/nms-patches/EntitySlime.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntitySlime.java 2014-11-28 17:43:43.157707434 +0000 -+++ src/main/java/net/minecraft/server/EntitySlime.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntitySlime.java 2015-02-26 22:40:22.687608138 +0000 ++++ src/main/java/net/minecraft/server/EntitySlime.java 2015-02-26 22:40:22.691608138 +0000 @@ -1,5 +1,9 @@ package net.minecraft.server; @@ -10,11 +10,19 @@ public class EntitySlime extends EntityInsentient implements IMonster { public float a; -@@ -132,6 +136,18 @@ +@@ -23,7 +27,7 @@ + this.datawatcher.a(16, Byte.valueOf((byte) 1)); + } - if (!this.world.isStatic && i > 1 && this.getHealth() <= 0.0F) { +- protected void setSize(int i) { ++ public void setSize(int i) { // CraftBukkit - public + this.datawatcher.watch(16, Byte.valueOf((byte) i)); + this.setSize(0.51000005F * (float) i, 0.51000005F * (float) i); + this.setPosition(this.locX, this.locY, this.locZ); +@@ -133,6 +137,18 @@ + if (!this.world.isClientSide && i > 1 && this.getHealth() <= 0.0F) { int j = 2 + this.random.nextInt(3); -+ + + // CraftBukkit start + SlimeSplitEvent event = new SlimeSplitEvent((org.bukkit.entity.Slime) this.getBukkitEntity(), j); + this.world.getServer().getPluginManager().callEvent(event); @@ -26,9 +34,10 @@ + return; + } + // CraftBukkit end - ++ for (int k = 0; k < j; ++k) { float f = ((float) (k % 2) - 0.5F) * (float) i / 4.0F; + float f1 = ((float) (k / 2) - 0.5F) * (float) i / 4.0F; @@ -148,7 +164,7 @@ entityslime.setSize(i / 2); diff --git a/nms-patches/EntitySmallFireball.patch b/nms-patches/EntitySmallFireball.patch index ffca235809..ae0cd200ad 100644 --- a/nms-patches/EntitySmallFireball.patch +++ b/nms-patches/EntitySmallFireball.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntitySmallFireball.java 2015-02-02 22:00:57.824074092 +0000 -+++ src/main/java/net/minecraft/server/EntitySmallFireball.java 2015-02-02 22:00:57.824074092 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntitySmallFireball.java 2015-02-26 22:40:22.691608138 +0000 ++++ src/main/java/net/minecraft/server/EntitySmallFireball.java 2015-02-26 22:40:22.691608138 +0000 @@ -1,5 +1,7 @@ package net.minecraft.server; diff --git a/nms-patches/EntitySnowman.patch b/nms-patches/EntitySnowman.patch index 4464a1a008..f26dddba1c 100644 --- a/nms-patches/EntitySnowman.patch +++ b/nms-patches/EntitySnowman.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntitySnowman.java 2014-11-28 17:43:43.161707434 +0000 -+++ src/main/java/net/minecraft/server/EntitySnowman.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntitySnowman.java 2015-02-26 22:40:22.695608138 +0000 ++++ src/main/java/net/minecraft/server/EntitySnowman.java 2015-02-26 22:40:22.695608138 +0000 @@ -1,5 +1,11 @@ package net.minecraft.server; @@ -21,11 +21,11 @@ } for (int l = 0; l < 4; ++l) { -@@ -39,7 +45,17 @@ - j = MathHelper.floor(this.locY); - k = MathHelper.floor(this.locZ + (double) ((float) (l / 2 % 2 * 2 - 1) * 0.25F)); - if (this.world.getType(new BlockPosition(i, j, k)).getBlock().getMaterial() == Material.AIR && this.world.getBiome(new BlockPosition(i, 0, k)).a(new BlockPosition(i, j, k)) < 0.8F && Blocks.SNOW_LAYER.canPlace(this.world, new BlockPosition(i, j, k))) { -- this.world.setTypeUpdate(new BlockPosition(i, j, k), Blocks.SNOW_LAYER.getBlockData()); +@@ -41,7 +47,17 @@ + BlockPosition blockposition = new BlockPosition(i, j, k); + + if (this.world.getType(blockposition).getBlock().getMaterial() == Material.AIR && this.world.getBiome(new BlockPosition(i, 0, k)).a(blockposition) < 0.8F && Blocks.SNOW_LAYER.canPlace(this.world, blockposition)) { +- this.world.setTypeUpdate(blockposition, Blocks.SNOW_LAYER.getBlockData()); + // CraftBukkit start + org.bukkit.block.BlockState blockState = this.world.getWorld().getBlockAt(i, j, k).getState(); + blockState.setType(CraftMagicNumbers.getMaterial(Blocks.SNOW_LAYER)); diff --git a/nms-patches/EntitySpider.patch b/nms-patches/EntitySpider.patch index ef476499d9..153e248ebb 100644 --- a/nms-patches/EntitySpider.patch +++ b/nms-patches/EntitySpider.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntitySpider.java 2014-11-28 17:43:43.165707433 +0000 -+++ src/main/java/net/minecraft/server/EntitySpider.java 2014-11-28 17:38:22.000000000 +0000 -@@ -107,7 +107,7 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntitySpider.java 2015-02-26 22:40:22.699608138 +0000 ++++ src/main/java/net/minecraft/server/EntitySpider.java 2015-02-26 22:40:22.699608138 +0000 +@@ -112,7 +112,7 @@ entityskeleton.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F); entityskeleton.prepare(difficultydamagescaler, (GroupDataEntity) null); diff --git a/nms-patches/EntitySquid.patch b/nms-patches/EntitySquid.patch index 01a76d9dd2..40128c83e2 100644 --- a/nms-patches/EntitySquid.patch +++ b/nms-patches/EntitySquid.patch @@ -1,14 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntitySquid.java 2014-11-28 17:43:43.165707433 +0000 -+++ src/main/java/net/minecraft/server/EntitySquid.java 2014-11-28 17:38:18.000000000 +0000 -@@ -1,5 +1,7 @@ - package net.minecraft.server; - -+import org.bukkit.craftbukkit.TrigMath; // CraftBukkit -+ - public class EntitySquid extends EntityWaterAnimal { - - public float a; -@@ -67,9 +69,11 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntitySquid.java 2015-02-26 22:40:22.703608138 +0000 ++++ src/main/java/net/minecraft/server/EntitySquid.java 2015-02-26 22:40:22.703608138 +0000 +@@ -67,9 +67,11 @@ } @@ -20,18 +12,3 @@ public void m() { super.m(); -@@ -116,10 +120,12 @@ - } - - f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ); -- this.aG += (-((float) Math.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.aG) * 0.1F; -+ // CraftBukkit - Math -> TrigMath -+ this.aG += (-((float) TrigMath.atan2(this.motX, this.motZ)) * 180.0F / 3.1415927F - this.aG) * 0.1F; - this.yaw = this.aG; - this.c = (float) ((double) this.c + 3.141592653589793D * (double) this.bp * 1.5D); -- this.a += (-((float) Math.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.a) * 0.1F; -+ // CraftBukkit - Math -> TrigMath -+ this.a += (-((float) TrigMath.atan2((double) f, this.motY)) * 180.0F / 3.1415927F - this.a) * 0.1F; - } else { - this.bl = MathHelper.e(MathHelper.sin(this.bj)) * 3.1415927F * 0.25F; - if (!this.world.isStatic) { diff --git a/nms-patches/EntityTNTPrimed.patch b/nms-patches/EntityTNTPrimed.patch index f894a23bd8..9167c320e3 100644 --- a/nms-patches/EntityTNTPrimed.patch +++ b/nms-patches/EntityTNTPrimed.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityTNTPrimed.java 2014-11-28 17:43:43.169707433 +0000 -+++ src/main/java/net/minecraft/server/EntityTNTPrimed.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityTNTPrimed.java 2015-02-26 22:40:22.707608138 +0000 ++++ src/main/java/net/minecraft/server/EntityTNTPrimed.java 2015-02-26 22:40:22.711608138 +0000 @@ -1,9 +1,13 @@ package net.minecraft.server; @@ -21,7 +21,7 @@ - this.die(); + // CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event + // this.die(); - if (!this.world.isStatic) { + if (!this.world.isClientSide) { this.explode(); } + this.die(); @@ -36,10 +36,10 @@ - float f = 4.0F; + // CraftBukkit start + // float f = 4.0F; - -- this.world.explode(this, this.locX, this.locY + (double) (this.length / 2.0F), this.locZ, f, true); ++ + org.bukkit.craftbukkit.CraftServer server = this.world.getServer(); -+ + +- this.world.explode(this, this.locX, this.locY + (double) (this.length / 16.0F), this.locZ, f, true); + ExplosionPrimeEvent event = new ExplosionPrimeEvent((org.bukkit.entity.Explosive) org.bukkit.craftbukkit.entity.CraftEntity.getEntity(server, this)); + server.getPluginManager().callEvent(event); + diff --git a/nms-patches/EntityThrownExpBottle.patch b/nms-patches/EntityThrownExpBottle.patch index 08b992e7bc..750bc72dd9 100644 --- a/nms-patches/EntityThrownExpBottle.patch +++ b/nms-patches/EntityThrownExpBottle.patch @@ -1,15 +1,14 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityThrownExpBottle.java 2014-11-28 17:43:43.169707433 +0000 -+++ src/main/java/net/minecraft/server/EntityThrownExpBottle.java 2014-11-28 17:38:19.000000000 +0000 -@@ -28,8 +28,17 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityThrownExpBottle.java 2015-02-26 22:40:22.707608138 +0000 ++++ src/main/java/net/minecraft/server/EntityThrownExpBottle.java 2015-02-26 22:40:22.707608138 +0000 +@@ -28,9 +28,18 @@ protected void a(MovingObjectPosition movingobjectposition) { - if (!this.world.isStatic) { + if (!this.world.isClientSide) { - this.world.triggerEffect(2002, new BlockPosition(this), 0); -- int i = 3 + this.world.random.nextInt(5) + this.world.random.nextInt(5); + // CraftBukkit - moved to after event + // this.world.triggerEffect(2002, new BlockPosition(this), 0); -+ int i = 3 + this.world.random.nextInt(5) + this.world.random.nextInt(5); -+ + int i = 3 + this.world.random.nextInt(5) + this.world.random.nextInt(5); + + // CraftBukkit start + org.bukkit.event.entity.ExpBottleEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callExpBottleEvent(this, i); + i = event.getExperience(); @@ -17,6 +16,7 @@ + this.world.triggerEffect(2002, new BlockPosition(this), 0); + } + // CraftBukkit end - ++ while (i > 0) { int j = EntityExperienceOrb.getOrbValue(i); + diff --git a/nms-patches/EntityTracker.patch b/nms-patches/EntityTracker.patch new file mode 100644 index 0000000000..54bdcca208 --- /dev/null +++ b/nms-patches/EntityTracker.patch @@ -0,0 +1,26 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/EntityTracker.java 2015-02-26 22:40:22.719608138 +0000 ++++ src/main/java/net/minecraft/server/EntityTracker.java 2015-02-26 22:40:22.719608138 +0000 +@@ -14,7 +14,7 @@ + private static final Logger a = LogManager.getLogger(); + private final WorldServer world; + private Set c = Sets.newHashSet(); +- private IntHashMap trackedEntities = new IntHashMap(); ++ public IntHashMap trackedEntities = new IntHashMap(); // CraftBukkit - public + private int e; + + public EntityTracker(WorldServer worldserver) { +@@ -113,11 +113,12 @@ + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity To Track"); + + crashreportsystemdetails.a("Tracking range", (Object) (i + " blocks")); ++ final int finalI = i; // CraftBukkit - fix decompile error + crashreportsystemdetails.a("Update interval", new Callable() { + public String a() throws Exception { +- String s = "Once per " + i + " ticks"; ++ String s = "Once per " + finalI + " ticks"; // CraftBukkit + +- if (i == Integer.MAX_VALUE) { ++ if (finalI == Integer.MAX_VALUE) { // CraftBukkit + s = "Maximum (" + s + ")"; + } + diff --git a/nms-patches/EntityTrackerEntry.patch b/nms-patches/EntityTrackerEntry.patch index 6703a119a9..552eb3917d 100644 --- a/nms-patches/EntityTrackerEntry.patch +++ b/nms-patches/EntityTrackerEntry.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityTrackerEntry.java 2014-12-06 20:17:40.567361225 +0000 -+++ src/main/java/net/minecraft/server/EntityTrackerEntry.java 2014-12-06 20:17:33.983361371 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityTrackerEntry.java 2015-02-26 22:40:22.711608138 +0000 ++++ src/main/java/net/minecraft/server/EntityTrackerEntry.java 2015-02-26 22:40:22.715608138 +0000 @@ -8,6 +8,11 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -22,18 +22,17 @@ ItemStack itemstack = entityitemframe.getItem(); - if (itemstack != null && itemstack.getItem() instanceof ItemWorldMap) { -+ if (this.m % 10 == 0 && itemstack != null && itemstack.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.m % 10 logic here so item frames do not enter the other blocks ++ if (this.m % 10 == 0 && itemstack != null && itemstack.getItem() instanceof ItemWorldMap) { // CraftBukkit - Moved this.m % 10 logic here so item frames do not enter the other blocks WorldMap worldmap = Items.FILLED_MAP.getSavedMap(itemstack, this.tracker.world); - Iterator iterator = list.iterator(); + Iterator iterator = this.trackedPlayers.iterator(); // CraftBukkit while (iterator.hasNext()) { EntityHuman entityhuman = (EntityHuman) iterator.next(); -@@ -115,6 +120,19 @@ - Object object = null; +@@ -116,6 +121,19 @@ boolean flag = Math.abs(j1) >= 4 || Math.abs(k1) >= 4 || Math.abs(l1) >= 4 || this.m % 60 == 0; boolean flag1 = Math.abs(l - this.yRot) >= 4 || Math.abs(i1 - this.xRot) >= 4; -+ + + // CraftBukkit start - Code moved from below + if (flag) { + this.xLoc = i; @@ -46,10 +45,11 @@ + this.xRot = i1; + } + // CraftBukkit end - ++ if (this.m > 0 || this.tracker instanceof EntityArrow) { if (j1 >= -128 && j1 < 128 && k1 >= -128 && k1 < 128 && l1 >= -128 && l1 < 128 && this.v <= 400 && !this.x && this.y == this.tracker.onGround) { -@@ -128,6 +146,11 @@ + if ((!flag || !flag1) && !(this.tracker instanceof EntityArrow)) { +@@ -130,6 +148,11 @@ } else { this.y = this.tracker.onGround; this.v = 0; @@ -61,7 +61,7 @@ object = new PacketPlayOutEntityTeleport(this.tracker.getId(), i, j, k, (byte) l, (byte) i1, this.tracker.onGround); } } -@@ -152,6 +175,7 @@ +@@ -154,6 +177,7 @@ } this.b(); @@ -69,7 +69,7 @@ if (flag) { this.xLoc = i; this.yLoc = j; -@@ -162,6 +186,7 @@ +@@ -164,6 +188,7 @@ this.yRot = l; this.xRot = i1; } @@ -77,7 +77,7 @@ this.x = false; } else { -@@ -193,7 +218,27 @@ +@@ -195,7 +220,27 @@ ++this.m; if (this.tracker.velocityChanged) { @@ -106,7 +106,7 @@ this.tracker.velocityChanged = false; } -@@ -211,6 +256,11 @@ +@@ -213,6 +258,11 @@ Set set = attributemapserver.getAttributes(); if (!set.isEmpty()) { @@ -118,12 +118,10 @@ this.broadcastIncludingSelf(new PacketPlayOutUpdateAttributes(this.tracker.getId(), set)); } -@@ -260,7 +310,17 @@ - public void updatePlayer(EntityPlayer entityplayer) { +@@ -263,6 +313,16 @@ if (entityplayer != this.tracker) { if (this.c(entityplayer)) { -- if (!this.trackedPlayers.contains(entityplayer) && (this.e(entityplayer) || this.tracker.attachedToPlayer)) { -+ if (!this.trackedPlayers.contains(entityplayer) && (this.e(entityplayer) || this.tracker.attachedToPlayer)) { + if (!this.trackedPlayers.contains(entityplayer) && (this.e(entityplayer) || this.tracker.attachedToPlayer)) { + // CraftBukkit start - respect vanish API + if (this.tracker instanceof EntityPlayer) { + Player player = ((EntityPlayer) this.tracker).getBukkitEntity(); @@ -137,32 +135,32 @@ this.trackedPlayers.add(entityplayer); Packet packet = this.c(); -@@ -278,6 +338,12 @@ - if (this.tracker instanceof EntityLiving) { +@@ -281,6 +341,12 @@ AttributeMapServer attributemapserver = (AttributeMapServer) ((EntityLiving) this.tracker).getAttributeMap(); Collection collection = attributemapserver.c(); -+ + + // CraftBukkit start - If sending own attributes send scaled health instead of current maximum health + if (this.tracker.getId() == entityplayer.getId()) { + ((EntityPlayer) this.tracker).getBukkitEntity().injectScaledMaxHealth(collection, false); + } + // CraftBukkit end - ++ if (!collection.isEmpty()) { entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateAttributes(this.tracker.getId(), collection)); -@@ -316,6 +382,11 @@ - entityplayer.playerConnection.sendPacket(new PacketPlayOutBed(entityhuman, new BlockPosition(this.tracker))); + } +@@ -319,6 +385,11 @@ } } -+ + + // CraftBukkit start - Fix for nonsensical head yaw + this.i = MathHelper.d(this.tracker.getHeadRotation() * 256.0F / 360.0F); + this.broadcast(new PacketPlayOutEntityHeadRotation(this.tracker, (byte) i)); + // CraftBukkit end - ++ if (this.tracker instanceof EntityLiving) { EntityLiving entityliving = (EntityLiving) this.tracker; -@@ -337,8 +408,10 @@ + Iterator iterator = entityliving.getEffects().iterator(); +@@ -339,8 +410,10 @@ } public boolean c(EntityPlayer entityplayer) { @@ -175,7 +173,7 @@ return d0 >= (double) (-this.b) && d0 <= (double) this.b && d1 >= (double) (-this.b) && d1 <= (double) this.b && this.tracker.a(entityplayer); } -@@ -356,7 +429,10 @@ +@@ -358,7 +431,10 @@ private Packet c() { if (this.tracker.dead) { diff --git a/nms-patches/EntityVillager.patch b/nms-patches/EntityVillager.patch index 106b13e09b..dbe1c8a16b 100644 --- a/nms-patches/EntityVillager.patch +++ b/nms-patches/EntityVillager.patch @@ -1,19 +1,28 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityVillager.java 2014-11-28 17:43:43.177707433 +0000 -+++ src/main/java/net/minecraft/server/EntityVillager.java 2014-11-28 17:38:22.000000000 +0000 -@@ -1,6 +1,7 @@ - package net.minecraft.server; +--- /home/matt/mc-dev-private//net/minecraft/server/EntityVillager.java 2015-02-26 22:40:22.723608138 +0000 ++++ src/main/java/net/minecraft/server/EntityVillager.java 2015-02-26 22:40:22.723608138 +0000 +@@ -2,6 +2,7 @@ import java.util.Iterator; -+import org.bukkit.craftbukkit.entity.CraftVillager; + import java.util.Random; ++import org.bukkit.craftbukkit.entity.CraftVillager; // CraftBukkit - public class EntityVillager extends EntityAgeable implements NPC, IMerchant { + public class EntityVillager extends EntityAgeable implements IMerchant, NPC { -@@ -28,7 +29,7 @@ +@@ -20,7 +21,7 @@ + private int by; + private boolean bz; + private boolean bA; +- private InventorySubcontainer inventory; ++ public InventorySubcontainer inventory; + private static final EntityVillager.IMerchantRecipeOption[][][][] bC = new EntityVillager.IMerchantRecipeOption[][][][] { { { { new EntityVillager.MerchantRecipeOptionBuy(Items.WHEAT, new EntityVillager.MerchantOptionRandomRange(18, 22)), new EntityVillager.MerchantRecipeOptionBuy(Items.POTATO, new EntityVillager.MerchantOptionRandomRange(15, 19)), new EntityVillager.MerchantRecipeOptionBuy(Items.CARROT, new EntityVillager.MerchantOptionRandomRange(15, 19)), new EntityVillager.MerchantRecipeOptionSell(Items.BREAD, new EntityVillager.MerchantOptionRandomRange(-4, -2))}, { new EntityVillager.MerchantRecipeOptionBuy(Item.getItemOf(Blocks.PUMPKIN), new EntityVillager.MerchantOptionRandomRange(8, 13)), new EntityVillager.MerchantRecipeOptionSell(Items.PUMPKIN_PIE, new EntityVillager.MerchantOptionRandomRange(-3, -2))}, { new EntityVillager.MerchantRecipeOptionBuy(Item.getItemOf(Blocks.MELON_BLOCK), new EntityVillager.MerchantOptionRandomRange(7, 12)), new EntityVillager.MerchantRecipeOptionSell(Items.APPLE, new EntityVillager.MerchantOptionRandomRange(-5, -7))}, { new EntityVillager.MerchantRecipeOptionSell(Items.COOKIE, new EntityVillager.MerchantOptionRandomRange(-6, -10)), new EntityVillager.MerchantRecipeOptionSell(Items.CAKE, new EntityVillager.MerchantOptionRandomRange(1, 1))}}, { { new EntityVillager.MerchantRecipeOptionBuy(Items.STRING, new EntityVillager.MerchantOptionRandomRange(15, 20)), new EntityVillager.MerchantRecipeOptionBuy(Items.COAL, new EntityVillager.MerchantOptionRandomRange(16, 24)), new EntityVillager.MerchantRecipeOptionProcess(Items.FISH, new EntityVillager.MerchantOptionRandomRange(6, 6), Items.COOKED_FISH, new EntityVillager.MerchantOptionRandomRange(6, 6))}, { new EntityVillager.MerchantRecipeOptionEnchant(Items.FISHING_ROD, new EntityVillager.MerchantOptionRandomRange(7, 8))}}, { { new EntityVillager.MerchantRecipeOptionBuy(Item.getItemOf(Blocks.WOOL), new EntityVillager.MerchantOptionRandomRange(16, 22)), new EntityVillager.MerchantRecipeOptionSell(Items.SHEARS, new EntityVillager.MerchantOptionRandomRange(3, 4))}, { new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, 0), new EntityVillager.MerchantOptionRandomRange(1, 2)), new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, 1), new EntityVillager.MerchantOptionRandomRange(1, 2)), new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, 2), new EntityVillager.MerchantOptionRandomRange(1, 2)), new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, 3), new EntityVillager.MerchantOptionRandomRange(1, 2)), new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, 4), new EntityVillager.MerchantOptionRandomRange(1, 2)), new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, 5), new EntityVillager.MerchantOptionRandomRange(1, 2)), new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, 6), new EntityVillager.MerchantOptionRandomRange(1, 2)), new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, 7), new EntityVillager.MerchantOptionRandomRange(1, 2)), new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, 8), new EntityVillager.MerchantOptionRandomRange(1, 2)), new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, 9), new EntityVillager.MerchantOptionRandomRange(1, 2)), new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, 10), new EntityVillager.MerchantOptionRandomRange(1, 2)), new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, 11), new EntityVillager.MerchantOptionRandomRange(1, 2)), new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, 12), new EntityVillager.MerchantOptionRandomRange(1, 2)), new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, 13), new EntityVillager.MerchantOptionRandomRange(1, 2)), new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, 14), new EntityVillager.MerchantOptionRandomRange(1, 2)), new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Item.getItemOf(Blocks.WOOL), 1, 15), new EntityVillager.MerchantOptionRandomRange(1, 2))}}, { { new EntityVillager.MerchantRecipeOptionBuy(Items.STRING, new EntityVillager.MerchantOptionRandomRange(15, 20)), new EntityVillager.MerchantRecipeOptionSell(Items.ARROW, new EntityVillager.MerchantOptionRandomRange(-12, -8))}, { new EntityVillager.MerchantRecipeOptionSell(Items.BOW, new EntityVillager.MerchantOptionRandomRange(2, 3)), new EntityVillager.MerchantRecipeOptionProcess(Item.getItemOf(Blocks.GRAVEL), new EntityVillager.MerchantOptionRandomRange(10, 10), Items.FLINT, new EntityVillager.MerchantOptionRandomRange(6, 10))}}}, { { { new EntityVillager.MerchantRecipeOptionBuy(Items.PAPER, new EntityVillager.MerchantOptionRandomRange(24, 36)), new EntityVillager.MerchantRecipeOptionBook()}, { new EntityVillager.MerchantRecipeOptionBuy(Items.BOOK, new EntityVillager.MerchantOptionRandomRange(8, 10)), new EntityVillager.MerchantRecipeOptionSell(Items.COMPASS, new EntityVillager.MerchantOptionRandomRange(10, 12)), new EntityVillager.MerchantRecipeOptionSell(Item.getItemOf(Blocks.BOOKSHELF), new EntityVillager.MerchantOptionRandomRange(3, 4))}, { new EntityVillager.MerchantRecipeOptionBuy(Items.WRITTEN_BOOK, new EntityVillager.MerchantOptionRandomRange(2, 2)), new EntityVillager.MerchantRecipeOptionSell(Items.CLOCK, new EntityVillager.MerchantOptionRandomRange(10, 12)), new EntityVillager.MerchantRecipeOptionSell(Item.getItemOf(Blocks.GLASS), new EntityVillager.MerchantOptionRandomRange(-5, -3))}, { new EntityVillager.MerchantRecipeOptionBook()}, { new EntityVillager.MerchantRecipeOptionBook()}, { new EntityVillager.MerchantRecipeOptionSell(Items.NAME_TAG, new EntityVillager.MerchantOptionRandomRange(20, 22))}}}, { { { new EntityVillager.MerchantRecipeOptionBuy(Items.ROTTEN_FLESH, new EntityVillager.MerchantOptionRandomRange(36, 40)), new EntityVillager.MerchantRecipeOptionBuy(Items.GOLD_INGOT, new EntityVillager.MerchantOptionRandomRange(8, 10))}, { new EntityVillager.MerchantRecipeOptionSell(Items.REDSTONE, new EntityVillager.MerchantOptionRandomRange(-4, -1)), new EntityVillager.MerchantRecipeOptionSell(new ItemStack(Items.DYE, 1, EnumColor.BLUE.getInvColorIndex()), new EntityVillager.MerchantOptionRandomRange(-2, -1))}, { new EntityVillager.MerchantRecipeOptionSell(Items.ENDER_EYE, new EntityVillager.MerchantOptionRandomRange(7, 11)), new EntityVillager.MerchantRecipeOptionSell(Item.getItemOf(Blocks.GLOWSTONE), new EntityVillager.MerchantOptionRandomRange(-3, -1))}, { new EntityVillager.MerchantRecipeOptionSell(Items.EXPERIENCE_BOTTLE, new EntityVillager.MerchantOptionRandomRange(3, 11))}}}, { { { new EntityVillager.MerchantRecipeOptionBuy(Items.COAL, new EntityVillager.MerchantOptionRandomRange(16, 24)), new EntityVillager.MerchantRecipeOptionSell(Items.IRON_HELMET, new EntityVillager.MerchantOptionRandomRange(4, 6))}, { new EntityVillager.MerchantRecipeOptionBuy(Items.IRON_INGOT, new EntityVillager.MerchantOptionRandomRange(7, 9)), new EntityVillager.MerchantRecipeOptionSell(Items.IRON_CHESTPLATE, new EntityVillager.MerchantOptionRandomRange(10, 14))}, { new EntityVillager.MerchantRecipeOptionBuy(Items.DIAMOND, new EntityVillager.MerchantOptionRandomRange(3, 4)), new EntityVillager.MerchantRecipeOptionEnchant(Items.DIAMOND_CHESTPLATE, new EntityVillager.MerchantOptionRandomRange(16, 19))}, { new EntityVillager.MerchantRecipeOptionSell(Items.CHAINMAIL_BOOTS, new EntityVillager.MerchantOptionRandomRange(5, 7)), new EntityVillager.MerchantRecipeOptionSell(Items.CHAINMAIL_LEGGINGS, new EntityVillager.MerchantOptionRandomRange(9, 11)), new EntityVillager.MerchantRecipeOptionSell(Items.CHAINMAIL_HELMET, new EntityVillager.MerchantOptionRandomRange(5, 7)), new EntityVillager.MerchantRecipeOptionSell(Items.CHAINMAIL_CHESTPLATE, new EntityVillager.MerchantOptionRandomRange(11, 15))}}, { { new EntityVillager.MerchantRecipeOptionBuy(Items.COAL, new EntityVillager.MerchantOptionRandomRange(16, 24)), new EntityVillager.MerchantRecipeOptionSell(Items.IRON_AXE, new EntityVillager.MerchantOptionRandomRange(6, 8))}, { new EntityVillager.MerchantRecipeOptionBuy(Items.IRON_INGOT, new EntityVillager.MerchantOptionRandomRange(7, 9)), new EntityVillager.MerchantRecipeOptionEnchant(Items.IRON_SWORD, new EntityVillager.MerchantOptionRandomRange(9, 10))}, { new EntityVillager.MerchantRecipeOptionBuy(Items.DIAMOND, new EntityVillager.MerchantOptionRandomRange(3, 4)), new EntityVillager.MerchantRecipeOptionEnchant(Items.DIAMOND_SWORD, new EntityVillager.MerchantOptionRandomRange(12, 15)), new EntityVillager.MerchantRecipeOptionEnchant(Items.DIAMOND_AXE, new EntityVillager.MerchantOptionRandomRange(9, 12))}}, { { new EntityVillager.MerchantRecipeOptionBuy(Items.COAL, new EntityVillager.MerchantOptionRandomRange(16, 24)), new EntityVillager.MerchantRecipeOptionEnchant(Items.IRON_SHOVEL, new EntityVillager.MerchantOptionRandomRange(5, 7))}, { new EntityVillager.MerchantRecipeOptionBuy(Items.IRON_INGOT, new EntityVillager.MerchantOptionRandomRange(7, 9)), new EntityVillager.MerchantRecipeOptionEnchant(Items.IRON_PICKAXE, new EntityVillager.MerchantOptionRandomRange(9, 11))}, { new EntityVillager.MerchantRecipeOptionBuy(Items.DIAMOND, new EntityVillager.MerchantOptionRandomRange(3, 4)), new EntityVillager.MerchantRecipeOptionEnchant(Items.DIAMOND_PICKAXE, new EntityVillager.MerchantOptionRandomRange(12, 15))}}}, { { { new EntityVillager.MerchantRecipeOptionBuy(Items.PORKCHOP, new EntityVillager.MerchantOptionRandomRange(14, 18)), new EntityVillager.MerchantRecipeOptionBuy(Items.CHICKEN, new EntityVillager.MerchantOptionRandomRange(14, 18))}, { new EntityVillager.MerchantRecipeOptionBuy(Items.COAL, new EntityVillager.MerchantOptionRandomRange(16, 24)), new EntityVillager.MerchantRecipeOptionSell(Items.COOKED_PORKCHOP, new EntityVillager.MerchantOptionRandomRange(-7, -5)), new EntityVillager.MerchantRecipeOptionSell(Items.COOKED_CHICKEN, new EntityVillager.MerchantOptionRandomRange(-8, -6))}}, { { new EntityVillager.MerchantRecipeOptionBuy(Items.LEATHER, new EntityVillager.MerchantOptionRandomRange(9, 12)), new EntityVillager.MerchantRecipeOptionSell(Items.LEATHER_LEGGINGS, new EntityVillager.MerchantOptionRandomRange(2, 4))}, { new EntityVillager.MerchantRecipeOptionEnchant(Items.LEATHER_CHESTPLATE, new EntityVillager.MerchantOptionRandomRange(7, 12))}, { new EntityVillager.MerchantRecipeOptionSell(Items.SADDLE, new EntityVillager.MerchantOptionRandomRange(8, 10))}}}}; + + public EntityVillager(World world) { +@@ -29,7 +30,7 @@ public EntityVillager(World world, int i) { super(world); - this.inventory = new InventorySubcontainer("Items", false, 8); + this.inventory = new InventorySubcontainer("Items", false, 8, (CraftVillager) this.getBukkitEntity()); // CraftBukkit add argument this.setProfession(i); - this.a(0.6F, 1.8F); + this.setSize(0.6F, 1.8F); ((Navigation) this.getNavigation()).b(true); diff --git a/nms-patches/EntityWither.patch b/nms-patches/EntityWither.patch index 0b9162268d..36b72db314 100644 --- a/nms-patches/EntityWither.patch +++ b/nms-patches/EntityWither.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityWither.java 2014-11-28 17:43:43.177707433 +0000 -+++ src/main/java/net/minecraft/server/EntityWither.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityWither.java 2015-02-26 22:40:22.727608138 +0000 ++++ src/main/java/net/minecraft/server/EntityWither.java 2015-02-26 22:40:22.727608138 +0000 @@ -5,6 +5,12 @@ import java.util.Iterator; import java.util.List; @@ -12,10 +12,10 @@ + public class EntityWither extends EntityMonster implements IRangedEntity { - private float[] b = new float[2]; -@@ -160,13 +166,38 @@ - if (this.cj() > 0) { - i = this.cj() - 1; + private float[] a = new float[2]; +@@ -168,13 +174,38 @@ + if (this.cl() > 0) { + i = this.cl() - 1; if (i <= 0) { - this.world.createExplosion(this, this.locX, this.locY + (double) this.getHeadHeight(), this.locZ, 7.0F, false, this.world.getGameRules().getBoolean("mobGriefing")); - this.world.a(1013, new BlockPosition(this), 0); @@ -28,11 +28,11 @@ + this.world.createExplosion(this, this.locX, this.locY + (double) this.getHeadHeight(), this.locZ, event.getRadius(), event.getFire(), this.world.getGameRules().getBoolean("mobGriefing")); + } + // CraftBukkit end -+ ++ + // CraftBukkit start - Use relative location for far away sounds + // this.world.a(1013, new BlockPosition(this), 0); + int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; -+ for (EntityPlayer player : (List) this.world.players) { ++ for (EntityPlayer player : (List) (List) this.world.players) { + double deltaX = this.locX - player.locX; + double deltaZ = this.locZ - player.locZ; + double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; @@ -55,19 +55,19 @@ } } else { -@@ -251,6 +282,11 @@ - Block block = this.world.getType(new BlockPosition(j2, k2, l2)).getBlock(); +@@ -264,6 +295,11 @@ + Block block = this.world.getType(blockposition).getBlock(); - if (block.getMaterial() != Material.AIR && block != Blocks.BEDROCK && block != Blocks.END_PORTAL && block != Blocks.END_PORTAL_FRAME && block != Blocks.COMMAND_BLOCK && block != Blocks.BARRIER) { + if (block.getMaterial() != Material.AIR && a(block)) { + // CraftBukkit start + if (CraftEventFactory.callEntityChangeBlockEvent(this, j2, k2, l2, Blocks.AIR, 0).isCancelled()) { + continue; + } + // CraftBukkit end - flag = this.world.setAir(new BlockPosition(j2, k2, l2), true) || flag; + flag = this.world.setAir(blockposition, true) || flag; } } -@@ -264,7 +300,7 @@ +@@ -277,7 +313,7 @@ } if (this.ticksLived % 20 == 0) { diff --git a/nms-patches/EntityWitherSkull.patch b/nms-patches/EntityWitherSkull.patch index c626821511..e57cc2e237 100644 --- a/nms-patches/EntityWitherSkull.patch +++ b/nms-patches/EntityWitherSkull.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/EntityWitherSkull.java 2015-01-25 10:19:25.655554075 +1100 -+++ src/main/java/net/minecraft/server/EntityWitherSkull.java 2015-01-25 10:19:25.655554075 +1100 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityWitherSkull.java 2015-02-26 22:40:22.731608138 +0000 ++++ src/main/java/net/minecraft/server/EntityWitherSkull.java 2015-02-26 22:40:22.731608138 +0000 @@ -1,5 +1,7 @@ package net.minecraft.server; @@ -8,8 +8,8 @@ public class EntityWitherSkull extends EntityFireball { public EntityWitherSkull(World world) { -@@ -34,9 +36,9 @@ - if (!this.world.isStatic) { +@@ -35,9 +37,9 @@ + if (!this.world.isClientSide) { if (movingobjectposition.entity != null) { if (this.shooter != null) { - if (movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8.0F)) { @@ -20,7 +20,7 @@ } else { this.a(this.shooter, movingobjectposition.entity); } -@@ -60,7 +62,15 @@ +@@ -61,7 +63,15 @@ } } diff --git a/nms-patches/EntityWolf.patch b/nms-patches/EntityWolf.patch index 71e0577715..427d92d656 100644 --- a/nms-patches/EntityWolf.patch +++ b/nms-patches/EntityWolf.patch @@ -1,7 +1,8 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/EntityWolf.java 2014-12-10 18:34:37.316492559 +0000 -+++ src/main/java/net/minecraft/server/EntityWolf.java 2014-12-10 18:34:29.104492649 +0000 -@@ -1,5 +1,10 @@ - package net.minecraft.server; +--- /home/matt/mc-dev-private//net/minecraft/server/EntityWolf.java 2015-02-26 22:40:22.735608138 +0000 ++++ src/main/java/net/minecraft/server/EntityWolf.java 2015-02-26 22:40:22.735608138 +0000 +@@ -2,6 +2,11 @@ + + import com.google.common.base.Predicate; +// CraftBukkit start +import org.bukkit.craftbukkit.event.CraftEventFactory; @@ -10,12 +11,10 @@ + public class EntityWolf extends EntityTameableAnimal { - private float bm; -@@ -51,8 +56,19 @@ - } else if (!this.isTamed()) { - this.setAngry(true); - } -+ } + private float bo; +@@ -64,6 +69,18 @@ + + } + // CraftBukkit - add overriden version + @Override @@ -26,12 +25,13 @@ + } else if (!this.isTamed()) { + this.setAngry(true); + } - } ++ } + // CraftBukkit end - ++ protected void E() { this.datawatcher.watch(18, Float.valueOf(this.getHealth())); -@@ -85,7 +101,8 @@ + } +@@ -95,7 +112,8 @@ } protected String z() { @@ -40,18 +40,18 @@ + return this.isAngry() ? "mob.wolf.growl" : (this.random.nextInt(3) == 0 ? (this.isTamed() && this.datawatcher.getFloat(18) < this.getMaxHealth() / 2 ? "mob.wolf.whine" : "mob.wolf.panting") : "mob.wolf.bark"); } - protected String bn() { -@@ -176,7 +193,8 @@ + protected String bo() { +@@ -186,7 +204,8 @@ } else { Entity entity = damagesource.getEntity(); -- this.bk.setSitting(false); +- this.bm.setSitting(false); + // CraftBukkit - moved into EntityLiving.d(DamageSource, float) -+ // this.bk.setSitting(false); ++ // this.bm.setSitting(false); if (entity != null && !(entity instanceof EntityHuman) && !(entity instanceof EntityArrow)) { f = (f + 1.0F) / 2.0F; } -@@ -219,7 +237,7 @@ +@@ -229,7 +248,7 @@ --itemstack.count; } @@ -60,19 +60,19 @@ if (itemstack.count <= 0) { entityhuman.inventory.setItem(entityhuman.inventory.itemInHandIndex, (ItemStack) null); } -@@ -244,7 +262,7 @@ - this.bk.setSitting(!this.isSitting()); - this.aW = false; +@@ -254,7 +273,7 @@ + this.bm.setSitting(!this.isSitting()); + this.aY = false; this.navigation.n(); - this.setGoalTarget((EntityLiving) null); + this.setGoalTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); // CraftBukkit - reason } } else if (itemstack != null && itemstack.getItem() == Items.BONE && !this.isAngry()) { if (!entityhuman.abilities.canInstantlyBuild) { -@@ -256,12 +274,13 @@ +@@ -266,12 +285,13 @@ } - if (!this.world.isStatic) { + if (!this.world.isClientSide) { - if (this.random.nextInt(3) == 0) { + // CraftBukkit - added event call and isCancelled check. + if (this.random.nextInt(3) == 0 && !CraftEventFactory.callEntityTameEvent(this, entityhuman).isCancelled()) { @@ -80,13 +80,13 @@ this.navigation.n(); - this.setGoalTarget((EntityLiving) null); + this.setGoalTarget((EntityLiving) null, TargetReason.FORGOT_TARGET, true); - this.bk.setSitting(true); + this.bm.setSitting(true); - this.setHealth(20.0F); + this.setHealth(this.getMaxHealth()); // CraftBukkit - 20.0 -> getMaxHealth() this.setOwnerUUID(entityhuman.getUniqueID().toString()); this.l(true); this.world.broadcastEntityEffect(this, (byte) 7); -@@ -348,7 +367,7 @@ +@@ -358,7 +378,7 @@ } protected boolean isTypeNotPersistent() { diff --git a/nms-patches/EntityZombie.patch b/nms-patches/EntityZombie.patch index 25dadd99f6..bf729792d9 100644 --- a/nms-patches/EntityZombie.patch +++ b/nms-patches/EntityZombie.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/EntityZombie.java Thu Dec 11 13:57:17 2014 -+++ src/main/java/net/minecraft/server/EntityZombie.java Thu Dec 11 13:56:17 2014 +--- /home/matt/mc-dev-private//net/minecraft/server/EntityZombie.java 2015-02-26 22:40:22.739608138 +0000 ++++ src/main/java/net/minecraft/server/EntityZombie.java 2015-02-26 22:40:22.739608138 +0000 @@ -4,6 +4,14 @@ import java.util.List; import java.util.UUID; @@ -14,16 +14,16 @@ + public class EntityZombie extends EntityMonster { - protected static final IAttribute b = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance"); + protected static final IAttribute a = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance"); @@ -14,6 +22,7 @@ - private boolean bn = false; - private float bo = -1.0F; - private float bp; + private boolean bo = false; + private float bp = -1.0F; + private float bq; + private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field public EntityZombie(World world) { super(world); -@@ -136,7 +145,14 @@ +@@ -135,7 +144,14 @@ } if (flag) { @@ -39,7 +39,7 @@ } } } -@@ -170,8 +186,8 @@ +@@ -169,8 +185,8 @@ if (World.a((IBlockAccess) this.world, new BlockPosition(i1, j1 - 1, k1)) && this.world.getLightLevel(new BlockPosition(i1, j1, k1)) < 10) { entityzombie.setPosition((double) i1, (double) j1, (double) k1); if (!this.world.isPlayerNearby((double) i1, (double) j1, (double) k1, 7.0D) && this.world.a(entityzombie.getBoundingBox(), (Entity) entityzombie) && this.world.getCubes(entityzombie, entityzombie.getBoundingBox()).isEmpty() && !this.world.containsLiquid(entityzombie.getBoundingBox())) { @@ -48,25 +48,25 @@ + this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit + entityzombie.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET, true); entityzombie.prepare(this.world.E(new BlockPosition(entityzombie)), (GroupDataEntity) null); - this.getAttributeInstance(EntityZombie.b).b(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); - entityzombie.getAttributeInstance(EntityZombie.b).b(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); + this.getAttributeInstance(EntityZombie.a).b(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0)); + entityzombie.getAttributeInstance(EntityZombie.a).b(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0)); @@ -190,6 +206,12 @@ - public void s_() { - if (!this.world.isStatic && this.cn()) { - int i = this.cp(); -+ + if (!this.world.isClientSide && this.cp()) { + int i = this.cr(); + + // CraftBukkit start - Use wall time instead of ticks for villager conversion + int elapsedTicks = MinecraftServer.currentTick - this.lastTick; + this.lastTick = MinecraftServer.currentTick; + i *= elapsedTicks; + // CraftBukkit end - - this.bm -= i; - if (this.bm <= 0) { -@@ -207,7 +229,14 @@ ++ + this.bn -= i; + if (this.bn <= 0) { + this.cq(); +@@ -206,7 +228,14 @@ int i = this.world.getDifficulty().a(); - if (this.bz() == null && this.isBurning() && this.random.nextFloat() < (float) i * 0.3F) { + if (this.bA() == null && this.isBurning() && this.random.nextFloat() < (float) i * 0.3F) { - entity.setOnFire(2 * i); + // CraftBukkit start + EntityCombustByEntityEvent event = new EntityCombustByEntityEvent(this.getBukkitEntity(), entity.getBukkitEntity(), 2 * i); @@ -79,8 +79,8 @@ } } -@@ -316,7 +345,7 @@ - entityzombie.setBaby(true); +@@ -322,7 +351,7 @@ + entityzombie.setCustomNameVisible(entityinsentient.getCustomNameVisible()); } - this.world.addEntity(entityzombie); @@ -88,7 +88,7 @@ this.world.a((EntityHuman) null, 1016, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0); } -@@ -369,7 +398,7 @@ +@@ -375,7 +404,7 @@ entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F); entitychicken1.prepare(difficultydamagescaler, (GroupDataEntity) null); entitychicken1.l(true); @@ -97,22 +97,21 @@ this.mount(entitychicken1); } } -@@ -452,7 +481,7 @@ +@@ -464,7 +493,7 @@ + entityvillager.setCustomNameVisible(this.getCustomNameVisible()); } - this.world.kill(this); - this.world.addEntity(entityvillager); + this.world.addEntity(entityvillager, CreatureSpawnEvent.SpawnReason.CURED); // CraftBukkit - add SpawnReason entityvillager.addEffect(new MobEffect(MobEffectList.CONFUSION.id, 200, 0)); this.world.a((EntityHuman) null, 1017, new BlockPosition((int) this.locX, (int) this.locY, (int) this.locZ), 0); } -@@ -487,7 +516,8 @@ +@@ -500,7 +529,7 @@ this.a(flag ? 0.5F : 1.0F); } -- protected final void a(float f, float f1) { -+ // PAIL: Access + rename please -+ public final void a(float f, float f1) { // CraftBukkit - protected to public - boolean flag = this.bo > 0.0F && this.bp > 0.0F; +- protected final void setSize(float f, float f1) { ++ public final void setSize(float f, float f1) { // CraftBukkit - public + boolean flag = this.bp > 0.0F && this.bq > 0.0F; - this.bo = f; + this.bp = f; diff --git a/nms-patches/ExpirableListEntry.patch b/nms-patches/ExpirableListEntry.patch index 48f6bbb78d..5ca3474ab6 100644 --- a/nms-patches/ExpirableListEntry.patch +++ b/nms-patches/ExpirableListEntry.patch @@ -1,11 +1,11 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ExpirableListEntry.java 2014-11-28 17:43:43.189707433 +0000 -+++ src/main/java/net/minecraft/server/ExpirableListEntry.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ExpirableListEntry.java 2015-02-26 22:40:22.743608138 +0000 ++++ src/main/java/net/minecraft/server/ExpirableListEntry.java 2015-02-26 22:40:22.743608138 +0000 @@ -22,7 +22,7 @@ } - protected ExpirableListEntry(Object object, JsonObject jsonobject) { -- super(object, jsonobject); -+ super(checkExpiry(object, jsonobject), jsonobject); + protected ExpirableListEntry(T t0, JsonObject jsonobject) { +- super(t0, jsonobject); ++ super(checkExpiry(t0, jsonobject), jsonobject); Date date; @@ -23,7 +23,7 @@ + return this.b; + } + -+ private static Object checkExpiry(Object object, JsonObject jsonobject) { ++ private static T checkExpiry(T object, JsonObject jsonobject) { + Date expires = null; + + try { diff --git a/nms-patches/Explosion.patch b/nms-patches/Explosion.patch index b9423fd1d9..bbbdf5b266 100644 --- a/nms-patches/Explosion.patch +++ b/nms-patches/Explosion.patch @@ -1,22 +1,27 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/Explosion.java 2015-02-01 16:12:57.784236937 +1100 -+++ src/main/java/net/minecraft/server/Explosion.java 2015-02-01 16:12:57.788236936 +1100 -@@ -8,6 +8,12 @@ - import java.util.List; +--- /home/matt/mc-dev-private//net/minecraft/server/Explosion.java 2015-02-26 22:40:22.747608138 +0000 ++++ src/main/java/net/minecraft/server/Explosion.java 2015-02-26 22:40:22.747608138 +0000 +@@ -9,6 +9,12 @@ import java.util.Map; import java.util.Random; -+ + +// CraftBukkit start +import org.bukkit.craftbukkit.event.CraftEventFactory; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.Location; +// CraftBukkit end - ++ public class Explosion { -@@ -22,11 +28,12 @@ + private final boolean a; +@@ -18,15 +24,16 @@ + private final double posX; + private final double posY; + private final double posZ; +- private final Entity source; ++ public final Entity source; // CraftBukkit - public private final float size; - private final List blocks = Lists.newArrayList(); - private final Map k = Maps.newHashMap(); + private final List blocks = Lists.newArrayList(); + private final Map k = Maps.newHashMap(); + public boolean wasCanceled = false; // CraftBukkit - add field public Explosion(World world, Entity entity, double d0, double d1, double d2, float f, boolean flag, boolean flag1) { @@ -27,7 +32,7 @@ this.posX = d0; this.posY = d1; this.posZ = d2; -@@ -35,6 +42,12 @@ +@@ -35,6 +42,11 @@ } public void a() { @@ -36,11 +41,10 @@ + return; + } + // CraftBukkit end -+ HashSet hashset = Sets.newHashSet(); boolean flag = true; -@@ -68,7 +81,7 @@ +@@ -68,7 +80,7 @@ f -= (f2 + 0.3F) * 0.3F; } @@ -49,14 +53,12 @@ hashset.add(blockposition); } -@@ -112,7 +125,17 @@ +@@ -112,7 +124,14 @@ double d12 = (double) this.world.a(vec3d, entity.getBoundingBox()); double d13 = (1.0D - d7) * d12; - entity.damageEntity(DamageSource.explosion(this), (float) ((int) ((d13 * d13 + d13) / 2.0D * 8.0D * (double) f3 + 1.0D))); -+ // entity.damageEntity(DamageSource.explosion(this), (float) ((int) ((d13 * d13 + d13) / 2.0D * 8.0D * (double) f3 + 1.0D))); -+ -+ // CraftBukkit start ++ // entity.damageEntity(DamageSource.explosion(this), (float) ((int) ((d13 * d13 + d13) / 2.0D * 8.0D * (double) f3 + 1.0D)));+ // CraftBukkit start + CraftEventFactory.entityDamage = source; + boolean wasDamaged = entity.damageEntity(DamageSource.explosion(this), (float) ((int) ((d13 * d13 + d13) / 2.0D * 8.0D * (double) f3 + 1.0D))); + CraftEventFactory.entityDamage = null; @@ -64,11 +66,10 @@ + continue; + } + // CraftBukkit end -+ double d14 = EnchantmentProtection.a(entity, d13); entity.motX += d8 * d14; -@@ -140,6 +163,35 @@ +@@ -140,6 +159,35 @@ BlockPosition blockposition; if (this.b) { @@ -104,7 +105,7 @@ iterator = this.blocks.iterator(); while (iterator.hasNext()) { -@@ -170,7 +222,8 @@ +@@ -170,7 +218,8 @@ if (block.getMaterial() != Material.AIR) { if (block.a(this)) { @@ -114,13 +115,11 @@ } this.world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3); -@@ -184,8 +237,12 @@ - +@@ -185,7 +234,11 @@ while (iterator.hasNext()) { blockposition = (BlockPosition) iterator.next(); -- if (this.world.getType(blockposition).getBlock().getMaterial() == Material.AIR && this.world.getType(blockposition.down()).getBlock().m() && this.c.nextInt(3) == 0) { + if (this.world.getType(blockposition).getBlock().getMaterial() == Material.AIR && this.world.getType(blockposition.down()).getBlock().o() && this.c.nextInt(3) == 0) { - this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); -+ if (this.world.getType(blockposition).getBlock().getMaterial() == Material.AIR && this.world.getType(blockposition.down()).getBlock().m() && this.c.nextInt(3) == 0) { + // CraftBukkit start - Ignition by explosion + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(this.world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this).isCancelled()) { + this.world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); diff --git a/nms-patches/FoodMetaData.patch b/nms-patches/FoodMetaData.patch index 4d928ac221..40d6cdddc4 100644 --- a/nms-patches/FoodMetaData.patch +++ b/nms-patches/FoodMetaData.patch @@ -1,9 +1,16 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/FoodMetaData.java 2014-11-28 17:43:43.193707433 +0000 -+++ src/main/java/net/minecraft/server/FoodMetaData.java 2014-11-28 17:38:19.000000000 +0000 -@@ -6,9 +6,17 @@ - public float saturationLevel = 5.0F; - public float exhaustionLevel; - public int foodTickTimer; +--- /home/matt/mc-dev-private//net/minecraft/server/FoodMetaData.java 2015-02-26 22:40:22.751608138 +0000 ++++ src/main/java/net/minecraft/server/FoodMetaData.java 2015-02-26 22:40:22.751608138 +0000 +@@ -2,13 +2,21 @@ + + public class FoodMetaData { + +- private int foodLevel = 20; +- private float saturationLevel = 5.0F; +- private float exhaustionLevel; ++ public int foodLevel = 20; // CraftBukkit - public ++ public float saturationLevel = 5.0F; // CraftBukkit - public ++ public float exhaustionLevel; // CraftBukkit - public + private int foodTickTimer; + private EntityHuman entityhuman; // CraftBukkit private int e = 20; @@ -55,7 +62,7 @@ } } - if (entityhuman.world.getGameRules().getBoolean("naturalRegeneration") && this.foodLevel >= 18 && entityhuman.cl()) { + if (entityhuman.world.getGameRules().getBoolean("naturalRegeneration") && this.foodLevel >= 18 && entityhuman.cm()) { ++this.foodTickTimer; if (this.foodTickTimer >= 80) { - entityhuman.heal(1.0F); diff --git a/nms-patches/HandshakeListener.patch b/nms-patches/HandshakeListener.patch index 4d95bd5fc0..3a6a8c1c54 100644 --- a/nms-patches/HandshakeListener.patch +++ b/nms-patches/HandshakeListener.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/HandshakeListener.java 2014-11-28 17:43:43.193707433 +0000 -+++ src/main/java/net/minecraft/server/HandshakeListener.java 2014-11-28 17:38:22.000000000 +0000 -@@ -1,6 +1,16 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/HandshakeListener.java 2015-02-26 22:40:22.755608138 +0000 ++++ src/main/java/net/minecraft/server/HandshakeListener.java 2015-02-26 22:40:22.755608138 +0000 +@@ -1,7 +1,17 @@ package net.minecraft.server; +// CraftBukkit start @@ -9,19 +9,19 @@ +// CraftBukkit end + public class HandshakeListener implements PacketHandshakingInListener { -+ + + // CraftBukkit start - add fields + private static final HashMap throttleTracker = new HashMap(); + private static int throttleCounter = 0; + // CraftBukkit end - ++ private final MinecraftServer a; private final NetworkManager b; -@@ -15,6 +25,41 @@ - case 1: + +@@ -16,6 +26,41 @@ this.b.a(EnumProtocol.LOGIN); ChatComponentText chatcomponenttext; -+ + + // CraftBukkit start - Connection throttle + try { + long currentTime = System.currentTimeMillis(); @@ -56,9 +56,10 @@ + org.apache.logging.log4j.LogManager.getLogger().debug("Failed to check connection throttle", t); + } + // CraftBukkit end - ++ if (packethandshakinginsetprotocol.b() > 47) { - chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8"); + chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.8.3"); + this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext)); @@ -26,6 +71,7 @@ this.b.close(chatcomponenttext); } else { diff --git a/nms-patches/ICommand.patch b/nms-patches/ICommand.patch deleted file mode 100644 index f3f78b5e9f..0000000000 --- a/nms-patches/ICommand.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/ICommand.java 2014-12-10 16:21:38.812579162 +0000 -+++ src/main/java/net/minecraft/server/ICommand.java 2014-12-10 16:18:07.164581460 +0000 -@@ -10,7 +10,7 @@ - - List b(); - -- void execute(ICommandListener icommandlistener, String[] astring); -+ void execute(ICommandListener icommandlistener, String[] astring) throws ExceptionUsage, CommandException; // CraftBukkit - Add exception - - boolean canUse(ICommandListener icommandlistener); - diff --git a/nms-patches/IDataManager.patch b/nms-patches/IDataManager.patch index 5de55c6fa1..28ff443fd7 100644 --- a/nms-patches/IDataManager.patch +++ b/nms-patches/IDataManager.patch @@ -1,14 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/IDataManager.java 2014-11-28 17:43:43.197707433 +0000 -+++ src/main/java/net/minecraft/server/IDataManager.java 2014-11-28 17:38:17.000000000 +0000 -@@ -6,7 +6,7 @@ - - WorldData getWorldData(); - -- void checkSession(); -+ void checkSession() throws ExceptionWorldConflict; // CraftBukkit - throws ExceptionWorldConflict - - IChunkLoader createChunkLoader(WorldProvider worldprovider); - +--- /home/matt/mc-dev-private//net/minecraft/server/IDataManager.java 2015-02-26 22:40:22.759608138 +0000 ++++ src/main/java/net/minecraft/server/IDataManager.java 2015-02-26 22:40:22.759608138 +0000 @@ -23,4 +23,6 @@ File getDataFile(String s); diff --git a/nms-patches/IInventory.patch b/nms-patches/IInventory.patch index 5891b9e01e..6bde6883cd 100644 --- a/nms-patches/IInventory.patch +++ b/nms-patches/IInventory.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/IInventory.java 2014-11-28 17:43:43.197707433 +0000 -+++ src/main/java/net/minecraft/server/IInventory.java 2014-11-28 17:38:22.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/IInventory.java 2015-02-26 22:40:22.759608138 +0000 ++++ src/main/java/net/minecraft/server/IInventory.java 2015-02-26 22:40:22.759608138 +0000 @@ -1,5 +1,7 @@ package net.minecraft.server; @@ -12,7 +12,7 @@ int g(); void l(); -+ ++ + // CraftBukkit start + ItemStack[] getContents(); + diff --git a/nms-patches/IRecipe.patch b/nms-patches/IRecipe.patch index 4923fa319e..aacd748c5e 100644 --- a/nms-patches/IRecipe.patch +++ b/nms-patches/IRecipe.patch @@ -1,9 +1,9 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/IRecipe.java 2014-11-28 17:43:43.217707432 +0000 -+++ src/main/java/net/minecraft/server/IRecipe.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/IRecipe.java 2015-02-26 22:40:22.791608137 +0000 ++++ src/main/java/net/minecraft/server/IRecipe.java 2015-02-26 22:40:22.791608137 +0000 @@ -11,4 +11,6 @@ ItemStack b(); ItemStack[] b(InventoryCrafting inventorycrafting); -+ ++ + org.bukkit.inventory.Recipe toBukkitRecipe(); // CraftBukkit } diff --git a/nms-patches/InventoryCraftResult.patch b/nms-patches/InventoryCraftResult.patch index a5a93db15e..725b887a54 100644 --- a/nms-patches/InventoryCraftResult.patch +++ b/nms-patches/InventoryCraftResult.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/InventoryCraftResult.java 2014-11-28 17:43:43.201707433 +0000 -+++ src/main/java/net/minecraft/server/InventoryCraftResult.java 2014-11-28 17:38:18.000000000 +0000 -@@ -1,8 +1,36 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/InventoryCraftResult.java 2015-02-26 22:40:22.767608137 +0000 ++++ src/main/java/net/minecraft/server/InventoryCraftResult.java 2015-02-26 22:40:22.767608137 +0000 +@@ -1,9 +1,37 @@ package net.minecraft.server; +// CraftBukkit start @@ -11,7 +11,7 @@ public class InventoryCraftResult implements IInventory { private ItemStack[] items = new ItemStack[1]; -+ + + // CraftBukkit start + private int maxStack = MAX_STACK; + @@ -33,10 +33,11 @@ + public void setMaxStackSize(int size) { + maxStack = size; + } -+ // CraftBukkit end - ++ // CraftBukkit end ++ public InventoryCraftResult() {} + public int getSize() { @@ -53,7 +81,7 @@ } diff --git a/nms-patches/InventoryCrafting.patch b/nms-patches/InventoryCrafting.patch index 2a80e8a2f6..76a1182346 100644 --- a/nms-patches/InventoryCrafting.patch +++ b/nms-patches/InventoryCrafting.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/InventoryCrafting.java 2014-11-28 17:43:43.201707433 +0000 -+++ src/main/java/net/minecraft/server/InventoryCrafting.java 2014-11-28 17:38:19.000000000 +0000 -@@ -1,11 +1,61 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/InventoryCrafting.java 2015-02-26 22:40:22.763608137 +0000 ++++ src/main/java/net/minecraft/server/InventoryCrafting.java 2015-02-26 22:40:22.763608137 +0000 +@@ -1,5 +1,13 @@ package net.minecraft.server; +// CraftBukkit start @@ -14,10 +14,10 @@ public class InventoryCrafting implements IInventory { private final ItemStack[] items; - private final int b; +@@ -7,6 +15,48 @@ private final int c; private final Container d; -+ + + // CraftBukkit start - add fields + public List transaction = new java.util.ArrayList(); + public IRecipe currentRecipe; @@ -58,7 +58,8 @@ + this(container, i, j); + this.owner = player; + } -+ // CraftBukkit end - ++ // CraftBukkit end ++ public InventoryCrafting(Container container, int i, int j) { int k = i * j; + diff --git a/nms-patches/InventoryEnderChest.patch b/nms-patches/InventoryEnderChest.patch index 43a79138b0..fedcd39b7c 100644 --- a/nms-patches/InventoryEnderChest.patch +++ b/nms-patches/InventoryEnderChest.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/InventoryEnderChest.java 2014-11-28 17:43:43.205707433 +0000 -+++ src/main/java/net/minecraft/server/InventoryEnderChest.java 2014-11-28 17:38:23.000000000 +0000 -@@ -1,8 +1,48 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/InventoryEnderChest.java 2015-02-26 22:40:22.771608137 +0000 ++++ src/main/java/net/minecraft/server/InventoryEnderChest.java 2015-02-26 22:40:22.771608137 +0000 +@@ -1,9 +1,49 @@ package net.minecraft.server; +// CraftBukkit start @@ -12,7 +12,7 @@ public class InventoryEnderChest extends InventorySubcontainer { private TileEntityEnderChest a; -+ + + // CraftBukkit start - add fields and methods + public List transaction = new java.util.ArrayList(); + public org.bukkit.entity.Player player; @@ -46,6 +46,7 @@ + return maxStack; + } + // CraftBukkit end - ++ public InventoryEnderChest() { super("container.enderchest", false, 27); + } diff --git a/nms-patches/InventoryHorseChest.patch b/nms-patches/InventoryHorseChest.patch index 427191bd7f..33c5a754d4 100644 --- a/nms-patches/InventoryHorseChest.patch +++ b/nms-patches/InventoryHorseChest.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/InventoryHorseChest.java 2014-11-28 17:43:43.205707433 +0000 -+++ src/main/java/net/minecraft/server/InventoryHorseChest.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/InventoryHorseChest.java 2015-02-26 22:40:22.775608137 +0000 ++++ src/main/java/net/minecraft/server/InventoryHorseChest.java 2015-02-26 22:40:22.775608137 +0000 @@ -1,8 +1,60 @@ package net.minecraft.server; diff --git a/nms-patches/InventoryLargeChest.patch b/nms-patches/InventoryLargeChest.patch index 49675d013f..42b410e213 100644 --- a/nms-patches/InventoryLargeChest.patch +++ b/nms-patches/InventoryLargeChest.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/InventoryLargeChest.java 2014-11-28 17:43:43.209707433 +0000 -+++ src/main/java/net/minecraft/server/InventoryLargeChest.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/InventoryLargeChest.java 2015-02-26 22:40:22.779608137 +0000 ++++ src/main/java/net/minecraft/server/InventoryLargeChest.java 2015-02-26 22:40:22.779608137 +0000 @@ -1,10 +1,54 @@ package net.minecraft.server; @@ -13,9 +13,11 @@ public class InventoryLargeChest implements ITileInventory { private String a; - public ITileInventory left; - public ITileInventory right; -+ +- private ITileInventory left; +- private ITileInventory right; ++ public ITileInventory left; ++ public ITileInventory right; ++ + // CraftBukkit start - add fields and methods + public List transaction = new java.util.ArrayList(); + diff --git a/nms-patches/InventoryMerchant.patch b/nms-patches/InventoryMerchant.patch index 07f3854205..f55d0058f2 100644 --- a/nms-patches/InventoryMerchant.patch +++ b/nms-patches/InventoryMerchant.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/InventoryMerchant.java 2015-02-06 20:41:38.537609199 +1100 -+++ src/main/java/net/minecraft/server/InventoryMerchant.java 2015-02-06 20:41:38.537609199 +1100 +--- /home/matt/mc-dev-private//net/minecraft/server/InventoryMerchant.java 2015-02-26 22:40:22.783608137 +0000 ++++ src/main/java/net/minecraft/server/InventoryMerchant.java 2015-02-26 22:40:22.783608137 +0000 @@ -1,5 +1,12 @@ package net.minecraft.server; @@ -44,8 +44,8 @@ + public org.bukkit.inventory.InventoryHolder getOwner() { + return (CraftVillager) ((EntityVillager) this.merchant).getBukkitEntity(); + } -+ // CraftBukkit end -+ ++ // CraftBukkit end ++ public InventoryMerchant(EntityHuman entityhuman, IMerchant imerchant) { this.player = entityhuman; this.merchant = imerchant; diff --git a/nms-patches/InventorySubcontainer.patch b/nms-patches/InventorySubcontainer.patch index d93ca99a8d..b1f5dcd738 100644 --- a/nms-patches/InventorySubcontainer.patch +++ b/nms-patches/InventorySubcontainer.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/InventorySubcontainer.java 2014-11-28 17:43:43.213707432 +0000 -+++ src/main/java/net/minecraft/server/InventorySubcontainer.java 2014-11-28 17:38:23.000000000 +0000 -@@ -3,6 +3,12 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/InventorySubcontainer.java 2015-02-26 22:40:22.787608137 +0000 ++++ src/main/java/net/minecraft/server/InventorySubcontainer.java 2015-02-26 22:40:22.787608137 +0000 +@@ -3,15 +3,56 @@ import com.google.common.collect.Lists; import java.util.List; @@ -13,11 +13,12 @@ public class InventorySubcontainer implements IInventory { private String a; -@@ -10,8 +16,43 @@ - public ItemStack[] items; - private List d; + private int b; +- private ItemStack[] items; ++ public ItemStack[] items; // CraftBukkit - public + private List d; private boolean e; -+ + + // CraftBukkit start - add fields and methods + public List transaction = new java.util.ArrayList(); + private int maxStack = MAX_STACK; @@ -30,7 +31,7 @@ + public void onOpen(CraftHumanEntity who) { + transaction.add(who); + } - ++ + public void onClose(CraftHumanEntity who) { + transaction.remove(who); + } @@ -46,12 +47,12 @@ + public org.bukkit.inventory.InventoryHolder getOwner() { + return bukkitOwner; + } -+ ++ public InventorySubcontainer(String s, boolean flag, int i) { + this(s, flag, i, null); + } + -+ public InventorySubcontainer(String s, boolean flag, int i, org.bukkit.inventory.InventoryHolder owner) { // Added argument ++ public InventorySubcontainer(String s, boolean flag, int i, org.bukkit.inventory.InventoryHolder owner) { // Added argument + this.bukkitOwner = owner; + // CraftBukkit end this.a = s; diff --git a/nms-patches/ItemArmor.patch b/nms-patches/ItemArmor.patch new file mode 100644 index 0000000000..6adb37eac0 --- /dev/null +++ b/nms-patches/ItemArmor.patch @@ -0,0 +1,59 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/ItemArmor.java 2015-02-26 22:40:22.791608137 +0000 ++++ src/main/java/net/minecraft/server/ItemArmor.java 2015-02-26 22:40:22.791608137 +0000 +@@ -3,6 +3,11 @@ + import com.google.common.base.Predicates; + import java.util.List; + ++// CraftBukkit start ++import org.bukkit.craftbukkit.inventory.CraftItemStack; ++import org.bukkit.event.block.BlockDispenseEvent; ++// CraftBukkit end ++ + public class ItemArmor extends Item { + + private static final int[] k = new int[] { 11, 16, 15, 13}; +@@ -20,7 +25,34 @@ + EntityLiving entityliving = (EntityLiving) list.get(0); + int l = entityliving instanceof EntityHuman ? 1 : 0; + int i1 = EntityInsentient.c(itemstack); +- ItemStack itemstack1 = itemstack.cloneItemStack(); ++ ++ // CraftBukkit start ++ ItemStack itemstack1 = itemstack.a(1); ++ World world = isourceblock.i(); ++ org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); ++ ++ BlockDispenseEvent event = new BlockDispenseEvent(block, craftItem.clone(), new org.bukkit.util.Vector(0, 0, 0)); ++ if (!BlockDispenser.eventFired) { ++ world.getServer().getPluginManager().callEvent(event); ++ } ++ ++ if (event.isCancelled()) { ++ itemstack.count++; ++ return itemstack; ++ } ++ ++ if (!event.getItem().equals(craftItem)) { ++ itemstack.count++; ++ // Chain to handler for new item ++ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ++ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.N.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { ++ idispensebehavior.a(isourceblock, eventStack); ++ return itemstack; ++ } ++ } ++ // CraftBukkit end + + itemstack1.count = 1; + entityliving.setEquipment(i1 - l, itemstack1); +@@ -28,7 +60,7 @@ + ((EntityInsentient) entityliving).a(i1, 2.0F); + } + +- --itemstack.count; ++ // --itemstack.count; // CraftBukkit - handled above + return itemstack; + } else { + return super.b(isourceblock, itemstack); diff --git a/nms-patches/ItemBed.patch b/nms-patches/ItemBed.patch deleted file mode 100644 index ec2a798c70..0000000000 --- a/nms-patches/ItemBed.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/ItemBed.java 2015-01-16 17:52:31.020317127 +1100 -+++ src/main/java/net/minecraft/server/ItemBed.java 2015-01-16 17:52:31.024317273 +1100 -@@ -23,7 +23,7 @@ - int i = MathHelper.floor((double) (entityhuman.yaw * 4.0F / 360.0F) + 0.5D) & 3; - EnumDirection enumdirection1 = EnumDirection.fromType2(i); - BlockPosition blockposition1 = blockposition.shift(enumdirection1); -- boolean flag1 = block.f(world, blockposition1); -+ boolean flag1 = world.getType(blockposition1).getBlock().f(world, blockposition1); // CraftBukkit - boolean flag2 = world.isEmpty(blockposition) || flag; - boolean flag3 = world.isEmpty(blockposition1) || flag1; - diff --git a/nms-patches/ItemBoat.patch b/nms-patches/ItemBoat.patch index 620564b23b..1afa794edc 100644 --- a/nms-patches/ItemBoat.patch +++ b/nms-patches/ItemBoat.patch @@ -1,10 +1,9 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ItemBoat.java 2014-11-28 17:43:43.217707432 +0000 -+++ src/main/java/net/minecraft/server/ItemBoat.java 2014-11-28 17:38:21.000000000 +0000 -@@ -53,6 +53,14 @@ - } else { - if (movingobjectposition.type == EnumMovingObjectType.BLOCK) { +--- /home/matt/mc-dev-private//net/minecraft/server/ItemBoat.java 2015-02-26 22:40:22.795608137 +0000 ++++ src/main/java/net/minecraft/server/ItemBoat.java 2015-02-26 22:40:22.795608137 +0000 +@@ -54,6 +54,14 @@ + if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.BLOCK) { BlockPosition blockposition = movingobjectposition.a(); -+ + + // CraftBukkit start - Boat placement + org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, blockposition, movingobjectposition.direction, itemstack); + @@ -12,6 +11,7 @@ + return itemstack; + } + // CraftBukkit end - ++ if (world.getType(blockposition).getBlock() == Blocks.SNOW_LAYER) { blockposition = blockposition.down(); + } diff --git a/nms-patches/ItemBow.patch b/nms-patches/ItemBow.patch index f285def65b..46cb964acb 100644 --- a/nms-patches/ItemBow.patch +++ b/nms-patches/ItemBow.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ItemBow.java 2014-11-28 17:43:43.217707432 +0000 -+++ src/main/java/net/minecraft/server/ItemBow.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ItemBow.java 2015-02-26 22:40:22.799608137 +0000 ++++ src/main/java/net/minecraft/server/ItemBow.java 2015-02-26 22:40:22.799608137 +0000 @@ -1,5 +1,7 @@ package net.minecraft.server; @@ -41,7 +41,7 @@ @@ -58,7 +79,7 @@ entityhuman.b(StatisticList.USE_ITEM_COUNT[Item.getId(this)]); - if (!world.isStatic) { + if (!world.isClientSide) { - world.addEntity(entityarrow); + // world.addEntity(entityarrow); // CraftBukkit - moved up } diff --git a/nms-patches/ItemBucket.patch b/nms-patches/ItemBucket.patch index f30d0cb122..1561e69f37 100644 --- a/nms-patches/ItemBucket.patch +++ b/nms-patches/ItemBucket.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ItemBucket.java 2014-11-28 17:43:43.221707432 +0000 -+++ src/main/java/net/minecraft/server/ItemBucket.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ItemBucket.java 2015-02-26 22:40:22.803608137 +0000 ++++ src/main/java/net/minecraft/server/ItemBucket.java 2015-02-26 22:40:22.803608137 +0000 @@ -1,5 +1,12 @@ package net.minecraft.server; @@ -58,11 +58,10 @@ } BlockPosition blockposition1 = blockposition.shift(movingobjectposition.direction); -@@ -53,10 +82,18 @@ - if (!entityhuman.a(blockposition1, movingobjectposition.direction, itemstack)) { +@@ -54,9 +83,17 @@ return itemstack; } -+ + + // CraftBukkit start + PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(entityhuman, blockposition.getX(), blockposition.getY(), blockposition.getZ(), movingobjectposition.direction, itemstack); + @@ -70,7 +69,7 @@ + return itemstack; + } + // CraftBukkit end - ++ if (this.a(world, blockposition1) && !entityhuman.abilities.canInstantlyBuild) { entityhuman.b(StatisticList.USE_ITEM_COUNT[Item.getId(this)]); - return new ItemStack(Items.BUCKET); @@ -78,13 +77,11 @@ } } } -@@ -64,15 +101,16 @@ - return itemstack; +@@ -65,14 +102,15 @@ } } -- + - private ItemStack a(ItemStack itemstack, EntityHuman entityhuman, Item item) { -+ + // CraftBukkit - added ob.ItemStack result - TODO: Is this... the right way to handle this? + private ItemStack a(ItemStack itemstack, EntityHuman entityhuman, Item item, org.bukkit.inventory.ItemStack result) { if (entityhuman.abilities.canInstantlyBuild) { diff --git a/nms-patches/ItemDye.patch b/nms-patches/ItemDye.patch index 8de676e7fe..5a725d308e 100644 --- a/nms-patches/ItemDye.patch +++ b/nms-patches/ItemDye.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ItemDye.java 2014-11-28 17:43:43.225707432 +0000 -+++ src/main/java/net/minecraft/server/ItemDye.java 2014-11-28 17:38:17.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ItemDye.java 2015-02-26 22:40:22.807608137 +0000 ++++ src/main/java/net/minecraft/server/ItemDye.java 2015-02-26 22:40:22.807608137 +0000 @@ -1,5 +1,7 @@ package net.minecraft.server; diff --git a/nms-patches/ItemFireball.patch b/nms-patches/ItemFireball.patch index 36d98f093b..5da26c32c1 100644 --- a/nms-patches/ItemFireball.patch +++ b/nms-patches/ItemFireball.patch @@ -1,10 +1,9 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ItemFireball.java 2014-11-28 17:43:43.225707432 +0000 -+++ src/main/java/net/minecraft/server/ItemFireball.java 2014-11-28 17:38:23.000000000 +0000 -@@ -15,7 +15,15 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/ItemFireball.java 2015-02-26 22:40:22.807608137 +0000 ++++ src/main/java/net/minecraft/server/ItemFireball.java 2015-02-26 22:40:22.811608137 +0000 +@@ -15,6 +15,14 @@ return false; } else { if (world.getType(blockposition).getBlock().getMaterial() == Material.AIR) { -- world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "item.fireCharge.use", 1.0F, (ItemFireball.g.nextFloat() - ItemFireball.g.nextFloat()) * 0.2F + 1.0F); + // CraftBukkit start - fire BlockIgniteEvent + if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockIgniteEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FIREBALL, entityhuman).isCancelled()) { + if (!entityhuman.abilities.canInstantlyBuild) { @@ -13,7 +12,6 @@ + return false; + } + // CraftBukkit end -+ world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "item.fireCharge.use", 1.0F, (g.nextFloat() - g.nextFloat()) * 0.2F + 1.0F); + world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "item.fireCharge.use", 1.0F, (ItemFireball.g.nextFloat() - ItemFireball.g.nextFloat()) * 0.2F + 1.0F); world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); } - diff --git a/nms-patches/ItemFishingRod.patch b/nms-patches/ItemFishingRod.patch index a1e4b44cc3..fca43b25e7 100644 --- a/nms-patches/ItemFishingRod.patch +++ b/nms-patches/ItemFishingRod.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ItemFishingRod.java 2014-11-28 17:43:43.229707432 +0000 -+++ src/main/java/net/minecraft/server/ItemFishingRod.java 2014-11-28 17:38:22.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ItemFishingRod.java 2015-02-26 22:40:22.819608137 +0000 ++++ src/main/java/net/minecraft/server/ItemFishingRod.java 2015-02-26 22:40:22.819608137 +0000 @@ -1,5 +1,7 @@ package net.minecraft.server; @@ -10,9 +10,8 @@ public ItemFishingRod() { @@ -15,9 +17,18 @@ itemstack.damage(i, entityhuman); - entityhuman.bv(); + entityhuman.bw(); } else { -- world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (ItemFishingRod.g.nextFloat() * 0.4F + 0.8F)); + // CraftBukkit start + EntityFishingHook hook = new EntityFishingHook(world, entityhuman); + PlayerFishEvent playerFishEvent = new PlayerFishEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), null, (org.bukkit.entity.Fish) hook.getBukkitEntity(), PlayerFishEvent.State.FISHING); @@ -22,10 +21,10 @@ + return itemstack; + } + // CraftBukkit end -+ world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (g.nextFloat() * 0.4F + 0.8F)); - if (!world.isStatic) { + world.makeSound(entityhuman, "random.bow", 0.5F, 0.4F / (ItemFishingRod.g.nextFloat() * 0.4F + 0.8F)); + if (!world.isClientSide) { - world.addEntity(new EntityFishingHook(world, entityhuman)); + world.addEntity(hook); // CraftBukkit - moved creation up } - entityhuman.bv(); + entityhuman.bw(); diff --git a/nms-patches/ItemFlintAndSteel.patch b/nms-patches/ItemFlintAndSteel.patch index 34616f001b..6807292544 100644 --- a/nms-patches/ItemFlintAndSteel.patch +++ b/nms-patches/ItemFlintAndSteel.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ItemFlintAndSteel.java 2014-11-28 17:43:43.229707432 +0000 -+++ src/main/java/net/minecraft/server/ItemFlintAndSteel.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ItemFlintAndSteel.java 2015-02-26 22:40:22.823608137 +0000 ++++ src/main/java/net/minecraft/server/ItemFlintAndSteel.java 2015-02-26 22:40:22.823608137 +0000 @@ -1,5 +1,10 @@ package net.minecraft.server; @@ -11,7 +11,7 @@ public class ItemFlintAndSteel extends Item { public ItemFlintAndSteel() { -@@ -9,13 +14,32 @@ +@@ -9,13 +14,31 @@ } public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) { @@ -21,7 +21,6 @@ return false; } else { if (world.getType(blockposition).getBlock().getMaterial() == Material.AIR) { -- world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "fire.ignite", 1.0F, ItemFlintAndSteel.g.nextFloat() * 0.4F + 0.8F); + // CraftBukkit start - Store the clicked block + if (CraftEventFactory.callBlockIgniteEvent(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), org.bukkit.event.block.BlockIgniteEvent.IgniteCause.FLINT_AND_STEEL, entityhuman).isCancelled()) { + itemstack.damage(1, entityhuman); @@ -30,8 +29,7 @@ + + CraftBlockState blockState = CraftBlockState.getBlockState(world, blockposition.getX(), blockposition.getY(), blockposition.getZ()); + // CraftBukkit end -+ -+ world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "fire.ignite", 1.0F, g.nextFloat() * 0.4F + 0.8F); + world.makeSound((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, "fire.ignite", 1.0F, ItemFlintAndSteel.g.nextFloat() * 0.4F + 0.8F); world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData()); + + // CraftBukkit start diff --git a/nms-patches/ItemHanging.patch b/nms-patches/ItemHanging.patch index 8032ef396b..4d52a77e13 100644 --- a/nms-patches/ItemHanging.patch +++ b/nms-patches/ItemHanging.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ItemHanging.java 2014-11-28 17:43:43.233707432 +0000 -+++ src/main/java/net/minecraft/server/ItemHanging.java 2014-11-28 17:38:16.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ItemHanging.java 2015-02-26 22:40:22.827608137 +0000 ++++ src/main/java/net/minecraft/server/ItemHanging.java 2015-02-26 22:40:22.827608137 +0000 @@ -1,5 +1,11 @@ package net.minecraft.server; @@ -11,11 +11,11 @@ + public class ItemHanging extends Item { - private final Class a; + private final Class a; @@ -24,6 +30,26 @@ if (entityhanging != null && entityhanging.survives()) { - if (!world.isStatic) { + if (!world.isClientSide) { + // CraftBukkit start - fire HangingPlaceEvent + Player who = (entityhuman == null) ? null : (Player) entityhuman.getBukkitEntity(); + org.bukkit.block.Block blockClicked = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); diff --git a/nms-patches/ItemLeash.patch b/nms-patches/ItemLeash.patch index 4da60e3eb2..d6a4a84c94 100644 --- a/nms-patches/ItemLeash.patch +++ b/nms-patches/ItemLeash.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ItemLeash.java 2014-11-28 17:43:43.233707432 +0000 -+++ src/main/java/net/minecraft/server/ItemLeash.java 2014-11-28 17:38:22.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ItemLeash.java 2015-02-26 22:40:22.827608137 +0000 ++++ src/main/java/net/minecraft/server/ItemLeash.java 2015-02-26 22:40:22.831608137 +0000 @@ -3,6 +3,8 @@ import java.util.Iterator; import java.util.List; @@ -10,7 +10,7 @@ public ItemLeash() { @@ -40,7 +42,23 @@ - if (entityinsentient.cb() && entityinsentient.getLeashHolder() == entityhuman) { + if (entityinsentient.cc() && entityinsentient.getLeashHolder() == entityhuman) { if (entityleash == null) { entityleash = EntityLeash.a(world, blockposition); + diff --git a/nms-patches/ItemMapEmpty.patch b/nms-patches/ItemMapEmpty.patch index ffa0d01f77..06e240b7b0 100644 --- a/nms-patches/ItemMapEmpty.patch +++ b/nms-patches/ItemMapEmpty.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ItemMapEmpty.java Wed Dec 17 16:16:12 2014 -+++ src/main/java/net/minecraft/server/ItemMapEmpty.java Wed Dec 17 16:16:12 2014 +--- /home/matt/mc-dev-private//net/minecraft/server/ItemMapEmpty.java 2015-02-26 22:40:22.835608137 +0000 ++++ src/main/java/net/minecraft/server/ItemMapEmpty.java 2015-02-26 22:40:22.835608137 +0000 @@ -7,15 +7,19 @@ } @@ -11,15 +11,15 @@ WorldMap worldmap = new WorldMap(s); - world.a(s, (PersistentBase) worldmap); -+ worldMain.a(s, (PersistentBase) worldmap); ++ worldMain.a(s, (PersistentBase) worldmap); // CraftBukkit worldmap.scale = 0; worldmap.a(entityhuman.locX, entityhuman.locZ, worldmap.scale); - worldmap.map = (byte) world.worldProvider.getDimension(); + worldmap.map = (byte) ((WorldServer) world).dimension; // CraftBukkit - use bukkit dimension worldmap.c(); -+ ++ + org.bukkit.craftbukkit.event.CraftEventFactory.callEvent(new org.bukkit.event.server.MapInitializeEvent(worldmap.mapView)); // CraftBukkit -+ ++ --itemstack.count; if (itemstack.count <= 0) { return itemstack1; diff --git a/nms-patches/ItemMinecart.patch b/nms-patches/ItemMinecart.patch index 2e1d5a0e56..205e27fb64 100644 --- a/nms-patches/ItemMinecart.patch +++ b/nms-patches/ItemMinecart.patch @@ -1,9 +1,66 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ItemMinecart.java 2014-11-28 17:43:43.237707432 +0000 -+++ src/main/java/net/minecraft/server/ItemMinecart.java 2014-11-28 17:38:22.000000000 +0000 -@@ -23,6 +23,13 @@ - if (enumtrackposition.c()) { +--- /home/matt/mc-dev-private//net/minecraft/server/ItemMinecart.java 2015-02-26 22:40:22.839608137 +0000 ++++ src/main/java/net/minecraft/server/ItemMinecart.java 2015-02-26 22:40:22.839608137 +0000 +@@ -1,5 +1,10 @@ + package net.minecraft.server; + ++// CraftBukkit start ++import org.bukkit.craftbukkit.inventory.CraftItemStack; ++import org.bukkit.event.block.BlockDispenseEvent; ++// CraftBukkit end ++ + public class ItemMinecart extends Item { + + private static final IDispenseBehavior a = new DispenseBehaviorItem() { +@@ -37,14 +42,43 @@ + } + } + +- EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, d0, d1 + d3, d2, ((ItemMinecart) itemstack.getItem()).b); ++ // CraftBukkit start ++ // EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, d0, d1 + d3, d2, ((ItemMinecart) itemstack.getItem()).b); ++ ItemStack itemstack1 = itemstack.a(1); ++ org.bukkit.block.Block block2 = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); ++ CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); ++ ++ BlockDispenseEvent event = new BlockDispenseEvent(block2, craftItem.clone(), new org.bukkit.util.Vector(d0, d1 + d3, d2)); ++ if (!BlockDispenser.eventFired) { ++ world.getServer().getPluginManager().callEvent(event); ++ } ++ ++ if (event.isCancelled()) { ++ itemstack.count++; ++ return itemstack; ++ } ++ ++ if (!event.getItem().equals(craftItem)) { ++ itemstack.count++; ++ // Chain to handler for new item ++ ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); ++ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.N.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.a && idispensebehavior != this) { ++ idispensebehavior.a(isourceblock, eventStack); ++ return itemstack; ++ } ++ } ++ ++ itemstack1 = CraftItemStack.asNMSCopy(event.getItem()); ++ EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), ((ItemMinecart) itemstack1.getItem()).b); + + if (itemstack.hasName()) { + entityminecartabstract.setCustomName(itemstack.getName()); + } + + world.addEntity(entityminecartabstract); +- itemstack.a(1); ++ itemstack.a(1); // CraftBukkit - handled during event processing ++ // CraftBukkit end + return itemstack; + } + +@@ -73,6 +107,14 @@ d0 = 0.5D; } + + // CraftBukkit start - Minecarts + org.bukkit.event.player.PlayerInteractEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerInteractEvent(entityhuman, org.bukkit.event.block.Action.RIGHT_CLICK_BLOCK, blockposition, enumdirection, itemstack); + @@ -11,6 +68,7 @@ + return false; + } + // CraftBukkit end - ++ EntityMinecartAbstract entityminecartabstract = EntityMinecartAbstract.a(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.0625D + d0, (double) blockposition.getZ() + 0.5D, this.b); + if (itemstack.hasName()) { diff --git a/nms-patches/ItemMonsterEgg.patch b/nms-patches/ItemMonsterEgg.patch index 39d62af26f..8685820b25 100644 --- a/nms-patches/ItemMonsterEgg.patch +++ b/nms-patches/ItemMonsterEgg.patch @@ -1,12 +1,12 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/ItemMonsterEgg.java 2014-12-15 13:53:30.086979118 +0000 -+++ src/main/java/net/minecraft/server/ItemMonsterEgg.java 2014-12-15 13:53:30.086979118 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ItemMonsterEgg.java 2015-02-26 22:40:22.843608137 +0000 ++++ src/main/java/net/minecraft/server/ItemMonsterEgg.java 2015-02-26 22:40:22.843608137 +0000 @@ -19,7 +19,8 @@ } public boolean interactWith(ItemStack itemstack, EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) { -- if (world.isStatic) { +- if (world.isClientSide) { + // CraftBukkit - check ItemStack data -+ if (world.isStatic || itemstack.getData() == 48 || itemstack.getData() == 49 || itemstack.getData() == 63 || itemstack.getData() == 64) { ++ if (world.isClientSide || itemstack.getData() == 48 || itemstack.getData() == 49 || itemstack.getData() == 63 || itemstack.getData() == 64) { return true; } else if (!entityhuman.a(blockposition.shift(enumdirection), enumdirection, itemstack)) { return false; @@ -24,8 +24,8 @@ return null; } else { @@ -123,8 +130,13 @@ + entityinsentient.aK = entityinsentient.yaw; entityinsentient.aI = entityinsentient.yaw; - entityinsentient.aG = entityinsentient.yaw; entityinsentient.prepare(world.E(new BlockPosition(entityinsentient)), (GroupDataEntity) null); - world.addEntity(entity); - entityinsentient.x(); diff --git a/nms-patches/ItemStack.patch b/nms-patches/ItemStack.patch index 7010dac02f..c837a0ede9 100644 --- a/nms-patches/ItemStack.patch +++ b/nms-patches/ItemStack.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ItemStack.java 2015-02-02 21:55:14.596077817 +0000 -+++ src/main/java/net/minecraft/server/ItemStack.java 2015-02-02 21:55:14.596077817 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ItemStack.java 2015-02-26 22:40:22.847608137 +0000 ++++ src/main/java/net/minecraft/server/ItemStack.java 2015-02-26 22:40:22.847608137 +0000 @@ -5,6 +5,18 @@ import java.text.DecimalFormat; import java.util.Random; @@ -19,7 +19,7 @@ public final class ItemStack { public static final DecimalFormat a = new DecimalFormat("#.###"); -@@ -46,11 +58,13 @@ +@@ -46,10 +58,14 @@ this.k = false; this.item = item; this.count = i; @@ -27,7 +27,7 @@ - if (this.damage < 0) { - this.damage = 0; - } -- ++ + // CraftBukkit start - Pass to setData to do filtering + this.setData(j); + //this.damage = j; @@ -35,10 +35,10 @@ + // this.damage = 0; + //} + // CraftBukkit end + } - public static ItemStack createStack(NBTTagCompound nbttagcompound) { -@@ -83,11 +97,114 @@ +@@ -83,11 +99,114 @@ } public boolean placeItem(EntityHuman entityhuman, World world, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) { @@ -131,7 +131,7 @@ + + if (this.getItem() == Items.SKULL) { // Special case skulls to allow wither spawns to be cancelled + BlockPosition bp = blockposition; -+ if (!world.getType(blockposition).getBlock().f(world, blockposition)) { ++ if (!world.getType(blockposition).getBlock().a(world, blockposition)) { + if (!world.getType(blockposition).getBlock().getMaterial().isBuildable()) { + bp = null; + } else { @@ -154,7 +154,7 @@ return flag; } -@@ -111,7 +228,7 @@ +@@ -111,7 +230,7 @@ nbttagcompound.setByte("Count", (byte) this.count); nbttagcompound.setShort("Damage", (short) this.damage); if (this.tag != null) { @@ -163,7 +163,7 @@ } return nbttagcompound; -@@ -125,13 +242,18 @@ +@@ -125,13 +244,18 @@ } this.count = nbttagcompound.getByte("Count"); @@ -183,7 +183,7 @@ if (this.item != null) { this.item.a(this.tag); } -@@ -168,8 +290,29 @@ +@@ -168,8 +292,28 @@ } public void setData(int i) { @@ -207,27 +207,26 @@ + i = 0; + } + // CraftBukkit end -+ this.damage = i; - if (this.damage < 0) { + if (this.damage < -1) { // CraftBukkit this.damage = 0; } -@@ -222,6 +365,12 @@ - if (this.count < 0) { +@@ -223,6 +367,12 @@ this.count = 0; } -+ + + // CraftBukkit start - Check for item breaking + if (this.count == 0 && entityliving instanceof EntityHuman) { + org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerItemBreakEvent((EntityHuman) entityliving, this); + } + // CraftBukkit end - ++ this.damage = 0; } -@@ -489,6 +638,7 @@ + +@@ -489,6 +639,7 @@ public void setItem(Item item) { this.item = item; diff --git a/nms-patches/ItemWaterLily.patch b/nms-patches/ItemWaterLily.patch index 5a1868c88a..380e4b3cfe 100644 --- a/nms-patches/ItemWaterLily.patch +++ b/nms-patches/ItemWaterLily.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ItemWaterLily.java 2014-11-28 17:43:43.245707432 +0000 -+++ src/main/java/net/minecraft/server/ItemWaterLily.java 2014-11-28 17:38:19.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ItemWaterLily.java 2015-02-26 22:40:22.851608137 +0000 ++++ src/main/java/net/minecraft/server/ItemWaterLily.java 2015-02-26 22:40:22.851608137 +0000 @@ -27,7 +27,15 @@ IBlockData iblockdata = world.getType(blockposition); diff --git a/nms-patches/ItemWorldMap.patch b/nms-patches/ItemWorldMap.patch index 36c0fb0db9..8682285dfd 100644 --- a/nms-patches/ItemWorldMap.patch +++ b/nms-patches/ItemWorldMap.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ItemWorldMap.java 2014-11-28 17:43:43.245707432 +0000 -+++ src/main/java/net/minecraft/server/ItemWorldMap.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ItemWorldMap.java 2015-02-26 22:40:22.855608136 +0000 ++++ src/main/java/net/minecraft/server/ItemWorldMap.java 2015-02-26 22:40:22.855608136 +0000 @@ -4,6 +4,11 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Multisets; @@ -21,7 +21,7 @@ - WorldMap worldmap = (WorldMap) world.a(WorldMap.class, s); + WorldMap worldmap = (WorldMap) worldMain.a(WorldMap.class, s); // CraftBukkit - use primary world for maps - if (worldmap == null && !world.isStatic) { + if (worldmap == null && !world.isClientSide) { - itemstack.setData(world.b("map")); + itemstack.setData(worldMain.b("map")); // CraftBukkit - use primary world for maps s = "map_" + itemstack.getData(); @@ -33,7 +33,7 @@ worldmap.c(); - world.a(s, (PersistentBase) worldmap); + worldMain.a(s, (PersistentBase) worldmap); // CraftBukkit - use primary world for maps -+ ++ + // CraftBukkit start + MapInitializeEvent event = new MapInitializeEvent(worldmap.mapView); + Bukkit.getServer().getPluginManager().callEvent(event); @@ -50,7 +50,7 @@ int i = 1 << worldmap.scale; int j = worldmap.centerX; int k = worldmap.centerZ; -@@ -179,6 +191,8 @@ +@@ -181,6 +193,8 @@ if (itemstack.hasTag() && itemstack.getTag().getBoolean("map_is_scaling")) { WorldMap worldmap = Items.FILLED_MAP.getSavedMap(itemstack, world); @@ -59,13 +59,11 @@ itemstack.setData(world.b("map")); WorldMap worldmap1 = new WorldMap("map_" + itemstack.getData()); -@@ -190,7 +204,12 @@ - worldmap1.a((double) worldmap.centerX, (double) worldmap.centerZ, worldmap1.scale); +@@ -193,6 +207,11 @@ worldmap1.map = worldmap.map; worldmap1.c(); -- world.a("map_" + itemstack.getData(), (PersistentBase) worldmap1); -+ world.a("map_" + itemstack.getData(), (PersistentBase) worldmap1); -+ + world.a("map_" + itemstack.getData(), (PersistentBase) worldmap1); ++ + // CraftBukkit start + MapInitializeEvent event = new MapInitializeEvent(worldmap1.mapView); + Bukkit.getServer().getPluginManager().callEvent(event); diff --git a/nms-patches/JsonList.patch b/nms-patches/JsonList.patch index 9342f17733..57ae7c2ad1 100644 --- a/nms-patches/JsonList.patch +++ b/nms-patches/JsonList.patch @@ -1,33 +1,47 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/JsonList.java 2014-11-28 17:43:43.249707432 +0000 -+++ src/main/java/net/minecraft/server/JsonList.java 2014-11-28 17:38:18.000000000 +0000 -@@ -79,6 +79,12 @@ - public String[] getEntries() { +--- /home/matt/mc-dev-private//net/minecraft/server/JsonList.java 2015-02-26 22:40:22.863608136 +0000 ++++ src/main/java/net/minecraft/server/JsonList.java 2015-02-26 22:40:22.863608136 +0000 +@@ -83,7 +83,7 @@ + + public V get(K k0) { + this.h(); +- return (JsonListEntry) this.d.get(this.a(k0)); ++ return (V) this.d.get(this.a(k0)); // CraftBukkit - fix decompile error + } + + public void remove(K k0) { +@@ -101,6 +101,12 @@ return (String[]) this.d.keySet().toArray(new String[this.d.size()]); } -+ + + // CraftBukkit start -+ public Collection getValues() { ++ public Collection getValues() { + return this.d.values(); + } + // CraftBukkit end - ++ public boolean isEmpty() { return this.d.size() < 1; -@@ -122,7 +128,7 @@ - return this.d; } +@@ -176,7 +182,7 @@ + JsonListEntry jsonlistentry = (JsonListEntry) iterator.next(); -- public void save() { -+ public void save() throws IOException { // CraftBukkit - Added throws - Collection collection = this.d.values(); - String s = this.b.toJson(collection); - BufferedWriter bufferedwriter = null; -@@ -136,7 +142,7 @@ + if (jsonlistentry.getKey() != null) { +- this.d.put(this.a(jsonlistentry.getKey()), jsonlistentry); ++ this.d.put(this.a((K) jsonlistentry.getKey()), (V) jsonlistentry); // CraftBukkit - fix decompile error + } + } + } +@@ -205,11 +211,11 @@ + } + } - } +- public JsonElement serialize(Object object, Type type, JsonSerializationContext jsonserializationcontext) { ++ public JsonElement serialize(JsonListEntry object, Type type, JsonSerializationContext jsonserializationcontext) { // CraftBukkit - fix decompile error + return this.a((JsonListEntry) object, type, jsonserializationcontext); + } -- public void load() { -+ public void load() throws IOException { // CraftBukkit - Added throws - Collection collection = null; - BufferedReader bufferedreader = null; +- public Object deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { ++ public JsonListEntry deserialize(JsonElement jsonelement, Type type, JsonDeserializationContext jsondeserializationcontext) throws JsonParseException { // CraftBukkit - fix decompile error + return this.a(jsonelement, type, jsondeserializationcontext); + } diff --git a/nms-patches/JsonListEntry.patch b/nms-patches/JsonListEntry.patch new file mode 100644 index 0000000000..de32677013 --- /dev/null +++ b/nms-patches/JsonListEntry.patch @@ -0,0 +1,11 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/JsonListEntry.java 2015-02-26 22:40:22.859608136 +0000 ++++ src/main/java/net/minecraft/server/JsonListEntry.java 2015-02-26 22:40:22.859608136 +0000 +@@ -14,7 +14,7 @@ + this.a = t0; + } + +- T getKey() { ++ public T getKey() { // CraftBukkit - public + return this.a; + } + diff --git a/nms-patches/Location2D.patch b/nms-patches/Location2D.patch deleted file mode 100644 index 4214968723..0000000000 --- a/nms-patches/Location2D.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/Location2D.java 2014-12-26 21:29:07.829484981 +0000 -+++ src/main/java/net/minecraft/server/Location2D.java 2014-12-26 21:29:07.829484981 +0000 -@@ -68,7 +68,7 @@ - } - - blockposition = blockposition.down(); -- } while (world.getType(blockposition).getBlock().getMaterial() == Material.AIR); -+ } while (getType(world, blockposition).getBlock().getMaterial() == Material.AIR); // CraftBukkit - - return blockposition.getY() + 1; - } -@@ -84,7 +84,7 @@ - } - - blockposition = blockposition.down(); -- material = world.getType(blockposition).getBlock().getMaterial(); -+ material = getType(world, blockposition).getBlock().getMaterial(); // CraftBukkit - } while (material == Material.AIR); - - return !material.isLiquid() && material != Material.FIRE; -@@ -94,4 +94,11 @@ - this.a = MathHelper.a(random, d0, d2); - this.b = MathHelper.a(random, d1, d3); - } -+ -+ // CraftBukkit start - add a version of getType which force loads chunks -+ private static IBlockData getType(World world, BlockPosition position) { -+ ((ChunkProviderServer) world.chunkProvider).getChunkAt(position.getX() >> 4, position.getZ() >> 4); -+ return world.getType(position); -+ } -+ // CraftBukkit end - } diff --git a/nms-patches/LoginListener.patch b/nms-patches/LoginListener.patch index 6732863545..c9be91fec6 100644 --- a/nms-patches/LoginListener.patch +++ b/nms-patches/LoginListener.patch @@ -1,14 +1,27 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/LoginListener.java 2014-11-28 17:43:43.249707432 +0000 -+++ src/main/java/net/minecraft/server/LoginListener.java 2014-11-28 17:38:20.000000000 +0000 -@@ -26,6 +26,7 @@ - private GameProfile i; +--- /home/matt/mc-dev-private//net/minecraft/server/LoginListener.java 2015-02-26 22:40:22.867608136 +0000 ++++ src/main/java/net/minecraft/server/LoginListener.java 2015-02-26 22:40:22.867608136 +0000 +@@ -18,6 +18,12 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + ++// CraftBukkit start ++import org.bukkit.craftbukkit.util.Waitable; ++import org.bukkit.event.player.AsyncPlayerPreLoginEvent; ++import org.bukkit.event.player.PlayerPreLoginEvent; ++// CraftBukkit end ++ + public class LoginListener implements PacketLoginInListener, IUpdatePlayerListBox { + + private static final AtomicInteger b = new AtomicInteger(0); +@@ -32,6 +38,7 @@ private String j; private SecretKey loginKey; + private EntityPlayer l; + public String hostname = ""; // CraftBukkit - add field public LoginListener(MinecraftServer minecraftserver, NetworkManager networkmanager) { - this.g = EnumProtocolState.HELLO; -@@ -64,10 +65,12 @@ + this.g = LoginListener.EnumProtocolState.HELLO; +@@ -78,10 +85,12 @@ this.i = this.a(this.i); } @@ -22,14 +35,91 @@ + // this.disconnect(s); + // CraftBukkit end } else { - this.g = EnumProtocolState.ACCEPTED; - if (this.server.aI() >= 0 && !this.networkManager.c()) { -@@ -75,7 +78,7 @@ - } + this.g = LoginListener.EnumProtocolState.ACCEPTED; + if (this.server.aJ() >= 0 && !this.networkManager.c()) { +@@ -90,7 +99,7 @@ + LoginListener.this.networkManager.a(LoginListener.this.server.aJ()); + } - this.networkManager.handle(new PacketLoginOutSuccess(this.i)); -- this.server.getPlayerList().a(this.networkManager, this.server.getPlayerList().processLogin(this.i)); -+ this.server.getPlayerList().a(this.networkManager, this.server.getPlayerList().processLogin(this.i, s)); // CraftBukkit - add player reference +- public void operationComplete(Future future) throws Exception { ++ public void operationComplete(ChannelFuture future) throws Exception { // CraftBukkit - fix decompile error + this.a((ChannelFuture) future); + } + }, new GenericFutureListener[0]); +@@ -101,9 +110,9 @@ + + if (entityplayer != null) { + this.g = LoginListener.EnumProtocolState.e; +- this.l = this.server.getPlayerList().processLogin(this.i); ++ this.l = this.server.getPlayerList().processLogin(this.i, s); // CraftBukkit - add player reference + } else { +- this.server.getPlayerList().a(this.networkManager, this.server.getPlayerList().processLogin(this.i)); ++ this.server.getPlayerList().a(this.networkManager, this.server.getPlayerList().processLogin(this.i, s)); // CraftBukkit - add player reference + } } - } +@@ -148,6 +157,43 @@ + + LoginListener.this.i = LoginListener.this.server.aC().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s); + if (LoginListener.this.i != null) { ++ // CraftBukkit start - fire PlayerPreLoginEvent ++ if (!networkManager.g()) { ++ return; ++ } ++ ++ String playerName = i.getName(); ++ java.net.InetAddress address = ((java.net.InetSocketAddress) networkManager.getSocketAddress()).getAddress(); ++ java.util.UUID uniqueId = i.getId(); ++ final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server; ++ ++ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId); ++ server.getPluginManager().callEvent(asyncEvent); ++ ++ if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) { ++ final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId); ++ if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) { ++ event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage()); ++ } ++ Waitable waitable = new Waitable() { ++ @Override ++ protected PlayerPreLoginEvent.Result evaluate() { ++ server.getPluginManager().callEvent(event); ++ return event.getResult(); ++ }}; ++ ++ LoginListener.this.server.processQueue.add(waitable); ++ if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { ++ disconnect(event.getKickMessage()); ++ return; ++ } ++ } else { ++ if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) { ++ disconnect(asyncEvent.getKickMessage()); ++ return; ++ } ++ } ++ // CraftBukkit end + LoginListener.c.info("UUID of player " + LoginListener.this.i.getName() + " is " + LoginListener.this.i.getId()); + LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; + } else if (LoginListener.this.server.S()) { +@@ -156,7 +202,7 @@ + LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; + } else { + LoginListener.this.disconnect("Failed to verify username!"); +- LoginListener.c.error("Username \'" + LoginListener.this.i.getName() + "\' tried to join with an invalid session"); ++ LoginListener.c.error("Username \'" + gameprofile.getName() + "\' tried to join with an invalid session"); // CraftBukkit - fix null pointer + } + } catch (AuthenticationUnavailableException authenticationunavailableexception) { + if (LoginListener.this.server.S()) { +@@ -167,6 +213,11 @@ + LoginListener.this.disconnect("Authentication servers are down. Please try again later, sorry!"); + LoginListener.c.error("Couldn\'t verify username because servers are unavailable"); + } ++ // CraftBukkit start - catch all exceptions ++ } catch (Exception exception) { ++ disconnect("Failed to verify username!"); ++ server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + gameprofile.getName(), exception); ++ // CraftBukkit end + } + + } diff --git a/nms-patches/MethodProfiler.patch b/nms-patches/MethodProfiler.patch index a8577d4b1e..2d593086c4 100644 --- a/nms-patches/MethodProfiler.patch +++ b/nms-patches/MethodProfiler.patch @@ -1,19 +1,19 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/MethodProfiler.java 2014-11-28 17:43:43.253707432 +0000 -+++ src/main/java/net/minecraft/server/MethodProfiler.java 2014-11-28 17:38:17.000000000 +0000 -@@ -10,129 +10,29 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/MethodProfiler.java 2015-02-26 22:40:22.867608136 +0000 ++++ src/main/java/net/minecraft/server/MethodProfiler.java 2015-02-26 22:40:22.871608136 +0000 +@@ -10,130 +10,30 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +// CraftBukkit start - Strip down to empty methods, performance cost public class MethodProfiler { -- + - private static final Logger b = LogManager.getLogger(); -- private final List c = Lists.newArrayList(); -- private final List d = Lists.newArrayList(); +- private final List c = Lists.newArrayList(); +- private final List d = Lists.newArrayList(); public boolean a; - private String e = ""; -- private final Map f = Maps.newHashMap(); - +- private final Map f = Maps.newHashMap(); +- public MethodProfiler() {} public void a() { @@ -56,7 +56,7 @@ - } } - public List b(String s) { + public List b(String s) { - if (!this.a) { - return null; - } else { @@ -101,7 +101,7 @@ - double d1 = (double) l * 100.0D / (double) i; - String s3 = s2.substring(s.length()); - -- arraylist.add(new ProfilerInfo(s3, d0, d1)); +- arraylist.add(new MethodProfiler.ProfilerInfo(s3, d0, d1)); - } - } - @@ -113,11 +113,11 @@ - } - - if ((float) k > f) { -- arraylist.add(new ProfilerInfo("unspecified", (double) ((float) k - f) * 100.0D / (double) k, (double) ((float) k - f) * 100.0D / (double) i)); +- arraylist.add(new MethodProfiler.ProfilerInfo("unspecified", (double) ((float) k - f) * 100.0D / (double) k, (double) ((float) k - f) * 100.0D / (double) i)); - } - - Collections.sort(arraylist); -- arraylist.add(0, new ProfilerInfo(s, 100.0D, (double) k * 100.0D / (double) i)); +- arraylist.add(0, new MethodProfiler.ProfilerInfo(s, 100.0D, (double) k * 100.0D / (double) i)); - return arraylist; - } + return null; @@ -130,6 +130,16 @@ public String c() { - return this.c.size() == 0 ? "[UNKNOWN]" : (String) this.c.get(this.c.size() - 1); -+ return null; ++ return ""; + } + + public static final class ProfilerInfo implements Comparable { +@@ -152,7 +52,7 @@ + return methodprofiler_profilerinfo.a < this.a ? -1 : (methodprofiler_profilerinfo.a > this.a ? 1 : methodprofiler_profilerinfo.c.compareTo(this.c)); + } + +- public int compareTo(Object object) { ++ public int compareTo(MethodProfiler.ProfilerInfo object) { + return this.a((MethodProfiler.ProfilerInfo) object); + } } - } diff --git a/nms-patches/MinecraftServer.patch b/nms-patches/MinecraftServer.patch index efb0cfcb4b..3da94870e9 100644 --- a/nms-patches/MinecraftServer.patch +++ b/nms-patches/MinecraftServer.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/MinecraftServer.java 2015-02-07 10:38:11.624196571 +0000 -+++ src/main/java/net/minecraft/server/MinecraftServer.java 2015-02-07 10:38:11.628196571 +0000 -@@ -37,6 +37,18 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/MinecraftServer.java 2015-02-26 22:40:22.875608136 +0000 ++++ src/main/java/net/minecraft/server/MinecraftServer.java 2015-02-26 22:40:22.879608136 +0000 +@@ -38,14 +38,27 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -16,12 +16,24 @@ +import org.bukkit.event.server.RemoteServerCommandEvent; +import org.bukkit.event.world.WorldSaveEvent; +// CraftBukkit end - public abstract class MinecraftServer implements ICommandListener, Runnable, IAsyncTaskHandler, IMojangStatistics { ++ + public abstract class MinecraftServer implements Runnable, ICommandListener, IAsyncTaskHandler, IMojangStatistics { - private static final Logger LOGGER = LogManager.getLogger(); -@@ -93,24 +105,66 @@ +- private static final Logger LOGGER = LogManager.getLogger(); ++ public static final Logger LOGGER = LogManager.getLogger(); + public static final File a = new File("usercache.json"); + private static MinecraftServer l; +- private final Convertable convertable; ++ public Convertable convertable; // CraftBukkit - remove final, public + private final MojangStatisticsGenerator n = new MojangStatisticsGenerator("server", this, ay()); +- private final File universe; ++ public File universe; // CraftBukkit - remove final, public + private final List p = Lists.newArrayList(); + protected final ICommandHandler b; + public final MethodProfiler methodProfiler = new MethodProfiler(); +@@ -94,19 +107,61 @@ private Thread serverThread; - private long ab = ax(); + private long ab = ay(); - public MinecraftServer(File file, Proxy proxy, File file1) { + // CraftBukkit start @@ -38,13 +50,13 @@ + // CraftBukkit end + + public MinecraftServer(OptionSet options, Proxy proxy, File file1) { - this.d = proxy; - MinecraftServer.k = this; + this.e = proxy; + MinecraftServer.l = this; - this.universe = file; + // this.universe = file; // CraftBukkit this.q = new ServerConnection(this); this.Z = new UserCache(this, file1); - this.p = this.h(); + this.b = this.h(); - this.convertable = new WorldLoaderServer(file); + // this.convertable = new WorldLoaderServer(file); // CraftBukkit - moved to DedicatedServer.init this.V = new YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString()); @@ -84,21 +96,15 @@ protected CommandDispatcher h() { return new CommandDispatcher(); } - -- protected abstract boolean init(); -+ protected abstract boolean init() throws java.net.UnknownHostException; // CraftBukkit - throws UnknownHostException - - protected void a(String s) { - if (this.getConvertable().isConvertable(s)) { -@@ -129,6 +183,7 @@ +@@ -144,6 +199,7 @@ this.a(s); this.b("menu.loadingLevel"); this.worldServer = new WorldServer[3]; + /* CraftBukkit start - Remove ticktime arrays and worldsettings - this.h = new long[this.worldServer.length][100]; + this.i = new long[this.worldServer.length][100]; IDataManager idatamanager = this.convertable.a(s, true); -@@ -152,37 +207,112 @@ +@@ -167,37 +223,112 @@ worlddata.a(s1); worldsettings = new WorldSettings(worlddata); } @@ -222,18 +228,18 @@ this.a(this.getDifficulty()); this.k(); } -@@ -197,25 +327,38 @@ +@@ -212,25 +343,38 @@ this.b("menu.generatingTerrain"); byte b0 = 0; - MinecraftServer.LOGGER.info("Preparing start region for level " + b0); - WorldServer worldserver = this.worldServer[b0]; - BlockPosition blockposition = worldserver.getSpawn(); -- long j = ax(); +- long j = ay(); - - for (int k = -192; k <= 192 && this.isRunning(); k += 16) { - for (int l = -192; l <= 192 && this.isRunning(); l += 16) { -- long i1 = ax(); +- long i1 = ay(); - - if (i1 - j > 1000L) { - this.a_("Preparing spawn area", i * 100 / 625); @@ -249,12 +255,12 @@ + } + + BlockPosition blockposition = worldserver.getSpawn(); -+ long j = ax(); ++ long j = ay(); + i = 0; + + for (int k = -192; k <= 192 && this.isRunning(); k += 16) { + for (int l = -192; l <= 192 && this.isRunning(); l += 16) { -+ long i1 = ax(); ++ long i1 = ay(); + + if (i1 - j > 1000L) { + this.a_("Preparing spawn area", i * 100 / 625); @@ -273,13 +279,13 @@ + this.server.getPluginManager().callEvent(new org.bukkit.event.world.WorldLoadEvent(world.getWorld())); + } + // CraftBukkit end - this.q(); + this.r(); } -@@ -247,35 +390,49 @@ - protected void q() { - this.e = null; - this.f = 0; +@@ -264,35 +408,52 @@ + protected void r() { + this.f = null; + this.g = 0; + + this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD); // CraftBukkit } @@ -287,16 +293,16 @@ - protected void saveChunks(boolean flag) { + protected void saveChunks(boolean flag) throws ExceptionWorldConflict { // CraftBukkit - added throws if (!this.N) { -- WorldServer[] aworldserver = this.worldServer; -- int i = aworldserver.length; -- + WorldServer[] aworldserver = this.worldServer; + int i = aworldserver.length; + - for (int j = 0; j < i; ++j) { - WorldServer worldserver = aworldserver[j]; - + // CraftBukkit start + for (int j = 0; j < worlds.size(); ++j) { + WorldServer worldserver = worlds.get(j); + // CraftBukkit end + if (worldserver != null) { if (!flag) { MinecraftServer.LOGGER.info("Saving chunks for level \'" + worldserver.getWorldData().getName() + "\'/" + worldserver.worldProvider.getName()); @@ -315,7 +321,7 @@ } } -- public void stop() { +- protected void stop() { + // CraftBukkit start + private boolean hasStopped = false; + private final Object stopLock = new Object(); @@ -335,10 +341,10 @@ + this.server.disablePlugins(); + } + // CraftBukkit end - if (this.ao() != null) { - this.ao().b(); + if (this.ap() != null) { + this.ap().b(); } -@@ -290,11 +447,13 @@ +@@ -307,11 +468,13 @@ MinecraftServer.LOGGER.info("Saving worlds"); this.saveChunks(false); @@ -351,8 +357,8 @@ + // CraftBukkit end */ } - if (this.m.d()) { -@@ -335,6 +494,7 @@ + if (this.n.d()) { +@@ -352,6 +515,7 @@ long k = j - this.ab; if (k > 2000L && this.ab - this.R >= 15000L) { @@ -360,21 +366,21 @@ MinecraftServer.LOGGER.warn("Can\'t keep up! Did the system time change, or is the server overloaded? Running {}ms behind, skipping {} tick(s)", new Object[] { Long.valueOf(k), Long.valueOf(k / 50L)}); k = 2000L; this.R = this.ab; -@@ -347,11 +507,12 @@ +@@ -364,11 +528,12 @@ i += k; this.ab = j; - if (this.worldServer[0].everyoneDeeplySleeping()) { -+ if (this.worlds.get(0).everyoneDeeplySleeping()) { // CraftBukkit - this.y(); ++ if (this.worlds.get(0).everyoneDeeplySleeping()) { + this.z(); i = 0L; } else { while (i > 50L) { + MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit i -= 50L; - this.y(); + this.z(); } -@@ -389,6 +550,12 @@ +@@ -406,6 +571,12 @@ } catch (Throwable throwable1) { MinecraftServer.LOGGER.error("Exception stopping the server", throwable1); } finally { @@ -384,19 +390,19 @@ + } catch (Exception ignored) { + } + // CraftBukkit end - this.x(); + this.y(); } -@@ -428,7 +595,7 @@ +@@ -445,7 +616,7 @@ - protected void x() {} + protected void y() {} -- protected void y() { -+ protected void y() throws ExceptionWorldConflict { // CraftBukkit - added throws +- protected void z() { ++ protected void z() throws ExceptionWorldConflict { // CraftBukkit - added throws long i = System.nanoTime(); ++this.ticks; -@@ -454,7 +621,7 @@ +@@ -471,7 +642,7 @@ this.r.b().a(agameprofile); } @@ -405,22 +411,7 @@ this.methodProfiler.a("save"); this.v.savePlayers(); this.saveChunks(true); -@@ -484,29 +651,53 @@ - synchronized (this.i) { - while (!this.i.isEmpty()) { - try { -- ((FutureTask) this.i.poll()).run(); -+ // CraftBukkit start - log exceptions -+ FutureTask task = ((FutureTask) this.i.poll()); -+ task.run(); -+ task.get(); - } catch (Throwable throwable) { -- MinecraftServer.LOGGER.fatal(throwable); -+ MinecraftServer.LOGGER.fatal("Handling task", throwable); -+ // CraftBukkit end - } - } - } +@@ -506,20 +677,40 @@ this.methodProfiler.c("levels"); @@ -464,20 +455,20 @@ this.methodProfiler.a("tick"); -@@ -533,9 +724,9 @@ +@@ -546,9 +737,9 @@ worldserver.getTracker().updatePlayers(); this.methodProfiler.b(); this.methodProfiler.b(); - } + // } // CraftBukkit -- this.h[i][this.ticks % 100] = System.nanoTime() - j; -+ // this.h[i][this.ticks % 100] = System.nanoTime() - j; // CraftBukkit +- this.i[i][this.ticks % 100] = System.nanoTime() - j; ++ // this.i[i][this.ticks % 100] = System.nanoTime() - j; // CraftBukkit } this.methodProfiler.c("connection"); -@@ -559,10 +750,11 @@ - this.o.add(iupdateplayerlistbox); +@@ -572,10 +763,11 @@ + this.p.add(iupdateplayerlistbox); } - public static void main(String[] astring) { @@ -489,10 +480,10 @@ boolean flag = true; String s = null; String s1 = "."; -@@ -636,6 +828,27 @@ - - dedicatedserver.B(); - Runtime.getRuntime().addShutdownHook(new ThreadShutdown("Server Shutdown Thread", dedicatedserver)); +@@ -653,6 +845,27 @@ + dedicatedserver.stop(); + } + }); + */ + + DedicatedServer dedicatedserver = new DedicatedServer(options); @@ -517,10 +508,10 @@ } catch (Exception exception) { MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception); } -@@ -643,8 +856,10 @@ +@@ -660,8 +873,10 @@ } - public void B() { + public void C() { + /* CraftBukkit start - prevent abuse this.serverThread = new Thread(this, "Server thread"); this.serverThread.start(); @@ -528,7 +519,7 @@ } public File d(String s) { -@@ -660,7 +875,14 @@ +@@ -677,7 +892,14 @@ } public WorldServer getWorldServer(int i) { @@ -543,69 +534,8 @@ + // CraftBukkit end } - public String C() { -@@ -696,17 +918,62 @@ - } - - public String getPlugins() { -- return ""; -- } -+ // CraftBukkit start - Whole method -+ StringBuilder result = new StringBuilder(); -+ org.bukkit.plugin.Plugin[] plugins = server.getPluginManager().getPlugins(); -+ -+ result.append(server.getName()); -+ result.append(" on Bukkit "); -+ result.append(server.getBukkitVersion()); -+ -+ if (plugins.length > 0 && server.getQueryPlugins()) { -+ result.append(": "); -+ -+ for (int i = 0; i < plugins.length; i++) { -+ if (i > 0) { -+ result.append("; "); -+ } - -- public String executeRemoteCommand(String s) { -- RemoteControlCommandListener.getInstance().i(); -- this.p.a(RemoteControlCommandListener.getInstance(), s); -- return RemoteControlCommandListener.getInstance().j(); -+ result.append(plugins[i].getDescription().getName()); -+ result.append(" "); -+ result.append(plugins[i].getDescription().getVersion().replaceAll(";", ",")); -+ } -+ } -+ -+ return result.toString(); -+ // CraftBukkit end -+ } -+ -+ // CraftBukkit start - fire RemoteServerCommandEvent -+ public String executeRemoteCommand(final String s) { -+ Waitable waitable = new Waitable() { -+ @Override -+ protected String evaluate() { -+ RemoteControlCommandListener.getInstance().i(); -+ // Event changes start -+ RemoteServerCommandEvent event = new RemoteServerCommandEvent(remoteConsole, s); -+ server.getPluginManager().callEvent(event); -+ // Event change end -+ ServerCommand serverCommand = new ServerCommand(event.getCommand(), RemoteControlCommandListener.getInstance()); -+ server.dispatchServerCommand(remoteConsole, serverCommand); -+ // this.p.a(RemoteControlCommandListener.getInstance(), s); -+ return RemoteControlCommandListener.getInstance().j(); -+ } -+ }; -+ processQueue.add(waitable); -+ try { -+ return waitable.get(); -+ } catch (java.util.concurrent.ExecutionException e) { -+ throw new RuntimeException("Exception processing rcon command " + s, e.getCause()); -+ } catch (InterruptedException e) { -+ Thread.currentThread().interrupt(); // Maintain interrupted state -+ throw new RuntimeException("Interrupted processing rcon command " + s, e); -+ } -+ // CraftBukkit end + public String D() { +@@ -713,7 +935,7 @@ } public boolean isDebugging() { @@ -613,8 +543,8 @@ + return this.getPropertyManager().getBoolean("debug", false); // CraftBukkit - don't hardcode } - public void h(String s) { -@@ -721,7 +988,7 @@ + public void g(String s) { +@@ -728,7 +950,7 @@ } public String getServerModName() { @@ -623,15 +553,15 @@ } public CrashReport b(CrashReport crashreport) { -@@ -734,6 +1001,7 @@ +@@ -757,6 +979,7 @@ } - public List tabCompleteCommand(ICommandListener icommandlistener, String s, BlockPosition blockposition) { + public List tabCompleteCommand(ICommandListener icommandlistener, String s, BlockPosition blockposition) { + /* CraftBukkit start - Allow tab-completion of Bukkit commands ArrayList arraylist = Lists.newArrayList(); if (s.startsWith("/")) { -@@ -772,6 +1040,9 @@ +@@ -795,6 +1018,9 @@ return arraylist; } @@ -641,7 +571,7 @@ } public static MinecraftServer getServer() { -@@ -779,7 +1050,7 @@ +@@ -802,7 +1028,7 @@ } public boolean N() { @@ -650,7 +580,7 @@ } public String getName() { -@@ -835,8 +1106,10 @@ +@@ -858,8 +1084,10 @@ } public void a(EnumDifficulty enumdifficulty) { @@ -663,17 +593,18 @@ if (worldserver != null) { if (worldserver.getWorldData().isHardcore()) { -@@ -878,15 +1151,17 @@ +@@ -901,15 +1129,17 @@ this.N = true; this.getConvertable().d(); - for (int i = 0; i < this.worldServer.length; ++i) { - WorldServer worldserver = this.worldServer[i]; +- + // CraftBukkit start + for (int i = 0; i < this.worlds.size(); ++i) { + WorldServer worldserver = this.worlds.get(i); + // CraftBukkit end - ++ if (worldserver != null) { worldserver.saveLevel(); } @@ -684,7 +615,7 @@ this.safeShutdown(); } -@@ -919,9 +1194,11 @@ +@@ -942,9 +1172,11 @@ int i = 0; if (this.worldServer != null) { @@ -699,7 +630,7 @@ WorldData worlddata = worldserver.getWorldData(); mojangstatisticsgenerator.a("world[" + i + "][dimension]", Integer.valueOf(worldserver.worldProvider.getDimension())); -@@ -954,7 +1231,7 @@ +@@ -977,7 +1209,7 @@ public abstract boolean ad(); public boolean getOnlineMode() { @@ -708,20 +639,19 @@ } public void setOnlineMode(boolean flag) { -@@ -1024,8 +1301,10 @@ +@@ -1049,8 +1281,9 @@ } - public void setGamemode(EnumGamemode enumgamemode) { + public void setGamemode(WorldSettings.EnumGamemode worldsettings_enumgamemode) { - for (int i = 0; i < this.worldServer.length; ++i) { -- getServer().worldServer[i].getWorldData().setGameType(enumgamemode); +- getServer().worldServer[i].getWorldData().setGameType(worldsettings_enumgamemode); + // CraftBukkit start + for (int i = 0; i < this.worlds.size(); ++i) { -+ getServer().worlds.get(i).getWorldData().setGameType(enumgamemode); -+ // CraftBukkit end ++ getServer().worlds.get(i).getWorldData().setGameType(worldsettings_enumgamemode); } } -@@ -1057,7 +1336,7 @@ +@@ -1082,7 +1315,7 @@ } public World getWorld() { @@ -730,13 +660,10 @@ } public Entity f() { -@@ -1125,11 +1404,10 @@ - } +@@ -1153,8 +1386,10 @@ + WorldServer[] aworldserver = this.worldServer; + int i = aworldserver.length; - public Entity a(UUID uuid) { -- WorldServer[] aworldserver = this.worldServer; -- int i = aworldserver.length; -- - for (int j = 0; j < i; ++j) { - WorldServer worldserver = aworldserver[j]; + // CraftBukkit start @@ -746,12 +673,12 @@ if (worldserver != null) { Entity entity = worldserver.getEntity(uuid); -@@ -1144,7 +1422,7 @@ +@@ -1169,7 +1404,7 @@ } public boolean getSendCommandFeedback() { - return getServer().worldServer[0].getGameRules().getBoolean("sendCommandFeedback"); -+ return getServer().worlds.get(0).getGameRules().getBoolean("sendCommandFeedback"); // CraftBukkit ++ return getServer().worlds.get(0).getGameRules().getBoolean("sendCommandFeedback"); } - public void a(EnumCommandResult enumcommandresult, int i) {} + public void a(CommandObjectiveExecutor.EnumCommandResult commandobjectiveexecutor_enumcommandresult, int i) {} diff --git a/nms-patches/MobEffectList.patch b/nms-patches/MobEffectList.patch index 5f8389c147..f9323cea57 100644 --- a/nms-patches/MobEffectList.patch +++ b/nms-patches/MobEffectList.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/MobEffectList.java 2014-11-28 17:43:43.257707431 +0000 -+++ src/main/java/net/minecraft/server/MobEffectList.java 2014-11-28 17:38:23.000000000 +0000 -@@ -6,6 +6,11 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/MobEffectList.java 2015-02-26 22:40:22.883608136 +0000 ++++ src/main/java/net/minecraft/server/MobEffectList.java 2015-02-26 22:40:22.883608136 +0000 +@@ -7,6 +7,11 @@ import java.util.UUID; import java.util.Map.Entry; @@ -12,16 +12,15 @@ public class MobEffectList { public static final MobEffectList[] byId = new MobEffectList[32]; -@@ -63,6 +68,8 @@ +@@ -64,6 +69,7 @@ } this.L = j; + org.bukkit.potion.PotionEffectType.registerPotionEffectType(new org.bukkit.craftbukkit.potion.CraftPotionEffectType(this)); // CraftBukkit -+ } public static MobEffectList b(String s) { -@@ -94,11 +101,11 @@ +@@ -86,11 +92,11 @@ public void tick(EntityLiving entityliving, int i) { if (this.id == MobEffectList.REGENERATION.id) { if (entityliving.getHealth() < entityliving.getMaxHealth()) { @@ -35,10 +34,10 @@ } } else if (this.id == MobEffectList.WITHER.id) { entityliving.damageEntity(DamageSource.WITHER, 1.0F); -@@ -106,14 +113,25 @@ +@@ -98,14 +104,25 @@ ((EntityHuman) entityliving).applyExhaustion(0.025F * (float) (i + 1)); } else if (this.id == MobEffectList.SATURATION.id && entityliving instanceof EntityHuman) { - if (!entityliving.world.isStatic) { + if (!entityliving.world.isClientSide) { - ((EntityHuman) entityliving).getFoodData().eat(i + 1, 1.0F); + // CraftBukkit start + EntityHuman entityhuman = (EntityHuman) entityliving; @@ -53,8 +52,8 @@ + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutUpdateHealth(((EntityPlayer) entityhuman).getBukkitEntity().getScaledHealth(), entityhuman.getFoodData().foodLevel, entityhuman.getFoodData().saturationLevel)); + // CraftBukkit end } - } else if ((this.id != MobEffectList.HEAL.id || entityliving.bl()) && (this.id != MobEffectList.HARM.id || !entityliving.bl())) { - if (this.id == MobEffectList.HARM.id && !entityliving.bl() || this.id == MobEffectList.HEAL.id && entityliving.bl()) { + } else if ((this.id != MobEffectList.HEAL.id || entityliving.bm()) && (this.id != MobEffectList.HARM.id || !entityliving.bm())) { + if (this.id == MobEffectList.HARM.id && !entityliving.bm() || this.id == MobEffectList.HEAL.id && entityliving.bm()) { entityliving.damageEntity(DamageSource.MAGIC, (float) (6 << i)); } } else { @@ -63,7 +62,7 @@ } } -@@ -132,7 +150,7 @@ +@@ -124,7 +141,7 @@ } } else { j = (int) (d0 * (double) (4 << i) + 0.5D); diff --git a/nms-patches/MobSpawnerAbstract.patch b/nms-patches/MobSpawnerAbstract.patch index 360ff2d3f6..fd2bedad29 100644 --- a/nms-patches/MobSpawnerAbstract.patch +++ b/nms-patches/MobSpawnerAbstract.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/MobSpawnerAbstract.java 2015-01-18 01:59:59.240758959 -0600 -+++ src/main/java/net/minecraft/server/MobSpawnerAbstract.java 2015-01-18 01:59:59.244758959 -0600 -@@ -4,6 +4,8 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/MobSpawnerAbstract.java 2015-02-26 22:40:22.887608136 +0000 ++++ src/main/java/net/minecraft/server/MobSpawnerAbstract.java 2015-02-26 22:40:22.887608136 +0000 +@@ -4,9 +4,11 @@ import java.util.Iterator; import java.util.List; @@ -8,17 +8,24 @@ + public abstract class MobSpawnerAbstract { - public int spawnDelay = 20; -@@ -24,6 +26,11 @@ +- private int spawnDelay = 20; ++ public int spawnDelay = 20; // CraftBukkit - public + private String mobName = "Pig"; + private final List mobs = Lists.newArrayList(); + private MobSpawnerAbstract.a spawnData; +@@ -22,8 +24,13 @@ - public String getMobName() { + public MobSpawnerAbstract() {} + +- private String getMobName() { ++ public String getMobName() { // CraftBukkit - public if (this.i() == null) { + // CraftBukkit start - fix NPE + if (this.mobName == null) { + this.mobName = "Pig"; + } + // CraftBukkit end - if (this.mobName.equals("Minecart")) { + if (this.mobName != null && this.mobName.equals("Minecart")) { this.mobName = "MinecartRideable"; } @@ -129,7 +136,7 @@ @@ -39,13 +46,10 @@ } entity1.mount(entity2); -@@ -162,9 +169,9 @@ - - entity1 = entity2; +@@ -167,7 +174,7 @@ + ((EntityInsentient) entity).prepare(entity.world.E(new BlockPosition(entity)), (GroupDataEntity) null); } -- } else if (entity instanceof EntityLiving && entity.world != null && flag) { -+ } else if (entity instanceof EntityInsentient && entity.world != null && flag) { // CraftBukkit - EntityLiving -> EntityInsentient - ((EntityInsentient) entity).prepare(entity.world.E(new BlockPosition(entity)), (GroupDataEntity) null); + - entity.world.addEntity(entity); + entity.world.addEntity(entity, CreatureSpawnEvent.SpawnReason.SPAWNER); // CraftBukkit } diff --git a/nms-patches/NameReferencingFileConverter.patch b/nms-patches/NameReferencingFileConverter.patch index c6fd391907..6a8e7d4040 100644 --- a/nms-patches/NameReferencingFileConverter.patch +++ b/nms-patches/NameReferencingFileConverter.patch @@ -1,29 +1,18 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/NameReferencingFileConverter.java 2014-11-28 17:43:43.261707431 +0000 -+++ src/main/java/net/minecraft/server/NameReferencingFileConverter.java 2014-11-28 17:38:23.000000000 +0000 -@@ -32,7 +32,7 @@ - public static final File c = new File("ops.txt"); - public static final File d = new File("white-list.txt"); - -- static List a(File file, Map map) { -+ static List a(File file, Map map) throws IOException { // CraftBukkit - Added throws - List list = Files.readLines(file, Charsets.UTF_8); - Iterator iterator = list.iterator(); - -@@ -77,9 +77,11 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/NameReferencingFileConverter.java 2015-02-26 22:40:22.891608136 +0000 ++++ src/main/java/net/minecraft/server/NameReferencingFileConverter.java 2015-02-26 22:40:22.891608136 +0000 +@@ -87,8 +87,9 @@ if (gameprofilebanlist.c().exists()) { try { gameprofilebanlist.load(); - } catch (FileNotFoundException filenotfoundexception) { - NameReferencingFileConverter.e.warn("Could not load existing file " + gameprofilebanlist.c().getName(), filenotfoundexception); -+ // CraftBukkit start - FileNotFoundException -> IOException, don't print stacetrace ++ // CraftBukkit start - FileNotFoundException -> IOException, don't print stacetrace + } catch (IOException filenotfoundexception) { -+ e.warn("Could not load existing file " + gameprofilebanlist.c().getName() + ", " + filenotfoundexception.getMessage()); ++ NameReferencingFileConverter.e.warn("Could not load existing file " + gameprofilebanlist.c().getName()); } -+ // CraftBukkit end } - try { -@@ -111,9 +113,11 @@ +@@ -145,8 +146,9 @@ if (ipbanlist.c().exists()) { try { ipbanlist.load(); @@ -31,13 +20,11 @@ - NameReferencingFileConverter.e.warn("Could not load existing file " + ipbanlist.c().getName(), filenotfoundexception); + // CraftBukkit start - FileNotFoundException -> IOException, don't print stacetrace + } catch (IOException filenotfoundexception) { -+ e.warn("Could not load existing file " + ipbanlist.c().getName() + ", " + filenotfoundexception.getMessage()); ++ NameReferencingFileConverter.e.warn("Could not load existing file " + ipbanlist.c().getName()); } -+ // CraftBukkit end } - try { -@@ -152,9 +156,11 @@ +@@ -186,8 +188,9 @@ if (oplist.c().exists()) { try { oplist.load(); @@ -45,13 +32,11 @@ - NameReferencingFileConverter.e.warn("Could not load existing file " + oplist.c().getName(), filenotfoundexception); + // CraftBukkit start - FileNotFoundException -> IOException, don't print stacetrace + } catch (IOException filenotfoundexception) { -+ e.warn("Could not load existing file " + oplist.c().getName() + ", " + filenotfoundexception.getMessage()); ++ NameReferencingFileConverter.e.warn("Could not load existing file " + oplist.c().getName()); } -+ // CraftBukkit end } - try { -@@ -184,9 +190,11 @@ +@@ -230,8 +233,9 @@ if (whitelist.c().exists()) { try { whitelist.load(); @@ -59,13 +44,42 @@ - NameReferencingFileConverter.e.warn("Could not load existing file " + whitelist.c().getName(), filenotfoundexception); + // CraftBukkit start - FileNotFoundException -> IOException, don't print stacetrace + } catch (IOException filenotfoundexception) { -+ e.warn("Could not load existing file " + whitelist.c().getName() + ", " + filenotfoundexception.getMessage()); ++ NameReferencingFileConverter.e.warn("Could not load existing file " + whitelist.c().getName()); } -+ // CraftBukkit end } - try { -@@ -351,7 +359,7 @@ +@@ -350,6 +354,30 @@ + File file1 = new File(file2, s + ".dat"); + File file3 = new File(file, s1 + ".dat"); + ++ // CraftBukkit start - Use old file name to seed lastKnownName ++ NBTTagCompound root = null; ++ ++ try { ++ root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file1)); ++ } catch (Exception exception) { ++ exception.printStackTrace(); ++ } ++ ++ if (root != null) { ++ if (!root.hasKey("bukkit")) { ++ root.set("bukkit", new NBTTagCompound()); ++ } ++ NBTTagCompound data = root.getCompound("bukkit"); ++ data.setString("lastKnownName", s); ++ ++ try { ++ NBTCompressedStreamTools.a(root, new java.io.FileOutputStream(file2)); ++ } catch (Exception exception) { ++ exception.printStackTrace(); ++ } ++ } ++ // CraftBukkit end ++ + NameReferencingFileConverter.b(file); + if (!file1.renameTo(file3)) { + throw new NameReferencingFileConverter.FileConversionException("Could not convert file for " + s, null); +@@ -467,7 +495,7 @@ private static File d(PropertyManager propertymanager) { String s = propertymanager.getString("level-name", "world"); diff --git a/nms-patches/NetworkManager.patch b/nms-patches/NetworkManager.patch index dc5b506b59..1379f1714a 100644 --- a/nms-patches/NetworkManager.patch +++ b/nms-patches/NetworkManager.patch @@ -1,20 +1,29 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/NetworkManager.java 2014-11-28 17:43:43.265707431 +0000 -+++ src/main/java/net/minecraft/server/NetworkManager.java 2014-11-28 17:38:19.000000000 +0000 -@@ -41,7 +41,7 @@ - this.g = enumprotocoldirection; - } - -- public void channelActive(ChannelHandlerContext channelhandlercontext) { -+ public void channelActive(ChannelHandlerContext channelhandlercontext) throws Exception { // CraftBukkit - added throws - super.channelActive(channelhandlercontext); - this.i = channelhandlercontext.channel(); - this.j = this.i.remoteAddress(); -@@ -159,7 +159,7 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/NetworkManager.java 2015-02-26 22:40:22.895608136 +0000 ++++ src/main/java/net/minecraft/server/NetworkManager.java 2015-02-26 22:40:22.895608136 +0000 +@@ -63,7 +63,7 @@ + private final EnumProtocolDirection h; + private final Queue i = Queues.newConcurrentLinkedQueue(); + private final ReentrantReadWriteLock j = new ReentrantReadWriteLock(); +- private Channel k; ++ public Channel k; // CraftBukkit - public, PAIL: rename + private SocketAddress l; + private PacketListener m; + private IChatBaseComponent n; +@@ -231,7 +231,7 @@ public void close(IChatBaseComponent ichatbasecomponent) { - if (this.i.isOpen()) { -- this.i.close().awaitUninterruptibly(); -+ this.i.close(); // We can't wait as this may be called from an event loop. - this.l = ichatbasecomponent; + if (this.k.isOpen()) { +- this.k.close().awaitUninterruptibly(); ++ this.k.close(); // We can't wait as this may be called from an event loop. + this.n = ichatbasecomponent; } +@@ -308,7 +308,7 @@ + } + } + +- protected void channelRead0(ChannelHandlerContext channelhandlercontext, Object object) throws Exception { ++ protected void channelRead0(ChannelHandlerContext channelhandlercontext, Packet object) throws Exception { // CraftBukkit - fix decompile error + this.a(channelhandlercontext, (Packet) object); + } + diff --git a/nms-patches/Packet.patch b/nms-patches/Packet.patch deleted file mode 100644 index 5798caf0d5..0000000000 --- a/nms-patches/Packet.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/Packet.java 2014-11-28 17:43:43.269707431 +0000 -+++ src/main/java/net/minecraft/server/Packet.java 2014-11-28 17:38:21.000000000 +0000 -@@ -2,9 +2,9 @@ - - public interface Packet { - -- void a(PacketDataSerializer packetdataserializer); -+ void a(PacketDataSerializer packetdataserializer) throws java.io.IOException; // CraftBukkit - added throws - -- void b(PacketDataSerializer packetdataserializer); -+ void b(PacketDataSerializer packetdataserializer) throws java.io.IOException; // CraftBukkit - added throws - - void a(PacketListener packetlistener); - } diff --git a/nms-patches/PacketDataSerializer.patch b/nms-patches/PacketDataSerializer.patch index e2f449fd7e..c0e3fd8bad 100644 --- a/nms-patches/PacketDataSerializer.patch +++ b/nms-patches/PacketDataSerializer.patch @@ -1,14 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PacketDataSerializer.java 2014-11-28 17:43:43.265707431 +0000 -+++ src/main/java/net/minecraft/server/PacketDataSerializer.java 2014-11-28 17:38:23.000000000 +0000 -@@ -8,7 +8,6 @@ - import io.netty.buffer.ByteBufProcessor; - import io.netty.handler.codec.DecoderException; - import io.netty.handler.codec.EncoderException; --import io.netty.util.ReferenceCounted; - import java.io.DataInput; - import java.io.DataOutput; - import java.io.IOException; -@@ -21,6 +20,8 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/PacketDataSerializer.java 2015-02-26 22:40:22.899608136 +0000 ++++ src/main/java/net/minecraft/server/PacketDataSerializer.java 2015-02-26 22:40:22.903608136 +0000 +@@ -21,6 +21,8 @@ import java.nio.charset.Charset; import java.util.UUID; @@ -17,7 +9,16 @@ public class PacketDataSerializer extends ByteBuf { private final ByteBuf a; -@@ -142,7 +143,7 @@ +@@ -68,7 +70,7 @@ + } + + public > T a(Class oclass) { +- return ((Enum[]) oclass.getEnumConstants())[this.e()]; ++ return ((T[]) oclass.getEnumConstants())[this.e()]; // CraftBukkit - fix decompile error + } + + public void a(Enum oenum) { +@@ -142,7 +144,7 @@ } else { try { NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) (new ByteBufOutputStream(this))); @@ -26,7 +27,7 @@ throw new EncoderException(ioexception); } } -@@ -162,7 +163,7 @@ +@@ -162,7 +164,7 @@ } public void a(ItemStack itemstack) { @@ -35,7 +36,7 @@ this.writeShort(-1); } else { this.writeShort(Item.getId(itemstack.getItem())); -@@ -189,6 +190,11 @@ +@@ -189,6 +191,11 @@ itemstack = new ItemStack(Item.getById(short0), b0, short1); itemstack.setTag(this.h()); @@ -47,63 +48,7 @@ } return itemstack; -@@ -416,11 +422,11 @@ - return this.a.getBytes(i, bytebuffer); - } - -- public ByteBuf getBytes(int i, OutputStream outputstream, int j) { -+ public ByteBuf getBytes(int i, OutputStream outputstream, int j) throws IOException { // CraftBukkit - throws IOException - return this.a.getBytes(i, outputstream, j); - } - -- public int getBytes(int i, GatheringByteChannel gatheringbytechannel, int j) { -+ public int getBytes(int i, GatheringByteChannel gatheringbytechannel, int j) throws IOException { // CraftBukkit - throws IOException - return this.a.getBytes(i, gatheringbytechannel, j); - } - -@@ -484,11 +490,11 @@ - return this.a.setBytes(i, bytebuffer); - } - -- public int setBytes(int i, InputStream inputstream, int j) { -+ public int setBytes(int i, InputStream inputstream, int j) throws IOException { // CraftBukkit - throws IOException - return this.a.setBytes(i, inputstream, j); - } - -- public int setBytes(int i, ScatteringByteChannel scatteringbytechannel, int j) { -+ public int setBytes(int i, ScatteringByteChannel scatteringbytechannel, int j) throws IOException { // CraftBukkit - throws IOException - return this.a.setBytes(i, scatteringbytechannel, j); - } - -@@ -580,11 +586,11 @@ - return this.a.readBytes(bytebuffer); - } - -- public ByteBuf readBytes(OutputStream outputstream, int i) { -+ public ByteBuf readBytes(OutputStream outputstream, int i) throws IOException { // CraftBukkit - throws IOException - return this.a.readBytes(outputstream, i); - } - -- public int readBytes(GatheringByteChannel gatheringbytechannel, int i) { -+ public int readBytes(GatheringByteChannel gatheringbytechannel, int i) throws IOException { // CraftBukkit - throws IOException - return this.a.readBytes(gatheringbytechannel, i); - } - -@@ -652,11 +658,11 @@ - return this.a.writeBytes(bytebuffer); - } - -- public int writeBytes(InputStream inputstream, int i) { -+ public int writeBytes(InputStream inputstream, int i) throws IOException { // CraftBukkit - throws IOException - return this.a.writeBytes(inputstream, i); - } - -- public int writeBytes(ScatteringByteChannel scatteringbytechannel, int i) { -+ public int writeBytes(ScatteringByteChannel scatteringbytechannel, int i) throws IOException { // CraftBukkit - throws IOException - return this.a.writeBytes(scatteringbytechannel, i); - } - -@@ -803,16 +809,4 @@ +@@ -803,16 +810,4 @@ public boolean release(int i) { return this.a.release(i); } diff --git a/nms-patches/PacketHandshakingInSetProtocol.patch b/nms-patches/PacketHandshakingInSetProtocol.patch new file mode 100644 index 0000000000..1734c47a27 --- /dev/null +++ b/nms-patches/PacketHandshakingInSetProtocol.patch @@ -0,0 +1,22 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/PacketHandshakingInSetProtocol.java 2015-02-26 22:40:22.903608136 +0000 ++++ src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java 2015-02-26 22:40:22.903608136 +0000 +@@ -5,8 +5,8 @@ + public class PacketHandshakingInSetProtocol implements Packet { + + private int a; +- private String b; +- private int c; ++ public String b; // CraftBukkit - public ++ public int c; // CraftBukkit - public + private EnumProtocol d; + + public PacketHandshakingInSetProtocol() {} +@@ -36,8 +36,4 @@ + public int b() { + return this.a; + } +- +- public void a(PacketListener packetlistener) { +- this.a((PacketHandshakingInListener) packetlistener); +- } + } diff --git a/nms-patches/PacketPlayInBlockPlace.patch b/nms-patches/PacketPlayInBlockPlace.patch index c51173a150..b125d99eb7 100644 --- a/nms-patches/PacketPlayInBlockPlace.patch +++ b/nms-patches/PacketPlayInBlockPlace.patch @@ -1,32 +1,28 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PacketPlayInBlockPlace.java 2014-11-28 17:43:43.273707431 +0000 -+++ src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java 2014-11-28 17:38:21.000000000 +0000 -@@ -9,6 +9,8 @@ - private float e; +--- /home/matt/mc-dev-private//net/minecraft/server/PacketPlayInBlockPlace.java 2015-02-26 22:40:22.907608136 +0000 ++++ src/main/java/net/minecraft/server/PacketPlayInBlockPlace.java 2015-02-26 22:40:22.907608136 +0000 +@@ -12,6 +12,8 @@ private float f; private float g; -+ -+ public long timestamp; // CraftBukkit ++ public long timestamp; // CraftBukkit ++ public PacketPlayInBlockPlace() {} -@@ -26,6 +28,7 @@ + public PacketPlayInBlockPlace(ItemStack itemstack) { +@@ -28,6 +30,7 @@ } - public void a(PacketDataSerializer packetdataserializer) { + public void a(PacketDataSerializer packetdataserializer) throws IOException { + timestamp = System.currentTimeMillis(); // CraftBukkit this.b = packetdataserializer.c(); this.c = packetdataserializer.readUnsignedByte(); this.d = packetdataserializer.i(); -@@ -71,7 +74,10 @@ +@@ -72,8 +75,4 @@ + public float f() { return this.g; } - +- - public void a(PacketListener packetlistener) { - this.a((PacketListenerPlayIn) packetlistener); -+ // CraftBukkit start - fix decompile error -+ @Override -+ public void a(PacketListener pl) { -+ a((PacketListenerPlayIn)pl); - } -+ // CraftBukkit end +- } } diff --git a/nms-patches/PacketPlayInCloseWindow.patch b/nms-patches/PacketPlayInCloseWindow.patch index 6ffe327268..ed7f29ea2a 100644 --- a/nms-patches/PacketPlayInCloseWindow.patch +++ b/nms-patches/PacketPlayInCloseWindow.patch @@ -1,15 +1,10 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PacketPlayInCloseWindow.java 2014-11-28 17:43:43.273707431 +0000 -+++ src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java 2014-11-28 17:38:22.000000000 +0000 -@@ -6,6 +6,17 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/PacketPlayInCloseWindow.java 2015-02-26 22:40:22.911608136 +0000 ++++ src/main/java/net/minecraft/server/PacketPlayInCloseWindow.java 2015-02-26 22:40:22.911608136 +0000 +@@ -8,6 +8,12 @@ public PacketPlayInCloseWindow() {} + // CraftBukkit start -+ @Override -+ public void a(PacketListener pl) { -+ a((PacketListenerPlayIn) pl); -+ } -+ + public PacketPlayInCloseWindow(int id) { + this.id = id; + } @@ -18,8 +13,8 @@ public void a(PacketListenerPlayIn packetlistenerplayin) { packetlistenerplayin.a(this); } -@@ -17,8 +28,4 @@ - public void b(PacketDataSerializer packetdataserializer) { +@@ -19,8 +25,4 @@ + public void b(PacketDataSerializer packetdataserializer) throws IOException { packetdataserializer.writeByte(this.id); } - diff --git a/nms-patches/PacketPlayOutBlockChange.patch b/nms-patches/PacketPlayOutBlockChange.patch new file mode 100644 index 0000000000..4f3361ab4a --- /dev/null +++ b/nms-patches/PacketPlayOutBlockChange.patch @@ -0,0 +1,20 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/PacketPlayOutBlockChange.java 2015-02-26 22:40:22.915608136 +0000 ++++ src/main/java/net/minecraft/server/PacketPlayOutBlockChange.java 2015-02-26 22:40:22.915608136 +0000 +@@ -5,7 +5,7 @@ + public class PacketPlayOutBlockChange implements Packet { + + private BlockPosition a; +- private IBlockData block; ++ public IBlockData block; // CraftBukkit - public + + public PacketPlayOutBlockChange() {} + +@@ -27,8 +27,4 @@ + public void a(PacketListenerPlayOut packetlistenerplayout) { + packetlistenerplayout.a(this); + } +- +- public void a(PacketListener packetlistener) { +- this.a((PacketListenerPlayOut) packetlistener); +- } + } diff --git a/nms-patches/PacketPlayOutSpawnPosition.patch b/nms-patches/PacketPlayOutSpawnPosition.patch new file mode 100644 index 0000000000..b23003b186 --- /dev/null +++ b/nms-patches/PacketPlayOutSpawnPosition.patch @@ -0,0 +1,20 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/PacketPlayOutSpawnPosition.java 2015-02-26 22:40:22.919608136 +0000 ++++ src/main/java/net/minecraft/server/PacketPlayOutSpawnPosition.java 2015-02-26 22:40:22.919608136 +0000 +@@ -4,7 +4,7 @@ + + public class PacketPlayOutSpawnPosition implements Packet { + +- private BlockPosition position; ++ public BlockPosition position; // CraftBukkit - public + + public PacketPlayOutSpawnPosition() {} + +@@ -23,8 +23,4 @@ + public void a(PacketListenerPlayOut packetlistenerplayout) { + packetlistenerplayout.a(this); + } +- +- public void a(PacketListener packetlistener) { +- this.a((PacketListenerPlayOut) packetlistener); +- } + } diff --git a/nms-patches/PacketStatusListener.patch b/nms-patches/PacketStatusListener.patch index 9de1eba108..ef19ea4fc5 100644 --- a/nms-patches/PacketStatusListener.patch +++ b/nms-patches/PacketStatusListener.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PacketStatusListener.java 2015-02-05 19:03:06.828858157 +0000 -+++ src/main/java/net/minecraft/server/PacketStatusListener.java 2015-02-05 19:03:06.828858157 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/PacketStatusListener.java 2015-02-26 22:40:22.927608136 +0000 ++++ src/main/java/net/minecraft/server/PacketStatusListener.java 2015-02-26 22:40:22.927608136 +0000 @@ -1,5 +1,16 @@ package net.minecraft.server; @@ -29,8 +29,8 @@ + // CraftBukkit end + public void a(PacketStatusInStart packetstatusinstart) { -- this.networkManager.handle(new PacketStatusOutServerInfo(this.minecraftServer.aE())); -+ // this.networkManager.handle(new PacketStatusOutServerInfo(this.minecraftServer.aE())); +- this.networkManager.handle(new PacketStatusOutServerInfo(this.minecraftServer.aF())); ++ // this.networkManager.handle(new PacketStatusOutServerInfo(this.minecraftServer.aF())); + // CraftBukkit start - fire ping event + if (state != WAITING) { + networkManager.close(null); @@ -111,14 +111,14 @@ + } + } + -+ ServerPingPlayerSample playerSample = new ServerPingPlayerSample(event.getMaxPlayers(), profiles.size()); ++ ServerPing.ServerPingPlayerSample playerSample = new ServerPing.ServerPingPlayerSample(event.getMaxPlayers(), profiles.size()); + playerSample.a(profiles.toArray(new GameProfile[profiles.size()])); + + ServerPing ping = new ServerPing(); + ping.setFavicon(event.icon.value); + ping.setMOTD(new ChatComponentText(event.getMotd())); + ping.setPlayerSample(playerSample); -+ ping.setServerInfo(new ServerPingServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), 47)); // TODO: Update when protocol changes ++ ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), 47)); // TODO: Update when protocol changes + + this.networkManager.handle(new PacketStatusOutServerInfo(ping)); + // CraftBukkit end diff --git a/nms-patches/Path.patch b/nms-patches/Path.patch index 818bb80251..d26a8cc3b3 100644 --- a/nms-patches/Path.patch +++ b/nms-patches/Path.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/Path.java 2014-11-28 17:43:43.317707430 +0000 -+++ src/main/java/net/minecraft/server/Path.java 2014-11-28 17:38:20.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/Path.java 2015-02-26 22:40:22.983608135 +0000 ++++ src/main/java/net/minecraft/server/Path.java 2015-02-26 22:40:22.983608135 +0000 @@ -2,7 +2,7 @@ public class Path { diff --git a/nms-patches/PathfinderGoalBreakDoor.patch b/nms-patches/PathfinderGoalBreakDoor.patch index 2aa9fb0121..c3299ed5f0 100644 --- a/nms-patches/PathfinderGoalBreakDoor.patch +++ b/nms-patches/PathfinderGoalBreakDoor.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalBreakDoor.java 2014-11-28 17:43:43.277707431 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/PathfinderGoalBreakDoor.java 2015-02-26 22:40:22.931608136 +0000 ++++ src/main/java/net/minecraft/server/PathfinderGoalBreakDoor.java 2015-02-26 22:40:22.931608136 +0000 @@ -63,6 +63,12 @@ } diff --git a/nms-patches/PathfinderGoalBreed.patch b/nms-patches/PathfinderGoalBreed.patch index 6d6c93ea61..955c41de28 100644 --- a/nms-patches/PathfinderGoalBreed.patch +++ b/nms-patches/PathfinderGoalBreed.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalBreed.java 2014-11-28 17:43:43.281707431 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalBreed.java 2014-11-28 17:38:19.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/PathfinderGoalBreed.java 2015-02-26 22:40:22.935608136 +0000 ++++ src/main/java/net/minecraft/server/PathfinderGoalBreed.java 2015-02-26 22:40:22.935608136 +0000 @@ -70,6 +70,11 @@ EntityAgeable entityageable = this.d.createChild(this.e); @@ -9,15 +9,15 @@ + entityageable.persistent = true; + } + // CraftBukkit end - EntityHuman entityhuman = this.d.co(); + EntityHuman entityhuman = this.d.cq(); - if (entityhuman == null && this.e.co() != null) { + if (entityhuman == null && this.e.cq() != null) { @@ -89,7 +94,7 @@ - this.e.cq(); + this.e.cs(); entityageable.setAgeRaw(-24000); entityageable.setPositionRotation(this.d.locX, this.d.locY, this.d.locZ, 0.0F, 0.0F); - this.a.addEntity(entityageable); + this.a.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason - Random random = this.d.bb(); + Random random = this.d.bc(); for (int i = 0; i < 7; ++i) { diff --git a/nms-patches/PathfinderGoalDefendVillage.patch b/nms-patches/PathfinderGoalDefendVillage.patch index 22db13a714..2b4fe8b710 100644 --- a/nms-patches/PathfinderGoalDefendVillage.patch +++ b/nms-patches/PathfinderGoalDefendVillage.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalDefendVillage.java 2014-11-28 17:43:43.281707431 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalDefendVillage.java 2014-11-28 17:38:19.000000000 +0000 -@@ -32,7 +32,7 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/PathfinderGoalDefendVillage.java 2015-02-26 22:40:22.939608136 +0000 ++++ src/main/java/net/minecraft/server/PathfinderGoalDefendVillage.java 2015-02-26 22:40:22.939608136 +0000 +@@ -34,7 +34,7 @@ } public void c() { diff --git a/nms-patches/PathfinderGoalEatTile.patch b/nms-patches/PathfinderGoalEatTile.patch index 7aa2a3b758..525d282b6f 100644 --- a/nms-patches/PathfinderGoalEatTile.patch +++ b/nms-patches/PathfinderGoalEatTile.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalEatTile.java 2014-11-28 17:43:43.285707431 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalEatTile.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/PathfinderGoalEatTile.java 2015-02-26 22:40:22.943608136 +0000 ++++ src/main/java/net/minecraft/server/PathfinderGoalEatTile.java 2015-02-26 22:40:22.943608136 +0000 @@ -3,6 +3,11 @@ import com.google.common.base.Predicate; import com.google.common.base.Predicates; @@ -11,7 +11,7 @@ + public class PathfinderGoalEatTile extends PathfinderGoal { - private static final Predicate b = BlockStatePredicate.a((Block) Blocks.TALLGRASS).a(BlockLongGrass.TYPE, Predicates.equalTo(EnumTallGrassType.GRASS)); + private static final Predicate b = BlockStatePredicate.a((Block) Blocks.TALLGRASS).a(BlockLongGrass.TYPE, Predicates.equalTo(BlockLongGrass.EnumTallGrassType.GRASS)); @@ -50,7 +55,8 @@ BlockPosition blockposition = new BlockPosition(this.c.locX, this.c.locY, this.c.locZ); @@ -28,7 +28,7 @@ if (this.d.getType(blockposition1).getBlock() == Blocks.GRASS) { - if (this.d.getGameRules().getBoolean("mobGriefing")) { + // CraftBukkit -+ if (!CraftEventFactory.callEntityChangeBlockEvent(this.c, this.c.world.getWorld().getBlockAt(blockposition1.getX(), blockposition1.getY(), blockposition1.getZ()), Material.DIRT, !this.d.getGameRules().getBoolean("mobGriefing")).isCancelled()) { ++ if (!CraftEventFactory.callEntityChangeBlockEvent(this.c, this.c.world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), Material.AIR, !this.d.getGameRules().getBoolean("mobGriefing")).isCancelled()) { this.d.triggerEffect(2001, blockposition1, Block.getId(Blocks.GRASS)); this.d.setTypeAndData(blockposition1, Blocks.DIRT.getBlockData(), 2); } diff --git a/nms-patches/PathfinderGoalEndermanPickupBlock.patch b/nms-patches/PathfinderGoalEndermanPickupBlock.patch deleted file mode 100644 index 57133e4273..0000000000 --- a/nms-patches/PathfinderGoalEndermanPickupBlock.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalEndermanPickupBlock.java 2014-11-28 17:43:43.285707431 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalEndermanPickupBlock.java 2014-11-28 17:38:23.000000000 +0000 -@@ -25,8 +25,12 @@ - Block block = iblockdata.getBlock(); - - if (EntityEnderman.co().contains(block)) { -- this.enderman.setCarried(iblockdata); -- world.setTypeUpdate(blockposition, Blocks.AIR.getBlockData()); -+ // CraftBukkit start - Pickup event -+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.enderman, this.enderman.world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), org.bukkit.Material.AIR).isCancelled()) { -+ this.enderman.setCarried(iblockdata); -+ world.setTypeUpdate(blockposition, Blocks.AIR.getBlockData()); -+ } -+ // CraftBukkit end - } - - } diff --git a/nms-patches/PathfinderGoalEndermanPlaceBlock.patch b/nms-patches/PathfinderGoalEndermanPlaceBlock.patch deleted file mode 100644 index a0459ce546..0000000000 --- a/nms-patches/PathfinderGoalEndermanPlaceBlock.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalEndermanPlaceBlock.java 2014-11-28 17:43:43.289707431 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalEndermanPlaceBlock.java 2014-11-28 17:38:24.000000000 +0000 -@@ -25,8 +25,12 @@ - Block block1 = world.getType(blockposition.down()).getBlock(); - - if (this.a(world, blockposition, this.a.getCarried().getBlock(), block, block1)) { -+ // CraftBukkit start - Place event -+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.a, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.a.getCarried().getBlock(), this.a.getCarried().getBlock().toLegacyData(this.a.getCarried())).isCancelled()) { - world.setTypeAndData(blockposition, this.a.getCarried(), 3); - this.a.setCarried(Blocks.AIR.getBlockData()); -+ } -+ // CraftBukkit end - } - - } diff --git a/nms-patches/PathfinderGoalGhastAttackTarget.patch b/nms-patches/PathfinderGoalGhastAttackTarget.patch deleted file mode 100644 index b7c251a851..0000000000 --- a/nms-patches/PathfinderGoalGhastAttackTarget.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalGhastAttackTarget.java 2014-11-28 17:43:43.289707431 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalGhastAttackTarget.java 2014-11-28 17:38:22.000000000 +0000 -@@ -43,7 +43,8 @@ - world.a((EntityHuman) null, 1008, new BlockPosition(this.b), 0); - EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.b, d2, d3, d4); - -- entitylargefireball.yield = this.b.cd(); -+ // CraftBukkit - set bukkitYield when setting explosionpower -+ entitylargefireball.bukkitYield = entitylargefireball.yield = this.b.cd(); - entitylargefireball.locX = this.b.locX + vec3d.a * d1; - entitylargefireball.locY = this.b.locY + (double) (this.b.length / 2.0F) + 0.5D; - entitylargefireball.locZ = this.b.locZ + vec3d.c * d1; diff --git a/nms-patches/PathfinderGoalHurtByTarget.patch b/nms-patches/PathfinderGoalHurtByTarget.patch index 83ef0653b9..23346dc438 100644 --- a/nms-patches/PathfinderGoalHurtByTarget.patch +++ b/nms-patches/PathfinderGoalHurtByTarget.patch @@ -1,12 +1,12 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalHurtByTarget.java 2015-02-12 14:16:35.901294972 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java 2015-02-12 14:16:35.901294972 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/PathfinderGoalHurtByTarget.java 2015-02-26 22:40:22.947608135 +0000 ++++ src/main/java/net/minecraft/server/PathfinderGoalHurtByTarget.java 2015-02-26 22:40:22.947608135 +0000 @@ -23,7 +23,7 @@ } public void c() { - this.e.setGoalTarget(this.e.getLastDamager()); + this.e.setGoalTarget(this.e.getLastDamager(), org.bukkit.event.entity.EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit - reason - this.b = this.e.bd(); + this.b = this.e.be(); if (this.a) { double d0 = this.f(); @@ -58,6 +58,6 @@ diff --git a/nms-patches/PathfinderGoalMakeLove.patch b/nms-patches/PathfinderGoalMakeLove.patch index ad9601167a..b45c07aba8 100644 --- a/nms-patches/PathfinderGoalMakeLove.patch +++ b/nms-patches/PathfinderGoalMakeLove.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalMakeLove.java 2014-11-28 17:43:43.293707431 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalMakeLove.java 2014-11-28 17:38:22.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/PathfinderGoalMakeLove.java 2015-02-26 22:40:22.951608135 +0000 ++++ src/main/java/net/minecraft/server/PathfinderGoalMakeLove.java 2015-02-26 22:40:22.951608135 +0000 @@ -87,7 +87,7 @@ this.b.o(false); entityvillager.setAgeRaw(-24000); diff --git a/nms-patches/PathfinderGoalNearestAttackableTarget.patch b/nms-patches/PathfinderGoalNearestAttackableTarget.patch index a1f6896b4b..5021dacefe 100644 --- a/nms-patches/PathfinderGoalNearestAttackableTarget.patch +++ b/nms-patches/PathfinderGoalNearestAttackableTarget.patch @@ -1,6 +1,15 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalNearestAttackableTarget.java 2014-12-27 12:18:17.361358975 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java 2014-12-27 12:18:17.369358975 +0000 -@@ -48,7 +48,7 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/PathfinderGoalNearestAttackableTarget.java 2015-02-26 22:40:22.955608135 +0000 ++++ src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java 2015-02-26 22:40:22.955608135 +0000 +@@ -60,7 +60,7 @@ + } + + public boolean apply(Object object) { +- return this.a((EntityLiving) object); ++ return this.a((T) object); // CraftBukkit - fix decompile error + } + }; + } +@@ -83,7 +83,7 @@ } public void c() { @@ -8,4 +17,13 @@ + this.e.setGoalTarget(this.d, d instanceof EntityPlayer ? org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER : org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_ENTITY, true); // Craftbukkit - reason super.c(); } - } + +@@ -102,7 +102,7 @@ + return d0 < d1 ? -1 : (d0 > d1 ? 1 : 0); + } + +- public int compare(Object object, Object object1) { ++ public int compare(Entity object, Entity object1) { // CraftBukkit - fix decompile error + return this.a((Entity) object, (Entity) object1); + } + } diff --git a/nms-patches/PathfinderGoalNearestAttackableTargetInsentient.patch b/nms-patches/PathfinderGoalNearestAttackableTargetInsentient.patch index d6b3eadbe0..c83954d3a4 100644 --- a/nms-patches/PathfinderGoalNearestAttackableTargetInsentient.patch +++ b/nms-patches/PathfinderGoalNearestAttackableTargetInsentient.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalNearestAttackableTargetInsentient.java 2014-11-28 17:43:43.297707431 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTargetInsentient.java 2014-11-28 17:38:19.000000000 +0000 -@@ -54,7 +54,7 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/PathfinderGoalNearestAttackableTargetInsentient.java 2015-02-26 22:40:22.951608135 +0000 ++++ src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTargetInsentient.java 2015-02-26 22:40:22.955608135 +0000 +@@ -68,7 +68,7 @@ } public void c() { diff --git a/nms-patches/PathfinderGoalOwnerHurtByTarget.patch b/nms-patches/PathfinderGoalOwnerHurtByTarget.patch index dec0fcf7b8..9e0ff9d0fd 100644 --- a/nms-patches/PathfinderGoalOwnerHurtByTarget.patch +++ b/nms-patches/PathfinderGoalOwnerHurtByTarget.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalOwnerHurtByTarget.java 2014-11-28 17:43:43.301707430 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalOwnerHurtByTarget.java 2014-11-28 17:38:22.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/PathfinderGoalOwnerHurtByTarget.java 2015-02-26 22:40:22.959608135 +0000 ++++ src/main/java/net/minecraft/server/PathfinderGoalOwnerHurtByTarget.java 2015-02-26 22:40:22.959608135 +0000 @@ -30,7 +30,7 @@ } diff --git a/nms-patches/PathfinderGoalOwnerHurtTarget.patch b/nms-patches/PathfinderGoalOwnerHurtTarget.patch index e1b1c9d861..831231deab 100644 --- a/nms-patches/PathfinderGoalOwnerHurtTarget.patch +++ b/nms-patches/PathfinderGoalOwnerHurtTarget.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalOwnerHurtTarget.java 2014-11-28 17:43:43.301707430 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalOwnerHurtTarget.java 2014-11-28 17:38:19.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/PathfinderGoalOwnerHurtTarget.java 2015-02-26 22:40:22.963608135 +0000 ++++ src/main/java/net/minecraft/server/PathfinderGoalOwnerHurtTarget.java 2015-02-26 22:40:22.963608135 +0000 @@ -30,7 +30,7 @@ } diff --git a/nms-patches/PathfinderGoalPanic.patch b/nms-patches/PathfinderGoalPanic.patch index 4b673e41ee..c22bac445d 100644 --- a/nms-patches/PathfinderGoalPanic.patch +++ b/nms-patches/PathfinderGoalPanic.patch @@ -1,11 +1,11 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalPanic.java 2014-11-28 17:43:43.305707430 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalPanic.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/PathfinderGoalPanic.java 2015-02-26 22:40:22.963608135 +0000 ++++ src/main/java/net/minecraft/server/PathfinderGoalPanic.java 2015-02-26 22:40:22.967608135 +0000 @@ -36,6 +36,12 @@ } public boolean b() { + // CraftBukkit start - introduce a temporary timeout hack until this is fixed properly -+ if ((this.b.ticksLived - this.b.bd/*getHurtTimestamp*/()) > 100) { ++ if ((this.b.ticksLived - this.b.hurtTimestamp) > 100) { + this.b.b((EntityLiving) null); + return false; + } diff --git a/nms-patches/PathfinderGoalSelector.patch b/nms-patches/PathfinderGoalSelector.patch index c2452a0846..2aee5af40f 100644 --- a/nms-patches/PathfinderGoalSelector.patch +++ b/nms-patches/PathfinderGoalSelector.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalSelector.java 2014-11-28 17:43:43.305707430 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalSelector.java 2014-11-28 17:38:21.000000000 +0000 -@@ -6,11 +6,15 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/PathfinderGoalSelector.java 2015-02-26 22:40:22.967608135 +0000 ++++ src/main/java/net/minecraft/server/PathfinderGoalSelector.java 2015-02-26 22:40:22.971608135 +0000 +@@ -6,11 +6,13 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,23 +9,21 @@ public class PathfinderGoalSelector { private static final Logger a = LogManager.getLogger(); -- private List b = Lists.newArrayList(); -- private List c = Lists.newArrayList(); -+ // CraftBukkit start - ArrayList -> UnsafeList -+ private List b = new UnsafeList(); -+ private List c = new UnsafeList(); -+ // CraftBukkit end +- private List b = Lists.newArrayList(); +- private List c = Lists.newArrayList(); ++ private List b = new UnsafeList(); ++ private List c = new UnsafeList(); private final MethodProfiler d; private int e; private int f = 3; -@@ -107,9 +111,11 @@ - if (pathfindergoalselectoritem1 != pathfindergoalselectoritem) { - if (pathfindergoalselectoritem.b >= pathfindergoalselectoritem1.b) { - if (!this.a(pathfindergoalselectoritem, pathfindergoalselectoritem1) && this.c.contains(pathfindergoalselectoritem1)) { +@@ -107,9 +109,11 @@ + if (pathfindergoalselector_pathfindergoalselectoritem1 != pathfindergoalselector_pathfindergoalselectoritem) { + if (pathfindergoalselector_pathfindergoalselectoritem.b >= pathfindergoalselector_pathfindergoalselectoritem1.b) { + if (!this.a(pathfindergoalselector_pathfindergoalselectoritem, pathfindergoalselector_pathfindergoalselectoritem1) && this.c.contains(pathfindergoalselector_pathfindergoalselectoritem1)) { + ((UnsafeList.Itr) iterator).valid = false; // CraftBukkit - mark iterator for reuse return false; } - } else if (!pathfindergoalselectoritem1.a.i() && this.c.contains(pathfindergoalselectoritem1)) { + } else if (!pathfindergoalselector_pathfindergoalselectoritem1.a.i() && this.c.contains(pathfindergoalselector_pathfindergoalselectoritem1)) { + ((UnsafeList.Itr) iterator).valid = false; // CraftBukkit - mark iterator for reuse return false; } diff --git a/nms-patches/PathfinderGoalSilverfishHideInBlock.patch b/nms-patches/PathfinderGoalSilverfishHideInBlock.patch deleted file mode 100644 index 145491d4f0..0000000000 --- a/nms-patches/PathfinderGoalSilverfishHideInBlock.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalSilverfishHideInBlock.java 2014-11-28 17:43:43.309707430 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalSilverfishHideInBlock.java 2014-11-28 17:38:23.000000000 +0000 -@@ -51,6 +51,11 @@ - IBlockData iblockdata = world.getType(blockposition); - - if (BlockMonsterEggs.d(iblockdata)) { -+ // CraftBukkit start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.MONSTER_EGG, Block.getId(BlockMonsterEggs.getById(iblockdata.getBlock().toLegacyData(iblockdata)))).isCancelled()) { -+ return; -+ } -+ // CraftBukkit end - world.setTypeAndData(blockposition, Blocks.MONSTER_EGG.getBlockData().set(BlockMonsterEggs.VARIANT, EnumMonsterEggVarient.a(iblockdata)), 3); - this.silverfish.y(); - this.silverfish.die(); diff --git a/nms-patches/PathfinderGoalSilverfishWakeOthers.patch b/nms-patches/PathfinderGoalSilverfishWakeOthers.patch deleted file mode 100644 index 2c9b3c7f26..0000000000 --- a/nms-patches/PathfinderGoalSilverfishWakeOthers.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalSilverfishWakeOthers.java 2014-11-28 17:43:43.309707430 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalSilverfishWakeOthers.java 2014-11-28 17:38:22.000000000 +0000 -@@ -36,6 +36,11 @@ - IBlockData iblockdata = world.getType(blockposition1); - - if (iblockdata.getBlock() == Blocks.MONSTER_EGG) { -+ // CraftBukkit start -+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.silverfish, blockposition1.getX(), blockposition1.getY(), blockposition1.getZ(), Blocks.AIR, 0).isCancelled()) { -+ continue; -+ } -+ // CraftBukkit end - if (world.getGameRules().getBoolean("mobGriefing")) { - world.setAir(blockposition1, true); - } else { diff --git a/nms-patches/PathfinderGoalSit.patch b/nms-patches/PathfinderGoalSit.patch index 0818ceb3f9..850580e71b 100644 --- a/nms-patches/PathfinderGoalSit.patch +++ b/nms-patches/PathfinderGoalSit.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalSit.java 2014-11-28 17:43:43.313707430 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalSit.java 2014-11-28 17:38:19.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/PathfinderGoalSit.java 2015-02-26 22:40:22.971608135 +0000 ++++ src/main/java/net/minecraft/server/PathfinderGoalSit.java 2015-02-26 22:40:22.971608135 +0000 @@ -12,7 +12,7 @@ public boolean a() { diff --git a/nms-patches/PathfinderGoalTame.patch b/nms-patches/PathfinderGoalTame.patch index 26cc5c14c6..54fc0b568e 100644 --- a/nms-patches/PathfinderGoalTame.patch +++ b/nms-patches/PathfinderGoalTame.patch @@ -1,12 +1,12 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalTame.java 2014-11-28 17:43:43.313707430 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalTame.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/PathfinderGoalTame.java 2015-02-26 22:40:22.975608135 +0000 ++++ src/main/java/net/minecraft/server/PathfinderGoalTame.java 2015-02-26 22:40:22.975608135 +0000 @@ -45,7 +45,8 @@ int i = this.entity.getTemper(); int j = this.entity.getMaxDomestication(); -- if (j > 0 && this.entity.bb().nextInt(j) < i) { +- if (j > 0 && this.entity.bc().nextInt(j) < i) { + // CraftBukkit - fire EntityTameEvent -+ if (j > 0 && this.entity.bb().nextInt(j) < i && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.entity, (EntityHuman) this.entity.passenger).isCancelled() && this.entity.passenger instanceof EntityHuman) { ++ if (j > 0 && this.entity.bc().nextInt(j) < i && !org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTameEvent(this.entity, (EntityHuman) this.entity.passenger).isCancelled() && this.entity.passenger instanceof EntityHuman) { this.entity.h((EntityHuman) this.entity.passenger); this.entity.world.broadcastEntityEffect(this.entity, (byte) 7); return; @@ -26,6 +26,6 @@ + } + // this.entity.passenger = null; + // CraftBukkit end - this.entity.cU(); + this.entity.cW(); this.entity.world.broadcastEntityEffect(this.entity, (byte) 6); } diff --git a/nms-patches/PathfinderGoalTargetNearestPlayer.patch b/nms-patches/PathfinderGoalTargetNearestPlayer.patch index 60dab633f7..12ed545bcb 100644 --- a/nms-patches/PathfinderGoalTargetNearestPlayer.patch +++ b/nms-patches/PathfinderGoalTargetNearestPlayer.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PathfinderGoalTargetNearestPlayer.java 2014-11-28 17:43:43.317707430 +0000 -+++ src/main/java/net/minecraft/server/PathfinderGoalTargetNearestPlayer.java 2014-11-28 17:38:17.000000000 +0000 -@@ -59,7 +59,7 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/PathfinderGoalTargetNearestPlayer.java 2015-02-26 22:40:22.979608135 +0000 ++++ src/main/java/net/minecraft/server/PathfinderGoalTargetNearestPlayer.java 2015-02-26 22:40:22.979608135 +0000 +@@ -91,7 +91,7 @@ } public void c() { diff --git a/nms-patches/PlayerAbilities.patch b/nms-patches/PlayerAbilities.patch new file mode 100644 index 0000000000..ba518d1ee7 --- /dev/null +++ b/nms-patches/PlayerAbilities.patch @@ -0,0 +1,13 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/PlayerAbilities.java 2015-02-26 22:40:22.987608135 +0000 ++++ src/main/java/net/minecraft/server/PlayerAbilities.java 2015-02-26 22:40:22.987608135 +0000 +@@ -7,8 +7,8 @@ + public boolean canFly; + public boolean canInstantlyBuild; + public boolean mayBuild = true; +- private float flySpeed = 0.05F; +- private float walkSpeed = 0.1F; ++ public float flySpeed = 0.05F; // CraftBukkit - public ++ public float walkSpeed = 0.1F; // CraftBukkit - public + + public PlayerAbilities() {} + diff --git a/nms-patches/PlayerChunk.patch b/nms-patches/PlayerChunk.patch deleted file mode 100644 index a9e2154b94..0000000000 --- a/nms-patches/PlayerChunk.patch +++ /dev/null @@ -1,95 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PlayerChunk.java 2015-01-30 23:33:46.784237383 +0000 -+++ src/main/java/net/minecraft/server/PlayerChunk.java 2015-01-30 23:33:46.784237383 +0000 -@@ -3,6 +3,11 @@ - import com.google.common.collect.Lists; - import java.util.List; - -+// CraftBukkit start -+import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor; -+import java.util.HashMap; -+// CraftBukkit end -+ - class PlayerChunk { - - private final List b; -@@ -12,16 +17,26 @@ - private int f; - private long g; - final PlayerChunkMap playerChunkMap; -+ -+ // CraftBukkit start - add fields -+ private final HashMap players = new HashMap(); -+ private boolean loaded = false; -+ private Runnable loadedRunnable = new Runnable() { -+ public void run() { -+ PlayerChunk.this.loaded = true; -+ } -+ }; -+ // CraftBukkit end - - public PlayerChunk(PlayerChunkMap playerchunkmap, int i, int j) { - this.playerChunkMap = playerchunkmap; - this.b = Lists.newArrayList(); - this.dirtyBlocks = new short[64]; - this.location = new ChunkCoordIntPair(i, j); -- playerchunkmap.a().chunkProviderServer.getChunkAt(i, j); -+ playerchunkmap.a().chunkProviderServer.getChunkAt(i, j, loadedRunnable); // CraftBukkit - } - -- public void a(EntityPlayer entityplayer) { -+ public void a(final EntityPlayer entityplayer) { // CraftBukkit - added final to argument - if (this.b.contains(entityplayer)) { - PlayerChunkMap.c().debug("Failed to add player. {} already is in chunk {}, {}", new Object[] { entityplayer, Integer.valueOf(this.location.x), Integer.valueOf(this.location.z)}); - } else { -@@ -30,18 +45,50 @@ - } - - this.b.add(entityplayer); -- entityplayer.chunkCoordIntPairQueue.add(this.location); -+ // CraftBukkit start - use async chunk io -+ Runnable playerRunnable; -+ if (this.loaded) { -+ playerRunnable = null; -+ entityplayer.chunkCoordIntPairQueue.add(this.location); -+ } else { -+ playerRunnable = new Runnable() { -+ public void run() { -+ entityplayer.chunkCoordIntPairQueue.add(PlayerChunk.this.location); -+ } -+ }; -+ this.playerChunkMap.a().chunkProviderServer.getChunkAt(this.location.x, this.location.z, playerRunnable); -+ } -+ -+ this.players.put(entityplayer, playerRunnable); -+ // CraftBukkit end - } - } - - public void b(EntityPlayer entityplayer) { - if (this.b.contains(entityplayer)) { -+ // CraftBukkit start - If we haven't loaded yet don't load the chunk just so we can clean it up -+ if (!this.loaded) { -+ ChunkIOExecutor.dropQueuedChunkLoad(this.playerChunkMap.a(), this.location.x, this.location.z, this.players.get(entityplayer)); -+ this.b.remove(entityplayer); -+ this.players.remove(entityplayer); -+ -+ if (this.b.isEmpty()) { -+ ChunkIOExecutor.dropQueuedChunkLoad(this.playerChunkMap.a(), this.location.x, this.location.z, this.loadedRunnable); -+ long i = (long) this.location.x + 2147483647L | (long) this.location.z + 2147483647L << 32; -+ PlayerChunkMap.b(this.playerChunkMap).remove(i); -+ PlayerChunkMap.c(this.playerChunkMap).remove(this); -+ } -+ -+ return; -+ } -+ // CraftBukkit end - Chunk chunk = PlayerChunkMap.a(this.playerChunkMap).getChunkAt(this.location.x, this.location.z); - - if (chunk.isReady()) { - entityplayer.playerConnection.sendPacket(new PacketPlayOutMapChunk(chunk, true, 0)); - } - -+ this.players.remove(entityplayer); // CraftBukkit - this.b.remove(entityplayer); - entityplayer.chunkCoordIntPairQueue.remove(this.location); - if (this.b.isEmpty()) { diff --git a/nms-patches/PlayerChunkMap.patch b/nms-patches/PlayerChunkMap.patch index 70c02c14e1..d7899e7d74 100644 --- a/nms-patches/PlayerChunkMap.patch +++ b/nms-patches/PlayerChunkMap.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PlayerChunkMap.java 2014-11-28 17:43:43.321707430 +0000 -+++ src/main/java/net/minecraft/server/PlayerChunkMap.java 2014-11-28 17:38:19.000000000 +0000 -@@ -7,17 +7,24 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/PlayerChunkMap.java 2015-02-26 22:40:22.991608135 +0000 ++++ src/main/java/net/minecraft/server/PlayerChunkMap.java 2015-02-26 22:40:22.991608135 +0000 +@@ -7,17 +7,26 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -8,18 +8,20 @@ +import java.util.Collections; +import java.util.Queue; +import java.util.LinkedList; ++import org.bukkit.craftbukkit.chunkio.ChunkIOExecutor; ++import java.util.HashMap; +// CraftBukkit end + public class PlayerChunkMap { private static final Logger a = LogManager.getLogger(); private final WorldServer world; - private final List managedPlayers = Lists.newArrayList(); - private final LongHashMap d = new LongHashMap(); -- private final List e = Lists.newArrayList(); -- private final List f = Lists.newArrayList(); -+ private final Queue e = new java.util.concurrent.ConcurrentLinkedQueue(); // CraftBukkit ArrayList -> ConcurrentLinkedQueue -+ private final Queue f = new java.util.concurrent.ConcurrentLinkedQueue(); // CraftBukkit ArrayList -> ConcurrentLinkedQueue + private final List managedPlayers = Lists.newArrayList(); + private final LongHashMap d = new LongHashMap(); +- private final List e = Lists.newArrayList(); +- private final List f = Lists.newArrayList(); ++ private final Queue e = new java.util.concurrent.ConcurrentLinkedQueue(); // CraftBukkit ArrayList -> ConcurrentLinkedQueue ++ private final Queue f = new java.util.concurrent.ConcurrentLinkedQueue(); // CraftBukkit ArrayList -> ConcurrentLinkedQueue private int g; private long h; private final int[][] i = new int[][] { { 1, 0}, { 0, 1}, { -1, 0}, { 0, -1}}; @@ -27,36 +29,33 @@ public PlayerChunkMap(WorldServer worldserver) { this.world = worldserver; -@@ -35,28 +42,39 @@ - +@@ -36,26 +45,37 @@ if (i - this.h > 8000L) { this.h = i; -- + - for (j = 0; j < this.f.size(); ++j) { -- playerchunk = (PlayerChunk) this.f.get(j); -+ +- playerchunkmap_playerchunk = (PlayerChunkMap.PlayerChunk) this.f.get(j); + // CraftBukkit start - Use iterator + java.util.Iterator iterator = this.f.iterator(); + while (iterator.hasNext()) { -+ playerchunk = (PlayerChunk) iterator.next(); - playerchunk.b(); - playerchunk.a(); ++ playerchunkmap_playerchunk = (PlayerChunk) iterator.next(); + playerchunkmap_playerchunk.b(); + playerchunkmap_playerchunk.a(); } } else { - for (j = 0; j < this.e.size(); ++j) { -- playerchunk = (PlayerChunk) this.e.get(j); +- playerchunkmap_playerchunk = (PlayerChunkMap.PlayerChunk) this.e.get(j); + java.util.Iterator iterator = this.e.iterator(); -+ + while (iterator.hasNext()) { -+ playerchunk = (PlayerChunk) iterator.next(); - playerchunk.b(); ++ playerchunkmap_playerchunk = (PlayerChunk) iterator.next(); + playerchunkmap_playerchunk.b(); + iterator.remove(); + // CraftBukkit end } } - this.e.clear(); -+ // this.e.clear(); // CraftBukkit - Removals are already covered ++ // this.e.clear(); //CraftBukkit - Removals are already covered if (this.managedPlayers.isEmpty()) { + if (!wasNotEmpty) return; // CraftBukkit - Only do unload when we go from non-empty to empty WorldProvider worldprovider = this.world.worldProvider; @@ -69,54 +68,50 @@ + } else { + wasNotEmpty = true; } -- + // CraftBukkit end + } - public boolean a(int i, int j) { -@@ -77,6 +95,16 @@ - - return playerchunk; +@@ -78,6 +98,16 @@ + return playerchunkmap_playerchunk; } -+ + + // CraftBukkit start - add method + public final boolean isChunkInUse(int x, int z) { + PlayerChunk pi = a(x, z, false); + if (pi != null) { -+ return (PlayerChunk.b(pi).size() > 0); ++ return (pi.b.size() > 0); + } + return false; + } + // CraftBukkit end - ++ public void flagDirty(BlockPosition blockposition) { int i = blockposition.getX() >> 4; -@@ -95,13 +123,22 @@ - + int j = blockposition.getZ() >> 4; +@@ -96,11 +126,20 @@ entityplayer.d = entityplayer.locX; entityplayer.e = entityplayer.locZ; -+ + + // CraftBukkit start - Load nearby chunks first + List chunkList = new LinkedList(); - ++ for (int k = i - this.g; k <= i + this.g; ++k) { for (int l = j - this.g; l <= j + this.g; ++l) { - this.a(k, l, true).a(entityplayer); + chunkList.add(new ChunkCoordIntPair(k, l)); } } -- + + Collections.sort(chunkList, new ChunkCoordComparator(entityplayer)); -+ for (ChunkCoordIntPair pair : chunkList) { ++ for (ChunkCoordIntPair pair : chunkList) { + this.a(pair.x, pair.z, true).a(entityplayer); + } + // CraftBukkit end -+ + this.managedPlayers.add(entityplayer); this.b(entityplayer); - } -@@ -188,12 +225,13 @@ +@@ -188,12 +227,13 @@ int i1 = this.g; int j1 = i - k; int k1 = j - l; @@ -131,17 +126,17 @@ } if (!this.a(l1 - j1, i2 - k1, i, j, i1)) { -@@ -209,6 +247,17 @@ +@@ -209,6 +249,17 @@ this.b(entityplayer); entityplayer.d = entityplayer.locX; entityplayer.e = entityplayer.locZ; -+ -+ // CraftBukkit start - send nearest chunks first ++ ++ // CraftBukkit start - send nearest chunks first + Collections.sort(chunksToLoad, new ChunkCoordComparator(entityplayer)); -+ for (ChunkCoordIntPair pair : chunksToLoad) { ++ for (ChunkCoordIntPair pair : chunksToLoad) { + this.a(pair.x, pair.z, true).a(entityplayer); + } -+ ++ + if (j1 > 1 || j1 < -1 || k1 > 1 || k1 < -1) { + Collections.sort(entityplayer.chunkCoordIntPairQueue, new ChunkCoordComparator(entityplayer)); + } @@ -149,20 +144,88 @@ } } } -@@ -274,11 +323,54 @@ - return playerchunkmap.d; - } +@@ -271,12 +322,22 @@ + private int f; + private long g; -- static List c(PlayerChunkMap playerchunkmap) { -+ static Queue c(PlayerChunkMap playerchunkmap) { // CraftBukkit List -> Queue - return playerchunkmap.f; - } ++ // CraftBukkit start - add fields ++ private final HashMap players = new HashMap(); ++ private boolean loaded = false; ++ private Runnable loadedRunnable = new Runnable() { ++ public void run() { ++ PlayerChunk.this.loaded = true; ++ } ++ }; ++ // CraftBukkit end ++ + public PlayerChunk(int i, int j) { + this.location = new ChunkCoordIntPair(i, j); +- PlayerChunkMap.this.a().chunkProviderServer.getChunkAt(i, j); ++ PlayerChunkMap.this.a().chunkProviderServer.getChunkAt(i, j, loadedRunnable); // CraftBukkit + } -- static List d(PlayerChunkMap playerchunkmap) { -+ static Queue d(PlayerChunkMap playerchunkmap) { // CraftBukkit List -> Queue - return playerchunkmap.e; +- public void a(EntityPlayer entityplayer) { ++ public void a(final EntityPlayer entityplayer) { // CraftBukkit - added final to argument + if (this.b.contains(entityplayer)) { + PlayerChunkMap.a.debug("Failed to add player. {} already is in chunk {}, {}", new Object[] { entityplayer, Integer.valueOf(this.location.x), Integer.valueOf(this.location.z)}); + } else { +@@ -285,18 +346,50 @@ + } + + this.b.add(entityplayer); +- entityplayer.chunkCoordIntPairQueue.add(this.location); ++ // CraftBukkit start - use async chunk io ++ Runnable playerRunnable; ++ if (this.loaded) { ++ playerRunnable = null; ++ entityplayer.chunkCoordIntPairQueue.add(this.location); ++ } else { ++ playerRunnable = new Runnable() { ++ public void run() { ++ entityplayer.chunkCoordIntPairQueue.add(PlayerChunk.this.location); ++ } ++ }; ++ PlayerChunkMap.this.a().chunkProviderServer.getChunkAt(this.location.x, this.location.z, playerRunnable); ++ } ++ ++ this.players.put(entityplayer, playerRunnable); ++ // CraftBukkit end + } + } + + public void b(EntityPlayer entityplayer) { + if (this.b.contains(entityplayer)) { ++ // CraftBukkit start - If we haven't loaded yet don't load the chunk just so we can clean it up ++ if (!this.loaded) { ++ ChunkIOExecutor.dropQueuedChunkLoad(PlayerChunkMap.this.a(), this.location.x, this.location.z, this.players.get(entityplayer)); ++ this.b.remove(entityplayer); ++ this.players.remove(entityplayer); ++ ++ if (this.b.isEmpty()) { ++ ChunkIOExecutor.dropQueuedChunkLoad(PlayerChunkMap.this.a(), this.location.x, this.location.z, this.loadedRunnable); ++ long i = (long) this.location.x + 2147483647L | (long) this.location.z + 2147483647L << 32; ++ PlayerChunkMap.this.d.remove(i); ++ PlayerChunkMap.this.f.remove(this); ++ } ++ ++ return; ++ } ++ // CraftBukkit end + Chunk chunk = PlayerChunkMap.this.world.getChunkAt(this.location.x, this.location.z); + + if (chunk.isReady()) { + entityplayer.playerConnection.sendPacket(new PacketPlayOutMapChunk(chunk, true, 0)); + } + ++ this.players.remove(entityplayer); // CraftBukkit + this.b.remove(entityplayer); + entityplayer.chunkCoordIntPairQueue.remove(this.location); + if (this.b.isEmpty()) { +@@ -421,4 +514,47 @@ + + } } -+ ++ + // CraftBukkit start - Sorter to load nearby chunks first + private static class ChunkCoordComparator implements java.util.Comparator { + private int x; diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index b0ae338044..1ef0885576 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/PlayerConnection.java 2015-02-26 21:28:11.874168704 +1100 -+++ src/main/java/net/minecraft/server/PlayerConnection.java 2015-02-26 21:28:11.878168702 +1100 -@@ -16,6 +16,48 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/PlayerConnection.java 2015-02-27 17:23:53.483145868 +0000 ++++ src/main/java/net/minecraft/server/PlayerConnection.java 2015-02-27 17:23:53.487145868 +0000 +@@ -17,6 +17,48 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -49,7 +49,7 @@ public class PlayerConnection implements PacketListenerPlayIn, IUpdatePlayerListBox { private static final Logger c = LogManager.getLogger(); -@@ -29,13 +71,17 @@ +@@ -30,13 +72,17 @@ private int i; private long j; private long k; @@ -59,16 +59,16 @@ + private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); + // CraftBukkit end private int m; - private IntHashMap n = new IntHashMap(); + private IntHashMap n = new IntHashMap(); private double o; private double p; private double q; - public boolean checkMovement = true; + private boolean checkMovement = true; + private boolean processedDisconnect; // CraftBukkit - added public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { this.minecraftServer = minecraftserver; -@@ -43,8 +89,32 @@ +@@ -44,8 +90,32 @@ networkmanager.a((PacketListener) this); this.player = entityplayer; entityplayer.playerConnection = this; @@ -101,7 +101,7 @@ public void c() { this.h = false; ++this.e; -@@ -57,9 +127,14 @@ +@@ -58,9 +128,14 @@ } this.minecraftServer.methodProfiler.b(); @@ -116,7 +116,7 @@ if (this.m > 0) { --this.m; -@@ -76,11 +151,28 @@ +@@ -77,19 +152,37 @@ } public void disconnect(String s) { @@ -136,17 +136,28 @@ + // Send the possibly modified leave message + s = event.getReason(); + // CraftBukkit end - ChatComponentText chatcomponenttext = new ChatComponentText(s); + final ChatComponentText chatcomponenttext = new ChatComponentText(s); - this.networkManager.a(new PacketPlayOutKickDisconnect(chatcomponenttext), new PlayerConnectionFuture(this, chatcomponenttext), new GenericFutureListener[0]); + this.networkManager.a(new PacketPlayOutKickDisconnect(chatcomponenttext), new GenericFutureListener() { +- public void operationComplete(Future future) throws Exception { ++ public void operationComplete(Future future) throws Exception { // CraftBukkit - fix decompile error + PlayerConnection.this.networkManager.close(chatcomponenttext); + } + }, new GenericFutureListener[0]); + this.a(chatcomponenttext); // CraftBukkit - fire quit instantly this.networkManager.k(); -- Futures.getUnchecked(this.minecraftServer.postToMainThread(new PlayerConnectionDisconnector(this))); -+ this.minecraftServer.postToMainThread(new PlayerConnectionDisconnector(this)); // CraftBukkit - Don't wait +- Futures.getUnchecked(this.minecraftServer.postToMainThread(new Runnable() { ++ // CraftBukkit - Don't wait ++ this.minecraftServer.postToMainThread(new Runnable() { + public void run() { + PlayerConnection.this.networkManager.l(); + } +- })); ++ }); } public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) { -@@ -90,6 +182,13 @@ +@@ -99,6 +192,13 @@ public void a(PacketPlayInFlying packetplayinflying) { PlayerConnectionUtils.ensureMainThread(packetplayinflying, this, this.player.u()); @@ -160,7 +171,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); this.h = true; -@@ -108,8 +207,65 @@ +@@ -117,8 +217,65 @@ this.checkMovement = true; } } @@ -200,7 +211,7 @@ + + // If the event is cancelled we move the player back to their old location. + if (event.isCancelled()) { -+ this.player.playerConnection.sendPacket(new PacketPlayOutPosition(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch(), Collections.emptySet())); ++ this.player.playerConnection.sendPacket(new PacketPlayOutPosition(from.getX(), from.getY(), from.getZ(), from.getYaw(), from.getPitch(), Collections.emptySet())); + return; + } + @@ -211,7 +222,8 @@ + this.player.getBukkitEntity().teleport(event.getTo(), PlayerTeleportEvent.TeleportCause.UNKNOWN); + return; + } -+ + +- if (this.checkMovement) { + /* Check to see if the Players Location has some how changed during the call of the event. + This can happen due to a plugin teleporting the player instead of using .setTo() */ + if (!from.equals(this.getPlayer().getLocation()) && this.justTeleported) { @@ -220,14 +232,13 @@ + } + } + } - -- if (this.checkMovement) { ++ + if (this.checkMovement && !this.player.dead) { + // CraftBukkit end this.f = this.e; double d7; double d8; -@@ -203,12 +359,14 @@ +@@ -212,12 +369,14 @@ double d11 = d7 - this.player.locX; double d12 = d8 - this.player.locY; double d13 = d9 - this.player.locZ; @@ -246,10 +257,15 @@ PlayerConnection.c.warn(this.player.getName() + " moved too quickly! " + d11 + "," + d12 + "," + d13 + " (" + d14 + ", " + d15 + ", " + d16 + ")"); this.a(this.o, this.p, this.q, this.player.yaw, this.player.pitch); return; -@@ -281,6 +439,49 @@ +@@ -286,10 +445,53 @@ } - public void a(double d0, double d1, double d2, float f, float f1, Set set) { + public void a(double d0, double d1, double d2, float f, float f1) { +- this.a(d0, d1, d2, f, f1, Collections.emptySet()); ++ this.a(d0, d1, d2, f, f1, Collections.emptySet()); // CraftBukkit fix decompile errors + } + + public void a(double d0, double d1, double d2, float f, float f1, Set set) { + // CraftBukkit start - Delegate to teleport(Location) + Player player = this.getPlayer(); + Location from = player.getLocation(); @@ -261,8 +277,8 @@ + to = event.isCancelled() ? from : event.getTo(); + + this.teleport(to, set); -+ } -+ ++ } ++ + public void teleport(Location dest) { + teleport(dest, Collections.emptySet()); + } @@ -296,7 +312,7 @@ this.checkMovement = false; this.o = d0; this.p = d1; -@@ -314,32 +515,49 @@ +@@ -323,32 +525,49 @@ public void a(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.u()); @@ -306,7 +322,7 @@ this.player.z(); + // CraftBukkit start - switch (SwitchHelperCommandActionType.a[packetplayinblockdig.c().ordinal()]) { + switch (PlayerConnection.SyntheticClass_1.a[packetplayinblockdig.c().ordinal()]) { - case 1: + case 1: // DROP_ITEM if (!this.player.v()) { @@ -340,7 +356,7 @@ - case 3: + case 3: // RELEASE_USE_ITEM - this.player.bT(); + this.player.bU(); return; - case 4: @@ -352,8 +368,8 @@ double d0 = this.player.locX - ((double) blockposition.getX() + 0.5D); double d1 = this.player.locY - ((double) blockposition.getY() + 0.5D) + 1.5D; double d2 = this.player.locZ - ((double) blockposition.getZ() + 0.5D); -@@ -354,7 +572,15 @@ - if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.af().a(blockposition)) { +@@ -363,7 +582,15 @@ + if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { this.player.playerInteractManager.a(blockposition, packetplayinblockdig.b()); } else { + // CraftBukkit start - fire PlayerInteractEvent @@ -367,8 +383,8 @@ + // CraftBukkit end } } else { - if (packetplayinblockdig.c() == EnumPlayerDigType.STOP_DESTROY_BLOCK) { -@@ -374,11 +600,22 @@ + if (packetplayinblockdig.c() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) { +@@ -383,11 +610,22 @@ default: throw new IllegalArgumentException("Invalid player action"); } @@ -378,27 +394,27 @@ public void a(PacketPlayInBlockPlace packetplayinblockplace) { PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.u()); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); -+ ++ + // CraftBukkit start + if (this.player.dead) return; -+ ++ + // CraftBukkit - if rightclick decremented the item, always send the update packet. */ + // this is not here for CraftBukkit's own functionality; rather it is to fix + // a notch bug where the item doesn't update correctly. + boolean always = false; + // CraftBukkit end -+ ++ ItemStack itemstack = this.player.inventory.getItemInHand(); boolean flag = false; BlockPosition blockposition = packetplayinblockplace.a(); -@@ -390,7 +627,50 @@ +@@ -399,7 +637,50 @@ return; } - this.player.playerInteractManager.useItem(this.player, worldserver, itemstack); + // CraftBukkit start + int itemstackAmount = itemstack.count; -+ ++ + // Raytrace to look for 'rogue armswings' + float f1 = this.player.pitch; + float f2 = this.player.yaw; @@ -413,12 +429,12 @@ + float f6 = MathHelper.sin(-f1 * 0.017453292F); + float f7 = f4 * f5; + float f8 = f3 * f5; -+ double d3 = player.playerInteractManager.getGameMode() == EnumGamemode.CREATIVE ? 5.0D : 4.5D; ++ double d3 = player.playerInteractManager.getGameMode() == WorldSettings.EnumGamemode.CREATIVE ? 5.0D : 4.5D; + Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); + MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, false); + + boolean cancelled = false; -+ if (movingobjectposition == null || movingobjectposition.type != EnumMovingObjectType.BLOCK) { ++ if (movingobjectposition == null || movingobjectposition.type != MovingObjectPosition.EnumMovingObjectType.BLOCK) { + org.bukkit.event.player.PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.RIGHT_CLICK_AIR, itemstack); + cancelled = event.useItemInHand() == Event.Result.DENY; + } else { @@ -443,7 +459,7 @@ } else if (blockposition.getY() >= this.minecraftServer.getMaxBuildHeight() - 1 && (enumdirection == EnumDirection.UP || blockposition.getY() >= this.minecraftServer.getMaxBuildHeight())) { ChatMessage chatmessage = new ChatMessage("build.tooHigh", new Object[] { Integer.valueOf(this.minecraftServer.getMaxBuildHeight())}); -@@ -398,9 +678,21 @@ +@@ -407,8 +688,19 @@ this.player.playerConnection.sendPacket(new PacketPlayOutChat(chatmessage)); flag = true; } else { @@ -453,20 +469,18 @@ + if (reachDistance > (this.getPlayer().getGameMode() == org.bukkit.GameMode.CREATIVE ? CREATIVE_PLACE_DISTANCE_SQUARED : SURVIVAL_PLACE_DISTANCE_SQUARED)) { + return; + } -+ -+ if (!worldserver.af().a(blockposition)) { ++ ++ if (!worldserver.getWorldBorder().a(blockposition)) { + return; + } + - if (this.checkMovement && this.player.e((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.af().a(blockposition)) { + if (this.checkMovement && this.player.e((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { - this.player.playerInteractManager.interact(this.player, worldserver, itemstack, blockposition, enumdirection, packetplayinblockplace.d(), packetplayinblockplace.e(), packetplayinblockplace.f()); + always = !this.player.playerInteractManager.interact(this.player, worldserver, itemstack, blockposition, enumdirection, packetplayinblockplace.d(), packetplayinblockplace.e(), packetplayinblockplace.f()); } -+ // CraftBukkit end flag = true; - } -@@ -423,7 +715,8 @@ +@@ -432,7 +724,8 @@ this.player.activeContainer.b(); this.player.g = false; @@ -476,7 +490,7 @@ this.sendPacket(new PacketPlayOutSetSlot(this.player.activeContainer.windowId, slot.rawSlotIndex, this.player.inventory.getItemInHand())); } } -@@ -437,8 +730,8 @@ +@@ -446,8 +739,8 @@ WorldServer[] aworldserver = this.minecraftServer.worldServer; int i = aworldserver.length; @@ -487,7 +501,7 @@ if (worldserver != null) { entity = packetplayinspectate.a(worldserver); -@@ -451,10 +744,11 @@ +@@ -460,6 +753,8 @@ if (entity != null) { this.player.e((Entity) this.player); this.player.mount((Entity) null); @@ -496,11 +510,7 @@ if (entity.world != this.player.world) { WorldServer worldserver1 = this.player.u(); WorldServer worldserver2 = (WorldServer) entity.world; -- - this.player.dimension = entity.dimension; - this.sendPacket(new PacketPlayOutRespawn(this.player.dimension, worldserver1.getDifficulty(), worldserver1.getWorldData().getType(), this.player.playerInteractManager.getGameMode())); - worldserver1.removeEntity(this.player); -@@ -475,6 +769,9 @@ +@@ -484,6 +779,9 @@ } else { this.player.enderTeleportTo(entity.locX, entity.locY, entity.locZ); } @@ -510,7 +520,7 @@ } } -@@ -483,14 +780,29 @@ +@@ -492,14 +790,29 @@ public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) {} public void a(IChatBaseComponent ichatbasecomponent) { @@ -522,16 +532,16 @@ + this.processedDisconnect = true; + } + // CraftBukkit end -+ c.info(this.player.getName() + " lost connection: " + ichatbasecomponent.c()); // CraftBukkit - Don't toString the component - this.minecraftServer.aF(); ++ PlayerConnection.c.info(this.player.getName() + " lost connection: " + ichatbasecomponent.c()); // CraftBukkit - Don't toString the component + // CraftBukkit start - Replace vanilla quit message handling with our own. + /* + this.minecraftServer.aG(); ChatMessage chatmessage = new ChatMessage("multiplayer.player.left", new Object[] { this.player.getScoreboardDisplayName()}); chatmessage.getChatModifier().setColor(EnumChatFormat.YELLOW); this.minecraftServer.getPlayerList().sendMessage(chatmessage); + */ -+ ++ this.player.q(); - this.minecraftServer.getPlayerList().disconnect(this.player); + String quitMessage = this.minecraftServer.getPlayerList().disconnect(this.player); @@ -542,11 +552,10 @@ if (this.minecraftServer.S() && this.player.getName().equals(this.minecraftServer.R())) { PlayerConnection.c.info("Stopping singleplayer server as player logged out"); this.minecraftServer.safeShutdown(); -@@ -511,6 +823,15 @@ - return; +@@ -521,6 +834,15 @@ } } -+ + + // CraftBukkit start + if (packet == null) { + return; @@ -555,10 +564,11 @@ + this.player.compassTarget = new Location(this.getPlayer().getWorld(), packet6.position.getX(), packet6.position.getY(), packet6.position.getZ()); + } + // CraftBukkit end - ++ try { this.networkManager.handle(packet); -@@ -524,18 +845,34 @@ + } catch (Throwable throwable) { +@@ -541,18 +863,34 @@ } public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { @@ -570,7 +580,7 @@ + this.server.getPluginManager().callEvent(event); + if (event.isCancelled()) { + this.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex)); -+ this.player.z(); // RENAME ++ this.player.z(); // PAIL: RENAME + return; + } + // CraftBukkit end @@ -584,18 +594,18 @@ public void a(PacketPlayInChat packetplayinchat) { - PlayerConnectionUtils.ensureMainThread(packetplayinchat, this, this.player.u()); -- if (this.player.getChatFlags() == EnumChatVisibility.HIDDEN) { +- if (this.player.getChatFlags() == EntityHuman.EnumChatVisibility.HIDDEN) { + // CraftBukkit start - async chat + boolean isSync = packetplayinchat.a().startsWith("/"); + if (packetplayinchat.a().startsWith("/")) { -+ PlayerConnectionUtils.ensureMainThread(packetplayinchat, this, this.player.u()); ++ PlayerConnectionUtils.ensureMainThread(packetplayinchat, this, this.player.u()); + } + // CraftBukkit end -+ if (this.player.dead || this.player.getChatFlags() == EnumChatVisibility.HIDDEN) { // CraftBukkit - dead men tell no tales ++ if (this.player.dead || this.player.getChatFlags() == EntityHuman.EnumChatVisibility.HIDDEN) { // CraftBukkit - dead men tell no tales ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); chatmessage.getChatModifier().setColor(EnumChatFormat.RED); -@@ -548,39 +885,247 @@ +@@ -565,39 +903,249 @@ for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { @@ -641,7 +651,7 @@ + c.warn(this.player.getName() + " tried to send an empty message"); + } else if (getPlayer().isConversing()) { + getPlayer().acceptConversationInput(s); -+ } else if (this.player.getChatFlags() == EnumChatVisibility.SYSTEM) { // Re-add "Command Only" flag check ++ } else if (this.player.getChatFlags() == EntityHuman.EnumChatVisibility.SYSTEM) { // Re-add "Command Only" flag check + ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); + + chatmessage.getChatModifier().setColor(EnumChatFormat.RED); @@ -658,7 +668,6 @@ - this.chatThrottle += 20; - if (this.chatThrottle > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { - this.disconnect("disconnect.spam"); -- } + // CraftBukkit start - replaced with thread safe throttle + // this.chatThrottle += 20; + if (chatSpamField.addAndGet(this, 20) > 200 && !this.minecraftServer.getPlayerList().isOp(this.player.getProfile())) { @@ -684,19 +693,22 @@ + this.disconnect("disconnect.spam"); + } + // CraftBukkit end -+ } -+ } -+ } -+ + } + + } + } + +- private void handleCommand(String s) { +- this.minecraftServer.getCommandHandler().a(this.player, s); + // CraftBukkit start - add method + public void chat(String s, boolean async) { -+ if (s.isEmpty() || this.player.getChatFlags() == EnumChatVisibility.HIDDEN) { ++ if (s.isEmpty() || this.player.getChatFlags() == EntityHuman.EnumChatVisibility.HIDDEN) { + return; + } + + if (!async && s.startsWith("/")) { + this.handleCommand(s); -+ } else if (this.player.getChatFlags() == EnumChatVisibility.SYSTEM) { ++ } else if (this.player.getChatFlags() == EntityHuman.EnumChatVisibility.SYSTEM) { + // Do nothing, this is coming from a plugin + } else { + Player player = this.getPlayer(); @@ -745,7 +757,7 @@ + if (event.isCancelled()) { + return; + } - ++ + s = String.format(event.getFormat(), event.getPlayer().getDisplayName(), event.getMessage()); + minecraftServer.console.sendMessage(s); + if (((LazyPlayerSet) event.getRecipients()).isLazy()) { @@ -758,12 +770,11 @@ + } + } + } - } - } ++ } ++ } + // CraftBukkit end - - private void handleCommand(String s) { -- this.minecraftServer.getCommandHandler().a(this.player, s); ++ ++ private void handleCommand(String s) { + // CraftBukkit start - whole method + this.c.info(this.player.getName() + " issued server command: " + s); + @@ -807,11 +818,11 @@ + float f6 = MathHelper.sin(-f1 * 0.017453292F); + float f7 = f4 * f5; + float f8 = f3 * f5; -+ double d3 = player.playerInteractManager.getGameMode() == EnumGamemode.CREATIVE ? 5.0D : 4.5D; ++ double d3 = player.playerInteractManager.getGameMode() == WorldSettings.EnumGamemode.CREATIVE ? 5.0D : 4.5D; + Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); + MovingObjectPosition movingobjectposition = this.player.world.rayTrace(vec3d, vec3d1, false); + -+ if (movingobjectposition == null || movingobjectposition.type != EnumMovingObjectType.BLOCK) { ++ if (movingobjectposition == null || movingobjectposition.type != MovingObjectPosition.EnumMovingObjectType.BLOCK) { + CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_AIR, this.player.inventory.getItemInHand()); + } + @@ -821,7 +832,7 @@ + + if (event.isCancelled()) return; + // CraftBukkit end - this.player.bv(); + this.player.bw(); } public void a(PacketPlayInEntityAction packetplayinentityaction) { @@ -830,8 +841,8 @@ + if (this.player.dead) return; + switch (packetplayinentityaction.b()) { + case START_SNEAKING: -+ case STOP_SNEAKING: -+ PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getPlayer(), packetplayinentityaction.b() == EnumPlayerAction.START_SNEAKING); ++ case STOP_SNEAKING: ++ PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this.getPlayer(), packetplayinentityaction.b() == PacketPlayInEntityAction.EnumPlayerAction.START_SNEAKING); + this.server.getPluginManager().callEvent(event); + + if (event.isCancelled()) { @@ -839,8 +850,8 @@ + } + break; + case START_SPRINTING: -+ case STOP_SPRINTING: -+ PlayerToggleSprintEvent e2 = new PlayerToggleSprintEvent(this.getPlayer(), packetplayinentityaction.b() == EnumPlayerAction.START_SPRINTING); ++ case STOP_SPRINTING: ++ PlayerToggleSprintEvent e2 = new PlayerToggleSprintEvent(this.getPlayer(), packetplayinentityaction.b() == PacketPlayInEntityAction.EnumPlayerAction.START_SPRINTING); + this.server.getPluginManager().callEvent(e2); + + if (e2.isCancelled()) { @@ -848,10 +859,11 @@ + } + break; + } ++ // CraftBukkit end this.player.z(); - switch (SwitchHelperCommandActionType.b[packetplayinentityaction.b().ordinal()]) { + switch (PlayerConnection.SyntheticClass_1.b[packetplayinentityaction.b().ordinal()]) { case 1: -@@ -601,7 +1146,7 @@ +@@ -618,7 +1166,7 @@ case 5: this.player.a(false, true, true); @@ -860,7 +872,7 @@ break; case 6: -@@ -623,6 +1168,7 @@ +@@ -640,6 +1188,7 @@ } public void a(PacketPlayInUseEntity packetplayinuseentity) { @@ -868,20 +880,20 @@ PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.u()); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); -@@ -637,18 +1183,72 @@ +@@ -654,18 +1203,71 @@ } if (this.player.h(entity) < d0) { + ItemStack itemInHand = this.player.inventory.getItemInHand(); // CraftBukkit -+ -+ if (packetplayinuseentity.a() == EnumEntityUseAction.INTERACT -+ || packetplayinuseentity.a() == EnumEntityUseAction.INTERACT_AT) { ++ ++ if (packetplayinuseentity.a() == PacketPlayInUseEntity.EnumEntityUseAction.INTERACT ++ || packetplayinuseentity.a() == PacketPlayInUseEntity.EnumEntityUseAction.INTERACT_AT) { + // CraftBukkit start + boolean triggerTagUpdate = itemInHand != null && itemInHand.getItem() == Items.NAME_TAG && entity instanceof EntityInsentient; + boolean triggerChestUpdate = itemInHand != null && itemInHand.getItem() == Item.getItemOf(Blocks.CHEST) && entity instanceof EntityHorse; + boolean triggerLeashUpdate = itemInHand != null && itemInHand.getItem() == Items.LEAD && entity instanceof EntityInsentient; + PlayerInteractEntityEvent event; -+ if (packetplayinuseentity.a() == EnumEntityUseAction.INTERACT) { ++ if (packetplayinuseentity.a() == PacketPlayInUseEntity.EnumEntityUseAction.INTERACT) { + event = new PlayerInteractEntityEvent((Player) this.getPlayer(), entity.getBukkitEntity()); + } else { + Vec3D target = packetplayinuseentity.b(); @@ -907,33 +919,32 @@ + } + // CraftBukkit end + } -+ - if (packetplayinuseentity.a() == EnumEntityUseAction.INTERACT) { + if (packetplayinuseentity.a() == PacketPlayInUseEntity.EnumEntityUseAction.INTERACT) { this.player.u(entity); -+ ++ + // CraftBukkit start + if (itemInHand != null && itemInHand.count <= -1) { + this.player.updateInventory(this.player.activeContainer); + } + // CraftBukkit end - } else if (packetplayinuseentity.a() == EnumEntityUseAction.INTERACT_AT) { + } else if (packetplayinuseentity.a() == PacketPlayInUseEntity.EnumEntityUseAction.INTERACT_AT) { entity.a((EntityHuman) this.player, packetplayinuseentity.b()); -+ ++ + // CraftBukkit start + if (itemInHand != null && itemInHand.count <= -1) { + this.player.updateInventory(this.player.activeContainer); + } + // CraftBukkit end - } else if (packetplayinuseentity.a() == EnumEntityUseAction.ATTACK) { + } else if (packetplayinuseentity.a() == PacketPlayInUseEntity.EnumEntityUseAction.ATTACK) { - if (entity instanceof EntityItem || entity instanceof EntityExperienceOrb || entity instanceof EntityArrow || entity == this.player) { -+ if (entity instanceof EntityItem || entity instanceof EntityExperienceOrb || entity instanceof EntityArrow || (entity == this.player && !player.v())) { // CraftBukkit, RENAME ++ if (entity instanceof EntityItem || entity instanceof EntityExperienceOrb || entity instanceof EntityArrow || (entity == this.player && !player.v())) { // CraftBukkit, PAIL: RENAME this.disconnect("Attempting to attack an invalid entity"); this.minecraftServer.warning("Player " + this.player.getName() + " tried to attack an invalid entity"); return; } this.player.attack(entity); -+ ++ + // CraftBukkit start + if (itemInHand != null && itemInHand.count <= -1) { + this.player.updateInventory(this.player.activeContainer); @@ -942,8 +953,8 @@ } } } -@@ -663,7 +1263,8 @@ - switch (SwitchHelperCommandActionType.c[enumclientcommand.ordinal()]) { +@@ -680,7 +1282,8 @@ + switch (PlayerConnection.SyntheticClass_1.c[packetplayinclientcommand_enumclientcommand.ordinal()]) { case 1: if (this.player.viewingCredits) { - this.player = this.minecraftServer.getPlayerList().moveToWorld(this.player, 0, true); @@ -952,21 +963,20 @@ } else if (this.player.u().getWorldData().isHardcore()) { if (this.minecraftServer.S() && this.player.getName().equals(this.minecraftServer.R())) { this.player.playerConnection.disconnect("You have died. Game over, man, it\'s game over!"); -@@ -694,15 +1295,22 @@ +@@ -711,15 +1314,21 @@ } public void a(PacketPlayInCloseWindow packetplayinclosewindow) { + if (this.player.dead) return; // CraftBukkit PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.u()); -+ ++ + CraftEventFactory.handleInventoryCloseEvent(this.player); // CraftBukkit -+ ++ this.player.p(); } public void a(PacketPlayInWindowClick packetplayinwindowclick) { + if (this.player.dead) return; // CraftBukkit -+ PlayerConnectionUtils.ensureMainThread(packetplayinwindowclick, this, this.player.u()); this.player.z(); if (this.player.activeContainer.windowId == packetplayinwindowclick.a() && this.player.activeContainer.c(this.player)) { @@ -976,7 +986,7 @@ ArrayList arraylist = Lists.newArrayList(); for (int i = 0; i < this.player.activeContainer.c.size(); ++i) { -@@ -711,7 +1319,270 @@ +@@ -728,7 +1337,270 @@ this.player.a(this.player.activeContainer, (List) arraylist); } else { @@ -1248,7 +1258,7 @@ if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) { this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true)); -@@ -772,8 +1643,50 @@ +@@ -789,8 +1661,48 @@ } boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() < 36 + PlayerInventory.getHotbarSize(); @@ -1256,8 +1266,6 @@ + // CraftBukkit - Add invalidItems check + boolean flag2 = itemstack == null || itemstack.getItem() != null && !invalidItems.contains(Item.getId(itemstack.getItem())); boolean flag3 = itemstack == null || itemstack.getData() >= 0 && itemstack.count <= 64 && itemstack.count > 0; -+ -+ + // CraftBukkit start - Call click event + if (flag || (flag1 && !ItemStack.matches(this.player.defaultContainer.getSlot(packetplayinsetcreativeslot.a()).getItem(), packetplayinsetcreativeslot.getItemStack()))) { // Insist on valid slot + @@ -1300,7 +1308,7 @@ if (flag1 && flag2 && flag3) { if (itemstack == null) { -@@ -796,6 +1709,7 @@ +@@ -813,6 +1725,7 @@ } public void a(PacketPlayInTransaction packetplayintransaction) { @@ -1308,7 +1316,7 @@ PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.u()); Short oshort = (Short) this.n.get(this.player.activeContainer.windowId); -@@ -806,6 +1720,7 @@ +@@ -823,6 +1736,7 @@ } public void a(PacketPlayInUpdateSign packetplayinupdatesign) { @@ -1316,7 +1324,7 @@ PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.u()); this.player.z(); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); -@@ -822,10 +1737,24 @@ +@@ -839,14 +1753,30 @@ if (!tileentitysign.b() || tileentitysign.c() != this.player) { this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign"); @@ -1324,25 +1332,31 @@ return; } -- System.arraycopy(packetplayinupdatesign.b(), 0, tileentitysign.lines, 0, 4); + IChatBaseComponent[] aichatbasecomponent = packetplayinupdatesign.b(); + + // CraftBukkit start + Player player = this.server.getPlayer(this.player); + int x = packetplayinupdatesign.a().getX(); + int y = packetplayinupdatesign.a().getY(); + int z = packetplayinupdatesign.a().getZ(); -+ SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), org.bukkit.craftbukkit.block.CraftSign.revertComponents(packetplayinupdatesign.b())); ++ String[] lines = new String[4]; + for (int i = 0; i < aichatbasecomponent.length; ++i) { +- tileentitysign.lines[i] = new ChatComponentText(aichatbasecomponent[i].c()); ++ lines[i] = aichatbasecomponent[i].c(); ++ } ++ SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines); + this.server.getPluginManager().callEvent(event); + + if (!event.isCancelled()) { + System.arraycopy(org.bukkit.craftbukkit.block.CraftSign.sanitizeLines(event.getLines()), 0, tileentitysign.lines, 0, 4); + tileentitysign.isEditable = false; -+ } + } + // System.arraycopy(packetplayinupdatesign.b(), 0, tileentitysign.lines, 0, 4); -+ // CraftBukkit end ++ // CraftBukkit end + tileentitysign.update(); worldserver.notify(blockposition); - } -@@ -847,11 +1776,28 @@ +@@ -869,11 +1799,27 @@ public void a(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.u()); @@ -1368,11 +1382,10 @@ + return; + } + // CraftBukkit end -+ ArrayList arraylist = Lists.newArrayList(); Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b()).iterator(); -@@ -891,13 +1837,15 @@ +@@ -913,13 +1859,15 @@ itemstack1 = this.player.inventory.getItemInHand(); if (itemstack1 != null) { if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { @@ -1389,28 +1402,9 @@ return; } finally { packetdataserializer.release(); -@@ -909,27 +1857,31 @@ - - try { - itemstack = packetdataserializer.i(); -- if (itemstack == null) { -- return; -- } -+ if (itemstack != null) { -+ if (!ItemWrittenBook.b(itemstack.getTag())) { -+ throw new IOException("Invalid book tag!"); -+ } - -- if (!ItemWrittenBook.b(itemstack.getTag())) { -- throw new IOException("Invalid book tag!"); -- } -+ itemstack1 = this.player.inventory.getItemInHand(); -+ if (itemstack1 == null) { -+ return; -+ } - -- itemstack1 = this.player.inventory.getItemInHand(); -- if (itemstack1 != null) { +@@ -942,16 +1890,20 @@ + itemstack1 = this.player.inventory.getItemInHand(); + if (itemstack1 != null) { if (itemstack.getItem() == Items.WRITTEN_BOOK && itemstack1.getItem() == Items.WRITABLE_BOOK) { - itemstack1.a("author", (NBTBase) (new NBTTagString(this.player.getName()))); - itemstack1.a("title", (NBTBase) (new NBTTagString(itemstack.getTag().getString("title")))); @@ -1421,7 +1415,7 @@ + // itemstack1.a("title", (NBTBase) (new NBTTagString(itemstack.getTag().getString("title")))); + // itemstack1.a("pages", (NBTBase) itemstack.getTag().getList("pages", 8)); + // itemstack1.setItem(Items.WRITTEN_BOOK); -+ CraftEventFactory.handleEditBookEvent(player, itemstack); ++ CraftEventFactory.handleEditBookEvent(player, itemstack); + // CraftBukkit end } @@ -1433,7 +1427,7 @@ return; } finally { packetdataserializer.release(); -@@ -946,11 +1898,12 @@ +@@ -968,11 +1920,12 @@ } } catch (Exception exception2) { PlayerConnection.c.error("Couldn\'t select trade", exception2); @@ -1447,7 +1441,7 @@ packetdataserializer = packetplayincustompayload.b(); try { -@@ -986,6 +1939,7 @@ +@@ -1008,6 +1961,7 @@ } } catch (Exception exception3) { PlayerConnection.c.error("Couldn\'t set command block", exception3); @@ -1455,7 +1449,7 @@ } finally { packetdataserializer.release(); } -@@ -1011,6 +1965,7 @@ +@@ -1033,6 +1987,7 @@ } } catch (Exception exception4) { PlayerConnection.c.error("Couldn\'t set beacon", exception4); @@ -1463,31 +1457,32 @@ } } } else if ("MC|ItemName".equals(packetplayincustompayload.a()) && this.player.activeContainer instanceof ContainerAnvil) { -@@ -1026,6 +1981,27 @@ +@@ -1048,7 +2003,28 @@ containeranvil.a(""); } } -+ // CraftBukkit start -+ else if (packetplayincustompayload.a().equals("REGISTER")) { -+ String channels = packetplayincustompayload.b().toString(com.google.common.base.Charsets.UTF_8); -+ for (String channel : channels.split("\0")) { -+ getPlayer().addChannel(channel); -+ } -+ } else if (packetplayincustompayload.a().equals("UNREGISTER")) { -+ String channels = packetplayincustompayload.b().toString(com.google.common.base.Charsets.UTF_8); -+ for (String channel : channels.split("\0")) { -+ getPlayer().removeChannel(channel); -+ } -+ } else { -+ byte[] data = new byte[packetplayincustompayload.b().readableBytes()]; -+ packetplayincustompayload.b().readBytes(data); -+ server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packetplayincustompayload.a(), data); ++ // CraftBukkit start ++ else if (packetplayincustompayload.a().equals("REGISTER")) { ++ String channels = packetplayincustompayload.b().toString(com.google.common.base.Charsets.UTF_8); ++ for (String channel : channels.split("\0")) { ++ getPlayer().addChannel(channel); + } -+ // CraftBukkit end ++ } else if (packetplayincustompayload.a().equals("UNREGISTER")) { ++ String channels = packetplayincustompayload.b().toString(com.google.common.base.Charsets.UTF_8); ++ for (String channel : channels.split("\0")) { ++ getPlayer().removeChannel(channel); ++ } ++ } else { ++ byte[] data = new byte[packetplayincustompayload.b().readableBytes()]; ++ packetplayincustompayload.b().readBytes(data); ++ server.getMessenger().dispatchIncomingMessage(player.getBukkitEntity(), packetplayincustompayload.a(), data); ++ } ++ // CraftBukkit end + } + // CraftBukkit start - Add "isDisconnected" method + public final boolean isDisconnected() { -+ return !this.player.joining && !NetworkManager.a(this.networkManager).config().isAutoRead(); ++ return !this.player.joining && !this.networkManager.k.config().isAutoRead(); } - } + + static class SyntheticClass_1 { diff --git a/nms-patches/PlayerDatFileConverter.patch b/nms-patches/PlayerDatFileConverter.patch deleted file mode 100644 index 5c9fc1af47..0000000000 --- a/nms-patches/PlayerDatFileConverter.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PlayerDatFileConverter.java 2014-11-28 17:43:43.329707430 +0000 -+++ src/main/java/net/minecraft/server/PlayerDatFileConverter.java 2014-11-28 17:38:20.000000000 +0000 -@@ -47,6 +47,30 @@ - private void a(File file, String s, String s1) { - File file1 = new File(this.d, s + ".dat"); - File file2 = new File(file, s1 + ".dat"); -+ -+ // CraftBukkit start - Use old file name to seed lastKnownName -+ NBTTagCompound root = null; -+ -+ try { -+ root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file1)); -+ } catch (Exception exception) { -+ exception.printStackTrace(); -+ } -+ -+ if (root != null) { -+ if (!root.hasKey("bukkit")) { -+ root.set("bukkit", new NBTTagCompound()); -+ } -+ NBTTagCompound data = root.getCompound("bukkit"); -+ data.setString("lastKnownName", s); -+ -+ try { -+ NBTCompressedStreamTools.a(root, new java.io.FileOutputStream(file2)); -+ } catch (Exception exception) { -+ exception.printStackTrace(); -+ } -+ } -+ // CraftBukkit end - - NameReferencingFileConverter.a(file); - if (!file1.renameTo(file2)) { diff --git a/nms-patches/PlayerInteractManager.patch b/nms-patches/PlayerInteractManager.patch index 8debad8da3..d2632652ca 100644 --- a/nms-patches/PlayerInteractManager.patch +++ b/nms-patches/PlayerInteractManager.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/PlayerInteractManager.java 2014-12-21 19:03:39.124516788 +0000 -+++ src/main/java/net/minecraft/server/PlayerInteractManager.java 2014-12-21 19:03:39.128516787 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/PlayerInteractManager.java 2015-02-26 22:40:23.011608135 +0000 ++++ src/main/java/net/minecraft/server/PlayerInteractManager.java 2015-02-26 22:40:23.011608135 +0000 @@ -1,5 +1,13 @@ package net.minecraft.server; @@ -59,7 +59,7 @@ + IBlockData data = this.world.getType(blockposition); + if (block == Blocks.WOODEN_DOOR) { + // For some reason *BOTH* the bottom/top part have to be marked updated. -+ boolean bottom = data.get(BlockDoor.HALF) == EnumDoorHalf.LOWER; ++ boolean bottom = data.get(BlockDoor.HALF) == BlockDoor.EnumDoorHalf.LOWER; + ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); + ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, bottom ? blockposition.up() : blockposition.down())); + } else if (block == Blocks.TRAPDOOR) { @@ -117,7 +117,7 @@ } public boolean breakBlock(BlockPosition blockposition) { -- if (this.gamemode.d() && this.player.bz() != null && this.player.bz().getItem() instanceof ItemSword) { +- if (this.gamemode.d() && this.player.bA() != null && this.player.bA().getItem() instanceof ItemSword) { + // CraftBukkit start - fire BlockBreakEvent + BlockBreakEvent event = null; + @@ -125,7 +125,7 @@ + org.bukkit.block.Block block = this.world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); + + // Sword + Creative mode pre-cancel -+ boolean isSwordNoBreak = this.gamemode.d() && this.player.bz() != null && this.player.bz().getItem() instanceof ItemSword; ++ boolean isSwordNoBreak = this.gamemode.d() && this.player.bA() != null && this.player.bA().getItem() instanceof ItemSword; + + // Tell client the block is gone immediately then process events + // Don't tell the client if its a creative sword break because its not broken! @@ -146,7 +146,7 @@ + + if (nmsBlock != null && !event.isCancelled() && !this.isCreative() && this.player.b(nmsBlock)) { + // Copied from block.a(World world, EntityHuman entityhuman, BlockPosition blockposition, IBlockData iblockdata, TileEntity tileentity) -+ if (!(nmsBlock.G() && EnchantmentManager.hasSilkTouchEnchantment(this.player))) { ++ if (!(nmsBlock.I() && EnchantmentManager.hasSilkTouchEnchantment(this.player))) { + int data = block.getData(); + int bonusLevel = EnchantmentManager.getBonusBlockLootEnchantmentLevel(this.player); + @@ -170,34 +170,32 @@ + return false; + } + } -+ if (false && this.gamemode.d() && this.player.bz() != null && this.player.bz().getItem() instanceof ItemSword) { ++ if (false && this.gamemode.d() && this.player.bA() != null && this.player.bA().getItem() instanceof ItemSword) { return false; } else { IBlockData iblockdata = this.world.getType(blockposition); + if (iblockdata.getBlock() == Blocks.AIR) return false; // CraftBukkit - A plugin set block to air without cancelling TileEntity tileentity = this.world.getTileEntity(blockposition); -- -+ + + // CraftBukkit start - Special case skulls, their item data comes from a tile entity + if (iblockdata.getBlock() == Blocks.SKULL && !this.isCreative()) { + iblockdata.getBlock().dropNaturally(world, blockposition, iblockdata, 1.0F, 0); + return this.c(blockposition); + } + // CraftBukkit end -+ ++ if (this.gamemode.c()) { - if (this.gamemode == EnumGamemode.SPECTATOR) { + if (this.gamemode == WorldSettings.EnumGamemode.SPECTATOR) { return false; -@@ -229,7 +349,13 @@ - if (flag && flag1) { +@@ -230,6 +350,12 @@ iblockdata.getBlock().a(this.world, this.player, blockposition, iblockdata, tileentity); } -+ } + } + + // CraftBukkit start - Drop event experience + if (flag && event != null) { + iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop()); - } ++ } + // CraftBukkit end return flag; @@ -213,7 +211,7 @@ + public boolean interact(EntityHuman entityhuman, World world, ItemStack itemstack, BlockPosition blockposition, EnumDirection enumdirection, float f, float f1, float f2) { + /* CraftBukkit start - whole method - if (this.gamemode == EnumGamemode.SPECTATOR) { + if (this.gamemode == WorldSettings.EnumGamemode.SPECTATOR) { TileEntity tileentity = world.getTileEntity(blockposition); @@ -312,6 +444,72 @@ @@ -225,8 +223,8 @@ + boolean result = false; + if (blockdata.getBlock() != Blocks.AIR) { + boolean cancelledBlock = false; -+ -+ if (this.gamemode == EnumGamemode.SPECTATOR) { ++ ++ if (this.gamemode == WorldSettings.EnumGamemode.SPECTATOR) { + TileEntity tileentity = world.getTileEntity(blockposition); + cancelledBlock = !(tileentity instanceof ITileInventory || tileentity instanceof IInventory); + } @@ -234,19 +232,19 @@ + if (!entityhuman.getBukkitEntity().isOp() && itemstack != null && Block.asBlock(itemstack.getItem()) instanceof BlockCommand) { + cancelledBlock = true; + } -+ ++ + PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(entityhuman, Action.RIGHT_CLICK_BLOCK, blockposition, enumdirection, itemstack, cancelledBlock); + firedInteract = true; + interactResult = event.useItemInHand() == Event.Result.DENY; -+ ++ + if (event.useInteractedBlock() == Event.Result.DENY) { + // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door. + if (blockdata.getBlock() instanceof BlockDoor) { -+ boolean bottom = blockdata.get(BlockDoor.HALF) == EnumDoorHalf.LOWER; ++ boolean bottom = blockdata.get(BlockDoor.HALF) == BlockDoor.EnumDoorHalf.LOWER; + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, bottom ? blockposition.up() : blockposition.down())); + } + result = (event.useItemInHand() != Event.Result.ALLOW); -+ } else if (this.gamemode == EnumGamemode.SPECTATOR) { ++ } else if (this.gamemode == WorldSettings.EnumGamemode.SPECTATOR) { + TileEntity tileentity = world.getTileEntity(blockposition); + + if (tileentity instanceof ITileInventory) { @@ -254,7 +252,7 @@ + ITileInventory itileinventory = (ITileInventory) tileentity; + + if (itileinventory instanceof TileEntityChest && block instanceof BlockChest) { -+ itileinventory = ((BlockChest) block).d(world, blockposition); ++ itileinventory = ((BlockChest) block).f(world, blockposition); + } + + if (itileinventory != null) { @@ -266,7 +264,7 @@ + return true; + } + -+ return false; ++ return false; + } else if (!entityhuman.isSneaking() || itemstack == null) { + result = blockdata.getBlock().interact(world, blockposition, blockdata, entityhuman, enumdirection, f, f1, f2); + } diff --git a/nms-patches/PlayerInventory.patch b/nms-patches/PlayerInventory.patch index 166187340a..496e6cab65 100644 --- a/nms-patches/PlayerInventory.patch +++ b/nms-patches/PlayerInventory.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PlayerInventory.java 2014-11-28 17:43:43.333707430 +0000 -+++ src/main/java/net/minecraft/server/PlayerInventory.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/PlayerInventory.java 2015-02-26 22:40:23.019608135 +0000 ++++ src/main/java/net/minecraft/server/PlayerInventory.java 2015-02-26 22:40:23.023608135 +0000 @@ -2,6 +2,13 @@ import java.util.concurrent.Callable; @@ -14,11 +14,10 @@ public class PlayerInventory implements IInventory { public ItemStack[] items = new ItemStack[36]; -@@ -10,6 +17,39 @@ - public EntityHuman player; +@@ -11,6 +18,39 @@ private ItemStack f; public boolean e; -+ + + // CraftBukkit start - add fields and methods + public List transaction = new java.util.ArrayList(); + private int maxStack = MAX_STACK; @@ -51,14 +50,14 @@ + maxStack = size; + } + // CraftBukkit end - ++ public PlayerInventory(EntityHuman entityhuman) { this.player = entityhuman; -@@ -42,6 +82,22 @@ - + } +@@ -43,6 +83,22 @@ return -1; } -+ + + // CraftBukkit start - Watch method above! :D + public int canHold(ItemStack itemstack) { + int remains = itemstack.count; @@ -74,10 +73,11 @@ + return itemstack.count - remains; + } + // CraftBukkit end - ++ public int getFirstEmptySlotIndex() { for (int i = 0; i < this.items.length; ++i) { -@@ -382,7 +438,7 @@ + if (this.items[i] == null) { +@@ -390,7 +446,7 @@ } public int getMaxStackSize() { @@ -86,7 +86,7 @@ } public boolean b(Block block) { -@@ -458,6 +514,11 @@ +@@ -466,6 +522,11 @@ } public ItemStack getCarried() { diff --git a/nms-patches/PlayerList.patch b/nms-patches/PlayerList.patch index 58a116d543..eeb0f68dbf 100644 --- a/nms-patches/PlayerList.patch +++ b/nms-patches/PlayerList.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PlayerList.java 2015-02-18 21:30:44.908620069 +0000 -+++ src/main/java/net/minecraft/server/PlayerList.java 2015-02-18 21:30:44.912620069 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/PlayerList.java 2015-02-26 22:40:23.023608135 +0000 ++++ src/main/java/net/minecraft/server/PlayerList.java 2015-02-26 22:40:23.027608135 +0000 @@ -18,6 +18,26 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -27,15 +27,23 @@ public abstract class PlayerList { public static final File a = new File("banned-players.json"); -@@ -27,7 +47,7 @@ - private static final Logger h = LogManager.getLogger(); - private static final SimpleDateFormat i = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z"); +@@ -27,14 +47,14 @@ + private static final Logger f = LogManager.getLogger(); + private static final SimpleDateFormat g = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z"); private final MinecraftServer server; -- public final List players = Lists.newArrayList(); -+ public final List players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety - public final Map f = Maps.newHashMap(); +- private final List players = Lists.newArrayList(); ++ public final List players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety, public + private final Map j = Maps.newHashMap(); private final GameProfileBanList k; private final IpBanList l; + private final OpList operators; + private final WhiteList whitelist; + private final Map o; +- private IPlayerFileData playerFileData; ++ public IPlayerFileData playerFileData; // CraftBukkit - public + private boolean hasWhitelist; + protected int maxPlayers; + private int r; @@ -42,7 +62,15 @@ private boolean t; private int u; @@ -48,7 +56,7 @@ + minecraftserver.console = org.bukkit.craftbukkit.command.ColouredConsoleSender.getInstance(); + minecraftserver.reader.addCompleter(new org.bukkit.craftbukkit.command.ConsoleCommandCompleter(minecraftserver.server)); + // CraftBukkit end -+ ++ this.k = new GameProfileBanList(PlayerList.a); this.l = new IpBanList(PlayerList.b); this.operators = new OpList(PlayerList.c); @@ -69,9 +77,9 @@ s1 = networkmanager.getSocketAddress().toString(); } -- PlayerList.h.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); +- PlayerList.f.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); + // CraftBukkit - Moved message to after join -+ // PlayerList.h.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); ++ // PlayerList.f.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at (" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); WorldData worlddata = worldserver.getWorldData(); BlockPosition blockposition = worldserver.getSpawn(); @@ -86,7 +94,7 @@ @@ -89,17 +125,23 @@ entityplayer.getStatisticManager().updateStatistics(entityplayer); this.sendScoreboard((ScoreboardServer) worldserver.getScoreboard(), entityplayer); - this.server.aF(); + this.server.aG(); - ChatMessage chatmessage; + // CraftBukkit start - login message is handled in the event + // ChatMessage chatmessage; @@ -113,24 +121,28 @@ playerconnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); this.b(entityplayer, worldserver); if (this.server.getResourcePack().length() > 0) { -@@ -126,6 +168,8 @@ +@@ -126,9 +168,11 @@ } } + // CraftBukkit - Moved from above, added world -+ PlayerList.h.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at ([" + entityplayer.world.worldData.getName() + "] " + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); ++ PlayerList.f.info(entityplayer.getName() + "[" + s1 + "] logged in with entity id " + entityplayer.getId() + " at ([" + entityplayer.world.worldData.getName() + "]" + entityplayer.locX + ", " + entityplayer.locY + ", " + entityplayer.locZ + ")"); } - public void sendScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) { +- protected void sendScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) { ++ public void sendScoreboard(ScoreboardServer scoreboardserver, EntityPlayer entityplayer) { // CraftBukkit - public + HashSet hashset = Sets.newHashSet(); + Iterator iterator = scoreboardserver.getTeams().iterator(); + @@ -158,6 +202,7 @@ } public void setPlayerFileData(WorldServer[] aworldserver) { + if (playerFileData != null) return; // CraftBukkit this.playerFileData = aworldserver[0].getDataManager().getPlayerFileData(); - aworldserver[0].af().a((IWorldBorderListener) (new WorldBorderListener(this))); - } -@@ -178,7 +223,7 @@ + aworldserver[0].getWorldBorder().a(new IWorldBorderListener() { + public void a(WorldBorder worldborder, double d0) { +@@ -202,7 +247,7 @@ } public NBTTagCompound a(EntityPlayer entityplayer) { @@ -139,16 +151,16 @@ NBTTagCompound nbttagcompound1; if (entityplayer.getName().equals(this.server.R()) && nbttagcompound != null) { -@@ -202,33 +247,72 @@ +@@ -226,33 +271,72 @@ } - public void onPlayerJoin(EntityPlayer entityplayer) { + public void onPlayerJoin(EntityPlayer entityplayer, String joinMessage) { // CraftBukkit added param this.players.add(entityplayer); - this.f.put(entityplayer.getUniqueID(), entityplayer); -- this.sendAll(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer})); -+ // this.sendAll(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer})); // CraftBukkit - replaced with loop below + this.j.put(entityplayer.getUniqueID(), entityplayer); +- this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer})); ++ // this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer})); // CraftBukkit - replaced with loop below WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); - worldserver.addEntity(entityplayer); @@ -166,10 +178,10 @@ + } + + ChunkIOExecutor.adjustPoolSize(getPlayerCount()); -+ // CraftBukkit end ++ // CraftBukkit end + + // CraftBukkit start - sendAll above replaced with this loop -+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, entityplayer); ++ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, entityplayer); for (int i = 0; i < this.players.size(); ++i) { EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i); @@ -182,7 +194,7 @@ + continue; + } + - entityplayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer1})); + entityplayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer1})); } + // CraftBukkit end @@ -209,30 +221,30 @@ + cserver.getPluginManager().callEvent(playerQuitEvent); + entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); + // CraftBukkit end -+ ++ this.savePlayerFile(entityplayer); WorldServer worldserver = entityplayer.u(); - if (entityplayer.vehicle != null) { + if (entityplayer.vehicle != null && !(entityplayer.vehicle instanceof EntityPlayer)) { // CraftBukkit - Don't remove players worldserver.removeEntity(entityplayer.vehicle); - PlayerList.h.debug("removing player mount"); + PlayerList.f.debug("removing player mount"); } -@@ -238,13 +322,61 @@ - this.players.remove(entityplayer); - this.f.remove(entityplayer.getUniqueID()); - this.o.remove(entityplayer.getUniqueID()); -- this.sendAll(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[] { entityplayer})); +@@ -268,13 +352,61 @@ + this.o.remove(uuid); + } + +- this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[] { entityplayer})); + // CraftBukkit start + // this.sendAll(new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[] { entityplayer})); -+ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(EnumPlayerInfoAction.REMOVE_PLAYER, entityplayer); ++ PacketPlayOutPlayerInfo packet = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, entityplayer); + for (int i = 0; i < players.size(); i++) { -+ EntityPlayer entityplayer1 = (EntityPlayer) this.players.get(i); ++ EntityPlayer entityplayer2 = (EntityPlayer) this.players.get(i); + -+ if (entityplayer1.getBukkitEntity().canSee(entityplayer.getBukkitEntity())) { -+ entityplayer1.playerConnection.sendPacket(packet); ++ if (entityplayer2.getBukkitEntity().canSee(entityplayer.getBukkitEntity())) { ++ entityplayer2.playerConnection.sendPacket(packet); + } else { -+ entityplayer1.getBukkitEntity().removeDisconnectingPlayer(entityplayer.getBukkitEntity()); ++ entityplayer2.getBukkitEntity().removeDisconnectingPlayer(entityplayer.getBukkitEntity()); + } + } + // This removes the scoreboard (and player reference) for the specific player in the manager @@ -267,7 +279,7 @@ + savePlayerFile(entityplayer); // CraftBukkit - Force the player's inventory to be saved + entityplayer.playerConnection.disconnect("You logged in from another location"); + } -+ ++ + // Instead of kicking then returning, we need to store the kick reason + // in the event, check with plugins to see if it's ok, and THEN kick + // depending on the outcome. @@ -283,8 +295,8 @@ GameProfileBanEntry gameprofilebanentry = (GameProfileBanEntry) this.k.get(gameprofile); s = "You are banned from this server!\nReason: " + gameprofilebanentry.getReason(); -@@ -252,10 +384,12 @@ - s = s + "\nYour ban will be removed on " + PlayerList.i.format(gameprofilebanentry.getExpires()); +@@ -282,10 +414,12 @@ + s = s + "\nYour ban will be removed on " + PlayerList.g.format(gameprofilebanentry.getExpires()); } - return s; @@ -299,8 +311,8 @@ IpBanEntry ipbanentry = this.l.get(socketaddress); s = "Your IP address is banned from this server!\nReason: " + ipbanentry.getReason(); -@@ -263,13 +397,25 @@ - s = s + "\nYour ban will be removed on " + PlayerList.i.format(ipbanentry.getExpires()); +@@ -293,13 +427,25 @@ + s = s + "\nYour ban will be removed on " + PlayerList.g.format(ipbanentry.getExpires()); } - return s; @@ -312,13 +324,13 @@ + if (this.players.size() >= this.maxPlayers) { + event.disallow(PlayerLoginEvent.Result.KICK_FULL, "The server is full"); + } -+ } + } + + cserver.getPluginManager().callEvent(event); + if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) { + loginlistener.disconnect(event.getKickMessage()); + return null; - } ++ } + return entity; } @@ -328,26 +340,13 @@ UUID uuid = EntityHuman.a(gameprofile); ArrayList arraylist = Lists.newArrayList(); -@@ -286,9 +432,12 @@ - - while (iterator.hasNext()) { - entityplayer = (EntityPlayer) iterator.next(); -+ savePlayerFile(entityplayer); // CraftBukkit - Force the player's inventory to be saved - entityplayer.playerConnection.disconnect("You logged in from another location"); - } -+ // CraftBukkit end */ - -+ /* CraftBukkit start - Object object; - - if (this.server.W()) { -@@ -298,17 +447,25 @@ +@@ -334,17 +480,25 @@ } return new EntityPlayer(this.server, this.server.getWorldServer(0), gameprofile, (PlayerInteractManager) object); -+ // */ ++ */ + return player; -+ // CraftBukkit end ++ // CraftBukkit end } + // CraftBukkit start @@ -368,16 +367,17 @@ entityplayer.dimension = i; Object object; -@@ -319,80 +476,269 @@ +@@ -355,80 +509,267 @@ } EntityPlayer entityplayer1 = new EntityPlayer(this.server, this.server.getWorldServer(entityplayer.dimension), entityplayer.getProfile(), (PlayerInteractManager) object); +- + // */ + EntityPlayer entityplayer1 = entityplayer; + org.bukkit.World fromWorld = entityplayer.getBukkitEntity().getWorld(); + entityplayer.viewingCredits = false; + // CraftBukkit end - ++ entityplayer1.playerConnection = entityplayer.playerConnection; entityplayer1.copyTo(entityplayer, flag); entityplayer1.d(entityplayer.getId()); @@ -433,10 +433,10 @@ worldserver.chunkProviderServer.getChunkAt((int) entityplayer1.locX >> 4, (int) entityplayer1.locZ >> 4); - while (!worldserver.getCubes(entityplayer1, entityplayer1.getBoundingBox()).isEmpty() && entityplayer1.locY < 256.0D) { -+ while (avoidSuffocation && !worldserver.getCubes(entityplayer1, entityplayer1.getBoundingBox()).isEmpty() && entityplayer1.locY < 256.0D) { // CraftBukkit ++ while (avoidSuffocation && !worldserver.getCubes(entityplayer1, entityplayer1.getBoundingBox()).isEmpty() && entityplayer1.locY < 256.0D) { entityplayer1.setPosition(entityplayer1.locX, entityplayer1.locY + 1.0D, entityplayer1.locZ); } - +- - entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(entityplayer1.dimension, entityplayer1.world.getDifficulty(), entityplayer1.world.getWorldData().getType(), entityplayer1.playerInteractManager.getGameMode())); + // CraftBukkit start + byte actualDimension = (byte) (worldserver.getWorld().getEnvironment().getId()); @@ -449,20 +449,20 @@ blockposition1 = worldserver.getSpawn(); - entityplayer1.playerConnection.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch); + // entityplayer1.playerConnection.a(entityplayer1.locX, entityplayer1.locY, entityplayer1.locZ, entityplayer1.yaw, entityplayer1.pitch); -+ // CraftBukkit end entityplayer1.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(blockposition1)); entityplayer1.playerConnection.sendPacket(new PacketPlayOutExperience(entityplayer1.exp, entityplayer1.expTotal, entityplayer1.expLevel)); this.b(entityplayer1, worldserver); - worldserver.getPlayerChunkMap().addPlayer(entityplayer1); - worldserver.addEntity(entityplayer1); - this.players.add(entityplayer1); -- this.f.put(entityplayer1.getUniqueID(), entityplayer1); +- this.j.put(entityplayer1.getUniqueID(), entityplayer1); - entityplayer1.syncInventory(); ++ + if (!entityplayer.playerConnection.isDisconnected()) { + worldserver.getPlayerChunkMap().addPlayer(entityplayer1); + worldserver.addEntity(entityplayer1); + this.players.add(entityplayer1); -+ this.f.put(entityplayer1.getUniqueID(), entityplayer1); ++ this.j.put(entityplayer1.getUniqueID(), entityplayer1); + } + // Added from changeDimension + updateClient(entityplayer); // Update health, etc... @@ -487,13 +487,15 @@ + this.savePlayerFile(entityplayer); + } + // CraftBukkit end -+ return entityplayer1; } - public void changeDimension(EntityPlayer entityplayer, int i) { - int j = entityplayer.dimension; - WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension); +- +- entityplayer.dimension = i; +- WorldServer worldserver1 = this.server.getWorldServer(entityplayer.dimension); + // CraftBukkit start - Replaced the standard handling of portals with a more customised method. + public void changeDimension(EntityPlayer entityplayer, int i, TeleportCause cause) { + WorldServer exitWorld = null; @@ -506,8 +508,16 @@ + } + } -- entityplayer.dimension = i; -- WorldServer worldserver1 = this.server.getWorldServer(entityplayer.dimension); +- entityplayer.playerConnection.sendPacket(new PacketPlayOutRespawn(entityplayer.dimension, entityplayer.world.getDifficulty(), entityplayer.world.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode())); +- worldserver.removeEntity(entityplayer); +- entityplayer.dead = false; +- this.changeWorld(entityplayer, j, worldserver, worldserver1); +- this.a(entityplayer, worldserver); +- entityplayer.playerConnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); +- entityplayer.playerInteractManager.a(worldserver1); +- this.b(entityplayer, worldserver1); +- this.updateClient(entityplayer); +- Iterator iterator = entityplayer.getEffects().iterator(); + Location enter = entityplayer.getBukkitEntity().getLocation(); + Location exit = null; + boolean useTravelAgent = false; // don't use agent for custom worlds or return from THE_END @@ -525,16 +535,8 @@ + } + } -- entityplayer.playerConnection.sendPacket(new PacketPlayOutRespawn(entityplayer.dimension, entityplayer.world.getDifficulty(), entityplayer.world.getWorldData().getType(), entityplayer.playerInteractManager.getGameMode())); -- worldserver.removeEntity(entityplayer); -- entityplayer.dead = false; -- this.changeWorld(entityplayer, j, worldserver, worldserver1); -- this.a(entityplayer, worldserver); -- entityplayer.playerConnection.a(entityplayer.locX, entityplayer.locY, entityplayer.locZ, entityplayer.yaw, entityplayer.pitch); -- entityplayer.playerInteractManager.a(worldserver1); -- this.b(entityplayer, worldserver1); -- this.updateClient(entityplayer); -- Iterator iterator = entityplayer.getEffects().iterator(); +- while (iterator.hasNext()) { +- MobEffect mobeffect = (MobEffect) iterator.next(); + TravelAgent agent = exit != null ? (TravelAgent) ((CraftWorld) exit.getWorld()).getHandle().getTravelAgent() : 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); @@ -542,11 +544,12 @@ + if (event.isCancelled() || event.getTo() == null) { + return; + } -+ + +- entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobeffect)); + exit = event.useTravelAgent() ? event.getPortalTravelAgent().findOrCreate(event.getTo()) : event.getTo(); + if (exit == null) { + return; -+ } + } + exitWorld = ((CraftWorld) exit.getWorld()).getHandle(); + + Vector velocity = entityplayer.getBukkitEntity().getVelocity(); @@ -554,16 +557,14 @@ + exitWorld.chunkProviderServer.forceChunkLoad = true; + exitWorld.getTravelAgent().adjustExit(entityplayer, exit, velocity); + 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 + if (entityplayer.motX != velocity.getX() || entityplayer.motY != velocity.getY() || entityplayer.motZ != velocity.getZ()) { + entityplayer.getBukkitEntity().setVelocity(velocity); + } -+ } + } -- while (iterator.hasNext()) { -- MobEffect mobeffect = (MobEffect) iterator.next(); -+ public void changeWorld(Entity entity, int i, WorldServer worldserver, WorldServer worldserver1) { + public void changeWorld(Entity entity, int i, WorldServer worldserver, WorldServer worldserver1) { + // CraftBukkit start - Split into modular functions + Location exit = calculateTarget(entity.getBukkitEntity().getLocation(), worldserver1); + repositionEntity(entity, exit, true); @@ -590,8 +591,8 @@ + worldserver.methodProfiler.a("moving"); + */ + if (worldserver1.dimension == -1) { -+ d0 = MathHelper.a(d0 / d2, worldserver1.af().b() + 16.0D, worldserver1.af().d() - 16.0D); -+ d1 = MathHelper.a(d1 / d2, worldserver1.af().c() + 16.0D, worldserver1.af().e() - 16.0D); ++ d0 = MathHelper.a(d0 / d2, worldserver1.getWorldBorder().b()+ 16.0D, worldserver1.getWorldBorder().d() - 16.0D); ++ d1 = MathHelper.a(d1 / d2, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D); + /* + entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch); + if (entity.isAlive()) { @@ -599,8 +600,8 @@ + } + */ + } else if (worldserver1.dimension == 0) { -+ d0 = MathHelper.a(d0 * d2, worldserver1.af().b() + 16.0D, worldserver1.af().d() - 16.0D); -+ d1 = MathHelper.a(d1 * d2, worldserver1.af().c() + 16.0D, worldserver1.af().e() - 16.0D); ++ d0 = MathHelper.a(d0 * d2, worldserver1.getWorldBorder().b() + 16.0D, worldserver1.getWorldBorder().d() - 16.0D); ++ d1 = MathHelper.a(d1 * d2, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D); + /* + entity.setPositionRotation(d0, entity.locY, d1, entity.yaw, entity.pitch); + if (entity.isAlive()) { @@ -641,17 +642,15 @@ + worldserver1.addEntity(entity); + worldserver1.entityJoinedWorld(entity, false); + } - -- entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobeffect)); ++ + worldserver.methodProfiler.b(); + */ - } - ++ } ++ + // entity.spawnIn(worldserver1); + return new Location(worldserver1.getWorld(), d0, y, d1, yaw, pitch); - } - -- public void changeWorld(Entity entity, int i, WorldServer worldserver, WorldServer worldserver1) { ++ } ++ + // copy of original a(Entity, int, WorldServer, WorldServer) method with only entity repositioning logic + public void repositionEntity(Entity entity, Location exit, boolean portal) { + WorldServer worldserver = (WorldServer) entity.world; @@ -672,9 +671,9 @@ + } + /* if (entity.dimension == -1) { - d0 = MathHelper.a(d0 / d2, worldserver1.af().b() + 16.0D, worldserver1.af().d() - 16.0D); - d1 = MathHelper.a(d1 / d2, worldserver1.af().c() + 16.0D, worldserver1.af().e() - 16.0D); -@@ -411,6 +757,8 @@ + d0 = MathHelper.a(d0 / d2, worldserver1.getWorldBorder().b() + 16.0D, worldserver1.getWorldBorder().d() - 16.0D); + d1 = MathHelper.a(d1 / d2, worldserver1.getWorldBorder().c() + 16.0D, worldserver1.getWorldBorder().e() - 16.0D); +@@ -447,6 +788,8 @@ BlockPosition blockposition; if (i == 1) { @@ -683,7 +682,7 @@ blockposition = worldserver1.getSpawn(); } else { blockposition = worldserver1.getDimensionSpawn(); -@@ -424,15 +772,26 @@ +@@ -460,15 +803,26 @@ worldserver.entityJoinedWorld(entity, false); } } @@ -712,7 +711,7 @@ worldserver1.addEntity(entity); worldserver1.entityJoinedWorld(entity, false); } -@@ -441,6 +800,7 @@ +@@ -477,6 +831,7 @@ } entity.spawnIn(worldserver1); @@ -720,7 +719,7 @@ } public void tick() { -@@ -458,6 +818,15 @@ +@@ -494,6 +849,15 @@ } @@ -736,7 +735,7 @@ public void a(Packet packet, int i) { for (int j = 0; j < this.players.size(); ++j) { EntityPlayer entityplayer = (EntityPlayer) this.players.get(j); -@@ -549,10 +918,24 @@ +@@ -589,10 +953,24 @@ public void addOp(GameProfile gameprofile) { this.operators.add(new OpListEntry(gameprofile, this.server.p())); @@ -761,7 +760,7 @@ } public boolean isWhitelisted(GameProfile gameprofile) { -@@ -560,7 +943,7 @@ +@@ -600,7 +978,7 @@ } public boolean isOp(GameProfile gameprofile) { @@ -770,7 +769,7 @@ } public EntityPlayer getPlayer(String s) { -@@ -587,6 +970,12 @@ +@@ -627,6 +1005,12 @@ for (int j = 0; j < this.players.size(); ++j) { EntityPlayer entityplayer = (EntityPlayer) this.players.get(j); @@ -783,14 +782,14 @@ if (entityplayer != entityhuman && entityplayer.dimension == i) { double d4 = d0 - entityplayer.locX; double d5 = d1 - entityplayer.locY; -@@ -634,21 +1023,26 @@ +@@ -674,21 +1058,26 @@ public void reloadWhitelist() {} public void b(EntityPlayer entityplayer, WorldServer worldserver) { -- WorldBorder worldborder = this.server.worldServer[0].af(); -+ WorldBorder worldborder = entityplayer.world.af(); // CraftBukkit +- WorldBorder worldborder = this.server.worldServer[0].getWorldBorder(); ++ WorldBorder worldborder = entityplayer.world.getWorldBorder(); // CraftBukkit - entityplayer.playerConnection.sendPacket(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.INITIALIZE)); + entityplayer.playerConnection.sendPacket(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.INITIALIZE)); entityplayer.playerConnection.sendPacket(new PacketPlayOutUpdateTime(worldserver.getTime(), worldserver.getDayTime(), worldserver.getGameRules().getBoolean("doDaylightCycle"))); if (worldserver.S()) { - entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(1, 0.0F)); @@ -815,7 +814,7 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex)); } -@@ -661,7 +1055,7 @@ +@@ -701,7 +1090,7 @@ } public String[] getSeenPlayers() { @@ -824,23 +823,24 @@ } public boolean getHasWhitelist() { -@@ -711,16 +1105,25 @@ +@@ -751,16 +1140,26 @@ - public void v() { + public void u() { for (int i = 0; i < this.players.size(); ++i) { - ((EntityPlayer) this.players.get(i)).playerConnection.disconnect("Server closed"); + ((EntityPlayer) this.players.get(i)).playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message } -+ } + + } + // CraftBukkit start + public void sendMessage(IChatBaseComponent[] iChatBaseComponents) { + for (IChatBaseComponent component : iChatBaseComponents) { + sendMessage(component, true); + } - } ++ } + // CraftBukkit end - ++ public void sendMessage(IChatBaseComponent ichatbasecomponent, boolean flag) { this.server.sendMessage(ichatbasecomponent); int i = flag ? 1 : 0; @@ -852,13 +852,10 @@ } public void sendMessage(IChatBaseComponent ichatbasecomponent) { -@@ -754,11 +1157,10 @@ - public void a(int i) { - this.r = i; - if (this.server.worldServer != null) { -- WorldServer[] aworldserver = this.server.worldServer; -- int j = aworldserver.length; -- +@@ -797,8 +1196,10 @@ + WorldServer[] aworldserver = this.server.worldServer; + int j = aworldserver.length; + - for (int k = 0; k < j; ++k) { - WorldServer worldserver = aworldserver[k]; + // CraftBukkit start diff --git a/nms-patches/PlayerSelector.patch b/nms-patches/PlayerSelector.patch deleted file mode 100644 index c0b028ba7c..0000000000 --- a/nms-patches/PlayerSelector.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/PlayerSelector.java 2014-12-11 20:04:51.273619960 +0000 -+++ src/main/java/net/minecraft/server/PlayerSelector.java 2014-12-11 20:03:19.893620952 +0000 -@@ -97,7 +97,7 @@ - if (h(map)) { - arraylist.add(icommandlistener.getWorld()); - } else { -- Collections.addAll(arraylist, MinecraftServer.getServer().worldServer); -+ arraylist.addAll(MinecraftServer.getServer().worlds); // CraftBukkit - } - - return arraylist; diff --git a/nms-patches/PortalCreator.patch b/nms-patches/PortalCreator.patch deleted file mode 100644 index d9436a0652..0000000000 --- a/nms-patches/PortalCreator.patch +++ /dev/null @@ -1,102 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PortalCreator.java 2014-11-28 17:43:43.341707430 +0000 -+++ src/main/java/net/minecraft/server/PortalCreator.java 2014-11-28 17:38:22.000000000 +0000 -@@ -1,5 +1,7 @@ - package net.minecraft.server; - -+import org.bukkit.event.world.PortalCreateEvent; // CraftBukkit -+ - public class PortalCreator { - - private final World a; -@@ -10,6 +12,7 @@ - private BlockPosition f; - private int g; - private int h; -+ java.util.Collection blocks = new java.util.HashSet(); // CraftBukkit - add field - - public PortalCreator(World world, BlockPosition blockposition, EnumAxis enumaxis) { - this.a = world; -@@ -60,6 +63,10 @@ - } - - protected int a() { -+ // CraftBukkit start -+ this.blocks.clear(); -+ org.bukkit.World bworld = this.a.getWorld(); -+ // CraftBukkit end - int i; - - label56: -@@ -80,11 +87,21 @@ - block = this.a.getType(blockposition.shift(this.d)).getBlock(); - if (block != Blocks.OBSIDIAN) { - break label56; -+ // CraftBukkit start - add the block to our list -+ } else { -+ BlockPosition pos = blockposition.shift(this.d); -+ blocks.add(bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ())); -+ // CraftBukkit end - } - } else if (i == this.h - 1) { - block = this.a.getType(blockposition.shift(this.c)).getBlock(); - if (block != Blocks.OBSIDIAN) { - break label56; -+ // CraftBukkit start - add the block to our list -+ } else { -+ BlockPosition pos = blockposition.shift(this.c); -+ blocks.add(bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ())); -+ // CraftBukkit end - } - } - } -@@ -94,6 +111,11 @@ - if (this.a.getType(this.f.shift(this.c, i).up(this.g)).getBlock() != Blocks.OBSIDIAN) { - this.g = 0; - break; -+ // CraftBukkit start - add the block to our list -+ } else { -+ BlockPosition pos = this.f.shift(this.c, i).up(this.g); -+ blocks.add(bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ())); -+ // CraftBukkit end - } - } - -@@ -115,15 +137,36 @@ - return this.f != null && this.h >= 2 && this.h <= 21 && this.g >= 3 && this.g <= 21; - } - -- public void c() { -+ // CraftBukkit start - return boolean -+ public boolean c() { -+ org.bukkit.World bworld = this.a.getWorld(); -+ -+ // Copy below for loop - for (int i = 0; i < this.h; ++i) { - BlockPosition blockposition = this.f.shift(this.c, i); - - for (int j = 0; j < this.g; ++j) { -- this.a.setTypeAndData(blockposition.up(j), Blocks.PORTAL.getBlockData().set(BlockPortal.AXIS, this.b), 2); -+ BlockPosition pos = blockposition.up(j); -+ blocks.add(bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ())); - } - } - -+ PortalCreateEvent event = new PortalCreateEvent(blocks, bworld, PortalCreateEvent.CreateReason.FIRE); -+ this.a.getServer().getPluginManager().callEvent(event); -+ -+ if (event.isCancelled()) { -+ return false; -+ } -+ // CraftBukkit end -+ for (int i = 0; i < this.h; ++i) { -+ BlockPosition blockposition = this.f.shift(this.c, i); -+ -+ for (int j = 0; j < this.g; ++j) { -+ this.a.setTypeAndData(blockposition.up(j), Blocks.PORTAL.getBlockData().set(BlockPortal.AXIS, this.b), 2); -+ } -+ } -+ -+ return true; // Craft Bukkit - } - - public static int a(PortalCreator portalcreator) { diff --git a/nms-patches/PortalTravelAgent.patch b/nms-patches/PortalTravelAgent.patch index e33d0809d3..43fa3a29c2 100644 --- a/nms-patches/PortalTravelAgent.patch +++ b/nms-patches/PortalTravelAgent.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PortalTravelAgent.java 2014-11-28 17:43:43.341707430 +0000 -+++ src/main/java/net/minecraft/server/PortalTravelAgent.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/PortalTravelAgent.java 2015-03-04 09:48:49.303820658 +0000 ++++ src/main/java/net/minecraft/server/PortalTravelAgent.java 2015-03-04 09:48:49.311820658 +0000 @@ -5,6 +5,12 @@ import java.util.List; import java.util.Random; @@ -13,7 +13,7 @@ public class PortalTravelAgent { private final WorldServer a; -@@ -27,8 +33,21 @@ +@@ -27,6 +33,19 @@ int i = MathHelper.floor(entity.locX); int j = MathHelper.floor(entity.locY) - 1; int k = MathHelper.floor(entity.locZ); @@ -29,12 +29,10 @@ + int i = MathHelper.floor(x); + int j = MathHelper.floor(y) - 1; + int k = MathHelper.floor(z); ++ // CraftBukkit end byte b0 = 1; byte b1 = 0; -+ // CraftBukkit end - for (int l = -2; l <= 2; ++l) { - for (int i1 = -2; i1 <= 2; ++i1) { @@ -43,16 +62,63 @@ } } @@ -105,7 +103,7 @@ Object object = BlockPosition.ZERO; long k = ChunkCoordIntPair.a(i, j); @@ -65,7 +131,7 @@ - chunkcoordinatesportal.b = this.a.getTime(); + portaltravelagent_chunkcoordinatesportal.c = this.a.getTime(); flag1 = false; } else { - BlockPosition blockposition = new BlockPosition(entity); @@ -113,8 +111,8 @@ for (int l = -128; l <= 128; ++l) { BlockPosition blockposition1; -@@ -95,7 +161,29 @@ - this.c.put(k, new ChunkCoordinatesPortal(this, (BlockPosition) object, this.a.getTime())); +@@ -95,6 +161,29 @@ + this.c.put(k, new PortalTravelAgent.ChunkCoordinatesPortal((BlockPosition) object, this.a.getTime())); this.d.add(Long.valueOf(k)); } + // CraftBukkit start - Move entity teleportation logic into exit @@ -123,7 +121,7 @@ + return null; + } + } - ++ + // Entity repositioning logic split out from original b method and combined with repositioning logic for The End from original a method + public void adjustExit(Entity entity, Location position, Vector velocity) { + Location from = position.clone(); @@ -131,7 +129,7 @@ + BlockPosition object = new BlockPosition(position.getBlockX(), position.getBlockY(), position.getBlockZ()); + float f = position.getYaw(); + -+ if (this.a.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END) { ++ if (this.a.getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END || entity.getBukkitEntity().getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END) { + // entity.setPositionRotation((double) i, (double) j, (double) k, entity.yaw, 0.0F); + // entity.motX = entity.motY = entity.motZ = 0.0D; + position.setPitch(0.0F); @@ -140,37 +138,32 @@ + velocity.setZ(0); + } else { + // CraftBukkit end + double d2 = (double) ((BlockPosition) object).getX() + 0.5D; double d3 = (double) ((BlockPosition) object).getY() + 0.5D; - double d4 = (double) ((BlockPosition) object).getZ() + 0.5D; -@@ -170,21 +258,46 @@ - f6 = 1.0F; - } - -- double d5 = entity.motX; -- double d6 = entity.motZ; -- -- entity.motX = d5 * (double) f3 + d6 * (double) f6; -- entity.motZ = d5 * (double) f5 + d6 * (double) f4; -- entity.yaw = f - (float) (enumdirection1.b() * 90) + (float) (enumdirection.b() * 90); -+ // CraftBukkit start -+ double d5 = velocity.getX(); -+ double d6 = velocity.getZ(); -+ // CraftBukkit end -+ -+ // CraftBukkit start - Adjust position and velocity instances instead of entity -+ velocity.setX(d5 * (double) f3 + d6 * (double) f6); -+ velocity.setZ(d5 * (double) f5 + d6 * (double) f4); -+ f = f - (float) (enumdirection1.b() * 90) + (float) (enumdirection.b() * 90); - } else { -- entity.motX = entity.motY = entity.motZ = 0.0D; -+ velocity.setX(0); -+ velocity.setY(0); -+ velocity.setZ(0); +@@ -134,26 +223,60 @@ + f3 = -1.0F; + f4 = 1.0F; } - +- +- double d6 = entity.motX; +- double d7 = entity.motZ; +- +- entity.motX = d6 * (double) f1 + d7 * (double) f4; +- entity.motZ = d6 * (double) f3 + d7 * (double) f2; +- entity.yaw = f - (float) (entity.aH().opposite().b() * 90) + (float) (shapedetector_shapedetectorcollection.b().b() * 90); - entity.setPositionRotation(d2, d3, d4, entity.yaw, entity.pitch); - return true; ++ ++ // CraftBukkit start ++ double d6 = velocity.getX(); ++ double d7 = velocity.getZ(); ++ // CraftBukkit end ++ ++ // CraftBukkit start - Adjust position and velocity instances instead of entity ++ velocity.setX(d6 * (double) f1 + d7 * (double) f4); ++ velocity.setZ(d6 * (double) f3 + d7 * (double) f2); ++ f = f - (float) (entity.aH().opposite().b() * 90) + (float) (shapedetector_shapedetectorcollection.b().b() * 90); + // entity.setPositionRotation(d2, d3, d4, entity.yaw, entity.pitch); + position.setX(d2); + position.setY(d3); @@ -199,10 +192,6 @@ + // CraftBukkit end } - private boolean a(BlockPosition blockposition) { -@@ -192,11 +305,22 @@ - } - public boolean a(Entity entity) { - byte b0 = 16; + // CraftBukkit start - Allow for portal creation to be based on coordinates instead of entity @@ -227,7 +216,7 @@ int l = i; int i1 = j; int j1 = k; -@@ -220,10 +344,10 @@ +@@ -178,10 +301,10 @@ double d4; for (i2 = i - b0; i2 <= i + b0; ++i2) { @@ -240,7 +229,7 @@ label271: for (k2 = this.a.V() - 1; k2 >= 0; --k2) { -@@ -254,7 +378,7 @@ +@@ -213,7 +336,7 @@ } } @@ -249,7 +238,7 @@ d4 = d1 * d1 + d3 * d3 + d2 * d2; if (d0 < 0.0D || d4 < d0) { d0 = d4; -@@ -271,10 +395,10 @@ +@@ -230,10 +353,10 @@ if (d0 < 0.0D) { for (i2 = i - b0; i2 <= i + b0; ++i2) { @@ -262,7 +251,7 @@ label219: for (k2 = this.a.V() - 1; k2 >= 0; --k2) { -@@ -298,7 +422,7 @@ +@@ -258,7 +381,7 @@ } } diff --git a/nms-patches/PropertyManager.patch b/nms-patches/PropertyManager.patch index 542cae57ce..e35d395bba 100644 --- a/nms-patches/PropertyManager.patch +++ b/nms-patches/PropertyManager.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/PropertyManager.java 2014-11-28 17:43:43.345707429 +0000 -+++ src/main/java/net/minecraft/server/PropertyManager.java 2014-11-28 17:38:20.000000000 +0000 -@@ -8,6 +8,8 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/PropertyManager.java 2015-02-26 22:40:23.035608135 +0000 ++++ src/main/java/net/minecraft/server/PropertyManager.java 2015-02-26 22:40:23.039608134 +0000 +@@ -8,10 +8,12 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,12 +9,15 @@ public class PropertyManager { private static final Logger a = LogManager.getLogger(); -@@ -39,8 +41,25 @@ - PropertyManager.a.warn(file + " does not exist"); - this.a(); - } -+ } -+ +- private final Properties properties = new Properties(); ++ public final Properties properties = new Properties(); // CraftBukkit - public + private final File file; + + public PropertyManager(File file) { +@@ -42,6 +44,24 @@ + + } + + // CraftBukkit start + private OptionSet options = null; + @@ -28,14 +31,15 @@ + if ((this.options != null) && (this.options.has(name))) { + return (T) this.options.valueOf(name); + } - ++ + return value; - } ++ } + // CraftBukkit end - ++ public void a() { PropertyManager.a.info("Generating new properties file"); -@@ -51,6 +70,12 @@ + this.savePropertiesFile(); +@@ -51,6 +71,12 @@ FileOutputStream fileoutputstream = null; try { @@ -48,7 +52,7 @@ fileoutputstream = new FileOutputStream(this.file); this.properties.store(fileoutputstream, "Minecraft server properties"); } catch (Exception exception) { -@@ -80,36 +105,36 @@ +@@ -80,36 +106,36 @@ this.savePropertiesFile(); } @@ -76,14 +80,14 @@ this.properties.setProperty(s, "" + i); this.savePropertiesFile(); - return i; -+ return getOverride(s ,i); // CraftBukkit ++ return getOverride(s, i); // CraftBukkit } } public boolean getBoolean(String s, boolean flag) { try { - return Boolean.parseBoolean(this.getString(s, "" + flag)); -+ return getOverride(s, Boolean.parseBoolean(this.getString(s, "" + flag))); // CraftBukkit ++ return getOverride(s, Boolean.parseBoolean(this.getString(s, "" + flag))); //CraftBukkit } catch (Exception exception) { this.properties.setProperty(s, "" + flag); this.savePropertiesFile(); diff --git a/nms-patches/RecipeArmorDye.patch b/nms-patches/RecipeArmorDye.patch index 3c3ba504d0..7cd3c92f5a 100644 --- a/nms-patches/RecipeArmorDye.patch +++ b/nms-patches/RecipeArmorDye.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/RecipeArmorDye.java 2014-11-28 17:43:43.345707429 +0000 -+++ src/main/java/net/minecraft/server/RecipeArmorDye.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/RecipeArmorDye.java 2015-02-26 22:40:23.039608134 +0000 ++++ src/main/java/net/minecraft/server/RecipeArmorDye.java 2015-02-26 22:40:23.039608134 +0000 @@ -3,9 +3,13 @@ import com.google.common.collect.Lists; import java.util.ArrayList; diff --git a/nms-patches/RecipeBookClone.patch b/nms-patches/RecipeBookClone.patch index 2642829096..9fa2edba0d 100644 --- a/nms-patches/RecipeBookClone.patch +++ b/nms-patches/RecipeBookClone.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/RecipeBookClone.java 2014-11-28 17:43:43.349707429 +0000 -+++ src/main/java/net/minecraft/server/RecipeBookClone.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/RecipeBookClone.java 2015-02-26 22:40:23.043608134 +0000 ++++ src/main/java/net/minecraft/server/RecipeBookClone.java 2015-02-26 22:40:23.043608134 +0000 @@ -1,8 +1,12 @@ package net.minecraft.server; diff --git a/nms-patches/RecipeFireworks.patch b/nms-patches/RecipeFireworks.patch index fd54312ceb..39d46e8cdb 100644 --- a/nms-patches/RecipeFireworks.patch +++ b/nms-patches/RecipeFireworks.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/RecipeFireworks.java 2014-11-28 17:43:43.349707429 +0000 -+++ src/main/java/net/minecraft/server/RecipeFireworks.java 2014-11-28 17:38:17.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/RecipeFireworks.java 2015-02-26 22:40:23.047608134 +0000 ++++ src/main/java/net/minecraft/server/RecipeFireworks.java 2015-02-26 22:40:23.047608134 +0000 @@ -3,11 +3,15 @@ import com.google.common.collect.Lists; import java.util.ArrayList; @@ -8,9 +8,8 @@ +public class RecipeFireworks extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends private ItemStack a; -- + - public RecipeFireworks() {} -+ + // CraftBukkit start - Delegate to new parent class with bogus info + public RecipeFireworks() { + super(new ItemStack(Items.FIREWORKS, 0, 0), java.util.Arrays.asList(new ItemStack(Items.GUNPOWDER, 0, 5))); diff --git a/nms-patches/RecipeMapClone.patch b/nms-patches/RecipeMapClone.patch index 65c1587ff0..ebe344d7ea 100644 --- a/nms-patches/RecipeMapClone.patch +++ b/nms-patches/RecipeMapClone.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/RecipeMapClone.java 2014-11-28 17:43:43.353707429 +0000 -+++ src/main/java/net/minecraft/server/RecipeMapClone.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/RecipeMapClone.java 2015-02-26 22:40:23.051608134 +0000 ++++ src/main/java/net/minecraft/server/RecipeMapClone.java 2015-02-26 22:40:23.051608134 +0000 @@ -1,8 +1,12 @@ package net.minecraft.server; diff --git a/nms-patches/RecipeRepair.patch b/nms-patches/RecipeRepair.patch index 9b81794569..64b19b3e32 100644 --- a/nms-patches/RecipeRepair.patch +++ b/nms-patches/RecipeRepair.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/RecipeRepair.java 2014-11-28 17:43:43.357707429 +0000 -+++ src/main/java/net/minecraft/server/RecipeRepair.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/RecipeRepair.java 2015-02-26 22:40:23.051608134 +0000 ++++ src/main/java/net/minecraft/server/RecipeRepair.java 2015-02-26 22:40:23.055608134 +0000 @@ -3,9 +3,13 @@ import com.google.common.collect.Lists; import java.util.ArrayList; @@ -16,13 +16,11 @@ public boolean a(InventoryCrafting inventorycrafting, World world) { ArrayList arraylist = Lists.newArrayList(); -@@ -61,8 +65,18 @@ - if (i1 < 0) { +@@ -62,7 +66,17 @@ i1 = 0; } -- + - return new ItemStack(itemstack2.getItem(), 1, i1); -+ + // CraftBukkit start - Construct a dummy repair recipe + ItemStack result = new ItemStack(itemstack.getItem(), 1, i1); + java.util.List ingredients = new ArrayList(); diff --git a/nms-patches/RecipesBanner.patch b/nms-patches/RecipesBanner.patch new file mode 100644 index 0000000000..f84764ebc7 --- /dev/null +++ b/nms-patches/RecipesBanner.patch @@ -0,0 +1,34 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/RecipesBanner.java 2015-02-26 22:40:23.055608134 +0000 ++++ src/main/java/net/minecraft/server/RecipesBanner.java 2015-02-26 22:40:23.055608134 +0000 +@@ -20,9 +20,13 @@ + + static class SyntheticClass_1 { } + +- static class AddRecipe implements IRecipe { ++ static class AddRecipe extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends + +- private AddRecipe() {} ++ // CraftBukkit start - Delegate to new parent class with bogus info ++ private AddRecipe() { ++ super(new ItemStack(Items.BANNER, 0, 0), java.util.Arrays.asList(new ItemStack(Items.BANNER))); ++ } ++ // CraftBukkit end + + public boolean a(InventoryCrafting inventorycrafting, World world) { + boolean flag = false; +@@ -210,9 +214,13 @@ + } + } + +- static class DuplicateRecipe implements IRecipe { ++ static class DuplicateRecipe extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends + +- private DuplicateRecipe() {} ++ // CraftBukkit start - Delegate to new parent class with bogus info ++ private DuplicateRecipe() { ++ super(new ItemStack(Items.BANNER, 0, 0), java.util.Arrays.asList(new ItemStack(Items.DYE, 0, 5))); ++ } ++ // CraftBukkit end + + public boolean a(InventoryCrafting inventorycrafting, World world) { + ItemStack itemstack = null; diff --git a/nms-patches/RecipesBannerInnerClass1.patch b/nms-patches/RecipesBannerInnerClass1.patch deleted file mode 100644 index d605c1423b..0000000000 --- a/nms-patches/RecipesBannerInnerClass1.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/RecipesBannerInnerClass1.java 2014-11-28 17:43:43.357707429 +0000 -+++ src/main/java/net/minecraft/server/RecipesBannerInnerClass1.java 2014-11-28 17:38:17.000000000 +0000 -@@ -1,8 +1,12 @@ - package net.minecraft.server; - --class RecipesBannerInnerClass1 implements IRecipe { -+class RecipesBannerInnerClass1 extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends - -- private RecipesBannerInnerClass1() {} -+ // CraftBukkit start - Delegate to new parent class with bogus info -+ private RecipesBannerInnerClass1() { -+ super(new ItemStack(Items.BANNER, 0, 0), java.util.Arrays.asList(new ItemStack(Items.BANNER))); -+ } -+ // CraftBukkit end - - public boolean a(InventoryCrafting inventorycrafting, World world) { - ItemStack itemstack = null; diff --git a/nms-patches/RecipesBannerInnerClass2.patch b/nms-patches/RecipesBannerInnerClass2.patch deleted file mode 100644 index e0c525e25f..0000000000 --- a/nms-patches/RecipesBannerInnerClass2.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/RecipesBannerInnerClass2.java 2014-11-28 17:43:43.357707429 +0000 -+++ src/main/java/net/minecraft/server/RecipesBannerInnerClass2.java 2014-11-28 17:38:18.000000000 +0000 -@@ -1,8 +1,12 @@ - package net.minecraft.server; - --class RecipesBannerInnerClass2 implements IRecipe { -+class RecipesBannerInnerClass2 extends ShapelessRecipes implements IRecipe { // CraftBukkit - added extends - -- private RecipesBannerInnerClass2() {} -+ // CraftBukkit start - Delegate to new parent class with bogus info -+ private RecipesBannerInnerClass2() { -+ super(new ItemStack(Items.BANNER, 0, 0), java.util.Arrays.asList(new ItemStack(Items.DYE, 0, 5))); -+ } -+ // CraftBukkit end - - public boolean a(InventoryCrafting inventorycrafting, World world) { - boolean flag = false; diff --git a/nms-patches/RecipesFurnace.patch b/nms-patches/RecipesFurnace.patch index 4aaa253439..436ca355c1 100644 --- a/nms-patches/RecipesFurnace.patch +++ b/nms-patches/RecipesFurnace.patch @@ -1,26 +1,36 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/RecipesFurnace.java 2014-11-28 17:43:43.361707429 +0000 -+++ src/main/java/net/minecraft/server/RecipesFurnace.java 2014-11-28 17:38:20.000000000 +0000 -@@ -10,6 +10,7 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/RecipesFurnace.java 2015-02-26 22:40:23.059608134 +0000 ++++ src/main/java/net/minecraft/server/RecipesFurnace.java 2015-02-26 22:40:23.059608134 +0000 +@@ -8,14 +8,15 @@ + public class RecipesFurnace { + private static final RecipesFurnace a = new RecipesFurnace(); - public Map recipes = Maps.newHashMap(); - private Map c = Maps.newHashMap(); +- private Map recipes = Maps.newHashMap(); ++ public Map recipes = Maps.newHashMap(); // CraftBukkit - public + private Map c = Maps.newHashMap(); + public Map customRecipes = Maps.newHashMap(); // CraftBukkit - add field public static RecipesFurnace getInstance() { return RecipesFurnace.a; -@@ -52,6 +53,12 @@ - this.registerRecipe(Blocks.LAPIS_ORE, new ItemStack(Items.DYE, 1, EnumColor.BLUE.getInvColorIndex()), 0.2F); + } + +- private RecipesFurnace() { ++ public RecipesFurnace() { // CraftBukkit - public + this.registerRecipe(Blocks.IRON_ORE, new ItemStack(Items.IRON_INGOT), 0.7F); + this.registerRecipe(Blocks.GOLD_ORE, new ItemStack(Items.GOLD_INGOT), 1.0F); + this.registerRecipe(Blocks.DIAMOND_ORE, new ItemStack(Items.DIAMOND), 1.0F); +@@ -53,6 +54,12 @@ this.registerRecipe(Blocks.QUARTZ_ORE, new ItemStack(Items.QUARTZ), 0.2F); } -+ + + // CraftBukkit start - add method + public void registerRecipe(ItemStack itemstack, ItemStack itemstack1) { + this.customRecipes.put(itemstack, itemstack1); + } + // CraftBukkit end - ++ public void registerRecipe(Block block, ItemStack itemstack, float f) { this.a(Item.getItemOf(block), itemstack, f); + } @@ -67,13 +74,23 @@ } diff --git a/nms-patches/RegionFile.patch b/nms-patches/RegionFile.patch index 68fbd0cb3f..19df82ef9e 100644 --- a/nms-patches/RegionFile.patch +++ b/nms-patches/RegionFile.patch @@ -1,11 +1,9 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/RegionFile.java 2014-11-28 17:43:43.361707429 +0000 -+++ src/main/java/net/minecraft/server/RegionFile.java 2014-11-28 17:38:17.000000000 +0000 -@@ -86,8 +86,46 @@ - } catch (IOException ioexception) { - ioexception.printStackTrace(); - } -+ } -+ +--- /home/matt/mc-dev-private//net/minecraft/server/RegionFile.java 2015-02-26 22:40:23.063608134 +0000 ++++ src/main/java/net/minecraft/server/RegionFile.java 2015-02-26 22:40:23.063608134 +0000 +@@ -90,6 +90,45 @@ + + } + + // CraftBukkit start - This is a copy (sort of) of the method below it, make sure they stay in sync + public synchronized boolean chunkExists(int i, int j) { + if (this.d(i, j)) { @@ -40,42 +38,11 @@ + return false; + } + } - ++ + return false; - } ++ } + // CraftBukkit end - ++ public synchronized DataInputStream a(int i, int j) { if (this.d(i, j)) { -@@ -214,7 +252,7 @@ - - } - -- private void a(int i, byte[] abyte, int j) { -+ private void a(int i, byte[] abyte, int j) throws IOException { // CraftBukkit - added throws - this.c.seek((long) (i * 4096)); - this.c.writeInt(j + 1); - this.c.writeByte(2); -@@ -233,19 +271,19 @@ - return this.e(i, j) != 0; - } - -- private void a(int i, int j, int k) { -+ private void a(int i, int j, int k) throws IOException { // CraftBukkit - added throws - this.d[i + j * 32] = k; - this.c.seek((long) ((i + j * 32) * 4)); - this.c.writeInt(k); - } - -- private void b(int i, int j, int k) { -+ private void b(int i, int j, int k) throws IOException { // CraftBukkit - added throws - this.e[i + j * 32] = k; - this.c.seek((long) (4096 + (i + j * 32) * 4)); - this.c.writeInt(k); - } - -- public void c() { -+ public void c() throws IOException { // CraftBukkit - added throws - if (this.c != null) { - this.c.close(); - } + return null; diff --git a/nms-patches/RemoteControlCommandListener.patch b/nms-patches/RemoteControlCommandListener.patch index 5cb03eeabe..2983751937 100644 --- a/nms-patches/RemoteControlCommandListener.patch +++ b/nms-patches/RemoteControlCommandListener.patch @@ -1,15 +1,15 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/RemoteControlCommandListener.java 2014-11-28 17:43:43.365707429 +0000 -+++ src/main/java/net/minecraft/server/RemoteControlCommandListener.java 2014-11-28 17:38:22.000000000 +0000 -@@ -26,6 +26,12 @@ - public IChatBaseComponent getScoreboardDisplayName() { +--- /home/matt/mc-dev-private//net/minecraft/server/RemoteControlCommandListener.java 2015-02-26 22:40:23.067608134 +0000 ++++ src/main/java/net/minecraft/server/RemoteControlCommandListener.java 2015-02-26 22:40:23.067608134 +0000 +@@ -27,6 +27,12 @@ return new ChatComponentText(this.getName()); } -+ + + // CraftBukkit start - Send a String + public void sendMessage(String message) { + this.b.append(message); + } + // CraftBukkit end - ++ public void sendMessage(IChatBaseComponent ichatbasecomponent) { this.b.append(ichatbasecomponent.c()); + } diff --git a/nms-patches/ScoreboardServer.patch b/nms-patches/ScoreboardServer.patch index 1e5b822767..3d927cdfda 100644 --- a/nms-patches/ScoreboardServer.patch +++ b/nms-patches/ScoreboardServer.patch @@ -1,11 +1,11 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ScoreboardServer.java 2014-11-28 17:43:43.369707429 +0000 -+++ src/main/java/net/minecraft/server/ScoreboardServer.java 2014-11-28 17:38:17.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ScoreboardServer.java 2015-02-26 22:40:23.071608134 +0000 ++++ src/main/java/net/minecraft/server/ScoreboardServer.java 2015-02-26 22:40:23.071608134 +0000 @@ -21,7 +21,7 @@ public void handleScoreChanged(ScoreboardScore scoreboardscore) { super.handleScoreChanged(scoreboardscore); if (this.b.contains(scoreboardscore.getObjective())) { - this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardScore(scoreboardscore)); -+ this.sendAll(new PacketPlayOutScoreboardScore(scoreboardscore)); // CraftBukkit - Internal packet method ++ this.sendAll(new PacketPlayOutScoreboardScore(scoreboardscore)); } this.b(); @@ -14,14 +14,14 @@ public void handlePlayerRemoved(String s) { super.handlePlayerRemoved(s); - this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardScore(s)); -+ this.sendAll(new PacketPlayOutScoreboardScore(s)); // CraftBukkit - Internal packet method ++ this.sendAll(new PacketPlayOutScoreboardScore(s)); this.b(); } public void a(String s, ScoreboardObjective scoreboardobjective) { super.a(s, scoreboardobjective); - this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardScore(s, scoreboardobjective)); -+ this.sendAll(new PacketPlayOutScoreboardScore(s, scoreboardobjective)); // CraftBukkit - Internal packet method ++ this.sendAll(new PacketPlayOutScoreboardScore(s, scoreboardobjective)); this.b(); } @@ -30,7 +30,7 @@ if (scoreboardobjective1 != scoreboardobjective && scoreboardobjective1 != null) { if (this.h(scoreboardobjective1) > 0) { - this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective)); -+ this.sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective)); // CraftBukkit - Internal packet method ++ this.sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective)); } else { this.g(scoreboardobjective1); } @@ -39,7 +39,7 @@ if (scoreboardobjective != null) { if (this.b.contains(scoreboardobjective)) { - this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective)); -+ this.sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective)); // CraftBukkit - Internal packet method ++ this.sendAll(new PacketPlayOutScoreboardDisplayObjective(i, scoreboardobjective)); } else { this.e(scoreboardobjective); } @@ -48,7 +48,7 @@ ScoreboardTeam scoreboardteam = this.getTeam(s1); - this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(new String[] { s}), 3)); -+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(new String[] { s}), 3)); // CraftBukkit - Internal packet method ++ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(new String[] { s}), 3)); this.b(); return true; } else { @@ -57,7 +57,7 @@ public void removePlayerFromTeam(String s, ScoreboardTeam scoreboardteam) { super.removePlayerFromTeam(s, scoreboardteam); - this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(new String[] { s}), 4)); -+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(new String[] { s}), 4)); // CraftBukkit - Internal packet method ++ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, Arrays.asList(new String[] { s}), 4)); this.b(); } @@ -66,7 +66,7 @@ super.handleObjectiveChanged(scoreboardobjective); if (this.b.contains(scoreboardobjective)) { - this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2)); -+ this.sendAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2)); // CraftBukkit - Internal packet method ++ this.sendAll(new PacketPlayOutScoreboardObjective(scoreboardobjective, 2)); } this.b(); @@ -75,21 +75,21 @@ public void handleTeamAdded(ScoreboardTeam scoreboardteam) { super.handleTeamAdded(scoreboardteam); - this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 0)); -+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 0)); // CraftBukkit - Internal packet method ++ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 0)); this.b(); } public void handleTeamChanged(ScoreboardTeam scoreboardteam) { super.handleTeamChanged(scoreboardteam); - this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 2)); -+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 2)); // CraftBukkit - Internal packet method ++ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 2)); this.b(); } public void handleTeamRemoved(ScoreboardTeam scoreboardteam) { super.handleTeamRemoved(scoreboardteam); - this.a.getPlayerList().sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 1)); -+ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 1)); // CraftBukkit - Internal packet method ++ this.sendAll(new PacketPlayOutScoreboardTeam(scoreboardteam, 1)); this.b(); } diff --git a/nms-patches/SecondaryWorldServer.patch b/nms-patches/SecondaryWorldServer.patch index 8356c3ad6b..c0d3fc76df 100644 --- a/nms-patches/SecondaryWorldServer.patch +++ b/nms-patches/SecondaryWorldServer.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/SecondaryWorldServer.java 2014-12-10 19:16:20.748465386 +0000 -+++ src/main/java/net/minecraft/server/SecondaryWorldServer.java 2014-12-10 18:55:01.104479276 +0000 -@@ -4,17 +4,19 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/SecondaryWorldServer.java 2015-02-26 22:40:23.075608134 +0000 ++++ src/main/java/net/minecraft/server/SecondaryWorldServer.java 2015-02-26 22:40:23.075608134 +0000 +@@ -4,9 +4,12 @@ private WorldServer a; @@ -11,8 +11,15 @@ + super(minecraftserver, idatamanager, worldData, i, methodprofiler, env, gen); + // CraftBukkit end this.a = worldserver; -- worldserver.af().a((IWorldBorderListener) (new SecondaryWorldServerInnerClass1(this))); -+ // worldserver.af().a((IWorldBorderListener) (new SecondaryWorldServerInnerClass1(this))); ++ /* CraftBukkit start + worldserver.getWorldBorder().a(new IWorldBorderListener() { + public void a(WorldBorder worldborder, double d0) { + SecondaryWorldServer.this.getWorldBorder().setSize(d0); +@@ -36,13 +39,14 @@ + SecondaryWorldServer.this.getWorldBorder().setDamageBuffer(d0); + } + }); ++ // CraftBukkit end */ } - protected void a() {} @@ -25,11 +32,11 @@ String s = PersistentVillage.a(this.worldProvider); PersistentVillage persistentvillage = (PersistentVillage) this.worldMaps.get(PersistentVillage.class, s); -@@ -26,6 +28,6 @@ +@@ -54,6 +58,6 @@ this.villages.a((World) this); } - return this; -+ return super.b(); ++ return super.b(); // CraftBukkit } } diff --git a/nms-patches/ShapeDetectorBlock.patch b/nms-patches/ShapeDetectorBlock.patch deleted file mode 100644 index 9a28dffc11..0000000000 --- a/nms-patches/ShapeDetectorBlock.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ShapeDetectorBlock.java 2015-02-02 20:26:40.044135504 +0000 -+++ src/main/java/net/minecraft/server/ShapeDetectorBlock.java 2015-02-02 20:26:40.056135504 +0000 -@@ -16,8 +16,10 @@ - } - - public IBlockData a() { -- if (this.c == null && this.a.isLoaded(this.b)) { -- this.c = this.a.getType(this.b); -+ // CraftBukkit start - fix null pointer -+ if (this.c == null) { -+ this.c = this.a.isLoaded(this.b) ? this.a.getType(this.b) : Blocks.AIR.getBlockData(); -+ // CraftBukkit end - } - - return this.c; diff --git a/nms-patches/ShapedRecipes.patch b/nms-patches/ShapedRecipes.patch index 9244c282ef..07b9e0e51e 100644 --- a/nms-patches/ShapedRecipes.patch +++ b/nms-patches/ShapedRecipes.patch @@ -1,22 +1,20 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ShapedRecipes.java 2014-11-28 17:43:43.373707429 +0000 -+++ src/main/java/net/minecraft/server/ShapedRecipes.java 2014-11-28 17:38:18.000000000 +0000 -@@ -1,5 +1,11 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/ShapedRecipes.java 2015-02-26 22:40:23.079608134 +0000 ++++ src/main/java/net/minecraft/server/ShapedRecipes.java 2015-02-26 22:40:23.079608134 +0000 +@@ -1,5 +1,10 @@ package net.minecraft.server; +// CraftBukkit start +import org.bukkit.craftbukkit.inventory.CraftItemStack; +import org.bukkit.craftbukkit.inventory.CraftShapedRecipe; +// CraftBukkit end -+ + public class ShapedRecipes implements IRecipe { private final int width; -@@ -14,6 +20,62 @@ - this.items = aitemstack; +@@ -15,6 +20,62 @@ this.result = itemstack; } -+ + + // CraftBukkit start + public org.bukkit.inventory.ShapedRecipe toBukkitRecipe() { + CraftItemStack result = CraftItemStack.asCraftMirror(this.result); @@ -72,6 +70,7 @@ + return recipe; + } + // CraftBukkit end - ++ public ItemStack b() { return this.result; + } diff --git a/nms-patches/ShapelessRecipes.patch b/nms-patches/ShapelessRecipes.patch index 8c3c5cfc3b..0a1ebf5e2f 100644 --- a/nms-patches/ShapelessRecipes.patch +++ b/nms-patches/ShapelessRecipes.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ShapelessRecipes.java 2014-11-28 17:43:43.373707429 +0000 -+++ src/main/java/net/minecraft/server/ShapelessRecipes.java 2014-11-28 17:38:22.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/ShapelessRecipes.java 2015-02-26 22:40:23.083608134 +0000 ++++ src/main/java/net/minecraft/server/ShapelessRecipes.java 2015-02-26 22:40:23.083608134 +0000 @@ -5,6 +5,11 @@ import java.util.Iterator; import java.util.List; @@ -12,11 +12,10 @@ public class ShapelessRecipes implements IRecipe { private final ItemStack result; -@@ -14,6 +19,20 @@ - this.result = itemstack; +@@ -15,6 +20,20 @@ this.ingredients = list; } -+ + + // CraftBukkit start + @SuppressWarnings("unchecked") + public org.bukkit.inventory.ShapelessRecipe toBukkitRecipe() { @@ -30,6 +29,7 @@ + return recipe; + } + // CraftBukkit end - ++ public ItemStack b() { return this.result; + } diff --git a/nms-patches/Slot.patch b/nms-patches/Slot.patch index dd05f9c03a..79694eae63 100644 --- a/nms-patches/Slot.patch +++ b/nms-patches/Slot.patch @@ -1,5 +1,14 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/Slot.java 2015-01-04 21:48:34.213601099 +0000 -+++ src/main/java/net/minecraft/server/Slot.java 2015-01-04 21:48:34.213601099 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/Slot.java 2015-02-26 22:40:23.091608134 +0000 ++++ src/main/java/net/minecraft/server/Slot.java 2015-02-26 22:40:23.091608134 +0000 +@@ -2,7 +2,7 @@ + + public class Slot { + +- private final int index; ++ public final int index; // CraftBukkit - public + public final IInventory inventory; + public int rawSlotIndex; + public int f; @@ -45,6 +45,9 @@ } diff --git a/nms-patches/SlotFurnaceResult.patch b/nms-patches/SlotFurnaceResult.patch index 3ed3bdfd5f..ac2bd23e40 100644 --- a/nms-patches/SlotFurnaceResult.patch +++ b/nms-patches/SlotFurnaceResult.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/SlotFurnaceResult.java 2014-11-28 17:43:43.377707429 +0000 -+++ src/main/java/net/minecraft/server/SlotFurnaceResult.java 2014-11-28 17:38:20.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/SlotFurnaceResult.java 2015-02-26 22:40:23.087608134 +0000 ++++ src/main/java/net/minecraft/server/SlotFurnaceResult.java 2015-02-26 22:40:23.087608134 +0000 @@ -1,5 +1,10 @@ package net.minecraft.server; @@ -11,11 +11,10 @@ public class SlotFurnaceResult extends Slot { private EntityHuman a; -@@ -49,6 +54,17 @@ - +@@ -50,6 +55,17 @@ i = j; } -+ + + // CraftBukkit start - fire FurnaceExtractEvent + Player player = (Player) a.getBukkitEntity(); + TileEntityFurnace furnace = ((TileEntityFurnace) this.inventory); @@ -26,6 +25,7 @@ + + i = event.getExpToDrop(); + // CraftBukkit end - ++ while (i > 0) { j = EntityExperienceOrb.getOrbValue(i); + i -= j; diff --git a/nms-patches/SpawnerCreature.patch b/nms-patches/SpawnerCreature.patch index 35588d1878..5de333c242 100644 --- a/nms-patches/SpawnerCreature.patch +++ b/nms-patches/SpawnerCreature.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/SpawnerCreature.java 2014-11-28 17:43:43.377707429 +0000 -+++ src/main/java/net/minecraft/server/SpawnerCreature.java 2014-11-28 17:38:22.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/SpawnerCreature.java 2015-02-26 22:40:23.107608134 +0000 ++++ src/main/java/net/minecraft/server/SpawnerCreature.java 2015-02-26 22:40:23.107608134 +0000 @@ -6,10 +6,16 @@ import java.util.Random; import java.util.Set; @@ -13,27 +13,26 @@ public final class SpawnerCreature { private static final int a = (int) Math.pow(17.0D, 2.0D); -- private final Set b = Sets.newHashSet(); -+ private final LongHashSet b = new LongHashSet(); +- private final Set b = Sets.newHashSet(); ++ private final LongHashSet b = new LongHashSet(); // CraftBukkit public SpawnerCreature() {} -@@ -36,14 +42,18 @@ +@@ -36,14 +42,17 @@ for (int i1 = -b0; i1 <= b0; ++i1) { for (k = -b0; k <= b0; ++k) { boolean flag3 = i1 == -b0 || i1 == b0 || k == -b0 || k == b0; - ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i1 + l, k + j); ++ // CraftBukkit start - use LongHash and LongHashSet + // ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i1 + l, k + j); - if (!this.b.contains(chunkcoordintpair)) { -+ // CraftBukkit start - use LongHash and LongHashSet + long chunkCoords = LongHash.toLong(i1 + l, k + j); -+ + if (!this.b.contains(chunkCoords)) { ++i; -- if (!flag3 && worldserver.af().isInBounds(chunkcoordintpair)) { +- if (!flag3 && worldserver.getWorldBorder().isInBounds(chunkcoordintpair)) { - this.b.add(chunkcoordintpair); -+ if (!flag3 && worldserver.af().isInBounds(chunkCoords)) { ++ if (!flag3 && worldserver.getWorldBorder().isInBounds(i1 + l, k + j)) { + this.b.add(chunkCoords); } } @@ -41,11 +40,10 @@ } } } -@@ -57,18 +67,41 @@ - +@@ -58,17 +67,41 @@ for (int k1 = 0; k1 < j; ++k1) { EnumCreatureType enumcreaturetype = aenumcreaturetype[k1]; -+ + + // CraftBukkit start - Use per-world spawn limits + int limit = enumcreaturetype.b(); + switch (enumcreaturetype) { @@ -67,7 +65,7 @@ + continue; + } + // CraftBukkit end - ++ if ((!enumcreaturetype.d() || flag1) && (enumcreaturetype.d() || flag) && (!enumcreaturetype.e() || flag2)) { k = worldserver.a(enumcreaturetype.a()); - int l1 = enumcreaturetype.b() * i / SpawnerCreature.a; @@ -83,6 +81,7 @@ + // CraftBukkit start = use LongHash and LongObjectHashMap + long key = ((Long) iterator1.next()).longValue(); + BlockPosition blockposition1 = getRandomPosition(worldserver, LongHash.msw(key), LongHash.lsw(key)); ++ // CraftBukkit int i2 = blockposition1.getX(); int j2 = blockposition1.getY(); int k2 = blockposition1.getZ(); @@ -94,7 +93,7 @@ + worldserver.addEntity(entityinsentient, SpawnReason.NATURAL); // CraftBukkit - Added a reason for spawning this creature } - if (l2 >= entityinsentient.bU()) { + if (l2 >= entityinsentient.bV()) { @@ -214,8 +247,10 @@ } diff --git a/nms-patches/StatisticManager.patch b/nms-patches/StatisticManager.patch index f1f0542a03..0e30b5872a 100644 --- a/nms-patches/StatisticManager.patch +++ b/nms-patches/StatisticManager.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/StatisticManager.java 2014-11-28 17:43:43.381707429 +0000 -+++ src/main/java/net/minecraft/server/StatisticManager.java 2014-11-28 17:38:19.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/StatisticManager.java 2015-02-26 22:40:23.111608134 +0000 ++++ src/main/java/net/minecraft/server/StatisticManager.java 2015-02-26 22:40:23.111608134 +0000 @@ -19,6 +19,12 @@ public void b(EntityHuman entityhuman, Statistic statistic, int i) { @@ -13,3 +13,12 @@ this.setStatistic(entityhuman, statistic, this.getStatisticValue(statistic) + i); } } +@@ -43,7 +49,7 @@ + public T b(Statistic statistic) { + StatisticWrapper statisticwrapper = (StatisticWrapper) this.a.get(statistic); + +- return statisticwrapper != null ? statisticwrapper.b() : null; ++ return statisticwrapper != null ? (T) statisticwrapper.b() : null; // CraftBukkit - fix decompile error + } + + public T a(Statistic statistic, T t0) { diff --git a/nms-patches/SwitchHelperLogVariant.patch b/nms-patches/SwitchHelperLogVariant.patch deleted file mode 100644 index ab4639ae3d..0000000000 --- a/nms-patches/SwitchHelperLogVariant.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/SwitchHelperLogVariant.java 2014-11-28 17:43:43.381707429 +0000 -+++ src/main/java/net/minecraft/server/SwitchHelperLogVariant.java 2014-11-28 17:38:22.000000000 +0000 -@@ -1,5 +1,6 @@ - package net.minecraft.server; - -+// CraftBukkit - imported for visibility - class SwitchHelperLogVariant { - - static final int[] a = new int[EnumLogVariant.values().length]; diff --git a/nms-patches/ThreadCommandReader.patch b/nms-patches/ThreadCommandReader.patch deleted file mode 100644 index 02cbab4431..0000000000 --- a/nms-patches/ThreadCommandReader.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ThreadCommandReader.java 2014-11-28 17:43:43.385707429 +0000 -+++ src/main/java/net/minecraft/server/ThreadCommandReader.java 2014-11-28 17:38:18.000000000 +0000 -@@ -4,6 +4,8 @@ - import java.io.IOException; - import java.io.InputStreamReader; - -+import static org.bukkit.craftbukkit.Main.*; // CraftBukkit -+ - class ThreadCommandReader extends Thread { - - final DedicatedServer server; -@@ -14,13 +16,28 @@ - } - - public void run() { -- BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(System.in)); -+ // CraftBukkit start -+ if (!useConsole) { -+ return; -+ } -+ // CraftBukkit end -+ -+ jline.console.ConsoleReader bufferedreader = this.server.reader; // CraftBukkit - - String s; - - try { -- while (!this.server.isStopped() && this.server.isRunning() && (s = bufferedreader.readLine()) != null) { -- this.server.issueCommand(s, this.server); -+ // CraftBukkit start - JLine disabling compatibility -+ while (!this.server.isStopped() && this.server.isRunning()) { -+ if (useJline) { -+ s = bufferedreader.readLine(">", null); -+ } else { -+ s = bufferedreader.readLine(); -+ } -+ if (s != null && s.trim().length() > 0) { // Trim to filter lines which are just spaces -+ this.server.issueCommand(s, this.server); -+ } -+ // CraftBukkit end - } - } catch (IOException ioexception) { - DedicatedServer.aR().error("Exception handling console input", ioexception); diff --git a/nms-patches/ThreadPlayerLookupUUID.patch b/nms-patches/ThreadPlayerLookupUUID.patch deleted file mode 100644 index 6c8da99e2c..0000000000 --- a/nms-patches/ThreadPlayerLookupUUID.patch +++ /dev/null @@ -1,81 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/ThreadPlayerLookupUUID.java 2015-02-05 10:00:43.580949912 +0000 -+++ src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java 2015-02-05 10:00:43.580949912 +0000 -@@ -5,6 +5,12 @@ - import java.math.BigInteger; - import java.util.UUID; - -+// CraftBukkit start -+import org.bukkit.craftbukkit.util.Waitable; -+import org.bukkit.event.player.AsyncPlayerPreLoginEvent; -+import org.bukkit.event.player.PlayerPreLoginEvent; -+// CraftBukkit end -+ - class ThreadPlayerLookupUUID extends Thread { - - final LoginListener a; -@@ -22,6 +28,44 @@ - - LoginListener.a(this.a, LoginListener.a(this.a).aB().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s)); - if (LoginListener.b(this.a) != null) { -+ // CraftBukkit start - fire PlayerPreLoginEvent -+ if (!this.a.networkManager.g()) { -+ return; -+ } -+ -+ String playerName = LoginListener.b(this.a).getName(); -+ java.net.InetAddress address = ((java.net.InetSocketAddress) a.networkManager.getSocketAddress()).getAddress(); -+ java.util.UUID uniqueId = LoginListener.b(this.a).getId(); -+ final org.bukkit.craftbukkit.CraftServer server = LoginListener.a(this.a).server; -+ -+ AsyncPlayerPreLoginEvent asyncEvent = new AsyncPlayerPreLoginEvent(playerName, address, uniqueId); -+ server.getPluginManager().callEvent(asyncEvent); -+ -+ if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) { -+ final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId); -+ if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) { -+ event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage()); -+ } -+ Waitable waitable = new Waitable() { -+ @Override -+ protected PlayerPreLoginEvent.Result evaluate() { -+ server.getPluginManager().callEvent(event); -+ return event.getResult(); -+ }}; -+ -+ LoginListener.a(this.a).processQueue.add(waitable); -+ if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { -+ this.a.disconnect(event.getKickMessage()); -+ return; -+ } -+ } else { -+ if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) { -+ this.a.disconnect(asyncEvent.getKickMessage()); -+ return; -+ } -+ } -+ // CraftBukkit end -+ - LoginListener.e().info("UUID of player " + LoginListener.b(this.a).getName() + " is " + LoginListener.b(this.a).getId()); - LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT); - } else if (LoginListener.a(this.a).S()) { -@@ -30,7 +74,7 @@ - LoginListener.a(this.a, EnumProtocolState.READY_TO_ACCEPT); - } else { - this.a.disconnect("Failed to verify username!"); -- LoginListener.e().error("Username \'" + LoginListener.b(this.a).getName() + "\' tried to join with an invalid session"); -+ LoginListener.e().error("Username \'" + gameprofile.getName() + "\' tried to join with an invalid session"); // CraftBukkit - fix null pointer - } - } catch (AuthenticationUnavailableException authenticationunavailableexception) { - if (LoginListener.a(this.a).S()) { -@@ -41,6 +85,11 @@ - this.a.disconnect("Authentication servers are down. Please try again later, sorry!"); - LoginListener.e().error("Couldn\'t verify username because servers are unavailable"); - } -+ // CraftBukkit start - catch all exceptions -+ } catch (Exception exception) { -+ this.a.disconnect("Failed to verify username!"); -+ LoginListener.a(this.a).server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + gameprofile.getName(), exception); -+ // CraftBukkit end - } - - } diff --git a/nms-patches/TileEntity.patch b/nms-patches/TileEntity.patch index 03dbb25ee1..0fedbc1daa 100644 --- a/nms-patches/TileEntity.patch +++ b/nms-patches/TileEntity.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/TileEntity.java 2014-11-28 17:43:43.401707428 +0000 -+++ src/main/java/net/minecraft/server/TileEntity.java 2014-11-28 17:38:19.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/TileEntity.java 2015-02-26 22:40:23.155608133 +0000 ++++ src/main/java/net/minecraft/server/TileEntity.java 2015-02-26 22:40:23.155608133 +0000 @@ -6,6 +6,8 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -9,7 +9,7 @@ public abstract class TileEntity { private static final Logger a = LogManager.getLogger(); -@@ -182,4 +184,12 @@ +@@ -217,4 +219,12 @@ a(TileEntityFlowerPot.class, "FlowerPot"); a(TileEntityBanner.class, "Banner"); } diff --git a/nms-patches/TileEntityBanner.patch b/nms-patches/TileEntityBanner.patch new file mode 100644 index 0000000000..38747d3c60 --- /dev/null +++ b/nms-patches/TileEntityBanner.patch @@ -0,0 +1,13 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/TileEntityBanner.java 2015-02-26 22:40:23.115608134 +0000 ++++ src/main/java/net/minecraft/server/TileEntityBanner.java 2015-02-26 22:40:23.115608134 +0000 +@@ -4,8 +4,8 @@ + + public class TileEntityBanner extends TileEntity { + +- private int color; +- private NBTTagList patterns; ++ public int color; // CraftBukkit - public ++ public NBTTagList patterns; // CraftBukkit - public + private boolean g; + private List h; + private List i; diff --git a/nms-patches/TileEntityBeacon.patch b/nms-patches/TileEntityBeacon.patch index 5091f62bfd..c5a6e3dc7b 100644 --- a/nms-patches/TileEntityBeacon.patch +++ b/nms-patches/TileEntityBeacon.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/TileEntityBeacon.java 2014-12-27 14:58:26.269254675 +0000 -+++ src/main/java/net/minecraft/server/TileEntityBeacon.java 2014-12-27 14:58:26.269254675 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/TileEntityBeacon.java 2015-02-26 22:40:23.119608134 +0000 ++++ src/main/java/net/minecraft/server/TileEntityBeacon.java 2015-02-26 22:40:23.119608134 +0000 @@ -5,6 +5,11 @@ import java.util.Iterator; import java.util.List; @@ -54,31 +54,31 @@ this.j = nbttagcompound.getInt("Levels"); } -@@ -182,7 +211,7 @@ +@@ -236,7 +265,7 @@ } - public int getSize() { + public int getMaxStackSize() { - return 1; + return maxStack; // CraftBukkit } - public ItemStack getItem(int i) { + public boolean a(EntityHuman entityhuman) { @@ -282,11 +311,11 @@ break; case 1: - this.k = j; -+ this.k = validateEffect(j); // CraftBukkit ++ this.k = validateEffect(j); break; case 2: - this.l = j; -+ this.l = validateEffect(j); // CraftBukkit ++ this.l = validateEffect(j); } } -@@ -307,4 +336,23 @@ - return super.c(i, j); +@@ -326,4 +355,23 @@ + return this.a; } } + @@ -93,7 +93,7 @@ + case 5: // MobEffectList.INCREASE_DAMAGE.id + case 10: // MobEffectList.REGENERATION.id + break; -+ default: ++ default: + i = 0; + break; + } diff --git a/nms-patches/TileEntityBrewingStand.patch b/nms-patches/TileEntityBrewingStand.patch index fcd716ab7e..012112d59e 100644 --- a/nms-patches/TileEntityBrewingStand.patch +++ b/nms-patches/TileEntityBrewingStand.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/TileEntityBrewingStand.java 2014-11-28 17:43:43.389707429 +0000 -+++ src/main/java/net/minecraft/server/TileEntityBrewingStand.java 2014-11-28 17:38:23.000000000 +0000 -@@ -3,6 +3,12 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/TileEntityBrewingStand.java 2015-02-26 22:40:23.123608134 +0000 ++++ src/main/java/net/minecraft/server/TileEntityBrewingStand.java 2015-02-26 22:40:23.123608134 +0000 +@@ -3,18 +3,50 @@ import java.util.Arrays; import java.util.List; @@ -13,15 +13,17 @@ public class TileEntityBrewingStand extends TileEntityContainer implements IUpdatePlayerListBox, IWorldInventory { private static final int[] a = new int[] { 3}; -@@ -12,8 +18,35 @@ + private static final int[] f = new int[] { 0, 1, 2}; + private ItemStack[] items = new ItemStack[4]; +- private int brewTime; ++ public int brewTime; // CraftBukkit - public private boolean[] i; private Item j; private String k; + private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field public TileEntityBrewingStand() {} -+ -+ + + // CraftBukkit start - add fields and methods + public List transaction = new java.util.ArrayList(); + private int maxStack = 64; @@ -46,10 +48,11 @@ + maxStack = size; + } + // CraftBukkit end - ++ public String getName() { return this.hasCustomName() ? this.k : "container.brewing"; -@@ -32,9 +65,14 @@ + } +@@ -32,9 +64,14 @@ } public void c() { @@ -66,11 +69,10 @@ this.o(); this.update(); } else if (!this.n()) { -@@ -109,6 +147,16 @@ - private void o() { +@@ -110,6 +147,16 @@ if (this.n()) { ItemStack itemstack = this.items[3]; -+ + + // CraftBukkit start + if (getOwner() != null) { + BrewEvent event = new BrewEvent(world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()), (org.bukkit.inventory.BrewerInventory) this.getOwner().getInventory()); @@ -80,10 +82,11 @@ + } + } + // CraftBukkit end - ++ for (int i = 0; i < 3; ++i) { if (this.items[i] != null && this.items[i].getItem() == Items.POTION) { -@@ -221,7 +269,7 @@ + int j = this.items[i].getData(); +@@ -221,7 +268,7 @@ } public int getMaxStackSize() { diff --git a/nms-patches/TileEntityChest.patch b/nms-patches/TileEntityChest.patch index a5e476f09a..ac339705c8 100644 --- a/nms-patches/TileEntityChest.patch +++ b/nms-patches/TileEntityChest.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/TileEntityChest.java 2014-11-28 17:43:43.393707428 +0000 -+++ src/main/java/net/minecraft/server/TileEntityChest.java 2014-11-28 17:38:17.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/TileEntityChest.java 2015-02-26 22:40:23.127608134 +0000 ++++ src/main/java/net/minecraft/server/TileEntityChest.java 2015-02-26 22:40:23.127608134 +0000 @@ -3,6 +3,11 @@ import java.util.Iterator; import java.util.List; @@ -12,11 +12,10 @@ public class TileEntityChest extends TileEntityContainer implements IUpdatePlayerListBox, IInventory { private ItemStack[] items = new ItemStack[27]; -@@ -19,6 +24,31 @@ - private String p; +@@ -20,6 +25,31 @@ public TileEntityChest() {} -+ + + // CraftBukkit start - add fields and methods + public List transaction = new java.util.ArrayList(); + private int maxStack = MAX_STACK; @@ -41,9 +40,10 @@ + maxStack = size; + } + // CraftBukkit end - ++ public int getSize() { return 27; + } @@ -125,10 +155,11 @@ } @@ -57,11 +57,10 @@ return this.world.getTileEntity(this.position) != this ? false : entityhuman.e((double) this.position.getX() + 0.5D, (double) this.position.getY() + 0.5D, (double) this.position.getZ() + 0.5D) <= 64.0D; } -@@ -304,9 +335,22 @@ +@@ -304,9 +335,21 @@ if (this.l < 0) { this.l = 0; } -+ + int oldPower = Math.max(0, Math.min(15, this.l)); // CraftBukkit - Get power before new viewer is added ++this.l; @@ -80,16 +79,15 @@ this.world.applyPhysics(this.position, this.w()); this.world.applyPhysics(this.position.down(), this.w()); } -@@ -315,8 +359,21 @@ +@@ -315,8 +358,20 @@ public void closeContainer(EntityHuman entityhuman) { if (!entityhuman.v() && this.w() instanceof BlockChest) { + int oldPower = Math.max(0, Math.min(15, this.l)); // CraftBukkit - Get power before new viewer is added -+ --this.l; + if (this.world == null) return; // CraftBukkit this.world.playBlockAction(this.position, this.w(), 1, this.l); -+ ++ + // CraftBukkit start - Call redstone event + if (this.w() == Blocks.TRAPPED_CHEST) { + int newPower = Math.max(0, Math.min(15, this.l)); diff --git a/nms-patches/TileEntityCommand.patch b/nms-patches/TileEntityCommand.patch new file mode 100644 index 0000000000..8cf33a7714 --- /dev/null +++ b/nms-patches/TileEntityCommand.patch @@ -0,0 +1,12 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/TileEntityCommand.java 2015-02-26 22:40:23.135608133 +0000 ++++ src/main/java/net/minecraft/server/TileEntityCommand.java 2015-02-26 22:40:23.139608133 +0000 +@@ -3,6 +3,9 @@ + public class TileEntityCommand extends TileEntity { + + private final CommandBlockListenerAbstract a = new CommandBlockListenerAbstract() { ++ { ++ sender = new org.bukkit.craftbukkit.command.CraftBlockCommandSender(this); // CraftBukkit - add sender ++ } + public BlockPosition getChunkCoordinates() { + return TileEntityCommand.this.position; + } diff --git a/nms-patches/TileEntityCommandListener.patch b/nms-patches/TileEntityCommandListener.patch deleted file mode 100644 index 10f9851653..0000000000 --- a/nms-patches/TileEntityCommandListener.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/TileEntityCommandListener.java 2014-11-28 17:43:43.393707428 +0000 -+++ src/main/java/net/minecraft/server/TileEntityCommandListener.java 2014-11-28 17:38:17.000000000 +0000 -@@ -6,6 +6,7 @@ - - TileEntityCommandListener(TileEntityCommand tileentitycommand) { - this.a = tileentitycommand; -+ sender = new org.bukkit.craftbukkit.command.CraftBlockCommandSender(this); // CraftBukkit - add sender - } - - public BlockPosition getChunkCoordinates() { diff --git a/nms-patches/TileEntityDispenser.patch b/nms-patches/TileEntityDispenser.patch index 59d30acea5..ddfa248821 100644 --- a/nms-patches/TileEntityDispenser.patch +++ b/nms-patches/TileEntityDispenser.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/TileEntityDispenser.java 2014-11-28 17:43:43.397707428 +0000 -+++ src/main/java/net/minecraft/server/TileEntityDispenser.java 2014-11-28 17:38:17.000000000 +0000 -@@ -2,11 +2,43 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/TileEntityDispenser.java 2015-02-26 22:40:23.139608133 +0000 ++++ src/main/java/net/minecraft/server/TileEntityDispenser.java 2015-02-26 22:40:23.139608133 +0000 +@@ -2,12 +2,44 @@ import java.util.Random; @@ -16,7 +16,7 @@ private static final Random f = new Random(); private ItemStack[] items = new ItemStack[9]; protected String a; -+ + + // CraftBukkit start - add fields and methods + public List transaction = new java.util.ArrayList(); + private int maxStack = MAX_STACK; @@ -40,10 +40,11 @@ + public void setMaxStackSize(int size) { + maxStack = size; + } -+ // CraftBukkit end - ++ // CraftBukkit end ++ public TileEntityDispenser() {} + public int getSize() { @@ -58,6 +90,7 @@ for (int k = 0; k < this.items.length; ++k) { diff --git a/nms-patches/TileEntityFurnace.patch b/nms-patches/TileEntityFurnace.patch index d4b3210863..56b5b0a82a 100644 --- a/nms-patches/TileEntityFurnace.patch +++ b/nms-patches/TileEntityFurnace.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/TileEntityFurnace.java 2014-11-28 17:43:43.397707428 +0000 -+++ src/main/java/net/minecraft/server/TileEntityFurnace.java 2014-11-28 17:38:23.000000000 +0000 -@@ -1,5 +1,15 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/TileEntityFurnace.java 2015-02-26 22:40:23.143608133 +0000 ++++ src/main/java/net/minecraft/server/TileEntityFurnace.java 2015-02-26 22:40:23.143608133 +0000 +@@ -1,17 +1,53 @@ package net.minecraft.server; +// CraftBukkit start @@ -16,11 +16,17 @@ public class TileEntityFurnace extends TileEntityContainer implements IUpdatePlayerListBox, IWorldInventory { private static final int[] a = new int[] { 0}; -@@ -11,6 +21,32 @@ - public int cookTime; + private static final int[] f = new int[] { 2, 1}; + private static final int[] g = new int[] { 1}; + private ItemStack[] items = new ItemStack[3]; +- private int burnTime; ++ public int burnTime; // CraftBukkit - public + private int ticksForCurrentFuel; +- private int cookTime; ++ public int cookTime; // CraftBukkit - public private int cookTimeTotal; private String m; -+ + + // CraftBukkit start - add fields and methods + private int lastTick = MinecraftServer.currentTick; + private int maxStack = MAX_STACK; @@ -46,9 +52,10 @@ + maxStack = size; + } + // CraftBukkit end - ++ public TileEntityFurnace() {} + public int getSize() { @@ -132,7 +168,7 @@ } @@ -58,11 +65,10 @@ } public boolean isBurning() { -@@ -142,9 +178,27 @@ - public void c() { +@@ -143,8 +179,26 @@ boolean flag = this.isBurning(); boolean flag1 = false; -+ + + // CraftBukkit start - Use wall time instead of ticks for cooking + int elapsedTicks = MinecraftServer.currentTick - this.lastTick; + this.lastTick = MinecraftServer.currentTick; @@ -80,13 +86,13 @@ + this.cookTime = 0; + } + // CraftBukkit end - ++ if (this.isBurning()) { - --this.burnTime; + this.burnTime -= elapsedTicks; // CraftBukkit - use elapsedTicks in place of constant } - if (!this.world.isStatic) { + if (!this.world.isClientSide) { @@ -153,9 +207,21 @@ this.cookTime = MathHelper.clamp(this.cookTime - 2, 0, this.cookTimeTotal); } @@ -112,12 +118,10 @@ flag1 = true; if (this.items[1] != null) { --this.items[1].count; -@@ -167,7 +233,8 @@ - } +@@ -168,6 +234,7 @@ } } -- -+ + + /* CraftBukkit start - Moved up if (this.isBurning() && this.canBurn()) { ++this.cookTime; @@ -130,26 +134,24 @@ } if (flag != this.isBurning()) { -@@ -202,20 +270,48 @@ - return false; +@@ -203,7 +271,8 @@ } else { ItemStack itemstack = RecipesFurnace.getInstance().getResult(this.items[0]); -- + - return itemstack == null ? false : (this.items[2] == null ? true : (!this.items[2].doMaterialsMatch(itemstack) ? false : (this.items[2].count < this.getMaxStackSize() && this.items[2].count < this.items[2].getMaxStackSize() ? true : this.items[2].count < itemstack.getMaxStackSize()))); + // 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()))); -+ } } - public void burn() { +@@ -211,11 +280,38 @@ if (this.canBurn()) { ItemStack itemstack = RecipesFurnace.getInstance().getResult(this.items[0]); -+ + + // CraftBukkit start - fire FurnaceSmeltEvent + CraftItemStack source = CraftItemStack.asCraftMirror(this.items[0]); + org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack); - ++ + FurnaceSmeltEvent furnaceSmeltEvent = new FurnaceSmeltEvent(this.world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()), source, result); + this.world.getServer().getPluginManager().callEvent(furnaceSmeltEvent); + @@ -169,7 +171,7 @@ + return; + } + } -+ ++ + /* if (this.items[2] == null) { this.items[2] = itemstack.cloneItemStack(); diff --git a/nms-patches/TileEntityHopper.patch b/nms-patches/TileEntityHopper.patch index a1367334dc..043e2bd905 100644 --- a/nms-patches/TileEntityHopper.patch +++ b/nms-patches/TileEntityHopper.patch @@ -1,7 +1,7 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/TileEntityHopper.java 2014-11-28 17:43:43.401707428 +0000 -+++ src/main/java/net/minecraft/server/TileEntityHopper.java 2014-11-28 17:38:19.000000000 +0000 -@@ -2,11 +2,45 @@ - +--- /home/matt/mc-dev-private//net/minecraft/server/TileEntityHopper.java 2015-02-26 22:40:23.147608133 +0000 ++++ src/main/java/net/minecraft/server/TileEntityHopper.java 2015-02-26 22:40:23.151608133 +0000 +@@ -3,12 +3,46 @@ + import java.util.Iterator; import java.util.List; +// CraftBukkit start @@ -18,7 +18,7 @@ private ItemStack[] items = new ItemStack[5]; private String f; private int g = -1; -+ + + // CraftBukkit start - add fields and methods + public List transaction = new java.util.ArrayList(); + private int maxStack = MAX_STACK; @@ -42,11 +42,12 @@ + public void setMaxStackSize(int size) { + maxStack = size; + } -+ // CraftBukkit end - ++ // CraftBukkit end ++ public TileEntityHopper() {} -@@ -119,7 +153,7 @@ + public void a(NBTTagCompound nbttagcompound) { +@@ -120,7 +154,7 @@ } public int getMaxStackSize() { @@ -55,13 +56,13 @@ } public boolean a(EntityHuman entityhuman) { -@@ -215,10 +249,35 @@ +@@ -216,10 +250,35 @@ for (int i = 0; i < this.getSize(); ++i) { if (this.getItem(i) != null) { ItemStack itemstack = this.getItem(i).cloneItemStack(); - ItemStack itemstack1 = addItem(iinventory, this.splitStack(i, 1), enumdirection); + // ItemStack itemstack1 = addItem(iinventory, this.splitStack(i, 1), enumdirection); -+ ++ + // CraftBukkit start - Call event when pushing items into other inventories + CraftItemStack oitemstack = CraftItemStack.asCraftMirror(this.splitStack(i, 1)); + @@ -93,7 +94,7 @@ return true; } -@@ -325,10 +384,41 @@ +@@ -330,10 +389,41 @@ if (itemstack != null && b(iinventory, itemstack, i, enumdirection)) { ItemStack itemstack1 = itemstack.cloneItemStack(); @@ -119,7 +120,7 @@ + if (ihopper instanceof TileEntityHopper) { + ((TileEntityHopper) ihopper).d(8); // Delay hopper checks + } else if (ihopper instanceof EntityMinecartHopper) { -+ ((EntityMinecartHopper) ihopper).l(4); // Delay hopper minecart checks ++ ((EntityMinecartHopper) ihopper).m(4); // Delay hopper minecart checks + } + + return false; @@ -137,7 +138,7 @@ return true; } -@@ -344,6 +434,14 @@ +@@ -349,6 +439,13 @@ if (entityitem == null) { return false; } else { @@ -148,7 +149,6 @@ + return false; + } + // CraftBukkit end -+ ItemStack itemstack = entityitem.getItemStack().cloneItemStack(); ItemStack itemstack1 = addItem(iinventory, itemstack, (EnumDirection) null); diff --git a/nms-patches/TileEntityNote.patch b/nms-patches/TileEntityNote.patch index 13a4099672..1039ba9e26 100644 --- a/nms-patches/TileEntityNote.patch +++ b/nms-patches/TileEntityNote.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/TileEntityNote.java 2014-11-28 17:43:43.405707428 +0000 -+++ src/main/java/net/minecraft/server/TileEntityNote.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/TileEntityNote.java 2015-02-26 22:40:23.159608133 +0000 ++++ src/main/java/net/minecraft/server/TileEntityNote.java 2015-02-26 22:40:23.159608133 +0000 @@ -44,7 +44,12 @@ b0 = 4; } diff --git a/nms-patches/TileEntityPiston.patch b/nms-patches/TileEntityPiston.patch index 6a268ddbde..c476e8510c 100644 --- a/nms-patches/TileEntityPiston.patch +++ b/nms-patches/TileEntityPiston.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/TileEntityPiston.java 2014-11-28 17:43:43.409707428 +0000 -+++ src/main/java/net/minecraft/server/TileEntityPiston.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/TileEntityPiston.java 2015-02-26 22:40:23.163608133 +0000 ++++ src/main/java/net/minecraft/server/TileEntityPiston.java 2015-02-26 22:40:23.163608133 +0000 @@ -104,6 +104,7 @@ } diff --git a/nms-patches/TileEntityRecordPlayer.patch b/nms-patches/TileEntityRecordPlayer.patch deleted file mode 100644 index 6ebf7ecfc7..0000000000 --- a/nms-patches/TileEntityRecordPlayer.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/TileEntityRecordPlayer.java 2014-11-28 17:43:43.409707428 +0000 -+++ src/main/java/net/minecraft/server/TileEntityRecordPlayer.java 2014-11-28 17:38:22.000000000 +0000 -@@ -29,6 +29,11 @@ - } - - public void setRecord(ItemStack itemstack) { -+ // CraftBukkit start - There can only be one -+ if (itemstack != null) { -+ itemstack.count = 1; -+ } -+ // CraftBukkit end - this.record = itemstack; - this.update(); - } diff --git a/nms-patches/TileEntitySign.patch b/nms-patches/TileEntitySign.patch index 4877eea015..f3b4c85429 100644 --- a/nms-patches/TileEntitySign.patch +++ b/nms-patches/TileEntitySign.patch @@ -1,55 +1,61 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/TileEntitySign.java 2014-12-27 14:58:26.377254674 +0000 -+++ src/main/java/net/minecraft/server/TileEntitySign.java 2014-12-27 14:58:26.381254674 +0000 -@@ -20,6 +20,12 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/TileEntitySign.java 2015-02-26 22:40:23.163608133 +0000 ++++ src/main/java/net/minecraft/server/TileEntitySign.java 2015-02-26 22:40:23.167608133 +0000 +@@ -6,7 +6,7 @@ + public final IChatBaseComponent[] lines = new IChatBaseComponent[] { new ChatComponentText(""), new ChatComponentText(""), new ChatComponentText(""), new ChatComponentText("")}; + public int f = -1; +- private boolean isEditable = true; ++ public boolean isEditable = true; // CraftBukkit - public + private EntityHuman h; + private final CommandObjectiveExecutor i = new CommandObjectiveExecutor(); + +@@ -21,6 +21,12 @@ nbttagcompound.setString("Text" + (i + 1), s); } -+ + + // CraftBukkit start + if (Boolean.getBoolean("convertLegacySigns")) { + nbttagcompound.setBoolean("Bukkit.isConverted", true); + } + // CraftBukkit end - ++ this.i.b(nbttagcompound); } -@@ -29,14 +35,27 @@ - super.a(nbttagcompound); - TileEntitySignCommandListener tileentitysigncommandlistener = new TileEntitySignCommandListener(this); + +@@ -65,12 +71,24 @@ + public void a(CommandObjectiveExecutor.EnumCommandResult commandobjectiveexecutor_enumcommandresult, int i) {} + }; + // CraftBukkit start - Add an option to convert signs correctly + // This is done with a flag instead of all the time because + // we have no way to tell whether a sign is from 1.7.10 or 1.8 -+ ++ + boolean oldSign = Boolean.getBoolean("convertLegacySigns") && !nbttagcompound.getBoolean("Bukkit.isConverted"); -+ ++ for (int i = 0; i < 4; ++i) { String s = nbttagcompound.getString("Text" + (i + 1)); -+ -+ if (oldSign) { -+ lines[i] = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s)[0]; -+ continue; -+ } -+ // CraftBukkit end try { - IChatBaseComponent ichatbasecomponent = ChatSerializer.a(s); + IChatBaseComponent ichatbasecomponent = IChatBaseComponent.ChatSerializer.a(s); ++ if (oldSign) { ++ lines[i] = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s)[0]; ++ continue; ++ } ++ // CraftBukkit end ++ try { - this.lines[i] = ChatComponentUtils.filterForDisplay(tileentitysigncommandlistener, ichatbasecomponent, (Entity) null); -+ if (false) throw new CommandException(null, null); // CraftBukkit - fix decompile error + this.lines[i] = ChatComponentUtils.filterForDisplay(icommandlistener, ichatbasecomponent, (Entity) null); } catch (CommandException commandexception) { - this.lines[i] = ichatbasecomponent; - } -@@ -77,7 +96,10 @@ +@@ -151,7 +169,10 @@ ChatClickable chatclickable = chatmodifier.h(); - if (chatclickable.a() == EnumClickAction.RUN_COMMAND) { -- MinecraftServer.getServer().getCommandHandler().a(tileentitysignplayerwrapper, chatclickable.b()); + if (chatclickable.a() == ChatClickable.EnumClickAction.RUN_COMMAND) { +- MinecraftServer.getServer().getCommandHandler().a(icommandlistener, chatclickable.b()); + // CraftBukkit start + // MinecraftServer.getServer().getCommandHandler().a(tileentitysignplayerwrapper, chatclickable.b()); + CommandBlockListenerAbstract.executeCommand(entityhuman, (org.bukkit.entity.Player) entityhuman.getBukkitEntity(), chatclickable.b()); -+ // CraftBukkit ebd ++ // CraftBukkit end } } } diff --git a/nms-patches/TileEntitySkull.patch b/nms-patches/TileEntitySkull.patch index a3406ddc87..f62aca67d0 100644 --- a/nms-patches/TileEntitySkull.patch +++ b/nms-patches/TileEntitySkull.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/TileEntitySkull.java 2014-11-28 17:43:43.413707428 +0000 -+++ src/main/java/net/minecraft/server/TileEntitySkull.java 2014-11-28 17:38:18.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/TileEntitySkull.java 2015-02-26 22:40:23.167608133 +0000 ++++ src/main/java/net/minecraft/server/TileEntitySkull.java 2015-02-26 22:40:23.167608133 +0000 @@ -105,4 +105,10 @@ public void setRotation(int i) { this.rotation = i; diff --git a/nms-patches/Village.patch b/nms-patches/Village.patch index b79b1de519..792320559d 100644 --- a/nms-patches/Village.patch +++ b/nms-patches/Village.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/Village.java 2014-11-28 17:43:43.413707428 +0000 -+++ src/main/java/net/minecraft/server/Village.java 2014-11-28 17:38:22.000000000 +0000 -@@ -60,7 +60,7 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/Village.java 2015-02-26 22:40:23.171608133 +0000 ++++ src/main/java/net/minecraft/server/Village.java 2015-02-26 22:40:23.175608133 +0000 +@@ -62,7 +62,7 @@ EntityIronGolem entityirongolem = new EntityIronGolem(this.a); entityirongolem.setPosition(vec3d.a, vec3d.b, vec3d.c); diff --git a/nms-patches/VillageSiege.patch b/nms-patches/VillageSiege.patch index 617c461bc2..6bb45311aa 100644 --- a/nms-patches/VillageSiege.patch +++ b/nms-patches/VillageSiege.patch @@ -1,11 +1,11 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/VillageSiege.java 2014-11-28 17:43:43.417707428 +0000 -+++ src/main/java/net/minecraft/server/VillageSiege.java 2014-11-28 17:38:23.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/VillageSiege.java 2015-02-26 22:40:23.175608133 +0000 ++++ src/main/java/net/minecraft/server/VillageSiege.java 2015-02-26 22:40:23.175608133 +0000 @@ -140,7 +140,7 @@ } entityzombie.setPositionRotation(vec3d.a, vec3d.b, vec3d.c, this.a.random.nextFloat() * 360.0F, 0.0F); - this.a.addEntity(entityzombie); -+ this.a.addEntity(entityzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_INVASION); // CraftBukkit ++ this.a.addEntity(entityzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_INVASION); // CraftBukkit BlockPosition blockposition = this.f.a(); entityzombie.a(blockposition, this.f.b()); diff --git a/nms-patches/World.patch b/nms-patches/World.patch index b0a4b5833d..9cc00ba8b8 100644 --- a/nms-patches/World.patch +++ b/nms-patches/World.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/World.java 2015-01-05 09:42:04.285856834 +1100 -+++ src/main/java/net/minecraft/server/World.java 2015-01-05 09:42:04.293856810 +1100 +--- /home/matt/mc-dev-private//net/minecraft/server/World.java 2015-02-26 22:40:23.215608133 +0000 ++++ src/main/java/net/minecraft/server/World.java 2015-02-26 22:40:23.219608133 +0000 @@ -13,6 +13,22 @@ import java.util.UUID; import java.util.concurrent.Callable; @@ -22,19 +22,37 @@ + public abstract class World implements IBlockAccess { - protected boolean e; -@@ -47,7 +63,8 @@ - private final Calendar J = Calendar.getInstance(); - public Scoreboard scoreboard = new Scoreboard(); - public final boolean isStatic; -- protected Set chunkTickList = Sets.newHashSet(); + private int a = 63; +@@ -36,27 +52,72 @@ + protected float r; + private int J; + public final Random random = new Random(); +- public final WorldProvider worldProvider; ++ public WorldProvider worldProvider; // CraftBukkit - remove final + protected List u = Lists.newArrayList(); + protected IChunkProvider chunkProvider; + protected final IDataManager dataManager; +- protected WorldData worldData; ++ public WorldData worldData; // CraftBukkit - public + protected boolean isLoading; +- protected PersistentCollection worldMaps; ++ public PersistentCollection worldMaps; // CraftBukkit - public + protected PersistentVillage villages; + public final MethodProfiler methodProfiler; + private final Calendar K = Calendar.getInstance(); +- protected Scoreboard scoreboard = new Scoreboard(); ++ public Scoreboard scoreboard = new Scoreboard(); // CraftBukkit - public + public final boolean isClientSide; +- protected Set chunkTickList = Sets.newHashSet(); + // CraftBukkit - longhashset + protected LongHashSet chunkTickList = new LongHashSet(); - private int K; - public boolean allowMonsters; - public boolean allowAnimals; -@@ -55,7 +72,52 @@ - private final WorldBorder M; + private int L; +- protected boolean allowMonsters; +- protected boolean allowAnimals; ++ public boolean allowMonsters; // CraftBukkit - public ++ public boolean allowAnimals; // CraftBukkit - public + private boolean M; + private final WorldBorder N; int[] H; - protected World(IDataManager idatamanager, WorldData worlddata, WorldProvider worldprovider, MethodProfiler methodprofiler, boolean flag) { @@ -83,22 +101,46 @@ + this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit + this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit + // CraftBukkit end -+ - this.K = this.random.nextInt(12000); + this.L = this.random.nextInt(12000); this.allowMonsters = true; this.allowAnimals = true; -@@ -66,6 +128,10 @@ +@@ -67,6 +128,35 @@ this.worldProvider = worldprovider; - this.isStatic = flag; - this.M = worldprovider.getWorldBorder(); -+ this.M.world = (WorldServer) this; // CraftBukkit -+ this.M.a(new WorldBorderListener(((WorldServer) this).getServer().getHandle())); // CraftBukkit + this.isClientSide = flag; + this.N = worldprovider.getWorldBorder(); ++ // CraftBukkit start ++ // Moved from PlayerList ++ this.N.a(new IWorldBorderListener() { ++ public void a(WorldBorder worldborder, double d0) { ++ getServer().getHandle().sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_SIZE), World.this); ++ } + -+ this.getServer().addWorld(this.world); // CraftBukkit ++ public void a(WorldBorder worldborder, double d0, double d1, long i) { ++ getServer().getHandle().sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.LERP_SIZE), World.this); ++ } ++ ++ public void a(WorldBorder worldborder, double d0, double d1) { ++ getServer().getHandle().sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_CENTER), World.this); ++ } ++ ++ public void a(WorldBorder worldborder, int i) { ++ getServer().getHandle().sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_WARNING_TIME), World.this); ++ } ++ ++ public void b(WorldBorder worldborder, int i) { ++ getServer().getHandle().sendAll(new PacketPlayOutWorldBorder(worldborder, PacketPlayOutWorldBorder.EnumWorldBorderAction.SET_WARNING_BLOCKS), World.this); ++ } ++ ++ public void b(WorldBorder worldborder, double d0) {} ++ ++ public void c(WorldBorder worldborder, double d0) {} ++ }); ++ this.getServer().addWorld(this.world); ++ // CraftBukkit end } public World b() { -@@ -184,6 +250,27 @@ +@@ -193,6 +283,27 @@ } public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) { @@ -125,12 +167,12 @@ + // CraftBukkit end if (!this.isValidLocation(blockposition)) { return false; - } else if (!this.isStatic && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) { -@@ -191,9 +278,23 @@ + } else if (!this.isClientSide && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) { +@@ -200,9 +311,23 @@ } else { Chunk chunk = this.getChunkAtWorldCoords(blockposition); Block block = iblockdata.getBlock(); -+ ++ + // CraftBukkit start - capture blockstates + BlockState blockstate = null; + if (this.captureBlockStates) { @@ -138,7 +180,7 @@ + this.capturedBlockStates.add(blockstate); + } + // CraftBukkit end -+ ++ IBlockData iblockdata1 = chunk.a(blockposition, iblockdata); if (iblockdata1 == null) { @@ -150,15 +192,15 @@ return false; } else { Block block1 = iblockdata1.getBlock(); -@@ -204,6 +305,7 @@ +@@ -213,6 +338,7 @@ this.methodProfiler.b(); } + /* - if ((i & 2) != 0 && (!this.isStatic || (i & 4) == 0) && chunk.isReady()) { + if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && chunk.isReady()) { this.notify(blockposition); } -@@ -214,12 +316,35 @@ +@@ -223,12 +349,35 @@ this.updateAdjacentComparators(blockposition, block); } } @@ -182,7 +224,7 @@ + this.notify(blockposition); + } + -+ if (!this.isStatic && (flag & 1) != 0) { ++ if (!this.isClientSide && (flag & 1) != 0) { + this.update(blockposition, oldBlock); + if (newBLock.isComplexRedstone()) { + this.updateAdjacentComparators(blockposition, newBLock); @@ -194,7 +236,7 @@ public boolean setAir(BlockPosition blockposition) { return this.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3); } -@@ -253,6 +378,11 @@ +@@ -262,6 +411,11 @@ public void update(BlockPosition blockposition, Block block) { if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) { @@ -206,7 +248,7 @@ this.applyPhysics(blockposition, block); } -@@ -328,6 +458,17 @@ +@@ -337,6 +491,17 @@ IBlockData iblockdata = this.getType(blockposition); try { @@ -224,7 +266,7 @@ iblockdata.getBlock().doPhysics(this, blockposition, iblockdata, block); } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours"); -@@ -497,6 +638,17 @@ +@@ -518,6 +683,17 @@ } public IBlockData getType(BlockPosition blockposition) { @@ -242,7 +284,7 @@ if (!this.isValidLocation(blockposition)) { return Blocks.AIR.getBlockData(); } else { -@@ -704,6 +856,13 @@ +@@ -723,6 +899,13 @@ } public boolean addEntity(Entity entity) { @@ -256,7 +298,7 @@ int i = MathHelper.floor(entity.locX / 16.0D); int j = MathHelper.floor(entity.locZ / 16.0D); boolean flag = entity.attachedToPlayer; -@@ -712,7 +871,35 @@ +@@ -731,7 +914,35 @@ flag = true; } @@ -292,7 +334,7 @@ return false; } else { if (entity instanceof EntityHuman) { -@@ -734,6 +921,7 @@ +@@ -753,6 +964,7 @@ ((IWorldAccess) this.u.get(i)).a(entity); } @@ -300,7 +342,7 @@ } protected void b(Entity entity) { -@@ -741,6 +929,7 @@ +@@ -760,6 +972,7 @@ ((IWorldAccess) this.u.get(i)).b(entity); } @@ -308,7 +350,7 @@ } public void kill(Entity entity) { -@@ -775,7 +964,15 @@ +@@ -794,7 +1007,15 @@ this.getChunkAt(i, j).b(entity); } @@ -325,7 +367,7 @@ this.b(entity); } -@@ -958,6 +1155,11 @@ +@@ -978,6 +1199,11 @@ for (i = 0; i < this.k.size(); ++i) { entity = (Entity) this.k.get(i); @@ -337,7 +379,7 @@ try { ++entity.ticksLived; -@@ -1001,8 +1203,10 @@ +@@ -1021,8 +1247,10 @@ this.g.clear(); this.methodProfiler.c("regular"); @@ -350,7 +392,7 @@ if (entity.vehicle != null) { if (!entity.vehicle.dead && entity.vehicle.passenger == entity) { continue; -@@ -1033,7 +1237,7 @@ +@@ -1053,7 +1281,7 @@ this.getChunkAt(j, k).b(entity); } @@ -359,37 +401,36 @@ this.b(entity); } -@@ -1042,6 +1246,14 @@ +@@ -1062,6 +1290,13 @@ this.methodProfiler.c("blockEntities"); - this.L = true; + this.M = true; + // CraftBukkit start - From below, clean up tile entities before ticking them -+ if (!this.b.isEmpty()) { -+ this.tileEntityList.removeAll(this.b); -+ this.h.removeAll(this.b); -+ this.b.clear(); ++ if (!this.c.isEmpty()) { ++ this.tileEntityList.removeAll(this.c); ++ this.h.removeAll(this.c); ++ this.c.clear(); + } + // CraftBukkit end -+ Iterator iterator = this.tileEntityList.iterator(); while (iterator.hasNext()) { -@@ -1073,11 +1285,13 @@ +@@ -1093,11 +1328,13 @@ } - this.L = false; + this.M = false; + /* CraftBukkit start - Moved up - if (!this.b.isEmpty()) { - this.tileEntityList.removeAll(this.b); - this.h.removeAll(this.b); - this.b.clear(); + if (!this.c.isEmpty()) { + this.tileEntityList.removeAll(this.c); + this.h.removeAll(this.c); + this.c.clear(); } -+ */ // CraftBukkit end ++ // CraftBukkit end */ this.methodProfiler.c("pendingBlockEntities"); - if (!this.a.isEmpty()) { -@@ -1085,9 +1299,11 @@ - TileEntity tileentity1 = (TileEntity) this.a.get(l); + if (!this.b.isEmpty()) { +@@ -1105,9 +1342,11 @@ + TileEntity tileentity1 = (TileEntity) this.b.get(l); if (!tileentity1.x()) { + /* CraftBukkit start - Order matters, moved down @@ -400,7 +441,7 @@ if (this.isLoaded(tileentity1.getPosition())) { this.getChunkAtWorldCoords(tileentity1.getPosition()).a(tileentity1.getPosition(), tileentity1); -@@ -1141,7 +1357,10 @@ +@@ -1161,7 +1400,10 @@ int j = MathHelper.floor(entity.locZ); byte b0 = 32; @@ -412,16 +453,18 @@ entity.P = entity.locX; entity.Q = entity.locY; entity.R = entity.locZ; -@@ -1651,12 +1870,18 @@ +@@ -1679,12 +1921,20 @@ } this.p = MathHelper.a(this.p, 0.0F, 1.0F); -+ ++ ++ // CraftBukkit start + for (int idx = 0; idx < this.players.size(); ++idx) { + if (((EntityPlayer) this.players.get(idx)).world == this) { + ((EntityPlayer) this.players.get(idx)).tickWeather(); + } + } ++ // CraftBukkit end } } } @@ -432,7 +475,7 @@ this.methodProfiler.a("buildList"); int i; -@@ -1673,7 +1898,7 @@ +@@ -1701,7 +1951,7 @@ for (int i1 = -l; i1 <= l; ++i1) { for (int j1 = -l; j1 <= l; ++j1) { @@ -441,7 +484,7 @@ } } } -@@ -1851,7 +2076,10 @@ +@@ -1879,7 +2129,10 @@ } public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) { @@ -453,10 +496,39 @@ return false; } else { int i = 0; -@@ -2095,8 +2323,17 @@ +@@ -2042,7 +2295,7 @@ + while (iterator.hasNext()) { + Entity entity = (Entity) iterator.next(); + +- if (oclass.isAssignableFrom(entity.getClass()) && predicate.apply(entity)) { ++ if (oclass.isAssignableFrom(entity.getClass()) && predicate.apply((T) entity)) { // CraftBukkit - fix decompile error + arraylist.add(entity); + } + } +@@ -2057,7 +2310,7 @@ + while (iterator.hasNext()) { + Entity entity = (Entity) iterator.next(); + +- if (oclass.isAssignableFrom(entity.getClass()) && predicate.apply(entity)) { ++ if (oclass.isAssignableFrom(entity.getClass()) && predicate.apply((T) entity)) { // CraftBukkit - fix decompile error + arraylist.add(entity); + } + } +@@ -2105,7 +2358,7 @@ + } + } + +- return entity; ++ return (T) entity; // CraftBukkit fix decompile error + } + + public Entity a(int i) { +@@ -2125,8 +2378,17 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); +- +- if ((!(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) && oclass.isAssignableFrom(entity.getClass())) { + // CraftBukkit start - Split out persistent check, don't apply it to special persistent mobs + if (entity instanceof EntityInsentient) { + EntityInsentient entityinsentient = (EntityInsentient) entity; @@ -464,18 +536,17 @@ + continue; + } + } - -- if ((!(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) && oclass.isAssignableFrom(entity.getClass())) { ++ + if (oclass.isAssignableFrom(entity.getClass())) { + // if ((!(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) && oclass.isAssignableFrom(entity.getClass())) { + // CraftBukkit end ++i; } } -@@ -2105,12 +2342,17 @@ +@@ -2135,12 +2397,18 @@ } - public void b(Collection collection) { + public void b(Collection collection) { - this.entityList.addAll(collection); + // CraftBukkit start + // this.entityList.addAll(collection); @@ -483,7 +554,7 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); -- + + if (entity == null) { + continue; + } @@ -492,7 +563,7 @@ this.a(entity); } -@@ -2124,7 +2366,13 @@ +@@ -2154,7 +2422,13 @@ Block block1 = this.getType(blockposition).getBlock(); AxisAlignedBB axisalignedbb = flag ? null : block.a(this, blockposition, block.getBlockData()); @@ -506,8 +577,8 @@ + // CraftBukkit end } - public int getBlockPower(BlockPosition blockposition, EnumDirection enumdirection) { -@@ -2215,6 +2463,11 @@ + public int F() { +@@ -2253,6 +2527,11 @@ for (int i = 0; i < this.players.size(); ++i) { EntityHuman entityhuman1 = (EntityHuman) this.players.get(i); @@ -519,16 +590,7 @@ if (IEntitySelector.d.apply(entityhuman1)) { double d5 = entityhuman1.e(d0, d1, d2); -@@ -2269,7 +2522,7 @@ - return null; - } - -- public void checkSession() { -+ public void checkSession() throws ExceptionWorldConflict { // CraftBukkit - added throws - this.dataManager.checkSession(); - } - -@@ -2331,6 +2584,16 @@ +@@ -2369,6 +2648,16 @@ public void everyoneSleeping() {} @@ -536,7 +598,7 @@ + // Calls the method that checks to see if players are sleeping + // Called by CraftPlayer.setPermanentSleeping() + public void checkSleepStatus() { -+ if (!this.isStatic) { ++ if (!this.isClientSide) { + this.everyoneSleeping(); + } + } @@ -545,7 +607,7 @@ public float h(float f) { return (this.q + (this.r - this.q) * f) * this.j(f); } -@@ -2538,6 +2801,6 @@ +@@ -2592,6 +2881,6 @@ int l = j * 16 + 8 - blockposition.getZ(); short short0 = 128; diff --git a/nms-patches/WorldBorder.patch b/nms-patches/WorldBorder.patch index daf3517f86..04ad152c38 100644 --- a/nms-patches/WorldBorder.patch +++ b/nms-patches/WorldBorder.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/WorldBorder.java 2014-12-10 19:16:20.872465385 +0000 -+++ src/main/java/net/minecraft/server/WorldBorder.java 2014-12-10 19:11:46.664468361 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/WorldBorder.java 2015-02-26 22:40:23.179608133 +0000 ++++ src/main/java/net/minecraft/server/WorldBorder.java 2015-02-26 22:40:23.183608133 +0000 @@ -18,6 +18,7 @@ private double j; private int k; @@ -8,7 +8,7 @@ public WorldBorder() { this.e = this.d; -@@ -32,9 +33,21 @@ +@@ -32,8 +33,19 @@ return (double) (blockposition.getX() + 1) > this.b() && (double) blockposition.getX() < this.d() && (double) (blockposition.getZ() + 1) > this.c() && (double) blockposition.getZ() < this.e(); } @@ -16,22 +16,20 @@ public boolean isInBounds(ChunkCoordIntPair chunkcoordintpair) { - return (double) chunkcoordintpair.e() > this.b() && (double) chunkcoordintpair.c() < this.d() && (double) chunkcoordintpair.f() > this.c() && (double) chunkcoordintpair.d() < this.e(); + return isInBounds(chunkcoordintpair.x, chunkcoordintpair.z); - } -+ ++ } ++ + // Inlined the getters from ChunkCoordIntPair + public boolean isInBounds(long chunkcoords) { + return isInBounds(org.bukkit.craftbukkit.util.LongHash.msw(chunkcoords), org.bukkit.craftbukkit.util.LongHash.lsw(chunkcoords)); + } -+ ++ + // Inlined the getters from ChunkCoordIntPair + public boolean isInBounds(int x, int z) { + return (double) ((x << 4) + 15) > this.b() && (double) (x << 4) < this.d() && (double) ((z << 4) + 15) > this.c() && (double) (x << 4) < this.e(); -+ } -+ // CraftBukkit end + } public boolean a(AxisAlignedBB axisalignedbb) { - return axisalignedbb.d > this.b() && axisalignedbb.a < this.d() && axisalignedbb.f > this.c() && axisalignedbb.c < this.e(); -@@ -177,6 +190,7 @@ +@@ -177,6 +189,7 @@ } public void a(IWorldBorderListener iworldborderlistener) { diff --git a/nms-patches/WorldBorderListener.patch b/nms-patches/WorldBorderListener.patch deleted file mode 100644 index 2a7d528411..0000000000 --- a/nms-patches/WorldBorderListener.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/WorldBorderListener.java 2014-12-10 19:16:20.876465384 +0000 -+++ src/main/java/net/minecraft/server/WorldBorderListener.java 2014-12-10 18:59:49.024476151 +0000 -@@ -9,23 +9,23 @@ - } - - public void a(WorldBorder worldborder, double d0) { -- this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.SET_SIZE)); -+ this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.SET_SIZE), worldborder.world); // CraftBukkit - } - - public void a(WorldBorder worldborder, double d0, double d1, long i) { -- this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.LERP_SIZE)); -+ this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.LERP_SIZE), worldborder.world); // CraftBukkit - } - - public void a(WorldBorder worldborder, double d0, double d1) { -- this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.SET_CENTER)); -+ this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.SET_CENTER), worldborder.world); // CraftBukkit - } - - public void a(WorldBorder worldborder, int i) { -- this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.SET_WARNING_TIME)); -+ this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.SET_WARNING_TIME), worldborder.world); // CraftBukkit - } - - public void b(WorldBorder worldborder, int i) { -- this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.SET_WARNING_BLOCKS)); -+ this.a.sendAll(new PacketPlayOutWorldBorder(worldborder, EnumWorldBorderAction.SET_WARNING_BLOCKS), worldborder.world); // CraftBukkit - } - - public void b(WorldBorder worldborder, double d0) {} diff --git a/nms-patches/WorldData.patch b/nms-patches/WorldData.patch index 74f093fb78..07e5410fd7 100644 --- a/nms-patches/WorldData.patch +++ b/nms-patches/WorldData.patch @@ -1,16 +1,26 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/WorldData.java 2015-01-13 20:36:38.880978444 +1100 -+++ src/main/java/net/minecraft/server/WorldData.java 2015-01-13 20:36:38.880978444 +1100 -@@ -1,6 +1,9 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/WorldData.java 2015-03-01 00:59:18.411214060 +0000 ++++ src/main/java/net/minecraft/server/WorldData.java 2015-03-01 00:59:18.411214060 +0000 +@@ -1,6 +1,11 @@ package net.minecraft.server; import java.util.concurrent.Callable; ++// CraftBukkit start +import org.bukkit.Bukkit; +import org.bukkit.event.weather.ThunderChangeEvent; +import org.bukkit.event.weather.WeatherChangeEvent; ++// CraftBukkit end public class WorldData { -@@ -395,6 +398,18 @@ +@@ -41,6 +46,7 @@ + private int I; + private int J; + private GameRules K; ++ public WorldServer world; // CraftBukkit + + protected WorldData() { + this.c = WorldType.NORMAL; +@@ -395,6 +401,18 @@ } public void setThundering(boolean flag) { @@ -29,7 +39,7 @@ this.s = flag; } -@@ -411,6 +426,18 @@ +@@ -411,6 +429,18 @@ } public void setStorm(boolean flag) { @@ -48,9 +58,22 @@ this.q = flag; } -@@ -645,4 +672,12 @@ - static boolean q(WorldData worlddata) { - return worlddata.x; +@@ -556,6 +586,12 @@ + + public void setDifficulty(EnumDifficulty enumdifficulty) { + this.z = enumdifficulty; ++ // CraftBukkit start ++ PacketPlayOutServerDifficulty packet = new PacketPlayOutServerDifficulty(this.y(), this.z()); // PAIL: Rename ++ for (EntityPlayer player : (java.util.List) (java.util.List) world.players) { ++ player.playerConnection.sendPacket(packet); ++ } ++ // CraftBukkit end + } + + public boolean z() { +@@ -664,4 +700,12 @@ + } + }); } + + // CraftBukkit start - Check if the name stored in NBT is the correct one diff --git a/nms-patches/WorldGenGroundBush.patch b/nms-patches/WorldGenGroundBush.patch index 01ccd29a02..92db9cf4e5 100644 --- a/nms-patches/WorldGenGroundBush.patch +++ b/nms-patches/WorldGenGroundBush.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/WorldGenGroundBush.java 2014-11-28 17:43:43.421707428 +0000 -+++ src/main/java/net/minecraft/server/WorldGenGroundBush.java 2014-11-28 17:38:18.000000000 +0000 -@@ -46,7 +46,11 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/WorldGenGroundBush.java 2015-02-26 22:40:23.195608133 +0000 ++++ src/main/java/net/minecraft/server/WorldGenGroundBush.java 2015-02-26 22:40:23.195608133 +0000 +@@ -46,7 +46,12 @@ } } } @@ -9,6 +9,7 @@ + return false; } + // CraftBukkit end ++ return true; } diff --git a/nms-patches/WorldGenMegaTreeAbstract.patch b/nms-patches/WorldGenMegaTreeAbstract.patch index f743f437e7..5697f03ffc 100644 --- a/nms-patches/WorldGenMegaTreeAbstract.patch +++ b/nms-patches/WorldGenMegaTreeAbstract.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/WorldGenMegaTreeAbstract.java 2014-11-28 17:43:43.425707428 +0000 -+++ src/main/java/net/minecraft/server/WorldGenMegaTreeAbstract.java 2014-11-28 17:38:17.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/WorldGenMegaTreeAbstract.java 2015-02-26 22:40:23.195608133 +0000 ++++ src/main/java/net/minecraft/server/WorldGenMegaTreeAbstract.java 2015-02-26 22:40:23.199608133 +0000 @@ -42,7 +42,7 @@ for (int k = -b0; k <= b0 && flag; ++k) { diff --git a/nms-patches/WorldGenRegistration.patch b/nms-patches/WorldGenRegistration.patch new file mode 100644 index 0000000000..7aa940cf39 --- /dev/null +++ b/nms-patches/WorldGenRegistration.patch @@ -0,0 +1,11 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/WorldGenRegistration.java 2015-02-26 22:40:23.199608133 +0000 ++++ src/main/java/net/minecraft/server/WorldGenRegistration.java 2015-02-26 22:40:23.203608133 +0000 +@@ -108,7 +108,7 @@ + + entitywitch.setPositionRotation((double) i1 + 0.5D, (double) j1, (double) k1 + 0.5D, 0.0F, 0.0F); + entitywitch.prepare(world.E(new BlockPosition(i1, j1, k1)), (GroupDataEntity) null); +- world.addEntity(entitywitch); ++ world.addEntity(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason + } + } + diff --git a/nms-patches/WorldGenVillagePiece.patch b/nms-patches/WorldGenVillagePiece.patch deleted file mode 100644 index 99376c858b..0000000000 --- a/nms-patches/WorldGenVillagePiece.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/WorldGenVillagePiece.java 2014-11-28 17:43:43.425707428 +0000 -+++ src/main/java/net/minecraft/server/WorldGenVillagePiece.java 2014-11-28 17:38:21.000000000 +0000 -@@ -114,7 +114,7 @@ - entityvillager.setPositionRotation((double) j1 + 0.5D, (double) k1, (double) l1 + 0.5D, 0.0F, 0.0F); - entityvillager.prepare(world.E(new BlockPosition(entityvillager)), (GroupDataEntity) null); - entityvillager.setProfession(this.c(i1, entityvillager.getProfession())); -- world.addEntity(entityvillager); -+ world.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason - } - - } diff --git a/nms-patches/WorldGenVillagePieces.patch b/nms-patches/WorldGenVillagePieces.patch index e69de29bb2..ca1392ca38 100644 --- a/nms-patches/WorldGenVillagePieces.patch +++ b/nms-patches/WorldGenVillagePieces.patch @@ -0,0 +1,11 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/WorldGenVillagePieces.java 2015-02-26 22:40:23.207608133 +0000 ++++ src/main/java/net/minecraft/server/WorldGenVillagePieces.java 2015-02-26 22:40:23.211608133 +0000 +@@ -1559,7 +1559,7 @@ + entityvillager.setPositionRotation((double) j1 + 0.5D, (double) k1, (double) l1 + 0.5D, 0.0F, 0.0F); + entityvillager.prepare(world.E(new BlockPosition(entityvillager)), (GroupDataEntity) null); + entityvillager.setProfession(this.c(i1, entityvillager.getProfession())); +- world.addEntity(entityvillager); ++ world.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason + } + + } diff --git a/nms-patches/WorldGenWitchHut.patch b/nms-patches/WorldGenWitchHut.patch deleted file mode 100644 index 05dc944767..0000000000 --- a/nms-patches/WorldGenWitchHut.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/WorldGenWitchHut.java 2014-11-28 17:43:43.429707428 +0000 -+++ src/main/java/net/minecraft/server/WorldGenWitchHut.java 2014-11-28 17:38:21.000000000 +0000 -@@ -77,7 +77,7 @@ - - entitywitch.setPositionRotation((double) i1 + 0.5D, (double) j1, (double) k1 + 0.5D, 0.0F, 0.0F); - entitywitch.prepare(world.E(new BlockPosition(i1, j1, k1)), (GroupDataEntity) null); -- world.addEntity(entitywitch); -+ world.addEntity(entitywitch, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.CHUNK_GEN); // CraftBukkit - add SpawnReason - } - } - diff --git a/nms-patches/WorldManager.patch b/nms-patches/WorldManager.patch index 11eaf42f60..f87dc50aff 100644 --- a/nms-patches/WorldManager.patch +++ b/nms-patches/WorldManager.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/WorldManager.java 2014-11-28 17:43:43.437707427 +0000 -+++ src/main/java/net/minecraft/server/WorldManager.java 2014-11-28 17:38:23.000000000 +0000 -@@ -23,11 +23,13 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/WorldManager.java 2015-02-26 22:40:23.223608132 +0000 ++++ src/main/java/net/minecraft/server/WorldManager.java 2015-02-26 22:40:23.227608132 +0000 +@@ -24,11 +24,13 @@ } public void a(String s, double d0, double d1, double d2, float f, float f1) { @@ -16,7 +16,7 @@ } public void a(int i, int j, int k, int l, int i1, int j1) {} -@@ -41,7 +43,8 @@ +@@ -42,7 +44,8 @@ public void a(String s, BlockPosition blockposition) {} public void a(EntityHuman entityhuman, int i, BlockPosition blockposition, int j) { diff --git a/nms-patches/WorldMap.patch b/nms-patches/WorldMap.patch index 9f8735545c..26b86f89cc 100644 --- a/nms-patches/WorldMap.patch +++ b/nms-patches/WorldMap.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/WorldMap.java 2014-11-28 17:43:43.441707427 +0000 -+++ src/main/java/net/minecraft/server/WorldMap.java 2014-11-28 17:38:21.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/WorldMap.java 2015-02-26 22:40:23.227608132 +0000 ++++ src/main/java/net/minecraft/server/WorldMap.java 2015-02-26 22:40:23.231608132 +0000 @@ -6,6 +6,14 @@ import java.util.List; import java.util.Map; @@ -15,17 +15,16 @@ public class WorldMap extends PersistentBase { public int centerX; -@@ -16,9 +24,19 @@ - public List g = Lists.newArrayList(); - private Map i = Maps.newHashMap(); - public Map decorations = Maps.newLinkedHashMap(); -+ +@@ -17,8 +25,18 @@ + private Map i = Maps.newHashMap(); + public Map decorations = Maps.newLinkedHashMap(); + + // CraftBukkit start + public final CraftMapView mapView; + private CraftServer server; + private UUID uniqueId = null; + // CraftBukkit end - ++ public WorldMap(String s) { super(s); + // CraftBukkit start @@ -93,3 +92,31 @@ nbttagcompound.setByte("dimension", this.map); nbttagcompound.setInt("xCenter", this.centerX); nbttagcompound.setInt("zCenter", this.centerZ); +@@ -212,12 +272,25 @@ + } + + public Packet a(ItemStack itemstack) { ++ // CraftBukkit start ++ org.bukkit.craftbukkit.map.RenderData render = WorldMap.this.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) this.trackee.getBukkitEntity()); // CraftBukkit ++ ++ java.util.Collection icons = new java.util.ArrayList(); ++ ++ for ( org.bukkit.map.MapCursor cursor : render.cursors) { ++ ++ if (cursor.isVisible()) { ++ icons.add(new MapIcon(cursor.getRawType(), cursor.getX(), cursor.getY(), cursor.getDirection())); ++ } ++ } ++ + if (this.d) { + this.d = false; +- return new PacketPlayOutMap(itemstack.getData(), WorldMap.this.scale, WorldMap.this.decorations.values(), WorldMap.this.colors, this.e, this.f, this.g + 1 - this.e, this.h + 1 - this.f); ++ return new PacketPlayOutMap(itemstack.getData(), WorldMap.this.scale, icons, render.buffer, this.e, this.f, this.g + 1 - this.e, this.h + 1 - this.f); + } else { +- return this.i++ % 5 == 0 ? new PacketPlayOutMap(itemstack.getData(), WorldMap.this.scale, WorldMap.this.decorations.values(), WorldMap.this.colors, 0, 0, 0, 0) : null; ++ return this.i++ % 5 == 0 ? new PacketPlayOutMap(itemstack.getData(), WorldMap.this.scale, icons, render.buffer, 0, 0, 0, 0) : null; + } ++ // CraftBukkit end + } + + public void a(int i, int j) { diff --git a/nms-patches/WorldMapHumanTracker.patch b/nms-patches/WorldMapHumanTracker.patch deleted file mode 100644 index fcd7f894b2..0000000000 --- a/nms-patches/WorldMapHumanTracker.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/WorldMapHumanTracker.java 2014-11-28 17:43:43.437707427 +0000 -+++ src/main/java/net/minecraft/server/WorldMapHumanTracker.java 2014-11-28 17:38:19.000000000 +0000 -@@ -23,12 +23,26 @@ - } - - public Packet a(ItemStack itemstack) { -+ // CraftBukkit start -+ org.bukkit.craftbukkit.map.RenderData render = this.worldMap.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) this.trackee.getBukkitEntity()); // CraftBukkit -+ -+ java.util.Collection icons = new java.util.ArrayList(); -+ -+ for ( org.bukkit.map.MapCursor cursor : render.cursors) { -+ -+ if (cursor.isVisible()) { -+ icons.add(new MapIcon(cursor.getRawType(), cursor.getX(), cursor.getY(), cursor.getDirection())); -+ } -+ } -+ -+ - if (this.d) { - this.d = false; -- return new PacketPlayOutMap(itemstack.getData(), this.worldMap.scale, this.worldMap.decorations.values(), this.worldMap.colors, this.e, this.f, this.g + 1 - this.e, this.h + 1 - this.f); -+ return new PacketPlayOutMap(itemstack.getData(), this.worldMap.scale, icons, render.buffer, this.e, this.f, this.g + 1 - this.e, this.h + 1 - this.f); - } else { -- return this.i++ % 5 == 0 ? new PacketPlayOutMap(itemstack.getData(), this.worldMap.scale, this.worldMap.decorations.values(), this.worldMap.colors, 0, 0, 0, 0) : null; -+ return this.i++ % 5 == 0 ? new PacketPlayOutMap(itemstack.getData(), this.worldMap.scale, icons, render.buffer, 0, 0, 0, 0) : null; - } -+ // CraftBukkit end - } - - public void a(int i, int j) { diff --git a/nms-patches/WorldNBTStorage.patch b/nms-patches/WorldNBTStorage.patch index aff7c5d782..a685c538f9 100644 --- a/nms-patches/WorldNBTStorage.patch +++ b/nms-patches/WorldNBTStorage.patch @@ -1,5 +1,5 @@ ---- ../work/decompile-8eb82bde//net/minecraft/server/WorldNBTStorage.java 2014-11-28 17:43:43.441707427 +0000 -+++ src/main/java/net/minecraft/server/WorldNBTStorage.java 2014-11-28 17:38:19.000000000 +0000 +--- /home/matt/mc-dev-private//net/minecraft/server/WorldNBTStorage.java 2015-02-26 22:40:23.231608132 +0000 ++++ src/main/java/net/minecraft/server/WorldNBTStorage.java 2015-02-26 22:40:23.235608132 +0000 @@ -11,6 +11,12 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -15,21 +15,12 @@ private static final Logger a = LogManager.getLogger(); @@ -19,6 +25,7 @@ private final File dataDir; - private final long sessionId = MinecraftServer.ax(); + private final long sessionId = MinecraftServer.ay(); private final String f; + private UUID uuid = null; // CraftBukkit public WorldNBTStorage(File file, String s, boolean flag) { this.baseDir = new File(file, s); -@@ -55,7 +62,7 @@ - return this.baseDir; - } - -- public void checkSession() { -+ public void checkSession() throws ExceptionWorldConflict { // CraftBukkit - throws ExceptionWorldConflict - try { - File file = new File(this.baseDir, "session.lock"); - DataInputStream datainputstream = new DataInputStream(new FileInputStream(file)); @@ -202,12 +209,39 @@ } diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch index 42ccea1c69..b435c1d598 100644 --- a/nms-patches/WorldServer.patch +++ b/nms-patches/WorldServer.patch @@ -1,6 +1,6 @@ ---- ../work/decompile-8eb82bde/net/minecraft/server/WorldServer.java 2015-01-05 09:50:02.053188213 +1100 -+++ src/main/java/net/minecraft/server/WorldServer.java 2015-01-05 09:50:02.057188206 +1100 -@@ -16,6 +16,18 @@ +--- /home/matt/mc-dev-private//net/minecraft/server/WorldServer.java 2015-03-01 00:59:18.643214058 +0000 ++++ src/main/java/net/minecraft/server/WorldServer.java 2015-03-01 00:59:18.647214058 +0000 +@@ -16,11 +16,23 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -19,20 +19,27 @@ public class WorldServer extends World implements IAsyncTaskHandler { private static final Logger a = LogManager.getLogger(); -@@ -37,14 +49,21 @@ - private static final List U = Lists.newArrayList(new StructurePieceTreasure[] { new StructurePieceTreasure(Items.STICK, 0, 1, 3, 10), new StructurePieceTreasure(Item.getItemOf(Blocks.PLANKS), 0, 1, 3, 10), new StructurePieceTreasure(Item.getItemOf(Blocks.LOG), 0, 1, 3, 10), new StructurePieceTreasure(Items.STONE_AXE, 0, 1, 1, 3), new StructurePieceTreasure(Items.WOODEN_AXE, 0, 1, 1, 5), new StructurePieceTreasure(Items.STONE_PICKAXE, 0, 1, 1, 3), new StructurePieceTreasure(Items.WOODEN_PICKAXE, 0, 1, 1, 5), new StructurePieceTreasure(Items.APPLE, 0, 2, 3, 5), new StructurePieceTreasure(Items.BREAD, 0, 2, 3, 3), new StructurePieceTreasure(Item.getItemOf(Blocks.LOG2), 0, 1, 3, 10)}); - private List V = Lists.newArrayList(); + private final MinecraftServer server; +- private final EntityTracker tracker; ++ public EntityTracker tracker; // CraftBukkit - public, remove final + private final PlayerChunkMap manager; + private final Set L = Sets.newHashSet(); + private final TreeSet M = new TreeSet(); +@@ -37,14 +49,22 @@ + private static final List U = Lists.newArrayList(new StructurePieceTreasure[] { new StructurePieceTreasure(Items.STICK, 0, 1, 3, 10), new StructurePieceTreasure(Item.getItemOf(Blocks.PLANKS), 0, 1, 3, 10), new StructurePieceTreasure(Item.getItemOf(Blocks.LOG), 0, 1, 3, 10), new StructurePieceTreasure(Items.STONE_AXE, 0, 1, 1, 3), new StructurePieceTreasure(Items.WOODEN_AXE, 0, 1, 1, 5), new StructurePieceTreasure(Items.STONE_PICKAXE, 0, 1, 1, 3), new StructurePieceTreasure(Items.WOODEN_PICKAXE, 0, 1, 1, 5), new StructurePieceTreasure(Items.APPLE, 0, 2, 3, 5), new StructurePieceTreasure(Items.BREAD, 0, 2, 3, 3), new StructurePieceTreasure(Item.getItemOf(Blocks.LOG2), 0, 1, 3, 10)}); + private List V = Lists.newArrayList(); - public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, WorldData worlddata, int i, MethodProfiler methodprofiler) { - super(idatamanager, worlddata, WorldProvider.byDimension(i), methodprofiler, false); -+ // CraftBukkit start ++ // CraftBukkit start + public final int dimension; + + // Add env and gen to constructor -+ public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, WorldData worlddata, int i, MethodProfiler methodprofiler, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { -+ super(idatamanager, worlddata, WorldProvider.byDimension(env.getId()), methodprofiler, false, gen, env); ++ public WorldServer(MinecraftServer minecraftserver, IDataManager idatamanager, WorldData worlddata, int i, MethodProfiler methodprofiler, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { ++ super(idatamanager, worlddata, WorldProvider.byDimension(i), methodprofiler, false, gen, env); + this.dimension = i; + this.pvpMode = minecraftserver.getPVP(); ++ worlddata.world = this; + // CraftBukkit end this.server = minecraftserver; this.tracker = new EntityTracker(this); @@ -43,12 +50,11 @@ + this.Q = new org.bukkit.craftbukkit.CraftTravelAgent(this); // CraftBukkit this.B(); this.C(); - this.af().a(minecraftserver.aG()); -@@ -86,6 +105,89 @@ - + this.getWorldBorder().a(minecraftserver.aH()); +@@ -87,6 +107,89 @@ return this; } -+ + + // CraftBukkit start + @Override + public TileEntity getTileEntity(BlockPosition pos) { @@ -72,7 +78,7 @@ + result = fixTileEntity(pos, type, result); + } + } else if (type == Blocks.JUKEBOX) { -+ if (!(result instanceof TileEntityRecordPlayer)) { ++ if (!(result instanceof BlockJukeBox.TileEntityRecordPlayer)) { + result = fixTileEntity(pos, type, result); + } + } else if (type == Blocks.NOTEBLOCK) { @@ -131,13 +137,15 @@ + } + } + // CraftBukkit end - ++ public void doTick() { super.doTick(); -@@ -105,8 +207,11 @@ + if (this.getWorldData().isHardcore() && this.getDifficulty() != EnumDifficulty.HARD) { +@@ -104,9 +207,11 @@ + this.e(); } - this.methodProfiler.a("mobSpawner"); +- this.methodProfiler.a("mobSpawner"); - if (this.getGameRules().getBoolean("doMobSpawning") && this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) { - this.R.a(this, this.allowMonsters, this.allowAnimals, this.worldData.getTime() % 400L == 0L); + // CraftBukkit start - Only call spawner if we have players online and the world allows for mobs or animals @@ -152,21 +160,21 @@ this.Q.a(this.getTime()); this.methodProfiler.b(); this.ak(); -+ ++ + this.getWorld().processChunkGC(); // CraftBukkit } - public BiomeMeta a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) { + public BiomeBase.BiomeMeta a(EnumCreatureType enumcreaturetype, BlockPosition blockposition) { @@ -161,7 +268,7 @@ if (entityhuman.v()) { ++i; - } else if (entityhuman.isSleeping()) { -+ } else if (entityhuman.isSleeping() || entityhuman.fauxSleeping) { // CraftBukkit ++ } else if (entityhuman.isSleeping() || entityhuman.fauxSleeping) { ++j; } } -@@ -187,26 +294,46 @@ +@@ -187,25 +294,46 @@ } private void ag() { @@ -191,12 +199,12 @@ } public boolean everyoneDeeplySleeping() { - if (this.O && !this.isStatic) { + if (this.O && !this.isClientSide) { Iterator iterator = this.players.iterator(); + // CraftBukkit - This allows us to assume that some people are in bed but not really, allowing time to pass in spite of AFKers + boolean foundActualSleepers = false; -+ ++ EntityHuman entityhuman; do { @@ -207,28 +215,24 @@ entityhuman = (EntityHuman) iterator.next(); - } while (!entityhuman.v() && entityhuman.isDeeplySleeping()); -- ++ + // CraftBukkit start + if (entityhuman.isDeeplySleeping()) { + foundActualSleepers = true; + } + } while (!entityhuman.v() && (entityhuman.isDeeplySleeping() || entityhuman.fauxSleeping)); + // CraftBukkit end -+ + return false; } else { - return false; -@@ -227,15 +354,22 @@ - } else { +@@ -228,13 +356,20 @@ int i = 0; int j = 0; -- + - for (Iterator iterator1 = this.chunkTickList.iterator(); iterator1.hasNext(); this.methodProfiler.b()) { - ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) iterator1.next(); - int k = chunkcoordintpair1.x * 16; - int l = chunkcoordintpair1.z * 16; -- -+ + // CraftBukkit start + //for (Iterator iterator1 = this.chunkTickList.iterator(); iterator1.hasNext(); this.methodProfiler.b()) { + // ChunkCoordIntPair chunkcoordintpair1 = (ChunkCoordIntPair) iterator1.next(); @@ -239,17 +243,15 @@ + int chunkZ = LongHash.lsw(chunkCoord); + int k = chunkX * 16; + int l = chunkZ * 16; -+ + this.methodProfiler.a("getChunk"); - Chunk chunk = this.getChunkAt(chunkcoordintpair1.x, chunkcoordintpair1.z); -- + Chunk chunk = this.getChunkAt(chunkX, chunkZ); + // CraftBukkit end -+ + this.a(k, l, chunk); this.methodProfiler.c("tickChunk"); - chunk.b(false); -@@ -260,11 +394,29 @@ +@@ -260,11 +395,29 @@ BlockPosition blockposition1 = blockposition.down(); if (this.w(blockposition1)) { @@ -281,16 +283,16 @@ } if (this.S() && this.getBiome(blockposition1).e()) { -@@ -376,7 +528,7 @@ +@@ -383,7 +536,7 @@ } public void tickEntities() { - if (this.players.isEmpty()) { -+ if (false && this.players.isEmpty()) { // CraftBukkit - this prevents entity cleanup, other issues on servers with no players ++ if (false && this.players.isEmpty()) { // CraftBukkit - this prevents entity cleanup, other issues on servers with no players if (this.emptyTime++ >= 1200) { return; } -@@ -401,7 +553,13 @@ +@@ -408,7 +561,13 @@ throw new IllegalStateException("TickNextTick list out of synch"); } else { if (i > 1000) { @@ -301,11 +303,11 @@ + } else { + i = 1000; + } -+ // CraftBukkit end ++ // CraftBukkit end } this.methodProfiler.a("cleaning"); -@@ -501,6 +659,7 @@ +@@ -508,6 +667,7 @@ return arraylist; } @@ -313,21 +315,19 @@ public void entityJoinedWorld(Entity entity, boolean flag) { if (!this.getSpawnAnimals() && (entity instanceof EntityAnimal || entity instanceof EntityWaterAnimal)) { entity.die(); -@@ -511,7 +670,9 @@ - } +@@ -519,6 +679,7 @@ super.entityJoinedWorld(entity, flag); -+ } + // CraftBukkit end */ private boolean getSpawnNPCs() { return this.server.getSpawnNPCs(); -@@ -523,14 +684,44 @@ - +@@ -531,13 +692,43 @@ protected IChunkProvider k() { IChunkLoader ichunkloader = this.dataManager.createChunkLoader(this.worldProvider); -+ + +- this.chunkProviderServer = new ChunkProviderServer(this, ichunkloader, this.worldProvider.getChunkProvider()); + // CraftBukkit start + org.bukkit.craftbukkit.generator.InternalChunkGenerator gen; + @@ -340,17 +340,15 @@ + } else { + gen = new org.bukkit.craftbukkit.generator.NormalChunkGenerator(this, this.getSeed()); + } - -- this.chunkProviderServer = new ChunkProviderServer(this, ichunkloader, this.worldProvider.getChunkProvider()); ++ + this.chunkProviderServer = new ChunkProviderServer(this, ichunkloader, gen); + // CraftBukkit end return this.chunkProviderServer; } - public List getTileEntities(int i, int j, int k, int l, int i1, int j1) { + public List getTileEntities(int i, int j, int k, int l, int i1, int j1) { ArrayList arraylist = Lists.newArrayList(); -- -+ + + // CraftBukkit start - Get tile entities from chunks instead of world + for (int chunkX = (i >> 4); chunkX <= ((l - 1) >> 4); chunkX++) { + for (int chunkZ = (k >> 4); chunkZ <= ((j1 - 1) >> 4); chunkZ++) { @@ -370,7 +368,7 @@ for (int k1 = 0; k1 < this.h.size(); ++k1) { TileEntity tileentity = (TileEntity) this.h.get(k1); BlockPosition blockposition = tileentity.getPosition(); -@@ -539,6 +730,8 @@ +@@ -546,6 +737,8 @@ arraylist.add(tileentity); } } @@ -379,11 +377,10 @@ return arraylist; } -@@ -601,6 +794,23 @@ - int i = 0; +@@ -609,6 +802,23 @@ int j = this.worldProvider.getSeaLevel(); int k = 0; -+ + + // CraftBukkit start + if (this.generator != null) { + Random rand = new Random(this.getSeed()); @@ -399,11 +396,12 @@ + } + } + } -+ // CraftBukkit end - ++ // CraftBukkit end ++ if (blockposition != null) { i = blockposition.getX(); -@@ -611,7 +821,7 @@ + k = blockposition.getZ(); +@@ -618,7 +828,7 @@ int l = 0; @@ -412,51 +410,39 @@ i += random.nextInt(64) - random.nextInt(64); k += random.nextInt(64) - random.nextInt(64); ++l; -@@ -648,8 +858,9 @@ - return this.worldProvider.h(); - } +@@ -657,6 +867,7 @@ -- public void save(boolean flag, IProgressUpdate iprogressupdate) { -+ public void save(boolean flag, IProgressUpdate iprogressupdate) throws ExceptionWorldConflict { // CraftBukkit - added throws + public void save(boolean flag, IProgressUpdate iprogressupdate) throws ExceptionWorldConflict { if (this.chunkProvider.canSave()) { + org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit if (iprogressupdate != null) { iprogressupdate.a("Saving level"); } -@@ -660,7 +871,8 @@ +@@ -667,7 +878,8 @@ } this.chunkProvider.saveChunks(flag, iprogressupdate); -- List list = this.chunkProviderServer.a(); +- ArrayList arraylist = Lists.newArrayList(this.chunkProviderServer.a()); + // CraftBukkit - ArrayList -> Collection -+ Collection list = this.chunkProviderServer.a(); - Iterator iterator = list.iterator(); ++ Collection arraylist = this.chunkProviderServer.a(); + Iterator iterator = arraylist.iterator(); while (iterator.hasNext()) { -@@ -680,7 +892,7 @@ - } - } - -- protected void a() { -+ protected void a() throws ExceptionWorldConflict { // CraftBukkit - added throws - this.checkSession(); - this.worldData.a(this.af().h()); - this.worldData.d(this.af().f()); -@@ -691,8 +903,12 @@ - this.worldData.k(this.af().p()); - this.worldData.b(this.af().j()); - this.worldData.e(this.af().i()); +@@ -698,8 +910,12 @@ + this.worldData.k(this.getWorldBorder().getWarningTime()); + this.worldData.b(this.getWorldBorder().j()); + this.worldData.e(this.getWorldBorder().i()); + // CraftBukkit start - save worldMaps once, rather than once per shared world + if (!(this instanceof SecondaryWorldServer)) { + this.worldMaps.a(); + } - this.dataManager.saveWorldData(this.worldData, this.server.getPlayerList().u()); + this.dataManager.saveWorldData(this.worldData, this.server.getPlayerList().t()); - this.worldMaps.a(); + // CraftBukkit end } protected void a(Entity entity) { -@@ -724,8 +940,16 @@ +@@ -731,8 +947,16 @@ } public boolean strikeLightning(Entity entity) { @@ -469,12 +455,12 @@ + } if (super.strikeLightning(entity)) { - this.server.getPlayerList().sendPacketNearby(entity.locX, entity.locY, entity.locZ, 512.0D, this.worldProvider.getDimension(), new PacketPlayOutSpawnEntityWeather(entity)); -+ this.server.getPlayerList().sendPacketNearby(entity.locX, entity.locY, entity.locZ, 512.0D, this.dimension, new PacketPlayOutSpawnEntityWeather(entity)); ++ this.server.getPlayerList().sendPacketNearby(entity.locX, entity.locY, entity.locZ, 512.0D, dimension, new PacketPlayOutSpawnEntityWeather(entity)); + // CraftBukkit end return true; } else { return false; -@@ -737,10 +961,20 @@ +@@ -744,10 +968,20 @@ } public Explosion createExplosion(Entity entity, double d0, double d1, double d2, float f, boolean flag, boolean flag1) { @@ -484,7 +470,7 @@ + if (explosion.wasCanceled) { + return explosion; + } -+ ++ + /* Remove Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, flag1); @@ -495,17 +481,17 @@ if (!flag1) { explosion.clearBlocks(); } -@@ -786,7 +1020,8 @@ +@@ -793,7 +1027,8 @@ BlockActionData blockactiondata = (BlockActionData) iterator.next(); if (this.a(blockactiondata)) { - this.server.getPlayerList().sendPacketNearby((double) blockactiondata.a().getX(), (double) blockactiondata.a().getY(), (double) blockactiondata.a().getZ(), 64.0D, this.worldProvider.getDimension(), new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.d(), blockactiondata.b(), blockactiondata.c())); + // CraftBukkit - this.worldProvider.dimension -> this.dimension -+ this.server.getPlayerList().sendPacketNearby((double) blockactiondata.a().getX(), (double) blockactiondata.a().getY(), (double) blockactiondata.a().getZ(), 64.0D, this.dimension, new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.d(), blockactiondata.b(), blockactiondata.c())); ++ this.server.getPlayerList().sendPacketNearby((double) blockactiondata.a().getX(), (double) blockactiondata.a().getY(), (double) blockactiondata.a().getZ(), 64.0D, dimension, new PacketPlayOutBlockAction(blockactiondata.a(), blockactiondata.d(), blockactiondata.b(), blockactiondata.c())); } } -@@ -809,6 +1044,7 @@ +@@ -816,6 +1051,7 @@ boolean flag = this.S(); super.p(); @@ -513,11 +499,10 @@ if (this.o != this.p) { this.server.getPlayerList().a(new PacketPlayOutGameStateChange(7, this.p), this.worldProvider.getDimension()); } -@@ -827,7 +1063,21 @@ +@@ -834,6 +1070,21 @@ this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.p)); this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.r)); } -- + // */ + if (flag != this.S()) { + // Only send weather packets to those affected @@ -533,17 +518,17 @@ + } + } + // CraftBukkit end + } - protected int q() { -@@ -855,10 +1105,17 @@ +@@ -862,10 +1113,17 @@ } public void a(EnumParticle enumparticle, boolean flag, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, int... aint) { + // CraftBukkit - visibility api support + sendParticles(null, enumparticle, flag, d0, d1, d2, i, d3, d4, d5, d6, aint); + } -+ ++ + public void sendParticles(EntityPlayer sender, EnumParticle enumparticle, boolean flag, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, int... aint) { + // CraftBukkit end PacketPlayOutWorldParticles packetplayoutworldparticles = new PacketPlayOutWorldParticles(enumparticle, flag, (float) d0, (float) d1, (float) d2, (float) d3, (float) d4, (float) d5, (float) d6, i, aint); diff --git a/pom.xml b/pom.xml index fec390d885..55e26033e6 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ org.bukkit craftbukkit jar - 1.8-R0.1-SNAPSHOT + 1.8.3-R0.1-SNAPSHOT CraftBukkit http://www.bukkit.org @@ -12,8 +12,8 @@ UTF-8 unknown 4.11 - 1.8 - 1_8_R1 + 1.8.3 + 1_8_R2 git-Bukkit- 1.6 @@ -63,11 +63,6 @@ jar compile - - com.google.code.gson - gson - 2.2.4 - junit @@ -186,10 +181,6 @@ - - org.bouncycastle - net.minecraft.v${minecraft_version}.org.bouncycastle - joptsimple org.bukkit.craftbukkit.libs.joptsimple @@ -206,10 +197,6 @@ org.gjt org.bukkit.craftbukkit.libs.org.gjt - - com.google.gson - org.bukkit.craftbukkit.libs.com.google.gson -