From 9935adc4ed9ac6c9ddf6c9e290b4c9f59b60cd4e Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 30 Jul 2015 16:56:52 +1000 Subject: [PATCH] Update for minor remapping changes. --- nms-patches/BlockDispenser.patch | 4 +- nms-patches/BlockDropper.patch | 13 +-- nms-patches/BlockPiston.patch | 2 +- nms-patches/BlockPortal.patch | 38 ++++----- nms-patches/BlockPressurePlateWeighted.patch | 8 +- nms-patches/BlockPumpkin.patch | 14 ++-- nms-patches/BlockSkull.patch | 14 ++-- nms-patches/BlockSoil.patch | 8 +- nms-patches/BlockVine.patch | 18 ++--- nms-patches/Container.patch | 6 +- nms-patches/ContainerBeacon.patch | 8 +- nms-patches/ContainerEnchantTable.patch | 4 +- nms-patches/CraftingManager.patch | 13 +-- nms-patches/DispenseBehaviorItem.patch | 10 +-- nms-patches/DispenseBehaviorProjectile.patch | 12 +-- nms-patches/DispenserRegistry.patch | 80 +++++++++---------- nms-patches/EntityEnderDragon.patch | 14 ++-- nms-patches/EntityInsentient.patch | 11 --- nms-patches/Explosion.patch | 5 +- nms-patches/HandshakeListener.patch | 2 +- nms-patches/ItemArmor.patch | 8 +- nms-patches/ItemMinecart.patch | 8 +- .../PacketHandshakingInSetProtocol.patch | 22 ----- .../craftbukkit/event/CraftEventFactory.java | 2 +- 24 files changed, 135 insertions(+), 189 deletions(-) delete mode 100644 nms-patches/PacketHandshakingInSetProtocol.patch diff --git a/nms-patches/BlockDispenser.patch b/nms-patches/BlockDispenser.patch index 3c8e138d3f..ff2bdb725c 100644 --- a/nms-patches/BlockDispenser.patch +++ b/nms-patches/BlockDispenser.patch @@ -2,7 +2,7 @@ +++ b/net/minecraft/server/BlockDispenser.java @@ -8,6 +8,7 @@ public static final BlockStateBoolean TRIGGERED = BlockStateBoolean.of("triggered"); - public static final RegistryDefault N = new RegistryDefault(new DispenseBehaviorItem()); + public static final RegistryDefault REGISTRY = new RegistryDefault(new DispenseBehaviorItem()); protected Random O = new Random(); + public static boolean eventFired = false; // CraftBukkit @@ -10,7 +10,7 @@ super(Material.STONE); @@ -83,6 +84,7 @@ - if (idispensebehavior != IDispenseBehavior.a) { + if (idispensebehavior != IDispenseBehavior.NONE) { ItemStack itemstack1 = idispensebehavior.a(sourceblock, itemstack); + eventFired = false; // CraftBukkit - reset event status diff --git a/nms-patches/BlockDropper.patch b/nms-patches/BlockDropper.patch index 5695252479..9f4ff914ea 100644 --- a/nms-patches/BlockDropper.patch +++ b/nms-patches/BlockDropper.patch @@ -11,23 +11,14 @@ public class BlockDropper extends BlockDispenser { 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; } } else { -- itemstack1 = TileEntityHopper.addItem(iinventory, itemstack.cloneItemStack().a(1), enumdirection.opposite()); +- itemstack1 = TileEntityHopper.addItem(iinventory, itemstack.cloneItemStack().cloneAndSubtract(1), enumdirection.opposite()); - if (itemstack1 == null) { + // CraftBukkit start - Fire event when pushing items into other inventories -+ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(itemstack.cloneItemStack().a(1)); ++ CraftItemStack oitemstack = CraftItemStack.asCraftMirror(itemstack.cloneItemStack().cloneAndSubtract(1)); + + org.bukkit.inventory.Inventory destinationInventory; + // Have to special case large chests as they work oddly diff --git a/nms-patches/BlockPiston.patch b/nms-patches/BlockPiston.patch index 3c90b62537..b19bcf4673 100644 --- a/nms-patches/BlockPiston.patch +++ b/nms-patches/BlockPiston.patch @@ -24,7 +24,7 @@ } } else if (!flag && ((Boolean) iblockdata.get(BlockPiston.EXTENDED)).booleanValue()) { + // CraftBukkit start -+ if (!this.N) { ++ if (!this.sticky) { + 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); diff --git a/nms-patches/BlockPortal.patch b/nms-patches/BlockPortal.patch index fcfb38eba6..d3d3a6505a 100644 --- a/nms-patches/BlockPortal.patch +++ b/nms-patches/BlockPortal.patch @@ -24,18 +24,18 @@ BlockPortal.Shape blockportal_shape = new BlockPortal.Shape(world, blockposition, EnumDirection.EnumAxis.X); if (blockportal_shape.d() && blockportal_shape.e == 0) { -- blockportal_shape.e(); +- blockportal_shape.createPortal(); - return true; + // CraftBukkit start - return portalcreator -+ return blockportal_shape.e(); ++ return blockportal_shape.createPortal(); + // return true; } else { BlockPortal.Shape blockportal_shape1 = new BlockPortal.Shape(world, blockposition, EnumDirection.EnumAxis.Z); if (blockportal_shape1.d() && blockportal_shape1.e == 0) { -- blockportal_shape1.e(); +- blockportal_shape1.createPortal(); - return true; -+ return blockportal_shape1.e(); ++ return blockportal_shape1.createPortal(); + // return true; + // CraftBukkit end } else { @@ -53,9 +53,9 @@ } @@ -185,6 +195,7 @@ - private BlockPosition f; - private int g; - private int h; + private BlockPosition position; + private int height; + private int width; + java.util.Collection blocks = new java.util.HashSet(); // CraftBukkit - add field public Shape(World world, BlockPosition blockposition, EnumDirection.EnumAxis enumdirection_enumaxis) { @@ -81,7 +81,7 @@ + blocks.add(bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ())); + // CraftBukkit end } - } else if (i == this.h - 1) { + } else if (i == this.width - 1) { block = this.a.getType(blockposition.shift(this.c)).getBlock(); if (block != Blocks.OBSIDIAN) { break label56; @@ -94,31 +94,31 @@ } } @@ -277,6 +302,11 @@ - if (this.a.getType(this.f.shift(this.c, i).up(this.g)).getBlock() != Blocks.OBSIDIAN) { - this.g = 0; + if (this.a.getType(this.position.shift(this.c, i).up(this.height)).getBlock() != Blocks.OBSIDIAN) { + this.height = 0; break; + // CraftBukkit start - add the block to our list + } else { -+ BlockPosition pos = this.f.shift(this.c, i).up(this.g); ++ BlockPosition pos = this.position.shift(this.c, i).up(this.height); + 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; + return this.position != null && this.width >= 2 && this.width <= 21 && this.height >= 3 && this.height <= 21; } -- public void e() { +- public void createPortal() { + // CraftBukkit start - return boolean -+ public boolean e() { ++ public boolean createPortal() { + 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 i = 0; i < this.width; ++i) { ++ BlockPosition blockposition = this.position.shift(this.c, i); + -+ for (int j = 0; j < this.g; ++j) { ++ for (int j = 0; j < this.height; ++j) { + BlockPosition pos = blockposition.up(j); + blocks.add(bworld.getBlockAt(pos.getX(), pos.getY(), pos.getZ())); + } @@ -131,8 +131,8 @@ + return false; + } + // CraftBukkit end - for (int i = 0; i < this.h; ++i) { - BlockPosition blockposition = this.f.shift(this.c, i); + for (int i = 0; i < this.width; ++i) { + BlockPosition blockposition = this.position.shift(this.c, i); @@ -307,6 +357,7 @@ } diff --git a/nms-patches/BlockPressurePlateWeighted.patch b/nms-patches/BlockPressurePlateWeighted.patch index 557b0db903..4b1f6e2dc7 100644 --- a/nms-patches/BlockPressurePlateWeighted.patch +++ b/nms-patches/BlockPressurePlateWeighted.patch @@ -12,11 +12,11 @@ } protected int f(World world, BlockPosition blockposition) { -- int i = Math.min(world.a(Entity.class, this.a(blockposition)).size(), this.b); +- int i = Math.min(world.a(Entity.class, this.getBoundingBox(blockposition)).size(), this.weight); + // CraftBukkit start + //int i = Math.min(world.a(Entity.class, this.a(blockposition)).size(), this.b); + int i = 0; -+ java.util.Iterator iterator = world.a(Entity.class, this.a(blockposition)).iterator(); ++ java.util.Iterator iterator = world.a(Entity.class, this.getBoundingBox(blockposition)).iterator(); + + while (iterator.hasNext()) { + Entity entity = (Entity) iterator.next(); @@ -36,8 +36,8 @@ + } + } + -+ i = Math.min(i, this.b); ++ i = Math.min(i, this.weight); + // CraftBukkit end if (i > 0) { - float f = (float) Math.min(this.b, i) / (float) this.b; + float f = (float) Math.min(this.weight, i) / (float) this.weight; diff --git a/nms-patches/BlockPumpkin.patch b/nms-patches/BlockPumpkin.patch index dd05688792..224b1e9db1 100644 --- a/nms-patches/BlockPumpkin.patch +++ b/nms-patches/BlockPumpkin.patch @@ -21,16 +21,16 @@ for (i = 0; i < this.getDetectorSnowGolem().b(); ++i) { ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.a(0, i, 0); -- world.setTypeAndData(shapedetectorblock.d(), Blocks.AIR.getBlockData(), 2); +- world.setTypeAndData(shapedetectorblock.getPosition(), Blocks.AIR.getBlockData(), 2); + // CraftBukkit start + // world.setTypeAndData(shapedetectorblock.d(), Blocks.AIR.getBlockData(), 2); -+ BlockPosition pos = shapedetectorblock.d(); ++ BlockPosition pos = shapedetectorblock.getPosition(); + blockList.setTypeId(pos.getX(), pos.getY(), pos.getZ(), 0); + // CraftBukkit end } EntitySnowman entitysnowman = new EntitySnowman(world); - BlockPosition blockposition1 = shapedetector_shapedetectorcollection.a(0, 2, 0).d(); + BlockPosition blockposition1 = shapedetector_shapedetectorcollection.a(0, 2, 0).getPosition(); entitysnowman.setPositionRotation((double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 0.05D, (double) blockposition1.getZ() + 0.5D, 0.0F, 0.0F); - world.addEntity(entitysnowman); @@ -42,17 +42,17 @@ 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 @@ - world.update(shapedetectorblock1.d(), Blocks.AIR); + world.update(shapedetectorblock1.getPosition(), Blocks.AIR); } + } // 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(shapedetector_shapedetectorcollection.a(i, k, 0).d(), Blocks.AIR.getBlockData(), 2); +- world.setTypeAndData(shapedetector_shapedetectorcollection.a(i, k, 0).getPosition(), Blocks.AIR.getBlockData(), 2); + // CraftBukkit start + // world.setTypeAndData(shapedetectorcollection.a(i, k, 0).d(), Blocks.AIR.getBlockData(), 2); -+ BlockPosition pos = shapedetector_shapedetectorcollection.a(i, k, 0).d(); ++ BlockPosition pos = shapedetector_shapedetectorcollection.a(i, k, 0).getPosition(); + blockList.setTypeId(pos.getX(), pos.getY(), pos.getZ(), 0); + // CraftBukkit end } @@ -71,7 +71,7 @@ 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); + world.update(shapedetectorblock2.getPosition(), Blocks.AIR); } } + } // CraftBukkit end diff --git a/nms-patches/BlockSkull.patch b/nms-patches/BlockSkull.patch index d9d6cd60bd..84c1dc2a4c 100644 --- a/nms-patches/BlockSkull.patch +++ b/nms-patches/BlockSkull.patch @@ -69,10 +69,10 @@ for (i = 0; i < 3; ++i) { ShapeDetectorBlock shapedetectorblock = shapedetector_shapedetectorcollection.a(i, 0, 0); -- world.setTypeAndData(shapedetectorblock.d(), shapedetectorblock.a().set(BlockSkull.NODROP, Boolean.valueOf(true)), 2); +- world.setTypeAndData(shapedetectorblock.getPosition(), shapedetectorblock.a().set(BlockSkull.NODROP, Boolean.valueOf(true)), 2); + // CraftBukkit start -+ // world.setTypeAndData(shapedetectorblock.d(), shapedetectorblock.a().set(BlockSkull.NODROP, Boolean.valueOf(true)), 2); -+ BlockPosition pos = shapedetectorblock.d(); ++ // world.setTypeAndData(shapedetectorblock.getPosition(), shapedetectorblock.a().set(BlockSkull.NODROP, Boolean.valueOf(true)), 2); ++ BlockPosition pos = shapedetectorblock.getPosition(); + IBlockData data = shapedetectorblock.a().set(BlockSkull.NODROP, Boolean.valueOf(true)); + blockList.setTypeAndData(pos.getX(), pos.getY(), pos.getZ(), data.getBlock(), data.getBlock().toLegacyData(data), 2); + // CraftBukkit end @@ -82,10 +82,10 @@ for (int j = 0; j < shapedetector.b(); ++j) { ShapeDetectorBlock shapedetectorblock1 = shapedetector_shapedetectorcollection.a(i, j, 0); -- world.setTypeAndData(shapedetectorblock1.d(), Blocks.AIR.getBlockData(), 2); +- world.setTypeAndData(shapedetectorblock1.getPosition(), Blocks.AIR.getBlockData(), 2); + // CraftBukkit start -+ // world.setTypeAndData(shapedetectorblock1.d(), Blocks.AIR.getBlockData(), 2); -+ BlockPosition pos = shapedetectorblock1.d(); ++ // world.setTypeAndData(shapedetectorblock1.getPosition(), Blocks.AIR.getBlockData(), 2); ++ BlockPosition pos = shapedetectorblock1.getPosition(); + blockList.setTypeAndData(pos.getX(), pos.getY(), pos.getZ(), Blocks.AIR, 0, 2); + // CraftBukkit end } @@ -111,7 +111,7 @@ for (k = 0; k < 120; ++k) { @@ -178,6 +218,7 @@ - world.update(shapedetectorblock2.d(), Blocks.AIR); + world.update(shapedetectorblock2.getPosition(), Blocks.AIR); } } + } // CraftBukkit end diff --git a/nms-patches/BlockSoil.patch b/nms-patches/BlockSoil.patch index fab55b837d..6490edd37a 100644 --- a/nms-patches/BlockSoil.patch +++ b/nms-patches/BlockSoil.patch @@ -28,8 +28,8 @@ @@ -43,16 +54,35 @@ } - 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. + public void fallOn(World world, BlockPosition blockposition, Entity entity, float f) { ++ super.fallOn(world, blockposition, entity, f); // CraftBukkit - moved here as game rules / events shouldn't affect fall damage. if (entity instanceof EntityLiving) { if (!world.isClientSide && world.random.nextFloat() < f - 0.5F) { if (!(entity instanceof EntityHuman) && !world.getGameRules().getBoolean("mobGriefing")) { @@ -57,8 +57,8 @@ world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData()); } -- super.a(world, blockposition, entity, f); -+ // super.a(world, blockposition, entity, f); // CraftBukkit - moved up +- super.fallOn(world, blockposition, entity, f); ++ // super.fallOn(world, blockposition, entity, f); // CraftBukkit - moved up } } diff --git a/nms-patches/BlockVine.patch b/nms-patches/BlockVine.patch index 8ed2aca9e9..e377c24982 100644 --- a/nms-patches/BlockVine.patch +++ b/nms-patches/BlockVine.patch @@ -33,23 +33,23 @@ + org.bukkit.block.Block bukkitBlock = world.getWorld().getBlockAt(blockposition2.getX(), blockposition2.getY(), blockposition2.getZ()); + if (flag1 && this.c(world.getType(blockposition3).getBlock())) { -- world.setTypeAndData(blockposition2, this.getBlockData().set(a(enumdirection1), Boolean.valueOf(true)), 2); +- world.setTypeAndData(blockposition2, this.getBlockData().set(getDirection(enumdirection1), Boolean.valueOf(true)), 2); + // world.setTypeAndData(blockposition2, this.getBlockData().set(a(enumdirection1), Boolean.valueOf(true)), 2); -+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(a(enumdirection1), Boolean.valueOf(true)))); ++ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection1), Boolean.valueOf(true)))); } else if (flag2 && this.c(world.getType(blockposition4).getBlock())) { -- world.setTypeAndData(blockposition2, this.getBlockData().set(a(enumdirection2), Boolean.valueOf(true)), 2); +- world.setTypeAndData(blockposition2, this.getBlockData().set(getDirection(enumdirection2), Boolean.valueOf(true)), 2); + // world.setTypeAndData(blockposition2, this.getBlockData().set(a(enumdirection2), Boolean.valueOf(true)), 2); -+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(a(enumdirection2), Boolean.valueOf(true)))); ++ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection2), Boolean.valueOf(true)))); } else if (flag1 && world.isEmpty(blockposition3) && this.c(world.getType(blockposition.shift(enumdirection1)).getBlock())) { -- world.setTypeAndData(blockposition3, this.getBlockData().set(a(enumdirection.opposite()), Boolean.valueOf(true)), 2); +- world.setTypeAndData(blockposition3, this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)), 2); + // world.setTypeAndData(blockposition3, this.getBlockData().set(a(enumdirection.opposite()), Boolean.valueOf(true)), 2); + bukkitBlock = world.getWorld().getBlockAt(blockposition3.getX(), blockposition3.getY(), blockposition3.getZ()); -+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(a(enumdirection.opposite()), Boolean.valueOf(true)))); ++ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)))); } else if (flag2 && world.isEmpty(blockposition4) && this.c(world.getType(blockposition.shift(enumdirection2)).getBlock())) { -- world.setTypeAndData(blockposition4, this.getBlockData().set(a(enumdirection.opposite()), Boolean.valueOf(true)), 2); +- world.setTypeAndData(blockposition4, this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)), 2); + // world.setTypeAndData(blockposition4, this.getBlockData().set(a(enumdirection.opposite()), Boolean.valueOf(true)), 2); + bukkitBlock = world.getWorld().getBlockAt(blockposition4.getX(), blockposition4.getY(), blockposition4.getZ()); -+ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(a(enumdirection.opposite()), Boolean.valueOf(true)))); ++ CraftEventFactory.handleBlockSpreadEvent(bukkitBlock, source, this, toLegacyData(this.getBlockData().set(getDirection(enumdirection.opposite()), Boolean.valueOf(true)))); } else if (this.c(world.getType(blockposition2.up()).getBlock())) { - world.setTypeAndData(blockposition2, this.getBlockData(), 2); + // world.setTypeAndData(blockposition2, this.getBlockData(), 2); @@ -57,7 +57,7 @@ } + // CraftBukkit end } else if (block.material.k() && block.d()) { - world.setTypeAndData(blockposition, iblockdata.set(a(enumdirection), Boolean.valueOf(true)), 2); + world.setTypeAndData(blockposition, iblockdata.set(getDirection(enumdirection), Boolean.valueOf(true)), 2); } @@ -257,7 +277,12 @@ } diff --git a/nms-patches/Container.patch b/nms-patches/Container.patch index 84210f0353..55fe26c77b 100644 --- a/nms-patches/Container.patch +++ b/nms-patches/Container.patch @@ -110,12 +110,12 @@ } if (j == 1) { -- entityhuman.drop(playerinventory.getCarried().a(1), true); +- entityhuman.drop(playerinventory.getCarried().cloneAndSubtract(1), true); - if (playerinventory.getCarried().count == 0) { + // CraftBukkit start - Store a reference + ItemStack itemstack4 = playerinventory.getCarried(); + if (itemstack4.count > 0) { -+ entityhuman.drop(itemstack4.a(1), true); ++ entityhuman.drop(itemstack4.cloneAndSubtract(1), true); + } + + if (itemstack4.count == 0) { @@ -136,7 +136,7 @@ } else if (slot2.isAllowed(entityhuman)) { if (itemstack4 == null) { @@ -249,7 +315,11 @@ - itemstack4.a(k1); + itemstack4.cloneAndSubtract(k1); if (itemstack4.count == 0) { playerinventory.setCarried((ItemStack) null); + // CraftBukkit start - Update client cursor if we didn't empty it diff --git a/nms-patches/ContainerBeacon.patch b/nms-patches/ContainerBeacon.patch index 70303e2b34..332ab07f4f 100644 --- a/nms-patches/ContainerBeacon.patch +++ b/nms-patches/ContainerBeacon.patch @@ -7,7 +7,7 @@ + public class ContainerBeacon extends Container { - private IInventory a; + private IInventory beacon; private final ContainerBeacon.SlotBeacon f; + // CraftBukkit start + private CraftInventoryView bukkitEntity = null; @@ -16,7 +16,7 @@ public ContainerBeacon(IInventory iinventory, IInventory iinventory1) { + player = (PlayerInventory) iinventory; // CraftBukkit - TODO: check this - this.a = iinventory1; + this.beacon = iinventory1; this.a((Slot) (this.f = new ContainerBeacon.SlotBeacon(iinventory1, 0, 136, 110))); byte b0 = 36; @@ -47,6 +54,7 @@ @@ -24,7 +24,7 @@ public boolean a(EntityHuman entityhuman) { + if (!this.checkReachable) return true; // CraftBukkit - return this.a.a(entityhuman); + return this.beacon.a(entityhuman); } @@ -110,4 +118,17 @@ @@ -39,7 +39,7 @@ + return bukkitEntity; + } + -+ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryBeacon((TileEntityBeacon) this.a); // TODO - check this ++ org.bukkit.craftbukkit.inventory.CraftInventory inventory = new org.bukkit.craftbukkit.inventory.CraftInventoryBeacon((TileEntityBeacon) this.beacon); // TODO - check this + bukkitEntity = new CraftInventoryView(this.player.player.getBukkitEntity(), inventory, this); + return bukkitEntity; + } diff --git a/nms-patches/ContainerEnchantTable.patch b/nms-patches/ContainerEnchantTable.patch index 598e9aaa32..5e436ed1ad 100644 --- a/nms-patches/ContainerEnchantTable.patch +++ b/nms-patches/ContainerEnchantTable.patch @@ -86,7 +86,7 @@ boolean flag = itemstack.getItem() == Items.BOOK; if (list != null) { -- entityhuman.b(j); +- entityhuman.enchantDone(j); + // CraftBukkit start + Map enchants = new java.util.HashMap(); + for (Object obj : list) { @@ -130,7 +130,7 @@ } } -+ entityhuman.b(j); ++ entityhuman.enchantDone(j); + // CraftBukkit end + + // CraftBukkit - TODO: let plugins change this diff --git a/nms-patches/CraftingManager.patch b/nms-patches/CraftingManager.patch index c0544eaa77..3a7c82eca2 100644 --- a/nms-patches/CraftingManager.patch +++ b/nms-patches/CraftingManager.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/CraftingManager.java +++ b/net/minecraft/server/CraftingManager.java -@@ -9,16 +9,22 @@ +@@ -9,10 +9,16 @@ import java.util.Iterator; import java.util.List; @@ -17,13 +17,6 @@ public static CraftingManager getInstance() { return CraftingManager.a; - } - -- private CraftingManager() { -+ public CraftingManager() { // PAIL: 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}); @@ -49,10 +42,10 @@ irecipe = (IRecipe) iterator.next(); } while (!irecipe.a(inventorycrafting, world)); -- return irecipe.a(inventorycrafting); +- return irecipe.craftItem(inventorycrafting); + // CraftBukkit start - INVENTORY_PRE_CRAFT event + inventorycrafting.currentRecipe = irecipe; -+ ItemStack result = irecipe.a(inventorycrafting); ++ ItemStack result = irecipe.craftItem(inventorycrafting); + return CraftEventFactory.callPreCraftEvent(inventorycrafting, result, lastCraftView, false); + // CraftBukkit end } diff --git a/nms-patches/DispenseBehaviorItem.patch b/nms-patches/DispenseBehaviorItem.patch index 64ad6a71de..61fe049e84 100644 --- a/nms-patches/DispenseBehaviorItem.patch +++ b/nms-patches/DispenseBehaviorItem.patch @@ -13,11 +13,11 @@ public DispenseBehaviorItem() {} @@ -17,11 +22,18 @@ IPosition iposition = BlockDispenser.a(isourceblock); - ItemStack itemstack1 = itemstack.a(1); + ItemStack itemstack1 = itemstack.cloneAndSubtract(1); -- a(isourceblock.i(), itemstack1, 6, enumdirection, iposition); +- a(isourceblock.getWorld(), itemstack1, 6, enumdirection, iposition); + // CraftBukkit start -+ if (!a(isourceblock.i(), itemstack1, 6, enumdirection, isourceblock)) { ++ if (!a(isourceblock.getWorld(), itemstack1, 6, enumdirection, isourceblock)) { + itemstack.count++; + } + // CraftBukkit end @@ -58,8 +58,8 @@ + if (!event.getItem().getType().equals(craftItem.getType())) { + // 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.getClass() != DispenseBehaviorItem.class) { ++ IDispenseBehavior idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior.getClass() != DispenseBehaviorItem.class) { + idispensebehavior.a(isourceblock, eventStack); + } else { + world.addEntity(entityitem); diff --git a/nms-patches/DispenseBehaviorProjectile.patch b/nms-patches/DispenseBehaviorProjectile.patch index 938d08badb..5cf558a8bb 100644 --- a/nms-patches/DispenseBehaviorProjectile.patch +++ b/nms-patches/DispenseBehaviorProjectile.patch @@ -15,10 +15,10 @@ EnumDirection enumdirection = BlockDispenser.b(isourceblock.f()); IProjectile iprojectile = this.a(world, iposition); -- iprojectile.shoot((double) enumdirection.getAdjacentX(), (double) ((float) enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ(), this.b(), this.a()); +- iprojectile.shoot((double) enumdirection.getAdjacentX(), (double) ((float) enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ(), this.getPower(), this.a()); + // iprojectile.shoot((double) enumdirection.getAdjacentX(), (double) ((float) enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ(), this.b(), this.a()); + // CraftBukkit start -+ ItemStack itemstack1 = itemstack.a(1); ++ ItemStack itemstack1 = itemstack.cloneAndSubtract(1); + org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + @@ -36,18 +36,18 @@ + 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 idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) { + idispensebehavior.a(isourceblock, eventStack); + return itemstack; + } + } + -+ iprojectile.shoot(event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.b(), this.a()); ++ iprojectile.shoot(event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), this.getPower(), this.a()); + ((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource((TileEntityDispenser) isourceblock.getTileEntity()); + // CraftBukkit end world.addEntity((Entity) iprojectile); -- itemstack.a(1); +- itemstack.cloneAndSubtract(1); + // itemstack.a(1); // CraftBukkit - Handled during event processing return itemstack; } diff --git a/nms-patches/DispenserRegistry.patch b/nms-patches/DispenserRegistry.patch index cf0952c8f6..ba9e6a2f6c 100644 --- a/nms-patches/DispenserRegistry.patch +++ b/nms-patches/DispenserRegistry.patch @@ -16,12 +16,12 @@ 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); +- Entity entity = ItemMonsterEgg.a(isourceblock.getWorld(), itemstack.getData(), d0, d1, d2); ++ // Entity entity = ItemMonsterEgg.a(isourceblock.getWorld(), itemstack.getData(), d0, d1, d2); + + // CraftBukkit start -+ World world = isourceblock.i(); -+ ItemStack itemstack1 = itemstack.a(1); ++ World world = isourceblock.getWorld(); ++ ItemStack itemstack1 = itemstack.cloneAndSubtract(1); + org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + @@ -39,8 +39,8 @@ + 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 idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) { + idispensebehavior.a(isourceblock, eventStack); + return itemstack; + } @@ -48,13 +48,13 @@ + + 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); ++ Entity entity = ItemMonsterEgg.spawnCreature(isourceblock.getWorld(), 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.cloneAndSubtract(1); + // itemstack.a(1); // Handled during event processing + // CraftBukkit end return itemstack; @@ -64,10 +64,10 @@ 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); +- EntityFireworks entityfireworks = new EntityFireworks(isourceblock.getWorld(), d0, d1, d2, itemstack); + // CraftBukkit start -+ World world = isourceblock.i(); -+ ItemStack itemstack1 = itemstack.a(1); ++ World world = isourceblock.getWorld(); ++ ItemStack itemstack1 = itemstack.cloneAndSubtract(1); + org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + @@ -85,18 +85,18 @@ + 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 idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) { + idispensebehavior.a(isourceblock, eventStack); + return itemstack; + } + } + + itemstack1 = CraftItemStack.asNMSCopy(event.getItem()); -+ EntityFireworks entityfireworks = new EntityFireworks(isourceblock.i(), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), itemstack1); ++ EntityFireworks entityfireworks = new EntityFireworks(isourceblock.getWorld(), event.getVelocity().getX(), event.getVelocity().getY(), event.getVelocity().getZ(), itemstack1); - isourceblock.i().addEntity(entityfireworks); -- itemstack.a(1); + isourceblock.getWorld().addEntity(entityfireworks); +- itemstack.cloneAndSubtract(1); + // itemstack.a(1); // Handled during event processing + // CraftBukkit end return itemstack; @@ -107,9 +107,9 @@ double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentZ(); - world.addEntity(new EntitySmallFireball(world, d0, d1, d2, d3, d4, d5)); -- itemstack.a(1); +- itemstack.cloneAndSubtract(1); + // CraftBukkit start -+ ItemStack itemstack1 = itemstack.a(1); ++ ItemStack itemstack1 = itemstack.cloneAndSubtract(1); + org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + @@ -127,8 +127,8 @@ + 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 idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) { + idispensebehavior.a(isourceblock, eventStack); + return itemstack; + } @@ -150,7 +150,7 @@ - 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); ++ ItemStack itemstack1 = itemstack.cloneAndSubtract(1); + org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + @@ -168,8 +168,8 @@ + 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 idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) { + idispensebehavior.a(isourceblock, eventStack); + return itemstack; + } @@ -179,7 +179,7 @@ + // CraftBukkit end world.addEntity(entityboat); -- itemstack.a(1); +- itemstack.cloneAndSubtract(1); + // itemstack.a(1); // CraftBukkit - handled during event processing return itemstack; } @@ -189,7 +189,7 @@ BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); + // CraftBukkit start -+ World world = isourceblock.i(); ++ World world = isourceblock.getWorld(); + int x = blockposition.getX(); + int y = blockposition.getY(); + int z = blockposition.getZ(); @@ -209,8 +209,8 @@ + 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 idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) { + idispensebehavior.a(isourceblock, eventStack); + return itemstack; + } @@ -220,7 +220,7 @@ + } + // CraftBukkit end + - if (itembucket.a(isourceblock.i(), blockposition)) { + if (itembucket.a(isourceblock.getWorld(), blockposition)) { - itemstack.setItem(Items.BUCKET); - itemstack.count = 1; + // CraftBukkit start - Handle stacked buckets @@ -255,8 +255,8 @@ + 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 idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) { + idispensebehavior.a(isourceblock, eventStack); + return itemstack; + } @@ -267,7 +267,7 @@ if (--itemstack.count == 0) { itemstack.setItem(item); @@ -215,11 +402,39 @@ - World world = isourceblock.i(); + World world = isourceblock.getWorld(); BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); + // CraftBukkit start @@ -286,8 +286,8 @@ + 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 idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) { + idispensebehavior.a(isourceblock, eventStack); + return itemstack; + } @@ -310,7 +310,7 @@ Blocks.TNT.postBreak(world, blockposition, Blocks.TNT.getBlockData().set(BlockTNT.EXPLODE, Boolean.valueOf(true))); world.setAir(blockposition); @@ -247,6 +462,30 @@ - World world = isourceblock.i(); + World world = isourceblock.getWorld(); BlockPosition blockposition = isourceblock.getBlockPosition().shift(BlockDispenser.b(isourceblock.f())); + // CraftBukkit start @@ -329,8 +329,8 @@ + 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 idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) { + idispensebehavior.a(isourceblock, eventStack); + return itemstack; + } @@ -342,13 +342,13 @@ world.triggerEffect(2005, blockposition, 0); @@ -274,11 +513,40 @@ protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) { - World world = isourceblock.i(); + World world = isourceblock.getWorld(); 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); ++ ItemStack itemstack1 = itemstack.cloneAndSubtract(1); + org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + @@ -366,8 +366,8 @@ + 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 idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) { + idispensebehavior.a(isourceblock, eventStack); + return itemstack; + } diff --git a/nms-patches/EntityEnderDragon.patch b/nms-patches/EntityEnderDragon.patch index 2e15e1945b..9572a00590 100644 --- a/nms-patches/EntityEnderDragon.patch +++ b/nms-patches/EntityEnderDragon.patch @@ -18,12 +18,8 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMonster { public double a; -@@ -24,9 +35,10 @@ - public float bv; - public boolean bw; - public boolean bx; -- private Entity bA; -+ public Entity bA; // CraftBukkit - public // PAIL: Target +@@ -27,6 +38,7 @@ + public Entity target; 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() @@ -57,7 +53,7 @@ } if (this.random.nextInt(2) == 0 && !arraylist.isEmpty()) { -- this.bA = (Entity) arraylist.get(this.random.nextInt(arraylist.size())); +- this.target = (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); @@ -65,9 +61,9 @@ + + if (!event.isCancelled()) { + if (event.getTarget() == null) { -+ this.bA = null; ++ this.target = null; + } else { -+ this.bA = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle(); ++ this.target = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle(); + } + } + // CraftBukkit end diff --git a/nms-patches/EntityInsentient.patch b/nms-patches/EntityInsentient.patch index 304ffa87fe..955ebec617 100644 --- a/nms-patches/EntityInsentient.patch +++ b/nms-patches/EntityInsentient.patch @@ -16,17 +16,6 @@ public abstract class EntityInsentient extends EntityLiving { public int a_; -@@ -13,8 +22,8 @@ - protected ControllerJump g; - private EntityAIBodyControl b; - protected NavigationAbstract navigation; -- public final PathfinderGoalSelector goalSelector; -- public final PathfinderGoalSelector targetSelector; -+ public PathfinderGoalSelector goalSelector; // PAIL: -final -+ public PathfinderGoalSelector targetSelector; // PAIL: -final - private EntityLiving goalTarget; - private EntitySenses bk; - private ItemStack[] equipment = new ItemStack[5]; @@ -40,6 +49,9 @@ this.dropChances[i] = 0.085F; } diff --git a/nms-patches/Explosion.patch b/nms-patches/Explosion.patch index 9e09e327b1..1b6b56f1e1 100644 --- a/nms-patches/Explosion.patch +++ b/nms-patches/Explosion.patch @@ -139,13 +139,12 @@ } } } -@@ -197,7 +266,10 @@ +@@ -197,7 +266,9 @@ } - public EntityLiving c() { + public EntityLiving getSource() { - return this.source == null ? null : (this.source instanceof EntityTNTPrimed ? ((EntityTNTPrimed) this.source).getSource() : (this.source instanceof EntityLiving ? (EntityLiving) this.source : null)); + // CraftBukkit start - obtain Fireball shooter for explosion tracking -+ // PAIL: Rename + return this.source == null ? null : (this.source instanceof EntityTNTPrimed ? ((EntityTNTPrimed) this.source).getSource() : (this.source instanceof EntityLiving ? (EntityLiving) this.source : (this.source instanceof EntityFireball ? ((EntityFireball) this.source).shooter : null))); + // CraftBukkit end } diff --git a/nms-patches/HandshakeListener.patch b/nms-patches/HandshakeListener.patch index 67106fb4bb..a30ece5b42 100644 --- a/nms-patches/HandshakeListener.patch +++ b/nms-patches/HandshakeListener.patch @@ -64,7 +64,7 @@ this.b.close(chatcomponenttext); } else { this.b.a((PacketListener) (new LoginListener(this.a, this.b))); -+ ((LoginListener) this.b.getPacketListener()).hostname = packethandshakinginsetprotocol.b + ":" + packethandshakinginsetprotocol.c; // CraftBukkit - set hostname ++ ((LoginListener) this.b.getPacketListener()).hostname = packethandshakinginsetprotocol.hostname + ":" + packethandshakinginsetprotocol.port; // CraftBukkit - set hostname } break; diff --git a/nms-patches/ItemArmor.patch b/nms-patches/ItemArmor.patch index 5dc021265a..e6beb5eee6 100644 --- a/nms-patches/ItemArmor.patch +++ b/nms-patches/ItemArmor.patch @@ -19,8 +19,8 @@ - ItemStack itemstack1 = itemstack.cloneItemStack(); + + // CraftBukkit start -+ ItemStack itemstack1 = itemstack.a(1); -+ World world = isourceblock.i(); ++ ItemStack itemstack1 = itemstack.cloneAndSubtract(1); ++ World world = isourceblock.getWorld(); + org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + @@ -38,8 +38,8 @@ + 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 idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) { + idispensebehavior.a(isourceblock, eventStack); + return itemstack; + } diff --git a/nms-patches/ItemMinecart.patch b/nms-patches/ItemMinecart.patch index 74d1368164..ed8f094a3f 100644 --- a/nms-patches/ItemMinecart.patch +++ b/nms-patches/ItemMinecart.patch @@ -18,7 +18,7 @@ - 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); ++ ItemStack itemstack1 = itemstack.cloneAndSubtract(1); + org.bukkit.block.Block block2 = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + @@ -36,8 +36,8 @@ + 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 idispensebehavior = (IDispenseBehavior) BlockDispenser.REGISTRY.get(eventStack.getItem()); ++ if (idispensebehavior != IDispenseBehavior.NONE && idispensebehavior != this) { + idispensebehavior.a(isourceblock, eventStack); + return itemstack; + } @@ -51,7 +51,7 @@ } world.addEntity(entityminecartabstract); -- itemstack.a(1); +- itemstack.cloneAndSubtract(1); + // itemstack.a(1); // CraftBukkit - handled during event processing + // CraftBukkit end return itemstack; diff --git a/nms-patches/PacketHandshakingInSetProtocol.patch b/nms-patches/PacketHandshakingInSetProtocol.patch deleted file mode 100644 index 87c1f9b1c5..0000000000 --- a/nms-patches/PacketHandshakingInSetProtocol.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- a/net/minecraft/server/PacketHandshakingInSetProtocol.java -+++ b/net/minecraft/server/PacketHandshakingInSetProtocol.java -@@ -5,8 +5,8 @@ - public class PacketHandshakingInSetProtocol implements Packet { - - private int a; -- private String b; -- private int c; -+ public String b; // CraftBukkit - public // PAIL: hostname -+ public int c; // CraftBukkit - public // PAIL: port - 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/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 2a010057ce..9e471c782f 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -413,7 +413,7 @@ public class CraftEventFactory { EntityDamageEvent event; if (damager == null) { event = new EntityDamageByBlockEvent(null, entity.getBukkitEntity(), DamageCause.BLOCK_EXPLOSION, modifiers, modifierFunctions); - } else if (entity instanceof EntityEnderDragon && ((EntityEnderDragon) entity).bA == damager) { + } else if (entity instanceof EntityEnderDragon && ((EntityEnderDragon) entity).target == damager) { event = new EntityDamageEvent(entity.getBukkitEntity(), DamageCause.ENTITY_EXPLOSION, modifiers, modifierFunctions); } else { if (damager instanceof org.bukkit.entity.TNTPrimed) {