diff --git a/Spigot-Server-Patches/Add-Heightmap-API.patch b/Spigot-Server-Patches/Add-Heightmap-API.patch index 62966a96c5..b767e1e1be 100644 --- a/Spigot-Server-Patches/Add-Heightmap-API.patch +++ b/Spigot-Server-Patches/Add-Heightmap-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add Heightmap API diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index dfc695084..10bb06489 100644 +index 7d39a8fbc..9889b0543 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 GeneratorAccess, AutoCloseable { diff --git a/Spigot-Server-Patches/Add-TNTPrimeEvent.patch b/Spigot-Server-Patches/Add-TNTPrimeEvent.patch index 494495da3c..e0403fea74 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 9cf7d0b9e..15d44cd98 100644 +index 0ece78d4d..3400e7ce3 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 9cf7d0b9e..15d44cd98 100644 } } diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java -index 44d26e096..199276f3a 100644 +index 44d26e096..ca9b0539f 100644 --- a/src/main/java/net/minecraft/server/BlockTNT.java +++ b/src/main/java/net/minecraft/server/BlockTNT.java @@ -0,0 +0,0 @@ @@ -94,7 +94,7 @@ index 44d26e096..199276f3a 100644 + // Paper start - TNTPrimeEvent + org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition); + if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.ITEM, entityhuman.getBukkitEntity()).callEvent()) -+ return true; ++ return EnumInteractionResult.FAIL; + // Paper end a(world, blockposition, (EntityLiving) entityhuman); world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 11); diff --git a/Spigot-Server-Patches/Add-World-Util-Methods.patch b/Spigot-Server-Patches/Add-World-Util-Methods.patch index 177478085f..dc46acf612 100644 --- a/Spigot-Server-Patches/Add-World-Util-Methods.patch +++ b/Spigot-Server-Patches/Add-World-Util-Methods.patch @@ -5,6 +5,29 @@ Subject: [PATCH] Add World Util Methods Methods that can be used for other patches to help improve logic. +diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +index 5d8404f8a..adc2e8ff7 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 GeneratorAccess, AutoCloseable { + + return chunk == null ? null : chunk.getFluid(blockposition); + } ++ ++ public boolean isLoadedAndInBounds(BlockPosition blockposition) { ++ return getWorldBorder().isInBounds(blockposition) && getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) != null; ++ } ++ public Chunk getChunkIfLoaded(BlockPosition blockposition) { ++ return getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); ++ } ++ ++ // reduces need to do isLoaded before getType ++ public IBlockData getTypeIfLoadedAndInBounds(BlockPosition blockposition) { ++ return getWorldBorder().isInBounds(blockposition) ? getTypeIfLoaded(blockposition) : null; ++ } + // Paper end + + @Override diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java index 020e5c171..4ee13ac45 100644 --- a/src/main/java/net/minecraft/server/WorldBorder.java diff --git a/Spigot-Server-Patches/Add-more-Witch-API.patch b/Spigot-Server-Patches/Add-more-Witch-API.patch index f2e644f83c..677d365e11 100644 --- a/Spigot-Server-Patches/Add-more-Witch-API.patch +++ b/Spigot-Server-Patches/Add-more-Witch-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add more Witch API diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java -index be6ecfb08..f1a4c10ad 100644 +index be6ecfb08..7b6b1ad17 100644 --- a/src/main/java/net/minecraft/server/EntityWitch.java +++ b/src/main/java/net/minecraft/server/EntityWitch.java @@ -0,0 +0,0 @@ @@ -25,7 +25,7 @@ index be6ecfb08..f1a4c10ad 100644 private static final UUID b = UUID.fromString("5CD17E52-A79A-43D3-A529-90FDE04B181E"); - private static final AttributeModifier bw = (new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION)).a(false); -+ private static final AttributeModifier bw = (new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION)).a(false); private static final AttributeModifier DRINKING_SPEED = bz; // Paper - OBFHELPER ++ private static final AttributeModifier bw = (new AttributeModifier(EntityWitch.b, "Drinking speed penalty", -0.25D, AttributeModifier.Operation.ADDITION)).a(false); private static final AttributeModifier DRINKING_SPEED = bw; // Paper - OBFHELPER private static final DataWatcherObject bx = DataWatcher.a(EntityWitch.class, DataWatcherRegistry.i); - private int by; + private int by; public int getPotionUseTimeLeft() { return by; } public void setPotionUseTimeLeft(int timeLeft) { by = timeLeft; } // Paper - OBFHELPER diff --git a/Spigot-Server-Patches/Add-sun-related-API.patch b/Spigot-Server-Patches/Add-sun-related-API.patch index 7a2931352a..8ee2817b5d 100644 --- a/Spigot-Server-Patches/Add-sun-related-API.patch +++ b/Spigot-Server-Patches/Add-sun-related-API.patch @@ -17,7 +17,7 @@ index eadac07f6..cbaed08f5 100644 if (this.world.J() && !this.world.isClientSide) { float f = this.aI(); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 9c23060bb..8e3367435 100644 +index 7a9159252..3e4632425 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 GeneratorAccess, AutoCloseable { diff --git a/Spigot-Server-Patches/Anti-Xray.patch b/Spigot-Server-Patches/Anti-Xray.patch index 94f51e00e8..786161c27c 100644 --- a/Spigot-Server-Patches/Anti-Xray.patch +++ b/Spigot-Server-Patches/Anti-Xray.patch @@ -1648,7 +1648,7 @@ index a905a29e7..335b64435 100644 public static TicketType a(String s, Comparator comparator) { return new TicketType<>(s, comparator, 0L); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 9ad76ab32..39725335d 100644 +index e80cb3b97..985f30372 100644 --- a/src/main/java/net/minecraft/server/World.java +++ b/src/main/java/net/minecraft/server/World.java @@ -0,0 +0,0 @@ package net.minecraft.server; diff --git a/Spigot-Server-Patches/Basic-PlayerProfile-API.patch b/Spigot-Server-Patches/Basic-PlayerProfile-API.patch index c10f820d2f..4ba8d37514 100644 --- a/Spigot-Server-Patches/Basic-PlayerProfile-API.patch +++ b/Spigot-Server-Patches/Basic-PlayerProfile-API.patch @@ -403,7 +403,7 @@ index 000000000..3aceb0ea8 + } +} diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 1f6a12632..6d278a0da 100644 +index 2f10dab36..670f8313a 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java @@ -0,0 +0,0 @@ @@ -450,7 +450,7 @@ index 7df3ae0ec..1ddb10741 100644 return this.minecraftSessionService; } diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index e8143eff4..10935bcf3 100644 +index 581199e6d..a072222bc 100644 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java @@ -0,0 +0,0 @@ public class UserCache { @@ -473,9 +473,9 @@ index e8143eff4..10935bcf3 100644 + } + // Paper end + - @Nullable public GameProfile getProfile(UUID uuid) { return a(uuid); } // Paper - OBFHELPER @Nullable public GameProfile getProfile(UUID uuid) { + UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.e.get(uuid); @@ -0,0 +0,0 @@ public class UserCache { class UserCacheEntry { diff --git a/Spigot-Server-Patches/BlockDestroyEvent.patch b/Spigot-Server-Patches/BlockDestroyEvent.patch index b95eca5580..a0d44c0a22 100644 --- a/Spigot-Server-Patches/BlockDestroyEvent.patch +++ b/Spigot-Server-Patches/BlockDestroyEvent.patch @@ -11,7 +11,7 @@ floating in the air. This can replace many uses of BlockPhysicsEvent diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index e8f83627c..61a3ddc4d 100644 +index 3e7ba9be6..77db1b73d 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 GeneratorAccess, AutoCloseable { diff --git a/Spigot-Server-Patches/Do-less-work-if-we-have-a-custom-Bukkit-generator.patch b/Spigot-Server-Patches/Do-less-work-if-we-have-a-custom-Bukkit-generator.patch index e8922dd084..372856a1ef 100644 --- a/Spigot-Server-Patches/Do-less-work-if-we-have-a-custom-Bukkit-generator.patch +++ b/Spigot-Server-Patches/Do-less-work-if-we-have-a-custom-Bukkit-generator.patch @@ -7,7 +7,7 @@ If the Bukkit generator already has a spawn, use it immediately instead of spending time generating one that we won't use diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index fecbe7914..a08308a12 100644 +index 657f0e024..1d750eba5 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 { @@ -35,7 +35,7 @@ index fecbe7914..a08308a12 100644 // CraftBukkit end + // Paper start - this is useless if craftbukkit returns early -+ WorldChunkManager worldchunkmanager = this.chunkProvider.getChunkGenerator().getWorldChunkManager(); ++ WorldChunkManager worldchunkmanager = this.getChunkProvider().getChunkGenerator().getWorldChunkManager(); + List list = worldchunkmanager.a(); + Random random = new Random(this.getSeed()); + BlockPosition blockposition = worldchunkmanager.a(0, this.getSeaLevel(), 0, 256, list, random); diff --git a/Spigot-Server-Patches/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/Spigot-Server-Patches/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch index 731239d55a..cf5016d9c9 100644 --- a/Spigot-Server-Patches/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch +++ b/Spigot-Server-Patches/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix Cancelling BlockPlaceEvent triggering physics diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index c4d5907b5..57633955c 100644 +index 1519e9e6b..4870264c6 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 GeneratorAccess, AutoCloseable { diff --git a/Spigot-Server-Patches/Fix-MC-117075-TE-Unload-Lag-Spike.patch b/Spigot-Server-Patches/Fix-MC-117075-TE-Unload-Lag-Spike.patch index 13fdc2a4af..de6742fab4 100644 --- a/Spigot-Server-Patches/Fix-MC-117075-TE-Unload-Lag-Spike.patch +++ b/Spigot-Server-Patches/Fix-MC-117075-TE-Unload-Lag-Spike.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 312e32f1b..8cbad8362 100644 +index ef5cec964..3cab54e77 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 GeneratorAccess, AutoCloseable { diff --git a/Spigot-Server-Patches/Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch b/Spigot-Server-Patches/Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch index 3d90815cdf..bbc4de0ca6 100644 --- a/Spigot-Server-Patches/Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch +++ b/Spigot-Server-Patches/Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch @@ -32,7 +32,7 @@ index 005ebec26..97d85f845 100644 this.s = this::l; if (this.i.canRead() && this.i.peek() == '#') { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 1eede4bcc..8a9a48bb8 100644 +index 1eede4bcc..fb78d6cce 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -0,0 +0,0 @@ import org.bukkit.persistence.PersistentDataContainer; @@ -189,7 +189,7 @@ index 1eede4bcc..8a9a48bb8 100644 + + NBTTagList tagList = new NBTTagList(); + for (String value : list) { -+ tagList.add(new NBTTagString(value)); ++ tagList.add(NBTTagString.a(value)); // Paper - NBTTagString.of(String str) + } + + return tagList; diff --git a/Spigot-Server-Patches/Improve-death-events.patch b/Spigot-Server-Patches/Improve-death-events.patch index 7c3d88f7e6..6a7eacbf1a 100644 --- a/Spigot-Server-Patches/Improve-death-events.patch +++ b/Spigot-Server-Patches/Improve-death-events.patch @@ -119,7 +119,7 @@ index 80717ad9a..53aac5bcc 100644 public void b(NBTTagCompound nbttagcompound) { super.b(nbttagcompound); diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 1592a705f..78e4fe67d 100644 +index 1592a705f..5fcf3e49a 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 { @@ -189,7 +189,7 @@ index 1592a705f..78e4fe67d 100644 + entity.onKill(this); + } + if (this.isSleeping()) { -+ this.dy(); ++ this.entityWakeup(); + } + this.getCombatTracker().reset(); + } else { @@ -279,7 +279,7 @@ index 1592a705f..78e4fe67d 100644 return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F; } diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index ca69f9038..139d19cde 100644 +index 850c7cc1b..51b3acadb 100644 --- a/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { diff --git a/Spigot-Server-Patches/MC-Dev-fixes.patch b/Spigot-Server-Patches/MC-Dev-fixes.patch index 29167f7137..b1442bbe0b 100644 --- a/Spigot-Server-Patches/MC-Dev-fixes.patch +++ b/Spigot-Server-Patches/MC-Dev-fixes.patch @@ -134,6 +134,28 @@ index 2dd27edc8..6def3616e 100644 })); CraftingManager.LOGGER.info("Loaded {} recipes", map1.size()); } +diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java +index f2c0e06ba..909d13c42 100644 +--- a/src/main/java/net/minecraft/server/EnderDragonBattle.java ++++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java +@@ -0,0 +0,0 @@ public class EnderDragonBattle { + + private void a(BlockPosition blockposition) { + this.d.triggerEffect(3000, blockposition, 0); +- WorldGenerator.END_GATEWAY.b((WorldGenFeatureConfiguration) WorldGenEndGatewayConfiguration.a()).a(this.d, this.d.getChunkProvider().getChunkGenerator(), new Random(), blockposition); ++ WorldGenerator.END_GATEWAY.b(WorldGenEndGatewayConfiguration.a()).a(this.d, this.d.getChunkProvider().getChunkGenerator(), new Random(), blockposition); // Paper - decompile fix + } + + private void a(boolean flag) { +@@ -0,0 +0,0 @@ public class EnderDragonBattle { + } + } + +- worldgenendtrophy.b((WorldGenFeatureConfiguration) WorldGenFeatureConfiguration.e).a(this.d, this.d.getChunkProvider().getChunkGenerator(), new Random(), this.o); ++ worldgenendtrophy.b(WorldGenFeatureConfiguration.e).a(this.d, this.d.getChunkProvider().getChunkGenerator(), new Random(), this.o); // Paper - decompile fix + } + + private EntityEnderDragon o() { diff --git a/src/main/java/net/minecraft/server/EntityVindicator.java b/src/main/java/net/minecraft/server/EntityVindicator.java index 7d44348c7..73ecdd22e 100644 --- a/src/main/java/net/minecraft/server/EntityVindicator.java @@ -178,7 +200,7 @@ index 1f3ea23ae..b098d86e3 100644 } } diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java -index 3be9efd22..8d9b9af9b 100644 +index 3be9efd22..3a1ad2346 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 @@ -204,7 +226,7 @@ index 3be9efd22..8d9b9af9b 100644 + this.f = new VoxelShape[a.length]; // Paper - decompile fix VoxelShape voxelshape = block.i(iblockdata, BlockAccessAir.INSTANCE, BlockPosition.ZERO); - EnumDirection[] aenumdirection = IBlockData.a.a; -+ EnumDirection[] aenumdirection = IBlockData.a.a; // Paper - decompile fix ++ EnumDirection[] aenumdirection = a; // Paper - decompile fix i = aenumdirection.length; @@ -359,6 +381,41 @@ index 829a7ae0a..8b9e47b4c 100644 default String asString() { return this.toString(); +diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java +index 22035b6c0..5406f4c40 100644 +--- a/src/main/java/net/minecraft/server/NBTTagList.java ++++ b/src/main/java/net/minecraft/server/NBTTagList.java +@@ -0,0 +0,0 @@ public class NBTTagList extends NBTList { + return "TAG_List"; + } + }; +- private static final ByteSet b = new ByteOpenHashSet(Arrays.asList(1, 2, 3, 4, 5, 6)); ++ private static final ByteSet b = new ByteOpenHashSet(Arrays.asList((byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6)); // Paper - decompiler fix + private final List list; + private byte type; + +diff --git a/src/main/java/net/minecraft/server/NextTickListEntry.java b/src/main/java/net/minecraft/server/NextTickListEntry.java +index 8471920b8..e9c405fb5 100644 +--- a/src/main/java/net/minecraft/server/NextTickListEntry.java ++++ b/src/main/java/net/minecraft/server/NextTickListEntry.java +@@ -0,0 +0,0 @@ public class NextTickListEntry { + return this.a.hashCode(); + } + +- public static Comparator> a() { ++ public static Comparator a() { // Paper - decompile fix + return Comparator.comparingLong((nextticklistentry) -> { +- return nextticklistentry.b; ++ return ((NextTickListEntry) nextticklistentry).b; // Paper - decompile fix + }).thenComparing((nextticklistentry) -> { +- return nextticklistentry.c; ++ return ((NextTickListEntry) nextticklistentry).c; // Paper - decompile fix + }).thenComparingLong((nextticklistentry) -> { +- return nextticklistentry.f; ++ return ((NextTickListEntry) nextticklistentry).f; // Paper - decompile fix + }); + } + diff --git a/src/main/java/net/minecraft/server/RegionFileSection.java b/src/main/java/net/minecraft/server/RegionFileSection.java index 737afc7d7..db9f0196b 100644 --- a/src/main/java/net/minecraft/server/RegionFileSection.java diff --git a/Spigot-Server-Patches/MC-Utils.patch b/Spigot-Server-Patches/MC-Utils.patch index ecb7a30e2c..52bc8a0a52 100644 --- a/Spigot-Server-Patches/MC-Utils.patch +++ b/Spigot-Server-Patches/MC-Utils.patch @@ -117,33 +117,32 @@ index 55373cae0..cfffbd031 100644 public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) { // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java -index 11c4d23ba..818872944 100644 +index 11c4d23ba..53c15c1c0 100644 --- a/src/main/java/net/minecraft/server/ChunkCache.java +++ b/src/main/java/net/minecraft/server/ChunkCache.java +@@ -0,0 +0,0 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { + protected final int b; + protected final IChunkAccess[][] c; + protected boolean d; +- protected final World e; ++ protected final World e; protected final World getWorld() { return e; } // Paper - OBFHELPER + + public ChunkCache(World world, BlockPosition blockposition, BlockPosition blockposition1) { + this.e = world; @@ -0,0 +0,0 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { return this.a(i, j); } + // Paper start - if loaded util -+ @Nullable -+ @Override -+ public IChunkAccess getChunkIfLoadedImmediately(int x, int z) { -+ IChunkAccess chunk = this.getChunkAt(x, z, ChunkStatus.FULL, false); -+ if (chunk instanceof ChunkEmpty) { -+ return null; -+ } -+ return chunk; -+ } -+ + @Override + public Fluid getFluidIfLoaded(BlockPosition blockposition) { -+ IChunkAccess chunk = this.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4); ++ IChunkAccess chunk = getWorld().getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4); + return chunk == null ? null : chunk.getFluid(blockposition); + } + + @Override + public IBlockData getTypeIfLoaded(BlockPosition blockposition) { -+ IChunkAccess chunk = this.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4); ++ IChunkAccess chunk = getWorld().getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4); + return chunk == null ? null : chunk.getType(blockposition); + } + // Paper end diff --git a/Spigot-Server-Patches/Mark-entities-as-being-ticked-when-notifying-navigat.patch b/Spigot-Server-Patches/Mark-entities-as-being-ticked-when-notifying-navigat.patch index 9fd5707ace..deb83568e4 100644 --- a/Spigot-Server-Patches/Mark-entities-as-being-ticked-when-notifying-navigat.patch +++ b/Spigot-Server-Patches/Mark-entities-as-being-ticked-when-notifying-navigat.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Mark entities as being ticked when notifying navigation diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index a5cce8f4e..8ea9b34a1 100644 +index 733f3e10e..049d4ef4e 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 { diff --git a/Spigot-Server-Patches/Mob-Pathfinding-API.patch b/Spigot-Server-Patches/Mob-Pathfinding-API.patch index 2142e1ec89..fedf81d7fb 100644 --- a/Spigot-Server-Patches/Mob-Pathfinding-API.patch +++ b/Spigot-Server-Patches/Mob-Pathfinding-API.patch @@ -123,7 +123,7 @@ index 000000000..f68a07cb9 + } +} diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index bdd092e49..1cb03d464 100644 +index bdd092e49..f06764973 100644 --- a/src/main/java/net/minecraft/server/NavigationAbstract.java +++ b/src/main/java/net/minecraft/server/NavigationAbstract.java @@ -0,0 +0,0 @@ public abstract class NavigationAbstract { @@ -157,7 +157,7 @@ index bdd092e49..1cb03d464 100644 } - @Nullable -+ @Nullable public PathEntity getPathEntity() { return l(); } @Nullable // Paper - OBFHELPER ++ @Nullable public PathEntity getPathEntity() { return k(); } @Nullable // Paper - OBFHELPER public PathEntity k() { return this.c; } diff --git a/Spigot-Server-Patches/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch b/Spigot-Server-Patches/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch index 047a103852..71950b8256 100644 --- a/Spigot-Server-Patches/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch +++ b/Spigot-Server-Patches/Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch @@ -38,7 +38,7 @@ index 363676348..0a7e6fff1 100644 public boolean asynchronous; public EngineMode engineMode; diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0fd3cb54b..a5cce8f4e 100644 +index 4bfa6ea0e..733f3e10e 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 { diff --git a/Spigot-Server-Patches/Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch b/Spigot-Server-Patches/Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch index 7b2854c6d3..c1b461615c 100644 --- a/Spigot-Server-Patches/Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch +++ b/Spigot-Server-Patches/Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch @@ -44,7 +44,7 @@ index 81d3a5262..25774fb73 100644 this.methodProfiler.a(() -> { return worldserver.getWorldData().getName() + " " + IRegistry.DIMENSION_TYPE.getKey(worldserver.worldProvider.getDimensionManager()); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 182376a0a..ead8d84be 100644 +index 0138b6bbe..1519e9e6b 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 GeneratorAccess, AutoCloseable { @@ -66,7 +66,7 @@ index 182376a0a..ead8d84be 100644 this.getServer().getPluginManager().callEvent(event); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 8307379e9..30c9cfa12 100644 +index 38bbb3ce2..70b8b41ea 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 { diff --git a/Spigot-Server-Patches/Optimize-Captured-TileEntity-Lookup.patch b/Spigot-Server-Patches/Optimize-Captured-TileEntity-Lookup.patch index 2c3a542064..4c3e7df88e 100644 --- a/Spigot-Server-Patches/Optimize-Captured-TileEntity-Lookup.patch +++ b/Spigot-Server-Patches/Optimize-Captured-TileEntity-Lookup.patch @@ -10,7 +10,7 @@ Optimize to check if the captured list even has values in it, and also to just do a get call since the value can never be null. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 61a3ddc4d..dfc695084 100644 +index 77db1b73d..7d39a8fbc 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 GeneratorAccess, AutoCloseable { diff --git a/Spigot-Server-Patches/Optimize-UserCache-Thread-Safe.patch b/Spigot-Server-Patches/Optimize-UserCache-Thread-Safe.patch index acb0e91eb1..a05b44c617 100644 --- a/Spigot-Server-Patches/Optimize-UserCache-Thread-Safe.patch +++ b/Spigot-Server-Patches/Optimize-UserCache-Thread-Safe.patch @@ -23,7 +23,7 @@ index 2a40bb0b8..38bf3ea44 100644 // Spigot end } diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index 65659996c..566f3db39 100644 +index 65659996c..d32bec70d 100644 --- a/src/main/java/net/minecraft/server/UserCache.java +++ b/src/main/java/net/minecraft/server/UserCache.java @@ -0,0 +0,0 @@ public class UserCache { @@ -66,14 +66,6 @@ index 65659996c..566f3db39 100644 String s1 = s.toLowerCase(Locale.ROOT); UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.d.get(s1); -@@ -0,0 +0,0 @@ public class UserCache { - return usercache_usercacheentry == null ? null : usercache_usercacheentry.a(); - } - -+ @Nullable public GameProfile getProfile(UUID uuid) { return a(uuid); } // Paper - OBFHELPER - @Nullable - public GameProfile getProfile(UUID uuid) { - UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.e.get(uuid); @@ -0,0 +0,0 @@ public class UserCache { } diff --git a/Spigot-Server-Patches/Optimize-redstone-algorithm.patch b/Spigot-Server-Patches/Optimize-redstone-algorithm.patch index 3ec1bf6153..7ae515716b 100644 --- a/Spigot-Server-Patches/Optimize-redstone-algorithm.patch +++ b/Spigot-Server-Patches/Optimize-redstone-algorithm.patch @@ -1124,7 +1124,7 @@ index 5bf2fc0b3..52a4982ec 100644 c(iblockdata, world, blockposition); world.a(blockposition, false); diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 8e3367435..e8f83627c 100644 +index 3e4632425..3e7ba9be6 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 GeneratorAccess, AutoCloseable { 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 86d290e872..689455b281 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 @@ -19,7 +19,7 @@ index b4e5948cc..0a99b8fe9 100644 + } } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 7fcc8c52d..d909d7a83 100644 +index 059e4544e..a4fd1cb37 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 GeneratorAccess, AutoCloseable { diff --git a/Spigot-Server-Patches/Player.setPlayerProfile-API.patch b/Spigot-Server-Patches/Player.setPlayerProfile-API.patch index 9dccc54275..c81af5ffea 100644 --- a/Spigot-Server-Patches/Player.setPlayerProfile-API.patch +++ b/Spigot-Server-Patches/Player.setPlayerProfile-API.patch @@ -48,7 +48,7 @@ index 0614976b8..a985ae7ba 100644 uniqueId = i.getId(); // Paper end diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 6bdee24f8..e786641cc 100644 +index 6bdee24f8..96b1eec91 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 @@ @@ -123,7 +123,7 @@ index 6bdee24f8..e786641cc 100644 + reregisterPlayer(handle); + + //Respawn the player then update their position and selected slot -+ connection.sendPacket(new net.minecraft.server.PacketPlayOutRespawn(handle.dimension, handle.world.getWorldData().getType(), handle.playerInteractManager.getGameMode())); ++ connection.sendPacket(new net.minecraft.server.PacketPlayOutRespawn(handle.dimension, net.minecraft.server.WorldData.c(handle.world.getWorldData().getSeed()), handle.world.getWorldData().getType(), handle.playerInteractManager.getGameMode())); + handle.updateAbilities(); + connection.sendPacket(new net.minecraft.server.PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet<>(), 0)); + net.minecraft.server.MinecraftServer.getServer().getPlayerList().updateClient(handle); diff --git a/Spigot-Server-Patches/Prevent-mob-spawning-from-loading-generating-chunks.patch b/Spigot-Server-Patches/Prevent-mob-spawning-from-loading-generating-chunks.patch index 5336f42217..19e56ec804 100644 --- a/Spigot-Server-Patches/Prevent-mob-spawning-from-loading-generating-chunks.patch +++ b/Spigot-Server-Patches/Prevent-mob-spawning-from-loading-generating-chunks.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Prevent mob spawning from loading/generating chunks also prevents if out of world border bounds diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 487114367..bcca7faed 100644 +index 224443e03..fdac5bb3a 100644 --- a/src/main/java/net/minecraft/server/SpawnerCreature.java +++ b/src/main/java/net/minecraft/server/SpawnerCreature.java @@ -0,0 +0,0 @@ public final class SpawnerCreature { @@ -14,7 +14,7 @@ index 487114367..bcca7faed 100644 if (k >= 1) { - IBlockData iblockdata = chunk.getType(blockposition1); -+ IBlockData iblockdata = world.getTypeIfLoadedAndInBounds(blockposition1); // Paper - don't load chunks for mob spawn ++ IBlockData iblockdata = worldserver.getTypeIfLoadedAndInBounds(blockposition1); // Paper - don't load chunks for mob spawn - if (!iblockdata.isOccluding(chunk, blockposition1)) { + if (iblockdata != null && !iblockdata.isOccluding(chunk, blockposition1)) { // Paper - don't load chunks for mob spawn @@ -26,7 +26,7 @@ index 487114367..bcca7faed 100644 double d0 = entityhuman.g((double) f, (double) k, (double) f1); - if (d0 > 576.0D && !blockposition.a((IPosition) (new Vec3D((double) f, (double) k, (double) f1)), 24.0D)) { -+ if (d0 > 576.0D && !blockposition.a((IPosition) (new Vec3D((double) f, (double) k, (double) f1)), 24.0D) && world.isLoadedAndInBounds(blockposition_mutableblockposition)) { // Paper - don't load chunks for mob spawn ++ if (d0 > 576.0D && !blockposition.a((IPosition) (new Vec3D((double) f, (double) k, (double) f1)), 24.0D) && worldserver.isLoadedAndInBounds(blockposition_mutableblockposition)) { // Paper - don't load chunks for mob spawn ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(blockposition_mutableblockposition); if (Objects.equals(chunkcoordintpair, chunk.getPos()) || worldserver.getChunkProvider().a(chunkcoordintpair)) { diff --git a/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch b/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch index bcfc5783b0..4faf91f8be 100644 --- a/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch +++ b/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Remove unused World Tile Entity List Massive hit to performance and it is completely unnecessary. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 57633955c..7d5f6e220 100644 +index 4870264c6..b2cc85834 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 GeneratorAccess, AutoCloseable { diff --git a/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch b/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch index b0b49a07ea..b6043efef5 100644 --- a/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch +++ b/Spigot-Server-Patches/Send-attack-SoundEffects-only-to-players-who-can-see.patch @@ -72,7 +72,7 @@ index 2d982ce1e..fd7de143e 100644 entity.extinguish(); } diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 8cbad8362..117939bb7 100644 +index 3cab54e77..989d4d8ca 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 GeneratorAccess, AutoCloseable { diff --git a/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch b/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch index c865d08092..57556f82dd 100644 --- a/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch +++ b/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch @@ -755,7 +755,7 @@ index e168c528c..56dabbc15 100644 @Nullable diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index a08308a12..4da5c8982 100644 +index b9e37d630..25a1ef134 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 { diff --git a/Spigot-Server-Patches/incremental-chunk-saving.patch b/Spigot-Server-Patches/incremental-chunk-saving.patch index 6b7edd76b4..4e7b9fd609 100644 --- a/Spigot-Server-Patches/incremental-chunk-saving.patch +++ b/Spigot-Server-Patches/incremental-chunk-saving.patch @@ -149,7 +149,7 @@ index 827831aab..4379434f6 100644 if (flag) { List list = (List) this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).peek(PlayerChunk::m).collect(Collectors.toList()); diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index c28c0431a..0fd3cb54b 100644 +index c28c0431a..4bfa6ea0e 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 { @@ -166,7 +166,7 @@ index c28c0431a..0fd3cb54b 100644 + + try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { + if (doFull) { -+ this.k_(); ++ this.saveData(); + } + + timings.worldSaveChunks.startTiming(); // Paper @@ -180,9 +180,9 @@ index c28c0431a..0fd3cb54b 100644 + WorldServer worldserver1 = this; + WorldData worlddata = worldserver1.getWorldData(); + -+ worldserver1.getWorldBorder().a(worlddata); -+ worlddata.c(this.server.getBossBattleCustomData().c()); -+ worldserver1.getDataManager().saveWorldData(worlddata, this.server.getPlayerList().r()); ++ worldserver1.getWorldBorder().save(worlddata); ++ worlddata.setCustomBossEvents(this.server.getBossBattleCustomData().save()); ++ worldserver1.getDataManager().saveWorldData(worlddata, this.server.getPlayerList().save()); + // CraftBukkit end + } + } @@ -198,4 +198,12 @@ index c28c0431a..0fd3cb54b 100644 try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper if (iprogressupdate != null) { iprogressupdate.a(new ChatMessage("menu.savingLevel", new Object[0])); +@@ -0,0 +0,0 @@ public class WorldServer extends World { + // CraftBukkit end + } + ++ protected void saveData() throws ExceptionWorldConflict { this.m_(); } // Paper - OBFHELPER + protected void m_() throws ExceptionWorldConflict { + this.checkSession(); + this.worldProvider.i(); -- \ No newline at end of file diff --git a/Spigot-Server-Patches/use-CB-BlockState-implementations-for-captured-block.patch b/Spigot-Server-Patches/use-CB-BlockState-implementations-for-captured-block.patch index 4197a92cff..706b754b31 100644 --- a/Spigot-Server-Patches/use-CB-BlockState-implementations-for-captured-block.patch +++ b/Spigot-Server-Patches/use-CB-BlockState-implementations-for-captured-block.patch @@ -18,7 +18,7 @@ the blockstate that will be valid for restoration, as opposed to dropping information on restoration when the event is cancelled. diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 117939bb7..39b136935 100644 +index 989d4d8ca..e7b8a6920 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 GeneratorAccess, AutoCloseable {