From 10043529907a4ba913ebe2712876e4b1911263b8 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 19 May 2017 21:00:13 +1000 Subject: [PATCH] Update to Minecraft 1.12-pre5 --- nms-patches/AdvancementDataPlayer.patch | 10 +- nms-patches/BlockDiodeAbstract.patch | 6 +- nms-patches/BlockDoor.patch | 2 +- nms-patches/BlockEnderPortal.patch | 2 +- nms-patches/BlockFire.patch | 8 +- nms-patches/BlockPiston.patch | 4 +- nms-patches/BlockPortal.patch | 2 +- nms-patches/BlockSapling.patch | 2 +- nms-patches/BlockTrapdoor.patch | 2 +- nms-patches/BlockTripwireHook.patch | 2 +- .../CommandBlockListenerAbstract.patch | 2 +- nms-patches/CommandExecute.patch | 25 ++--- nms-patches/ContainerBrewingStand.patch | 6 +- nms-patches/ContainerEnchantTable.patch | 4 +- nms-patches/CustomFunctionData.patch | 6 +- nms-patches/DedicatedServer.patch | 8 +- nms-patches/DispenserRegistry.patch | 30 +++--- nms-patches/Enchantment.patch | 4 +- nms-patches/EntityHuman.patch | 46 ++++----- nms-patches/EntityPig.patch | 2 +- nms-patches/EntityPlayer.patch | 58 +++++------ nms-patches/EntityZombie.patch | 2 +- nms-patches/HandshakeListener.patch | 4 +- nms-patches/IRecipe.patch | 4 +- nms-patches/ItemBucket.patch | 2 +- nms-patches/ItemSkull.patch | 2 +- nms-patches/ItemStack.patch | 2 +- nms-patches/ItemWaterLily.patch | 4 +- nms-patches/ItemWorldMap.patch | 8 +- nms-patches/JsonList.patch | 14 +-- nms-patches/MapIcon.patch | 11 --- nms-patches/PathfinderGoalFollowOwner.patch | 2 +- nms-patches/PathfinderGoalVillagerFarm.patch | 2 +- nms-patches/PlayerConnection.patch | 95 +++++++++---------- nms-patches/PlayerInteractManager.patch | 14 +-- nms-patches/PlayerInventory.patch | 12 +-- nms-patches/PlayerList.patch | 2 +- nms-patches/RecipeRepair.patch | 4 +- nms-patches/ShapedRecipes.patch | 4 +- nms-patches/ShapelessRecipes.patch | 6 +- nms-patches/TileEntitySign.patch | 4 +- nms-patches/World.patch | 54 ++++------- nms-patches/WorldServer.patch | 10 +- pom.xml | 4 +- .../craftbukkit/entity/CraftLivingEntity.java | 4 +- .../inventory/CraftShapedRecipe.java | 2 +- .../inventory/CraftShapelessRecipe.java | 2 +- 47 files changed, 222 insertions(+), 283 deletions(-) delete mode 100644 nms-patches/MapIcon.patch diff --git a/nms-patches/AdvancementDataPlayer.patch b/nms-patches/AdvancementDataPlayer.patch index b3e70215b1..84c937c4e8 100644 --- a/nms-patches/AdvancementDataPlayer.patch +++ b/nms-patches/AdvancementDataPlayer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/AdvancementDataPlayer.java +++ b/net/minecraft/server/AdvancementDataPlayer.java -@@ -29,7 +29,7 @@ +@@ -30,7 +30,7 @@ private static final Logger a = LogManager.getLogger(); private static final Gson b = (new GsonBuilder()).registerTypeAdapter(AdvancementProgress.class, new AdvancementProgress.a()).registerTypeAdapter(MinecraftKey.class, new MinecraftKey.a()).setPrettyPrinting().create(); @@ -9,7 +9,7 @@ }; private final MinecraftServer d; private final File e; -@@ -88,7 +88,7 @@ +@@ -92,7 +92,7 @@ Iterator iterator = this.data.entrySet().iterator(); while (iterator.hasNext()) { @@ -18,7 +18,7 @@ if (((AdvancementProgress) entry.getValue()).isDone()) { arraylist.add(entry.getKey()); -@@ -124,13 +124,15 @@ +@@ -128,13 +128,15 @@ if (this.e.isFile()) { try { String s = Files.toString(this.e, StandardCharsets.UTF_8); @@ -36,7 +36,7 @@ Iterator iterator = ((List) stream.collect(Collectors.toList())).iterator(); while (iterator.hasNext()) { -@@ -138,7 +140,11 @@ +@@ -142,7 +144,11 @@ Advancement advancement = this.d.getAdvancementData().a((MinecraftKey) entry.getKey()); if (advancement == null) { @@ -49,7 +49,7 @@ } else { this.a(advancement, (AdvancementProgress) entry.getValue()); } -@@ -190,6 +196,7 @@ +@@ -194,6 +200,7 @@ this.i.add(advancement); flag = true; if (!flag1 && advancementprogress.isDone()) { diff --git a/nms-patches/BlockDiodeAbstract.patch b/nms-patches/BlockDiodeAbstract.patch index e5d9e7d5ef..f7f4522e14 100644 --- a/nms-patches/BlockDiodeAbstract.patch +++ b/nms-patches/BlockDiodeAbstract.patch @@ -18,13 +18,13 @@ + return; + } + // CraftBukkit end - world.setTypeAndData(blockposition, this.A(iblockdata), 2); + world.setTypeAndData(blockposition, this.z(iblockdata), 2); } else if (!this.d) { + // CraftBukkit start + if (CraftEventFactory.callRedstoneChange(world, blockposition.getX(), blockposition.getY(), blockposition.getZ(), 0, 15).getNewCurrent() != 15) { + return; + } + // CraftBukkit end - world.setTypeAndData(blockposition, this.z(iblockdata), 2); + world.setTypeAndData(blockposition, this.y(iblockdata), 2); if (!flag) { - world.a(blockposition, this.z(iblockdata).getBlock(), this.F(iblockdata), -1); + world.a(blockposition, this.y(iblockdata).getBlock(), this.E(iblockdata), -1); diff --git a/nms-patches/BlockDoor.patch b/nms-patches/BlockDoor.patch index 1946c5afff..063d2ea12e 100644 --- a/nms-patches/BlockDoor.patch +++ b/nms-patches/BlockDoor.patch @@ -15,7 +15,7 @@ } else { - boolean flag1 = world.isBlockIndirectlyPowered(blockposition) || world.isBlockIndirectlyPowered(blockposition3); -- if (block != this && (flag1 || block.getBlockData().n()) && flag1 != ((Boolean) iblockdata2.get(BlockDoor.POWERED)).booleanValue()) { +- if (block != this && (flag1 || block.getBlockData().m()) && 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()); diff --git a/nms-patches/BlockEnderPortal.patch b/nms-patches/BlockEnderPortal.patch index eef4d6ac2b..2a6fd12d09 100644 --- a/nms-patches/BlockEnderPortal.patch +++ b/nms-patches/BlockEnderPortal.patch @@ -12,7 +12,7 @@ @@ -37,6 +39,10 @@ public void a(World world, BlockPosition blockposition, IBlockData iblockdata, Entity entity) { - if (!entity.isPassenger() && !entity.isVehicle() && entity.bd() && !world.isClientSide && entity.getBoundingBox().c(iblockdata.d(world, blockposition).a(blockposition))) { + if (!entity.isPassenger() && !entity.isVehicle() && entity.bd() && !world.isClientSide && entity.getBoundingBox().c(iblockdata.e(world, blockposition).a(blockposition))) { + // 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 11fa2edfb7..f5ce1cd85f 100644 --- a/nms-patches/BlockFire.patch +++ b/nms-patches/BlockFire.patch @@ -25,7 +25,7 @@ @@ -108,7 +114,7 @@ int i = ((Integer) iblockdata.get(BlockFire.AGE)).intValue(); - if (!flag && world.Y() && this.b(world, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) { + if (!flag && world.isRaining() && this.b(world, blockposition) && random.nextFloat() < 0.2F + (float) i * 0.03F) { - world.setAir(blockposition); + fireExtinguished(world, blockposition); // CraftBukkit - extinguished by rain } else { @@ -34,7 +34,7 @@ @@ -119,14 +125,14 @@ if (!flag) { if (!this.c(world, blockposition)) { - if (!world.getType(blockposition.down()).r() || i > 3) { + if (!world.getType(blockposition.down()).q() || i > 3) { - world.setAir(blockposition); + fireExtinguished(world, blockposition); // CraftBukkit } @@ -126,7 +126,7 @@ @@ -276,7 +315,7 @@ public void a(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1) { - if (!world.getType(blockposition.down()).r() && !this.c(world, blockposition)) { + if (!world.getType(blockposition.down()).q() && !this.c(world, blockposition)) { - world.setAir(blockposition); + fireExtinguished(world, blockposition); // CraftBukkit - fuel block gone } @@ -135,7 +135,7 @@ @@ -284,7 +323,7 @@ public void onPlace(World world, BlockPosition blockposition, IBlockData iblockdata) { if (world.worldProvider.getDimensionManager().getDimensionID() > 0 || !Blocks.PORTAL.b(world, blockposition)) { - if (!world.getType(blockposition.down()).r() && !this.c(world, blockposition)) { + if (!world.getType(blockposition.down()).q() && !this.c(world, blockposition)) { - world.setAir(blockposition); + fireExtinguished(world, blockposition); // CraftBukkit - fuel block broke } else { diff --git a/nms-patches/BlockPiston.patch b/nms-patches/BlockPiston.patch index dc294d1722..c7e24f36f5 100644 --- a/nms-patches/BlockPiston.patch +++ b/nms-patches/BlockPiston.patch @@ -42,8 +42,8 @@ } } -- if (!flag1 && iblockdata1.getMaterial() != Material.AIR && a(iblockdata1, world, blockposition1, enumdirection.opposite(), false, enumdirection) && (iblockdata1.p() == EnumPistonReaction.NORMAL || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) { -+ if (!flag1 && a(iblockdata1, world, blockposition1, enumdirection.opposite(), false, enumdirection) && (iblockdata1.p() == EnumPistonReaction.NORMAL || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) { // CraftBukkit - remove 'block.getMaterial() != Material.AIR' condition +- if (!flag1 && iblockdata1.getMaterial() != Material.AIR && a(iblockdata1, world, blockposition1, enumdirection.opposite(), false, enumdirection) && (iblockdata1.o() == EnumPistonReaction.NORMAL || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) { ++ if (!flag1 && a(iblockdata1, world, blockposition1, enumdirection.opposite(), false, enumdirection) && (iblockdata1.o() == EnumPistonReaction.NORMAL || block == Blocks.PISTON || block == Blocks.STICKY_PISTON)) { // CraftBukkit - remove 'block.getMaterial() != Material.AIR' condition this.a(world, blockposition, enumdirection, false); } } else { diff --git a/nms-patches/BlockPortal.patch b/nms-patches/BlockPortal.patch index 4956296f6f..62524affbc 100644 --- a/nms-patches/BlockPortal.patch +++ b/nms-patches/BlockPortal.patch @@ -13,7 +13,7 @@ @@ -43,7 +46,8 @@ } - if (i > 0 && !world.getType(blockposition1.up()).m()) { + if (i > 0 && !world.getType(blockposition1.up()).l()) { - Entity entity = ItemMonsterEgg.a(world, EntityTypes.getName(EntityPigZombie.class), (double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 1.1D, (double) blockposition1.getZ() + 0.5D); + // CraftBukkit - set spawn reason to NETHER_PORTAL + Entity entity = ItemMonsterEgg.spawnCreature(world, EntityTypes.getName(EntityPigZombie.class), (double) blockposition1.getX() + 0.5D, (double) blockposition1.getY() + 1.1D, (double) blockposition1.getZ() + 0.5D, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NETHER_PORTAL); diff --git a/nms-patches/BlockSapling.patch b/nms-patches/BlockSapling.patch index bce7652f2c..e1a4e53867 100644 --- a/nms-patches/BlockSapling.patch +++ b/nms-patches/BlockSapling.patch @@ -21,7 +21,7 @@ + public static TreeType treeType; // CraftBukkit protected BlockSapling() { - this.y(this.blockStateList.getBlockData().set(BlockSapling.TYPE, BlockWood.EnumLogVariant.OAK).set(BlockSapling.STAGE, Integer.valueOf(0))); + this.x(this.blockStateList.getBlockData().set(BlockSapling.TYPE, BlockWood.EnumLogVariant.OAK).set(BlockSapling.STAGE, Integer.valueOf(0))); @@ -25,7 +35,30 @@ if (!world.isClientSide) { super.b(world, blockposition, iblockdata, random); diff --git a/nms-patches/BlockTrapdoor.patch b/nms-patches/BlockTrapdoor.patch index 1eb2c40d99..310070951d 100644 --- a/nms-patches/BlockTrapdoor.patch +++ b/nms-patches/BlockTrapdoor.patch @@ -11,7 +11,7 @@ @@ -91,6 +92,19 @@ boolean flag = world.isBlockIndirectlyPowered(blockposition); - if (flag || block.getBlockData().n()) { + if (flag || block.getBlockData().m()) { + // CraftBukkit start + org.bukkit.World bworld = world.getWorld(); + org.bukkit.block.Block bblock = bworld.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); diff --git a/nms-patches/BlockTripwireHook.patch b/nms-patches/BlockTripwireHook.patch index 07fde01d49..d3cf09471b 100644 --- a/nms-patches/BlockTripwireHook.patch +++ b/nms-patches/BlockTripwireHook.patch @@ -9,7 +9,7 @@ public class BlockTripwireHook extends Block { public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING; -@@ -159,6 +161,17 @@ +@@ -160,6 +162,17 @@ this.a(world, blockposition1, flag4, flag5, flag2, flag3); } diff --git a/nms-patches/CommandBlockListenerAbstract.patch b/nms-patches/CommandBlockListenerAbstract.patch index ceaba882ed..da8ee32a40 100644 --- a/nms-patches/CommandBlockListenerAbstract.patch +++ b/nms-patches/CommandBlockListenerAbstract.patch @@ -26,7 +26,7 @@ if (minecraftserver != null && minecraftserver.M() && minecraftserver.getEnableCommandBlock()) { try { this.f = null; -- this.d = minecraftserver.getCommandHandler().b(this, this.g); +- this.d = minecraftserver.getCommandHandler().a(this, this.g); + // CraftBukkit start - Handle command block commands using Bukkit dispatcher + this.d = executeSafely(this, sender, this.g); + // CraftBukkit end diff --git a/nms-patches/CommandExecute.patch b/nms-patches/CommandExecute.patch index 6fad56fb37..8fbfb2eae1 100644 --- a/nms-patches/CommandExecute.patch +++ b/nms-patches/CommandExecute.patch @@ -11,27 +11,16 @@ public class CommandExecute extends CommandAbstract { -@@ -59,7 +63,10 @@ +@@ -59,26 +63,59 @@ } String s = a(astring, b0); -- ICommandListener icommandlistener1 = new ICommandListener() { -+ // CraftBukkit start - name class -+ class ProxyListener implements ICommandListener { -+ private final ICommandListener base = icommandlistener; -+ // CraftBukkit end - public String getName() { - return entity.getName(); - } -@@ -104,25 +111,59 @@ - return entity.C_(); - } - }; -+ ICommandListener icommandlistener1 = new ProxyListener(); // CraftBukkit +- CommandListenerWrapper commandlistenerwrapper = CommandListenerWrapper.a(icommandlistener).a(entity, new Vec3D(d0, d1, d2)).a(minecraftserver.worldServer[0].getGameRules().getBoolean("commandBlockOutput")); ++ CommandListenerWrapper commandlistenerwrapper = CommandListenerWrapper.a(icommandlistener).a(entity, new Vec3D(d0, d1, d2)).a(minecraftserver.worlds.get(0).getGameRules().getBoolean("commandBlockOutput")); // CraftBukkit ICommandHandler icommandhandler = minecraftserver.getCommandHandler(); try { -- int i = icommandhandler.b(icommandlistener1, s); +- int i = icommandhandler.a(commandlistenerwrapper, s); + // CraftBukkit start + org.bukkit.command.CommandSender sender = null; + ICommandListener listener = icommandlistener; @@ -42,8 +31,8 @@ + sender = minecraftserver.remoteConsole; + } else if (listener instanceof CommandBlockListenerAbstract) { + sender = ((CommandBlockListenerAbstract) listener).sender; -+ } else if (listener instanceof ProxyListener) { -+ listener = ((ProxyListener) listener).base; // Search deeper ++ } else if (listener instanceof CommandListenerWrapper) { ++ listener = ((CommandListenerWrapper) listener).base; // Search deeper + } else if (VanillaCommandWrapper.lastSender != null) { + sender = VanillaCommandWrapper.lastSender; + } else if (listener.f() != null) { @@ -52,7 +41,7 @@ + throw new CommandException("Unhandled executor " + icommandlistener.getClass().getSimpleName(), new Object[0]); + } + } -+ int i = CommandBlockListenerAbstract.executeCommand(icommandlistener1, new ProxiedNativeCommandSender(icommandlistener1, sender, entity.getBukkitEntity()), s); ++ int i = CommandBlockListenerAbstract.executeCommand(commandlistenerwrapper, new ProxiedNativeCommandSender(commandlistenerwrapper, sender, entity.getBukkitEntity()), s); + // CraftBukkit end if (i < 1) { diff --git a/nms-patches/ContainerBrewingStand.patch b/nms-patches/ContainerBrewingStand.patch index dc38c122a7..6bacb345ef 100644 --- a/nms-patches/ContainerBrewingStand.patch +++ b/nms-patches/ContainerBrewingStand.patch @@ -23,8 +23,8 @@ public ContainerBrewingStand(PlayerInventory playerinventory, IInventory iinventory) { + player = playerinventory; // CraftBukkit this.brewingStand = iinventory; - this.a((Slot) (new ContainerBrewingStand.SlotPotionBottle(playerinventory.player, iinventory, 0, 56, 51))); - this.a((Slot) (new ContainerBrewingStand.SlotPotionBottle(playerinventory.player, iinventory, 1, 79, 58))); + this.a((Slot) (new ContainerBrewingStand.SlotPotionBottle(iinventory, 0, 56, 51))); + this.a((Slot) (new ContainerBrewingStand.SlotPotionBottle(iinventory, 1, 79, 58))); @@ -54,6 +65,7 @@ } @@ -33,7 +33,7 @@ return this.brewingStand.a(entityhuman); } -@@ -181,4 +193,17 @@ +@@ -178,4 +190,17 @@ return item == Items.POTION || item == Items.SPLASH_POTION || item == Items.LINGERING_POTION || item == Items.GLASS_BOTTLE; } } diff --git a/nms-patches/ContainerEnchantTable.patch b/nms-patches/ContainerEnchantTable.patch index 7f21527ee2..4fd8a19a27 100644 --- a/nms-patches/ContainerEnchantTable.patch +++ b/nms-patches/ContainerEnchantTable.patch @@ -147,11 +147,11 @@ + } - if (flag) { -- Items.ENCHANTED_BOOK.a(itemstack, weightedrandomenchant); +- ItemEnchantedBook.a(itemstack, weightedrandomenchant); - } else { - itemstack.addEnchantment(weightedrandomenchant.enchantment, weightedrandomenchant.level); + WeightedRandomEnchant weightedrandomenchant = new WeightedRandomEnchant(Enchantment.c(enchantId), entry.getValue()); -+ Items.ENCHANTED_BOOK.a(itemstack, weightedrandomenchant); ++ ItemEnchantedBook.a(itemstack, weightedrandomenchant); + } else { + item.addUnsafeEnchantment(entry.getKey(), entry.getValue()); + } diff --git a/nms-patches/CustomFunctionData.patch b/nms-patches/CustomFunctionData.patch index f7ac23a0c6..f0baac8473 100644 --- a/nms-patches/CustomFunctionData.patch +++ b/nms-patches/CustomFunctionData.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/CustomFunctionData.java +++ b/net/minecraft/server/CustomFunctionData.java -@@ -31,7 +31,7 @@ +@@ -33,7 +33,7 @@ } public World getWorld() { @@ -9,7 +9,7 @@ } public MinecraftServer C_() { -@@ -55,7 +55,7 @@ +@@ -57,7 +57,7 @@ } public int c() { @@ -18,7 +18,7 @@ } public Map d() { -@@ -63,7 +63,7 @@ +@@ -65,7 +65,7 @@ } public void e() { diff --git a/nms-patches/DedicatedServer.patch b/nms-patches/DedicatedServer.patch index eb648a36f2..04036d244b 100644 --- a/nms-patches/DedicatedServer.patch +++ b/nms-patches/DedicatedServer.patch @@ -98,7 +98,7 @@ + thread.setDaemon(true); thread.start(); - DedicatedServer.LOGGER.info("Starting minecraft server version 1.12-pre2"); + DedicatedServer.LOGGER.info("Starting minecraft server version 1.12-pre5"); @@ -79,7 +126,7 @@ } @@ -172,14 +172,14 @@ while (!this.serverCommandQueue.isEmpty()) { ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0); -- this.getCommandHandler().b(servercommand.source, servercommand.command); +- this.getCommandHandler().a(servercommand.source, servercommand.command); + // CraftBukkit start - ServerCommand for preprocessing + ServerCommandEvent event = new ServerCommandEvent(console, servercommand.command); + server.getPluginManager().callEvent(event); + if (event.isCancelled()) continue; + servercommand = new ServerCommand(event.getCommand(), servercommand.source); + -+ // this.getCommandHandler().b(servercommand.source, servercommand.command); // Called in dispatchServerCommand ++ // this.getCommandHandler().a(servercommand.source, servercommand.command); // Called in dispatchServerCommand + server.dispatchServerCommand(console, servercommand); + // CraftBukkit end } @@ -215,7 +215,7 @@ - public String executeRemoteCommand(String s) { - this.remoteControlCommandListener.clearMessages(); -- this.b.b(this.remoteControlCommandListener, s); +- this.b.a(this.remoteControlCommandListener, s); - return this.remoteControlCommandListener.getMessages(); + return result.toString(); + // CraftBukkit end diff --git a/nms-patches/DispenserRegistry.patch b/nms-patches/DispenserRegistry.patch index 310e6d5503..bf0e83c310 100644 --- a/nms-patches/DispenserRegistry.patch +++ b/nms-patches/DispenserRegistry.patch @@ -16,7 +16,7 @@ public class DispenserRegistry { public static final PrintStream a = System.out; -@@ -70,7 +79,7 @@ +@@ -71,7 +80,7 @@ BlockDispenser.REGISTRY.a(Items.SPLASH_POTION, new IDispenseBehavior() { public ItemStack a(ISourceBlock isourceblock, final ItemStack itemstack) { return (new DispenseBehaviorProjectile() { @@ -25,7 +25,7 @@ return new EntityPotion(world, iposition.getX(), iposition.getY(), iposition.getZ(), itemstack1.cloneItemStack()); } -@@ -87,7 +96,7 @@ +@@ -88,7 +97,7 @@ BlockDispenser.REGISTRY.a(Items.LINGERING_POTION, new IDispenseBehavior() { public ItemStack a(ISourceBlock isourceblock, final ItemStack itemstack) { return (new DispenseBehaviorProjectile() { @@ -34,7 +34,7 @@ return new EntityPotion(world, iposition.getX(), iposition.getY(), iposition.getZ(), itemstack1.cloneItemStack()); } -@@ -107,14 +116,46 @@ +@@ -108,14 +117,46 @@ double d0 = isourceblock.getX() + (double) enumdirection.getAdjacentX(); double d1 = (double) ((float) (isourceblock.getBlockPosition().getY() + enumdirection.getAdjacentY()) + 0.2F); double d2 = isourceblock.getZ() + (double) enumdirection.getAdjacentZ(); @@ -83,7 +83,7 @@ return itemstack; } }); -@@ -124,10 +165,39 @@ +@@ -125,10 +166,39 @@ double d0 = isourceblock.getX() + (double) enumdirection.getAdjacentX(); double d1 = (double) ((float) isourceblock.getBlockPosition().getY() + 0.2F); double d2 = isourceblock.getZ() + (double) enumdirection.getAdjacentZ(); @@ -125,7 +125,7 @@ return itemstack; } -@@ -148,8 +218,38 @@ +@@ -149,8 +219,38 @@ double d4 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentY(); double d5 = random.nextGaussian() * 0.05D + (double) enumdirection.getAdjacentZ(); @@ -166,7 +166,7 @@ return itemstack; } -@@ -170,7 +270,53 @@ +@@ -171,7 +271,53 @@ ItemBucket itembucket = (ItemBucket) itemstack.getItem(); BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING)); @@ -221,7 +221,7 @@ } }; -@@ -197,6 +343,30 @@ +@@ -198,6 +344,30 @@ item = Items.LAVA_BUCKET; } @@ -252,7 +252,7 @@ world.setAir(blockposition); itemstack.subtract(1); if (itemstack.isEmpty()) { -@@ -214,14 +384,42 @@ +@@ -215,14 +385,42 @@ protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) { World world = isourceblock.getWorld(); @@ -298,7 +298,7 @@ } 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); -@@ -239,6 +437,32 @@ +@@ -240,6 +438,32 @@ World world = isourceblock.getWorld(); BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING)); @@ -331,7 +331,7 @@ if (ItemDye.a(itemstack, world, blockposition)) { if (!world.isClientSide) { world.triggerEffect(2005, blockposition, 0); -@@ -246,6 +470,26 @@ +@@ -247,6 +471,26 @@ } else { this.b = false; } @@ -358,7 +358,7 @@ return itemstack; } else { -@@ -257,11 +501,40 @@ +@@ -258,11 +502,40 @@ protected ItemStack b(ISourceBlock isourceblock, ItemStack itemstack) { World world = isourceblock.getWorld(); BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING)); @@ -401,7 +401,7 @@ return itemstack; } }); -@@ -272,6 +545,30 @@ +@@ -273,6 +546,30 @@ BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection); BlockSkull blockskull = Blocks.SKULL; @@ -432,7 +432,7 @@ this.b = true; if (world.isEmpty(blockposition) && blockskull.b(world, blockposition, itemstack)) { if (!world.isClientSide) { -@@ -320,6 +617,30 @@ +@@ -321,6 +618,30 @@ BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING)); BlockPumpkin blockpumpkin = (BlockPumpkin) Blocks.PUMPKIN; @@ -463,7 +463,7 @@ this.b = true; if (world.isEmpty(blockposition) && blockpumpkin.b(world, blockposition)) { if (!world.isClientSide) { -@@ -403,6 +724,30 @@ +@@ -407,6 +728,30 @@ EnumDirection enumdirection = (EnumDirection) isourceblock.e().get(BlockDispenser.FACING); BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection); @@ -494,7 +494,7 @@ this.b = world.a(block, blockposition, false, EnumDirection.DOWN, (Entity) null); if (this.b) { EnumDirection enumdirection1 = world.isEmpty(blockposition.down()) ? enumdirection : EnumDirection.UP; -@@ -471,12 +816,40 @@ +@@ -475,12 +820,40 @@ d3 = 0.0D; } diff --git a/nms-patches/Enchantment.patch b/nms-patches/Enchantment.patch index cdfad14a1d..498dc96544 100644 --- a/nms-patches/Enchantment.patch +++ b/nms-patches/Enchantment.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/Enchantment.java +++ b/net/minecraft/server/Enchantment.java -@@ -19,7 +19,7 @@ +@@ -20,7 +20,7 @@ } public static int getId(Enchantment enchantment) { @@ -9,7 +9,7 @@ } @Nullable -@@ -154,6 +154,11 @@ +@@ -155,6 +155,11 @@ Enchantment.enchantments.a(62, new MinecraftKey("lure"), new EnchantmentLure(Enchantment.Rarity.RARE, EnchantmentSlotType.FISHING_ROD, new EnumItemSlot[] { EnumItemSlot.MAINHAND})); Enchantment.enchantments.a(70, new MinecraftKey("mending"), new EnchantmentMending(Enchantment.Rarity.RARE, EnumItemSlot.values())); Enchantment.enchantments.a(71, new MinecraftKey("vanishing_curse"), new EnchantmentVanishing(Enchantment.Rarity.VERY_RARE, EnumItemSlot.values())); diff --git a/nms-patches/EntityHuman.patch b/nms-patches/EntityHuman.patch index 72cbcf8360..24faf19847 100644 --- a/nms-patches/EntityHuman.patch +++ b/nms-patches/EntityHuman.patch @@ -33,7 +33,7 @@ protected int bA; public float bB; public float bC; -@@ -53,6 +66,17 @@ +@@ -52,6 +65,17 @@ @Nullable public EntityFishingHook hookedFish; @@ -51,7 +51,7 @@ protected ItemCooldown l() { return new ItemCooldown(); } -@@ -311,7 +335,8 @@ +@@ -310,7 +334,8 @@ if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL && this.world.getGameRules().getBoolean("naturalRegeneration")) { if (this.getHealth() < this.getMaxHealth() && this.ticksLived % 20 == 0) { @@ -61,7 +61,7 @@ } if (this.foodData.c() && this.ticksLived % 10 == 0) { -@@ -335,7 +360,7 @@ +@@ -334,7 +359,7 @@ this.m((float) attributeinstance.getValue()); float f = MathHelper.sqrt(this.motX * this.motX + this.motZ * this.motZ); @@ -70,7 +70,7 @@ if (f > 0.1F) { f = 0.1F; -@@ -457,6 +482,7 @@ +@@ -456,6 +481,7 @@ @Nullable public EntityItem a(boolean flag) { @@ -78,7 +78,7 @@ return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && !this.inventory.getItemInHand().isEmpty() ? this.inventory.getItemInHand().getCount() : 1), false, true); } -@@ -499,6 +525,30 @@ +@@ -498,6 +524,30 @@ entityitem.motZ += Math.sin((double) f1) * (double) f; } @@ -109,7 +109,7 @@ ItemStack itemstack1 = this.a(entityitem); if (flag1) { -@@ -614,6 +664,13 @@ +@@ -613,6 +663,13 @@ this.a(true, true, false); } @@ -123,7 +123,7 @@ if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) { this.d = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ")); this.e = nbttagcompound.getBoolean("SpawnForced"); -@@ -666,6 +723,7 @@ +@@ -665,6 +722,7 @@ if (!this.getShoulderEntityRight().isEmpty()) { nbttagcompound.set("ShoulderEntityRight", this.getShoulderEntityRight()); } @@ -131,7 +131,7 @@ } -@@ -686,7 +744,7 @@ +@@ -685,7 +743,7 @@ this.releaseShoulderEntities(); if (damagesource.r()) { if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL) { @@ -140,7 +140,7 @@ } if (this.world.getDifficulty() == EnumDifficulty.EASY) { -@@ -698,7 +756,7 @@ +@@ -697,7 +755,7 @@ } } @@ -149,7 +149,7 @@ } } } -@@ -712,10 +770,29 @@ +@@ -711,10 +769,29 @@ } public boolean a(EntityHuman entityhuman) { @@ -182,7 +182,7 @@ } protected void damageArmor(float f) { -@@ -758,7 +835,12 @@ +@@ -757,7 +834,12 @@ return (float) i / (float) this.inventory.armor.size(); } @@ -196,7 +196,7 @@ if (!this.isInvulnerable(damagesource)) { f = this.applyArmorModifier(damagesource, f); f = this.applyMagicModifier(damagesource, f); -@@ -778,6 +860,7 @@ +@@ -777,6 +859,7 @@ } } @@ -204,7 +204,7 @@ } public void openSign(TileEntitySign tileentitysign) {} -@@ -899,8 +982,15 @@ +@@ -898,8 +981,15 @@ if (entity instanceof EntityLiving) { f3 = ((EntityLiving) entity).getHealth(); if (j > 0 && !entity.isBurning()) { @@ -222,7 +222,7 @@ } } -@@ -931,8 +1021,11 @@ +@@ -930,8 +1020,11 @@ EntityLiving entityliving = (EntityLiving) iterator.next(); if (entityliving != this && entityliving != entity && !this.r(entityliving) && this.h(entityliving) < 9.0D) { @@ -235,7 +235,7 @@ } } -@@ -941,11 +1034,28 @@ +@@ -940,11 +1033,28 @@ } if (entity instanceof EntityPlayer && entity.velocityChanged) { @@ -264,7 +264,7 @@ } if (flag2) { -@@ -994,7 +1104,14 @@ +@@ -993,7 +1103,14 @@ this.a(StatisticList.y, Math.round(f5 * 10.0F)); if (j > 0) { @@ -280,7 +280,7 @@ } if (this.world instanceof WorldServer && f5 > 2.0F) { -@@ -1010,6 +1127,11 @@ +@@ -1009,6 +1126,11 @@ if (flag4) { entity.extinguish(); } @@ -292,7 +292,7 @@ } } -@@ -1100,6 +1222,20 @@ +@@ -1099,6 +1221,20 @@ this.stopRiding(); } @@ -313,7 +313,7 @@ this.releaseShoulderEntities(); this.setSize(0.2F, 0.2F); if (this.world.isLoaded(blockposition)) { -@@ -1160,6 +1296,23 @@ +@@ -1159,6 +1295,23 @@ this.world.everyoneSleeping(); } @@ -337,7 +337,7 @@ this.sleepTicks = flag ? 0 : 100; if (flag2) { this.setRespawnPosition(this.bedPosition, false); -@@ -1211,9 +1364,11 @@ +@@ -1210,9 +1363,11 @@ if (blockposition != null) { this.d = blockposition; this.e = flag; @@ -349,7 +349,7 @@ } } -@@ -1537,13 +1692,17 @@ +@@ -1540,13 +1695,17 @@ } protected void releaseShoulderEntities() { @@ -372,7 +372,7 @@ if (!this.world.isClientSide && !nbttagcompound.isEmpty()) { Entity entity = EntityTypes.a(nbttagcompound, this.world); -@@ -1552,9 +1711,10 @@ +@@ -1555,9 +1714,10 @@ } entity.setPosition(this.locX, this.locY + 0.699999988079071D, this.locZ); @@ -384,7 +384,7 @@ } public abstract boolean isSpectator(); -@@ -1756,7 +1916,7 @@ +@@ -1759,7 +1919,7 @@ return entitymonster.c(this.a); } diff --git a/nms-patches/EntityPig.patch b/nms-patches/EntityPig.patch index 6d97b021d6..0af22aafb3 100644 --- a/nms-patches/EntityPig.patch +++ b/nms-patches/EntityPig.patch @@ -37,7 +37,7 @@ + entitypigzombie.setSlot(EnumItemSlot.MAINHAND, new ItemStack(Items.GOLDEN_SWORD)); entitypigzombie.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, this.pitch); - entitypigzombie.setAI(this.hasAI()); + entitypigzombie.setNoAI(this.isNoAI()); @@ -163,7 +172,8 @@ entitypigzombie.setCustomNameVisible(this.getCustomNameVisible()); } diff --git a/nms-patches/EntityPlayer.patch b/nms-patches/EntityPlayer.patch index 08574ea9a9..98d00053cc 100644 --- a/nms-patches/EntityPlayer.patch +++ b/nms-patches/EntityPlayer.patch @@ -22,7 +22,7 @@ + public class EntityPlayer extends EntityHuman implements ICrafting { - private static final Logger bW = LogManager.getLogger(); + private static final Logger bV = LogManager.getLogger(); @@ -51,6 +67,19 @@ public int ping; public boolean viewingCredits; @@ -43,15 +43,7 @@ public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { super(worldserver, gameprofile); playerinteractmanager.player = this; -@@ -75,13 +104,18 @@ - this.server = minecraftserver; - this.ca = minecraftserver.getPlayerList().a((EntityHuman) this); - this.bZ = minecraftserver.getPlayerList().h(this); -- this.P = 0.0F; -+ this.P = 1.0F; // CraftBukkit - hit when sneaking - this.setPositionRotation(blockposition, 0.0F, 0.0F); - - while (!worldserver.getCubes(this, this.getBoundingBox()).isEmpty() && this.locY < 255.0D) { +@@ -82,6 +111,11 @@ this.setPosition(this.locX, this.locY + 1.0D, this.locZ); } @@ -65,7 +57,7 @@ public void a(NBTTagCompound nbttagcompound) { @@ -104,6 +138,7 @@ if (nbttagcompound.hasKeyOfType("recipeBook", 10)) { - this.cs.a(nbttagcompound.getCompound("recipeBook")); + this.cr.a(nbttagcompound.getCompound("recipeBook")); } + this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit @@ -74,7 +66,7 @@ @@ -150,8 +185,34 @@ } - nbttagcompound.set("recipeBook", this.cs.e()); + nbttagcompound.set("recipeBook", this.cr.e()); + this.getBukkitEntity().setExtraData(nbttagcompound); // CraftBukkit } @@ -121,14 +113,14 @@ @@ -250,7 +316,7 @@ } - if (this.getHealth() != this.lastHealthSent || this.ci != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.cj) { + if (this.getHealth() != this.lastHealthSent || this.ch != this.foodData.getFoodLevel() || this.foodData.getSaturationLevel() == 0.0F != this.ci) { - 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())); // CraftBukkit this.lastHealthSent = this.getHealth(); - this.ci = this.foodData.getFoodLevel(); - this.cj = this.foodData.getSaturationLevel() == 0.0F; + this.ch = this.foodData.getFoodLevel(); + this.ci = this.foodData.getSaturationLevel() == 0.0F; @@ -271,6 +337,12 @@ - this.a(IScoreboardCriteria.i, MathHelper.f((float) this.cd)); + this.a(IScoreboardCriteria.i, MathHelper.f((float) this.cc)); } + // CraftBukkit start - Force max health updates @@ -137,9 +129,9 @@ + } + // CraftBukkit end + - if (this.getArmorStrength() != this.ce) { - this.ce = this.getArmorStrength(); - this.a(IScoreboardCriteria.j, MathHelper.f((float) this.ce)); + if (this.getArmorStrength() != this.cd) { + this.cd = this.getArmorStrength(); + this.a(IScoreboardCriteria.j, MathHelper.f((float) this.cd)); @@ -295,6 +367,16 @@ CriterionTriggers.o.a(this); } @@ -319,7 +311,7 @@ + if (this.isSleeping()) return this; // CraftBukkit - SPIGOT-3154 + // this.worldChangeInvuln = true; // CraftBukkit - Moved down and into PlayerList#changeDimension if (this.dimension == 0 && i == -1) { - this.cw = new Vec3D(this.locX, this.locY, this.locZ); + this.cv = new Vec3D(this.locX, this.locY, this.locZ); } else if (this.dimension != -1 && i != 0) { @@ -476,6 +599,7 @@ } @@ -519,12 +511,12 @@ @@ -880,7 +1071,7 @@ this.lastSentExp = -1; this.lastHealthSent = -1.0F; - this.ci = -1; -- this.cs.a((RecipeBook) entityplayer.cs); -+ // this.cs.a((RecipeBook) entityplayer.cs); // CraftBukkit + this.ch = -1; +- this.cr.a((RecipeBook) entityplayer.cr); ++ // this.cr.a((RecipeBook) entityplayer.cr); // CraftBukkit this.removeQueue.addAll(entityplayer.removeQueue); - this.cr = entityplayer.cr; - this.cw = entityplayer.cw; + this.cq = entityplayer.cq; + this.cv = entityplayer.cv; @@ -939,6 +1130,18 @@ } @@ -579,14 +571,14 @@ + } + // CraftBukkit end this.locale = packetplayinsettings.a(); - this.cm = packetplayinsettings.c(); - this.cn = packetplayinsettings.d(); + this.cl = packetplayinsettings.c(); + this.cm = packetplayinsettings.d(); @@ -1054,7 +1273,7 @@ - this.cp = (Entity) (entity == null ? this : entity); - if (entity1 != this.cp) { - this.playerConnection.sendPacket(new PacketPlayOutCamera(this.cp)); -- this.enderTeleportTo(this.cp.locX, this.cp.locY, this.cp.locZ); -+ this.playerConnection.a(this.cp.locX, this.cp.locY, this.cp.locZ, this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit + this.co = (Entity) (entity == null ? this : entity); + if (entity1 != this.co) { + this.playerConnection.sendPacket(new PacketPlayOutCamera(this.co)); +- this.enderTeleportTo(this.co.locX, this.co.locY, this.co.locZ); ++ this.playerConnection.a(this.co.locX, this.co.locY, this.co.locZ, this.yaw, this.pitch, TeleportCause.SPECTATE); // CraftBukkit } } @@ -619,7 +611,7 @@ public AdvancementDataPlayer getAdvancementData() { @@ -1114,4 +1338,139 @@ public Vec3D Q() { - return this.cw; + return this.cv; } + + // CraftBukkit start - Add per-player time and weather. diff --git a/nms-patches/EntityZombie.patch b/nms-patches/EntityZombie.patch index 2acddcba3f..60c088762f 100644 --- a/nms-patches/EntityZombie.patch +++ b/nms-patches/EntityZombie.patch @@ -31,7 +31,7 @@ } } @@ -167,8 +181,8 @@ - if (this.world.getType(new BlockPosition(i1, j1 - 1, k1)).r() && this.world.getLightLevel(new BlockPosition(i1, j1, k1)) < 10) { + if (this.world.getType(new BlockPosition(i1, j1 - 1, k1)).q() && 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())) { - this.world.addEntity(entityzombie); diff --git a/nms-patches/HandshakeListener.patch b/nms-patches/HandshakeListener.patch index 9d05ff87a6..99a2fdd969 100644 --- a/nms-patches/HandshakeListener.patch +++ b/nms-patches/HandshakeListener.patch @@ -57,8 +57,8 @@ + } + // CraftBukkit end + - if (packethandshakinginsetprotocol.b() > 329) { - chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.12-pre2"); + if (packethandshakinginsetprotocol.b() > 332) { + chatcomponenttext = new ChatComponentText("Outdated server! I\'m still on 1.12-pre5"); this.b.sendPacket(new PacketLoginOutDisconnect(chatcomponenttext)); @@ -26,6 +71,7 @@ this.b.close(chatcomponenttext); diff --git a/nms-patches/IRecipe.patch b/nms-patches/IRecipe.patch index 48c1ebc405..844b91e7e8 100644 --- a/nms-patches/IRecipe.patch +++ b/nms-patches/IRecipe.patch @@ -12,8 +12,8 @@ } public int a(IRecipe irecipe) { -- return ((MinecraftKey) CraftingManager.recipes.b(this)).a((MinecraftKey) CraftingManager.recipes.b(irecipe)); -+ return this.key.a(irecipe.key); // CraftBukkit +- return ((MinecraftKey) CraftingManager.recipes.b(this)).toString().compareTo(((MinecraftKey) CraftingManager.recipes.b(irecipe)).toString()); ++ return this.key.toString().compareTo(irecipe.key.toString()); // CraftBukkit } - public int compareTo(Object object) { diff --git a/nms-patches/ItemBucket.patch b/nms-patches/ItemBucket.patch index 31987d2d51..0d6b49e120 100644 --- a/nms-patches/ItemBucket.patch +++ b/nms-patches/ItemBucket.patch @@ -52,7 +52,7 @@ - } else if (this.a(entityhuman, world, blockposition1)) { + } else if (this.a(entityhuman, world, blockposition1, movingobjectposition.direction, blockposition, itemstack)) { // CraftBukkit if (entityhuman instanceof EntityPlayer) { - CriterionTriggers.x.a((EntityPlayer) entityhuman, blockposition, itemstack); + CriterionTriggers.x.a((EntityPlayer) entityhuman, blockposition1, itemstack); } @@ -67,16 +87,19 @@ } diff --git a/nms-patches/ItemSkull.patch b/nms-patches/ItemSkull.patch index da4ce8a1ba..76f59f26b8 100644 --- a/nms-patches/ItemSkull.patch +++ b/nms-patches/ItemSkull.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/ItemSkull.java +++ b/net/minecraft/server/ItemSkull.java -@@ -120,6 +120,15 @@ +@@ -124,6 +124,15 @@ nbttagcompound.set("SkullOwner", GameProfileSerializer.serialize(new NBTTagCompound(), gameprofile)); return true; } else { diff --git a/nms-patches/ItemStack.patch b/nms-patches/ItemStack.patch index a294408458..693439094a 100644 --- a/nms-patches/ItemStack.patch +++ b/nms-patches/ItemStack.patch @@ -303,7 +303,7 @@ itemstack.d(this.D()); if (this.tag != null) { -@@ -514,6 +720,12 @@ +@@ -513,6 +719,12 @@ nbttaglist.add(nbttagcompound); } diff --git a/nms-patches/ItemWaterLily.patch b/nms-patches/ItemWaterLily.patch index 89115f2428..65b3ab61ed 100644 --- a/nms-patches/ItemWaterLily.patch +++ b/nms-patches/ItemWaterLily.patch @@ -13,6 +13,6 @@ + return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack); + } + // CraftBukkit end - if (!entityhuman.abilities.canInstantlyBuild) { - itemstack.subtract(1); + if (entityhuman instanceof EntityPlayer) { + CriterionTriggers.x.a((EntityPlayer) entityhuman, blockposition1, itemstack); } diff --git a/nms-patches/ItemWorldMap.patch b/nms-patches/ItemWorldMap.patch index 42baeba595..8705b2516c 100644 --- a/nms-patches/ItemWorldMap.patch +++ b/nms-patches/ItemWorldMap.patch @@ -71,7 +71,7 @@ int i = 1 << worldmap.scale; int j = worldmap.centerX; int k = worldmap.centerZ; -@@ -308,6 +322,7 @@ +@@ -309,6 +323,7 @@ protected static void a(ItemStack itemstack, World world, int i) { WorldMap worldmap = Items.FILLED_MAP.getSavedMap(itemstack, world); @@ -79,7 +79,7 @@ itemstack.setData(world.b("map")); WorldMap worldmap1 = new WorldMap("map_" + itemstack.getData()); -@@ -318,6 +333,10 @@ +@@ -319,6 +334,10 @@ worldmap1.map = worldmap.map; worldmap1.c(); world.a("map_" + itemstack.getData(), (PersistentBase) worldmap1); @@ -90,7 +90,7 @@ } } -@@ -325,6 +344,7 @@ +@@ -326,6 +345,7 @@ protected static void b(ItemStack itemstack, World world) { WorldMap worldmap = Items.FILLED_MAP.getSavedMap(itemstack, world); @@ -98,7 +98,7 @@ itemstack.setData(world.b("map")); WorldMap worldmap1 = new WorldMap("map_" + itemstack.getData()); -@@ -336,6 +356,10 @@ +@@ -337,6 +357,10 @@ worldmap1.map = worldmap.map; worldmap1.c(); world.a("map_" + itemstack.getData(), (PersistentBase) worldmap1); diff --git a/nms-patches/JsonList.patch b/nms-patches/JsonList.patch index 9af5b05c97..9cdf691bfc 100644 --- a/nms-patches/JsonList.patch +++ b/nms-patches/JsonList.patch @@ -22,16 +22,16 @@ public boolean isEmpty() { return this.d.size() < 1; } -@@ -177,7 +183,7 @@ - JsonListEntry jsonlistentry = (JsonListEntry) iterator.next(); +@@ -178,7 +184,7 @@ + JsonListEntry jsonlistentry = (JsonListEntry) iterator.next(); - 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 + 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 @@ +@@ -207,11 +213,11 @@ } } diff --git a/nms-patches/MapIcon.patch b/nms-patches/MapIcon.patch deleted file mode 100644 index 8f7130f0ba..0000000000 --- a/nms-patches/MapIcon.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/net/minecraft/server/MapIcon.java -+++ b/net/minecraft/server/MapIcon.java -@@ -86,7 +86,7 @@ - } - - public static MapIcon.Type a(byte b0) { -- return values()[b0]; -+ return b0 >= 0 && b0 < values().length ? values()[b0] : MapIcon.Type.PLAYER; // CraftBukkit - } - } - } diff --git a/nms-patches/PathfinderGoalFollowOwner.patch b/nms-patches/PathfinderGoalFollowOwner.patch index 64420ba546..039f15a91d 100644 --- a/nms-patches/PathfinderGoalFollowOwner.patch +++ b/nms-patches/PathfinderGoalFollowOwner.patch @@ -12,7 +12,7 @@ public class PathfinderGoalFollowOwner extends PathfinderGoal { private final EntityTameableAnimal d; -@@ -79,7 +85,18 @@ +@@ -73,7 +79,18 @@ for (int l = 0; l <= 4; ++l) { for (int i1 = 0; i1 <= 4; ++i1) { if ((l < 1 || i1 < 1 || l > 3 || i1 > 3) && this.a(i, j, k, l, i1)) { diff --git a/nms-patches/PathfinderGoalVillagerFarm.patch b/nms-patches/PathfinderGoalVillagerFarm.patch index 542eba3db5..32dc8bd0a2 100644 --- a/nms-patches/PathfinderGoalVillagerFarm.patch +++ b/nms-patches/PathfinderGoalVillagerFarm.patch @@ -3,7 +3,7 @@ @@ -40,7 +40,11 @@ Block block = iblockdata.getBlock(); - if (this.f == 0 && block instanceof BlockCrops && ((BlockCrops) block).A(iblockdata)) { + if (this.f == 0 && block instanceof BlockCrops && ((BlockCrops) block).z(iblockdata)) { - world.setAir(blockposition, true); + // CraftBukkit start + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.c, blockposition, Blocks.AIR, 0).isCancelled()) { diff --git a/nms-patches/PlayerConnection.patch b/nms-patches/PlayerConnection.patch index c31a92b5ed..e0d19a92f4 100644 --- a/nms-patches/PlayerConnection.patch +++ b/nms-patches/PlayerConnection.patch @@ -170,15 +170,6 @@ } public void a(PacketPlayInSteerVehicle packetplayinsteervehicle) { -@@ -158,7 +258,7 @@ - } - - private static boolean b(PacketPlayInFlying packetplayinflying) { -- return Doubles.isFinite(packetplayinflying.a(0.0D)) && Doubles.isFinite(packetplayinflying.b(0.0D)) && Doubles.isFinite(packetplayinflying.c(0.0D)) && Floats.isFinite(packetplayinflying.b(0.0F)) && Floats.isFinite(packetplayinflying.a(0.0F)) ? false : Math.abs(packetplayinflying.a(0.0D)) <= 3.0E7D && Math.abs(packetplayinflying.c(0.0D)) <= 3.0E7D; -+ return !Doubles.isFinite(packetplayinflying.a(0.0D)) || !Doubles.isFinite(packetplayinflying.b(0.0D)) || !Doubles.isFinite(packetplayinflying.c(0.0D)) || !Floats.isFinite(packetplayinflying.b(0.0F)) || !Floats.isFinite(packetplayinflying.a(0.0F)) || Math.abs(packetplayinflying.a(0.0D)) >= 3.0E7D || Math.abs(packetplayinflying.b(0.0D)) >= 3.0E7D || Math.abs(packetplayinflying.c(0.0D)) >= 3.0E7D; - } - - private static boolean b(PacketPlayInVehicleMove packetplayinvehiclemove) { @@ -188,7 +288,34 @@ double d9 = entity.motX * entity.motX + entity.motY * entity.motY + entity.motZ * entity.motZ; double d10 = d6 * d6 + d7 * d7 + d8 * d8; @@ -278,7 +269,7 @@ this.minecraftServer.getPlayerList().d(this.player); this.player.checkMovement(this.player.locX - d0, this.player.locY - d1, this.player.locZ - d2); this.D = d11 >= -0.03125D && !this.minecraftServer.getAllowFlight() && !worldserver.c(entity.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); -@@ -271,7 +454,7 @@ +@@ -284,7 +467,7 @@ } else { WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); @@ -287,7 +278,7 @@ if (this.e == 0) { this.syncPosition(); } -@@ -281,13 +464,21 @@ +@@ -294,13 +477,21 @@ this.A = this.e; this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); } @@ -310,7 +301,7 @@ double d0 = this.player.locX; double d1 = this.player.locY; double d2 = this.player.locZ; -@@ -312,15 +503,33 @@ +@@ -325,15 +516,33 @@ ++this.receivedMovePackets; int i = this.receivedMovePackets - this.processedMovePackets; @@ -346,7 +337,7 @@ PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName(), Double.valueOf(d7), Double.valueOf(d8), Double.valueOf(d9)); this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch); return; -@@ -366,6 +575,69 @@ +@@ -379,6 +588,69 @@ } } @@ -416,7 +407,7 @@ this.B = d12 >= -0.03125D; this.B &= !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly; this.B &= !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.cN() && !worldserver.c(this.player.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); -@@ -383,10 +655,76 @@ +@@ -396,10 +668,76 @@ } public void a(double d0, double d1, double d2, float f, float f1) { @@ -494,7 +485,7 @@ double d3 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.X) ? this.player.locX : 0.0D; double d4 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Y) ? this.player.locY : 0.0D; double d5 = set.contains(PacketPlayOutPosition.EnumPlayerTeleportFlags.Z) ? this.player.locZ : 0.0D; -@@ -403,6 +741,14 @@ +@@ -416,6 +754,14 @@ f3 = f1 + this.player.pitch; } @@ -509,7 +500,7 @@ if (++this.teleportAwait == Integer.MAX_VALUE) { this.teleportAwait = 0; } -@@ -414,6 +760,7 @@ +@@ -427,6 +773,7 @@ public void a(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.x()); @@ -517,7 +508,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinblockdig.a(); -@@ -423,7 +770,15 @@ +@@ -436,7 +783,15 @@ if (!this.player.isSpectator()) { ItemStack itemstack = this.player.b(EnumHand.OFF_HAND); @@ -534,7 +525,7 @@ this.player.a(EnumHand.MAIN_HAND, itemstack); } -@@ -431,6 +786,21 @@ +@@ -444,6 +799,21 @@ case DROP_ITEM: if (!this.player.isSpectator()) { @@ -556,7 +547,7 @@ this.player.a(false); } -@@ -464,7 +834,15 @@ +@@ -477,7 +847,15 @@ if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { this.player.playerInteractManager.a(blockposition, packetplayinblockdig.b()); } else { @@ -572,7 +563,7 @@ } } else { if (packetplayinblockdig.c() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) { -@@ -484,10 +862,12 @@ +@@ -497,10 +875,12 @@ default: throw new IllegalArgumentException("Invalid player action"); } @@ -585,7 +576,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); EnumHand enumhand = packetplayinuseitem.c(); ItemStack itemstack = this.player.b(enumhand); -@@ -501,6 +881,13 @@ +@@ -514,6 +894,13 @@ chatmessage.getChatModifier().setColor(EnumChatFormat.RED); this.player.playerConnection.sendPacket(new PacketPlayOutChat(chatmessage, ChatMessageType.GAME_INFO)); } else if (this.teleportPos == null && this.player.d((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)) { @@ -599,7 +590,7 @@ this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, blockposition, enumdirection, packetplayinuseitem.d(), packetplayinuseitem.e(), packetplayinuseitem.f()); } -@@ -510,13 +897,52 @@ +@@ -523,13 +910,52 @@ public void a(PacketPlayInBlockPlace packetplayinblockplace) { PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.x()); @@ -653,7 +644,7 @@ } } -@@ -527,8 +953,8 @@ +@@ -540,8 +966,8 @@ WorldServer[] aworldserver = this.minecraftServer.worldServer; int i = aworldserver.length; @@ -664,7 +655,7 @@ if (worldserver != null) { entity = packetplayinspectate.a(worldserver); -@@ -541,6 +967,8 @@ +@@ -554,6 +980,8 @@ if (entity != null) { this.player.setSpectatorTarget(this.player); this.player.stopRiding(); @@ -673,7 +664,7 @@ if (entity.world == this.player.world) { this.player.enderTeleportTo(entity.locX, entity.locY, entity.locZ); } else { -@@ -566,12 +994,20 @@ +@@ -579,12 +1007,20 @@ this.minecraftServer.getPlayerList().b(this.player, worldserver2); this.minecraftServer.getPlayerList().updateClient(this.player); } @@ -695,7 +686,7 @@ public void a(PacketPlayInBoatMove packetplayinboatmove) { PlayerConnectionUtils.ensureMainThread(packetplayinboatmove, this, this.player.x()); -@@ -584,14 +1020,29 @@ +@@ -597,14 +1033,29 @@ } public void a(IChatBaseComponent ichatbasecomponent) { @@ -727,7 +718,7 @@ if (this.minecraftServer.R() && this.player.getName().equals(this.minecraftServer.Q())) { PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out"); this.minecraftServer.safeShutdown(); -@@ -613,6 +1064,15 @@ +@@ -626,6 +1077,15 @@ } } @@ -743,7 +734,7 @@ try { this.networkManager.sendPacket(packet); } catch (Throwable throwable) { -@@ -634,17 +1094,32 @@ +@@ -647,17 +1107,32 @@ public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.x()); @@ -778,7 +769,7 @@ ChatMessage chatmessage = new ChatMessage("chat.cannotSend", new Object[0]); chatmessage.getChatModifier().setColor(EnumChatFormat.RED); -@@ -657,39 +1132,249 @@ +@@ -670,39 +1145,249 @@ for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { @@ -946,7 +937,7 @@ + // CraftBukkit end + private void handleCommand(String s) { -- this.minecraftServer.getCommandHandler().b(this.player, s); +- this.minecraftServer.getCommandHandler().a(this.player, s); + // CraftBukkit start - whole method + this.LOGGER.info(this.player.getName() + " issued server command: " + s); + @@ -968,7 +959,7 @@ + java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + return; + } -+ // this.minecraftServer.getCommandHandler().b(this.player, s); ++ // this.minecraftServer.getCommandHandler().a(this.player, s); + // CraftBukkit end } @@ -1035,7 +1026,7 @@ this.player.resetIdleTimer(); IJumpable ijumpable; -@@ -761,6 +1446,7 @@ +@@ -774,6 +1459,7 @@ public void a(PacketPlayInUseEntity packetplayinuseentity) { PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.x()); @@ -1043,7 +1034,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); -@@ -776,20 +1462,68 @@ +@@ -789,20 +1475,68 @@ if (this.player.h(entity) < d0) { EnumHand enumhand; @@ -1113,17 +1104,17 @@ } } } -@@ -805,7 +1539,8 @@ +@@ -818,7 +1552,8 @@ case PERFORM_RESPAWN: if (this.player.viewingCredits) { this.player.viewingCredits = false; - this.player = this.minecraftServer.getPlayerList().moveToWorld(this.player, 0, true); + // this.player = this.minecraftServer.getPlayerList().moveToWorld(this.player, 0, true); + this.minecraftServer.getPlayerList().changeDimension(this.player, 0, PlayerTeleportEvent.TeleportCause.END_PORTAL); // CraftBukkit - reroute logic through custom portal management + CriterionTriggers.u.a(this.player, DimensionManager.THE_END, DimensionManager.OVERWORLD); } else { if (this.player.getHealth() > 0.0F) { - return; -@@ -827,14 +1562,20 @@ +@@ -841,14 +1576,20 @@ public void a(PacketPlayInCloseWindow packetplayinclosewindow) { PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.x()); @@ -1146,7 +1137,7 @@ NonNullList nonnulllist = NonNullList.a(); for (int i = 0; i < this.player.activeContainer.c.size(); ++i) { -@@ -843,8 +1584,274 @@ +@@ -857,8 +1598,274 @@ this.player.a(this.player.activeContainer, nonnulllist); } else { @@ -1422,7 +1413,7 @@ if (ItemStack.matches(packetplayinwindowclick.e(), itemstack)) { this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.a(), packetplayinwindowclick.d(), true)); this.player.f = true; -@@ -946,6 +1953,7 @@ +@@ -960,6 +1967,7 @@ public void a(PacketPlayInEnchantItem packetplayinenchantitem) { PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.x()); @@ -1430,7 +1421,7 @@ this.player.resetIdleTimer(); if (this.player.activeContainer.windowId == packetplayinenchantitem.a() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { this.player.activeContainer.a(this.player, packetplayinenchantitem.b()); -@@ -979,7 +1987,46 @@ +@@ -993,7 +2001,46 @@ } boolean flag1 = packetplayinsetcreativeslot.a() >= 1 && packetplayinsetcreativeslot.a() <= 45; @@ -1478,7 +1469,7 @@ if (flag1 && flag2) { if (itemstack.isEmpty()) { -@@ -1003,6 +2050,7 @@ +@@ -1017,6 +2064,7 @@ public void a(PacketPlayInTransaction packetplayintransaction) { PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.x()); @@ -1486,7 +1477,7 @@ Short oshort = (Short) this.k.get(this.player.activeContainer.windowId); if (oshort != null && packetplayintransaction.b() == oshort.shortValue() && this.player.activeContainer.windowId == packetplayintransaction.a() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { -@@ -1013,6 +2061,7 @@ +@@ -1027,6 +2075,7 @@ public void a(PacketPlayInUpdateSign packetplayinupdatesign) { PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.x()); @@ -1494,7 +1485,7 @@ this.player.resetIdleTimer(); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinupdatesign.a(); -@@ -1029,14 +2078,30 @@ +@@ -1043,14 +2092,30 @@ if (!tileentitysign.a() || tileentitysign.e() != this.player) { this.minecraftServer.warning("Player " + this.player.getName() + " just tried to change non-editable sign"); @@ -1526,7 +1517,7 @@ tileentitysign.update(); worldserver.notify(blockposition, iblockdata, iblockdata, 3); -@@ -1059,11 +2124,27 @@ +@@ -1073,11 +2138,27 @@ public void a(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.x()); @@ -1555,7 +1546,7 @@ ArrayList arraylist = Lists.newArrayList(); Iterator iterator = this.minecraftServer.tabCompleteCommand(this.player, packetplayintabcomplete.a(), packetplayintabcomplete.b(), packetplayintabcomplete.c()).iterator(); -@@ -1089,6 +2170,13 @@ +@@ -1103,6 +2184,13 @@ ItemStack itemstack1; if ("MC|BEdit".equals(s)) { @@ -1569,7 +1560,7 @@ packetdataserializer = packetplayincustompayload.b(); try { -@@ -1107,15 +2195,25 @@ +@@ -1121,15 +2209,25 @@ } if (itemstack.getItem() == Items.WRITABLE_BOOK && itemstack.getItem() == itemstack1.getItem()) { @@ -1595,7 +1586,7 @@ packetdataserializer = packetplayincustompayload.b(); try { -@@ -1149,10 +2247,11 @@ +@@ -1163,10 +2261,11 @@ } itemstack2.a("pages", (NBTBase) nbttaglist); @@ -1608,7 +1599,7 @@ } } else if ("MC|TrSel".equals(s)) { try { -@@ -1164,6 +2263,7 @@ +@@ -1178,6 +2277,7 @@ } } catch (Exception exception2) { PlayerConnection.LOGGER.error("Couldn\'t select trade", exception2); @@ -1616,7 +1607,7 @@ } } else { TileEntity tileentity; -@@ -1213,6 +2313,7 @@ +@@ -1227,6 +2327,7 @@ } } catch (Exception exception3) { PlayerConnection.LOGGER.error("Couldn\'t set command block", exception3); @@ -1624,7 +1615,7 @@ } } else if ("MC|AutoCmd".equals(s)) { if (!this.minecraftServer.getEnableCommandBlock()) { -@@ -1280,6 +2381,7 @@ +@@ -1294,6 +2395,7 @@ } } catch (Exception exception4) { PlayerConnection.LOGGER.error("Couldn\'t set command block", exception4); @@ -1632,7 +1623,7 @@ } } else { int k; -@@ -1303,6 +2405,7 @@ +@@ -1317,6 +2419,7 @@ } } catch (Exception exception5) { PlayerConnection.LOGGER.error("Couldn\'t set beacon", exception5); @@ -1640,7 +1631,7 @@ } } } else if ("MC|ItemName".equals(s)) { -@@ -1389,6 +2492,7 @@ +@@ -1403,6 +2506,7 @@ } } catch (Exception exception6) { PlayerConnection.LOGGER.error("Couldn\'t set structure block", exception6); @@ -1648,7 +1639,7 @@ } } else if ("MC|PickItem".equals(s)) { packetdataserializer = packetplayincustompayload.b(); -@@ -1401,11 +2505,49 @@ +@@ -1415,11 +2519,49 @@ this.player.playerConnection.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex)); } catch (Exception exception7) { PlayerConnection.LOGGER.error("Couldn\'t pick item", exception7); diff --git a/nms-patches/PlayerInteractManager.patch b/nms-patches/PlayerInteractManager.patch index 126642b7ac..7362bf4ad3 100644 --- a/nms-patches/PlayerInteractManager.patch +++ b/nms-patches/PlayerInteractManager.patch @@ -32,7 +32,7 @@ float f; int i; -@@ -98,6 +106,19 @@ +@@ -96,6 +104,19 @@ } public void a(BlockPosition blockposition, EnumDirection enumdirection) { @@ -52,7 +52,7 @@ if (this.isCreative()) { if (!this.world.douseFire((EntityHuman) null, blockposition, enumdirection)) { this.breakBlock(blockposition); -@@ -125,14 +146,48 @@ +@@ -123,14 +144,48 @@ } } @@ -103,7 +103,7 @@ if (iblockdata.getMaterial() != Material.AIR && f >= 1.0F) { this.breakBlock(blockposition); -@@ -150,6 +205,7 @@ +@@ -148,6 +203,7 @@ public void a(BlockPosition blockposition) { if (blockposition.equals(this.f)) { @@ -111,7 +111,7 @@ int i = this.currentTick - this.lastDigTick; IBlockData iblockdata = this.world.getType(blockposition); -@@ -167,6 +223,10 @@ +@@ -165,6 +221,10 @@ this.j = this.lastDigTick; } } @@ -122,7 +122,7 @@ } } -@@ -190,13 +250,86 @@ +@@ -188,13 +248,86 @@ } public boolean breakBlock(BlockPosition blockposition) { @@ -210,7 +210,7 @@ if ((block instanceof BlockCommand || block instanceof BlockStructure) && !this.player.isCreativeAndOp()) { this.world.notify(blockposition, iblockdata, iblockdata, 3); return false; -@@ -238,6 +371,12 @@ +@@ -236,6 +369,12 @@ } } @@ -223,7 +223,7 @@ return flag; } } -@@ -280,63 +419,90 @@ +@@ -278,63 +417,90 @@ } } diff --git a/nms-patches/PlayerInventory.patch b/nms-patches/PlayerInventory.patch index 0510e6ead4..086019ab3e 100644 --- a/nms-patches/PlayerInventory.patch +++ b/nms-patches/PlayerInventory.patch @@ -16,9 +16,9 @@ public class PlayerInventory implements IInventory { public final NonNullList items; -@@ -16,11 +25,54 @@ +@@ -16,6 +25,49 @@ private ItemStack carried; - public boolean f; + private int h; + // CraftBukkit start - add fields and methods + public List transaction = new java.util.ArrayList(); @@ -26,7 +26,7 @@ + + public List getContents() { + List combined = new ArrayList(items.size() + armor.size() + extraSlots.size()); -+ for (List sub : this.g) { ++ for (List sub : this.f) { + combined.addAll(sub); + } + @@ -66,12 +66,6 @@ public PlayerInventory(EntityHuman entityhuman) { this.items = NonNullList.a(36, ItemStack.a); this.armor = NonNullList.a(4, ItemStack.a); - this.extraSlots = NonNullList.a(1, ItemStack.a); -- this.g = Arrays.asList(new NonNullList[] { this.items, this.armor, this.extraSlots}); -+ this.g = (List) Arrays.asList(new NonNullList[] { this.items, this.armor, this.extraSlots}); // CraftBukkit - decompile error - this.carried = ItemStack.a; - this.player = entityhuman; - } @@ -41,6 +93,23 @@ return itemstack.getItem() == itemstack1.getItem() && (!itemstack.usesData() || itemstack.getData() == itemstack1.getData()) && ItemStack.equals(itemstack, itemstack1); } diff --git a/nms-patches/PlayerList.patch b/nms-patches/PlayerList.patch index e78caad175..c54c64fa7a 100644 --- a/nms-patches/PlayerList.patch +++ b/nms-patches/PlayerList.patch @@ -840,7 +840,7 @@ @@ -775,16 +1226,21 @@ entityplayer.playerConnection.sendPacket(new PacketPlayOutSpawnPosition(blockposition)); - if (worldserver.Y()) { + if (worldserver.isRaining()) { - entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(1, 0.0F)); - entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(7, worldserver.j(1.0F))); - entityplayer.playerConnection.sendPacket(new PacketPlayOutGameStateChange(8, worldserver.h(1.0F))); diff --git a/nms-patches/RecipeRepair.patch b/nms-patches/RecipeRepair.patch index 4b01fe2a0f..843ea3b919 100644 --- a/nms-patches/RecipeRepair.patch +++ b/nms-patches/RecipeRepair.patch @@ -24,8 +24,8 @@ + // CraftBukkit start - Construct a dummy repair recipe + ItemStack result = new ItemStack(itemstack.getItem(), 1, i1); + NonNullList ingredients = NonNullList.a(); -+ ingredients.add(new RecipeItemStack(itemstack2.cloneItemStack())); -+ ingredients.add(new RecipeItemStack(itemstack.cloneItemStack())); ++ ingredients.add(RecipeItemStack.a(new ItemStack[]{itemstack2.cloneItemStack()})); ++ ingredients.add(RecipeItemStack.a(new ItemStack[]{itemstack.cloneItemStack()})); + ShapelessRecipes recipe = new ShapelessRecipes(this.a, result.cloneItemStack(), ingredients); + recipe.key = new MinecraftKey("repairitem"); + inventorycrafting.currentRecipe = recipe; diff --git a/nms-patches/ShapedRecipes.patch b/nms-patches/ShapedRecipes.patch index b86fd148bd..7ef8d040f2 100644 --- a/nms-patches/ShapedRecipes.patch +++ b/nms-patches/ShapedRecipes.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/ShapedRecipes.java +++ b/net/minecraft/server/ShapedRecipes.java -@@ -12,6 +12,10 @@ +@@ -14,6 +14,10 @@ import java.util.Map; import java.util.Map.Entry; import javax.annotation.Nullable; @@ -11,7 +11,7 @@ public class ShapedRecipes extends IRecipe { -@@ -28,6 +32,63 @@ +@@ -30,6 +34,63 @@ this.result = itemstack; } diff --git a/nms-patches/ShapelessRecipes.patch b/nms-patches/ShapelessRecipes.patch index cbe208aa84..914c0af93b 100644 --- a/nms-patches/ShapelessRecipes.patch +++ b/nms-patches/ShapelessRecipes.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/ShapelessRecipes.java +++ b/net/minecraft/server/ShapelessRecipes.java -@@ -5,6 +5,10 @@ - import com.google.gson.JsonObject; +@@ -6,6 +6,10 @@ + import com.google.gson.JsonParseException; import java.util.ArrayList; import java.util.Iterator; +// CraftBukkit start @@ -11,7 +11,7 @@ public class ShapelessRecipes extends IRecipe { -@@ -17,6 +21,21 @@ +@@ -18,6 +22,21 @@ this.ingredients = nonnulllist; } diff --git a/nms-patches/TileEntitySign.patch b/nms-patches/TileEntitySign.patch index 4e8f902fb0..88ab430616 100644 --- a/nms-patches/TileEntitySign.patch +++ b/nms-patches/TileEntitySign.patch @@ -56,9 +56,9 @@ ChatClickable chatclickable = chatmodifier.h(); if (chatclickable.a() == ChatClickable.EnumClickAction.RUN_COMMAND) { -- entityhuman.C_().getCommandHandler().b(icommandlistener, chatclickable.b()); +- entityhuman.C_().getCommandHandler().a(icommandlistener, chatclickable.b()); + // CraftBukkit start -+ // entityhuman.C_().getCommandHandler().b(icommandlistener, chatclickable.b()); ++ // entityhuman.C_().getCommandHandler().a(icommandlistener, chatclickable.b()); + CommandBlockListenerAbstract.executeSafely(icommandlistener, new org.bukkit.craftbukkit.command.ProxiedNativeCommandSender( + icommandlistener, + new org.bukkit.craftbukkit.command.CraftBlockCommandSender(icommandlistener), diff --git a/nms-patches/World.patch b/nms-patches/World.patch index 50b3b76578..4686f7772f 100644 --- a/nms-patches/World.patch +++ b/nms-patches/World.patch @@ -198,7 +198,7 @@ + + if (!this.isClientSide && (i & 1) != 0) { + this.update(blockposition, oldBlock.getBlock(), true); -+ if (newBlock.o()) { ++ if (newBlock.n()) { + this.updateAdjacentComparators(blockposition, newBlock.getBlock()); + } + } else if (!this.isClientSide && (i & 16) == 0) { @@ -448,27 +448,15 @@ } } } -@@ -1245,7 +1494,10 @@ - int j = MathHelper.floor(entity.locZ); - boolean flag1 = true; - -- if (!flag || this.isAreaLoaded(i - 32, 0, j - 32, i + 32, 0, j + 32, true)) { -+ // CraftBukkit start - Use neighbor cache instead of looking up -+ Chunk startingChunk = this.getChunkIfLoaded(i >> 4, j >> 4); -+ if (!flag || (startingChunk != null && startingChunk.areNeighborsLoaded(2)) /* this.isAreaLoaded(i - b0, 0, j - b0, i + b0, 0, j + b0) */) { -+ // CraftBukkit end - entity.M = entity.locX; - entity.N = entity.locY; - entity.O = entity.locZ; -@@ -1257,6 +1509,7 @@ - entity.leaveVehicle(); - } else { - entity.B_(); -+ entity.postTick(); // CraftBukkit - } +@@ -1252,6 +1501,7 @@ + entity.leaveVehicle(); + } else { + entity.B_(); ++ entity.postTick(); // CraftBukkit } + } -@@ -1549,11 +1802,18 @@ +@@ -1543,11 +1793,18 @@ } } @@ -487,7 +475,7 @@ TileEntity tileentity = null; if (this.O) { -@@ -1588,6 +1848,14 @@ +@@ -1582,6 +1839,14 @@ public void setTileEntity(BlockPosition blockposition, @Nullable TileEntity tileentity) { if (!this.E(blockposition)) { if (tileentity != null && !tileentity.y()) { @@ -502,7 +490,7 @@ if (this.O) { tileentity.setPosition(blockposition); Iterator iterator = this.b.iterator(); -@@ -1747,6 +2015,14 @@ +@@ -1741,6 +2006,14 @@ } this.o = MathHelper.a(this.o, 0.0F, 1.0F); @@ -517,7 +505,7 @@ } } } -@@ -1878,7 +2154,10 @@ +@@ -1878,7 +2151,10 @@ } public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) { @@ -529,7 +517,7 @@ return false; } else { int i = 0; -@@ -2045,7 +2324,7 @@ +@@ -2045,7 +2321,7 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -538,7 +526,7 @@ arraylist.add(entity); } } -@@ -2060,7 +2339,7 @@ +@@ -2060,7 +2336,7 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -547,7 +535,7 @@ arraylist.add(entity); } } -@@ -2109,7 +2388,7 @@ +@@ -2109,7 +2385,7 @@ } } @@ -556,7 +544,7 @@ } @Nullable -@@ -2130,8 +2409,17 @@ +@@ -2130,8 +2406,17 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -575,7 +563,7 @@ ++i; } } -@@ -2140,12 +2428,18 @@ +@@ -2140,12 +2425,18 @@ } public void a(Collection collection) { @@ -595,9 +583,9 @@ this.b(entity); } -@@ -2159,7 +2453,13 @@ +@@ -2159,7 +2450,13 @@ IBlockData iblockdata = this.getType(blockposition); - AxisAlignedBB axisalignedbb = flag ? null : block.getBlockData().c(this, blockposition); + AxisAlignedBB axisalignedbb = flag ? null : block.getBlockData().d(this, blockposition); - return axisalignedbb != Block.k && !this.a(axisalignedbb.a(blockposition), entity) ? false : (iblockdata.getMaterial() == Material.ORIENTABLE && block == Blocks.ANVIL ? true : iblockdata.getMaterial().isReplaceable() && block.canPlace(this, blockposition, enumdirection)); + // CraftBukkit start - store default return @@ -610,7 +598,7 @@ } public int getSeaLevel() { -@@ -2269,6 +2569,11 @@ +@@ -2269,6 +2566,11 @@ for (int i = 0; i < this.players.size(); ++i) { EntityHuman entityhuman1 = (EntityHuman) this.players.get(i); @@ -622,7 +610,7 @@ if (predicate.apply(entityhuman1)) { double d5 = entityhuman1.d(d0, d1, d2); -@@ -2437,6 +2742,16 @@ +@@ -2437,6 +2739,16 @@ public void everyoneSleeping() {} @@ -639,7 +627,7 @@ public float h(float f) { return (this.p + (this.q - this.p) * f) * this.j(f); } -@@ -2654,7 +2969,7 @@ +@@ -2654,7 +2966,7 @@ int l = j * 16 + 8 - blockposition.getZ(); boolean flag = true; diff --git a/nms-patches/WorldServer.patch b/nms-patches/WorldServer.patch index 35fe4e5035..0939b13952 100644 --- a/nms-patches/WorldServer.patch +++ b/nms-patches/WorldServer.patch @@ -591,12 +591,8 @@ } } -@@ -980,9 +1232,10 @@ - } - - protected void t() { -- boolean flag = this.Y(); -+ boolean flag = this.Y(); // PAIL: rename +@@ -983,6 +1235,7 @@ + boolean flag = this.isRaining(); super.t(); + /* CraftBukkit start @@ -608,7 +604,7 @@ this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.q)); } + // */ -+ if (flag != this.Y()) { ++ if (flag != this.isRaining()) { + // Only send weather packets to those affected + for (int i = 0; i < this.players.size(); ++i) { + if (((EntityPlayer) this.players.get(i)).world == this) { diff --git a/pom.xml b/pom.xml index 143c474dc8..c00f073878 100644 --- a/pom.xml +++ b/pom.xml @@ -4,14 +4,14 @@ org.bukkit craftbukkit jar - 1.12-pre2-SNAPSHOT + 1.12-pre5-SNAPSHOT CraftBukkit http://www.bukkit.org UTF-8 unknown - 1.12-pre2 + 1.12-pre5 1_12_R1 git-Bukkit- diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 5fbd124716..825ca93463 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -551,13 +551,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { @Override public void setAI(boolean ai) { if (this.getHandle() instanceof EntityInsentient) { - ((EntityInsentient) this.getHandle()).setAI(!ai); + ((EntityInsentient) this.getHandle()).setNoAI(!ai); } } @Override public boolean hasAI() { - return (this.getHandle() instanceof EntityInsentient) ? !((EntityInsentient) this.getHandle()).hasAI(): false; + return (this.getHandle() instanceof EntityInsentient) ? !((EntityInsentient) this.getHandle()).isNoAI(): false; } @Override diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java index 26e945586e..44df930192 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapedRecipe.java @@ -51,7 +51,7 @@ public class CraftShapedRecipe extends ShapedRecipe implements CraftRecipe { for (int i = 0; i < shape.length; i++) { String row = shape[i]; for (int j = 0; j < row.length(); j++) { - data.set(i * width + j, new RecipeItemStack(CraftItemStack.asNMSCopy(ingred.get(row.charAt(j))))); + data.set(i * width + j, RecipeItemStack.a(new net.minecraft.server.ItemStack[]{CraftItemStack.asNMSCopy(ingred.get(row.charAt(j)))})); } } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java index 7ba9502ad8..211898c514 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftShapelessRecipe.java @@ -40,7 +40,7 @@ public class CraftShapelessRecipe extends ShapelessRecipe implements CraftRecipe List ingred = this.getIngredientList(); NonNullList data = NonNullList.a(ingred.size(), RecipeItemStack.a); for (int i = 0; i < ingred.size(); i++) { - data.set(i, new RecipeItemStack(CraftItemStack.asNMSCopy(ingred.get(i)))); + data.set(i, RecipeItemStack.a(new net.minecraft.server.ItemStack[]{CraftItemStack.asNMSCopy(ingred.get(i))})); } CraftingManager.a(CraftNamespacedKey.toMinecraft(this.getKey()), new ShapelessRecipes("", CraftItemStack.asNMSCopy(this.getResult()), data));