From a4b8e8ce68facc5e30943e56f16a87013fecc78b Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sat, 20 Jul 2019 09:00:00 +1000 Subject: [PATCH] Update to Minecraft 1.14.4 By: md_5 --- .../nms-patches/AdvancementDataPlayer.patch | 2 +- paper-server/nms-patches/ArgumentBlock.patch | 2 +- paper-server/nms-patches/BehaviorFarm.patch | 8 +- .../nms-patches/BehaviorInteractDoor.patch | 33 +-- paper-server/nms-patches/BlockBamboo.patch | 4 +- paper-server/nms-patches/BlockCauldron.patch | 8 +- .../nms-patches/BlockDirtSnowSpreadable.patch | 2 +- paper-server/nms-patches/BlockFire.patch | 4 +- .../nms-patches/BlockMinecartDetector.patch | 9 +- .../BlockPressurePlateAbstract.patch | 4 +- paper-server/nms-patches/BlockTurtleEgg.patch | 4 +- paper-server/nms-patches/Chunk.patch | 12 +- .../nms-patches/ChunkMapDistance.patch | 80 +++--- .../nms-patches/ChunkProviderGenerate.patch | 2 +- .../nms-patches/ChunkProviderServer.patch | 29 +- .../CommandBlockListenerAbstract.patch | 2 +- paper-server/nms-patches/ContainerAnvil.patch | 20 +- .../nms-patches/ContainerMerchant.patch | 2 +- paper-server/nms-patches/CrashReport.patch | 2 +- .../nms-patches/DedicatedServer.patch | 8 +- .../DedicatedServerProperties.patch | 4 +- .../DispenseBehaviorProjectile.patch | 2 +- paper-server/nms-patches/EntityCreeper.patch | 2 +- paper-server/nms-patches/EntityEnderman.patch | 2 +- .../nms-patches/EntityFallingBlock.patch | 4 +- paper-server/nms-patches/EntityFox.patch | 2 +- .../nms-patches/EntityHorseAbstract.patch | 4 +- paper-server/nms-patches/EntityHuman.patch | 98 +++---- .../nms-patches/EntityLightning.patch | 6 +- paper-server/nms-patches/EntityLiving.patch | 4 +- paper-server/nms-patches/EntityPanda.patch | 2 +- .../nms-patches/EntityPigZombie.patch | 4 +- paper-server/nms-patches/EntityPlayer.patch | 2 +- paper-server/nms-patches/EntityRaider.patch | 6 +- .../nms-patches/EntitySilverfish.patch | 8 +- paper-server/nms-patches/EntityTurtle.patch | 2 +- paper-server/nms-patches/EntityTypes.patch | 14 +- paper-server/nms-patches/EntityVillager.patch | 18 +- paper-server/nms-patches/EntityWither.patch | 2 +- paper-server/nms-patches/EntityZombie.patch | 28 +- .../nms-patches/EntityZombieVillager.patch | 16 +- paper-server/nms-patches/FoodMetaData.patch | 2 +- paper-server/nms-patches/GameRules.patch | 12 +- .../nms-patches/IDispenseBehavior.patch | 16 +- paper-server/nms-patches/ItemArmorStand.patch | 2 +- paper-server/nms-patches/ItemBlock.patch | 4 +- paper-server/nms-patches/ItemBow.patch | 6 +- paper-server/nms-patches/ItemCrossbow.patch | 4 +- paper-server/nms-patches/ItemEnderPearl.patch | 6 +- paper-server/nms-patches/ItemFishingRod.patch | 8 +- .../nms-patches/ItemFlintAndSteel.patch | 2 +- paper-server/nms-patches/ItemSnowball.patch | 4 +- paper-server/nms-patches/ItemStack.patch | 2 +- paper-server/nms-patches/ItemTrident.patch | 4 +- paper-server/nms-patches/LoginListener.patch | 16 +- .../nms-patches/MinecraftServer.patch | 102 +++---- paper-server/nms-patches/NetworkManager.patch | 6 +- .../nms-patches/PacketStatusListener.patch | 2 +- paper-server/nms-patches/PlayerChunk.patch | 12 +- paper-server/nms-patches/PlayerChunkMap.patch | 60 +++-- .../nms-patches/PlayerConnection.patch | 106 +++----- .../nms-patches/PlayerConnectionUtils.patch | 8 +- .../nms-patches/PlayerInteractManager.patch | 249 +++++++++--------- paper-server/nms-patches/Raid.patch | 19 -- .../nms-patches/SpawnerCreature.patch | 34 +-- paper-server/nms-patches/TagRegistry.patch | 20 +- paper-server/nms-patches/TickListServer.patch | 2 +- paper-server/nms-patches/Ticket.patch | 20 -- paper-server/nms-patches/TicketType.patch | 20 -- .../nms-patches/TileEntityBeacon.patch | 6 +- .../nms-patches/TileEntityConduit.patch | 4 +- .../nms-patches/TileEntityLectern.patch | 2 +- paper-server/nms-patches/VillageSiege.patch | 8 +- paper-server/nms-patches/World.patch | 4 +- paper-server/nms-patches/WorldServer.patch | 66 ++--- paper-server/pom.xml | 6 +- .../org/bukkit/craftbukkit/CraftParticle.java | 2 +- .../org/bukkit/craftbukkit/CraftServer.java | 12 +- .../bukkit/craftbukkit/CraftStatistic.java | 4 +- .../org/bukkit/craftbukkit/CraftWorld.java | 22 +- .../java/org/bukkit/craftbukkit/Main.java | 2 +- .../attribute/CraftAttributeInstance.java | 10 +- .../bukkit/craftbukkit/block/CraftBanner.java | 2 +- .../block/data/CraftBlockData.java | 2 +- .../command/VanillaCommandWrapper.java | 2 +- .../enchantments/CraftEnchantment.java | 2 +- .../entity/CraftAreaEffectCloud.java | 2 +- .../bukkit/craftbukkit/entity/CraftArrow.java | 4 +- .../craftbukkit/entity/CraftHumanEntity.java | 2 +- .../craftbukkit/entity/CraftPlayer.java | 2 +- .../craftbukkit/entity/CraftTippedArrow.java | 2 +- .../craftbukkit/event/CraftEventFactory.java | 4 +- .../generator/CustomChunkGenerator.java | 3 + .../inventory/CraftInventoryAnvil.java | 4 +- .../inventory/CraftMerchantCustom.java | 4 +- .../craftbukkit/map/CraftMapRenderer.java | 2 +- .../CraftBlockProjectileSource.java | 2 +- .../craftbukkit/util/CraftChatMessage.java | 12 +- .../craftbukkit/util/CraftMagicNumbers.java | 2 +- .../craftbukkit/util/CraftNamespacedKey.java | 2 +- .../util/DummyGeneratorAccess.java | 3 +- .../bukkit/StatisticsAndAchievementsTest.java | 8 +- 102 files changed, 678 insertions(+), 751 deletions(-) delete mode 100644 paper-server/nms-patches/Raid.patch delete mode 100644 paper-server/nms-patches/Ticket.patch diff --git a/paper-server/nms-patches/AdvancementDataPlayer.patch b/paper-server/nms-patches/AdvancementDataPlayer.patch index 30065645ee..6a9f24a173 100644 --- a/paper-server/nms-patches/AdvancementDataPlayer.patch +++ b/paper-server/nms-patches/AdvancementDataPlayer.patch @@ -6,7 +6,7 @@ if (advancement == null) { - AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.e); + // CraftBukkit start -+ if (entry.getKey().b().equals("minecraft")) { ++ if (entry.getKey().getNamespace().equals("minecraft")) { + AdvancementDataPlayer.LOGGER.warn("Ignored advancement '{}' in progress file {} - it doesn't exist anymore?", entry.getKey(), this.e); + } + // CraftBukkit end diff --git a/paper-server/nms-patches/ArgumentBlock.patch b/paper-server/nms-patches/ArgumentBlock.patch index 18c4e7144f..959f0de427 100644 --- a/paper-server/nms-patches/ArgumentBlock.patch +++ b/paper-server/nms-patches/ArgumentBlock.patch @@ -10,7 +10,7 @@ private MinecraftKey m = new MinecraftKey(""); private BlockStateList n; @@ -217,7 +217,7 @@ - Iterator iterator = iblockstate.d().iterator(); + Iterator iterator = iblockstate.getValues().iterator(); while (iterator.hasNext()) { - T t0 = (Comparable) iterator.next(); diff --git a/paper-server/nms-patches/BehaviorFarm.patch b/paper-server/nms-patches/BehaviorFarm.patch index 1993a5a349..d91bdb5023 100644 --- a/paper-server/nms-patches/BehaviorFarm.patch +++ b/paper-server/nms-patches/BehaviorFarm.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/BehaviorFarm.java +++ b/net/minecraft/server/BehaviorFarm.java -@@ -72,8 +72,8 @@ +@@ -79,8 +79,8 @@ protected void a(WorldServer worldserver, EntityVillager entityvillager, long i) { if (i > this.d && this.a != null) { @@ -11,7 +11,7 @@ } } -@@ -92,7 +92,11 @@ +@@ -99,7 +99,11 @@ Block block1 = worldserver.getType(this.a.down()).getBlock(); if (block instanceof BlockCrops && ((BlockCrops) block).isRipe(iblockdata) && this.c) { @@ -24,7 +24,7 @@ } if (iblockdata.isAir() && block1 instanceof BlockSoil && this.b) { -@@ -103,19 +107,28 @@ +@@ -110,19 +114,28 @@ boolean flag = false; if (!itemstack.isEmpty()) { @@ -57,7 +57,7 @@ } if (flag) { -@@ -134,8 +147,8 @@ +@@ -141,8 +154,8 @@ this.a = this.a(worldserver); if (this.a != null) { this.d = i + 20L; diff --git a/paper-server/nms-patches/BehaviorInteractDoor.patch b/paper-server/nms-patches/BehaviorInteractDoor.patch index 797190c7bd..1c2f409b17 100644 --- a/paper-server/nms-patches/BehaviorInteractDoor.patch +++ b/paper-server/nms-patches/BehaviorInteractDoor.patch @@ -1,26 +1,9 @@ --- a/net/minecraft/server/BehaviorInteractDoor.java +++ b/net/minecraft/server/BehaviorInteractDoor.java -@@ -23,7 +23,7 @@ - Set set = this.a(worldserver, list, list1); - int j = pathentity.f() - 1; - -- this.a(worldserver, list1, set, j); -+ this.a(worldserver, list1, set, j, entityliving); // CraftBukkit - add entity - } - - private Set a(WorldServer worldserver, List list, List list1) { -@@ -35,13 +35,20 @@ - return (Set) stream.filter(list1::contains).collect(Collectors.toSet()); - } - -- private void a(WorldServer worldserver, List list, Set set, int i) { -+ private void a(WorldServer worldserver, List list, Set set, int i, EntityLiving entityliving) { // CraftBukkit - add entity - set.forEach((blockposition) -> { - int j = list.indexOf(blockposition); - IBlockData iblockdata = worldserver.getType(blockposition); - Block block = iblockdata.getBlock(); - +@@ -46,11 +46,18 @@ if (TagsBlock.WOODEN_DOORS.isTagged(block) && block instanceof BlockDoor) { + boolean flag = j >= i; + + // CraftBukkit start - entities opening doors + org.bukkit.event.entity.EntityInteractEvent event = new org.bukkit.event.entity.EntityInteractEvent(entityliving.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(entityliving.world, blockposition)); + entityliving.world.getServer().getPluginManager().callEvent(event); @@ -28,6 +11,12 @@ + return; + } + // CaftBukkit end - ((BlockDoor) block).setDoor(worldserver, blockposition, j >= i); - } + ((BlockDoor) block).setDoor(worldserver, blockposition, flag); + GlobalPos globalpos = GlobalPos.create(worldserver.getWorldProvider().getDimensionManager(), blockposition); + if (!behaviorcontroller.getMemory(MemoryModuleType.OPENED_DOORS).isPresent() && flag) { +- behaviorcontroller.setMemory(MemoryModuleType.OPENED_DOORS, (Object) Sets.newHashSet(new GlobalPos[]{globalpos})); ++ behaviorcontroller.setMemory(MemoryModuleType.OPENED_DOORS, Sets.newHashSet(new GlobalPos[]{globalpos})); // CraftBukkit - decompile error + } else { + behaviorcontroller.getMemory(MemoryModuleType.OPENED_DOORS).ifPresent((set1) -> { + if (flag) { diff --git a/paper-server/nms-patches/BlockBamboo.patch b/paper-server/nms-patches/BlockBamboo.patch index 4b8fd8d01f..1fbeea621f 100644 --- a/paper-server/nms-patches/BlockBamboo.patch +++ b/paper-server/nms-patches/BlockBamboo.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/BlockBamboo.java +++ b/net/minecraft/server/BlockBamboo.java -@@ -159,14 +159,18 @@ +@@ -164,14 +164,18 @@ BlockPosition blockposition1 = blockposition.down(2); IBlockData iblockdata2 = world.getType(blockposition1); BlockPropertyBambooSize blockpropertybamboosize = BlockPropertyBambooSize.NONE; @@ -21,7 +21,7 @@ } } } else { -@@ -177,7 +181,14 @@ +@@ -182,7 +186,14 @@ int j = (Integer) iblockdata.get(BlockBamboo.d) != 1 && iblockdata2.getBlock() != Blocks.BAMBOO ? 0 : 1; int k = (i < 11 || random.nextFloat() >= 0.25F) && i != 15 ? 0 : 1; diff --git a/paper-server/nms-patches/BlockCauldron.patch b/paper-server/nms-patches/BlockCauldron.patch index d0edc6343e..37f214cd08 100644 --- a/paper-server/nms-patches/BlockCauldron.patch +++ b/paper-server/nms-patches/BlockCauldron.patch @@ -39,7 +39,7 @@ - this.a(world, blockposition, iblockdata, 3); + // this.a(world, blockposition, iblockdata, 3); + // CraftBukkit end - world.a((EntityHuman) null, blockposition, SoundEffects.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BUCKET_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); } return true; @@ -59,7 +59,7 @@ - this.a(world, blockposition, iblockdata, 0); + // this.a(world, blockposition, iblockdata, 0); + // CraftBukkit end - world.a((EntityHuman) null, blockposition, SoundEffects.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BUCKET_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); } @@ -82,6 +99,10 @@ @@ -76,7 +76,7 @@ @@ -96,12 +117,17 @@ } - world.a((EntityHuman) null, blockposition, SoundEffects.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BOTTLE_FILL, SoundCategory.BLOCKS, 1.0F, 1.0F); - this.a(world, blockposition, iblockdata, i - 1); + // this.a(world, blockposition, iblockdata, i - 1); + // CraftBukkit end @@ -95,7 +95,7 @@ @@ -112,7 +138,8 @@ } - world.a((EntityHuman) null, blockposition, SoundEffects.ITEM_BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound((EntityHuman) null, blockposition, SoundEffects.ITEM_BOTTLE_EMPTY, SoundCategory.BLOCKS, 1.0F, 1.0F); - this.a(world, blockposition, iblockdata, i + 1); + // this.a(world, blockposition, iblockdata, i + 1); + // CraftBukkit end diff --git a/paper-server/nms-patches/BlockDirtSnowSpreadable.patch b/paper-server/nms-patches/BlockDirtSnowSpreadable.patch index 8fc77afd0d..4bff6aefe5 100644 --- a/paper-server/nms-patches/BlockDirtSnowSpreadable.patch +++ b/paper-server/nms-patches/BlockDirtSnowSpreadable.patch @@ -10,7 +10,7 @@ + } + // CraftBukkit end world.setTypeUpdate(blockposition, Blocks.DIRT.getBlockData()); - } else if (world.getLightLevel(blockposition.up()) >= 4) { + } else { if (world.getLightLevel(blockposition.up()) >= 9) { @@ -40,7 +45,7 @@ BlockPosition blockposition1 = blockposition.b(random.nextInt(3) - 1, random.nextInt(5) - 3, random.nextInt(3) - 1); diff --git a/paper-server/nms-patches/BlockFire.patch b/paper-server/nms-patches/BlockFire.patch index 422c6faa9d..7b092eb3d2 100644 --- a/paper-server/nms-patches/BlockFire.patch +++ b/paper-server/nms-patches/BlockFire.patch @@ -59,7 +59,7 @@ @@ -105,14 +127,14 @@ BlockPosition blockposition1 = blockposition.down(); - if (!Block.d(world.getType(blockposition1), world, blockposition1, EnumDirection.UP) || i > 3) { + if (!world.getType(blockposition1).d(world, blockposition1, EnumDirection.UP) || i > 3) { - world.a(blockposition, false); + fireExtinguished(world, blockposition); // CraftBukkit } @@ -74,7 +74,7 @@ } } @@ -120,12 +142,14 @@ - boolean flag1 = world.t(blockposition); + boolean flag1 = world.s(blockposition); int k = flag1 ? -50 : 0; - this.a(world, blockposition.east(), 300 + k, random, i); diff --git a/paper-server/nms-patches/BlockMinecartDetector.patch b/paper-server/nms-patches/BlockMinecartDetector.patch index ff1bbc5916..d75c736253 100644 --- a/paper-server/nms-patches/BlockMinecartDetector.patch +++ b/paper-server/nms-patches/BlockMinecartDetector.patch @@ -9,10 +9,10 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract { public static final BlockStateEnum SHAPE = BlockProperties.X; -@@ -61,6 +63,17 @@ - flag1 = true; +@@ -62,6 +64,16 @@ } + IBlockData iblockdata1; + // CraftBukkit start + if (flag != flag1) { + org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); @@ -23,7 +23,6 @@ + flag1 = eventRedstone.getNewCurrent() > 0; + } + // CraftBukkit end -+ + if (flag1 && !flag) { - world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockMinecartDetector.POWERED, true), 3); - this.b(world, blockposition, iblockdata, true); + iblockdata1 = (IBlockData) iblockdata.set(BlockMinecartDetector.POWERED, true); diff --git a/paper-server/nms-patches/BlockPressurePlateAbstract.patch b/paper-server/nms-patches/BlockPressurePlateAbstract.patch index 50850c9b45..35ce273d11 100644 --- a/paper-server/nms-patches/BlockPressurePlateAbstract.patch +++ b/paper-server/nms-patches/BlockPressurePlateAbstract.patch @@ -27,5 +27,5 @@ + // CraftBukkit end + if (i != j) { - iblockdata = this.a(iblockdata, j); - world.setTypeAndData(blockposition, iblockdata, 2); + IBlockData iblockdata1 = this.a(iblockdata, j); + diff --git a/paper-server/nms-patches/BlockTurtleEgg.patch b/paper-server/nms-patches/BlockTurtleEgg.patch index c66ad9b63d..724d4bce27 100644 --- a/paper-server/nms-patches/BlockTurtleEgg.patch +++ b/paper-server/nms-patches/BlockTurtleEgg.patch @@ -42,7 +42,7 @@ + return; + } + // CraftBukkit end - world.a((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_CRACK, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); + world.playSound((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_CRACK, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); - world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockTurtleEgg.a, i + 1), 2); + // world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockTurtleEgg.a, i + 1), 2); // CraftBukkit - handled above } else { @@ -51,7 +51,7 @@ + return; + } + // CraftBukkit end - world.a((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_HATCH, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); + world.playSound((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_EGG_HATCH, SoundCategory.BLOCKS, 0.7F, 0.9F + random.nextFloat() * 0.2F); world.a(blockposition, false); if (!world.isClientSide) { @@ -73,7 +102,7 @@ diff --git a/paper-server/nms-patches/Chunk.patch b/paper-server/nms-patches/Chunk.patch index 0658ec8a6f..7e52717390 100644 --- a/paper-server/nms-patches/Chunk.patch +++ b/paper-server/nms-patches/Chunk.patch @@ -160,7 +160,7 @@ + ((ProtoChunkTickList) this.o).a(this.world.getBlockTickList(), (blockposition) -> { // CraftBukkit - decompile error return this.getType(blockposition).getBlock(); }); - this.o = TickListEmpty.a(); + this.o = TickListEmpty.b(); @@ -777,7 +853,7 @@ } @@ -169,19 +169,19 @@ + ((ProtoChunkTickList) this.p).a(this.world.getFluidTickList(), (blockposition) -> { // CraftBukkit - decompile error return this.getFluid(blockposition).getType(); }); - this.p = TickListEmpty.a(); + this.p = TickListEmpty.b(); @@ -789,12 +865,12 @@ } public void a(WorldServer worldserver) { -- if (this.o == TickListEmpty.a()) { -+ if (this.o == TickListEmpty.a()) { // CraftBukkit - decompile error +- if (this.o == TickListEmpty.b()) { ++ if (this.o == TickListEmpty.b()) { // CraftBukkit - decompile error this.o = new TickListChunk<>(IRegistry.BLOCK::getKey, worldserver.getBlockTickList().a(this.loc, true, false)); this.setNeedsSaving(true); } -- if (this.p == TickListEmpty.a()) { -+ if (this.p == TickListEmpty.a()) { // CraftBukkit - decompile error +- if (this.p == TickListEmpty.b()) { ++ if (this.p == TickListEmpty.b()) { // CraftBukkit - decompile error this.p = new TickListChunk<>(IRegistry.FLUID::getKey, worldserver.getFluidTickList().a(this.loc, true, false)); this.setNeedsSaving(true); } diff --git a/paper-server/nms-patches/ChunkMapDistance.patch b/paper-server/nms-patches/ChunkMapDistance.patch index 4d3f204f63..622c9958f6 100644 --- a/paper-server/nms-patches/ChunkMapDistance.patch +++ b/paper-server/nms-patches/ChunkMapDistance.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/ChunkMapDistance.java +++ b/net/minecraft/server/ChunkMapDistance.java -@@ -32,11 +32,11 @@ +@@ -32,7 +32,7 @@ private static final Logger LOGGER = LogManager.getLogger(); private static final int b = 33 + ChunkStatus.a(ChunkStatus.FULL) - 2; private final Long2ObjectMap> c = new Long2ObjectOpenHashMap(); @@ -9,12 +9,7 @@ private final ChunkMapDistance.a e = new ChunkMapDistance.a(); private final ChunkMapDistance.b f = new ChunkMapDistance.b(8); private final ChunkMapDistance.c g = new ChunkMapDistance.c(33); -- private final Set h = Sets.newHashSet(); -+ private final Set h = Sets.newHashSet(); // PAIL pendingChunkUpdates - private final PlayerChunk.c i; - private final Mailbox> j; - private final Mailbox k; -@@ -61,7 +61,7 @@ +@@ -62,7 +62,7 @@ while (objectiterator.hasNext()) { Entry>> entry = (Entry) objectiterator.next(); @@ -23,15 +18,15 @@ return ticket.a(this.currentTick); })) { this.e.b(entry.getLongKey(), this.a((ObjectSortedSet) entry.getValue()), false); -@@ -99,10 +99,25 @@ +@@ -100,10 +100,25 @@ } - if (!this.h.isEmpty()) { -- this.h.forEach((playerchunk) -> { + if (!this.pendingChunkUpdates.isEmpty()) { +- this.pendingChunkUpdates.forEach((playerchunk) -> { + // CraftBukkit start + // Iterate pending chunk updates with protection against concurrent modification exceptions -+ java.util.Iterator iter = this.h.iterator(); -+ int expectedSize = this.h.size(); ++ java.util.Iterator iter = this.pendingChunkUpdates.iterator(); ++ int expectedSize = this.pendingChunkUpdates.size(); + do { + PlayerChunk playerchunk = iter.next(); + iter.remove(); @@ -39,12 +34,12 @@ + playerchunk.a(playerchunkmap); - }); -- this.h.clear(); +- this.pendingChunkUpdates.clear(); + + // Reset iterator if set was modified using add() -+ if (this.h.size() != expectedSize) { -+ expectedSize = this.h.size(); -+ iter = this.h.iterator(); ++ if (this.pendingChunkUpdates.size() != expectedSize) { ++ expectedSize = this.pendingChunkUpdates.size(); ++ iter = this.pendingChunkUpdates.iterator(); + } + } while (iter.hasNext()); + // CraftBukkit end @@ -52,7 +47,7 @@ return true; } else { if (!this.l.isEmpty()) { -@@ -124,7 +139,7 @@ +@@ -125,7 +140,7 @@ completablefuture.thenAccept((either) -> { this.m.execute(() -> { @@ -61,16 +56,16 @@ }, j, false)); }); }); -@@ -138,7 +153,7 @@ +@@ -139,7 +154,7 @@ } } -- private void a(long i, Ticket ticket) { -+ private boolean a(long i, Ticket ticket) { // CraftBukkit - void -> boolean // PAIL addTicket +- private void addTicket(long i, Ticket ticket) { ++ private boolean addTicket(long i, Ticket ticket) { // CraftBukkit - void -> boolean ObjectSortedSet> objectsortedset = this.e(i); ObjectBidirectionalIterator> objectbidirectionaliterator = objectsortedset.iterator(); int j; -@@ -149,21 +164,24 @@ +@@ -150,21 +165,24 @@ j = PlayerChunkMap.GOLDEN_TICKET + 1; } @@ -87,8 +82,8 @@ + return ret; // CraftBukkit } -- private void b(long i, Ticket ticket) { -+ private boolean b(long i, Ticket ticket) { // CraftBukkit - void -> boolean // PAIL removeTicket +- private void removeTicket(long i, Ticket ticket) { ++ private boolean removeTicket(long i, Ticket ticket) { // CraftBukkit - void -> boolean ObjectSortedSet> objectsortedset = this.e(i); + boolean removed = false; // CraftBukkit @@ -98,7 +93,7 @@ } if (objectsortedset.isEmpty()) { -@@ -171,16 +189,27 @@ +@@ -172,16 +190,29 @@ } this.e.b(i, this.a(objectsortedset), false); @@ -106,12 +101,13 @@ } public void a(TicketType tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) { -- this.a(chunkcoordintpair.pair(), new Ticket<>(tickettype, i, t0, this.currentTick)); +- this.addTicket(chunkcoordintpair.pair(), new Ticket<>(tickettype, i, t0, this.currentTick)); + // CraftBukkit start + this.addTicketAtLevel(tickettype, chunkcoordintpair, i, t0); + } -+ public boolean addTicketAtLevel(TicketType ticketType, ChunkCoordIntPair chunkPos, int level, T identifier) { -+ return this.a(chunkPos.pair(), new Ticket<>(ticketType, level, identifier, this.currentTick)); ++ ++ public boolean addTicketAtLevel(TicketType ticketType, ChunkCoordIntPair chunkcoordintpair, int level, T identifier) { ++ return this.addTicket(chunkcoordintpair.pair(), new Ticket<>(ticketType, level, identifier, this.currentTick)); + // CraftBukkit end } @@ -120,17 +116,18 @@ + // CraftBukkit start + this.removeTicketAtLevel(tickettype, chunkcoordintpair, i, t0); + } -+ public boolean removeTicketAtLevel(TicketType ticketType, ChunkCoordIntPair chunkPos, int level, T identifier) { -+ Ticket ticket = new Ticket<>(ticketType, level, identifier, this.currentTick); -- this.b(chunkcoordintpair.pair(), ticket); -+ return this.b(chunkPos.pair(), ticket); +- this.removeTicket(chunkcoordintpair.pair(), ticket); ++ public boolean removeTicketAtLevel(TicketType ticketType, ChunkCoordIntPair chunkcoordintpair, int level, T identifier) { ++ Ticket ticket = new Ticket<>(ticketType, level, identifier, this.currentTick); ++ ++ return this.removeTicket(chunkcoordintpair.pair(), ticket); + // CraftBukkit end } public void addTicket(TicketType tickettype, ChunkCoordIntPair chunkcoordintpair, int i, T t0) { -@@ -247,6 +276,21 @@ - return this.f.a.containsKey(i); +@@ -265,6 +296,21 @@ + return this.i.a(); } + // CraftBukkit start @@ -151,21 +148,28 @@ class a extends ChunkMap { public a() { -@@ -333,7 +377,7 @@ +@@ -351,13 +397,13 @@ Ticket ticket = new Ticket<>(TicketType.PLAYER, ChunkMapDistance.b, new ChunkCoordIntPair(i), ChunkMapDistance.this.currentTick); if (flag1) { - ChunkMapDistance.this.j.a((Object) ChunkTaskQueueSorter.a(() -> { + ChunkMapDistance.this.j.a(ChunkTaskQueueSorter.a(() -> { // Craftbukkit - decompile error ChunkMapDistance.this.m.execute(() -> { - ChunkMapDistance.this.a(i, ticket); - ChunkMapDistance.this.l.add(i); -@@ -342,7 +386,7 @@ + if (this.c(this.c(i))) { + ChunkMapDistance.this.addTicket(i, ticket); + ChunkMapDistance.this.l.add(i); + } else { +- ChunkMapDistance.this.k.a((Object) ChunkTaskQueueSorter.a(() -> { ++ ChunkMapDistance.this.k.a(ChunkTaskQueueSorter.a(() -> { // Craftbukkit - decompile error + }, i, false)); + } + +@@ -366,7 +412,7 @@ return j; })); } else { - ChunkMapDistance.this.k.a((Object) ChunkTaskQueueSorter.a(() -> { + ChunkMapDistance.this.k.a(ChunkTaskQueueSorter.a(() -> { // Craftbukkit - decompile error ChunkMapDistance.this.m.execute(() -> { - ChunkMapDistance.this.b(i, ticket); + ChunkMapDistance.this.removeTicket(i, ticket); }); diff --git a/paper-server/nms-patches/ChunkProviderGenerate.patch b/paper-server/nms-patches/ChunkProviderGenerate.patch index b9cb61bc5b..8b8d076d90 100644 --- a/paper-server/nms-patches/ChunkProviderGenerate.patch +++ b/paper-server/nms-patches/ChunkProviderGenerate.patch @@ -9,7 +9,7 @@ for (int i = -2; i <= 2; ++i) { for (int j = -2; j <= 2; ++j) { float f = 10.0F / MathHelper.c((float) (i * i + j * j) + 0.2F); -@@ -81,6 +81,11 @@ +@@ -82,6 +82,11 @@ f4 = 1.0F + f4 * 2.0F; f5 = 1.0F + f5 * 4.0F; } diff --git a/paper-server/nms-patches/ChunkProviderServer.patch b/paper-server/nms-patches/ChunkProviderServer.patch index f3f094d1d5..994eeabf74 100644 --- a/paper-server/nms-patches/ChunkProviderServer.patch +++ b/paper-server/nms-patches/ChunkProviderServer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/ChunkProviderServer.java +++ b/net/minecraft/server/ChunkProviderServer.java -@@ -79,7 +79,7 @@ +@@ -92,7 +92,7 @@ for (int l = 0; l < 4; ++l) { if (k == this.cachePos[l] && chunkstatus == this.cacheStatus[l]) { ichunkaccess = this.cacheChunk[l]; @@ -9,7 +9,22 @@ return ichunkaccess; } } -@@ -123,7 +123,15 @@ +@@ -136,12 +136,12 @@ + if (playerchunk == null) { + return null; + } else { +- Either either = (Either) playerchunk.b(ChunkStatus.FULL).getNow((Object) null); ++ Either either = (Either) playerchunk.b(ChunkStatus.FULL).getNow(null); // Craftbukkit - decompile error + + if (either == null) { + return null; + } else { +- IChunkAccess ichunkaccess1 = (IChunkAccess) either.left().orElse((Object) null); ++ IChunkAccess ichunkaccess1 = (IChunkAccess) either.left().orElse(null); // Craftbukkit - decompile error + + if (ichunkaccess1 != null) { + this.a(k, ichunkaccess1, ChunkStatus.FULL); +@@ -168,7 +168,15 @@ int l = 33 + ChunkStatus.a(chunkstatus); PlayerChunk playerchunk = this.getChunk(k); @@ -26,7 +41,7 @@ this.chunkMapDistance.a(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair); if (this.a(playerchunk, l)) { GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler(); -@@ -142,7 +150,7 @@ +@@ -187,7 +195,7 @@ } private boolean a(@Nullable PlayerChunk playerchunk, int i) { @@ -35,7 +50,7 @@ } public boolean isLoaded(int i, int j) { -@@ -249,6 +257,18 @@ +@@ -294,6 +302,18 @@ this.playerChunkMap.close(); } @@ -54,7 +69,7 @@ public void tick(BooleanSupplier booleansupplier) { this.world.getMethodProfiler().enter("purge"); this.chunkMapDistance.purgeTickets(); -@@ -268,13 +288,13 @@ +@@ -313,13 +333,13 @@ this.lastTickTime = i; WorldData worlddata = this.world.getWorldData(); boolean flag = worlddata.getType() == WorldType.DEBUG_ALL_BLOCK_STATES; @@ -70,7 +85,7 @@ this.world.getMethodProfiler().enter("naturalSpawnCount"); int l = this.chunkMapDistance.b(); -@@ -303,8 +323,30 @@ +@@ -348,8 +368,30 @@ for (int j1 = 0; j1 < i1; ++j1) { EnumCreatureType enumcreaturetype = aenumcreaturetype1[j1]; @@ -102,7 +117,7 @@ if (object2intmap.getInt(enumcreaturetype) <= k1) { SpawnerCreature.a(enumcreaturetype, (World) this.world, chunk, blockposition); -@@ -447,12 +489,18 @@ +@@ -497,12 +539,18 @@ @Override protected boolean executeNext() { diff --git a/paper-server/nms-patches/CommandBlockListenerAbstract.patch b/paper-server/nms-patches/CommandBlockListenerAbstract.patch index 42b2f97820..5200399ed1 100644 --- a/paper-server/nms-patches/CommandBlockListenerAbstract.patch +++ b/paper-server/nms-patches/CommandBlockListenerAbstract.patch @@ -20,7 +20,7 @@ public CommandBlockListenerAbstract() {} @@ -102,14 +107,7 @@ - if (minecraftserver != null && minecraftserver.E() && minecraftserver.getEnableCommandBlock() && !UtilColor.b(this.command)) { + if (minecraftserver != null && minecraftserver.F() && minecraftserver.getEnableCommandBlock() && !UtilColor.b(this.command)) { try { this.lastOutput = null; - CommandListenerWrapper commandlistenerwrapper = this.getWrapper().a((commandcontext, flag, i) -> { diff --git a/paper-server/nms-patches/ContainerAnvil.patch b/paper-server/nms-patches/ContainerAnvil.patch index 50df646671..5f9776b6d4 100644 --- a/paper-server/nms-patches/ContainerAnvil.patch +++ b/paper-server/nms-patches/ContainerAnvil.patch @@ -38,7 +38,7 @@ if (itemstack.isEmpty()) { - this.resultInventory.setItem(0, ItemStack.a); + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.a); // CraftBukkit - this.levelCost.a(0); + this.levelCost.set(0); } else { ItemStack itemstack1 = itemstack.cloneItemStack(); @@ -141,7 +152,7 @@ @@ -47,7 +47,7 @@ if (k <= 0) { - this.resultInventory.setItem(0, ItemStack.a); + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.a); // CraftBukkit - this.levelCost.a(0); + this.levelCost.set(0); return; } @@ -156,7 +167,7 @@ @@ -56,7 +56,7 @@ if (!flag && (itemstack1.getItem() != itemstack2.getItem() || !itemstack1.e())) { - this.resultInventory.setItem(0, ItemStack.a); + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.a); // CraftBukkit - this.levelCost.a(0); + this.levelCost.set(0); return; } @@ -246,7 +257,7 @@ @@ -65,21 +65,21 @@ if (flag2 && !flag1) { - this.resultInventory.setItem(0, ItemStack.a); + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareAnvilEvent(getBukkitView(), ItemStack.a); // CraftBukkit - this.levelCost.a(0); + this.levelCost.set(0); return; } @@ -270,11 +281,11 @@ itemstack1 = ItemStack.a; } -- if (b1 == i && b1 > 0 && this.levelCost.b() >= 40) { -- this.levelCost.a(39); -+ if (b1 == i && b1 > 0 && this.levelCost.b() >= maximumRepairCost) { // CraftBukkit -+ this.levelCost.a(maximumRepairCost - 1); // CraftBukkit +- if (b1 == i && b1 > 0 && this.levelCost.get() >= 40) { +- this.levelCost.set(39); ++ if (b1 == i && b1 > 0 && this.levelCost.get() >= maximumRepairCost) { // CraftBukkit ++ this.levelCost.set(maximumRepairCost - 1); // CraftBukkit } -- if (this.levelCost.b() >= 40 && !this.player.abilities.canInstantlyBuild) { -+ if (this.levelCost.b() >= maximumRepairCost && !this.player.abilities.canInstantlyBuild) { // CraftBukkit +- if (this.levelCost.get() >= 40 && !this.player.abilities.canInstantlyBuild) { ++ if (this.levelCost.get() >= maximumRepairCost && !this.player.abilities.canInstantlyBuild) { // CraftBukkit itemstack1 = ItemStack.a; } diff --git a/paper-server/nms-patches/ContainerMerchant.patch b/paper-server/nms-patches/ContainerMerchant.patch index b0c96b1580..2b7bb57dee 100644 --- a/paper-server/nms-patches/ContainerMerchant.patch +++ b/paper-server/nms-patches/ContainerMerchant.patch @@ -42,4 +42,4 @@ + if (!this.merchant.getWorld().isClientSide && this.merchant instanceof Entity) { // CraftBukkit - SPIGOT-5035 Entity entity = (Entity) this.merchant; - this.merchant.getWorld().a(entity.locX, entity.locY, entity.locZ, this.merchant.ec(), SoundCategory.NEUTRAL, 1.0F, 1.0F, false); + this.merchant.getWorld().a(entity.locX, entity.locY, entity.locZ, this.merchant.eb(), SoundCategory.NEUTRAL, 1.0F, 1.0F, false); diff --git a/paper-server/nms-patches/CrashReport.patch b/paper-server/nms-patches/CrashReport.patch index c6274c49e0..8ec21a5f98 100644 --- a/paper-server/nms-patches/CrashReport.patch +++ b/paper-server/nms-patches/CrashReport.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/CrashReport.java +++ b/net/minecraft/server/CrashReport.java -@@ -64,6 +64,7 @@ +@@ -68,6 +68,7 @@ return String.format("%d total; %s", list.size(), list.stream().collect(Collectors.joining(" "))); }); diff --git a/paper-server/nms-patches/DedicatedServer.patch b/paper-server/nms-patches/DedicatedServer.patch index 7850865099..2e9da4469c 100644 --- a/paper-server/nms-patches/DedicatedServer.patch +++ b/paper-server/nms-patches/DedicatedServer.patch @@ -160,7 +160,7 @@ } } -@@ -529,14 +599,45 @@ +@@ -534,14 +604,45 @@ @Override public String getPlugins() { @@ -195,20 +195,20 @@ public String executeRemoteCommand(String s) { this.remoteControlCommandListener.clearMessages(); this.executeSync(() -> { -- this.getCommandDispatcher().a(this.remoteControlCommandListener.f(), s); +- this.getCommandDispatcher().a(this.remoteControlCommandListener.getWrapper(), s); + // CraftBukkit start - fire RemoteServerCommandEvent + RemoteServerCommandEvent event = new RemoteServerCommandEvent(remoteConsole, s); + server.getPluginManager().callEvent(event); + if (event.isCancelled()) { + return; + } -+ ServerCommand serverCommand = new ServerCommand(event.getCommand(), remoteControlCommandListener.f()); ++ ServerCommand serverCommand = new ServerCommand(event.getCommand(), remoteControlCommandListener.getWrapper()); + server.dispatchServerCommand(remoteConsole, serverCommand); + // CraftBukkit end }); return this.remoteControlCommandListener.getMessages(); } -@@ -557,4 +658,16 @@ +@@ -562,4 +663,16 @@ public boolean b(GameProfile gameprofile) { return false; } diff --git a/paper-server/nms-patches/DedicatedServerProperties.patch b/paper-server/nms-patches/DedicatedServerProperties.patch index f86b0fdfe3..70de039a76 100644 --- a/paper-server/nms-patches/DedicatedServerProperties.patch +++ b/paper-server/nms-patches/DedicatedServerProperties.patch @@ -12,7 +12,7 @@ public final boolean onlineMode = this.getBoolean("online-mode", true); public final boolean preventProxyConnections = this.getBoolean("prevent-proxy-connections", false); public final String serverIp = this.getString("server-ip", ""); -@@ -51,8 +53,10 @@ +@@ -52,8 +54,10 @@ public final PropertyManager.EditableProperty playerIdleTimeout; public final PropertyManager.EditableProperty whiteList; @@ -25,7 +25,7 @@ this.difficulty = (EnumDifficulty) this.a("difficulty", a(EnumDifficulty::getById, EnumDifficulty::a), EnumDifficulty::c, EnumDifficulty.EASY); this.gamemode = (EnumGamemode) this.a("gamemode", a(EnumGamemode::getById, EnumGamemode::a), EnumGamemode::b, EnumGamemode.SURVIVAL); this.levelName = this.getString("level-name", "world"); -@@ -96,12 +100,14 @@ +@@ -98,12 +102,14 @@ this.whiteList = this.b("white-list", false); } diff --git a/paper-server/nms-patches/DispenseBehaviorProjectile.patch b/paper-server/nms-patches/DispenseBehaviorProjectile.patch index fb73cdec30..d8b541210c 100644 --- a/paper-server/nms-patches/DispenseBehaviorProjectile.patch +++ b/paper-server/nms-patches/DispenseBehaviorProjectile.patch @@ -12,7 +12,7 @@ public DispenseBehaviorProjectile() {} @@ -11,9 +16,38 @@ - EnumDirection enumdirection = (EnumDirection) isourceblock.e().get(BlockDispenser.FACING); + EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING); IProjectile iprojectile = this.a(world, iposition, itemstack); - iprojectile.shoot((double) enumdirection.getAdjacentX(), (double) ((float) enumdirection.getAdjacentY() + 0.1F), (double) enumdirection.getAdjacentZ(), this.getPower(), this.a()); diff --git a/paper-server/nms-patches/EntityCreeper.patch b/paper-server/nms-patches/EntityCreeper.patch index 75bd57ef46..43dcff6ed9 100644 --- a/paper-server/nms-patches/EntityCreeper.patch +++ b/paper-server/nms-patches/EntityCreeper.patch @@ -65,7 +65,7 @@ entityareaeffectcloud.setRadiusOnUse(-0.5F); entityareaeffectcloud.setWaitTime(10); @@ -219,7 +243,7 @@ - entityareaeffectcloud.a(new MobEffect(mobeffect)); + entityareaeffectcloud.addEffect(new MobEffect(mobeffect)); } - this.world.addEntity(entityareaeffectcloud); diff --git a/paper-server/nms-patches/EntityEnderman.patch b/paper-server/nms-patches/EntityEnderman.patch index c4c0854f75..e56ac07615 100644 --- a/paper-server/nms-patches/EntityEnderman.patch +++ b/paper-server/nms-patches/EntityEnderman.patch @@ -20,7 +20,7 @@ if (entityliving == null) { @@ -65,6 +75,7 @@ - attributeinstance.b(EntityEnderman.c); + attributeinstance.addModifier(EntityEnderman.c); } } + return true; diff --git a/paper-server/nms-patches/EntityFallingBlock.patch b/paper-server/nms-patches/EntityFallingBlock.patch index 3df1448cfa..70cf28b0e2 100644 --- a/paper-server/nms-patches/EntityFallingBlock.patch +++ b/paper-server/nms-patches/EntityFallingBlock.patch @@ -18,7 +18,7 @@ this.world.a(blockposition, false); } else if (!this.world.isClientSide) { this.die(); -@@ -125,6 +127,11 @@ +@@ -124,6 +126,11 @@ this.block = (IBlockData) this.block.set(BlockProperties.C, true); } @@ -30,7 +30,7 @@ if (this.world.setTypeAndData(blockposition, this.block, 3)) { if (block instanceof BlockFalling) { ((BlockFalling) block).a(this.world, blockposition, this.block, iblockdata); -@@ -179,7 +186,9 @@ +@@ -180,7 +187,9 @@ while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); diff --git a/paper-server/nms-patches/EntityFox.patch b/paper-server/nms-patches/EntityFox.patch index 2ee7208504..34ed37a107 100644 --- a/paper-server/nms-patches/EntityFox.patch +++ b/paper-server/nms-patches/EntityFox.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/EntityFox.java +++ b/net/minecraft/server/EntityFox.java @@ -267,8 +267,8 @@ - private List el() { + private List ek() { List list = Lists.newArrayList(); - list.add(((Optional) this.datawatcher.get(EntityFox.bB)).orElse((Object) null)); diff --git a/paper-server/nms-patches/EntityHorseAbstract.patch b/paper-server/nms-patches/EntityHorseAbstract.patch index 7f24105d6b..38170a0ead 100644 --- a/paper-server/nms-patches/EntityHorseAbstract.patch +++ b/paper-server/nms-patches/EntityHorseAbstract.patch @@ -51,7 +51,7 @@ + this.heal(1.0F, RegainReason.REGEN); // CraftBukkit } - if (this.eu()) { + if (this.et()) { @@ -716,6 +718,7 @@ if (this.getOwnerUUID() != null) { nbttagcompound.setString("OwnerUUID", this.getOwnerUUID().toString()); @@ -89,5 +89,5 @@ + } + // CraftBukkit end this.canSlide = true; - this.eC(); + this.eB(); } diff --git a/paper-server/nms-patches/EntityHuman.patch b/paper-server/nms-patches/EntityHuman.patch index 78a1d4ffed..1a592e3526 100644 --- a/paper-server/nms-patches/EntityHuman.patch +++ b/paper-server/nms-patches/EntityHuman.patch @@ -26,9 +26,9 @@ private static final DataWatcherObject c = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.c); private static final DataWatcherObject d = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.b); protected static final DataWatcherObject bt = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); -@@ -26,10 +40,10 @@ - protected static final DataWatcherObject bv = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); +@@ -27,10 +41,10 @@ protected static final DataWatcherObject bw = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); + private long e; public final PlayerInventory inventory = new PlayerInventory(this); - protected InventoryEnderChest enderChest = new InventoryEnderChest(); + protected InventoryEnderChest enderChest = new InventoryEnderChest(this); // CraftBukkit - add "this" to constructor @@ -39,7 +39,7 @@ protected int bC; public float bD; public float bE; -@@ -57,6 +71,17 @@ +@@ -58,6 +72,17 @@ @Nullable public EntityFishingHook hookedFish; @@ -56,8 +56,8 @@ + public EntityHuman(World world, GameProfile gameprofile) { super(EntityTypes.PLAYER, world); - this.bX = ItemStack.a; -@@ -179,7 +204,7 @@ + this.bY = ItemStack.a; +@@ -194,7 +219,7 @@ ItemStack itemstack = this.getEquipment(EnumItemSlot.HEAD); if (itemstack.getItem() == Items.TURTLE_HELMET && !this.a(TagsFluid.WATER)) { @@ -66,7 +66,7 @@ } } -@@ -352,7 +377,8 @@ +@@ -367,7 +392,8 @@ if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL && this.world.getGameRules().getBoolean(GameRules.NATURAL_REGENERATION)) { if (this.getHealth() < this.getMaxHealth() && this.ticksLived % 20 == 0) { @@ -76,7 +76,7 @@ } if (this.foodData.c() && this.ticksLived % 10 == 0) { -@@ -497,6 +523,7 @@ +@@ -512,6 +538,7 @@ @Nullable public EntityItem n(boolean flag) { @@ -84,7 +84,7 @@ return this.a(this.inventory.splitStack(this.inventory.itemInHandIndex, flag && !this.inventory.getItemInHand().isEmpty() ? this.inventory.getItemInHand().getCount() : 1), false, true); } -@@ -537,6 +564,30 @@ +@@ -552,6 +579,30 @@ entityitem.setMot((double) (-f3 * f2 * 0.3F) + Math.cos((double) f5) * (double) f6, (double) (-f1 * 0.3F + 0.1F + (this.random.nextFloat() - this.random.nextFloat()) * 0.1F), (double) (f4 * f2 * 0.3F) + Math.sin((double) f5) * (double) f6); } @@ -115,7 +115,7 @@ return entityitem; } } -@@ -611,6 +662,14 @@ +@@ -626,6 +677,14 @@ } this.setScore(nbttagcompound.getInt("Score")); @@ -128,9 +128,9 @@ + // CraftBukkit end + if (nbttagcompound.hasKeyOfType("SpawnX", 99) && nbttagcompound.hasKeyOfType("SpawnY", 99) && nbttagcompound.hasKeyOfType("SpawnZ", 99)) { - this.f = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ")); - this.g = nbttagcompound.getBoolean("SpawnForced"); -@@ -661,6 +720,7 @@ + this.g = new BlockPosition(nbttagcompound.getInt("SpawnX"), nbttagcompound.getInt("SpawnY"), nbttagcompound.getInt("SpawnZ")); + this.bU = nbttagcompound.getBoolean("SpawnForced"); +@@ -676,6 +735,7 @@ if (!this.getShoulderEntityRight().isEmpty()) { nbttagcompound.set("ShoulderEntityRight", this.getShoulderEntityRight()); } @@ -138,7 +138,7 @@ } -@@ -675,10 +735,10 @@ +@@ -690,10 +750,10 @@ if (this.getHealth() <= 0.0F) { return false; } else { @@ -151,7 +151,7 @@ } if (this.world.getDifficulty() == EnumDifficulty.EASY) { -@@ -690,7 +750,13 @@ +@@ -705,7 +765,13 @@ } } @@ -166,7 +166,7 @@ } } } -@@ -705,10 +771,29 @@ +@@ -720,10 +786,29 @@ } public boolean a(EntityHuman entityhuman) { @@ -199,7 +199,7 @@ } @Override -@@ -739,8 +824,13 @@ +@@ -754,8 +839,13 @@ } @@ -214,7 +214,7 @@ if (!this.isInvulnerable(damagesource)) { f = this.applyArmorModifier(damagesource, f); f = this.applyMagicModifier(damagesource, f); -@@ -766,6 +856,7 @@ +@@ -781,6 +871,7 @@ } } @@ -222,7 +222,7 @@ } public void openSign(TileEntitySign tileentitysign) {} -@@ -896,8 +987,15 @@ +@@ -911,8 +1002,15 @@ if (entity instanceof EntityLiving) { f3 = ((EntityLiving) entity).getHealth(); if (j > 0 && !entity.isBurning()) { @@ -240,7 +240,7 @@ } } -@@ -925,8 +1023,11 @@ +@@ -940,8 +1038,11 @@ EntityLiving entityliving = (EntityLiving) iterator.next(); if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h((Entity) entityliving) < 9.0D) { @@ -253,7 +253,7 @@ } } -@@ -935,9 +1036,26 @@ +@@ -950,9 +1051,26 @@ } if (entity instanceof EntityPlayer && entity.velocityChanged) { @@ -280,7 +280,7 @@ } if (flag2) { -@@ -982,7 +1100,14 @@ +@@ -997,7 +1115,14 @@ this.a(StatisticList.DAMAGE_DEALT, Math.round(f5 * 10.0F)); if (j > 0) { @@ -296,7 +296,7 @@ } if (this.world instanceof WorldServer && f5 > 2.0F) { -@@ -998,6 +1123,11 @@ +@@ -1013,6 +1138,11 @@ if (flag4) { entity.extinguish(); } @@ -308,8 +308,8 @@ } } -@@ -1057,15 +1187,15 @@ - return this.bV; +@@ -1072,15 +1202,15 @@ + return this.bW; } - public Either sleep(BlockPosition blockposition) { @@ -328,7 +328,7 @@ return Either.left(EntityHuman.EnumBedResult.NOT_POSSIBLE_HERE); } -@@ -1093,6 +1223,34 @@ +@@ -1108,6 +1238,34 @@ } } } @@ -363,7 +363,7 @@ this.e(blockposition); this.sleepTicks = 0; -@@ -1134,6 +1292,24 @@ +@@ -1148,6 +1306,24 @@ ((WorldServer) this.world).everyoneSleeping(); } @@ -388,19 +388,19 @@ this.sleepTicks = flag ? 0 : 100; if (flag2) { optional.ifPresent((blockposition) -> { -@@ -1187,9 +1363,11 @@ +@@ -1201,9 +1377,11 @@ if (blockposition != null) { - this.f = blockposition; - this.g = flag; + this.g = blockposition; + this.bU = flag; + this.spawnWorld = this.world.worldData.getName(); // CraftBukkit } else { - this.f = null; - this.g = false; + this.g = null; + this.bU = false; + this.spawnWorld = ""; // CraftBukkit } } -@@ -1261,7 +1439,11 @@ +@@ -1275,7 +1453,11 @@ this.setMot(vec3d2.x, d3 * 0.6D, vec3d2.z); this.aO = f; this.fallDistance = 0.0F; @@ -413,26 +413,28 @@ } else { super.e(vec3d); } -@@ -1580,24 +1762,29 @@ - } +@@ -1597,26 +1779,31 @@ protected void releaseShoulderEntities() { -- this.spawnEntityFromShoulder(this.getShoulderEntityLeft()); -- this.setShoulderEntityLeft(new NBTTagCompound()); -- this.spawnEntityFromShoulder(this.getShoulderEntityRight()); -- this.setShoulderEntityRight(new NBTTagCompound()); -+ // CraftBukkit start -+ if (this.spawnEntityFromShoulder(this.getShoulderEntityLeft())) { -+ this.setShoulderEntityLeft(new NBTTagCompound()); -+ } -+ if (this.spawnEntityFromShoulder(this.getShoulderEntityRight())) { -+ this.setShoulderEntityRight(new NBTTagCompound()); -+ } -+ // CraftBukkit end + if (this.e + 20L < this.world.getTime()) { +- this.spawnEntityFromShoulder(this.getShoulderEntityLeft()); +- this.setShoulderEntityLeft(new NBTTagCompound()); +- this.spawnEntityFromShoulder(this.getShoulderEntityRight()); +- this.setShoulderEntityRight(new NBTTagCompound()); ++ // CraftBukkit start ++ if (this.spawnEntityFromShoulder(this.getShoulderEntityLeft())) { ++ this.setShoulderEntityLeft(new NBTTagCompound()); ++ } ++ if (this.spawnEntityFromShoulder(this.getShoulderEntityRight())) { ++ this.setShoulderEntityRight(new NBTTagCompound()); ++ } ++ // CraftBukkit end + } + } -- private void spawnEntityFromShoulder(@Nullable NBTTagCompound nbttagcompound) { -+ private boolean spawnEntityFromShoulder(@Nullable NBTTagCompound nbttagcompound) { // CraftBukkit void->boolean +- private void spawnEntityFromShoulder(NBTTagCompound nbttagcompound) { ++ private boolean spawnEntityFromShoulder(NBTTagCompound nbttagcompound) { // CraftBukkit void->boolean if (!this.world.isClientSide && !nbttagcompound.isEmpty()) { - EntityTypes.a(nbttagcompound, this.world).ifPresent((entity) -> { + return EntityTypes.a(nbttagcompound, this.world).map((entity) -> { // CraftBukkit diff --git a/paper-server/nms-patches/EntityLightning.patch b/paper-server/nms-patches/EntityLightning.patch index 042c0c2a3d..bf0b31c97d 100644 --- a/paper-server/nms-patches/EntityLightning.patch +++ b/paper-server/nms-patches/EntityLightning.patch @@ -25,9 +25,9 @@ public void tick() { super.tick(); if (this.lifeTicks == 2) { -- this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); +- this.world.playSound((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); + // CraftBukkit start - Use relative location for far away sounds -+ // this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); ++ // this.world.playSound((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, 10000.0F, 0.8F + this.random.nextFloat() * 0.2F); + float pitch = 0.8F + this.random.nextFloat() * 0.2F; + int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; + for (EntityPlayer player : (List) (List) this.world.getPlayers()) { @@ -44,7 +44,7 @@ + } + } + // CraftBukkit end - this.world.a((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); + this.world.playSound((EntityHuman) null, this.locX, this.locY, this.locZ, SoundEffects.ENTITY_LIGHTNING_BOLT_IMPACT, SoundCategory.WEATHER, 2.0F, 0.5F + this.random.nextFloat() * 0.2F); } @@ -59,7 +80,7 @@ diff --git a/paper-server/nms-patches/EntityLiving.patch b/paper-server/nms-patches/EntityLiving.patch index 782b48545b..a926a1b884 100644 --- a/paper-server/nms-patches/EntityLiving.patch +++ b/paper-server/nms-patches/EntityLiving.patch @@ -797,7 +797,7 @@ + + this.a(this.getRaisedHand(), itemstack); + // CraftBukkit end - this.dq(); + this.dp(); } @@ -2495,10 +2908,18 @@ @@ -825,7 +825,7 @@ @@ -2585,7 +3006,7 @@ } - public void dz() { + public void dy() { - Optional optional = this.getBedPosition(); + Optional optional = this.getBedPosition(); // CraftBukkit - decompile error World world = this.world; diff --git a/paper-server/nms-patches/EntityPanda.patch b/paper-server/nms-patches/EntityPanda.patch index e649b0d612..4d78363cf0 100644 --- a/paper-server/nms-patches/EntityPanda.patch +++ b/paper-server/nms-patches/EntityPanda.patch @@ -21,7 +21,7 @@ @@ -673,7 +675,7 @@ @Override protected void a(EntityInsentient entityinsentient, EntityLiving entityliving) { - if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).dS()) { + if (entityinsentient instanceof EntityPanda && ((EntityPanda) entityinsentient).dR()) { - entityinsentient.setGoalTarget(entityliving); + entityinsentient.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY, true); // CraftBukkit } diff --git a/paper-server/nms-patches/EntityPigZombie.patch b/paper-server/nms-patches/EntityPigZombie.patch index a76033f4f7..aa73f3a5d5 100644 --- a/paper-server/nms-patches/EntityPigZombie.patch +++ b/paper-server/nms-patches/EntityPigZombie.patch @@ -19,9 +19,9 @@ } private boolean a(Entity entity) { -- this.angerLevel = this.ef(); +- this.angerLevel = this.ee(); + // CraftBukkit start -+ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), this.ef()); ++ org.bukkit.event.entity.PigZombieAngerEvent event = new org.bukkit.event.entity.PigZombieAngerEvent((org.bukkit.entity.PigZombie) this.getBukkitEntity(), (entity == null) ? null : entity.getBukkitEntity(), this.ee()); + this.world.getServer().getPluginManager().callEvent(event); + if (event.isCancelled()) { + return false; diff --git a/paper-server/nms-patches/EntityPlayer.patch b/paper-server/nms-patches/EntityPlayer.patch index 2de75bfa5b..d9f88c08e6 100644 --- a/paper-server/nms-patches/EntityPlayer.patch +++ b/paper-server/nms-patches/EntityPlayer.patch @@ -112,7 +112,7 @@ + this.getBukkitEntity().readExtraData(nbttagcompound); // CraftBukkit if (this.isSleeping()) { - this.dz(); + this.dy(); @@ -157,7 +235,20 @@ Entity entity = this.getRootVehicle(); Entity entity1 = this.getVehicle(); diff --git a/paper-server/nms-patches/EntityRaider.patch b/paper-server/nms-patches/EntityRaider.patch index 2d89fc266b..4b97647e37 100644 --- a/paper-server/nms-patches/EntityRaider.patch +++ b/paper-server/nms-patches/EntityRaider.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityRaider.java +++ b/net/minecraft/server/EntityRaider.java -@@ -397,7 +397,7 @@ +@@ -399,7 +399,7 @@ while (iterator.hasNext()) { EntityRaider entityraider = (EntityRaider) iterator.next(); @@ -9,7 +9,7 @@ } } -@@ -414,7 +414,7 @@ +@@ -416,7 +416,7 @@ while (iterator.hasNext()) { EntityRaider entityraider = (EntityRaider) iterator.next(); @@ -18,7 +18,7 @@ entityraider.q(true); } -@@ -488,7 +488,7 @@ +@@ -490,7 +490,7 @@ private final T b; diff --git a/paper-server/nms-patches/EntitySilverfish.patch b/paper-server/nms-patches/EntitySilverfish.patch index 04df3289aa..96cd5ac67d 100644 --- a/paper-server/nms-patches/EntitySilverfish.patch +++ b/paper-server/nms-patches/EntitySilverfish.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/EntitySilverfish.java +++ b/net/minecraft/server/EntitySilverfish.java -@@ -19,7 +19,7 @@ - this.goalSelector.a(3, this.c); +@@ -18,7 +18,7 @@ + this.goalSelector.a(3, this.b); this.goalSelector.a(4, new PathfinderGoalMeleeAttack(this, 1.0D, false)); this.goalSelector.a(5, new EntitySilverfish.PathfinderGoalSilverfishHideInBlock(this)); - this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[0])).a()); @@ -9,7 +9,7 @@ this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)); } -@@ -161,6 +161,11 @@ +@@ -160,6 +160,11 @@ IBlockData iblockdata = world.getType(blockposition); if (BlockMonsterEggs.j(iblockdata)) { @@ -21,7 +21,7 @@ world.setTypeAndData(blockposition, BlockMonsterEggs.e(iblockdata.getBlock()), 3); this.a.doSpawnEffect(); this.a.die(); -@@ -207,6 +212,11 @@ +@@ -206,6 +211,11 @@ Block block = iblockdata.getBlock(); if (block instanceof BlockMonsterEggs) { diff --git a/paper-server/nms-patches/EntityTurtle.patch b/paper-server/nms-patches/EntityTurtle.patch index ad8160f277..9c60bce5db 100644 --- a/paper-server/nms-patches/EntityTurtle.patch +++ b/paper-server/nms-patches/EntityTurtle.patch @@ -26,7 +26,7 @@ + // CraftBukkit start + if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.g, this.e.up(), (IBlockData) Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, this.g.random.nextInt(4) + 1)).isCancelled()) { - world.a((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_LAY_EGG, SoundCategory.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F); + world.playSound((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_LAY_EGG, SoundCategory.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F); world.setTypeAndData(this.e.up(), (IBlockData) Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, this.g.random.nextInt(4) + 1), 3); + } + // CraftBukkit end diff --git a/paper-server/nms-patches/EntityTypes.patch b/paper-server/nms-patches/EntityTypes.patch index f1e63be46b..46072e822b 100644 --- a/paper-server/nms-patches/EntityTypes.patch +++ b/paper-server/nms-patches/EntityTypes.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/EntityTypes.java +++ b/net/minecraft/server/EntityTypes.java -@@ -131,7 +131,7 @@ - private final Type bh; +@@ -129,7 +129,7 @@ + private MinecraftKey bh; private final EntitySize bi; - private static EntityTypes a(String s, EntityTypes.a entitytypes_a) { @@ -9,7 +9,7 @@ return (EntityTypes) IRegistry.a((IRegistry) IRegistry.ENTITY_TYPE, s, (Object) entitytypes_a.a(s)); } -@@ -160,10 +160,16 @@ +@@ -158,10 +158,16 @@ @Nullable public T spawnCreature(World world, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1) { @@ -28,7 +28,7 @@ } @Nullable -@@ -325,7 +331,7 @@ +@@ -327,7 +333,7 @@ } return entity; @@ -37,7 +37,7 @@ } private static Optional b(NBTTagCompound nbttagcompound, World world) { -@@ -342,7 +348,8 @@ +@@ -344,7 +350,8 @@ } public int getUpdateInterval() { @@ -47,8 +47,8 @@ } public boolean isDeltaTracking() { -@@ -372,7 +379,7 @@ - this.b = enumcreaturetype; +@@ -376,7 +383,7 @@ + this.f = enumcreaturetype == EnumCreatureType.CREATURE || enumcreaturetype == EnumCreatureType.MISC; } - public static EntityTypes.a a(EntityTypes.b entitytypes_b, EnumCreatureType enumcreaturetype) { diff --git a/paper-server/nms-patches/EntityVillager.patch b/paper-server/nms-patches/EntityVillager.patch index 5c82eabcf3..b38cc5c1ae 100644 --- a/paper-server/nms-patches/EntityVillager.patch +++ b/paper-server/nms-patches/EntityVillager.patch @@ -17,7 +17,7 @@ public class EntityVillager extends EntityVillagerAbstract implements ReputationHandler, VillagerDataHolder { -@@ -58,7 +68,7 @@ +@@ -60,7 +70,7 @@ @Override public BehaviorController getBehaviorController() { @@ -26,16 +26,16 @@ } @Override -@@ -122,7 +132,7 @@ +@@ -124,7 +134,7 @@ @Override protected void mobTick() { this.world.getMethodProfiler().enter("brain"); - this.getBehaviorController().a((WorldServer) this.world, (EntityLiving) this); + this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error this.world.getMethodProfiler().exit(); - if (!this.dZ() && this.bE > 0) { + if (!this.dY() && this.bE > 0) { --this.bE; -@@ -132,7 +142,7 @@ +@@ -134,7 +144,7 @@ this.bF = false; } @@ -44,7 +44,7 @@ } } -@@ -278,7 +288,14 @@ +@@ -351,7 +361,14 @@ while (iterator.hasNext()) { MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next(); @@ -60,7 +60,7 @@ } } -@@ -598,7 +615,12 @@ +@@ -673,7 +690,12 @@ entitywitch.setCustomNameVisible(this.getCustomNameVisible()); } @@ -74,7 +74,7 @@ this.die(); } -@@ -730,7 +752,7 @@ +@@ -823,7 +845,7 @@ } private void b(long i) { @@ -83,7 +83,7 @@ } private boolean c(long i) { -@@ -779,7 +801,7 @@ +@@ -872,7 +894,7 @@ if (entityirongolem != null) { if (entityirongolem.a((GeneratorAccess) this.world, EnumMobSpawn.MOB_SUMMONED) && entityirongolem.a((IWorldReader) this.world)) { @@ -92,7 +92,7 @@ return entityirongolem; } -@@ -830,7 +852,7 @@ +@@ -933,7 +955,7 @@ @Override public void e(BlockPosition blockposition) { super.e(blockposition); diff --git a/paper-server/nms-patches/EntityWither.patch b/paper-server/nms-patches/EntityWither.patch index b8ceee7a48..4b8e0af43a 100644 --- a/paper-server/nms-patches/EntityWither.patch +++ b/paper-server/nms-patches/EntityWither.patch @@ -15,7 +15,7 @@ private static final DataWatcherObject b = DataWatcher.a(EntityWither.class, DataWatcherRegistry.b); @@ -188,14 +195,38 @@ - i = this.dW() - 1; + i = this.dV() - 1; if (i <= 0) { Explosion.Effect explosion_effect = this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING) ? Explosion.Effect.DESTROY : Explosion.Effect.NONE; + // CraftBukkit start diff --git a/paper-server/nms-patches/EntityZombie.patch b/paper-server/nms-patches/EntityZombie.patch index d48d588f84..9f206c4125 100644 --- a/paper-server/nms-patches/EntityZombie.patch +++ b/paper-server/nms-patches/EntityZombie.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/EntityZombie.java +++ b/net/minecraft/server/EntityZombie.java -@@ -7,6 +7,14 @@ +@@ -8,6 +8,14 @@ import java.util.function.Predicate; import javax.annotation.Nullable; @@ -15,7 +15,7 @@ public class EntityZombie extends EntityMonster { protected static final IAttribute d = (new AttributeRanged((IAttribute) null, "zombie.spawnReinforcements", 0.0D, 0.0D, 1.0D)).a("Spawn Reinforcements Chance"); -@@ -22,6 +30,7 @@ +@@ -23,6 +31,7 @@ private boolean bE; private int bF; public int drownedConversionTime; @@ -23,7 +23,7 @@ public EntityZombie(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -143,7 +152,11 @@ +@@ -144,7 +153,11 @@ public void tick() { if (!this.world.isClientSide && this.isAlive()) { if (this.isDrownConverting()) { @@ -34,9 +34,9 @@ + this.drownedConversionTime -= elapsedTicks; + // CraftBukkit end if (this.drownedConversionTime < 0) { - this.eb(); + this.ea(); } -@@ -192,6 +205,7 @@ +@@ -193,6 +206,7 @@ } public void startDrownedConversion(int i) { @@ -44,7 +44,7 @@ this.drownedConversionTime = i; this.getDataWatcher().set(EntityZombie.DROWN_CONVERTING, true); } -@@ -229,7 +243,12 @@ +@@ -231,7 +245,12 @@ entityzombie.setCustomNameVisible(this.getCustomNameVisible()); } @@ -58,7 +58,7 @@ this.die(); } } -@@ -262,8 +281,8 @@ +@@ -264,8 +283,8 @@ if (this.world.getType(blockposition).a((IBlockAccess) this.world, blockposition, (Entity) entityzombie) && 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.i((Entity) entityzombie) && this.world.getCubes(entityzombie) && !this.world.containsLiquid(entityzombie.getBoundingBox())) { @@ -67,9 +67,9 @@ + this.world.addEntity(entityzombie, CreatureSpawnEvent.SpawnReason.REINFORCEMENTS); // CraftBukkit + entityzombie.setGoalTarget(entityliving, EntityTargetEvent.TargetReason.REINFORCEMENT_TARGET, true); // CraftBukkit entityzombie.prepare(this.world, this.world.getDamageScaler(new BlockPosition(entityzombie)), EnumMobSpawn.REINFORCEMENT, (GroupDataEntity) null, (NBTTagCompound) null); - this.getAttributeInstance(EntityZombie.d).b(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION)); - entityzombie.getAttributeInstance(EntityZombie.d).b(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION)); -@@ -287,7 +306,14 @@ + this.getAttributeInstance(EntityZombie.d).addModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION)); + entityzombie.getAttributeInstance(EntityZombie.d).addModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, AttributeModifier.Operation.ADDITION)); +@@ -289,7 +308,14 @@ float f = this.world.getDamageScaler(new BlockPosition(this)).b(); if (this.getItemInMainHand().isEmpty() && this.isBurning() && this.random.nextFloat() < f * 0.3F) { @@ -85,7 +85,7 @@ } } -@@ -377,7 +403,7 @@ +@@ -379,7 +405,7 @@ EntityZombieVillager entityzombievillager = (EntityZombieVillager) EntityTypes.ZOMBIE_VILLAGER.a(this.world); entityzombievillager.u(entityvillager); @@ -93,8 +93,8 @@ + // entityvillager.die(); // CraftBukkit - moved down entityzombievillager.prepare(this.world, this.world.getDamageScaler(new BlockPosition(entityzombievillager)), EnumMobSpawn.CONVERSION, new EntityZombie.GroupDataZombie(false), (NBTTagCompound) null); entityzombievillager.setVillagerData(entityvillager.getVillagerData()); - entityzombievillager.setOffers(entityvillager.getOffers().a()); -@@ -389,7 +415,13 @@ + entityzombievillager.a((NBTBase) entityvillager.es().a((DynamicOps) DynamicOpsNBT.a).getValue()); +@@ -392,7 +418,13 @@ entityzombievillager.setCustomNameVisible(entityvillager.getCustomNameVisible()); } @@ -109,7 +109,7 @@ this.world.a((EntityHuman) null, 1026, new BlockPosition(this), 0); } -@@ -436,7 +468,7 @@ +@@ -439,7 +471,7 @@ entitychicken1.setPositionRotation(this.locX, this.locY, this.locZ, this.yaw, 0.0F); entitychicken1.prepare(generatoraccess, difficultydamagescaler, EnumMobSpawn.JOCKEY, (GroupDataEntity) null, (NBTTagCompound) null); entitychicken1.r(true); diff --git a/paper-server/nms-patches/EntityZombieVillager.patch b/paper-server/nms-patches/EntityZombieVillager.patch index 45ac546031..315a2ac56d 100644 --- a/paper-server/nms-patches/EntityZombieVillager.patch +++ b/paper-server/nms-patches/EntityZombieVillager.patch @@ -11,15 +11,15 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHolder { -@@ -12,6 +16,7 @@ - public UUID conversionPlayer; - private NBTTagCompound bB; - private int bC; +@@ -13,6 +17,7 @@ + private NBTBase bB; + private NBTTagCompound bC; + private int bD; + private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field public EntityZombieVillager(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -66,6 +71,11 @@ +@@ -75,6 +80,11 @@ public void tick() { if (!this.world.isClientSide && this.isAlive() && this.isConverting()) { int i = this.getConversionProgress(); @@ -31,7 +31,7 @@ this.conversionTime -= i; if (this.conversionTime <= 0) { -@@ -113,8 +123,11 @@ +@@ -122,8 +132,11 @@ this.conversionPlayer = uuid; this.conversionTime = i; this.getDataWatcher().set(EntityZombieVillager.CONVERTING, true); @@ -45,7 +45,7 @@ this.world.broadcastEntityEffect(this, (byte) 16); } -@@ -133,14 +146,20 @@ +@@ -146,14 +159,20 @@ entityvillager.setAgeRaw(-24000); } @@ -68,7 +68,7 @@ if (this.conversionPlayer != null) { EntityHuman entityhuman = worldserver.b(this.conversionPlayer); -@@ -150,7 +169,7 @@ +@@ -163,7 +182,7 @@ } } diff --git a/paper-server/nms-patches/FoodMetaData.patch b/paper-server/nms-patches/FoodMetaData.patch index fef68df322..316c443b12 100644 --- a/paper-server/nms-patches/FoodMetaData.patch +++ b/paper-server/nms-patches/FoodMetaData.patch @@ -64,7 +64,7 @@ this.a(f); this.foodTickTimer = 0; } - } else if (flag && this.foodLevel >= 18 && entityhuman.dQ()) { + } else if (flag && this.foodLevel >= 18 && entityhuman.dP()) { ++this.foodTickTimer; if (this.foodTickTimer >= 80) { - entityhuman.heal(1.0F); diff --git a/paper-server/nms-patches/GameRules.patch b/paper-server/nms-patches/GameRules.patch index 3b755ac9d5..2b8d891fc2 100644 --- a/paper-server/nms-patches/GameRules.patch +++ b/paper-server/nms-patches/GameRules.patch @@ -36,15 +36,7 @@ this.a = b(s); } -@@ -246,14 +246,14 @@ - this.a(((CommandListenerWrapper) commandcontext.getSource()).getServer()); - } - -- protected void a(@Nullable MinecraftServer minecraftserver) { -+ public void a(@Nullable MinecraftServer minecraftserver) { // PAIL - private->public - if (minecraftserver != null) { - this.a.c.accept(minecraftserver, this.e()); - } +@@ -253,7 +253,7 @@ } @@ -56,7 +48,7 @@ @@ -283,7 +283,7 @@ } - public T a() { + public T getValue() { - return (GameRules.GameRuleValue) this.b.apply(this); + return this.b.apply(this); // CraftBukkit - decompile error } diff --git a/paper-server/nms-patches/IDispenseBehavior.patch b/paper-server/nms-patches/IDispenseBehavior.patch index 439bdd61c3..7d4677d6a0 100644 --- a/paper-server/nms-patches/IDispenseBehavior.patch +++ b/paper-server/nms-patches/IDispenseBehavior.patch @@ -62,7 +62,7 @@ }); } @@ -127,8 +136,36 @@ - EnumDirection enumdirection = (EnumDirection) isourceblock.e().get(BlockDispenser.FACING); + EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING); EntityTypes entitytypes = ((ItemMonsterEgg) itemstack.getItem()).b(itemstack.getTag()); + // CraftBukkit start @@ -184,7 +184,7 @@ } @@ -199,9 +293,52 @@ - BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING)); + BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING)); World world = isourceblock.getWorld(); + // CraftBukkit start @@ -307,7 +307,7 @@ + // CraftBukkit end + this.dispensed = true; - BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING)); + BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING)); IBlockData iblockdata = world.getType(blockposition); if (ItemFlintAndSteel.a(iblockdata, (GeneratorAccess) world, blockposition)) { @@ -323,7 +323,7 @@ @@ -281,12 +472,57 @@ this.dispensed = true; World world = isourceblock.getWorld(); - BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING)); + BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING)); + // CraftBukkit start + org.bukkit.block.Block block = world.getWorld().getBlockAt(isourceblock.getBlockPosition().getX(), isourceblock.getBlockPosition().getY(), isourceblock.getBlockPosition().getZ()); + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack); @@ -381,7 +381,7 @@ @@ -296,11 +532,40 @@ protected ItemStack a(ISourceBlock isourceblock, ItemStack itemstack) { World world = isourceblock.getWorld(); - BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING)); + BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING)); - 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); + @@ -415,14 +415,14 @@ + // CraftBukkit end world.addEntity(entitytntprimed); - world.a((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F); + world.playSound((EntityHuman) null, entitytntprimed.locX, entitytntprimed.locY, entitytntprimed.locZ, SoundEffects.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F); - itemstack.subtract(1); + // itemstack.subtract(1); // CraftBukkit - handled above return itemstack; } })); @@ -324,6 +589,30 @@ - EnumDirection enumdirection = (EnumDirection) isourceblock.e().get(BlockDispenser.FACING); + EnumDirection enumdirection = (EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING); BlockPosition blockposition = isourceblock.getBlockPosition().shift(enumdirection); + // CraftBukkit start @@ -453,7 +453,7 @@ if (world.isEmpty(blockposition) && BlockWitherSkull.b(world, blockposition, itemstack)) { world.setTypeAndData(blockposition, (IBlockData) Blocks.WITHER_SKELETON_SKULL.getBlockData().set(BlockSkull.a, enumdirection.k() == EnumDirection.EnumAxis.Y ? 0 : enumdirection.opposite().get2DRotationValue() * 4), 3); @@ -348,6 +637,30 @@ - BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.e().get(BlockDispenser.FACING)); + BlockPosition blockposition = isourceblock.getBlockPosition().shift((EnumDirection) isourceblock.getBlockData().get(BlockDispenser.FACING)); BlockPumpkinCarved blockpumpkincarved = (BlockPumpkinCarved) Blocks.CARVED_PUMPKIN; + // CraftBukkit start diff --git a/paper-server/nms-patches/ItemArmorStand.patch b/paper-server/nms-patches/ItemArmorStand.patch index 9ede4eab9c..960ea52a6e 100644 --- a/paper-server/nms-patches/ItemArmorStand.patch +++ b/paper-server/nms-patches/ItemArmorStand.patch @@ -10,5 +10,5 @@ + } + // CraftBukkit end world.addEntity(entityarmorstand); - world.a((EntityHuman) null, entityarmorstand.locX, entityarmorstand.locY, entityarmorstand.locZ, SoundEffects.ENTITY_ARMOR_STAND_PLACE, SoundCategory.BLOCKS, 0.75F, 0.8F); + world.playSound((EntityHuman) null, entityarmorstand.locX, entityarmorstand.locY, entityarmorstand.locZ, SoundEffects.ENTITY_ARMOR_STAND_PLACE, SoundCategory.BLOCKS, 0.75F, 0.8F); } diff --git a/paper-server/nms-patches/ItemBlock.patch b/paper-server/nms-patches/ItemBlock.patch index 12c5ed7c7a..5e08b5f294 100644 --- a/paper-server/nms-patches/ItemBlock.patch +++ b/paper-server/nms-patches/ItemBlock.patch @@ -16,8 +16,8 @@ SoundEffectType soundeffecttype = iblockdata1.r(); -- world.a(entityhuman, blockposition, this.a(iblockdata1), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F); -+ // world.a(entityhuman, blockposition, this.a(iblockdata1), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F); +- world.playSound(entityhuman, blockposition, this.a(iblockdata1), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F); ++ // world.playSound(entityhuman, blockposition, this.a(iblockdata1), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F); itemstack.subtract(1); return EnumInteractionResult.SUCCESS; } diff --git a/paper-server/nms-patches/ItemBow.patch b/paper-server/nms-patches/ItemBow.patch index 8296c83a5a..e344c3cd82 100644 --- a/paper-server/nms-patches/ItemBow.patch +++ b/paper-server/nms-patches/ItemBow.patch @@ -7,10 +7,10 @@ + // CraftBukkit start - obfuscator went a little crazy + /* this.a(new MinecraftKey("pull"), (itemstack, world, entityliving) -> { - return entityliving == null ? 0.0F : (entityliving.dm().getItem() != Items.BOW ? 0.0F : (float) (itemstack.k() - entityliving.dn()) / 20.0F); + return entityliving == null ? 0.0F : (entityliving.dl().getItem() != Items.BOW ? 0.0F : (float) (itemstack.k() - entityliving.dm()) / 20.0F); }); this.a(new MinecraftKey("pulling"), (itemstack, world, entityliving) -> { - return entityliving != null && entityliving.isHandRaised() && entityliving.dm() == itemstack ? 1.0F : 0.0F; + return entityliving != null && entityliving.isHandRaised() && entityliving.dl() == itemstack ? 1.0F : 0.0F; }); + */ + // CraftBukkit end @@ -48,4 +48,4 @@ + // CraftBukkit end } - world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.i.nextFloat() * 0.4F + 1.2F) + f * 0.5F); + world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ARROW_SHOOT, SoundCategory.PLAYERS, 1.0F, 1.0F / (ItemBow.i.nextFloat() * 0.4F + 1.2F) + f * 0.5F); diff --git a/paper-server/nms-patches/ItemCrossbow.patch b/paper-server/nms-patches/ItemCrossbow.patch index 7ad3d24b9b..5a495fc7c9 100644 --- a/paper-server/nms-patches/ItemCrossbow.patch +++ b/paper-server/nms-patches/ItemCrossbow.patch @@ -7,7 +7,7 @@ + // CraftBukkit start - obfuscator went a little crazy + /* this.a(new MinecraftKey("pull"), (itemstack, world, entityliving) -> { - return entityliving != null && itemstack.getItem() == this ? (d(itemstack) ? 0.0F : (float) (itemstack.k() - entityliving.dn()) / (float) e(itemstack)) : 0.0F; + return entityliving != null && itemstack.getItem() == this ? (d(itemstack) ? 0.0F : (float) (itemstack.k() - entityliving.dm()) / (float) e(itemstack)) : 0.0F; }); @@ -24,6 +26,8 @@ this.a(new MinecraftKey("firework"), (itemstack, world, entityliving) -> { @@ -56,6 +56,6 @@ + } + } + // CraftBukkit end - world.a((EntityHuman) null, entityliving.locX, entityliving.locY, entityliving.locZ, SoundEffects.ITEM_CROSSBOW_SHOOT, SoundCategory.PLAYERS, 1.0F, f); + world.playSound((EntityHuman) null, entityliving.locX, entityliving.locY, entityliving.locZ, SoundEffects.ITEM_CROSSBOW_SHOOT, SoundCategory.PLAYERS, 1.0F, f); } } diff --git a/paper-server/nms-patches/ItemEnderPearl.patch b/paper-server/nms-patches/ItemEnderPearl.patch index 46ac954367..09a5322140 100644 --- a/paper-server/nms-patches/ItemEnderPearl.patch +++ b/paper-server/nms-patches/ItemEnderPearl.patch @@ -8,8 +8,8 @@ - itemstack.subtract(1); - } - -- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.i.nextFloat() * 0.4F + 0.8F)); -- entityhuman.getCooldownTracker().a(this, 20); +- world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.i.nextFloat() * 0.4F + 0.8F)); +- entityhuman.getCooldownTracker().setCooldown(this, 20); + // CraftBukkit start - change order if (!world.isClientSide) { EntityEnderPearl entityenderpearl = new EntityEnderPearl(world, entityhuman); @@ -29,7 +29,7 @@ + itemstack.subtract(1); + } + -+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.i.nextFloat() * 0.4F + 0.8F)); ++ world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemEnderPearl.i.nextFloat() * 0.4F + 0.8F)); + entityhuman.getCooldownTracker().a(this, 20); + // CraftBukkit end + diff --git a/paper-server/nms-patches/ItemFishingRod.patch b/paper-server/nms-patches/ItemFishingRod.patch index 908677f5aa..c4619b26af 100644 --- a/paper-server/nms-patches/ItemFishingRod.patch +++ b/paper-server/nms-patches/ItemFishingRod.patch @@ -25,10 +25,10 @@ @Override @@ -36,12 +42,23 @@ entityhuman.a(enumhand); - world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_RETRIEVE, SoundCategory.NEUTRAL, 1.0F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F)); + world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_RETRIEVE, SoundCategory.NEUTRAL, 1.0F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F)); } else { -- world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F)); -+ // world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F)); +- world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F)); ++ // world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F)); if (!world.isClientSide) { i = EnchantmentManager.c(itemstack); int j = EnchantmentManager.b(itemstack); @@ -43,7 +43,7 @@ + entityhuman.hookedFish = null; + return new InteractionResultWrapper(EnumInteractionResult.PASS, itemstack); + } -+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F)); ++ world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_FISHING_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemFishingRod.i.nextFloat() * 0.4F + 0.8F)); + world.addEntity(entityfishinghook); + // CraftBukkit end } diff --git a/paper-server/nms-patches/ItemFlintAndSteel.patch b/paper-server/nms-patches/ItemFlintAndSteel.patch index a872da3f58..04e7a467b1 100644 --- a/paper-server/nms-patches/ItemFlintAndSteel.patch +++ b/paper-server/nms-patches/ItemFlintAndSteel.patch @@ -12,6 +12,6 @@ + return EnumInteractionResult.PASS; + } + // CraftBukkit end - world.a(entityhuman, blockposition1, SoundEffects.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, ItemFlintAndSteel.i.nextFloat() * 0.4F + 0.8F); + world.playSound(entityhuman, blockposition1, SoundEffects.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, ItemFlintAndSteel.i.nextFloat() * 0.4F + 0.8F); iblockdata = ((BlockFire) Blocks.FIRE).a((IBlockAccess) world, blockposition1); world.setTypeAndData(blockposition1, iblockdata, 11); diff --git a/paper-server/nms-patches/ItemSnowball.patch b/paper-server/nms-patches/ItemSnowball.patch index 6190a807e5..325f51598c 100644 --- a/paper-server/nms-patches/ItemSnowball.patch +++ b/paper-server/nms-patches/ItemSnowball.patch @@ -10,7 +10,7 @@ itemstack.subtract(1); } - world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F)); + world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F)); + */ if (!world.isClientSide) { EntitySnowball entitysnowball = new EntitySnowball(world, entityhuman); @@ -23,7 +23,7 @@ + itemstack.subtract(1); + } + -+ world.a((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F)); ++ world.playSound((EntityHuman) null, entityhuman.locX, entityhuman.locY, entityhuman.locZ, SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.i.nextFloat() * 0.4F + 0.8F)); + } else if (entityhuman instanceof EntityPlayer) { + ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); + } diff --git a/paper-server/nms-patches/ItemStack.patch b/paper-server/nms-patches/ItemStack.patch index 03a874cddc..7c4895b311 100644 --- a/paper-server/nms-patches/ItemStack.patch +++ b/paper-server/nms-patches/ItemStack.patch @@ -223,7 +223,7 @@ + // SPIGOT-1288 - play sound stripped from ItemBlock + if (this.item instanceof ItemBlock) { + SoundEffectType soundeffecttype = ((ItemBlock) this.item).getBlock().stepSound; -+ world.a(entityhuman, blockposition, soundeffecttype.e(), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F); ++ world.playSound(entityhuman, blockposition, soundeffecttype.e(), SoundCategory.BLOCKS, (soundeffecttype.a() + 1.0F) / 2.0F, soundeffecttype.b() * 0.8F); + } + + entityhuman.b(StatisticList.ITEM_USED.b(item)); diff --git a/paper-server/nms-patches/ItemTrident.patch b/paper-server/nms-patches/ItemTrident.patch index b32e8d028f..0117734de4 100644 --- a/paper-server/nms-patches/ItemTrident.patch +++ b/paper-server/nms-patches/ItemTrident.patch @@ -7,7 +7,7 @@ + // CraftBukkit start - obfuscator went a little crazy + /* this.a(new MinecraftKey("throwing"), (itemstack, world, entityliving) -> { - return entityliving != null && entityliving.isHandRaised() && entityliving.dm() == itemstack ? 1.0F : 0.0F; + return entityliving != null && entityliving.isHandRaised() && entityliving.dl() == itemstack ? 1.0F : 0.0F; }); + */ + // CraftBukkit end @@ -46,7 +46,7 @@ + entitythrowntrident.trident = itemstack.cloneItemStack(); // SPIGOT-4511 update since damage call moved + // CraftBukkit end + - world.a((EntityHuman) null, (Entity) entitythrowntrident, SoundEffects.ITEM_TRIDENT_THROW, SoundCategory.PLAYERS, 1.0F, 1.0F); + world.playSound((EntityHuman) null, (Entity) entitythrowntrident, SoundEffects.ITEM_TRIDENT_THROW, SoundCategory.PLAYERS, 1.0F, 1.0F); if (!entityhuman.abilities.canInstantlyBuild) { entityhuman.inventory.f(itemstack); @@ -58,6 +78,10 @@ diff --git a/paper-server/nms-patches/LoginListener.patch b/paper-server/nms-patches/LoginListener.patch index 1d9293c5b9..311b38504d 100644 --- a/paper-server/nms-patches/LoginListener.patch +++ b/paper-server/nms-patches/LoginListener.patch @@ -39,10 +39,10 @@ + } + // CraftBukkit end + - public void disconnect(IChatBaseComponent ichatbasecomponent) { - try { - LoginListener.LOGGER.info("Disconnecting {}: {}", this.d(), ichatbasecomponent.getString()); -@@ -76,10 +97,12 @@ + @Override + public NetworkManager a() { + return this.networkManager; +@@ -81,10 +102,12 @@ this.i = this.a(this.i); } @@ -57,8 +57,8 @@ + // CraftBukkit end } else { this.g = LoginListener.EnumProtocolState.ACCEPTED; - if (this.server.ay() >= 0 && !this.networkManager.isLocal()) { -@@ -93,9 +116,9 @@ + if (this.server.az() >= 0 && !this.networkManager.isLocal()) { +@@ -98,9 +121,9 @@ if (entityplayer != null) { this.g = LoginListener.EnumProtocolState.DELAY_ACCEPT; @@ -70,7 +70,7 @@ } } -@@ -143,6 +166,43 @@ +@@ -148,6 +171,43 @@ LoginListener.this.i = LoginListener.this.server.getMinecraftSessionService().hasJoinedServer(new GameProfile((UUID) null, gameprofile.getName()), s, this.a()); if (LoginListener.this.i != null) { @@ -114,7 +114,7 @@ LoginListener.LOGGER.info("UUID of player {} is {}", LoginListener.this.i.getName(), LoginListener.this.i.getId()); LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; } else if (LoginListener.this.server.isEmbeddedServer()) { -@@ -162,6 +222,11 @@ +@@ -167,6 +227,11 @@ LoginListener.this.disconnect(new ChatMessage("multiplayer.disconnect.authservers_down", new Object[0])); LoginListener.LOGGER.error("Couldn't verify username because servers are unavailable"); } diff --git a/paper-server/nms-patches/MinecraftServer.patch b/paper-server/nms-patches/MinecraftServer.patch index 848b6729cf..28fc468dbc 100644 --- a/paper-server/nms-patches/MinecraftServer.patch +++ b/paper-server/nms-patches/MinecraftServer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -47,6 +47,13 @@ +@@ -56,6 +56,13 @@ import org.apache.commons.lang3.Validate; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -14,7 +14,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable, Runnable { -@@ -65,7 +72,7 @@ +@@ -75,7 +82,7 @@ public final DataFixer dataConverterManager; private String serverIp; private int serverPort = -1; @@ -23,18 +23,18 @@ private PlayerList playerList; private volatile boolean isRunning = true; private boolean isStopped; -@@ -103,7 +110,7 @@ +@@ -113,7 +120,7 @@ private final GameProfileRepository gameProfileRepository; private final UserCache userCache; - private long Y; + private long Z; - public final Thread serverThread = (Thread) SystemUtils.a((Object) (new Thread(this, "Server thread")), (thread) -> { + public final Thread serverThread = (Thread) SystemUtils.a((new Thread(this, "Server thread")), (thread) -> { // CraftBukkit - decompile error thread.setUncaughtExceptionHandler((thread1, throwable) -> { MinecraftServer.LOGGER.error(throwable); }); -@@ -132,7 +139,21 @@ +@@ -142,7 +149,21 @@ @Nullable - private String au; + private String av; - public MinecraftServer(File file, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory, String s) { + // CraftBukkit start @@ -53,11 +53,11 @@ + + public MinecraftServer(OptionSet options, Proxy proxy, DataFixer datafixer, CommandDispatcher commanddispatcher, YggdrasilAuthenticationService yggdrasilauthenticationservice, MinecraftSessionService minecraftsessionservice, GameProfileRepository gameprofilerepository, UserCache usercache, WorldLoadListenerFactory worldloadlistenerfactory, String s) { super("Server"); - this.ad = new ResourceManager(EnumResourcePackType.SERVER_DATA, this.serverThread); + this.ae = new ResourceManager(EnumResourcePackType.SERVER_DATA, this.serverThread); this.resourcePackRepository = new ResourcePackRepository<>(ResourcePackLoader::new); -@@ -145,15 +166,15 @@ - this.an = new CustomFunctionData(this); - this.ao = new CircularTimer(); +@@ -155,15 +176,15 @@ + this.ao = new CustomFunctionData(this); + this.ap = new CircularTimer(); this.proxy = proxy; - this.commandDispatcher = commanddispatcher; + this.commandDispatcher = this.vanillaCommandDispatcher = commanddispatcher; // CraftBukkit @@ -73,12 +73,12 @@ - this.convertable = new Convertable(file.toPath(), file.toPath().resolve("../backups"), datafixer); + // this.convertable = new Convertable(file.toPath(), file.toPath().resolve("../backups"), datafixer); // CraftBukkit - moved to DedicatedServer.init this.dataConverterManager = datafixer; - this.ad.a((IReloadListener) this.ai); - this.ad.a((IReloadListener) this.ah); -@@ -162,7 +183,32 @@ - this.ad.a((IReloadListener) this.am); + this.ae.a((IReloadListener) this.aj); + this.ae.a((IReloadListener) this.ai); +@@ -172,7 +193,32 @@ + this.ae.a((IReloadListener) this.an); this.executorService = SystemUtils.e(); - this.J = s; + this.K = s; + // CraftBukkit start + this.options = options; + // Try to see if we're actually running in a terminal, disable jline if not @@ -108,7 +108,7 @@ private void initializeScoreboards(WorldPersistentData worldpersistentdata) { PersistentScoreboard persistentscoreboard = (PersistentScoreboard) worldpersistentdata.a(PersistentScoreboard::new, "scoreboard"); -@@ -198,11 +244,11 @@ +@@ -208,11 +254,11 @@ } if (this.forceUpgrade) { @@ -123,7 +123,7 @@ IChatBaseComponent ichatbasecomponent = null; while (!worldupgrader.b()) { -@@ -241,8 +287,9 @@ +@@ -251,8 +297,9 @@ } protected void a(String s, String s1, long i, WorldType worldtype, JsonElement jsonelement) { @@ -134,7 +134,7 @@ WorldNBTStorage worldnbtstorage = this.getConvertable().a(s, this); this.a(this.getWorld(), worldnbtstorage); -@@ -267,24 +314,134 @@ +@@ -277,24 +324,134 @@ } this.a(worldnbtstorage.getDirectory(), worlddata); @@ -158,10 +158,7 @@ + continue; + } + } - -- protected void a(WorldNBTStorage worldnbtstorage, WorldData worlddata, WorldSettings worldsettings, WorldLoadListener worldloadlistener) { -- if (this.isDemoMode()) { -- worlddata.a(MinecraftServer.c); ++ + if (j == 2) { + if (server.getAllowEnd()) { + dimension = 1; @@ -231,7 +228,10 @@ + MinecraftServer.LOGGER.info("---- Migration of old " + worldType + " folder failed ----"); + } + } -+ + +- protected void a(WorldNBTStorage worldnbtstorage, WorldData worlddata, WorldSettings worldsettings, WorldLoadListener worldloadlistener) { +- if (this.isDemoMode()) { +- worlddata.a(MinecraftServer.c); + WorldNBTStorage worldnbtstorage = new WorldNBTStorage(server.getWorldContainer(), name, this, this.dataConverterManager); + // world =, b0 to dimension, s1 to name, added Environment and gen + worlddata = worldnbtstorage.getWorldData(); @@ -282,7 +282,7 @@ if (!worlddata.u()) { try { -@@ -308,23 +465,8 @@ +@@ -318,23 +475,8 @@ worlddata.d(true); } @@ -307,7 +307,7 @@ private void a(WorldData worlddata) { worlddata.f(false); -@@ -343,6 +485,25 @@ +@@ -353,6 +495,25 @@ protected void a(File file, WorldData worlddata) { this.resourcePackRepository.a((ResourcePackSource) (new ResourcePackSourceVanilla())); this.resourcePackFolder = new ResourcePackSourceFolder(new File(file, "datapacks")); @@ -333,7 +333,7 @@ this.resourcePackRepository.a((ResourcePackSource) this.resourcePackFolder); this.resourcePackRepository.a(); List list = Lists.newArrayList(); -@@ -363,11 +524,18 @@ +@@ -373,11 +534,18 @@ this.b(worlddata); } @@ -355,7 +355,7 @@ BlockPosition blockposition = worldserver.getSpawn(); worldloadlistener.a(new ChunkCoordIntPair(blockposition)); -@@ -378,17 +546,21 @@ +@@ -388,17 +556,21 @@ chunkproviderserver.addTicket(TicketType.START, new ChunkCoordIntPair(blockposition), 11, Unit.INSTANCE); while (chunkproviderserver.b() != 441) { @@ -386,7 +386,7 @@ if (forcedchunk != null) { WorldServer worldserver1 = this.getWorldServer(dimensionmanager); -@@ -403,10 +575,16 @@ +@@ -413,10 +585,16 @@ } } @@ -405,7 +405,7 @@ } protected void a(String s, WorldNBTStorage worldnbtstorage) { -@@ -451,12 +629,16 @@ +@@ -463,12 +641,16 @@ } } @@ -422,7 +422,7 @@ return flag3; } -@@ -465,8 +647,29 @@ +@@ -477,8 +659,29 @@ this.stop(); } @@ -452,7 +452,7 @@ if (this.getServerConnection() != null) { this.getServerConnection().b(); } -@@ -475,6 +678,7 @@ +@@ -487,6 +690,7 @@ MinecraftServer.LOGGER.info("Saving players"); this.playerList.savePlayers(); this.playerList.shutdown(); @@ -460,7 +460,7 @@ } MinecraftServer.LOGGER.info("Saving worlds"); -@@ -544,14 +748,16 @@ +@@ -556,14 +760,16 @@ while (this.isRunning) { long i = SystemUtils.getMonotonicMillis() - this.nextTick; @@ -476,9 +476,9 @@ + MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit this.nextTick += 50L; - if (this.S) { - this.S = false; -@@ -598,6 +804,12 @@ + if (this.T) { + this.T = false; +@@ -610,6 +816,12 @@ } catch (Throwable throwable1) { MinecraftServer.LOGGER.error("Exception stopping the server", throwable1); } finally { @@ -491,13 +491,13 @@ this.exit(); } -@@ -606,8 +818,15 @@ +@@ -618,8 +830,15 @@ } private boolean canSleepForTick() { -- return this.isEntered() || SystemUtils.getMonotonicMillis() < (this.ab ? this.aa : this.nextTick); +- return this.isEntered() || SystemUtils.getMonotonicMillis() < (this.ac ? this.ab : this.nextTick); + // CraftBukkit start -+ return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < (this.ab ? this.aa : this.nextTick); ++ return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < (this.ac ? this.ab : this.nextTick); + } + + private void executeModerately() { @@ -508,7 +508,7 @@ protected void sleepForTick() { this.executeAll(); -@@ -708,7 +927,7 @@ +@@ -720,7 +939,7 @@ this.serverPing.b().a(agameprofile); } @@ -517,7 +517,7 @@ MinecraftServer.LOGGER.debug("Autosave started"); this.methodProfiler.enter("save"); this.playerList.savePlayers(); -@@ -738,23 +957,40 @@ +@@ -750,23 +969,40 @@ } protected void b(BooleanSupplier booleansupplier) { @@ -559,7 +559,7 @@ this.methodProfiler.enter("tick"); -@@ -793,7 +1029,8 @@ +@@ -805,7 +1041,8 @@ this.tickables.add(runnable); } @@ -569,7 +569,7 @@ OptionParser optionparser = new OptionParser(); OptionSpec optionspec = optionparser.accepts("nogui"); OptionSpec optionspec1 = optionparser.accepts("initSettings", "Initializes 'server.properties' and 'eula.txt', then quits"); -@@ -816,15 +1053,17 @@ +@@ -828,15 +1065,17 @@ optionparser.printHelpOn(System.err); return; } @@ -589,7 +589,7 @@ MinecraftServer.LOGGER.info("Initialized '" + java_nio_file_path.toAbsolutePath().toString() + "' and '" + java_nio_file_path1.toAbsolutePath().toString() + "'"); return; } -@@ -836,14 +1075,15 @@ +@@ -848,14 +1087,15 @@ DispenserRegistry.init(); DispenserRegistry.c(); @@ -608,7 +608,7 @@ dedicatedserver.i((String) optionset.valueOf(optionspec7)); dedicatedserver.setPort((Integer) optionset.valueOf(optionspec10)); dedicatedserver.e(optionset.has(optionspec2)); -@@ -866,6 +1106,29 @@ +@@ -878,6 +1118,29 @@ thread.setUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler(MinecraftServer.LOGGER)); Runtime.getRuntime().addShutdownHook(thread); @@ -638,7 +638,7 @@ } catch (Exception exception) { MinecraftServer.LOGGER.fatal("Failed to start the minecraft server", exception); } -@@ -885,7 +1148,9 @@ +@@ -897,7 +1160,9 @@ } public void startServerThread() { @@ -648,7 +648,7 @@ } public File d(String s) { -@@ -940,7 +1205,7 @@ +@@ -952,7 +1217,7 @@ } public String getServerModName() { @@ -657,19 +657,19 @@ } public CrashReport b(CrashReport crashreport) { -@@ -979,7 +1244,7 @@ +@@ -991,7 +1256,7 @@ } - public boolean E() { + public boolean F() { - return this.universe != null; + return true; // CraftBukkit } @Override -@@ -1482,4 +1747,16 @@ - } +@@ -1690,4 +1955,16 @@ + } - public abstract boolean b(GameProfile gameprofile); + } + + // CraftBukkit start + @Override diff --git a/paper-server/nms-patches/NetworkManager.patch b/paper-server/nms-patches/NetworkManager.patch index d65400b9d8..dab0a63327 100644 --- a/paper-server/nms-patches/NetworkManager.patch +++ b/paper-server/nms-patches/NetworkManager.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/NetworkManager.java +++ b/net/minecraft/server/NetworkManager.java -@@ -129,7 +129,7 @@ +@@ -127,7 +127,7 @@ } private static void a(Packet packet, PacketListener packetlistener) { @@ -9,12 +9,12 @@ } public void setPacketListener(PacketListener packetlistener) { -@@ -244,7 +244,7 @@ +@@ -234,7 +234,7 @@ public void close(IChatBaseComponent ichatbasecomponent) { if (this.channel.isOpen()) { - this.channel.close().awaitUninterruptibly(); + this.channel.close(); // We can't wait as this may be called from an event loop. - this.n = ichatbasecomponent; + this.m = ichatbasecomponent; } diff --git a/paper-server/nms-patches/PacketStatusListener.patch b/paper-server/nms-patches/PacketStatusListener.patch index 5eec59eb19..1d9950d88b 100644 --- a/paper-server/nms-patches/PacketStatusListener.patch +++ b/paper-server/nms-patches/PacketStatusListener.patch @@ -17,7 +17,7 @@ public class PacketStatusListener implements PacketStatusInListener { private static final IChatBaseComponent a = new ChatMessage("multiplayer.status.request_handled", new Object[0]); -@@ -21,8 +32,96 @@ +@@ -26,8 +37,96 @@ this.networkManager.close(PacketStatusListener.a); } else { this.d = true; diff --git a/paper-server/nms-patches/PlayerChunk.patch b/paper-server/nms-patches/PlayerChunk.patch index c66affdf41..e6be890ffd 100644 --- a/paper-server/nms-patches/PlayerChunk.patch +++ b/paper-server/nms-patches/PlayerChunk.patch @@ -25,7 +25,7 @@ public CompletableFuture> getStatusFutureUnchecked(ChunkStatus chunkstatus) { CompletableFuture> completablefuture = (CompletableFuture) this.statusFutures.get(chunkstatus.c()); -@@ -76,9 +85,9 @@ +@@ -80,9 +89,9 @@ @Nullable public Chunk getChunk() { CompletableFuture> completablefuture = this.a(); @@ -36,8 +36,8 @@ + return either == null ? null : (Chunk) either.left().orElse(null); // CraftBukkit - decompile error } - public CompletableFuture getChunkSave() { -@@ -201,7 +210,7 @@ + @Nullable +@@ -223,7 +232,7 @@ CompletableFuture> completablefuture = (CompletableFuture) this.statusFutures.get(i); if (completablefuture != null) { @@ -46,7 +46,7 @@ if (either == null || either.left().isPresent()) { return completablefuture; -@@ -256,6 +265,24 @@ +@@ -278,6 +287,24 @@ boolean flag1 = this.ticketLevel <= PlayerChunkMap.GOLDEN_TICKET; PlayerChunk.State playerchunk_state = getChunkState(this.oldTicketLevel); PlayerChunk.State playerchunk_state1 = getChunkState(this.ticketLevel); @@ -71,7 +71,7 @@ CompletableFuture completablefuture; if (flag) { -@@ -287,7 +314,7 @@ +@@ -309,7 +336,7 @@ if (flag2 && !flag3) { completablefuture = this.fullChunkFuture; this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE; @@ -80,7 +80,7 @@ playerchunkmap.getClass(); return either1.ifLeft(playerchunkmap::a); })); -@@ -325,6 +352,20 @@ +@@ -347,6 +374,20 @@ this.w.a(this.location, this::k, this.ticketLevel, this::d); this.oldTicketLevel = this.ticketLevel; diff --git a/paper-server/nms-patches/PlayerChunkMap.patch b/paper-server/nms-patches/PlayerChunkMap.patch index 0a70d13915..028bc6bc89 100644 --- a/paper-server/nms-patches/PlayerChunkMap.patch +++ b/paper-server/nms-patches/PlayerChunkMap.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/PlayerChunkMap.java +++ b/net/minecraft/server/PlayerChunkMap.java -@@ -37,6 +37,7 @@ +@@ -42,6 +42,7 @@ import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -8,16 +8,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { -@@ -58,7 +59,7 @@ - private final Mailbox> mailboxWorldGen; - private final Mailbox> mailboxMain; - public final WorldLoadListener worldLoadListener; -- private final PlayerChunkMap.a u; -+ public final PlayerChunkMap.a u; // CraftBukkit - private -> public // PAIL chunkDistanceManager - private final AtomicInteger v; - private final DefinedStructureManager definedStructureManager; - private final File x; -@@ -67,6 +68,31 @@ +@@ -72,6 +73,31 @@ private final Queue A; private int viewDistance; @@ -49,7 +40,7 @@ public PlayerChunkMap(WorldServer worldserver, File file, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, Supplier supplier, int i) { super(new File(worldserver.getWorldProvider().getDimensionManager().a(file), "region"), datafixer); this.visibleChunks = this.updatingChunks.clone(); -@@ -184,9 +210,12 @@ +@@ -191,9 +217,12 @@ return completablefuture1.thenApply((list1) -> { List list2 = Lists.newArrayList(); @@ -64,7 +55,7 @@ final Either either = (Either) iterator.next(); Optional optional = either.left(); -@@ -284,7 +313,7 @@ +@@ -291,7 +320,7 @@ PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.x.getName()); } else { this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).forEach((playerchunk) -> { @@ -73,7 +64,7 @@ if (ichunkaccess instanceof ProtoChunkExtension || ichunkaccess instanceof Chunk) { this.saveChunk(ichunkaccess); -@@ -295,7 +324,6 @@ +@@ -302,7 +331,6 @@ } } @@ -81,7 +72,7 @@ protected void unloadChunks(BooleanSupplier booleansupplier) { GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler(); -@@ -334,7 +362,7 @@ +@@ -341,7 +369,7 @@ private void a(long i, PlayerChunk playerchunk) { CompletableFuture completablefuture = playerchunk.getChunkSave(); @@ -90,7 +81,7 @@ CompletableFuture completablefuture1 = playerchunk.getChunkSave(); if (completablefuture1 != completablefuture) { -@@ -483,7 +511,7 @@ +@@ -490,7 +518,7 @@ return CompletableFuture.completedFuture(Either.right(playerchunk_failure)); }); }, (runnable) -> { @@ -99,7 +90,7 @@ }); } -@@ -564,7 +592,7 @@ +@@ -571,7 +599,7 @@ long i = playerchunk.i().pair(); playerchunk.getClass(); @@ -108,7 +99,7 @@ }); } -@@ -581,7 +609,7 @@ +@@ -588,7 +616,7 @@ return Either.left(chunk); }); }, (runnable) -> { @@ -117,7 +108,7 @@ }); completablefuture1.thenAcceptAsync((either) -> { -@@ -595,7 +623,7 @@ +@@ -602,7 +630,7 @@ return Either.left(chunk); }); }, (runnable) -> { @@ -126,7 +117,7 @@ }); return completablefuture1; } -@@ -609,7 +637,7 @@ +@@ -616,7 +644,7 @@ return chunk; }); }, (runnable) -> { @@ -135,7 +126,26 @@ }); } -@@ -724,7 +752,7 @@ +@@ -740,7 +768,8 @@ + return ichunkaccess instanceof Chunk ? Optional.of((Chunk) ichunkaccess) : Optional.empty(); + }); + +- csvwriter.a(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getChunkStatus).orElse((Object) null), optional1.map(Chunk::getState).orElse((Object) null), a(playerchunk.c()), a(playerchunk.a()), a(playerchunk.b()), this.chunkDistanceManager.c(entry.getLongKey()), !this.isOutsideOfRange(chunkcoordintpair), optional1.map((chunk) -> { ++ // Craftbukkit - decompile error ++ csvwriter.a(chunkcoordintpair.x, chunkcoordintpair.z, playerchunk.getTicketLevel(), optional.isPresent(), optional.map(IChunkAccess::getChunkStatus).orElse(null), optional1.map(Chunk::getState).orElse(null), a(playerchunk.c()), a(playerchunk.a()), a(playerchunk.b()), this.chunkDistanceManager.c(entry.getLongKey()), !this.isOutsideOfRange(chunkcoordintpair), optional1.map((chunk) -> { + return Stream.of(chunk.getEntitySlices()).mapToInt(EntitySlice::size).sum(); + }).orElse(0), optional1.map((chunk) -> { + return chunk.getTileEntities().size(); +@@ -751,7 +780,7 @@ + + private static String a(CompletableFuture> completablefuture) { + try { +- Either either = (Either) completablefuture.getNow((Object) null); ++ Either either = (Either) completablefuture.getNow(null); // Craftbukkit - decompile error + + return either != null ? (String) either.map((chunk) -> { + return "done"; +@@ -769,7 +798,7 @@ private NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException { NBTTagCompound nbttagcompound = this.read(chunkcoordintpair); @@ -144,7 +154,7 @@ } boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) { -@@ -1056,7 +1084,7 @@ +@@ -1101,7 +1130,7 @@ public final Set trackedPlayers = Sets.newHashSet(); public EntityTracker(Entity entity, int i, int j, boolean flag) { @@ -153,16 +163,16 @@ this.tracker = entity; this.trackingDistance = i; this.e = SectionPosition.a(entity); -@@ -1109,7 +1137,7 @@ +@@ -1154,7 +1183,7 @@ public void updatePlayer(EntityPlayer entityplayer) { if (entityplayer != this.tracker) { - Vec3D vec3d = (new Vec3D(entityplayer.locX, entityplayer.locY, entityplayer.locZ)).d(this.trackerEntry.b()); -+ Vec3D vec3d = (new Vec3D(entityplayer.locX, entityplayer.locY, entityplayer.locZ)).d(this.tracker.ci()); // MC-155077, SPIGOT-5113 // PAIL getPositionVector ++ Vec3D vec3d = (new Vec3D(entityplayer.locX, entityplayer.locY, entityplayer.locZ)).d(this.tracker.getPositionVector()); // MC-155077, SPIGOT-5113 int i = Math.min(this.trackingDistance, (PlayerChunkMap.this.viewDistance - 1) * 16); boolean flag = vec3d.x >= (double) (-i) && vec3d.x <= (double) i && vec3d.z >= (double) (-i) && vec3d.z <= (double) i && this.tracker.a(entityplayer); -@@ -1125,6 +1153,17 @@ +@@ -1170,6 +1199,17 @@ } } diff --git a/paper-server/nms-patches/PlayerConnection.patch b/paper-server/nms-patches/PlayerConnection.patch index 772af2dc1c..02f2ca2bb9 100644 --- a/paper-server/nms-patches/PlayerConnection.patch +++ b/paper-server/nms-patches/PlayerConnection.patch @@ -126,7 +126,7 @@ this.disconnect(new ChatMessage("multiplayer.disconnect.idling", new Object[0])); } -@@ -149,16 +226,46 @@ +@@ -150,16 +227,46 @@ return this.minecraftServer.b(this.player.getProfile()); } @@ -174,7 +174,7 @@ } @Override -@@ -199,7 +306,34 @@ +@@ -200,7 +307,34 @@ double d9 = entity.getMot().g(); double d10 = d6 * d6 + d7 * d7 + d8 * d8; @@ -210,7 +210,7 @@ PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), d6, d7, d8); this.networkManager.sendPacket(new PacketPlayOutVehicleMove(entity)); return; -@@ -229,14 +363,72 @@ +@@ -230,14 +364,72 @@ } entity.setLocation(d3, d4, d5, f, f1); @@ -283,7 +283,7 @@ this.player.getWorldServer().getChunkProvider().movePlayer(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.a(entity.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); -@@ -251,7 +443,7 @@ +@@ -252,7 +444,7 @@ @Override public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) { PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.getWorldServer()); @@ -292,7 +292,7 @@ this.player.setLocation(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); this.o = this.teleportPos.x; this.p = this.teleportPos.y; -@@ -261,6 +453,7 @@ +@@ -262,6 +454,7 @@ } this.teleportPos = null; @@ -300,7 +300,7 @@ } } -@@ -269,7 +462,7 @@ +@@ -270,7 +463,7 @@ public void a(PacketPlayInRecipeDisplayed packetplayinrecipedisplayed) { PlayerConnectionUtils.ensureMainThread(packetplayinrecipedisplayed, this, this.player.getWorldServer()); if (packetplayinrecipedisplayed.b() == PacketPlayInRecipeDisplayed.Status.SHOWN) { @@ -309,7 +309,7 @@ RecipeBookServer recipebookserver = this.player.B(); optional.ifPresent(recipebookserver::e); -@@ -303,6 +496,12 @@ +@@ -304,6 +497,12 @@ @Override public void a(PacketPlayInTabComplete packetplayintabcomplete) { PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); @@ -322,7 +322,7 @@ StringReader stringreader = new StringReader(packetplayintabcomplete.c()); if (stringreader.canRead() && stringreader.peek() == '/') { -@@ -312,7 +511,8 @@ +@@ -313,7 +512,8 @@ ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener()); this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { @@ -332,7 +332,7 @@ }); } -@@ -517,6 +717,7 @@ +@@ -518,6 +718,7 @@ if (container instanceof ContainerMerchant) { ContainerMerchant containermerchant = (ContainerMerchant) container; @@ -340,7 +340,7 @@ containermerchant.d(i); containermerchant.g(i); -@@ -526,6 +727,15 @@ +@@ -527,6 +728,15 @@ @Override public void a(PacketPlayInBEdit packetplayinbedit) { @@ -356,7 +356,7 @@ ItemStack itemstack = packetplayinbedit.b(); if (!itemstack.isEmpty()) { -@@ -554,9 +764,11 @@ +@@ -555,9 +765,11 @@ } itemstack2.a("pages", (NBTBase) nbttaglist); @@ -369,7 +369,7 @@ } } -@@ -598,7 +810,7 @@ +@@ -599,7 +811,7 @@ } else { WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); @@ -378,7 +378,7 @@ if (this.e == 0) { this.syncPosition(); } -@@ -608,13 +820,21 @@ +@@ -609,13 +821,21 @@ this.A = this.e; this.a(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); } @@ -401,7 +401,7 @@ double d0 = this.player.locX; double d1 = this.player.locY; double d2 = this.player.locZ; -@@ -639,15 +859,33 @@ +@@ -640,15 +860,33 @@ ++this.receivedMovePackets; int i = this.receivedMovePackets - this.processedMovePackets; @@ -437,7 +437,7 @@ PlayerConnection.LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getDisplayName().getString(), d7, d8, d9); this.a(this.player.locX, this.player.locY, this.player.locZ, this.player.yaw, this.player.pitch); return; -@@ -693,6 +931,69 @@ +@@ -694,6 +932,69 @@ } } @@ -507,7 +507,7 @@ this.B = d12 >= -0.03125D && this.player.playerInteractManager.getGameMode() != EnumGamemode.SPECTATOR && !this.minecraftServer.getAllowFlight() && !this.player.abilities.canFly && !this.player.hasEffect(MobEffects.LEVITATION) && !this.player.isGliding() && !worldserver.a(this.player.getBoundingBox().g(0.0625D).b(0.0D, -0.55D, 0.0D)); this.player.onGround = packetplayinflying.b(); this.player.getWorldServer().getChunkProvider().movePlayer(this.player); -@@ -712,10 +1013,66 @@ +@@ -713,10 +1014,66 @@ } public void a(double d0, double d1, double d2, float f, float f1) { @@ -575,7 +575,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; -@@ -727,6 +1084,14 @@ +@@ -728,6 +1085,14 @@ this.teleportAwait = 0; } @@ -590,15 +590,15 @@ this.A = this.e; this.player.setLocation(d0, d1, d2, f, f1); this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait)); -@@ -735,6 +1100,7 @@ +@@ -736,6 +1101,7 @@ @Override public void a(PacketPlayInBlockDig packetplayinblockdig) { PlayerConnectionUtils.ensureMainThread(packetplayinblockdig, this, this.player.getWorldServer()); + if (this.player.isFrozen()) return; // CraftBukkit - WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinblockdig.b(); -@@ -744,13 +1110,45 @@ + this.player.resetIdleTimer(); +@@ -746,13 +1112,45 @@ if (!this.player.isSpectator()) { ItemStack itemstack = this.player.b(EnumHand.OFF_HAND); @@ -646,29 +646,7 @@ this.player.n(false); } -@@ -781,7 +1179,15 @@ - if (!this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { - this.player.playerInteractManager.a(blockposition, packetplayinblockdig.c()); - } else { -+ // CraftBukkit start - fire PlayerInteractEvent -+ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, packetplayinblockdig.c(), this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND); - this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(worldserver, blockposition)); -+ // Update any tile entity data for this block -+ TileEntity tileentity = worldserver.getTileEntity(blockposition); -+ if (tileentity != null) { -+ this.player.playerConnection.sendPacket(tileentity.getUpdatePacket()); -+ } -+ // CraftBukkit end - } - } else { - if (packetplayinblockdig.d() == PacketPlayInBlockDig.EnumPlayerDigType.STOP_DESTROY_BLOCK) { -@@ -800,11 +1206,13 @@ - default: - throw new IllegalArgumentException("Invalid player action"); - } -+ // CraftBukkit end - } - +@@ -779,6 +1177,7 @@ @Override public void a(PacketPlayInUseItem packetplayinuseitem) { PlayerConnectionUtils.ensureMainThread(packetplayinuseitem, this, this.player.getWorldServer()); @@ -676,10 +654,10 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); EnumHand enumhand = packetplayinuseitem.b(); ItemStack itemstack = this.player.b(enumhand); -@@ -818,6 +1226,14 @@ +@@ -792,6 +1191,14 @@ this.player.playerConnection.sendPacket(new PacketPlayOutChat(ichatbasecomponent, ChatMessageType.GAME_INFO)); - } else if (this.teleportPos == null && this.player.e((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && !this.minecraftServer.a(worldserver, blockposition, this.player) && worldserver.getWorldBorder().a(blockposition)) { + } else if (this.teleportPos == null && this.player.e((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D) < 64.0D && worldserver.a((EntityHuman) this.player, blockposition)) { + // CraftBukkit start - Check if we can actually do something over this large a distance + Location eyeLoc = this.getPlayer().getEyeLocation(); + double reachDistance = NumberConversions.square(eyeLoc.getX() - blockposition.getX()) + NumberConversions.square(eyeLoc.getY() - blockposition.getY()) + NumberConversions.square(eyeLoc.getZ() - blockposition.getZ()); @@ -691,7 +669,7 @@ this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand, movingobjectpositionblock); } -@@ -828,13 +1244,53 @@ +@@ -802,13 +1209,53 @@ @Override public void a(PacketPlayInBlockPlace packetplayinblockplace) { PlayerConnectionUtils.ensureMainThread(packetplayinblockplace, this, this.player.getWorldServer()); @@ -746,7 +724,7 @@ } } -@@ -849,7 +1305,7 @@ +@@ -823,7 +1270,7 @@ Entity entity = packetplayinspectate.a(worldserver); if (entity != null) { @@ -755,7 +733,7 @@ return; } } -@@ -858,7 +1314,12 @@ +@@ -832,7 +1279,12 @@ } @Override @@ -769,7 +747,7 @@ @Override public void a(PacketPlayInBoatMove packetplayinboatmove) { -@@ -873,11 +1334,26 @@ +@@ -847,11 +1299,26 @@ @Override public void a(IChatBaseComponent ichatbasecomponent) { @@ -797,7 +775,7 @@ if (this.isExemptPlayer()) { PlayerConnection.LOGGER.info("Stopping singleplayer server as player logged out"); this.minecraftServer.safeShutdown(false); -@@ -903,6 +1379,15 @@ +@@ -877,6 +1344,15 @@ } } @@ -813,7 +791,7 @@ try { this.networkManager.sendPacket(packet, genericfuturelistener); } catch (Throwable throwable) { -@@ -919,18 +1404,38 @@ +@@ -893,18 +1369,38 @@ @Override public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) { PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.getWorldServer()); @@ -854,7 +832,7 @@ this.sendPacket(new PacketPlayOutChat((new ChatMessage("chat.cannotSend", new Object[0])).a(EnumChatFormat.RED))); } else { this.player.resetIdleTimer(); -@@ -940,41 +1445,257 @@ +@@ -914,41 +1410,257 @@ for (int i = 0; i < s.length(); ++i) { if (!SharedConstants.isAllowedChatCharacter(s.charAt(i))) { @@ -1119,7 +1097,7 @@ this.player.resetIdleTimer(); IJumpable ijumpable; -@@ -1038,6 +1759,7 @@ +@@ -1012,6 +1724,7 @@ @Override public void a(PacketPlayInUseEntity packetplayinuseentity) { PlayerConnectionUtils.ensureMainThread(packetplayinuseentity, this, this.player.getWorldServer()); @@ -1127,7 +1105,7 @@ WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); Entity entity = packetplayinuseentity.a((World) worldserver); -@@ -1053,20 +1775,74 @@ +@@ -1027,20 +1740,74 @@ if (this.player.h(entity) < d0) { EnumHand enumhand; @@ -1203,7 +1181,7 @@ } } } -@@ -1106,15 +1882,21 @@ +@@ -1080,15 +1847,21 @@ @Override public void a(PacketPlayInCloseWindow packetplayinclosewindow) { PlayerConnectionUtils.ensureMainThread(packetplayinclosewindow, this, this.player.getWorldServer()); @@ -1227,7 +1205,7 @@ NonNullList nonnulllist = NonNullList.a(); for (int i = 0; i < this.player.activeContainer.slots.size(); ++i) { -@@ -1123,8 +1905,274 @@ +@@ -1097,8 +1870,274 @@ this.player.a(this.player.activeContainer, nonnulllist); } else { @@ -1503,7 +1481,7 @@ if (ItemStack.matches(packetplayinwindowclick.f(), itemstack)) { this.player.playerConnection.sendPacket(new PacketPlayOutTransaction(packetplayinwindowclick.b(), packetplayinwindowclick.e(), true)); this.player.e = true; -@@ -1164,6 +2212,7 @@ +@@ -1138,6 +2177,7 @@ @Override public void a(PacketPlayInEnchantItem packetplayinenchantitem) { PlayerConnectionUtils.ensureMainThread(packetplayinenchantitem, this, this.player.getWorldServer()); @@ -1511,7 +1489,7 @@ this.player.resetIdleTimer(); if (this.player.activeContainer.windowId == packetplayinenchantitem.b() && this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { this.player.activeContainer.a((EntityHuman) this.player, packetplayinenchantitem.c()); -@@ -1196,6 +2245,43 @@ +@@ -1170,6 +2210,43 @@ boolean flag1 = packetplayinsetcreativeslot.b() >= 1 && packetplayinsetcreativeslot.b() <= 45; boolean flag2 = itemstack.isEmpty() || itemstack.getDamage() >= 0 && itemstack.getCount() <= 64 && !itemstack.isEmpty(); @@ -1555,7 +1533,7 @@ if (flag1 && flag2) { if (itemstack.isEmpty()) { -@@ -1221,6 +2307,7 @@ +@@ -1195,6 +2272,7 @@ @Override public void a(PacketPlayInTransaction packetplayintransaction) { PlayerConnectionUtils.ensureMainThread(packetplayintransaction, this, this.player.getWorldServer()); @@ -1563,7 +1541,7 @@ int i = this.player.activeContainer.windowId; if (i == packetplayintransaction.b() && this.k.getOrDefault(i, (short) (packetplayintransaction.c() + 1)) == packetplayintransaction.c() && !this.player.activeContainer.c(this.player) && !this.player.isSpectator()) { -@@ -1232,6 +2319,7 @@ +@@ -1206,6 +2284,7 @@ @Override public void a(PacketPlayInUpdateSign packetplayinupdatesign) { PlayerConnectionUtils.ensureMainThread(packetplayinupdatesign, this, this.player.getWorldServer()); @@ -1571,7 +1549,7 @@ this.player.resetIdleTimer(); WorldServer worldserver = this.minecraftServer.getWorldServer(this.player.dimension); BlockPosition blockposition = packetplayinupdatesign.b(); -@@ -1248,14 +2336,30 @@ +@@ -1222,14 +2301,30 @@ if (!tileentitysign.d() || tileentitysign.f() != this.player) { this.minecraftServer.warning("Player " + this.player.getDisplayName().getString() + " just tried to change non-editable sign"); @@ -1603,7 +1581,7 @@ tileentitysign.update(); worldserver.notify(blockposition, iblockdata, iblockdata, 3); -@@ -1265,6 +2369,7 @@ +@@ -1239,6 +2334,7 @@ @Override public void a(PacketPlayInKeepAlive packetplayinkeepalive) { @@ -1611,7 +1589,7 @@ if (this.awaitingKeepAlive && packetplayinkeepalive.b() == this.h) { int i = (int) (SystemUtils.getMonotonicMillis() - this.lastKeepAlive); -@@ -1279,7 +2384,17 @@ +@@ -1253,7 +2349,17 @@ @Override public void a(PacketPlayInAbilities packetplayinabilities) { PlayerConnectionUtils.ensureMainThread(packetplayinabilities, this, this.player.getWorldServer()); @@ -1630,7 +1608,7 @@ } @Override -@@ -1288,8 +2403,50 @@ +@@ -1262,8 +2368,50 @@ this.player.a(packetplayinsettings); } diff --git a/paper-server/nms-patches/PlayerConnectionUtils.patch b/paper-server/nms-patches/PlayerConnectionUtils.patch index a189c43803..d367e37279 100644 --- a/paper-server/nms-patches/PlayerConnectionUtils.patch +++ b/paper-server/nms-patches/PlayerConnectionUtils.patch @@ -1,10 +1,10 @@ --- a/net/minecraft/server/PlayerConnectionUtils.java +++ b/net/minecraft/server/PlayerConnectionUtils.java -@@ -9,6 +9,7 @@ +@@ -14,6 +14,7 @@ public static void ensureMainThread(Packet packet, T t0, IAsyncTaskHandler iasynctaskhandler) throws CancelledPacketHandleException { if (!iasynctaskhandler.isMainThread()) { iasynctaskhandler.execute(() -> { + if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) return; // CraftBukkit, MC-142590 - packet.a(t0); - }); - throw CancelledPacketHandleException.INSTANCE; + if (t0.a().isConnected()) { + packet.a(t0); + } else { diff --git a/paper-server/nms-patches/PlayerInteractManager.patch b/paper-server/nms-patches/PlayerInteractManager.patch index 321f074add..d2b3cac333 100644 --- a/paper-server/nms-patches/PlayerInteractManager.patch +++ b/paper-server/nms-patches/PlayerInteractManager.patch @@ -1,8 +1,9 @@ --- a/net/minecraft/server/PlayerInteractManager.java +++ b/net/minecraft/server/PlayerInteractManager.java -@@ -1,5 +1,15 @@ - package net.minecraft.server; +@@ -2,6 +2,15 @@ + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; +// CraftBukkit start +import java.util.ArrayList; +import org.bukkit.craftbukkit.block.CraftBlock; @@ -12,11 +13,10 @@ +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; +// CraftBukkit end -+ + public class PlayerInteractManager { - public WorldServer world; -@@ -26,7 +36,7 @@ +@@ -30,7 +39,7 @@ this.gamemode = enumgamemode; enumgamemode.a(this.player.abilities); this.player.updateAbilities(); @@ -25,107 +25,102 @@ this.world.everyoneSleeping(); } -@@ -51,7 +61,7 @@ +@@ -55,7 +64,7 @@ } public void a() { - ++this.currentTick; + this.currentTick = MinecraftServer.currentTick; // CraftBukkit; - float f; - int i; + IBlockData iblockdata; -@@ -96,6 +106,19 @@ - } + if (this.i) { +@@ -111,10 +120,32 @@ - public void a(BlockPosition blockposition, EnumDirection enumdirection) { -+ // CraftBukkit start -+ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND); -+ if (event.isCancelled()) { -+ // Let the client know the block still exists -+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); -+ // Update any tile entity data for this block -+ TileEntity tileentity = this.world.getTileEntity(blockposition); -+ if (tileentity != null) { -+ this.player.playerConnection.sendPacket(tileentity.getUpdatePacket()); -+ } -+ return; -+ } -+ // CraftBukkit end - if (this.isCreative()) { - if (!this.world.douseFire((EntityHuman) null, blockposition, enumdirection)) { - this.breakBlock(blockposition); -@@ -122,15 +145,49 @@ + if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.START_DESTROY_BLOCK) { + if (!this.world.a((EntityHuman) this.player, blockposition)) { ++ // CraftBukkit start - fire PlayerInteractEvent ++ CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND); + this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false)); ++ // Update any tile entity data for this block ++ TileEntity tileentity = world.getTileEntity(blockposition); ++ if (tileentity != null) { ++ this.player.playerConnection.sendPacket(tileentity.getUpdatePacket()); ++ } ++ // CraftBukkit end + return; } - } -- this.world.douseFire((EntityHuman) null, blockposition, enumdirection); -+ // this.world.douseFire((EntityHuman) null, blockposition, enumdirection); // CraftBukkit - Moved down - this.lastDigTick = this.currentTick; - float f = 1.0F; - IBlockData iblockdata = this.world.getType(blockposition); - -- if (!iblockdata.isAir()) { -+ // CraftBukkit start - Swings at air do *NOT* exist. -+ if (event.useInteractedBlock() == Event.Result.DENY) { -+ // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door. -+ IBlockData data = this.world.getType(blockposition); -+ if (data.getBlock() instanceof BlockDoor) { -+ // For some reason *BOTH* the bottom/top part have to be marked updated. -+ boolean bottom = data.get(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER; -+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); -+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, bottom ? blockposition.up() : blockposition.down())); -+ } else if (data.getBlock() instanceof BlockTrapdoor) { -+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); ++ // CraftBukkit start ++ PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND); ++ if (event.isCancelled()) { ++ // Let the client know the block still exists ++ this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false)); ++ // Update any tile entity data for this block ++ TileEntity tileentity = this.world.getTileEntity(blockposition); ++ if (tileentity != null) { ++ this.player.playerConnection.sendPacket(tileentity.getUpdatePacket()); ++ } ++ return; + } -+ } else if (!iblockdata.isAir()) { - iblockdata.attack(this.world, blockposition, this.player); - f = iblockdata.getDamage(this.player, this.player.world, blockposition); -+ // Allow fire punching to be blocked -+ this.world.douseFire((EntityHuman) null, blockposition, enumdirection); -+ } ++ // CraftBukkit end + -+ if (event.useItemInHand() == Event.Result.DENY) { -+ // If we 'insta destroyed' then the client needs to be informed. -+ if (f > 1.0f) { -+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); -+ } -+ return; -+ } -+ org.bukkit.event.block.BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.player, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.player.inventory.getItemInHand(), f >= 1.0f); -+ -+ if (blockEvent.isCancelled()) { -+ // Let the client know the block still exists -+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); -+ return; -+ } -+ -+ if (blockEvent.getInstaBreak()) { -+ f = 2.0f; - } -+ // CraftBukkit end - - if (!iblockdata.isAir() && f >= 1.0F) { - this.breakBlock(blockposition); -@@ -149,6 +206,7 @@ - - public void a(BlockPosition blockposition) { - if (blockposition.equals(this.f)) { -+ this.currentTick = MinecraftServer.currentTick; // CraftBukkit - int i = this.currentTick - this.lastDigTick; - IBlockData iblockdata = this.world.getType(blockposition); - -@@ -166,6 +224,10 @@ - this.j = this.lastDigTick; + if (this.isCreative()) { + if (!this.world.douseFire((EntityHuman) null, blockposition, enumdirection)) { + this.a(blockposition, packetplayinblockdig_enumplayerdigtype); +@@ -130,16 +161,50 @@ + return; } - } -+ // CraftBukkit start - Force block reset to client -+ } else { -+ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); -+ // CraftBukkit end - } - } -@@ -190,10 +252,66 @@ +- this.world.douseFire((EntityHuman) null, blockposition, enumdirection); ++ // this.world.douseFire((EntityHuman) null, blockposition, enumdirection); // CraftBukkit - Moved down + this.lastDigTick = this.currentTick; + float f = 1.0F; + + iblockdata = this.world.getType(blockposition); +- if (!iblockdata.isAir()) { ++ // CraftBukkit start - Swings at air do *NOT* exist. ++ if (event.useInteractedBlock() == Event.Result.DENY) { ++ // If we denied a door from opening, we need to send a correcting update to the client, as it already opened the door. ++ IBlockData data = this.world.getType(blockposition); ++ if (data.getBlock() instanceof BlockDoor) { ++ // For some reason *BOTH* the bottom/top part have to be marked updated. ++ boolean bottom = data.get(BlockDoor.HALF) == BlockPropertyDoubleBlockHalf.LOWER; ++ this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false)); ++ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, bottom ? blockposition.up() : blockposition.down())); ++ } else if (data.getBlock() instanceof BlockTrapdoor) { ++ this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false)); ++ } ++ } else if (!iblockdata.isAir()) { + iblockdata.attack(this.world, blockposition, this.player); + f = iblockdata.getDamage(this.player, this.player.world, blockposition); ++ // Allow fire punching to be blocked ++ this.world.douseFire((EntityHuman) null, blockposition, enumdirection); + } + ++ if (event.useItemInHand() == Event.Result.DENY) { ++ // If we 'insta destroyed' then the client needs to be informed. ++ if (f > 1.0f) { ++ this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false)); ++ } ++ return; ++ } ++ org.bukkit.event.block.BlockDamageEvent blockEvent = CraftEventFactory.callBlockDamageEvent(this.player, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.player.inventory.getItemInHand(), f >= 1.0f); ++ ++ if (blockEvent.isCancelled()) { ++ // Let the client know the block still exists ++ this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, false)); ++ return; ++ } ++ ++ if (blockEvent.getInstaBreak()) { ++ f = 2.0f; ++ } ++ // CraftBukkit end ++ + if (!iblockdata.isAir() && f >= 1.0F) { + this.a(blockposition, packetplayinblockdig_enumplayerdigtype); + } else { +@@ -196,10 +261,66 @@ public boolean breakBlock(BlockPosition blockposition) { IBlockData iblockdata = this.world.getType(blockposition); @@ -142,7 +137,7 @@ + if (world.getTileEntity(blockposition) == null && !isSwordNoBreak) { + PacketPlayOutBlockChange packet = new PacketPlayOutBlockChange(this.world, blockposition); + packet.block = Blocks.AIR.getBlockData(); -+ ((EntityPlayer) this.player).playerConnection.sendPacket(packet); ++ this.player.playerConnection.sendPacket(packet); + } + + event = new BlockBreakEvent(bblock, this.player.getBukkitEntity()); @@ -168,11 +163,11 @@ + return false; + } + // Let the client know the block still exists -+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); ++ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); + + // Brute force all possible updates + for (EnumDirection dir : EnumDirection.values()) { -+ ((EntityPlayer) this.player).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition.shift(dir))); ++ this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition.shift(dir))); + } + + // Update any tile entity data for this block @@ -193,47 +188,55 @@ TileEntity tileentity = this.world.getTileEntity(blockposition); Block block = iblockdata.getBlock(); -@@ -221,6 +339,10 @@ - } - } - +@@ -209,6 +330,10 @@ + } else if (this.player.a((World) this.world, blockposition, this.gamemode)) { + return false; + } else { + // CraftBukkit start + org.bukkit.block.BlockState state = bblock.getState(); + world.captureDrops = new ArrayList<>(); + // CraftBukkit end - boolean flag = this.c(blockposition); + block.a((World) this.world, blockposition, iblockdata, (EntityHuman) this.player); + boolean flag = this.world.a(blockposition, false); - if (!this.isCreative()) { -@@ -228,13 +350,27 @@ - boolean flag1 = this.player.hasBlock(iblockdata); - - itemstack1.a(this.world, iblockdata, blockposition, this.player); -- if (flag && flag1) { -+ // CraftBukkit start - Check if block should drop items -+ if (flag && flag1 && event.isDropItems()) { - ItemStack itemstack2 = itemstack1.isEmpty() ? ItemStack.a : itemstack1.cloneItemStack(); - - iblockdata.getBlock().a(this.world, this.player, blockposition, iblockdata, tileentity, itemstack2); - } -+ // CraftBukkit end +@@ -217,20 +342,33 @@ } + if (this.isCreative()) { +- return true; ++ // return true; // CraftBukkit + } else { + ItemStack itemstack = this.player.getItemInMainHand(); + boolean flag1 = this.player.hasBlock(iblockdata); + + itemstack.a(this.world, iblockdata, blockposition, this.player); +- if (flag && flag1) { ++ if (flag && flag1 && event.isDropItems()) { // CraftBukkit - Check if block should drop items + ItemStack itemstack1 = itemstack.isEmpty() ? ItemStack.a : itemstack.cloneItemStack(); + + block.a(this.world, this.player, blockposition, iblockdata, tileentity, itemstack1); + } + +- return true; ++ // return true; // CraftBukkit ++ } ++ // CraftBukkit start + if (event.isDropItems()) { + org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockDropItemEvent(bblock, state, this.player, world.captureDrops); + } + world.captureDrops = null; -+ // CraftBukkit end + -+ // CraftBukkit start - Drop event experience ++ // Drop event experience + if (flag && event != null) { + iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop()); -+ } -+ // CraftBukkit end + } + - return flag; ++ return true; ++ // CraftBukkit end } } -@@ -277,12 +413,41 @@ + } +@@ -272,12 +410,41 @@ } } @@ -252,7 +255,7 @@ + cancelledBlock = !(itileinventory instanceof ITileInventory); + } + -+ if (entityhuman.getCooldownTracker().a(itemstack.getItem())) { ++ if (entityhuman.getCooldownTracker().hasCooldown(itemstack.getItem())) { + cancelledBlock = true; + } + @@ -275,13 +278,13 @@ if (itileinventory != null) { entityhuman.openContainer(itileinventory); -@@ -294,24 +459,26 @@ +@@ -289,24 +456,26 @@ boolean flag = !entityhuman.getItemInMainHand().isEmpty() || !entityhuman.getItemInOffHand().isEmpty(); boolean flag1 = entityhuman.isSneaking() && flag; - if (!flag1 && iblockdata.interact(world, entityhuman, enumhand, movingobjectpositionblock)) { - return EnumInteractionResult.SUCCESS; -- } else if (!itemstack.isEmpty() && !entityhuman.getCooldownTracker().a(itemstack.getItem())) { +- } else if (!itemstack.isEmpty() && !entityhuman.getCooldownTracker().hasCooldown(itemstack.getItem())) { + if (!flag1) { + enuminteractionresult = iblockdata.interact(world, entityhuman, enumhand, movingobjectpositionblock) ? EnumInteractionResult.SUCCESS : EnumInteractionResult.FAIL; + } diff --git a/paper-server/nms-patches/Raid.patch b/paper-server/nms-patches/Raid.patch deleted file mode 100644 index 75c2ea0dcf..0000000000 --- a/paper-server/nms-patches/Raid.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- a/net/minecraft/server/Raid.java -+++ b/net/minecraft/server/Raid.java -@@ -137,14 +137,14 @@ - private void y() { - Collection collection = this.r.getPlayers(); - Set set = Sets.newHashSet(collection); -- Iterator iterator = collection.iterator(); -+ Iterator iterator = set.iterator(); // CraftBukkit - - while (iterator.hasNext()) { - EntityPlayer entityplayer = (EntityPlayer) iterator.next(); - BlockPosition blockposition = new BlockPosition(entityplayer); - - if (this.k.c_(blockposition) != this) { -- set.remove(entityplayer); -+ iterator.remove(); // CraftBukkit - this.r.removePlayer(entityplayer); - } - } diff --git a/paper-server/nms-patches/SpawnerCreature.patch b/paper-server/nms-patches/SpawnerCreature.patch index cf4e010396..7bd0fe1c08 100644 --- a/paper-server/nms-patches/SpawnerCreature.patch +++ b/paper-server/nms-patches/SpawnerCreature.patch @@ -11,23 +11,23 @@ public final class SpawnerCreature { private static final Logger LOGGER = LogManager.getLogger(); -@@ -85,9 +89,12 @@ - entityinsentient.setPositionRotation((double) f, (double) k, (double) f1, world.random.nextFloat() * 360.0F, 0.0F); - if ((entityhuman.e((double) f, (double) k, (double) f1) <= 16384.0D || !entityinsentient.isTypeNotPersistent(entityhuman.e((double) f, (double) k, (double) f1))) && entityinsentient.a((GeneratorAccess) world, EnumMobSpawn.NATURAL) && entityinsentient.a((IWorldReader) world)) { - groupdataentity = entityinsentient.prepare(world, world.getDamageScaler(new BlockPosition(entityinsentient)), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null); -- ++i; -- ++i2; -- world.addEntity(entityinsentient); -+ // CraftBukkit start -+ if (world.addEntity(entityinsentient, SpawnReason.NATURAL)) { -+ ++i; -+ ++i2; -+ } -+ // CraftBukkit end - if (i >= entityinsentient.dD()) { - return; - } -@@ -212,7 +219,7 @@ +@@ -88,9 +92,12 @@ + entityinsentient.setPositionRotation((double) f, (double) k, (double) f1, world.random.nextFloat() * 360.0F, 0.0F); + if ((d0 <= 16384.0D || !entityinsentient.isTypeNotPersistent(d0)) && entityinsentient.a((GeneratorAccess) world, EnumMobSpawn.NATURAL) && entityinsentient.a((IWorldReader) world)) { + groupdataentity = entityinsentient.prepare(world, world.getDamageScaler(new BlockPosition(entityinsentient)), EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null); +- ++i; +- ++i2; +- world.addEntity(entityinsentient); ++ // CraftBukkit start ++ if (world.addEntity(entityinsentient, SpawnReason.NATURAL)) { ++ ++i; ++ ++i2; ++ } ++ // CraftBukkit end + if (i >= entityinsentient.dC()) { + return; + } +@@ -216,7 +223,7 @@ if (entityinsentient.a(generatoraccess, EnumMobSpawn.CHUNK_GENERATION) && entityinsentient.a((IWorldReader) generatoraccess)) { groupdataentity = entityinsentient.prepare(generatoraccess, generatoraccess.getDamageScaler(new BlockPosition(entityinsentient)), EnumMobSpawn.CHUNK_GENERATION, groupdataentity, (NBTTagCompound) null); diff --git a/paper-server/nms-patches/TagRegistry.patch b/paper-server/nms-patches/TagRegistry.patch index 49f39b3572..68a959f8ce 100644 --- a/paper-server/nms-patches/TagRegistry.patch +++ b/paper-server/nms-patches/TagRegistry.patch @@ -1,23 +1,23 @@ --- a/net/minecraft/server/TagRegistry.java +++ b/net/minecraft/server/TagRegistry.java @@ -58,7 +58,7 @@ - CompletableFuture>> completablefuture1 = this.b.a(iresourcemanager, executor); - CompletableFuture>> completablefuture2 = this.c.a(iresourcemanager, executor); - CompletableFuture>>> completablefuture3 = this.d.a(iresourcemanager, executor); + CompletableFuture>> completablefuture1 = this.itemTags.a(iresourcemanager, executor); + CompletableFuture>> completablefuture2 = this.fluidTags.a(iresourcemanager, executor); + CompletableFuture>>> completablefuture3 = this.entityTags.a(iresourcemanager, executor); - CompletableFuture completablefuture4 = completablefuture.thenCombine(completablefuture1, Pair::of).thenCombine(completablefuture2.thenCombine(completablefuture3, Pair::of), (pair, pair1) -> { + CompletableFuture completablefuture4 = completablefuture.thenCombine(completablefuture1, Pair::of).thenCombine(completablefuture2.thenCombine(completablefuture3, Pair::of), (pair, pair1) -> { // CraftBukkit - decompile error return new TagRegistry.a((Map) pair.getFirst(), (Map) pair.getSecond(), (Map) pair1.getFirst(), (Map) pair1.getSecond()); }); @@ -72,6 +72,12 @@ - TagsItem.a((Tags) this.b); - TagsFluid.a((Tags) this.c); - TagsEntity.a((Tags) this.d); + TagsItem.a((Tags) this.itemTags); + TagsFluid.a((Tags) this.fluidTags); + TagsEntity.a((Tags) this.entityTags); + // CraftBukkit start -+ this.a.version++; -+ this.b.version++; -+ this.c.version++; -+ this.d.version++; ++ this.blockTags.version++; ++ this.itemTags.version++; ++ this.fluidTags.version++; ++ this.entityTags.version++; + // CraftBukkit end }, executor1); } diff --git a/paper-server/nms-patches/TickListServer.patch b/paper-server/nms-patches/TickListServer.patch index 5571924416..ab993d7a94 100644 --- a/paper-server/nms-patches/TickListServer.patch +++ b/paper-server/nms-patches/TickListServer.patch @@ -1,7 +1,7 @@ --- a/net/minecraft/server/TickListServer.java +++ b/net/minecraft/server/TickListServer.java @@ -39,11 +39,17 @@ - public void a() { + public void b() { int i = this.nextTickList.size(); - if (i != this.nextTickListHash.size()) { diff --git a/paper-server/nms-patches/Ticket.patch b/paper-server/nms-patches/Ticket.patch deleted file mode 100644 index aa2c539482..0000000000 --- a/paper-server/nms-patches/Ticket.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/net/minecraft/server/Ticket.java -+++ b/net/minecraft/server/Ticket.java -@@ -6,7 +6,7 @@ - - private final TicketType a; - private final int b; -- private final T c; -+ public final T c; // CraftBukkit - private -> public // PAIL identifier - private final long d; - - protected Ticket(TicketType tickettype, int i, T t0, long j) { -@@ -24,7 +24,7 @@ - } else { - int j = Integer.compare(System.identityHashCode(this.a), System.identityHashCode(ticket.a)); - -- return j != 0 ? j : this.a.a().compare(this.c, ticket.c); -+ return j != 0 ? j : this.a.a().compare(this.c, (T) ticket.c); // CraftBukkit - decompile error - } - } - diff --git a/paper-server/nms-patches/TicketType.patch b/paper-server/nms-patches/TicketType.patch index 0ccbf0697f..96325e6082 100644 --- a/paper-server/nms-patches/TicketType.patch +++ b/paper-server/nms-patches/TicketType.patch @@ -1,14 +1,5 @@ --- a/net/minecraft/server/TicketType.java +++ b/net/minecraft/server/TicketType.java -@@ -6,7 +6,7 @@ - - private final String i; - private final Comparator j; -- private final long k; -+ private long k; // PAIL - public static final TicketType START = a("start", (unit, unit1) -> { - return 0; - }); @@ -19,6 +19,8 @@ public static final TicketType PORTAL = a("portal", Comparator.comparingLong(BlockPosition2D::b)); public static final TicketType POST_TELEPORT = a("post_teleport", Integer::compareTo, 5); @@ -18,14 +9,3 @@ public static TicketType a(String s, Comparator comparator) { return new TicketType<>(s, comparator, 0L); -@@ -45,4 +47,10 @@ - public long b() { - return this.k; - } -+ -+ // CraftBukkit start -+ public void setLoadPeriod(int ticks) { -+ this.k = ticks; -+ } -+ // CraftBukkit end - } diff --git a/paper-server/nms-patches/TileEntityBeacon.patch b/paper-server/nms-patches/TileEntityBeacon.patch index 242a143a05..4ef4276fe8 100644 --- a/paper-server/nms-patches/TileEntityBeacon.patch +++ b/paper-server/nms-patches/TileEntityBeacon.patch @@ -30,7 +30,7 @@ public TileEntityBeacon() { super(TileEntityTypes.BEACON); -@@ -192,39 +208,78 @@ +@@ -194,39 +210,78 @@ super.V_(); } @@ -117,9 +117,9 @@ + // CraftBukkit end + public void a(SoundEffect soundeffect) { - this.world.a((EntityHuman) null, this.position, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F); + this.world.playSound((EntityHuman) null, this.position, soundeffect, SoundCategory.BLOCKS, 1.0F, 1.0F); } -@@ -254,8 +309,11 @@ +@@ -256,8 +311,11 @@ @Override public void load(NBTTagCompound nbttagcompound) { super.load(nbttagcompound); diff --git a/paper-server/nms-patches/TileEntityConduit.patch b/paper-server/nms-patches/TileEntityConduit.patch index 07f2785d81..3c1027d3e9 100644 --- a/paper-server/nms-patches/TileEntityConduit.patch +++ b/paper-server/nms-patches/TileEntityConduit.patch @@ -33,12 +33,12 @@ } if (this.target != null) { -- this.world.a((EntityHuman) null, this.target.locX, this.target.locY, this.target.locZ, SoundEffects.BLOCK_CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F); +- this.world.playSound((EntityHuman) null, this.target.locX, this.target.locY, this.target.locZ, SoundEffects.BLOCK_CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F); - this.target.damageEntity(DamageSource.MAGIC, 4.0F); + // CraftBukkit start + CraftEventFactory.blockDamage = CraftBlock.at(this.world, this.position); + if (this.target.damageEntity(DamageSource.MAGIC, 4.0F)) { -+ this.world.a((EntityHuman) null, this.target.locX, this.target.locY, this.target.locZ, SoundEffects.BLOCK_CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F); ++ this.world.playSound((EntityHuman) null, this.target.locX, this.target.locY, this.target.locZ, SoundEffects.BLOCK_CONDUIT_ATTACK_TARGET, SoundCategory.BLOCKS, 1.0F, 1.0F); + } + CraftEventFactory.blockDamage = null; + // CraftBukkit end diff --git a/paper-server/nms-patches/TileEntityLectern.patch b/paper-server/nms-patches/TileEntityLectern.patch index ab0cc68726..d670e06b34 100644 --- a/paper-server/nms-patches/TileEntityLectern.patch +++ b/paper-server/nms-patches/TileEntityLectern.patch @@ -130,7 +130,7 @@ } @Override -@@ -206,7 +293,7 @@ +@@ -211,7 +298,7 @@ @Override public Container createMenu(int i, PlayerInventory playerinventory, EntityHuman entityhuman) { diff --git a/paper-server/nms-patches/VillageSiege.patch b/paper-server/nms-patches/VillageSiege.patch index 90e01b9a54..9567f53873 100644 --- a/paper-server/nms-patches/VillageSiege.patch +++ b/paper-server/nms-patches/VillageSiege.patch @@ -1,11 +1,11 @@ --- a/net/minecraft/server/VillageSiege.java +++ b/net/minecraft/server/VillageSiege.java -@@ -101,7 +101,7 @@ +@@ -104,7 +104,7 @@ } - entityzombie.setPositionRotation(vec3d.x, vec3d.y, vec3d.z, this.a.random.nextFloat() * 360.0F, 0.0F); -- this.a.addEntity(entityzombie); -+ this.a.addEntity(entityzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_INVASION); // CraftBukkit + entityzombie.setPositionRotation(vec3d.x, vec3d.y, vec3d.z, worldserver.random.nextFloat() * 360.0F, 0.0F); +- worldserver.addEntity(entityzombie); ++ worldserver.addEntity(entityzombie, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.VILLAGE_INVASION); // CraftBukkit } } diff --git a/paper-server/nms-patches/World.patch b/paper-server/nms-patches/World.patch index e984db18f6..1af8ae4075 100644 --- a/paper-server/nms-patches/World.patch +++ b/paper-server/nms-patches/World.patch @@ -171,7 +171,7 @@ + /* if (iblockdata2 == iblockdata) { if (iblockdata1 != iblockdata2) { - this.m(blockposition); + this.b(blockposition, iblockdata1, iblockdata2); @@ -165,12 +289,65 @@ this.a(blockposition, iblockdata1, iblockdata2); @@ -197,7 +197,7 @@ + IBlockData iblockdata2 = actualBlock; + if (iblockdata2 == iblockdata) { + if (iblockdata1 != iblockdata2) { -+ this.m(blockposition); ++ this.b(blockposition, iblockdata1, iblockdata2); + } + + if ((i & 2) != 0 && (!this.isClientSide || (i & 4) == 0) && (this.isClientSide || chunk == null || (chunk.getState() != null && chunk.getState().isAtLeast(PlayerChunk.State.TICKING)))) { // allow chunk to be null here as chunk.isReady() is false when we send our notification during block placement diff --git a/paper-server/nms-patches/WorldServer.patch b/paper-server/nms-patches/WorldServer.patch index f0d1380f75..c0a8a3c10f 100644 --- a/paper-server/nms-patches/WorldServer.patch +++ b/paper-server/nms-patches/WorldServer.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/WorldServer.java +++ b/net/minecraft/server/WorldServer.java -@@ -30,6 +30,15 @@ +@@ -34,6 +34,15 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -16,7 +16,7 @@ public class WorldServer extends World { private static final Logger LOGGER = LogManager.getLogger(); -@@ -55,12 +64,29 @@ +@@ -58,12 +67,29 @@ @Nullable private final MobSpawnerTrader mobSpawnerTrader; @@ -49,7 +49,7 @@ this.nextTickListBlock = new TickListServer<>(this, (block) -> { return block == null || block.getBlockData().isAir(); }, IRegistry.BLOCK::getKey, IRegistry.BLOCK::get, this::b); -@@ -83,7 +109,8 @@ +@@ -85,7 +111,8 @@ this.getWorldData().setGameType(minecraftserver.getGamemode()); } @@ -59,7 +59,7 @@ } public void doTick(BooleanSupplier booleansupplier) { -@@ -160,6 +187,7 @@ +@@ -162,6 +189,7 @@ this.rainLevel = MathHelper.a(this.rainLevel, 0.0F, 1.0F); } @@ -67,7 +67,7 @@ if (this.lastRainLevel != this.rainLevel) { this.server.getPlayerList().a((Packet) (new PacketPlayOutGameStateChange(7, this.rainLevel)), this.worldProvider.getDimensionManager()); } -@@ -178,13 +206,34 @@ +@@ -180,13 +208,34 @@ this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(7, this.rainLevel)); this.server.getPlayerList().sendAll(new PacketPlayOutGameStateChange(8, this.thunderLevel)); } @@ -97,11 +97,11 @@ this.getWorldData().setDifficulty(EnumDifficulty.HARD); } - if (this.D && this.players.stream().noneMatch((entityplayer) -> { + if (this.C && this.players.stream().noneMatch((entityplayer) -> { - return !entityplayer.isSpectator() && !entityplayer.isDeeplySleeping(); + return !entityplayer.isSpectator() && !entityplayer.isDeeplySleeping() && !entityplayer.fauxSleeping; // CraftBukkit })) { - this.D = false; + this.C = false; if (this.getGameRules().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) { @@ -225,7 +274,7 @@ this.ae(); @@ -266,25 +266,17 @@ } protected void k_() throws ExceptionWorldConflict { -@@ -715,8 +811,16 @@ +@@ -719,7 +815,8 @@ + if (entity instanceof EntityInsentient) { + EntityInsentient entityinsentient = (EntityInsentient) entity; - while (objectiterator.hasNext()) { - Entity entity = (Entity) objectiterator.next(); -+ // CraftBukkit start - Split out persistent check, don't apply it to special persistent mobs -+ if (entity instanceof EntityInsentient) { -+ EntityInsentient entityinsentient = (EntityInsentient) entity; +- if (entityinsentient.isPersistent() || entityinsentient.I()) { ++ // CraftBukkit - Split out persistent check, don't apply it to special persistent mobs + if (entityinsentient.isTypeNotPersistent(0) && entityinsentient.isPersistent()) { -+ continue; -+ } -+ } - -- if (!(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) { -+ if (true || !(entity instanceof EntityInsentient) || !((EntityInsentient) entity).isPersistent()) { -+ // CraftBukkit end - EnumCreatureType enumcreaturetype = entity.getEntityType().d(); - - if (enumcreaturetype != EnumCreatureType.MISC && this.getChunkProvider().b(entity)) { -@@ -730,11 +834,24 @@ + continue; + } + } +@@ -736,11 +833,24 @@ @Override public boolean addEntity(Entity entity) { @@ -311,7 +303,7 @@ } public void addEntityTeleport(Entity entity) { -@@ -784,13 +901,18 @@ +@@ -790,13 +900,18 @@ this.registerEntity(entityplayer); } @@ -332,7 +324,7 @@ IChunkAccess ichunkaccess = this.getChunkAt(MathHelper.floor(entity.locX / 16.0D), MathHelper.floor(entity.locZ / 16.0D), ChunkStatus.FULL, entity.attachedToPlayer); if (!(ichunkaccess instanceof Chunk)) { -@@ -818,7 +940,7 @@ +@@ -824,7 +939,7 @@ if (entity1 == null) { return false; } else { @@ -341,23 +333,23 @@ return true; } } -@@ -873,6 +995,7 @@ - this.I.remove(((EntityInsentient) entity).getNavigation()); +@@ -879,6 +994,7 @@ + this.H.remove(((EntityInsentient) entity).getNavigation()); } + entity.valid = false; // CraftBukkit } private void registerEntity(Entity entity) { -@@ -896,6 +1019,7 @@ +@@ -902,6 +1018,7 @@ if (entity instanceof EntityInsentient) { - this.I.add(((EntityInsentient) entity).getNavigation()); + this.H.add(((EntityInsentient) entity).getNavigation()); } + entity.valid = true; // CraftBukkit } } -@@ -926,6 +1050,18 @@ +@@ -932,6 +1049,18 @@ } public void strikeLightning(EntityLightning entitylightning) { @@ -376,7 +368,7 @@ this.globalEntityList.add(entitylightning); this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX, entitylightning.locY, entitylightning.locZ, 512.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutSpawnEntityWeather(entitylightning)); } -@@ -934,6 +1070,12 @@ +@@ -940,6 +1069,12 @@ public void a(int i, BlockPosition blockposition, int j) { Iterator iterator = this.server.getPlayerList().getPlayers().iterator(); @@ -389,7 +381,7 @@ while (iterator.hasNext()) { EntityPlayer entityplayer = (EntityPlayer) iterator.next(); -@@ -942,6 +1084,12 @@ +@@ -948,6 +1083,12 @@ double d1 = (double) blockposition.getY() - entityplayer.locY; double d2 = (double) blockposition.getZ() - entityplayer.locZ; @@ -402,7 +394,7 @@ if (d0 * d0 + d1 * d1 + d2 * d2 < 1024.0D) { entityplayer.playerConnection.sendPacket(new PacketPlayOutBlockBreakAnimation(i, blockposition, j)); } -@@ -1002,6 +1150,14 @@ +@@ -1008,6 +1149,14 @@ @Override public Explosion createExplosion(@Nullable Entity entity, DamageSource damagesource, double d0, double d1, double d2, float f, boolean flag, Explosion.Effect explosion_effect) { @@ -417,7 +409,7 @@ Explosion explosion = new Explosion(this, entity, d0, d1, d2, f, flag, explosion_effect); if (damagesource != null) { -@@ -1010,6 +1166,8 @@ +@@ -1016,6 +1165,8 @@ explosion.a(); explosion.a(false); @@ -426,7 +418,7 @@ if (explosion_effect == Explosion.Effect.NONE) { explosion.clearBlocks(); } -@@ -1074,13 +1232,20 @@ +@@ -1080,13 +1231,20 @@ } public int a(T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) { @@ -449,7 +441,7 @@ ++j; } } -@@ -1163,7 +1328,13 @@ +@@ -1169,7 +1327,13 @@ @Override public WorldMap a(String s) { return (WorldMap) this.getMinecraftServer().getWorldServer(DimensionManager.OVERWORLD).getWorldPersistentData().b(() -> { diff --git a/paper-server/pom.xml b/paper-server/pom.xml index 16074c4e70..98406afa98 100644 --- a/paper-server/pom.xml +++ b/paper-server/pom.xml @@ -4,7 +4,7 @@ org.bukkit craftbukkit jar - 1.14.3-R0.1-SNAPSHOT + 1.14.4-R0.1-SNAPSHOT CraftBukkit https://www.spigotmc.org/ @@ -12,7 +12,7 @@ true UTF-8 unknown - 1.14.3 + 1.14.4 1_14_R1 git-Bukkit- @@ -56,7 +56,7 @@ org.xerial sqlite-jdbc - 3.27.2.1 + 3.28.0 runtime diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftParticle.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftParticle.java index 179b267dc2..99377033b8 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftParticle.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftParticle.java @@ -151,7 +151,7 @@ public enum CraftParticle { } public static Particle toBukkit(net.minecraft.server.ParticleParam nms) { - return toBukkit(nms.b()); + return toBukkit(nms.getParticle()); } public static Particle toBukkit(net.minecraft.server.Particle nms) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 3eb989657f..7c32c967f9 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -306,7 +306,7 @@ public final class CraftServer implements Server { ambientSpawn = configuration.getInt("spawn-limits.ambient"); console.autosavePeriod = configuration.getInt("ticks-per.autosave"); warningState = WarningState.value(configuration.getString("settings.deprecated-verbose")); - TicketType.PLUGIN.setLoadPeriod(configuration.getInt("chunk-gc.period-in-ticks")); + TicketType.PLUGIN.loadPeriod = configuration.getInt("chunk-gc.period-in-ticks"); minimumAPI = configuration.getString("settings.minimum-api"); loadIcon(); } @@ -717,7 +717,7 @@ public final class CraftServer implements Server { waterAnimalSpawn = configuration.getInt("spawn-limits.water-animals"); ambientSpawn = configuration.getInt("spawn-limits.ambient"); warningState = WarningState.value(configuration.getString("settings.deprecated-verbose")); - TicketType.PLUGIN.setLoadPeriod(configuration.getInt("chunk-gc.period-in-ticks")); + TicketType.PLUGIN.loadPeriod = configuration.getInt("chunk-gc.period-in-ticks"); minimumAPI = configuration.getString("settings.minimum-api"); printSaveWarning = false; console.autosavePeriod = configuration.getInt("ticks-per.autosave"); @@ -1826,11 +1826,11 @@ public final class CraftServer implements Server { case org.bukkit.Tag.REGISTRY_BLOCKS: Preconditions.checkArgument(clazz == org.bukkit.Material.class, "Block namespace must have material type"); - return (org.bukkit.Tag) new CraftBlockTag(console.getTagRegistry().a(), key); + return (org.bukkit.Tag) new CraftBlockTag(console.getTagRegistry().getBlockTags(), key); case org.bukkit.Tag.REGISTRY_ITEMS: Preconditions.checkArgument(clazz == org.bukkit.Material.class, "Item namespace must have material type"); - return (org.bukkit.Tag) new CraftItemTag(console.getTagRegistry().b(), key); + return (org.bukkit.Tag) new CraftItemTag(console.getTagRegistry().getItemTags(), key); default: throw new IllegalArgumentException(); } @@ -1843,12 +1843,12 @@ public final class CraftServer implements Server { case org.bukkit.Tag.REGISTRY_BLOCKS: Preconditions.checkArgument(clazz == org.bukkit.Material.class, "Block namespace must have material type"); - TagsServer blockTags = console.getTagRegistry().a(); // PAIL: getBlockTags + TagsServer blockTags = console.getTagRegistry().getBlockTags(); return blockTags.b().keySet().stream().map(key -> (org.bukkit.Tag) new CraftBlockTag(blockTags, key)).collect(ImmutableList.toImmutableList()); case org.bukkit.Tag.REGISTRY_ITEMS: Preconditions.checkArgument(clazz == org.bukkit.Material.class, "Item namespace must have material type"); - TagsServer itemTags = console.getTagRegistry().b(); // PAIL: getItemTags + TagsServer itemTags = console.getTagRegistry().getItemTags(); return itemTags.b().keySet().stream().map(key -> (org.bukkit.Tag) new CraftItemTag(itemTags, key)).collect(ImmutableList.toImmutableList()); default: throw new IllegalArgumentException(); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftStatistic.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftStatistic.java index 7d5290526e..4536b70dc0 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftStatistic.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftStatistic.java @@ -113,8 +113,8 @@ public enum CraftStatistic { } public static org.bukkit.Statistic getBukkitStatistic(net.minecraft.server.Statistic statistic) { - IRegistry statRegistry = statistic.a().a(); - MinecraftKey nmsKey = IRegistry.STATS.getKey(statistic.a()); + IRegistry statRegistry = statistic.getWrapper().getRegistry(); + MinecraftKey nmsKey = IRegistry.STATS.getKey(statistic.getWrapper()); if (statRegistry == IRegistry.CUSTOM_STAT) { nmsKey = (MinecraftKey) statistic.b(); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 161bed2982..3c77c2b496 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -482,7 +482,7 @@ public class CraftWorld implements World { Preconditions.checkArgument(plugin != null, "null plugin"); Preconditions.checkArgument(plugin.isEnabled(), "plugin is not enabled"); - ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.u; + ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.chunkDistanceManager; if (chunkDistanceManager.addTicketAtLevel(TicketType.PLUGIN_TICKET, new ChunkCoordIntPair(x, z), 31, plugin)) { // keep in-line with force loading, add at level 31 this.getChunkAt(x, z); // ensure loaded @@ -496,7 +496,7 @@ public class CraftWorld implements World { public boolean removePluginChunkTicket(int x, int z, Plugin plugin) { Preconditions.checkNotNull(plugin, "null plugin"); - ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.u; + ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.chunkDistanceManager; return chunkDistanceManager.removeTicketAtLevel(TicketType.PLUGIN_TICKET, new ChunkCoordIntPair(x, z), 31, plugin); // keep in-line with force loading, remove at level 31 } @@ -504,13 +504,13 @@ public class CraftWorld implements World { public void removePluginChunkTickets(Plugin plugin) { Preconditions.checkNotNull(plugin, "null plugin"); - ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.u; + ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.chunkDistanceManager; chunkDistanceManager.removeAllTicketsFor(TicketType.PLUGIN_TICKET, 31, plugin); // keep in-line with force loading, remove at level 31 } @Override public Collection getPluginChunkTickets(int x, int z) { - ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.u; + ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.chunkDistanceManager; ObjectSortedSet> tickets = chunkDistanceManager.tickets.get(ChunkCoordIntPair.pair(x, z)); if (tickets == null) { @@ -520,7 +520,7 @@ public class CraftWorld implements World { ImmutableList.Builder ret = ImmutableList.builder(); for (Ticket ticket : tickets) { if (ticket.getTicketType() == TicketType.PLUGIN_TICKET) { - ret.add((Plugin) ticket.c); + ret.add((Plugin) ticket.identifier); } } @@ -530,7 +530,7 @@ public class CraftWorld implements World { @Override public Map> getPluginChunkTickets() { Map> ret = new HashMap<>(); - ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.u; + ChunkMapDistance chunkDistanceManager = this.world.getChunkProvider().playerChunkMap.chunkDistanceManager; for (Long2ObjectMap.Entry>> chunkTickets : chunkDistanceManager.tickets.long2ObjectEntrySet()) { long chunkKey = chunkTickets.getLongKey(); @@ -546,7 +546,7 @@ public class CraftWorld implements World { chunk = this.getChunkAt(ChunkCoordIntPair.getX(chunkKey), ChunkCoordIntPair.getZ(chunkKey)); } - ret.computeIfAbsent((Plugin) ticket.c, (key) -> ImmutableList.builder()).add(chunk); + ret.computeIfAbsent((Plugin) ticket.identifier, (key) -> ImmutableList.builder()).add(chunk); } } @@ -1923,7 +1923,7 @@ public class CraftWorld implements World { double y = loc.getY(); double z = loc.getZ(); - getHandle().a(null, x, y, z, CraftSound.getSoundEffect(CraftSound.getSound(sound)), SoundCategory.valueOf(category.name()), volume, pitch); // PAIL: rename + getHandle().playSound(null, x, y, z, CraftSound.getSoundEffect(CraftSound.getSound(sound)), SoundCategory.valueOf(category.name()), volume, pitch); } @Override @@ -1992,7 +1992,7 @@ public class CraftWorld implements World { GameRules.GameRuleValue handle = getHandle().getGameRules().get(getGameRulesNMS().get(rule)); handle.setValue(value); - handle.a(getHandle().getMinecraftServer()); + handle.onChange(getHandle().getMinecraftServer()); return true; } @@ -2016,7 +2016,7 @@ public class CraftWorld implements World { @Override public T getGameRuleDefault(GameRule rule) { Validate.notNull(rule, "GameRule cannot be null"); - return convert(rule, getGameRuleDefinitions().get(rule.getName()).a()); + return convert(rule, getGameRuleDefinitions().get(rule.getName()).getValue()); } @Override @@ -2028,7 +2028,7 @@ public class CraftWorld implements World { GameRules.GameRuleValue handle = getHandle().getGameRules().get(getGameRulesNMS().get(rule.getName())); handle.setValue(newValue.toString()); - handle.a(getHandle().getMinecraftServer()); + handle.onChange(getHandle().getMinecraftServer()); return true; } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java b/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java index d3ec2b21da..b4cf53334b 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/Main.java @@ -177,7 +177,7 @@ public class Main { useConsole = false; } - if (false && Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { + if (Main.class.getPackage().getImplementationVendor() != null && System.getProperty("IReallyKnowWhatIAmDoingISwear") == null) { Date buildDate = new SimpleDateFormat("yyyyMMdd-HHmm").parse(Main.class.getPackage().getImplementationVendor()); Calendar deadline = Calendar.getInstance(); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java b/paper-server/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java index 49852d971e..f9da97c074 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeInstance.java @@ -25,7 +25,7 @@ public class CraftAttributeInstance implements AttributeInstance { @Override public double getBaseValue() { - return handle.b(); + return handle.getBaseValue(); } @Override @@ -36,7 +36,7 @@ public class CraftAttributeInstance implements AttributeInstance { @Override public Collection getModifiers() { List result = new ArrayList(); - for (net.minecraft.server.AttributeModifier nms : handle.c()) { + for (net.minecraft.server.AttributeModifier nms : handle.getModifiers()) { result.add(convert(nms)); } @@ -46,13 +46,13 @@ public class CraftAttributeInstance implements AttributeInstance { @Override public void addModifier(AttributeModifier modifier) { Preconditions.checkArgument(modifier != null, "modifier"); - handle.b(convert(modifier)); + handle.addModifier(convert(modifier)); } @Override public void removeModifier(AttributeModifier modifier) { Preconditions.checkArgument(modifier != null, "modifier"); - handle.c(convert(modifier)); + handle.removeModifier(convert(modifier)); } @Override @@ -70,6 +70,6 @@ public class CraftAttributeInstance implements AttributeInstance { } public static AttributeModifier convert(net.minecraft.server.AttributeModifier nms) { - return new AttributeModifier(nms.a(), nms.b(), nms.d(), AttributeModifier.Operation.values()[nms.c().ordinal()]); + return new AttributeModifier(nms.getUniqueId(), nms.getName(), nms.getAmount(), AttributeModifier.Operation.values()[nms.getOperation().ordinal()]); } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java index 9269448f71..754205636b 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java @@ -32,7 +32,7 @@ public class CraftBanner extends CraftBlockEntityState impleme public void load(TileEntityBanner banner) { super.load(banner); - base = DyeColor.getByWoolData((byte) ((BlockBannerAbstract) this.data.getBlock()).b().getColorIndex()); // PAIL + base = DyeColor.getByWoolData((byte) ((BlockBannerAbstract) this.data.getBlock()).getColor().getColorIndex()); patterns = new ArrayList(); if (banner.patterns != null) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/paper-server/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java index 49c9975cf6..99c361dc69 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java @@ -76,7 +76,7 @@ public class CraftBlockData implements BlockData { protected > Set getValues(BlockStateEnum nms, Class bukkit) { ImmutableSet.Builder values = ImmutableSet.builder(); - for (Enum e : nms.d()) { + for (Enum e : nms.getValues()) { values.add(toBukkit(e, bukkit)); } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java b/paper-server/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java index 59d82cf64a..a3ae4a9ffa 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/command/VanillaCommandWrapper.java @@ -74,7 +74,7 @@ public final class VanillaCommandWrapper extends BukkitCommand { return ((EntityMinecartCommandBlock) ((CraftMinecartCommand) sender).getHandle()).getCommandBlock().getWrapper(); } if (sender instanceof RemoteConsoleCommandSender) { - return ((DedicatedServer) MinecraftServer.getServer()).remoteControlCommandListener.f(); + return ((DedicatedServer) MinecraftServer.getServer()).remoteControlCommandListener.getWrapper(); } if (sender instanceof ConsoleCommandSender) { return ((CraftServer) sender.getServer()).getServer().getServerCommandListener(); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/paper-server/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java index 6818e1adc3..8602069c4e 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java @@ -183,7 +183,7 @@ public class CraftEnchantment extends Enchantment { return false; } CraftEnchantment ench = (CraftEnchantment) other; - return !target.b(ench.target); + return !target.isCompatible(ench.target); } public net.minecraft.server.Enchantment getHandle() { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java index a52eae8cda..ab6cbf5600 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftAreaEffectCloud.java @@ -151,7 +151,7 @@ public class CraftAreaEffectCloud extends CraftEntity implements AreaEffectCloud } getHandle().effects.remove(existing); } - getHandle().a(CraftPotionUtil.fromBukkit(effect)); + getHandle().addEffect(CraftPotionUtil.fromBukkit(effect)); getHandle().refreshEffects(); return true; } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java index 2793ce7a19..29d23db412 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java @@ -41,14 +41,14 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow { @Override public int getPierceLevel() { - return getHandle().s(); // PAIL: rename + return getHandle().getPierceLevel(); } @Override public void setPierceLevel(int pierceLevel) { Preconditions.checkArgument(0 <= pierceLevel && pierceLevel <= Byte.MAX_VALUE, "Pierce level out of range, expected 0 < level < 127"); - getHandle().b((byte) pierceLevel); // PAIL: rename + getHandle().setPierceLevel((byte) pierceLevel); } @Override diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 5cc5074a5e..fa9cedd6e2 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -645,7 +645,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { public boolean hasCooldown(Material material) { Preconditions.checkArgument(material != null, "material"); - return getHandle().getCooldownTracker().a(CraftMagicNumbers.getItem(material)); + return getHandle().getCooldownTracker().hasCooldown(CraftMagicNumbers.getItem(material)); } @Override diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 220130fd20..0f9fa92224 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1656,7 +1656,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { ItemStack hand = getInventory().getItemInMainHand(); getInventory().setItemInMainHand(book); - getHandle().a(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(book), net.minecraft.server.EnumHand.MAIN_HAND); // PAIL rename openBook + getHandle().openBook(org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(book), net.minecraft.server.EnumHand.MAIN_HAND); getInventory().setItemInMainHand(hand); } } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftTippedArrow.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftTippedArrow.java index ced99327c0..ecdaa2b97f 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftTippedArrow.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftTippedArrow.java @@ -51,7 +51,7 @@ public class CraftTippedArrow extends CraftArrow implements Arrow { } getHandle().effects.remove(existing); } - getHandle().a(CraftPotionUtil.fromBukkit(effect)); + getHandle().addEffect(CraftPotionUtil.fromBukkit(effect)); getHandle().refreshEffects(); return true; } diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index a09240d8a7..3cf0053bb5 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1232,7 +1232,7 @@ public class CraftEventFactory { c.setChatModifier(modi); if (c instanceof ChatMessage) { ChatMessage cm = (ChatMessage) c; - Object[] oo = cm.l(); + Object[] oo = cm.getArgs(); for (int i = 0; i < oo.length; i++) { Object o = oo[i]; if (o instanceof IChatBaseComponent) { @@ -1240,7 +1240,7 @@ public class CraftEventFactory { } } } - List ls = c.a(); + List ls = c.getSiblings(); if (ls != null) { for (int i = 0; i < ls.size(); i++) { ls.set(i, stripEvents(ls.get(i))); diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java index 9473748624..f9411d9d5a 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java @@ -19,6 +19,7 @@ import net.minecraft.server.MobSpawnerPhantom; import net.minecraft.server.RegionLimitedWorldAccess; import net.minecraft.server.StructureGenerator; import net.minecraft.server.TileEntity; +import net.minecraft.server.VillageSiege; import net.minecraft.server.World; import net.minecraft.server.WorldGenFeatureConfiguration; import net.minecraft.server.WorldGenStage; @@ -39,6 +40,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator extras = new ArrayList(); - List extrasOld = new ArrayList(text.a()); + List extrasOld = new ArrayList(text.getSiblings()); component = text = new ChatComponentText(""); int pos = 0; @@ -245,21 +245,21 @@ public final class CraftChatMessage { } } - List extras = component.a(); + List extras = component.getSiblings(); for (int i = 0; i < extras.size(); i++) { - IChatBaseComponent comp = (IChatBaseComponent) extras.get(i); - if (comp.getChatModifier() != null && comp.getChatModifier().h() == null) { + IChatBaseComponent comp = extras.get(i); + if (comp.getChatModifier() != null && comp.getChatModifier().getClickEvent() == null) { extras.set(i, fixComponent(comp, matcher)); } } if (component instanceof ChatMessage) { - Object[] subs = ((ChatMessage) component).l(); + Object[] subs = ((ChatMessage) component).getArgs(); for (int i = 0; i < subs.length; i++) { Object comp = subs[i]; if (comp instanceof IChatBaseComponent) { IChatBaseComponent c = (IChatBaseComponent) comp; - if (c.getChatModifier() != null && c.getChatModifier().h() == null) { + if (c.getChatModifier() != null && c.getChatModifier().getClickEvent() == null) { subs[i] = fixComponent(c, matcher); } } else if (comp instanceof String && matcher.reset((String)comp).find()) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java index 8b6ec888e8..dd602243d3 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -188,7 +188,7 @@ public final class CraftMagicNumbers implements UnsafeValues { * @return string */ public String getMappingsVersion() { - return "a69acbca3007d2ae1b4b69881f0ab9ad"; + return "11ae498d9cf909730659b6357e7c2afa"; } @Override diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java b/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java index f1f41262db..b308b19014 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/util/CraftNamespacedKey.java @@ -21,7 +21,7 @@ public final class CraftNamespacedKey { } public static NamespacedKey fromMinecraft(MinecraftKey minecraft) { - return new NamespacedKey(minecraft.b(), minecraft.getKey()); + return new NamespacedKey(minecraft.getNamespace(), minecraft.getKey()); } public static MinecraftKey toMinecraft(NamespacedKey key) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/paper-server/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java index 755f7f2649..f575b884b0 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java @@ -11,7 +11,6 @@ import net.minecraft.server.ChunkStatus; import net.minecraft.server.DifficultyDamageScaler; import net.minecraft.server.Entity; import net.minecraft.server.EntityHuman; -import net.minecraft.server.EnumDirection; import net.minecraft.server.EnumSkyBlock; import net.minecraft.server.Fluid; import net.minecraft.server.FluidType; @@ -83,7 +82,7 @@ public class DummyGeneratorAccess implements GeneratorAccess { } @Override - public void a(EntityHuman eh, BlockPosition bp, SoundEffect se, SoundCategory sc, float f, float f1) { + public void playSound(EntityHuman eh, BlockPosition bp, SoundEffect se, SoundCategory sc, float f, float f1) { throw new UnsupportedOperationException("Not supported yet."); } diff --git a/paper-server/src/test/java/org/bukkit/StatisticsAndAchievementsTest.java b/paper-server/src/test/java/org/bukkit/StatisticsAndAchievementsTest.java index fe8cad4aab..f45fa3fd63 100644 --- a/paper-server/src/test/java/org/bukkit/StatisticsAndAchievementsTest.java +++ b/paper-server/src/test/java/org/bukkit/StatisticsAndAchievementsTest.java @@ -32,16 +32,16 @@ public class StatisticsAndAchievementsTest extends AbstractTestingBase { public void verifyStatisticMapping() throws Throwable { HashMultiset statistics = HashMultiset.create(); for (StatisticWrapper wrapper : IRegistry.STATS) { - for (Object child : wrapper.a()) { + for (Object child : wrapper.getRegistry()) { net.minecraft.server.Statistic statistic = wrapper.b(child); String message = String.format("org.bukkit.Statistic is missing: '%s'", statistic); Statistic subject = CraftStatistic.getBukkitStatistic(statistic); assertThat(message, subject, is(not(nullValue()))); - if (wrapper.a() == IRegistry.BLOCK || wrapper.a() == IRegistry.ITEM) { - assertNotNull("Material type map missing for " + wrapper.a().getKey(child), CraftStatistic.getMaterialFromStatistic(statistic)); - } else if (wrapper.a() == IRegistry.ENTITY_TYPE) { + if (wrapper.getRegistry() == IRegistry.BLOCK || wrapper.getRegistry() == IRegistry.ITEM) { + assertNotNull("Material type map missing for " + wrapper.getRegistry().getKey(child), CraftStatistic.getMaterialFromStatistic(statistic)); + } else if (wrapper.getRegistry() == IRegistry.ENTITY_TYPE) { assertNotNull("Entity type map missing for " + EntityTypes.getName((EntityTypes) child), CraftStatistic.getEntityTypeFromStatistic((net.minecraft.server.Statistic>) statistic)); }