From dd751b919158c2ff4c727dae50e046c92640ba83 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> Date: Wed, 11 Dec 2019 18:03:31 -0600 Subject: [PATCH] Little more progress Keep getting interrupted so not as much as I'd like :( --- ...ile-Entities-from-a-chunk-without-sn.patch | 2 +- ...dd-Early-Warning-Feature-to-WatchDog.patch | 10 +- .../Add-More-Creeper-API.patch | 8 +- .../Add-PhantomPreSpawnEvent.patch | 6 +- Spigot-Server-Patches/Add-TNTPrimeEvent.patch | 12 +- .../Add-hand-to-bucket-events.patch | 45 ++-- ...-ray-tracing-methods-to-LivingEntity.patch | 2 +- ...dd-some-Debug-to-Chunk-Entity-slices.patch | 8 +- ...Allow-disabling-armour-stand-ticking.patch | 56 +++-- Spigot-Server-Patches/AnvilDamageEvent.patch | 4 +- ...nd-make-tab-spam-limits-configurable.patch | 6 +- ...le-speed-for-water-flowing-over-lava.patch | 25 +- ...tect-and-repair-corrupt-Region-Files.patch | 113 --------- ...on-t-call-getItemMeta-on-hasItemMeta.patch | 51 ++-- .../EntityTransformedEvent.patch | 8 +- ...e-attack-cooldown-methods-for-Player.patch | 22 +- Spigot-Server-Patches/Fix-MC-124320.patch | 4 +- ...ient-rendering-skulls-from-same-user.patch | 10 +- ...ead-Entities-in-entityList-iteration.patch | 24 +- .../Implement-Expanded-ArmorStand-API.patch | 14 +- .../Inventory-removeItemAnySlot.patch | 2 +- .../MC-111480-Start-Entity-ID-s-at-1.patch | 2 +- ...6-Experience-should-save-as-Integers.patch | 2 +- ...loadChunk-int-int-false-load-unconve.patch | 2 +- .../Make-EnderDragon-implement-Mob.patch | 2 +- ...-anytime-entities-change-to-guarante.patch | 2 +- ...ptimize-BlockPosition-helper-methods.patch | 20 +- .../Optimize-CraftBlockData-Creation.patch | 6 +- Spigot-Server-Patches/Optimize-Hoppers.patch | 35 +-- .../Optimize-RegistryMaterials.patch | 19 +- ...t-armor-stands-from-doing-entity-loo.patch | 18 +- ...revent-Saving-Bad-entities-to-chunks.patch | 10 +- ...o-use-a-versioned-world-folder-for-t.patch | 228 ------------------ ...store-vanlla-default-mob-spawn-range.patch | 2 +- ...ets-from-world-player-list-not-serve.patch | 16 +- .../SkeletonHorse-Additions.patch | 24 +- .../Slime-Pathfinder-Events.patch | 22 +- .../Use-ConcurrentHashMap-in-JsonList.patch | 2 +- .../Use-a-Queue-for-Queueing-Commands.patch | 2 +- .../Vanished-players-don-t-have-rights.patch | 34 ++- 40 files changed, 263 insertions(+), 617 deletions(-) delete mode 100644 Spigot-Server-Patches/Detect-and-repair-corrupt-Region-Files.patch delete mode 100644 Spigot-Server-Patches/Provide-option-to-use-a-versioned-world-folder-for-t.patch diff --git a/Spigot-Server-Patches/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch b/Spigot-Server-Patches/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch index 9ddca8b02e..544ff58eb8 100644 --- a/Spigot-Server-Patches/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch +++ b/Spigot-Server-Patches/Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ability to get Tile Entities from a chunk without snapshots diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index bc9a65de2..b45516140 100644 +index 3a21d2cdd..9dcba4d15 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -0,0 +0,0 @@ public class CraftChunk implements Chunk { diff --git a/Spigot-Server-Patches/Add-Early-Warning-Feature-to-WatchDog.patch b/Spigot-Server-Patches/Add-Early-Warning-Feature-to-WatchDog.patch index 5df32b5ea0..46163b2a21 100644 --- a/Spigot-Server-Patches/Add-Early-Warning-Feature-to-WatchDog.patch +++ b/Spigot-Server-Patches/Add-Early-Warning-Feature-to-WatchDog.patch @@ -9,7 +9,7 @@ thread dumps at an interval until the point of crash. This will help diagnose what was going on in that time before the crash. diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index 207e5d3e23..a13c8c68b6 100644 +index adef07d4d..214b577b3 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ import org.bukkit.configuration.file.YamlConfiguration; @@ -36,7 +36,7 @@ index 207e5d3e23..a13c8c68b6 100644 public static int tabSpamLimit = 500; private static void tabSpamLimiters() { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 37353b29da..2acb71fa8a 100644 +index 97a0a6924..dd2d8712e 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant POWERED = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject isIgnitedDW = d; // Paper OBFHELPER - private int bz; + private int bw; - private int fuseTicks; + public int fuseTicks; // Paper - public public int maxFuseTicks = 30; public int explosionRadius = 3; - private int bD; + private int bA; @@ -0,0 +0,0 @@ public class EntityCreeper extends EntityMonster { } @@ -38,7 +38,7 @@ index ae4dd98ee1..bcb7276308 100644 public boolean canCauseHeadDrop() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java -index 896405148c..075a5e77e2 100644 +index 896405148..075a5e77e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java @@ -0,0 +0,0 @@ public class CraftCreeper extends CraftMonster implements Creeper { diff --git a/Spigot-Server-Patches/Add-PhantomPreSpawnEvent.patch b/Spigot-Server-Patches/Add-PhantomPreSpawnEvent.patch index 367051d866..8ae1ad4c53 100644 --- a/Spigot-Server-Patches/Add-PhantomPreSpawnEvent.patch +++ b/Spigot-Server-Patches/Add-PhantomPreSpawnEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PhantomPreSpawnEvent diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java -index e5ed5a3dcc..e5d032d02b 100644 +index b62a8227b..82323bf4a 100644 --- a/src/main/java/net/minecraft/server/EntityPhantom.java +++ b/src/main/java/net/minecraft/server/EntityPhantom.java @@ -0,0 +0,0 @@ public class EntityPhantom extends EntityFlying implements IMonster { @@ -48,7 +48,7 @@ index e5ed5a3dcc..e5d032d02b 100644 private final PathfinderTargetCondition b; diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java -index 9f64d81c64..1818e7c384 100644 +index add566ea4..f488c22ed 100644 --- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java +++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java @@ -0,0 +0,0 @@ public class MobSpawnerPhantom { @@ -71,7 +71,7 @@ index 9f64d81c64..1818e7c384 100644 groupdataentity = entityphantom.prepare(worldserver, difficultydamagescaler, EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null); worldserver.addEntity(entityphantom, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java -index 9f9ee92390..2b97313694 100644 +index 9f9ee9239..2b9731369 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java @@ -0,0 +0,0 @@ public class CraftPhantom extends CraftFlying implements Phantom { diff --git a/Spigot-Server-Patches/Add-TNTPrimeEvent.patch b/Spigot-Server-Patches/Add-TNTPrimeEvent.patch index 252c99028d..494495da3c 100644 --- a/Spigot-Server-Patches/Add-TNTPrimeEvent.patch +++ b/Spigot-Server-Patches/Add-TNTPrimeEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add TNTPrimeEvent diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java -index 37e6a91520..135c6ae47e 100644 +index 9cf7d0b9e..15d44cd98 100644 --- a/src/main/java/net/minecraft/server/BlockFire.java +++ b/src/main/java/net/minecraft/server/BlockFire.java @@ -0,0 +0,0 @@ package net.minecraft.server; @@ -39,7 +39,7 @@ index 37e6a91520..135c6ae47e 100644 } } diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java -index 462c77a000..b2689ee8bf 100644 +index 44d26e096..199276f3a 100644 --- a/src/main/java/net/minecraft/server/BlockTNT.java +++ b/src/main/java/net/minecraft/server/BlockTNT.java @@ -0,0 +0,0 @@ @@ -98,7 +98,7 @@ index 462c77a000..b2689ee8bf 100644 + // Paper end a(world, blockposition, (EntityLiving) entityhuman); world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 11); - if (item == Items.FLINT_AND_STEEL) { + if (!entityhuman.isCreative()) { @@ -0,0 +0,0 @@ public class BlockTNT extends Block { } // CraftBukkit end @@ -114,7 +114,7 @@ index 462c77a000..b2689ee8bf 100644 world.a(blockposition, false); } diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 5fae347db2..c2f35f89d3 100644 +index 07abcc1e2..3df8e30ec 100644 --- a/src/main/java/net/minecraft/server/EntityEnderDragon.java +++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.block.CraftBlock; @@ -126,8 +126,8 @@ index 5fae347db2..c2f35f89d3 100644 // PAIL: Fixme public class EntityEnderDragon extends EntityInsentient implements IMonster { @@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { - - Block.b(craftBlock.getNMS(), loottableinfo_builder); + }); + craftBlock.getNMS().dropNaturally(world, blockposition, ItemStack.a); } + // Paper start - TNTPrimeEvent + org.bukkit.block.Block tntBlock = world.getWorld().getBlockAt(blockposition.x, blockposition.y, blockposition.z); diff --git a/Spigot-Server-Patches/Add-hand-to-bucket-events.patch b/Spigot-Server-Patches/Add-hand-to-bucket-events.patch index bf0d3a0678..28795229e3 100644 --- a/Spigot-Server-Patches/Add-hand-to-bucket-events.patch +++ b/Spigot-Server-Patches/Add-hand-to-bucket-events.patch @@ -18,63 +18,65 @@ index 6e385b530..2c8bbf20a 100644 if (event.isCancelled()) { return false; diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java -index 59e239e9d..91ff811d8 100644 +index aaed8c0ae..0ff92aea5 100644 --- a/src/main/java/net/minecraft/server/ItemBucket.java +++ b/src/main/java/net/minecraft/server/ItemBucket.java @@ -0,0 +0,0 @@ public class ItemBucket extends Item { if (iblockdata.getBlock() instanceof IFluidSource) { // CraftBukkit start FluidType dummyFluid = ((IFluidSource) iblockdata.getBlock()).removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); -- PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.b()); -+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.b(), enumhand); // Paper - add enumHand +- PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a()); ++ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent(world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a(), enumhand); if (event.isCancelled()) { ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager) @@ -0,0 +0,0 @@ public class ItemBucket extends Item { iblockdata = world.getType(blockposition); - BlockPosition blockposition1 = iblockdata.getBlock() instanceof IFluidContainer && this.fluidType == FluidTypes.WATER ? blockposition : movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()); + BlockPosition blockposition2 = iblockdata.getBlock() instanceof IFluidContainer && this.fluidType == FluidTypes.WATER ? blockposition : blockposition1; -- if (this.a(entityhuman, world, blockposition1, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack)) { // CraftBukkit -+ if (this.a(entityhuman, world, blockposition1, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack, enumhand)) { // CraftBukkit // Paper - add enumHand - this.a(world, itemstack, blockposition1); +- if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack)) { // CraftBukkit ++ if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock, movingobjectpositionblock.getDirection(), blockposition, itemstack, enumhand)) { // CraftBukkit // Paper - add enumhand + this.a(world, itemstack, blockposition2); if (entityhuman instanceof EntityPlayer) { - CriterionTriggers.y.a((EntityPlayer) entityhuman, blockposition1, itemstack); + CriterionTriggers.y.a((EntityPlayer) entityhuman, blockposition2, itemstack); @@ -0,0 +0,0 @@ public class ItemBucket extends Item { + + // CraftBukkit start + public boolean a(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock) { +- return a(entityhuman, world, blockposition, movingobjectpositionblock, null, null, null); ++ // Paper start - add enumHand ++ return a(entityhuman, world, blockposition, movingobjectpositionblock, null, null, null, null); } - public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack) { -+ // Paper start - add enumHand -+ return a(entityhuman, world, blockposition, movingobjectpositionblock, enumdirection, clicked, itemstack, null); -+ } -+ +- public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack) { + public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack, EnumHand enumhand) { + // Paper end // CraftBukkit end if (!(this.fluidType instanceof FluidTypeFlowing)) { return false; @@ -0,0 +0,0 @@ public class ItemBucket extends Item { - boolean flag1 = material.isReplaceable(); + boolean flag = iblockdata.a(this.fluidType); - if (!world.isEmpty(blockposition) && !flag && !flag1 && (!(iblockdata.getBlock() instanceof IFluidContainer) || !((IFluidContainer) iblockdata.getBlock()).canPlace(world, blockposition, iblockdata, this.fluidType))) { + if (!iblockdata.isAir() && !flag && (!(iblockdata.getBlock() instanceof IFluidContainer) || !((IFluidContainer) iblockdata.getBlock()).canPlace(world, blockposition, iblockdata, this.fluidType))) { - return movingobjectpositionblock == null ? false : this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack); // CraftBukkit -+ return movingobjectpositionblock == null ? false : this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit // Paper - add enumhand ++ return movingobjectpositionblock == null ? false : this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit } else { // CraftBukkit start if (entityhuman != null) { - PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(world, entityhuman, blockposition, clicked, enumdirection, itemstack); -+ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand); // Paper - add enumHand ++ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent(world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand); if (event.isCancelled()) { ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-4238: needed when looking through entity ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541 diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index f4db17759..e22389457 100644 +index e954c59d5..844781f4e 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -0,0 +0,0 @@ public class CraftEventFactory { + } private static PlayerEvent getPlayerBucketEvent(boolean isFilling, World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item) { - Player player = (Player) who.getBukkitEntity(); -+ // Paper start - add EnumHand ++ // Paper start - add enumHand + return getPlayerBucketEvent(isFilling, world, who, changed, clicked, clickedFace, itemstack, item, null); + } + @@ -88,10 +90,9 @@ index f4db17759..e22389457 100644 + + private static PlayerEvent getPlayerBucketEvent(boolean isFilling, World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item, EnumHand enumHand) { + // Paper end -+ Player player = (who == null) ? null : (Player) who.getBukkitEntity(); + Player player = (Player) who.getBukkitEntity(); CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item); Material bucket = CraftMagicNumbers.getMaterial(itemstack.getItem()); - @@ -0,0 +0,0 @@ public class CraftEventFactory { PlayerEvent event; diff --git a/Spigot-Server-Patches/Add-ray-tracing-methods-to-LivingEntity.patch b/Spigot-Server-Patches/Add-ray-tracing-methods-to-LivingEntity.patch index 4d177dab41..20317d794e 100644 --- a/Spigot-Server-Patches/Add-ray-tracing-methods-to-LivingEntity.patch +++ b/Spigot-Server-Patches/Add-ray-tracing-methods-to-LivingEntity.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add ray tracing methods to LivingEntity diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index dbf42f882..b09712ca9 100644 +index 91b6d6878..ac85a5d23 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { diff --git a/Spigot-Server-Patches/Add-some-Debug-to-Chunk-Entity-slices.patch b/Spigot-Server-Patches/Add-some-Debug-to-Chunk-Entity-slices.patch index b6d1c2fa31..2da712fc91 100644 --- a/Spigot-Server-Patches/Add-some-Debug-to-Chunk-Entity-slices.patch +++ b/Spigot-Server-Patches/Add-some-Debug-to-Chunk-Entity-slices.patch @@ -9,7 +9,7 @@ This should hopefully avoid duplicate entities ever being created if the entity was to end up in 2 different chunk slices diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 4c0fc8f7ea..a74e389d14 100644 +index 6774c6480..b156f5428 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -57,7 +57,7 @@ index 4c0fc8f7ea..a74e389d14 100644 return; } diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 9776a29923..701090c11e 100644 +index 6ef5d2ebd..be8f6ac99 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -66,6 +66,6 @@ index 9776a29923..701090c11e 100644 }; + List entitySlice = null; // Paper end - static boolean isLevelAtLeast(NBTTagCompound tag, int level) { - return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; + + public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Allow-disabling-armour-stand-ticking.patch b/Spigot-Server-Patches/Allow-disabling-armour-stand-ticking.patch index a697d09870..12dae039a1 100644 --- a/Spigot-Server-Patches/Allow-disabling-armour-stand-ticking.patch +++ b/Spigot-Server-Patches/Allow-disabling-armour-stand-ticking.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Allow disabling armour stand ticking diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 721685704..9ee27f638 100644 +index 0a99b8fe9..42d14fac2 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { - log("Bed Search Radius: " + bedSearchRadius); - } + private void armorStandEntityLookups() { + armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); } + + public boolean armorStandTick = true; @@ -20,7 +20,7 @@ index 721685704..9ee27f638 100644 + } } diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index d8497fa5e..85fc48371 100644 +index eb6cf3a86..b51662ee9 100644 --- a/src/main/java/net/minecraft/server/EntityArmorStand.java +++ b/src/main/java/net/minecraft/server/EntityArmorStand.java @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { @@ -37,11 +37,11 @@ index d8497fa5e..85fc48371 100644 public EntityArmorStand(EntityTypes entitytypes, World world) { super(entitytypes, world); @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { - this.rightArmPose = EntityArmorStand.bx; - this.leftLegPose = EntityArmorStand.by; - this.rightLegPose = EntityArmorStand.bz; + this.rightArmPose = EntityArmorStand.bu; + this.leftLegPose = EntityArmorStand.bv; + this.rightLegPose = EntityArmorStand.bw; + if (world != null) this.canTick = world.paperConfig.armorStandTick; // Paper - armour stand ticking - this.K = 0.0F; + this.H = 0.0F; } @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { @@ -136,13 +136,13 @@ index d8497fa5e..85fc48371 100644 public void setRightLegPose(Vector3f vector3f) { this.rightLegPose = vector3f; - this.datawatcher.set(EntityArmorStand.bs, vector3f); + this.datawatcher.set(EntityArmorStand.bp, vector3f); + this.noTickPoseDirty = true; // Paper - Allow updates when not ticking } public Vector3f r() { diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index e1972f793..dbf42f882 100644 +index 470cbddeb..91b6d6878 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @@ -150,18 +150,18 @@ index e1972f793..dbf42f882 100644 } - EnumItemSlot[] aenumitemslot = EnumItemSlot.values(); -- int j = aenumitemslot.length; +- int k = aenumitemslot.length; - -- for (int k = 0; k < j; ++k) { -- EnumItemSlot enumitemslot = aenumitemslot[k]; +- for (int l = 0; l < k; ++l) { +- EnumItemSlot enumitemslot = aenumitemslot[l]; - ItemStack itemstack; - - switch (enumitemslot.a()) { - case HAND: -- itemstack = (ItemStack) this.bw.get(enumitemslot.b()); +- itemstack = (ItemStack) this.bu.get(enumitemslot.b()); - break; - case ARMOR: -- itemstack = (ItemStack) this.bx.get(enumitemslot.b()); +- itemstack = (ItemStack) this.bv.get(enumitemslot.b()); - break; - default: - continue; @@ -188,10 +188,10 @@ index e1972f793..dbf42f882 100644 - - switch (enumitemslot.a()) { - case HAND: -- this.bw.set(enumitemslot.b(), itemstack1.isEmpty() ? ItemStack.a : itemstack1.cloneItemStack()); +- this.bu.set(enumitemslot.b(), itemstack1.cloneItemStack()); - break; - case ARMOR: -- this.bx.set(enumitemslot.b(), itemstack1.isEmpty() ? ItemStack.a : itemstack1.cloneItemStack()); +- this.bv.set(enumitemslot.b(), itemstack1.cloneItemStack()); - } - } - } @@ -206,18 +206,17 @@ index e1972f793..dbf42f882 100644 + // Paper start - split into own method from above + public void updateEntityEquipment() { + EnumItemSlot[] aenumitemslot = EnumItemSlot.values(); -+ int j = aenumitemslot.length; -+ -+ for (int k = 0; k < j; ++k) { -+ EnumItemSlot enumitemslot = aenumitemslot[k]; ++ int k = aenumitemslot.length; ++ for (int l = 0; l < k; ++l) { ++ EnumItemSlot enumitemslot = aenumitemslot[l]; + ItemStack itemstack; + + switch (enumitemslot.a()) { + case HAND: -+ itemstack = (ItemStack) this.bw.get(enumitemslot.b()); ++ itemstack = (ItemStack) this.bu.get(enumitemslot.b()); + break; + case ARMOR: -+ itemstack = (ItemStack) this.bx.get(enumitemslot.b()); ++ itemstack = (ItemStack) this.bv.get(enumitemslot.b()); + break; + default: + continue; @@ -244,21 +243,20 @@ index e1972f793..dbf42f882 100644 + + switch (enumitemslot.a()) { + case HAND: -+ this.bw.set(enumitemslot.b(), itemstack1.isEmpty() ? ItemStack.a : itemstack1.cloneItemStack()); ++ this.bu.set(enumitemslot.b(), itemstack1.cloneItemStack()); + break; + case ARMOR: -+ this.bx.set(enumitemslot.b(), itemstack1.isEmpty() ? ItemStack.a : itemstack1.cloneItemStack()); ++ this.bv.set(enumitemslot.b(), itemstack1.cloneItemStack()); + } + } + } + } -+ // Paper end + - protected float e(float f, float f1) { - float f2 = MathHelper.g(f - this.aK); + protected float f(float f, float f1) { + float f2 = MathHelper.g(f - this.aI); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -index 9f5c3b92e..73714d71a 100644 +index d1d689e5d..ac105270d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java @@ -0,0 +0,0 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { diff --git a/Spigot-Server-Patches/AnvilDamageEvent.patch b/Spigot-Server-Patches/AnvilDamageEvent.patch index fe78309f61..26cd03af0e 100644 --- a/Spigot-Server-Patches/AnvilDamageEvent.patch +++ b/Spigot-Server-Patches/AnvilDamageEvent.patch @@ -5,13 +5,13 @@ Subject: [PATCH] AnvilDamageEvent diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java -index 59f4798520..7718c5a3b7 100644 +index 1d9ce5ef1..286b930dd 100644 --- a/src/main/java/net/minecraft/server/ContainerAnvil.java +++ b/src/main/java/net/minecraft/server/ContainerAnvil.java @@ -0,0 +0,0 @@ public class ContainerAnvil extends Container { if (!entityhuman.abilities.canInstantlyBuild && iblockdata.a(TagsBlock.ANVIL) && entityhuman.getRandom().nextFloat() < 0.12F) { - IBlockData iblockdata1 = BlockAnvil.a_(iblockdata); + IBlockData iblockdata1 = BlockAnvil.e(iblockdata); + // Paper start + com.destroystokyo.paper.event.block.AnvilDamagedEvent event = new com.destroystokyo.paper.event.block.AnvilDamagedEvent(getBukkitView(), iblockdata1 != null ? org.bukkit.craftbukkit.block.data.CraftBlockData.fromData(iblockdata1) : null); + if (!event.callEvent()) { diff --git a/Spigot-Server-Patches/Break-up-and-make-tab-spam-limits-configurable.patch b/Spigot-Server-Patches/Break-up-and-make-tab-spam-limits-configurable.patch index 0bfcf120df..c8d1f27ffc 100644 --- a/Spigot-Server-Patches/Break-up-and-make-tab-spam-limits-configurable.patch +++ b/Spigot-Server-Patches/Break-up-and-make-tab-spam-limits-configurable.patch @@ -22,11 +22,11 @@ to take the burden of this into their own hand without having to rely on plugins doing unsafe things. diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index dfdc7c384d..207e5d3e23 100644 +index 26ab855dc..adef07d4d 100644 --- a/src/main/java/com/destroystokyo/paper/PaperConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java @@ -0,0 +0,0 @@ public class PaperConfig { - logger.log(Level.INFO, "******************************************************"); + Bukkit.getLogger().log(Level.INFO, "Using Aikar's Alternative Luck Formula to apply Luck attribute to all loot pool calculations. See https://luckformula.emc.gs"); } } + @@ -45,7 +45,7 @@ index dfdc7c384d..207e5d3e23 100644 + } } diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index f2de19b9b4..a814d8cae9 100644 +index 3a7e197e3..77c375f71 100644 --- a/src/main/java/net/minecraft/server/PlayerConnection.java +++ b/src/main/java/net/minecraft/server/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { diff --git a/Spigot-Server-Patches/Configurable-speed-for-water-flowing-over-lava.patch b/Spigot-Server-Patches/Configurable-speed-for-water-flowing-over-lava.patch index a85fe53f47..07e3880c7c 100644 --- a/Spigot-Server-Patches/Configurable-speed-for-water-flowing-over-lava.patch +++ b/Spigot-Server-Patches/Configurable-speed-for-water-flowing-over-lava.patch @@ -5,32 +5,30 @@ Subject: [PATCH] Configurable speed for water flowing over lava diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 269c1ace4..4a4e9d715 100644 +index 80d66c647..e49318a19 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { - } + disableHopperMoveEvents = getBoolean("hopper.disable-move-event", disableHopperMoveEvents); + log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled")); } - ++ + public int waterOverLavaFlowSpeed; + private void waterOverLavaFlowSpeed() { + waterOverLavaFlowSpeed = getInt("water-over-lava-flow-speed", 5); + log("Water over lava flow speed: " + waterOverLavaFlowSpeed); + } -+ - public boolean armorStandTick = true; - private void armorStandTick() { - this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick); + } diff --git a/src/main/java/net/minecraft/server/BlockFluids.java b/src/main/java/net/minecraft/server/BlockFluids.java -index cccdd1398..56bf0b1d8 100644 +index f56e14e1e..6d351f097 100644 --- a/src/main/java/net/minecraft/server/BlockFluids.java +++ b/src/main/java/net/minecraft/server/BlockFluids.java @@ -0,0 +0,0 @@ public class BlockFluids extends Block implements IFluidSource { @Override public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) { if (this.a(world, blockposition, iblockdata)) { -- world.getFluidTickList().a(blockposition, iblockdata.p().getType(), this.a((IWorldReader) world)); -+ world.getFluidTickList().a(blockposition, iblockdata.p().getType(), this.getFlowSpeed(world, blockposition)); // Paper +- world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.a((IWorldReader) world)); ++ world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.getFlowSpeed(world, blockposition)); // Paper } } @@ -50,16 +48,17 @@ index cccdd1398..56bf0b1d8 100644 + return this.a(world); + } + // Paper end ++ + @Override public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) { - if (iblockdata.p().isSource() || iblockdata1.p().isSource()) { + if (iblockdata.getFluid().isSource() || iblockdata1.getFluid().isSource()) { @@ -0,0 +0,0 @@ public class BlockFluids extends Block implements IFluidSource { @Override public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) { if (this.a(world, blockposition, iblockdata)) { -- world.getFluidTickList().a(blockposition, iblockdata.p().getType(), this.a((IWorldReader) world)); -+ world.getFluidTickList().a(blockposition, iblockdata.p().getType(), this.getFlowSpeed(world, blockposition)); // Paper +- world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.a((IWorldReader) world)); ++ world.getFluidTickList().a(blockposition, iblockdata.getFluid().getType(), this.getFlowSpeed(world, blockposition)); // Paper } } diff --git a/Spigot-Server-Patches/Detect-and-repair-corrupt-Region-Files.patch b/Spigot-Server-Patches/Detect-and-repair-corrupt-Region-Files.patch deleted file mode 100644 index 362ebb6a34..0000000000 --- a/Spigot-Server-Patches/Detect-and-repair-corrupt-Region-Files.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sat, 11 Aug 2018 00:49:20 -0400 -Subject: [PATCH] Detect and repair corrupt Region Files - -If the file has partial data written but not the full 8192 bytes, -then the server will be unable to load that region file... - -I don't know why mojang only checks for 4096, when anything less than 8192 is a crash. - -But to be safe, it will attempt to back up the file. - -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 3aeac69c26..17648c1c04 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { - // Spigot end - private static final byte[] a = new byte[4096]; - private final RandomAccessFile b; private RandomAccessFile getDataFile() { return this.b; } // Paper - OBFHELPER // PAIL dataFile -- private final int[] c = new int[1024]; -- private final int[] d = new int[1024]; -+ private final int[] c = new int[1024]; private final int[] offsets = c; // Paper - OBFHELPER -+ private final int[] d = new int[1024]; private final int[] timestamps = d; // Paper - OBFHELPER - private final List e; // PAIL freeSectors - - public RegionFile(File file) throws IOException { - this.b = new RandomAccessFile(file, "rw"); -- if (this.b.length() < 4096L) { -+ if (this.b.length() < 8192L) { // Paper - headers should be 8192 - this.b.write(RegionFile.a); - this.b.write(RegionFile.a); - } -@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { - this.b.seek(j * 4 + 4); // Go back to where we were - } - } -- if (k != 0 && (k >> 8) + (length) <= this.e.size()) { -+ if (k > 0 && (k >> 8) > 1 && (k >> 8) + (k & 255) <= this.e.size()) { // Paper >= 1 as 0/1 are the headers, and negative isnt valid - for (int l = 0; l < (length); ++l) { - // Spigot end - this.e.set((k >> 8) + l, false); -@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { - // Spigot start - else if (length > 0) { - org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.WARNING, "Invalid chunk: ({0}, {1}) Offset: {2} Length: {3} runs off end file. {4}", new Object[]{j % 32, (int) (j / 32), k >> 8, length, file}); -+ deleteChunk(j); // Paper - } - // Spigot end - } - - for (j = 0; j < 1024; ++j) { - k = headerAsInts.get(); // Paper -- this.d[j] = k; -+ if (this.offsets[j] != 0) this.timestamps[j] = k; // Paper - don't set timestamp if it got 0'd above due to corruption - } - - this.file = file; // Spigot -@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { - } - // Spigot end - -+ // Paper start -+ public synchronized void deleteChunk(int j1) { -+ backup(); -+ int k = offsets[j1]; -+ int x = j1 & 1024; -+ int z = j1 >> 2; -+ int offset = (k >> 8); -+ int len = (k & 255); -+ String debug = "idx:" + + j1 + " - " + x + "," + z + " - offset: " + offset + " - len: " + len; -+ try { -+ timestamps[j1] = 0; -+ offsets[j1] = 0; -+ RandomAccessFile file = getDataFile(); -+ file.seek(j1 * 4); -+ file.writeInt(0); -+ // clear the timestamp -+ file.seek(4096 + j1 * 4); -+ file.writeInt(0); -+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "Deleted corrupt chunk (" + debug + ") " + this.file.getAbsolutePath(), e); -+ } catch (IOException e) { -+ -+ org.bukkit.Bukkit.getLogger().log(java.util.logging.Level.SEVERE, "Error deleting corrupt chunk (" + debug + ") " + this.file.getAbsolutePath(), e); -+ } -+ } -+ private boolean backedUp = false; -+ private synchronized void backup() { -+ if (backedUp) { -+ return; -+ } -+ backedUp = true; -+ java.text.DateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd"); -+ java.util.Date today = new java.util.Date(); -+ File corrupt = new File(file.getParentFile(), file.getName() + "." + formatter.format(today) + ".corrupt"); -+ if (corrupt.exists()) { -+ return; -+ } -+ org.apache.logging.log4j.Logger logger = org.apache.logging.log4j.LogManager.getLogger(); -+ logger.error("Region file " + file.getAbsolutePath() + " was corrupt. Backing up to " + corrupt.getAbsolutePath() + " and repairing"); -+ try { -+ java.nio.file.Files.copy(file.toPath(), corrupt.toPath()); -+ -+ } catch (IOException e) { -+ logger.error("Error backing up corrupt file" + file.getAbsolutePath(), e); -+ } -+ } -+ // Paper end -+ - class ChunkBuffer extends ByteArrayOutputStream { - - private final ChunkCoordIntPair b; --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Don-t-call-getItemMeta-on-hasItemMeta.patch b/Spigot-Server-Patches/Don-t-call-getItemMeta-on-hasItemMeta.patch index bcbb64b188..c02d8ad531 100644 --- a/Spigot-Server-Patches/Don-t-call-getItemMeta-on-hasItemMeta.patch +++ b/Spigot-Server-Patches/Don-t-call-getItemMeta-on-hasItemMeta.patch @@ -11,7 +11,7 @@ Returns true if getDamage() == 0 or has damage tag or other tag is set. Check the `ItemMetaTest#testTaggedButNotMeta` method to see how this method behaves. diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index d273f24da..b1ea5b93d 100644 +index 553f60987..ba8fbef85 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack { @@ -24,36 +24,28 @@ index d273f24da..b1ea5b93d 100644 static boolean hasItemMeta(net.minecraft.server.ItemStack item) { diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -index 919f2ffa9..4726386ef 100644 +index 3a82bede7..d73141839 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -@@ -0,0 +0,0 @@ import static org.hamcrest.Matchers.*; - import static org.junit.Assert.*; - import java.util.ArrayList; - import java.util.Arrays; -+import java.util.Collections; // Paper - import java.util.List; - import java.util.UUID; - import com.destroystokyo.paper.inventory.meta.ArmorStandMeta; // Paper -@@ -0,0 +0,0 @@ public class ItemMetaTest extends AbstractTestingBase { +@@ -0,0 +0,0 @@ package org.bukkit.craftbukkit.inventory; - assertThat("noTag and enchanted stacks should not be similar", noTag.isSimilar(enchanted), is(false)); - assertThat("noTag and enchanted stacks should not be equal", noTag.equals(enchanted), is(false)); + import static org.hamcrest.Matchers.*; + import static org.junit.Assert.*; +-import java.util.ArrayList; +-import java.util.Arrays; +-import java.util.List; +-import java.util.UUID; + -+ // Paper start - test additional ItemMeta damage cases -+ ItemStack clone = CraftItemStack.asBukkitCopy(CraftItemStack.asNMSCopy(noDamage)); -+ assertThat("Bukkit and craft stacks should be similar", noDamage.isSimilar(clone), is(true)); -+ assertThat("Bukkit and craft stacks should be equal", noDamage.equals(clone), is(true)); -+ -+ ItemStack pureBukkit = new ItemStack(Material.DIAMOND_SWORD); -+ pureBukkit.setDurability((short) 2); -+ net.minecraft.server.ItemStack nms = CraftItemStack.asNMSCopy(pureBukkit); -+ ItemStack other = CraftItemStack.asBukkitCopy(nms); -+ -+ assertThat("Bukkit and NMS ItemStack copies should be similar", pureBukkit.isSimilar(other), is(true)); -+ assertThat("Bukkit and NMS ItemStack copies should be equal", pureBukkit.equals(other), is(true)); -+ } ++import java.util.*; + + import com.destroystokyo.paper.inventory.meta.ArmorStandMeta; // Paper + import net.minecraft.server.Block; + import net.minecraft.server.IRegistry; +@@ -0,0 +0,0 @@ public class ItemMetaTest extends AbstractTestingBase { + assertThat(itemMeta.hasConflictingEnchant(null), is(false)); + } + ++ // Paper start + private void testItemMeta(ItemStack stack) { + assertThat("Should not have ItemMeta", stack.hasItemMeta(), is(false)); + @@ -78,9 +70,10 @@ index 919f2ffa9..4726386ef 100644 + + testItemMeta(itemStack); + testItemMeta(CraftItemStack.asCraftCopy(itemStack)); - } ++ } + // Paper end - ++ @Test - public void testBlockStateMeta() { + public void testConflictingStoredEnchantment() { + EnchantmentStorageMeta itemMeta = (EnchantmentStorageMeta) Bukkit.getItemFactory().getItemMeta(Material.ENCHANTED_BOOK); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/EntityTransformedEvent.patch b/Spigot-Server-Patches/EntityTransformedEvent.patch index 52fca6231c..bc0c901b1b 100644 --- a/Spigot-Server-Patches/EntityTransformedEvent.patch +++ b/Spigot-Server-Patches/EntityTransformedEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] EntityTransformedEvent diff --git a/src/main/java/net/minecraft/server/EntityMushroomCow.java b/src/main/java/net/minecraft/server/EntityMushroomCow.java -index 3b1b0b599..1363069ff 100644 +index 1fff4ce63..efde7bd1d 100644 --- a/src/main/java/net/minecraft/server/EntityMushroomCow.java +++ b/src/main/java/net/minecraft/server/EntityMushroomCow.java @@ -0,0 +0,0 @@ public class EntityMushroomCow extends EntityCow { @@ -17,7 +17,7 @@ index 3b1b0b599..1363069ff 100644 this.die(); // CraftBukkit - from above diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index a4033a666..c2ccb8589 100644 +index 4aa947e24..7ea55c939 100644 --- a/src/main/java/net/minecraft/server/EntityVillager.java +++ b/src/main/java/net/minecraft/server/EntityVillager.java @@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @@ -29,7 +29,7 @@ index a4033a666..c2ccb8589 100644 // CraftBukkit end this.die(); diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index a3af14630..832375f27 100644 +index 6333d2234..c8e4dcdac 100644 --- a/src/main/java/net/minecraft/server/EntityZombie.java +++ b/src/main/java/net/minecraft/server/EntityZombie.java @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { @@ -49,7 +49,7 @@ index a3af14630..832375f27 100644 this.world.addEntity(entityzombievillager, CreatureSpawnEvent.SpawnReason.INFECTION); // CraftBukkit - add SpawnReason // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/EntityZombieVillager.java b/src/main/java/net/minecraft/server/EntityZombieVillager.java -index edb0aa220..d2bd3bb31 100644 +index 91cac5d53..8082fa617 100644 --- a/src/main/java/net/minecraft/server/EntityZombieVillager.java +++ b/src/main/java/net/minecraft/server/EntityZombieVillager.java @@ -0,0 +0,0 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHo diff --git a/Spigot-Server-Patches/Expose-attack-cooldown-methods-for-Player.patch b/Spigot-Server-Patches/Expose-attack-cooldown-methods-for-Player.patch index cefb801a32..2ba15cbc19 100644 --- a/Spigot-Server-Patches/Expose-attack-cooldown-methods-for-Player.patch +++ b/Spigot-Server-Patches/Expose-attack-cooldown-methods-for-Player.patch @@ -5,36 +5,36 @@ Subject: [PATCH] Expose attack cooldown methods for Player diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 9544039ab..2342ea481 100644 +index 007934d8c..78e48f478 100644 --- a/src/main/java/net/minecraft/server/EntityHuman.java +++ b/src/main/java/net/minecraft/server/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - this.datawatcher.set(EntityHuman.bw, nbttagcompound); + this.datawatcher.set(EntityHuman.bt, nbttagcompound); } -+ public float getCooldownPeriod() { return this.dY(); } // Paper - OBFHELPER - public float dY() { ++ public float getCooldownPeriod() { return this.ex(); } // Paper - OBFHELPER + public float ex() { return (float) (1.0D / this.getAttributeInstance(GenericAttributes.ATTACK_SPEED).getValue() * 20.0D); } + public float getCooledAttackStrength(float adjustTicks) { return s(adjustTicks); } // Paper - OBFHELPER public float s(float f) { - return MathHelper.a(((float) this.aD + f) / this.dY(), 0.0F, 1.0F); + return MathHelper.a(((float) this.aB + f) / this.ex(), 0.0F, 1.0F); } -+ public void resetCooldown() { this.dZ(); } // Paper - OBFHELPER - public void dZ() { - this.aD = 0; ++ public void resetCooldown() { this.ey(); } // Paper - OBFHELPER + public void ey() { + this.aB = 0; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index ce35e6bbc..2c99a1e9d 100644 +index e45dd6cd4..9e0be10d7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player { getInventory().setItemInMainHand(hand); } -+ //Paper start ++ // Paper start + public float getCooldownPeriod() { + return getHandle().getCooldownPeriod(); + } @@ -46,7 +46,7 @@ index ce35e6bbc..2c99a1e9d 100644 + public void resetCooldown() { + getHandle().resetCooldown(); + } -+ //Paper end ++ // Paper end + // Spigot start private final Player.Spigot spigot = new Player.Spigot() diff --git a/Spigot-Server-Patches/Fix-MC-124320.patch b/Spigot-Server-Patches/Fix-MC-124320.patch index 312cb60e3a..8cf38664c3 100644 --- a/Spigot-Server-Patches/Fix-MC-124320.patch +++ b/Spigot-Server-Patches/Fix-MC-124320.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix MC-124320 diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 2c0e59c60d..3aa4cb6401 100644 +index 3e4fc4ee5..2262a8253 100644 --- a/src/main/java/net/minecraft/server/Block.java +++ b/src/main/java/net/minecraft/server/Block.java @@ -0,0 +0,0 @@ public class Block implements IMaterial { @@ -17,7 +17,7 @@ index 2c0e59c60d..3aa4cb6401 100644 IBlockData iblockdata1 = iblockdata; BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index 639f55ed98..2d29da8560 100644 +index 607d6da6a..9783576e3 100644 --- a/src/main/java/net/minecraft/server/EntityEnderman.java +++ b/src/main/java/net/minecraft/server/EntityEnderman.java @@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster { diff --git a/Spigot-Server-Patches/Fix-client-rendering-skulls-from-same-user.patch b/Spigot-Server-Patches/Fix-client-rendering-skulls-from-same-user.patch index b0545b1c14..9962ed59b9 100644 --- a/Spigot-Server-Patches/Fix-client-rendering-skulls-from-same-user.patch +++ b/Spigot-Server-Patches/Fix-client-rendering-skulls-from-same-user.patch @@ -12,7 +12,7 @@ This allows the client to render multiple skull textures from the same user, for when different skins were used when skull was made. diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index f849a29e2a..c69a067ef1 100644 +index 5fc7124dd..33d9cac4d 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -0,0 +0,0 @@ public final class ItemStack { @@ -25,7 +25,7 @@ index f849a29e2a..c69a067ef1 100644 private EntityItemFrame i; private ShapeDetectorBlock j; diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index 0d67676f7d..fa2d3ce8cb 100644 +index d9574a9ac..93ae6dcd7 100644 --- a/src/main/java/net/minecraft/server/PacketDataSerializer.java +++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java @@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { @@ -62,7 +62,7 @@ index 0d67676f7d..fa2d3ce8cb 100644 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 363ab5da12..d19a30ad87 100644 +index 3a1d0deb0..1fcbbd698 100644 --- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet { @@ -71,10 +71,10 @@ index 363ab5da12..d19a30ad87 100644 NBTTagCompound nbttagcompound = tileentity.b(); + if (tileentity instanceof TileEntitySkull) { TileEntitySkull.sanitizeTileEntityUUID(nbttagcompound); } // Paper - this.f.add(nbttagcompound); + this.g.add(nbttagcompound); } diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java -index 177cceb77f..0882d82cef 100644 +index 177cceb77..0882d82ce 100644 --- a/src/main/java/net/minecraft/server/TileEntitySkull.java +++ b/src/main/java/net/minecraft/server/TileEntitySkull.java @@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa diff --git a/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch b/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch index e2487b94a7..3e088f97f1 100644 --- a/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch +++ b/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch @@ -11,7 +11,7 @@ This will ensure that dead entities are skipped from iteration since they shouldn't of been in the list in the first place. diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index eecf27370b..d704fc79c0 100644 +index eecf27370..d704fc79c 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -0,0 +0,0 @@ public class PaperCommand extends Command { @@ -23,7 +23,7 @@ index eecf27370b..d704fc79c0 100644 MutablePair> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap())); ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.getChunkX(), e.getChunkZ()); diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index a74e389d14..09e010e670 100644 +index b156f5428..c7c600b80 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @@ -37,7 +37,7 @@ index a74e389d14..09e010e670 100644 @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { while (iterator.hasNext()) { - Entity entity = (Entity) iterator.next(); + T entity = (T) iterator.next(); // CraftBukkit - decompile error + if (entity.shouldBeRemoved) continue; // Paper if ((entitytypes == null || entity.getEntityType() == entitytypes) && entity.getBoundingBox().c(axisalignedbb) && predicate.test(entity)) { @@ -51,19 +51,19 @@ index a74e389d14..09e010e670 100644 if (oclass.isInstance(t0) && t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) { // Spigot - instance check list.add(t0); diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 701090c11e..7d579c119b 100644 +index be8f6ac99..4a931aaf4 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - public float D; - public float E; - public float F; + protected int numCollisions = 0; // Paper + public void inactiveTick() { } + // Spigot end + public boolean shouldBeRemoved; // Paper - public float fallDistance; - private float av; - private float aw; + + public float getBukkitYaw() { + return this.yaw; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index a5ba64a4c9..6c55ae1a9f 100644 +index 110d6e571..afae55973 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World { @@ -92,7 +92,7 @@ index a5ba64a4c9..6c55ae1a9f 100644 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 67137d69c1..01b869a06f 100644 +index 96ff39e13..cc4788c96 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { diff --git a/Spigot-Server-Patches/Implement-Expanded-ArmorStand-API.patch b/Spigot-Server-Patches/Implement-Expanded-ArmorStand-API.patch index 8c0d38b798..b0edd21543 100644 --- a/Spigot-Server-Patches/Implement-Expanded-ArmorStand-API.patch +++ b/Spigot-Server-Patches/Implement-Expanded-ArmorStand-API.patch @@ -8,15 +8,15 @@ Add the following: - Enable/Disable slot interactions diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index b337fb812..d8497fa5e 100644 +index 80bf58b05..eb6cf3a86 100644 --- a/src/main/java/net/minecraft/server/EntityArmorStand.java +++ b/src/main/java/net/minecraft/server/EntityArmorStand.java @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { private final NonNullList armorItems; - private boolean bD; - public long bt; -- private int bE; -+ private int bE; public void setDisabledSlots(int i) { bE = i;} public int getDisabledSlots() { return bE ;} // Paper - OBFHELPER + private boolean armorStandInvisible; + public long bq; +- private int bB; ++ private int bB; public void setDisabledSlots(int i) { bB = i; } public int getDisabledSlots() { return bB; } // Paper - OBFHELPER public Vector3f headPose; public Vector3f bodyPose; public Vector3f leftArmPose; @@ -25,8 +25,8 @@ index b337fb812..d8497fa5e 100644 } + public boolean isSlotDisabled(EnumItemSlot slot) { return this.d(slot); } // Paper - OBFHELPER - public boolean d(EnumItemSlot enumitemslot) { - return (this.bE & 1 << enumitemslot.c()) != 0 || enumitemslot.a() == EnumItemSlot.Function.HAND && !this.hasArms(); + private boolean d(EnumItemSlot enumitemslot) { + return (this.bB & 1 << enumitemslot.c()) != 0 || enumitemslot.a() == EnumItemSlot.Function.HAND && !this.hasArms(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java index 124c3185b..d1d689e5d 100644 diff --git a/Spigot-Server-Patches/Inventory-removeItemAnySlot.patch b/Spigot-Server-Patches/Inventory-removeItemAnySlot.patch index 47570e976f..6ead028e96 100644 --- a/Spigot-Server-Patches/Inventory-removeItemAnySlot.patch +++ b/Spigot-Server-Patches/Inventory-removeItemAnySlot.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Inventory#removeItemAnySlot diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java -index 0d637e207e..026a0c3995 100644 +index 0d637e207..026a0c399 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java @@ -0,0 +0,0 @@ public class CraftInventory implements Inventory { diff --git a/Spigot-Server-Patches/MC-111480-Start-Entity-ID-s-at-1.patch b/Spigot-Server-Patches/MC-111480-Start-Entity-ID-s-at-1.patch index 947b995fc9..64271d0e5f 100644 --- a/Spigot-Server-Patches/MC-111480-Start-Entity-ID-s-at-1.patch +++ b/Spigot-Server-Patches/MC-111480-Start-Entity-ID-s-at-1.patch @@ -7,7 +7,7 @@ DataWatchers that store Entity ID's treat 0 as special, and can break things such as Elytra Fireworks. diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 7d579c119b..7811beb807 100644 +index 4a931aaf4..75343a438 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke diff --git a/Spigot-Server-Patches/MC-135506-Experience-should-save-as-Integers.patch b/Spigot-Server-Patches/MC-135506-Experience-should-save-as-Integers.patch index e86e1efd31..e4203f2483 100644 --- a/Spigot-Server-Patches/MC-135506-Experience-should-save-as-Integers.patch +++ b/Spigot-Server-Patches/MC-135506-Experience-should-save-as-Integers.patch @@ -5,7 +5,7 @@ Subject: [PATCH] MC-135506: Experience should save as Integers diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index ba3e66f9e..d8f23ff02 100644 +index 87c6b77ce..53c6c3389 100644 --- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java +++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java @@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity { diff --git a/Spigot-Server-Patches/Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch b/Spigot-Server-Patches/Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch index 211bb6a25a..37ec37f86c 100644 --- a/Spigot-Server-Patches/Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch +++ b/Spigot-Server-Patches/Make-CraftWorld-loadChunk-int-int-false-load-unconve.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Make CraftWorld#loadChunk(int, int, false) load unconverted diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index f57023529d..dc0a07c7cd 100644 +index a2739b887..182322752 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { diff --git a/Spigot-Server-Patches/Make-EnderDragon-implement-Mob.patch b/Spigot-Server-Patches/Make-EnderDragon-implement-Mob.patch index a1c858da6a..46a73bcd79 100644 --- a/Spigot-Server-Patches/Make-EnderDragon-implement-Mob.patch +++ b/Spigot-Server-Patches/Make-EnderDragon-implement-Mob.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Make EnderDragon implement Mob diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java -index cc115cc368..4947249da2 100644 +index cc115cc36..4947249da 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftComplexLivingEntity.java @@ -0,0 +0,0 @@ diff --git a/Spigot-Server-Patches/Mark-chunk-dirty-anytime-entities-change-to-guarante.patch b/Spigot-Server-Patches/Mark-chunk-dirty-anytime-entities-change-to-guarante.patch index bf6dd1c935..65ac05603a 100644 --- a/Spigot-Server-Patches/Mark-chunk-dirty-anytime-entities-change-to-guarante.patch +++ b/Spigot-Server-Patches/Mark-chunk-dirty-anytime-entities-change-to-guarante.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 1da80e244b..4c0fc8f7ea 100644 +index 1efddb533..6774c6480 100644 --- a/src/main/java/net/minecraft/server/Chunk.java +++ b/src/main/java/net/minecraft/server/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { diff --git a/Spigot-Server-Patches/Optimize-BlockPosition-helper-methods.patch b/Spigot-Server-Patches/Optimize-BlockPosition-helper-methods.patch index 5a809195f9..c2a6aab318 100644 --- a/Spigot-Server-Patches/Optimize-BlockPosition-helper-methods.patch +++ b/Spigot-Server-Patches/Optimize-BlockPosition-helper-methods.patch @@ -6,14 +6,14 @@ Subject: [PATCH] Optimize BlockPosition helper methods Resolves #1338 diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 04f754d2c1..16f0930404 100644 +index 5a505b753..142476395 100644 --- a/src/main/java/net/minecraft/server/BlockPosition.java +++ b/src/main/java/net/minecraft/server/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition implements MinecraftSeriali } public BlockPosition up() { -- return this.up(1); +- return this.shift(EnumDirection.UP); + return new BlockPosition(this.getX(), this.getY() + 1, this.getZ()); // Paper - Optimize BlockPosition } @@ -22,18 +22,20 @@ index 04f754d2c1..16f0930404 100644 + return i == 0 ? this : new BlockPosition(this.getX(), this.getY() + i, this.getZ()); // Paper - Optimize BlockPosition } + @Override public BlockPosition down() { -- return this.down(1); +- return this.shift(EnumDirection.DOWN); + return new BlockPosition(this.getX(), this.getY() - 1, this.getZ()); // Paper - Optimize BlockPosition } + @Override public BlockPosition down(int i) { - return this.shift(EnumDirection.DOWN, i); + return i == 0 ? this : new BlockPosition(this.getX(), this.getY() - i, this.getZ()); // Paper - Optimize BlockPosition } public BlockPosition north() { -- return this.north(1); +- return this.shift(EnumDirection.NORTH); + return new BlockPosition(this.getX(), this.getY(), this.getZ() - 1); // Paper - Optimize BlockPosition } @@ -43,7 +45,7 @@ index 04f754d2c1..16f0930404 100644 } public BlockPosition south() { -- return this.south(1); +- return this.shift(EnumDirection.SOUTH); + return new BlockPosition(this.getX(), this.getY(), this.getZ() + 1); // Paper - Optimize BlockPosition } @@ -53,7 +55,7 @@ index 04f754d2c1..16f0930404 100644 } public BlockPosition west() { -- return this.west(1); +- return this.shift(EnumDirection.WEST); + return new BlockPosition(this.getX() - 1, this.getY(), this.getZ()); // Paper - Optimize BlockPosition } @@ -63,7 +65,7 @@ index 04f754d2c1..16f0930404 100644 } public BlockPosition east() { -- return this.east(1); +- return this.shift(EnumDirection.EAST); + return new BlockPosition(this.getX() + 1, this.getY(), this.getZ()); // Paper - Optimize BlockPosition } @@ -73,7 +75,7 @@ index 04f754d2c1..16f0930404 100644 } public BlockPosition shift(EnumDirection enumdirection) { -- return this.shift(enumdirection, 1); +- return new BlockPosition(this.getX() + enumdirection.getAdjacentX(), this.getY() + enumdirection.getAdjacentY(), this.getZ() + enumdirection.getAdjacentZ()); + // Paper Start - Optimize BlockPosition + switch(enumdirection) { + case UP: @@ -94,5 +96,5 @@ index 04f754d2c1..16f0930404 100644 + // Paper End } - public BlockPosition shift(EnumDirection enumdirection, int i) { + @Override -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch b/Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch index aa99dafbdb..266a3e1b2f 100644 --- a/Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch +++ b/Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch @@ -7,7 +7,7 @@ Avoids a hashmap lookup by cacheing a reference to the CraftBlockData and cloning it when one is needed. diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java -index 367b02800a..9fd1b4915f 100644 +index 08d884649..8fb0b5af0 100644 --- a/src/main/java/net/minecraft/server/IBlockData.java +++ b/src/main/java/net/minecraft/server/IBlockData.java @@ -0,0 +0,0 @@ import com.google.common.collect.ImmutableMap; @@ -33,10 +33,10 @@ index 367b02800a..9fd1b4915f 100644 + // Paper end + public Material getMaterial() { - return this.getBlock().l(this); + return this.getBlock().k(this); } diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index 99c361dc69..839e645b69 100644 +index e371e7f6d..32e1e7e20 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java @@ -0,0 +0,0 @@ public class CraftBlockData implements BlockData { diff --git a/Spigot-Server-Patches/Optimize-Hoppers.patch b/Spigot-Server-Patches/Optimize-Hoppers.patch index f19fa4b299..7ae1486240 100644 --- a/Spigot-Server-Patches/Optimize-Hoppers.patch +++ b/Spigot-Server-Patches/Optimize-Hoppers.patch @@ -11,13 +11,14 @@ Subject: [PATCH] Optimize Hoppers * Skip subsequent InventoryMoveItemEvents if a plugin does not use the item after first event fire for an iteration diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 9ee27f638..269c1ace4 100644 +index 42d14fac2..80d66c647 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { - squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 0.0D); + this.armorStandTick = this.getBoolean("armor-stands-tick", this.armorStandTick); + log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default"); } - ++ + public boolean cooldownHopperWhenFull = true; + public boolean disableHopperMoveEvents = false; + private void hopperOptimizations() { @@ -26,12 +27,9 @@ index 9ee27f638..269c1ace4 100644 + disableHopperMoveEvents = getBoolean("hopper.disable-move-event", disableHopperMoveEvents); + log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled")); + } -+ - public boolean disableSprintInterruptionOnAttack; - private void disableSprintInterruptionOnAttack() { - disableSprintInterruptionOnAttack = getBoolean("game-mechanics.disable-sprint-interruption-on-attack", false); + } diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index c69a067ef..1e23d77e7 100644 +index 33d9cac4d..627fa465c 100644 --- a/src/main/java/net/minecraft/server/ItemStack.java +++ b/src/main/java/net/minecraft/server/ItemStack.java @@ -0,0 +0,0 @@ public final class ItemStack { @@ -39,15 +37,18 @@ index c69a067ef..1e23d77e7 100644 } - public ItemStack cloneItemStack() { -- ItemStack itemstack = new ItemStack(this.getItem(), this.count); + public ItemStack cloneItemStack() { return cloneItemStack(false); } // Paper + public ItemStack cloneItemStack(boolean origItem) { // Paper -+ ItemStack itemstack = new ItemStack(origItem ? this.item : this.getItem(), this.count); // Paper + if (this.isEmpty()) { + return ItemStack.a; + } else { +- ItemStack itemstack = new ItemStack(this.getItem(), this.count); ++ ItemStack itemstack = new ItemStack(origItem ? this.item : this.getItem(), this.count); // Paper - itemstack.d(this.C()); - if (this.tag != null) { + itemstack.d(this.C()); + if (this.tag != null) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6f410ca92..c07578067 100644 +index dd2d8712e..206a4ad64 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { return worldserver.getWorldData().getName() + " " + IRegistry.DIMENSION_TYPE.getKey(worldserver.worldProvider.getDimensionManager()); diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index c72b01386..b8ddb99fa 100644 +index 958279249..a8e64dfda 100644 --- a/src/main/java/net/minecraft/server/TileEntity.java +++ b/src/main/java/net/minecraft/server/TileEntity.java @@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { // Paper @@ -79,7 +80,7 @@ index c72b01386..b8ddb99fa 100644 this.world.b(this.position, this); if (!this.c.isAir()) { diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index 1ba98bf73..6f6519f6c 100644 +index e08faf538..15588103b 100644 --- a/src/main/java/net/minecraft/server/TileEntityHopper.java +++ b/src/main/java/net/minecraft/server/TileEntityHopper.java @@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi @@ -234,8 +235,8 @@ index 1ba98bf73..6f6519f6c 100644 + } + // Paper end + - private boolean t() { - IInventory iinventory = this.u(); + private boolean j() { + IInventory iinventory = this.k(); @@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi if (this.b(iinventory, enumdirection)) { diff --git a/Spigot-Server-Patches/Optimize-RegistryMaterials.patch b/Spigot-Server-Patches/Optimize-RegistryMaterials.patch index a300645040..6a89e4c586 100644 --- a/Spigot-Server-Patches/Optimize-RegistryMaterials.patch +++ b/Spigot-Server-Patches/Optimize-RegistryMaterials.patch @@ -8,7 +8,7 @@ Use larger initial sizes to increase bucket capacity on the BiMap BiMap.get was seen to be using a good bit of CPU time. diff --git a/src/main/java/net/minecraft/server/RegistryMaterials.java b/src/main/java/net/minecraft/server/RegistryMaterials.java -index f291e05b26..fed38e6ef0 100644 +index 2d6a7b3a4..8477febca 100644 --- a/src/main/java/net/minecraft/server/RegistryMaterials.java +++ b/src/main/java/net/minecraft/server/RegistryMaterials.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; @@ -17,20 +17,17 @@ index f291e05b26..fed38e6ef0 100644 protected static final Logger LOGGER = LogManager.getLogger(); - protected final RegistryID b = new RegistryID<>(256); - protected final BiMap c = HashBiMap.create(); -- protected Object[] d; + protected final RegistryID b = new RegistryID<>(2048); // Paper - use bigger expected size to reduce collisions + protected final BiMap c = HashBiMap.create(2048); // Paper - use bigger expected size to reduce collisions -+ protected T[] d; // Paper - Decompile fix - private int R; + protected Object[] d; + private int V; - public RegistryMaterials() {} @@ -0,0 +0,0 @@ public class RegistryMaterials extends IRegistryWritable { - return null; - } - -- this.d = collection.toArray(new Object[collection.size()]); -+ this.d = (T[]) collection.toArray(new Object[collection.size()]); // Paper - Decompile fix + this.d = collection.toArray(new Object[collection.size()]); } - return this.d[random.nextInt(this.d.length)]; +- return this.d[random.nextInt(this.d.length)]; ++ return (T) this.d[random.nextInt(this.d.length)]; // Paper - Decompile fix + } + } -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Option-to-prevent-armor-stands-from-doing-entity-loo.patch b/Spigot-Server-Patches/Option-to-prevent-armor-stands-from-doing-entity-loo.patch index 06488fea86..da44264611 100644 --- a/Spigot-Server-Patches/Option-to-prevent-armor-stands-from-doing-entity-loo.patch +++ b/Spigot-Server-Patches/Option-to-prevent-armor-stands-from-doing-entity-loo.patch @@ -5,26 +5,24 @@ Subject: [PATCH] Option to prevent armor stands from doing entity lookups diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java -index 1ffcebd3c..721685704 100644 +index b4e5948cc..0a99b8fe9 100644 --- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java +++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java @@ -0,0 +0,0 @@ public class PaperWorldConfig { + log("Bed Search Radius: " + bedSearchRadius); } } - ++ + public boolean armorStandEntityLookups = true; + private void armorStandEntityLookups() { + armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); + } -+ - public int maxCollisionsPerEntity; - private void maxEntityCollision() { - maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) ); + } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 95c809ba9..98195fb16 100644 +index 7fcc8c52d..eea3a542d 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } } @@ -32,11 +30,11 @@ index 95c809ba9..98195fb16 100644 + @Override + public boolean getCubes(@Nullable Entity entity, AxisAlignedBB axisAlignedBB) { + if (entity instanceof EntityArmorStand && !entity.world.paperConfig.armorStandEntityLookups) return false; -+ return GeneratorAccess.super.getCubes(entity, axisAlignedBB); ++ return GeneratorAccess.super.getCubes(entity, axisAlignedBB) + } + // Paper end + - public boolean a(AxisAlignedBB axisalignedbb) { + public boolean b(AxisAlignedBB axisalignedbb) { int i = MathHelper.floor(axisalignedbb.minX); int j = MathHelper.f(axisalignedbb.maxX); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/Prevent-Saving-Bad-entities-to-chunks.patch b/Spigot-Server-Patches/Prevent-Saving-Bad-entities-to-chunks.patch index cb01dba86f..9dcae614bc 100644 --- a/Spigot-Server-Patches/Prevent-Saving-Bad-entities-to-chunks.patch +++ b/Spigot-Server-Patches/Prevent-Saving-Bad-entities-to-chunks.patch @@ -18,7 +18,7 @@ an invalid entity. This should reduce log occurrences of dupe uuid messages. diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 03be77299b..e778c2e857 100644 +index 4af5a230b..6371f2f5b 100644 --- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java +++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java @@ -0,0 +0,0 @@ public class ChunkRegionLoader { @@ -32,10 +32,10 @@ index 03be77299b..e778c2e857 100644 @@ -0,0 +0,0 @@ public class ChunkRegionLoader { while (iterator1.hasNext()) { Entity entity = (Entity) iterator1.next(); - NBTTagCompound nbttagcompound3 = new NBTTagCompound(); + NBTTagCompound nbttagcompound4 = new NBTTagCompound(); - + // Paper start -+ if ((int)Math.floor(entity.locX) >> 4 != chunk.getPos().x || (int)Math.floor(entity.locZ) >> 4 != chunk.getPos().z) { ++ if ((int) Math.floor(entity.locX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.locZ()) >> 4 != chunk.getPos().z) { + LogManager.getLogger().warn(entity + " is not in this chunk, skipping save. This a bug fix to a vanilla bug. Do not report this to PaperMC please."); + toUpdate.add(entity); + continue; @@ -44,9 +44,9 @@ index 03be77299b..e778c2e857 100644 + continue; + } + // Paper end - if (entity.d(nbttagcompound3)) { + if (entity.d(nbttagcompound4)) { chunk.d(true); - nbttaglist2.add(nbttagcompound3); + nbttaglist2.add(nbttagcompound4); } } } diff --git a/Spigot-Server-Patches/Provide-option-to-use-a-versioned-world-folder-for-t.patch b/Spigot-Server-Patches/Provide-option-to-use-a-versioned-world-folder-for-t.patch deleted file mode 100644 index 14a4dbe48c..0000000000 --- a/Spigot-Server-Patches/Provide-option-to-use-a-versioned-world-folder-for-t.patch +++ /dev/null @@ -1,228 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Aikar -Date: Sun, 29 Jul 2018 15:48:50 -0400 -Subject: [PATCH] Provide option to use a versioned world folder for testing - -This should not ever be used in production!! - -This setting is intended for testing so you can try out converting your world -without actually modifying the world files. - -This will add some additional overhead to your world, but you're -just testing anyways so that's not a big deal :) - -Will store in a folder named after the current version. - -PlayerData and Data folders are copied on server start, so there -may be some delay there, but region files are only copied on demand. - -This is highly experiemental so backup your world before relying on this to not modify it - -diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java -index eeef7d330b..dfdc7c384d 100644 ---- a/src/main/java/com/destroystokyo/paper/PaperConfig.java -+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java -@@ -0,0 +0,0 @@ import java.util.List; - import java.util.Map; - import java.util.concurrent.TimeUnit; - import java.util.logging.Level; -+import java.util.logging.Logger; - import java.util.regex.Pattern; - - import com.google.common.collect.Lists; -@@ -0,0 +0,0 @@ public class PaperConfig { - Bukkit.getLogger().log(Level.INFO, "Using Aikar's Alternative Luck Formula to apply Luck attribute to all loot pool calculations. See https://luckformula.emc.gs"); - } - } -+ -+ public static boolean useVersionedWorld = false; -+ private static void useVersionedWorld() { -+ useVersionedWorld = getBoolean("settings.use-versioned-world", false); -+ if (useVersionedWorld) { -+ Logger logger = Bukkit.getLogger(); -+ String ver = MinecraftServer.getServer().getVersion(); -+ logger.log(Level.INFO, "******************************************************"); -+ logger.log(Level.INFO, "*** Using a versioned world folder. Your world will be saved"); -+ logger.log(Level.INFO, "*** to into the " + ver + " folder, but copied from your current world."); -+ logger.log(Level.INFO, "*** "); -+ logger.log(Level.INFO, "*** This setting should not be used in your real world!!!"); -+ logger.log(Level.INFO, "*** If you want to retain the new world, you need to move "); -+ logger.log(Level.INFO, "*** the folders out of the " + ver + " folder and overwrite existing"); -+ logger.log(Level.INFO, "*** "); -+ logger.log(Level.INFO, "*** Deleting the " + ver + " folder will cause it to recreate again"); -+ logger.log(Level.INFO, "*** from your unversioned world files."); -+ logger.log(Level.INFO, "*** "); -+ logger.log(Level.INFO, "*** You should backup your original world files incase something goes"); -+ logger.log(Level.INFO, "*** wrong with this system! This is not a backup system."); -+ logger.log(Level.INFO, "******************************************************"); -+ } -+ } - } -diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 21b3b06f53..8718811655 100644 ---- a/src/main/java/net/minecraft/server/RegionFileCache.java -+++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -0,0 +0,0 @@ import java.io.IOException; - import javax.annotation.Nullable; - import com.destroystokyo.paper.PaperConfig; // Paper - -+import org.apache.logging.log4j.LogManager; -+ - public abstract class RegionFileCache implements AutoCloseable { - - public final Long2ObjectLinkedOpenHashMap cache = new Long2ObjectLinkedOpenHashMap(); - private final File a; -+ // Paper start -+ private final File templateWorld; -+ private final File actualWorld; -+ private boolean useAltWorld; -+ // Paper end -+ - - protected RegionFileCache(File file) { - this.a = file; -+ // Paper end -+ -+ this.actualWorld = file; -+ if (com.destroystokyo.paper.PaperConfig.useVersionedWorld) { -+ this.useAltWorld = true; -+ String name = file.getName(); -+ File container = file.getParentFile().getParentFile(); -+ if (name.equals("DIM-1") || name.equals("DIM1")) { -+ container = container.getParentFile(); -+ } -+ this.templateWorld = new File(container, name); -+ File region = new File(file, "region"); -+ if (!region.exists()) { -+ region.mkdirs(); -+ } -+ } else { -+ this.useAltWorld = false; -+ this.templateWorld = file; -+ } -+ // Paper start - } - - private RegionFile a(ChunkCoordIntPair chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit -@@ -0,0 +0,0 @@ public abstract class RegionFileCache implements AutoCloseable { - this.a.mkdirs(); - } - -+ copyIfNeeded(chunkcoordintpair.x, chunkcoordintpair.z); // Paper - File file = new File(this.a, "r." + chunkcoordintpair.getRegionX() + "." + chunkcoordintpair.getRegionZ() + ".mca"); - if (existingOnly && !file.exists()) return null; // CraftBukkit - RegionFile regionfile1 = new RegionFile(file); -@@ -0,0 +0,0 @@ public abstract class RegionFileCache implements AutoCloseable { - } - } - -+ public static File getRegionFileName(File file, int i, int j) { -+ File file1 = new File(file, "region"); -+ return new File(file1, "r." + (i >> 5) + "." + (j >> 5) + ".mca"); -+ } -+ public synchronized boolean hasRegionFile(File file, int i, int j) { -+ return cache.containsKey(ChunkCoordIntPair.pair(i, j)); -+ } -+ // Paper End -+ - @Nullable - public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException { - RegionFile regionfile = this.a(chunkcoordintpair, false); // CraftBukkit -@@ -0,0 +0,0 @@ public abstract class RegionFileCache implements AutoCloseable { - - // CraftBukkit start - public boolean chunkExists(ChunkCoordIntPair pos) throws IOException { -+ copyIfNeeded(pos.x, pos.z); // Paper - RegionFile regionfile = a(pos, true); - - return regionfile != null ? regionfile.d(pos) : false; - } - // CraftBukkit end -+ -+ private void copyIfNeeded(int x, int z) { -+ if (!useAltWorld) { -+ return; -+ } -+ synchronized (RegionFileCache.class) { -+ if (hasRegionFile(this.actualWorld, x, z)) { -+ return; -+ } -+ File actual = RegionFileCache.getRegionFileName(this.actualWorld, x, z); -+ File template = RegionFileCache.getRegionFileName(this.templateWorld, x, z); -+ if (!actual.exists() && template.exists()) { -+ try { -+ net.minecraft.server.MinecraftServer.LOGGER.info("Copying" + template + " to " + actual); -+ java.nio.file.Files.copy(template.toPath(), actual.toPath(), java.nio.file.StandardCopyOption.COPY_ATTRIBUTES); -+ } catch (IOException e1) { -+ LogManager.getLogger().error("Error copying " + template + " to " + actual, e1); -+ MinecraftServer.getServer().safeShutdown(false); -+ com.destroystokyo.paper.util.SneakyThrow.sneaky(e1); -+ } -+ } -+ } -+ } - } -diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index 350ac42d6b..eaae446861 100644 ---- a/src/main/java/net/minecraft/server/WorldNBTStorage.java -+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java -@@ -0,0 +0,0 @@ public class WorldNBTStorage implements IPlayerFileData { - - public WorldNBTStorage(File file, String s, @Nullable MinecraftServer minecraftserver, DataFixer datafixer) { - this.a = datafixer; -+ // Paper start -+ if (com.destroystokyo.paper.PaperConfig.useVersionedWorld) { -+ File origBaseDir = new File(file, s); -+ final String currentVersion = MinecraftServer.getServer().getVersion(); -+ file = new File(file, currentVersion); -+ File baseDir = new File(file, s); -+ -+ if (!baseDir.exists() && origBaseDir.exists() && !baseDir.mkdirs()) { -+ LogManager.getLogger().error("Could not create world directory for " + file); -+ System.exit(1); -+ } -+ -+ try { -+ boolean printedHeader = false; -+ String[] dirs = {"advancements", "data", "datapacks", "playerdata", "stats"}; -+ for (String dir : dirs) { -+ File origPlayerData = new File(origBaseDir, dir); -+ File targetPlayerData = new File(baseDir, dir); -+ if (origPlayerData.exists() && !targetPlayerData.exists()) { -+ if (!printedHeader) { -+ LogManager.getLogger().info("**** VERSIONED WORLD - Copying files"); -+ printedHeader = true; -+ } -+ LogManager.getLogger().info("- Copying: " + dir); -+ org.apache.commons.io.FileUtils.copyDirectory(origPlayerData, targetPlayerData); -+ } -+ } -+ -+ String[] files = {"level.dat", "level.dat_old", "session.lock", "uid.dat"}; -+ for (String fileName : files) { -+ File origPlayerData = new File(origBaseDir, fileName); -+ File targetPlayerData = new File(baseDir, fileName); -+ if (origPlayerData.exists() && !targetPlayerData.exists()) { -+ if (!printedHeader) { -+ LogManager.getLogger().info("- Copying files"); -+ printedHeader = true; -+ } -+ LogManager.getLogger().info("- Copying: " + fileName); -+ org.apache.commons.io.FileUtils.copyFile(origPlayerData, targetPlayerData); -+ -+ } -+ } -+ if (printedHeader) { -+ LogManager.getLogger().info("**** VERSIONED WORLD - Copying DONE"); -+ } -+ } catch (IOException e) { -+ LogManager.getLogger().error("Error copying versioned world data for " + origBaseDir + " to " + baseDir, e); -+ com.destroystokyo.paper.util.SneakyThrow.sneaky(e); -+ } -+ -+ } -+ // Paper end - this.baseDir = new File(file, s); - this.baseDir.mkdirs(); - this.playerDir = new File(this.baseDir, "playerdata"); --- \ No newline at end of file diff --git a/Spigot-Server-Patches/Restore-vanlla-default-mob-spawn-range.patch b/Spigot-Server-Patches/Restore-vanlla-default-mob-spawn-range.patch index d618bb2f3e..0a18336b74 100644 --- a/Spigot-Server-Patches/Restore-vanlla-default-mob-spawn-range.patch +++ b/Spigot-Server-Patches/Restore-vanlla-default-mob-spawn-range.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Restore vanlla default mob-spawn-range diff --git a/src/main/java/org/spigotmc/SpigotWorldConfig.java b/src/main/java/org/spigotmc/SpigotWorldConfig.java -index 8c7dd013..4feea10d 100644 +index 8c7dd0133..4feea10de 100644 --- a/src/main/java/org/spigotmc/SpigotWorldConfig.java +++ b/src/main/java/org/spigotmc/SpigotWorldConfig.java @@ -0,0 +0,0 @@ public class SpigotWorldConfig diff --git a/Spigot-Server-Patches/Send-nearby-packets-from-world-player-list-not-serve.patch b/Spigot-Server-Patches/Send-nearby-packets-from-world-player-list-not-serve.patch index 329e1b6f10..3f15eda973 100644 --- a/Spigot-Server-Patches/Send-nearby-packets-from-world-player-list-not-serve.patch +++ b/Spigot-Server-Patches/Send-nearby-packets-from-world-player-list-not-serve.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Send nearby packets from world player list not server list diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 9e5cd22d7d..049d702cb9 100644 +index fd0f5c6f2..e46436623 100644 --- a/src/main/java/net/minecraft/server/PlayerList.java +++ b/src/main/java/net/minecraft/server/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { @@ -42,19 +42,19 @@ index 9e5cd22d7d..049d702cb9 100644 - if (entityplayer != entityhuman && entityplayer.dimension == dimensionmanager) { + if (entityplayer != entityhuman && (world != null || entityplayer.dimension == dimensionmanager)) { // Paper - double d4 = d0 - entityplayer.locX; - double d5 = d1 - entityplayer.locY; - double d6 = d2 - entityplayer.locZ; + double d4 = d0 - entityplayer.locX(); + double d5 = d1 - entityplayer.locY(); + double d6 = d2 - entityplayer.locZ(); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 6c55ae1a9f..8b55879c64 100644 +index afae55973..640e40ef8 100644 --- a/src/main/java/net/minecraft/server/WorldServer.java +++ b/src/main/java/net/minecraft/server/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World { } // CraftBukkit end this.globalEntityList.add(entitylightning); -- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX, entitylightning.locY, entitylightning.locZ, 512.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutSpawnEntityWeather(entitylightning)); -+ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX, entitylightning.locY, entitylightning.locZ, 512.0D, this, new PacketPlayOutSpawnEntityWeather(entitylightning)); // Paper - use world instead of dimension +- this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX(), entitylightning.locY(), entitylightning.locZ(), 512.0D, this.worldProvider.getDimensionManager(), new PacketPlayOutSpawnEntityWeather(entitylightning)); ++ this.server.getPlayerList().sendPacketNearby((EntityHuman) null, entitylightning.locX(), entitylightning.locY(), entitylightning.locZ(), 512.0D, this, new PacketPlayOutSpawnEntityWeather(entitylightning)); // Paper - use world instead of dimension } @Override @@ -68,7 +68,7 @@ index 6c55ae1a9f..8b55879c64 100644 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 01b869a06f..f57023529d 100644 +index cc4788c96..a2739b887 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { diff --git a/Spigot-Server-Patches/SkeletonHorse-Additions.patch b/Spigot-Server-Patches/SkeletonHorse-Additions.patch index 461dc9b07f..31f7d00cf0 100644 --- a/Spigot-Server-Patches/SkeletonHorse-Additions.patch +++ b/Spigot-Server-Patches/SkeletonHorse-Additions.patch @@ -5,15 +5,15 @@ Subject: [PATCH] SkeletonHorse Additions diff --git a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java -index ab6deaaa89..0aa77914ca 100644 +index 621f2afee..290cb9337 100644 --- a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java +++ b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java @@ -0,0 +0,0 @@ public class EntityHorseSkeleton extends EntityHorseAbstract { - private final PathfinderGoalHorseTrap bI = new PathfinderGoalHorseTrap(this); - private boolean bJ; -- private int bK; -+ private int bK;public int getTrapTime() { return this.bK; } // Paper - OBFHELPER + private final PathfinderGoalHorseTrap bF = new PathfinderGoalHorseTrap(this); + private boolean bG; +- private int bH; ++ private int bH; public int getTrapTime() { return this.bH; } // Paper - OBFHELPER public EntityHorseSkeleton(EntityTypes entitytypes, World world) { super(entitytypes, world); @@ -21,17 +21,17 @@ index ab6deaaa89..0aa77914ca 100644 return 0.96F; } -+ public boolean isTrap() { return this.dV(); } // Paper - OBFHELPER - public boolean dV() { - return this.bJ; ++ public boolean isTrap() { return this.eq(); } // Paper - OBFHELPER + public boolean eq() { + return this.bG; } + public void setTrap(boolean trap) { this.r(trap); } // Paper - OBFHELPER public void r(boolean flag) { - if (flag != this.bJ) { - this.bJ = flag; + if (flag != this.bG) { + this.bG = flag; diff --git a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java -index 7b0a6f82fb..f093744136 100644 +index dfe5a6358..37626f925 100644 --- a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java +++ b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java @@ -0,0 +0,0 @@ public class PathfinderGoalHorseTrap extends PathfinderGoal { @@ -43,7 +43,7 @@ index 7b0a6f82fb..f093744136 100644 this.a.r(false); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java -index e822c2200d..2a7d1d4ec2 100644 +index e822c2200..2a7d1d4ec 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java @@ -0,0 +0,0 @@ public class CraftSkeletonHorse extends CraftAbstractHorse implements SkeletonHo diff --git a/Spigot-Server-Patches/Slime-Pathfinder-Events.patch b/Spigot-Server-Patches/Slime-Pathfinder-Events.patch index 61ac41a5fe..04917caaa8 100644 --- a/Spigot-Server-Patches/Slime-Pathfinder-Events.patch +++ b/Spigot-Server-Patches/Slime-Pathfinder-Events.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Slime Pathfinder Events diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java -index a5238c6734..253ff9594c 100644 +index 3ecf73219..2efc18df9 100644 --- a/src/main/java/net/minecraft/server/EntitySlime.java +++ b/src/main/java/net/minecraft/server/EntitySlime.java @@ -0,0 +0,0 @@ package net.minecraft.server; @@ -26,15 +26,15 @@ index a5238c6734..253ff9594c 100644 @@ -0,0 +0,0 @@ public class EntitySlime extends EntityInsentient implements IMonster { super.b(nbttagcompound); nbttagcompound.setInt("Size", this.getSize() - 1); - nbttagcompound.setBoolean("wasOnGround", this.bA); + nbttagcompound.setBoolean("wasOnGround", this.bx); + nbttagcompound.setBoolean("Paper.canWander", this.canWander); // Paper } @Override @@ -0,0 +0,0 @@ public class EntitySlime extends EntityInsentient implements IMonster { - this.setSize(i + 1, false); - this.bA = nbttagcompound.getBoolean("wasOnGround"); + super.a(nbttagcompound); + this.bx = nbttagcompound.getBoolean("wasOnGround"); + // Paper start - check exists before loading or this will be loaded as false + if (nbttagcompound.hasKey("Paper.canWander")) { + this.canWander = nbttagcompound.getBoolean("Paper.canWander"); @@ -42,7 +42,7 @@ index a5238c6734..253ff9594c 100644 + // Paper end } - public boolean ea() { + public boolean ev() { @@ -0,0 +0,0 @@ public class EntitySlime extends EntityInsentient implements IMonster { @Override @@ -56,8 +56,8 @@ index a5238c6734..253ff9594c 100644 @Override public boolean a() { -- return (this.a.isInWater() || this.a.aD()) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; -+ return (this.a.isInWater() || this.a.aD()) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime && this.a.canWander && new SlimeSwimEvent((Slime) this.a.getBukkitEntity()).callEvent(); // Paper +- return (this.a.isInWater() || this.a.aH()) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; ++ return (this.a.isInWater() || this.a.aH()) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime && this.a.canWander && new SlimeSwimEvent((Slime) this.a.getBukkitEntity()).callEvent(); // Paper } @Override @@ -65,8 +65,8 @@ index a5238c6734..253ff9594c 100644 @Override public boolean a() { -- return this.a.getGoalTarget() == null && (this.a.onGround || this.a.isInWater() || this.a.aD() || this.a.hasEffect(MobEffects.LEVITATION)) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; -+ return this.a.canWander && this.a.getGoalTarget() == null && (this.a.onGround || this.a.isInWater() || this.a.aD() || this.a.hasEffect(MobEffects.LEVITATION)) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; +- return this.a.getGoalTarget() == null && (this.a.onGround || this.a.isInWater() || this.a.aH() || this.a.hasEffect(MobEffects.LEVITATION)) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; ++ return this.a.canWander && this.a.getGoalTarget() == null && (this.a.onGround || this.a.isInWater() || this.a.aH() || this.a.hasEffect(MobEffects.LEVITATION)) && this.a.getControllerMove() instanceof EntitySlime.ControllerMoveSlime; } @Override @@ -118,7 +118,7 @@ index a5238c6734..253ff9594c 100644 @Override @@ -0,0 +0,0 @@ public class EntitySlime extends EntityInsentient implements IMonster { this.a.a((Entity) this.a.getGoalTarget(), 10.0F, 10.0F); - ((EntitySlime.ControllerMoveSlime) this.a.getControllerMove()).a(this.a.yaw, this.a.dV()); + ((EntitySlime.ControllerMoveSlime) this.a.getControllerMove()).a(this.a.yaw, this.a.eq()); } + + // Paper start - clear timer and target when goal resets @@ -147,7 +147,7 @@ index a5238c6734..253ff9594c 100644 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java -index ce6ed6e890..6e9f1b66df 100644 +index ce6ed6e89..6e9f1b66d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java @@ -0,0 +0,0 @@ public class CraftSlime extends CraftMob implements Slime { diff --git a/Spigot-Server-Patches/Use-ConcurrentHashMap-in-JsonList.patch b/Spigot-Server-Patches/Use-ConcurrentHashMap-in-JsonList.patch index e0bf2e3af3..3a36e89fca 100644 --- a/Spigot-Server-Patches/Use-ConcurrentHashMap-in-JsonList.patch +++ b/Spigot-Server-Patches/Use-ConcurrentHashMap-in-JsonList.patch @@ -25,7 +25,7 @@ The point of this is readability, but does have a side-benefit of a small microp Finally, added a couple obfhelpers for the modified code diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java -index 734e7ecf63..8570e38f42 100644 +index 734e7ecf6..8570e38f4 100644 --- a/src/main/java/net/minecraft/server/JsonList.java +++ b/src/main/java/net/minecraft/server/JsonList.java @@ -0,0 +0,0 @@ public class JsonList> { diff --git a/Spigot-Server-Patches/Use-a-Queue-for-Queueing-Commands.patch b/Spigot-Server-Patches/Use-a-Queue-for-Queueing-Commands.patch index 7af34e0057..d68aba9964 100644 --- a/Spigot-Server-Patches/Use-a-Queue-for-Queueing-Commands.patch +++ b/Spigot-Server-Patches/Use-a-Queue-for-Queueing-Commands.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Use a Queue for Queueing Commands Lists are bad as Queues mmmkay. diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index c6eb88c34b..5bc19cd081 100644 +index 6e95a0452..3ed74ae0e 100644 --- a/src/main/java/net/minecraft/server/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/DedicatedServer.java @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer diff --git a/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch b/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch index be6ee09612..037bd0597b 100644 --- a/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch +++ b/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Vanished players don't have rights diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 9241874139..9776a29923 100644 +index 3458333c9..6ef5d2ebd 100644 --- a/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java @@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -16,9 +16,9 @@ index 9241874139..9776a29923 100644 + public boolean i; public final boolean blocksEntitySpawning() { return this.i; } // Paper - OBFHELPER public final List passengers; protected int j; - private Entity vehicle; + @Nullable diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java -index 3328a84792..367b02800a 100644 +index 8d9b9af9b..08d884649 100644 --- a/src/main/java/net/minecraft/server/IBlockData.java +++ b/src/main/java/net/minecraft/server/IBlockData.java @@ -0,0 +0,0 @@ public class IBlockData extends BlockDataAbstract implements @@ -30,21 +30,21 @@ index 3328a84792..367b02800a 100644 return this.getBlock().b(this, iblockaccess, blockposition, voxelshapecollision); } diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java -index c34c635a85..0c8b11bbec 100644 +index ab875a736..aed353365 100644 --- a/src/main/java/net/minecraft/server/ItemBlock.java +++ b/src/main/java/net/minecraft/server/ItemBlock.java @@ -0,0 +0,0 @@ public class ItemBlock extends Item { EntityHuman entityhuman = blockactioncontext.getEntity(); VoxelShapeCollision voxelshapecollision = entityhuman == null ? VoxelShapeCollision.a() : VoxelShapeCollision.a((Entity) entityhuman); // CraftBukkit start - store default return -- boolean defaultReturn = (!this.d() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition(), voxelshapecollision); +- boolean defaultReturn = (!this.T_() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && blockactioncontext.getWorld().a(iblockdata, blockactioncontext.getClickPosition(), voxelshapecollision); + World world = blockactioncontext.getWorld(); // Paper -+ boolean defaultReturn = (!this.d() || iblockdata.canPlace(world, blockactioncontext.getClickPosition())) && world.checkEntityCollision(iblockdata, entityhuman, voxelshapecollision, blockactioncontext.getClickPosition(), true); // Paper ++ boolean defaultReturn = (!this.T_() || iblockdata.canPlace(blockactioncontext.getWorld(), blockactioncontext.getClickPosition())) && world.checkEntityCollision(iblockdata, entityhuman, voxelshapecollision, blockactioncontext.getClickPosition(), true); // Paper org.bukkit.entity.Player player = (blockactioncontext.getEntity() instanceof EntityPlayer) ? (org.bukkit.entity.Player) blockactioncontext.getEntity().getBukkitEntity() : null; BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), player, CraftBlockData.fromData(iblockdata), defaultReturn); diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java -index 3801b3f21d..092f02cc2f 100644 +index 0f64a3c05..0f95bcbcc 100644 --- a/src/main/java/net/minecraft/server/VoxelShape.java +++ b/src/main/java/net/minecraft/server/VoxelShape.java @@ -0,0 +0,0 @@ public abstract class VoxelShape { @@ -56,7 +56,7 @@ index 3801b3f21d..092f02cc2f 100644 return (VoxelShape) (this.isEmpty() ? VoxelShapes.a() : new VoxelShapeArray(this.a, new DoubleListOffset(this.a(EnumDirection.EnumAxis.X), d0), new DoubleListOffset(this.a(EnumDirection.EnumAxis.Y), d1), new DoubleListOffset(this.a(EnumDirection.EnumAxis.Z), d2))); } diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java -index b8659f703c..c8bd4b7034 100644 +index 143be566c..08c83c62d 100644 --- a/src/main/java/net/minecraft/server/VoxelShapes.java +++ b/src/main/java/net/minecraft/server/VoxelShapes.java @@ -0,0 +0,0 @@ public final class VoxelShapes { @@ -74,19 +74,19 @@ index b8659f703c..c8bd4b7034 100644 + public static final boolean applyOperation(VoxelShape voxelshape, VoxelShape voxelshape1, OperatorBoolean operatorboolean) { return VoxelShapes.c(voxelshape, voxelshape1, operatorboolean); } // Paper - OBFHELPER public static boolean c(VoxelShape voxelshape, VoxelShape voxelshape1, OperatorBoolean operatorboolean) { if (operatorboolean.apply(false, false)) { - throw new IllegalArgumentException(); + throw (IllegalArgumentException) SystemUtils.c(new IllegalArgumentException()); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index cacc18ca41..c60279da8f 100644 +index eea3a542d..bdbabe6a0 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ public abstract class World implements IIBlockAccess, GeneratorAccess, AutoClose +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); } + // Paper start + // ret true if no collision + public final boolean checkEntityCollision(IBlockData data, Entity source, VoxelShapeCollision voxelshapedcollision, -+ BlockPosition position, boolean checkCanSee) { ++ BlockPosition position, boolean checkCanSee) { + // Copied from IWorldReader#a(IBlockData, BlockPosition, VoxelShapeCollision) & EntityAccess#a(Entity, VoxelShape) + VoxelShape voxelshape = data.getCollisionShape(this, position, voxelshapedcollision); + if (voxelshape.isEmpty()) { @@ -94,18 +94,16 @@ index cacc18ca41..c60279da8f 100644 + } + + voxelshape = voxelshape.offset((double) position.getX(), (double) position.getY(), (double) position.getZ()); -+ + if (voxelshape.isEmpty()) { + return true; + } + + List entities = this.getEntities(null, voxelshape.getBoundingBox()); -+ + for (int i = 0, len = entities.size(); i < len; ++i) { + Entity entity = entities.get(i); + + if (checkCanSee && source instanceof EntityPlayer && entity instanceof EntityPlayer -+ && !((EntityPlayer)source).getBukkitEntity().canSee(((EntityPlayer)entity).getBukkitEntity())) { ++ && !((EntityPlayer) source).getBukkitEntity().canSee(((EntityPlayer) entity).getBukkitEntity())) { + continue; + } + @@ -126,10 +124,10 @@ index cacc18ca41..c60279da8f 100644 + // Paper end + @Override - public BiomeBase getBiome(BlockPosition blockposition) { - IChunkProvider ichunkprovider = this.getChunkProvider(); + public boolean p_() { + return this.isClientSide; diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index ade1d42f7e..ac4369dcef 100644 +index 7967222d9..e954c59d5 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -0,0 +0,0 @@ public class CraftEventFactory {