diff --git a/Spigot-Server-Patches/0547-Brand-support.patch b/Spigot-Server-Patches/0547-Brand-support.patch index 3683eb17a7..4772afa475 100644 --- a/Spigot-Server-Patches/0547-Brand-support.patch +++ b/Spigot-Server-Patches/0547-Brand-support.patch @@ -4,10 +4,10 @@ Date: Sat, 11 Apr 2020 13:10:58 +0200 Subject: [PATCH] Brand support -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ import com.google.common.primitives.Doubles; import com.google.common.primitives.Floats; import com.mojang.brigadier.ParseResults; diff --git a/Spigot-Server-Patches/API-to-get-a-BlockState-without-a-snapshot.patch b/Spigot-Server-Patches/API-to-get-a-BlockState-without-a-snapshot.patch index 25a82c3c3c..3037240c80 100644 --- a/Spigot-Server-Patches/API-to-get-a-BlockState-without-a-snapshot.patch +++ b/Spigot-Server-Patches/API-to-get-a-BlockState-without-a-snapshot.patch @@ -12,11 +12,11 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE If Tile Entity was null, correct Sign to return empty lines instead of null -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +@@ -0,0 +0,0 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / public TileEntity(TileEntityTypes<?> tileentitytypes) { this.position = BlockPosition.ZERO; this.tileType = tileentitytypes; @@ -24,16 +24,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Paper start -@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / public void load(IBlockData iblockdata, NBTTagCompound nbttagcompound) { this.position = new BlockPosition(nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z")); // CraftBukkit start - read container - this.persistentDataContainer = new CraftPersistentDataContainer(DATA_TYPE_REGISTRY); + this.persistentDataContainer.clear(); // Paper - clear instead of reinit - NBTBase persistentDataTag = nbttagcompound.get("PublicBukkitValues"); + net.minecraft.nbt.NBTBase persistentDataTag = nbttagcompound.get("PublicBukkitValues"); if (persistentDataTag instanceof NBTTagCompound) { -@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / } // CraftBukkit start - add method @@ -46,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (world == null) return null; // Spigot start org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()); -@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / return null; } // Spigot end diff --git a/Spigot-Server-Patches/Ability-to-apply-mending-to-XP-API.patch b/Spigot-Server-Patches/Ability-to-apply-mending-to-XP-API.patch index 36703d12b5..e8ae603b7d 100644 --- a/Spigot-Server-Patches/Ability-to-apply-mending-to-XP-API.patch +++ b/Spigot-Server-Patches/Ability-to-apply-mending-to-XP-API.patch @@ -9,25 +9,10 @@ of giving the player experience points. Both an API To standalone mend, and apply mending logic to .giveExp has been added. -diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EnchantmentManager.java -+++ b/src/main/java/net/minecraft/server/EnchantmentManager.java -@@ -0,0 +0,0 @@ public class EnchantmentManager { - return getEnchantmentLevel(Enchantments.CHANNELING, itemstack) > 0; - } - -- @Nullable -- public static Entry<EnumItemSlot, ItemStack> b(Enchantment enchantment, EntityLiving entityliving) { -+ public static @javax.annotation.Nonnull ItemStack getRandomEquippedItemWithEnchant(Enchantment enchantment, EntityLiving entityliving) { Entry<EnumItemSlot, ItemStack> entry = b(enchantment, entityliving); return entry != null ? entry.getValue() : ItemStack.NULL_ITEM; } // Paper - OBFHELPER -+ @Nullable public static Entry<EnumItemSlot, ItemStack> b(Enchantment enchantment, EntityLiving entityliving) { - return a(enchantment, entityliving, (itemstack) -> { - return true; - }); -diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java -+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java +--- a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java ++++ b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java @@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity { } } @@ -41,6 +26,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private int c(int i) { return i * 2; } +diff --git a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentManager.java b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentManager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentManager.java ++++ b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentManager.java +@@ -0,0 +0,0 @@ public class EnchantmentManager { + return getEnchantmentLevel(Enchantments.CHANNELING, itemstack) > 0; + } + +- @Nullable +- public static Entry<EnumItemSlot, ItemStack> b(Enchantment enchantment, EntityLiving entityliving) { ++ public static @javax.annotation.Nonnull ItemStack getRandomEquippedItemWithEnchant(Enchantment enchantment, EntityLiving entityliving) { Entry<EnumItemSlot, ItemStack> entry = b(enchantment, entityliving); return entry != null ? entry.getValue() : ItemStack.NULL_ITEM; } // Paper - OBFHELPER ++ @Nullable public static Entry<EnumItemSlot, ItemStack> b(Enchantment enchantment, EntityLiving entityliving) { + return a(enchantment, entityliving, (itemstack) -> { + return true; + }); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/Spigot-Server-Patches/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch b/Spigot-Server-Patches/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch index 6ec8ef2fa1..960d694ea2 100644 --- a/Spigot-Server-Patches/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch +++ b/Spigot-Server-Patches/Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent This will allow you to change the players name or skin on login. -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.server.network; +import com.destroystokyo.paper.profile.CraftPlayerProfile; +import com.destroystokyo.paper.profile.PlayerProfile; @@ -18,8 +18,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import com.mojang.authlib.exceptions.AuthenticationUnavailableException; import java.math.BigInteger; @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - // CraftBukkit start + import net.minecraft.network.chat.ChatComponentText; import io.papermc.paper.adventure.PaperAdventure; // Paper +import org.bukkit.Bukkit; import org.bukkit.craftbukkit.util.Waitable; 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 c32017fa5b..ffff74d637 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 @@ -17,8 +17,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import java.util.Collection; +import java.util.List; import java.util.function.Predicate; - import net.minecraft.server.BiomeStorage; - import net.minecraft.server.BlockPosition; + import net.minecraft.core.BlockPosition; + import net.minecraft.core.IRegistry; @@ -0,0 +0,0 @@ public class CraftChunk implements Chunk { @Override @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + // Paper end int index = 0; - net.minecraft.server.Chunk chunk = getHandle(); + net.minecraft.world.level.chunk.Chunk chunk = getHandle(); @@ -0,0 +0,0 @@ public class CraftChunk implements Chunk { } @@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (!isLoaded()) { + getWorld().getChunkAt(x, z); // Transient load for this tick + } -+ net.minecraft.server.Chunk chunk = getHandle(); ++ net.minecraft.world.level.chunk.Chunk chunk = getHandle(); + + List<BlockState> entities = new ArrayList<>(); + diff --git a/Spigot-Server-Patches/Add-API-for-quit-reason.patch b/Spigot-Server-Patches/Add-API-for-quit-reason.patch index a8f9a38451..6cf5722d11 100644 --- a/Spigot-Server-Patches/Add-API-for-quit-reason.patch +++ b/Spigot-Server-Patches/Add-API-for-quit-reason.patch @@ -4,22 +4,10 @@ Date: Sat, 14 Nov 2020 16:19:52 +0100 Subject: [PATCH] Add API for quit reason -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks - - boolean needsChunkCenterUpdate; // Paper - no-tick view distance -+ public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event - - public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { - super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java +--- a/src/main/java/net/minecraft/network/NetworkManager.java ++++ b/src/main/java/net/minecraft/network/NetworkManager.java @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { this.u = true; @@ -36,10 +24,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (flag) { NetworkManager.LOGGER.debug("Failed to sent packet", throwable); this.sendPacket(new PacketPlayOutKickDisconnect(chatmessage), (future) -> { -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks + + boolean needsChunkCenterUpdate; // Paper - no-tick view distance ++ public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event + + public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { + super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { final IChatBaseComponent ichatbasecomponent = PaperAdventure.asVanilla(event.reason()); // Paper - Adventure // CraftBukkit end @@ -48,10 +48,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.networkManager.sendPacket(new PacketPlayOutKickDisconnect(ichatbasecomponent), (future) -> { this.networkManager.close(ichatbasecomponent); }); -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { entityplayer.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper } diff --git a/Spigot-Server-Patches/Add-API-methods-to-control-if-armour-stands-can-move.patch b/Spigot-Server-Patches/Add-API-methods-to-control-if-armour-stands-can-move.patch index ff0274f21a..59f5dfcc27 100644 --- a/Spigot-Server-Patches/Add-API-methods-to-control-if-armour-stands-can-move.patch +++ b/Spigot-Server-Patches/Add-API-methods-to-control-if-armour-stands-can-move.patch @@ -4,10 +4,10 @@ Date: Wed, 21 Dec 2016 11:47:25 -0600 Subject: [PATCH] Add API methods to control if armour stands can move -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { public Vector3f rightArmPose; public Vector3f leftLegPose; diff --git a/Spigot-Server-Patches/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch b/Spigot-Server-Patches/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch index c3ef9c8fbf..2d75b4559a 100644 --- a/Spigot-Server-Patches/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch +++ b/Spigot-Server-Patches/Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch @@ -15,10 +15,10 @@ current defacto implementation, I've elected to deprecate (with no intent to remove) and replace it with two new methods, clearly named and documented as to their purpose. -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public int ping; public boolean viewingCredits; @@ -26,11 +26,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public long loginTime; // Paper // Paper start - cancellable death event public boolean queueHealthUpdatePacket = false; - public net.minecraft.server.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java + public net.minecraft.network.protocol.game.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { } diff --git a/Spigot-Server-Patches/Add-ArmorStand-Item-Meta.patch b/Spigot-Server-Patches/Add-ArmorStand-Item-Meta.patch index cf2774907a..1e178065fb 100644 --- a/Spigot-Server-Patches/Add-ArmorStand-Item-Meta.patch +++ b/Spigot-Server-Patches/Add-ArmorStand-Item-Meta.patch @@ -286,14 +286,6 @@ diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 java.util.ArrayList; - import java.util.Arrays; - import java.util.List; - import java.util.UUID; -+import com.destroystokyo.paper.inventory.meta.ArmorStandMeta; // Paper - import net.minecraft.server.Block; - import net.minecraft.server.IRegistry; - import net.minecraft.server.ITileEntity; @@ -0,0 +0,0 @@ public class ItemMetaTest extends AbstractTestingBase { final CraftMetaArmorStand meta = (CraftMetaArmorStand) cleanStack.getItemMeta(); meta.entityTag = new NBTTagCompound(); diff --git a/Spigot-Server-Patches/Add-BeaconEffectEvent.patch b/Spigot-Server-Patches/Add-BeaconEffectEvent.patch index 906edbcae0..7a0ea7cbfc 100644 --- a/Spigot-Server-Patches/Add-BeaconEffectEvent.patch +++ b/Spigot-Server-Patches/Add-BeaconEffectEvent.patch @@ -4,11 +4,11 @@ Date: Wed, 2 Mar 2016 23:30:53 -0600 Subject: [PATCH] Add BeaconEffectEvent -diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityBeacon.java -+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java +@@ -0,0 +0,0 @@ import net.minecraft.world.phys.AxisAlignedBB; import org.bukkit.craftbukkit.potion.CraftPotionUtil; import org.bukkit.potion.PotionEffect; // CraftBukkit end diff --git a/Spigot-Server-Patches/Add-BellRingEvent.patch b/Spigot-Server-Patches/Add-BellRingEvent.patch index 833ab9703c..2b70b2ad8b 100644 --- a/Spigot-Server-Patches/Add-BellRingEvent.patch +++ b/Spigot-Server-Patches/Add-BellRingEvent.patch @@ -6,18 +6,18 @@ Subject: [PATCH] Add BellRingEvent Add a new event, BellRingEvent, to trigger whenever a player rings a village bell. Passes along the bell block and the player who rang it. -diff --git a/src/main/java/net/minecraft/server/BlockBell.java b/src/main/java/net/minecraft/server/BlockBell.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockBell.java b/src/main/java/net/minecraft/world/level/block/BlockBell.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockBell.java -+++ b/src/main/java/net/minecraft/server/BlockBell.java +--- a/src/main/java/net/minecraft/world/level/block/BlockBell.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockBell.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.world.level.block; +import io.papermc.paper.event.block.BellRingEvent; + import javax.annotation.Nullable; - - public class BlockBell extends BlockTileEntity { + import net.minecraft.core.BlockPosition; + import net.minecraft.core.EnumDirection; @@ -0,0 +0,0 @@ public class BlockBell extends BlockTileEntity { boolean flag1 = !flag || this.a(iblockdata, enumdirection, movingobjectpositionblock.getPos().y - (double) blockposition.getY()); diff --git a/Spigot-Server-Patches/Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch b/Spigot-Server-Patches/Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch index 9be54d7784..aec3825530 100644 --- a/Spigot-Server-Patches/Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch +++ b/Spigot-Server-Patches/Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch @@ -5,23 +5,10 @@ Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues Add -Ddebug.entities=true to your JVM flags to gain more information -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper - private CraftEntity bukkitEntity; - -+ PlayerChunkMap.EntityTracker tracker; // Paper -+ Throwable addedToWorldStack; // Paper - entity debug - public CraftEntity getBukkitEntity() { - if (bukkitEntity == null) { - bukkitEntity = CraftEntity.getEntity(world.getServer(), this); -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } else { PlayerChunkMap.EntityTracker playerchunkmap_entitytracker = new PlayerChunkMap.EntityTracker(entity, i, j, entitytypes.isDeltaTracking()); @@ -39,22 +26,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } protected void g() { -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - public boolean pvpMode; - public boolean keepSpawnInMemory = true; - public org.bukkit.generator.ChunkGenerator generator; -+ public static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper - - public boolean captureBlockStates = false; - public boolean captureTreeGeneration = false; -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { public final Convertable.ConversionSession convertable; public final UUID uuid; @@ -121,3 +96,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.getChunkProvider().addEntity(entity); // CraftBukkit start - SPIGOT-5278 if (entity instanceof EntityDrowned) { +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper + private CraftEntity bukkitEntity; + ++ PlayerChunkMap.EntityTracker tracker; // Paper ++ Throwable addedToWorldStack; // Paper - entity debug + public CraftEntity getBukkitEntity() { + if (bukkitEntity == null) { + bukkitEntity = CraftEntity.getEntity(world.getServer(), this); +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public boolean pvpMode; + public boolean keepSpawnInMemory = true; + public org.bukkit.generator.ChunkGenerator generator; ++ public static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper + + public boolean captureBlockStates = false; + public boolean captureTreeGeneration = false; diff --git a/Spigot-Server-Patches/Add-Destroy-Speed-API.patch b/Spigot-Server-Patches/Add-Destroy-Speed-API.patch index 502ba1f97b..cbe2771a5c 100644 --- a/Spigot-Server-Patches/Add-Destroy-Speed-API.patch +++ b/Spigot-Server-Patches/Add-Destroy-Speed-API.patch @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + public float getDestroySpeed(ItemStack itemStack, boolean considerEnchants) { -+ net.minecraft.server.ItemStack nmsItemStack; ++ net.minecraft.world.item.ItemStack nmsItemStack; + if (itemStack instanceof CraftItemStack) { + nmsItemStack = ((CraftItemStack) itemStack).getHandle(); + } else { @@ -24,7 +24,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + float speed = nmsItemStack.getItem().getDestroySpeed(nmsItemStack, this.getNMSBlock().getBlockData()); + if (speed > 1.0F && considerEnchants) { -+ int enchantLevel = net.minecraft.server.EnchantmentManager.getEnchantmentLevel(net.minecraft.server.Enchantments.DIG_SPEED, nmsItemStack); ++ int enchantLevel = net.minecraft.world.item.enchantment.EnchantmentManager.getEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.DIG_SPEED, nmsItemStack); + if (enchantLevel > 0) { + speed += enchantLevel * enchantLevel + 1; + } diff --git a/Spigot-Server-Patches/Add-EntityLoadCrossbowEvent.patch b/Spigot-Server-Patches/Add-EntityLoadCrossbowEvent.patch index a3f7a2a141..2b8925dae2 100644 --- a/Spigot-Server-Patches/Add-EntityLoadCrossbowEvent.patch +++ b/Spigot-Server-Patches/Add-EntityLoadCrossbowEvent.patch @@ -4,17 +4,15 @@ Date: Wed, 7 Oct 2020 12:04:01 -0400 Subject: [PATCH] Add EntityLoadCrossbowEvent -diff --git a/src/main/java/net/minecraft/server/ItemCrossbow.java b/src/main/java/net/minecraft/server/ItemCrossbow.java +diff --git a/src/main/java/net/minecraft/world/item/ItemCrossbow.java b/src/main/java/net/minecraft/world/item/ItemCrossbow.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemCrossbow.java -+++ b/src/main/java/net/minecraft/server/ItemCrossbow.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - +--- a/src/main/java/net/minecraft/world/item/ItemCrossbow.java ++++ b/src/main/java/net/minecraft/world/item/ItemCrossbow.java +@@ -0,0 +0,0 @@ package net.minecraft.world.item; import com.google.common.collect.Lists; -+ -+import org.bukkit.inventory.EquipmentSlot; -+ + import com.mojang.math.Quaternion; + import com.mojang.math.Vector3fa; ++import org.bukkit.inventory.EquipmentSlot; // Paper +import io.papermc.paper.event.entity.EntityLoadCrossbowEvent; // Paper - EntityLoadCrossbowEvent namespace conflicts import java.util.List; import java.util.Random; diff --git a/Spigot-Server-Patches/Add-EntityZapEvent.patch b/Spigot-Server-Patches/Add-EntityZapEvent.patch index df1fbe895a..d1f62144c0 100644 --- a/Spigot-Server-Patches/Add-EntityZapEvent.patch +++ b/Spigot-Server-Patches/Add-EntityZapEvent.patch @@ -4,10 +4,10 @@ Date: Sun, 16 Oct 2016 23:19:30 -0700 Subject: [PATCH] Add EntityZapEvent -diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityPig.java b/src/main/java/net/minecraft/world/entity/animal/EntityPig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPig.java -+++ b/src/main/java/net/minecraft/server/EntityPig.java +--- a/src/main/java/net/minecraft/world/entity/animal/EntityPig.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityPig.java @@ -0,0 +0,0 @@ public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable { } @@ -20,10 +20,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) { return; -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVillager.java -+++ b/src/main/java/net/minecraft/server/EntityVillager.java +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java @@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation EntityVillager.LOGGER.info("Villager {} was struck by lightning {}.", this, entitylightning); EntityWitch entitywitch = (EntityWitch) EntityTypes.WITCH.a((World) worldserver); diff --git a/Spigot-Server-Patches/Add-Heightmap-API.patch b/Spigot-Server-Patches/Add-Heightmap-API.patch index 659cd494e0..568141b604 100644 --- a/Spigot-Server-Patches/Add-Heightmap-API.patch +++ b/Spigot-Server-Patches/Add-Heightmap-API.patch @@ -4,10 +4,10 @@ Date: Tue, 1 Jan 2019 02:22:01 -0800 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 +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } } diff --git a/Spigot-Server-Patches/Add-LivingEntity-getTargetEntity.patch b/Spigot-Server-Patches/Add-LivingEntity-getTargetEntity.patch index fa6ea3b029..92f3f5a9de 100644 --- a/Spigot-Server-Patches/Add-LivingEntity-getTargetEntity.patch +++ b/Spigot-Server-Patches/Add-LivingEntity-getTargetEntity.patch @@ -4,52 +4,11 @@ Date: Sat, 22 Sep 2018 00:33:08 -0500 Subject: [PATCH] Add LivingEntity#getTargetEntity -diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/AxisAlignedBB.java -+++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java -@@ -0,0 +0,0 @@ public class AxisAlignedBB { - return this.b(vec3d.x, vec3d.y, vec3d.z); - } - -+ public final AxisAlignedBB expand(double x, double y, double z) { return b(x, y, z); } // Paper - OBFHELPER - public AxisAlignedBB b(double d0, double d1, double d2) { - double d3 = this.minX; - double d4 = this.minY; -@@ -0,0 +0,0 @@ public class AxisAlignedBB { - return new AxisAlignedBB(d3, d4, d5, d6, d7, d8); - } - -+ // Paper start -+ public AxisAlignedBB grow(double d0) { -+ return grow(d0, d0, d0); -+ } -+ // Paper end -+ - public AxisAlignedBB grow(double d0, double d1, double d2) { - double d3 = this.minX - d0; - double d4 = this.minY - d1; -@@ -0,0 +0,0 @@ public class AxisAlignedBB { - return this.minX < d3 && this.maxX > d0 && this.minY < d4 && this.maxY > d1 && this.minZ < d5 && this.maxZ > d2; - } - -+ public final boolean contains(Vec3D vec3d) { return d(vec3d); } // Paper - OBFHELPER - public boolean d(Vec3D vec3d) { - return this.e(vec3d.x, vec3d.y, vec3d.z); - } -@@ -0,0 +0,0 @@ public class AxisAlignedBB { - return this.g(-d0); - } - -+ public final Optional<Vec3D> calculateIntercept(Vec3D vec3d, Vec3D vec3d1) { return b(vec3d, vec3d1); } // Paper - OBFHELPER - public Optional<Vec3D> b(Vec3D vec3d, Vec3D vec3d1) { - double[] adouble = new double[]{1.0D}; - double d0 = vec3d1.x - vec3d.x; -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return this.c(f - 90.0F, f1); } @@ -57,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public final Vec3D j(float f) { if (f == 1.0F) { return new Vec3D(this.locX(), this.getHeadY(), this.locZ()); -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return this.getPassengers().size() < 1; } @@ -65,10 +24,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public float bg() { return 0.0F; } -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { return world.rayTrace(raytrace); } @@ -107,10 +66,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public int shieldBlockingDelay = world.paperConfig.shieldBlockingDelay; public int getShieldBlockingDelay() { -diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java +diff --git a/src/main/java/net/minecraft/world/entity/IEntitySelector.java b/src/main/java/net/minecraft/world/entity/IEntitySelector.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IEntitySelector.java -+++ b/src/main/java/net/minecraft/server/IEntitySelector.java +--- a/src/main/java/net/minecraft/world/entity/IEntitySelector.java ++++ b/src/main/java/net/minecraft/world/entity/IEntitySelector.java @@ -0,0 +0,0 @@ public final class IEntitySelector { public static final Predicate<Entity> e = (entity) -> { return !(entity instanceof EntityHuman) || !entity.isSpectator() && !((EntityHuman) entity).isCreative(); @@ -119,6 +78,47 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static final Predicate<Entity> f = (entity) -> { return !(entity instanceof EntityHuman) || !entity.isSpectator() && !((EntityHuman) entity).isCreative() && entity.world.getDifficulty() != EnumDifficulty.PEACEFUL; }; +diff --git a/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java b/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java ++++ b/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java +@@ -0,0 +0,0 @@ public class AxisAlignedBB { + return this.b(vec3d.x, vec3d.y, vec3d.z); + } + ++ public final AxisAlignedBB expand(double x, double y, double z) { return b(x, y, z); } // Paper - OBFHELPER + public AxisAlignedBB b(double d0, double d1, double d2) { + double d3 = this.minX; + double d4 = this.minY; +@@ -0,0 +0,0 @@ public class AxisAlignedBB { + return new AxisAlignedBB(d3, d4, d5, d6, d7, d8); + } + ++ // Paper start ++ public AxisAlignedBB grow(double d0) { ++ return grow(d0, d0, d0); ++ } ++ // Paper end ++ + public AxisAlignedBB grow(double d0, double d1, double d2) { + double d3 = this.minX - d0; + double d4 = this.minY - d1; +@@ -0,0 +0,0 @@ public class AxisAlignedBB { + return this.minX < d3 && this.maxX > d0 && this.minY < d4 && this.maxY > d1 && this.minZ < d5 && this.maxZ > d2; + } + ++ public final boolean contains(Vec3D vec3d) { return d(vec3d); } // Paper - OBFHELPER + public boolean d(Vec3D vec3d) { + return this.e(vec3d.x, vec3d.y, vec3d.z); + } +@@ -0,0 +0,0 @@ public class AxisAlignedBB { + return this.g(-d0); + } + ++ public final Optional<Vec3D> calculateIntercept(Vec3D vec3d, Vec3D vec3d1) { return b(vec3d, vec3d1); } // Paper - OBFHELPER + public Optional<Vec3D> b(Vec3D vec3d, Vec3D vec3d1) { + double[] adouble = new double[]{1.0D}; + double d0 = vec3d1.x - vec3d.x; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java diff --git a/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch b/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch index b33fd8c4bb..19038b684a 100644 --- a/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch +++ b/Spigot-Server-Patches/Add-MinecraftKey-Information-to-Objects.patch @@ -18,16 +18,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap())); ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.chunkX, e.chunkZ); -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/server/KeyedObject.java b/src/main/java/net/minecraft/server/KeyedObject.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/KeyedObject.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++import net.minecraft.resources.MinecraftKey; ++ ++public interface KeyedObject { ++ MinecraftKey getMinecraftKey(); ++ default String getMinecraftKeyString() { ++ MinecraftKey key = getMinecraftKey(); ++ return key != null ? key.toString() : null; ++ } ++} +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -0,0 +0,0 @@ import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.plugin.PluginManager; // CraftBukkit end -public abstract class Entity implements INamableTileEntity, ICommandListener { -+public abstract class Entity implements INamableTileEntity, ICommandListener, KeyedObject { // Paper ++public abstract class Entity implements INamableTileEntity, ICommandListener, net.minecraft.server.KeyedObject { // Paper // CraftBukkit start private static final int CURRENT_LEVEL = 2; @@ -64,10 +81,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } protected abstract void loadData(NBTTagCompound nbttagcompound); -diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTypes.java -+++ b/src/main/java/net/minecraft/server/EntityTypes.java +--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java ++++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java @@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { } } @@ -76,31 +93,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean a() { return this.bi; } -diff --git a/src/main/java/net/minecraft/server/KeyedObject.java b/src/main/java/net/minecraft/server/KeyedObject.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/KeyedObject.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+public interface KeyedObject { -+ MinecraftKey getMinecraftKey(); -+ default String getMinecraftKeyString() { -+ MinecraftKey key = getMinecraftKey(); -+ return key != null ? key.toString() : null; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntity.java -+++ b/src/main/java/net/minecraft/server/TileEntity.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java @@ -0,0 +0,0 @@ import org.bukkit.inventory.InventoryHolder; import org.spigotmc.CustomTimingsHandler; // Spigot -public abstract class TileEntity { -+public abstract class TileEntity implements KeyedObject { // Paper ++public abstract class TileEntity implements net.minecraft.server.KeyedObject { // Paper public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot // CraftBukkit start - data containers diff --git a/Spigot-Server-Patches/Add-More-Creeper-API.patch b/Spigot-Server-Patches/Add-More-Creeper-API.patch index b68db0927a..520dbe22eb 100644 --- a/Spigot-Server-Patches/Add-More-Creeper-API.patch +++ b/Spigot-Server-Patches/Add-More-Creeper-API.patch @@ -4,10 +4,10 @@ Date: Fri, 24 Aug 2018 11:50:26 -0500 Subject: [PATCH] Add More Creeper API -diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java b/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityCreeper.java -+++ b/src/main/java/net/minecraft/server/EntityCreeper.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java @@ -0,0 +0,0 @@ public class EntityCreeper extends EntityMonster { private static final DataWatcherObject<Boolean> POWERED = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject<Boolean> isIgnitedDW = d; // Paper OBFHELPER diff --git a/Spigot-Server-Patches/Add-PhantomPreSpawnEvent.patch b/Spigot-Server-Patches/Add-PhantomPreSpawnEvent.patch index 5613cecd38..39cf804848 100644 --- a/Spigot-Server-Patches/Add-PhantomPreSpawnEvent.patch +++ b/Spigot-Server-Patches/Add-PhantomPreSpawnEvent.patch @@ -4,10 +4,10 @@ Date: Sat, 25 Aug 2018 19:56:51 -0500 Subject: [PATCH] Add PhantomPreSpawnEvent -diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java b/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPhantom.java -+++ b/src/main/java/net/minecraft/server/EntityPhantom.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java @@ -0,0 +0,0 @@ public class EntityPhantom extends EntityFlying implements IMonster { } @@ -47,10 +47,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 class b extends PathfinderGoal { private final PathfinderTargetCondition b; -diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java +diff --git a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java +--- a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java @@ -0,0 +0,0 @@ public class MobSpawnerPhantom implements MobSpawner { int k = 1 + random.nextInt(difficultydamagescaler.a().a() + 1); diff --git a/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch b/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch index f78f0cbd97..f39ec8aaf3 100644 --- a/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerArmorChangeEvent.patch @@ -4,12 +4,12 @@ Date: Fri, 10 Nov 2017 23:46:34 -0500 Subject: [PATCH] Add PlayerArmorChangeEvent -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.world.entity; +import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent; // Paper import com.google.common.base.Objects; @@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (map == null) { map = Maps.newEnumMap(EnumItemSlot.class); } -diff --git a/src/main/java/net/minecraft/server/EnumItemSlot.java b/src/main/java/net/minecraft/server/EnumItemSlot.java +diff --git a/src/main/java/net/minecraft/world/entity/EnumItemSlot.java b/src/main/java/net/minecraft/world/entity/EnumItemSlot.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EnumItemSlot.java -+++ b/src/main/java/net/minecraft/server/EnumItemSlot.java +--- a/src/main/java/net/minecraft/world/entity/EnumItemSlot.java ++++ b/src/main/java/net/minecraft/world/entity/EnumItemSlot.java @@ -0,0 +0,0 @@ public enum EnumItemSlot { this.j = s; } diff --git a/Spigot-Server-Patches/Add-PlayerAttackEntityCooldownResetEvent.patch b/Spigot-Server-Patches/Add-PlayerAttackEntityCooldownResetEvent.patch index b9ce035409..cf7c5bf392 100644 --- a/Spigot-Server-Patches/Add-PlayerAttackEntityCooldownResetEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerAttackEntityCooldownResetEvent.patch @@ -4,10 +4,10 @@ Date: Thu, 26 Mar 2020 19:44:50 -0700 Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption); diff --git a/Spigot-Server-Patches/Add-PlayerConnectionCloseEvent.patch b/Spigot-Server-Patches/Add-PlayerConnectionCloseEvent.patch index 4e23de4004..66acaf0105 100644 --- a/Spigot-Server-Patches/Add-PlayerConnectionCloseEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerConnectionCloseEvent.patch @@ -33,26 +33,10 @@ API spec for this event. Plugins should not be using that event, and how PlayerPreLoginEvent interacts with PlayerConnectionCloseEvent is undefined. -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java +diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { - private final byte[] e = new byte[4]; - private final MinecraftServer server; - public final NetworkManager networkManager; -- private LoginListener.EnumProtocolState g; -+ private LoginListener.EnumProtocolState g; public final LoginListener.EnumProtocolState getLoginState() { return this.g; }; // Paper - OBFHELPER - private int h; -- private GameProfile i; private void setGameProfile(final GameProfile profile) { this.i = profile; } private GameProfile getGameProfile() { return this.i; } // Paper - OBFHELPER -+ private GameProfile i; private void setGameProfile(final GameProfile profile) { this.i = profile; } public GameProfile getGameProfile() { return this.i; } // Paper - OBFHELPER - private final String j; - private SecretKey loginKey; - private EntityPlayer l; -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java +--- a/src/main/java/net/minecraft/network/NetworkManager.java ++++ b/src/main/java/net/minecraft/network/NetworkManager.java @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { this.j().a(new ChatMessage("multiplayer.disconnect.generic")); } @@ -80,3 +64,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java +@@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { + private final byte[] e = new byte[4]; + private final MinecraftServer server; + public final NetworkManager networkManager; +- private LoginListener.EnumProtocolState g; ++ private LoginListener.EnumProtocolState g; public final LoginListener.EnumProtocolState getLoginState() { return this.g; }; // Paper - OBFHELPER + private int h; +- private GameProfile i; private void setGameProfile(final GameProfile profile) { this.i = profile; } private GameProfile getGameProfile() { return this.i; } // Paper - OBFHELPER ++ private GameProfile i; private void setGameProfile(final GameProfile profile) { this.i = profile; } public GameProfile getGameProfile() { return this.i; } // Paper - OBFHELPER + private final String j; + private SecretKey loginKey; + private EntityPlayer l; diff --git a/Spigot-Server-Patches/Add-PlayerInitialSpawnEvent.patch b/Spigot-Server-Patches/Add-PlayerInitialSpawnEvent.patch index cb61610367..e52ae43861 100644 --- a/Spigot-Server-Patches/Add-PlayerInitialSpawnEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerInitialSpawnEvent.patch @@ -8,10 +8,10 @@ For modifying a player's initial spawn location as they join the server This is a duplicate API from spigot, so use our duplicate subclass and improve setPosition to use raw -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { // Spigot start - spawn location event @@ -25,8 +25,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entityplayer.spawnIn(worldserver1); entityplayer.playerInteractManager.a((WorldServer) entityplayer.world); -- entityplayer.setPosition(loc.getX(), loc.getY(), loc.getZ()); -+ entityplayer.setPositionRaw(loc.getX(), loc.getY(), loc.getZ()); // Paper - set raw so we aren't fully joined to the world (not added to chunk or world) - entityplayer.setYawPitch(loc.getYaw(), loc.getPitch()); +- entityplayer.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch()); ++ // Paper start - set raw so we aren't fully joined to the world (not added to chunk or world) ++ entityplayer.setPositionRaw(loc.getX(), loc.getY(), loc.getZ()); ++ entityplayer.setYawPitch(loc.getYaw(), loc.getPitch()); ++ // Paper end // Spigot end + // CraftBukkit - Moved message to after join +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + return d1 * d1 + d2 * d2 + d3 * d3 < d0 * d0; + } + +- protected void setYawPitch(float f, float f1) { ++ public void setYawPitch(float f, float f1) { // Paper - protected -> public + // CraftBukkit start - yaw was sometimes set to NaN, so we need to set it back to 0 + if (Float.isNaN(f)) { + f = 0; diff --git a/Spigot-Server-Patches/Add-PlayerItemCooldownEvent.patch b/Spigot-Server-Patches/Add-PlayerItemCooldownEvent.patch index 804f7457c6..967b3ae655 100644 --- a/Spigot-Server-Patches/Add-PlayerItemCooldownEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerItemCooldownEvent.patch @@ -4,12 +4,13 @@ Date: Tue, 25 Aug 2020 13:48:33 +0200 Subject: [PATCH] Add PlayerItemCooldownEvent -diff --git a/src/main/java/net/minecraft/server/ItemCooldownPlayer.java b/src/main/java/net/minecraft/server/ItemCooldownPlayer.java +diff --git a/src/main/java/net/minecraft/world/item/ItemCooldownPlayer.java b/src/main/java/net/minecraft/world/item/ItemCooldownPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemCooldownPlayer.java -+++ b/src/main/java/net/minecraft/server/ItemCooldownPlayer.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; +--- a/src/main/java/net/minecraft/world/item/ItemCooldownPlayer.java ++++ b/src/main/java/net/minecraft/world/item/ItemCooldownPlayer.java +@@ -0,0 +0,0 @@ package net.minecraft.world.item; + import net.minecraft.network.protocol.game.PacketPlayOutSetCooldown; + import net.minecraft.server.level.EntityPlayer; +import io.papermc.paper.event.player.PlayerItemCooldownEvent; // Paper + diff --git a/Spigot-Server-Patches/Add-PlayerJumpEvent.patch b/Spigot-Server-Patches/Add-PlayerJumpEvent.patch index c5bc026c81..ecd171d834 100644 --- a/Spigot-Server-Patches/Add-PlayerJumpEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerJumpEvent.patch @@ -4,10 +4,10 @@ Date: Thu, 28 Sep 2017 17:21:44 -0400 Subject: [PATCH] Add PlayerJumpEvent -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { boolean flag = d8 > 0.0D; diff --git a/Spigot-Server-Patches/Add-PlayerShearBlockEvent.patch b/Spigot-Server-Patches/Add-PlayerShearBlockEvent.patch index 31fe45f4bd..9655a5151f 100644 --- a/Spigot-Server-Patches/Add-PlayerShearBlockEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerShearBlockEvent.patch @@ -4,10 +4,10 @@ Date: Thu, 27 Aug 2020 15:02:48 -0400 Subject: [PATCH] Add PlayerShearBlockEvent -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Block.java -+++ b/src/main/java/net/minecraft/server/Block.java +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java @@ -0,0 +0,0 @@ public class Block extends BlockBase implements IMaterial { } @@ -17,12 +17,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!world.isClientSide && !itemstack.isEmpty() && world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)) { float f = 0.5F; double d0 = (double) (world.random.nextFloat() * 0.5F) + 0.25D; -diff --git a/src/main/java/net/minecraft/server/BlockBeehive.java b/src/main/java/net/minecraft/server/BlockBeehive.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockBeehive.java b/src/main/java/net/minecraft/world/level/block/BlockBeehive.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockBeehive.java -+++ b/src/main/java/net/minecraft/server/BlockBeehive.java +--- a/src/main/java/net/minecraft/world/level/block/BlockBeehive.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockBeehive.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.world.level.block; +import io.papermc.paper.event.block.PlayerShearBlockEvent; // Paper - PlayerShearBlockEvent namespace conflicts + @@ -50,12 +50,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 itemstack.damage(1, entityhuman, (entityhuman1) -> { entityhuman1.broadcastItemBreak(enumhand); }); -diff --git a/src/main/java/net/minecraft/server/BlockPumpkin.java b/src/main/java/net/minecraft/server/BlockPumpkin.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockPumpkin.java b/src/main/java/net/minecraft/world/level/block/BlockPumpkin.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockPumpkin.java -+++ b/src/main/java/net/minecraft/server/BlockPumpkin.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; +--- a/src/main/java/net/minecraft/world/level/block/BlockPumpkin.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockPumpkin.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.state.BlockBase; + import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.phys.MovingObjectPositionBlock; +import io.papermc.paper.event.block.PlayerShearBlockEvent; // Paper - PlayerShearBlockEvent namespace conflicts + diff --git a/Spigot-Server-Patches/Add-PlayerUseUnknownEntityEvent.patch b/Spigot-Server-Patches/Add-PlayerUseUnknownEntityEvent.patch index f84923c1b0..6fe855aa24 100644 --- a/Spigot-Server-Patches/Add-PlayerUseUnknownEntityEvent.patch +++ b/Spigot-Server-Patches/Add-PlayerUseUnknownEntityEvent.patch @@ -4,11 +4,11 @@ Date: Sat, 2 Apr 2016 05:09:16 -0400 Subject: [PATCH] Add PlayerUseUnknownEntityEvent -diff --git a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInUseEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInUseEntity.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInUseEntity.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInUseEntity.java +@@ -0,0 +0,0 @@ import net.minecraft.world.phys.Vec3D; public class PacketPlayInUseEntity implements Packet<PacketListenerPlayIn> { @@ -17,10 +17,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private PacketPlayInUseEntity.EnumEntityUseAction action; private Vec3D c; private EnumHand d; -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { } } diff --git a/Spigot-Server-Patches/Add-Plugin-Tickets-to-API-Chunk-Methods.patch b/Spigot-Server-Patches/Add-Plugin-Tickets-to-API-Chunk-Methods.patch index f7746ec53d..f6c0dd1326 100644 --- a/Spigot-Server-Patches/Add-Plugin-Tickets-to-API-Chunk-Methods.patch +++ b/Spigot-Server-Patches/Add-Plugin-Tickets-to-API-Chunk-Methods.patch @@ -60,17 +60,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + return chunk.bukkitChunk; + // Paper end - } - ++ } ++ + // Paper start + private void addTicket(int x, int z) { + MCUtil.MAIN_EXECUTOR.execute(() -> world.getChunkProvider().addTicket(TicketType.PLUGIN, new ChunkCoordIntPair(x, z), 0, Unit.INSTANCE)); // Paper -+ } + } + // Paper end -+ + @Override public Chunk getChunkAt(Block block) { - Preconditions.checkArgument(block != null, "null block"); @@ -0,0 +0,0 @@ public class CraftWorld implements World { public boolean unloadChunkRequest(int x, int z) { org.spigotmc.AsyncCatcher.catchOp("chunk unload"); // Spigot @@ -88,14 +87,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (immediate != null) return true; // Paper if (!generate) { - - IChunkAccess immediate = world.getChunkProvider().getChunkAtImmediately(x, z); ++ + //IChunkAccess immediate = world.getChunkProvider().getChunkAtImmediately(x, z); // Paper if (immediate == null) { immediate = world.getChunkProvider().playerChunkMap.getUnloadingChunk(x, z); } @@ -0,0 +0,0 @@ public class CraftWorld implements World { - if (!(immediate instanceof ProtoChunkExtension) && !(immediate instanceof net.minecraft.server.Chunk)) { + if (!(immediate instanceof ProtoChunkExtension) && !(immediate instanceof net.minecraft.world.level.chunk.Chunk)) { return false; // not full status } - world.getChunkProvider().addTicket(TicketType.PLUGIN, chunkPos, 1, Unit.INSTANCE); @@ -115,8 +114,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CraftWorld implements World { } return this.world.getChunkProvider().getChunkAtAsynchronously(x, z, gen, urgent).thenComposeAsync((either) -> { - net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) either.left().orElse(null); + net.minecraft.world.level.chunk.Chunk chunk = (net.minecraft.world.level.chunk.Chunk) either.left().orElse(null); + if (chunk != null) addTicket(x, z); // Paper return CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk()); - }, MinecraftServer.getServer()); + }, net.minecraft.server.MinecraftServer.getServer()); } diff --git a/Spigot-Server-Patches/Add-PrepareResultEvent.patch b/Spigot-Server-Patches/Add-PrepareResultEvent.patch index 70f8c1fc68..d597f09950 100644 --- a/Spigot-Server-Patches/Add-PrepareResultEvent.patch +++ b/Spigot-Server-Patches/Add-PrepareResultEvent.patch @@ -7,10 +7,10 @@ Adds a new event for all crafting stations that generate a result slot item Anvil, Grindstone and Smithing now extend this event -diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java +diff --git a/src/main/java/net/minecraft/world/inventory/Container.java b/src/main/java/net/minecraft/world/inventory/Container.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Container.java -+++ b/src/main/java/net/minecraft/server/Container.java +--- a/src/main/java/net/minecraft/world/inventory/Container.java ++++ b/src/main/java/net/minecraft/world/inventory/Container.java @@ -0,0 +0,0 @@ public abstract class Container { return nonnulllist; } @@ -19,10 +19,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void c() { int i; -diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java b/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ContainerAnvil.java -+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java +--- a/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java @@ -0,0 +0,0 @@ public class ContainerAnvil extends ContainerAnvilAbstract { } @@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // CraftBukkit start -diff --git a/src/main/java/net/minecraft/server/ContainerAnvilAbstract.java b/src/main/java/net/minecraft/server/ContainerAnvilAbstract.java +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerAnvilAbstract.java b/src/main/java/net/minecraft/world/inventory/ContainerAnvilAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ContainerAnvilAbstract.java -+++ b/src/main/java/net/minecraft/server/ContainerAnvilAbstract.java +--- a/src/main/java/net/minecraft/world/inventory/ContainerAnvilAbstract.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerAnvilAbstract.java @@ -0,0 +0,0 @@ public abstract class ContainerAnvilAbstract extends Container { super.a(iinventory); if (iinventory == this.repairInventory) { @@ -43,10 +43,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -diff --git a/src/main/java/net/minecraft/server/ContainerCartography.java b/src/main/java/net/minecraft/server/ContainerCartography.java +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerCartography.java b/src/main/java/net/minecraft/world/inventory/ContainerCartography.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ContainerCartography.java -+++ b/src/main/java/net/minecraft/server/ContainerCartography.java +--- a/src/main/java/net/minecraft/world/inventory/ContainerCartography.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerCartography.java @@ -0,0 +0,0 @@ public class ContainerCartography extends Container { this.a(itemstack, itemstack1, itemstack2); } @@ -55,10 +55,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } private void a(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2) { -diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/main/java/net/minecraft/server/ContainerGrindstone.java +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java b/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ContainerGrindstone.java -+++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java +--- a/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java @@ -0,0 +0,0 @@ public class ContainerGrindstone extends Container { super.a(iinventory); if (iinventory == this.craftInventory) { @@ -67,10 +67,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -diff --git a/src/main/java/net/minecraft/server/ContainerLoom.java b/src/main/java/net/minecraft/server/ContainerLoom.java +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerLoom.java b/src/main/java/net/minecraft/world/inventory/ContainerLoom.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ContainerLoom.java -+++ b/src/main/java/net/minecraft/server/ContainerLoom.java +--- a/src/main/java/net/minecraft/world/inventory/ContainerLoom.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerLoom.java @@ -0,0 +0,0 @@ public class ContainerLoom extends Container { } @@ -81,10 +81,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @Override -diff --git a/src/main/java/net/minecraft/server/ContainerSmithing.java b/src/main/java/net/minecraft/server/ContainerSmithing.java +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerSmithing.java b/src/main/java/net/minecraft/world/inventory/ContainerSmithing.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ContainerSmithing.java -+++ b/src/main/java/net/minecraft/server/ContainerSmithing.java +--- a/src/main/java/net/minecraft/world/inventory/ContainerSmithing.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerSmithing.java @@ -0,0 +0,0 @@ public class ContainerSmithing extends ContainerAnvilAbstract { org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), itemstack); // CraftBukkit } @@ -93,10 +93,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @Override -diff --git a/src/main/java/net/minecraft/server/ContainerStonecutter.java b/src/main/java/net/minecraft/server/ContainerStonecutter.java +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerStonecutter.java b/src/main/java/net/minecraft/world/inventory/ContainerStonecutter.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ContainerStonecutter.java -+++ b/src/main/java/net/minecraft/server/ContainerStonecutter.java +--- a/src/main/java/net/minecraft/world/inventory/ContainerStonecutter.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerStonecutter.java @@ -0,0 +0,0 @@ public class ContainerStonecutter extends Container { this.a(iinventory, itemstack); } diff --git a/Spigot-Server-Patches/Add-ProjectileCollideEvent.patch b/Spigot-Server-Patches/Add-ProjectileCollideEvent.patch index 133ef02941..742f4dfb47 100644 --- a/Spigot-Server-Patches/Add-ProjectileCollideEvent.patch +++ b/Spigot-Server-Patches/Add-ProjectileCollideEvent.patch @@ -4,10 +4,10 @@ Date: Fri, 16 Dec 2016 21:25:39 -0600 Subject: [PATCH] Add ProjectileCollideEvent -diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityArrow.java -+++ b/src/main/java/net/minecraft/server/EntityArrow.java +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java @@ -0,0 +0,0 @@ public abstract class EntityArrow extends IProjectile { } } @@ -26,10 +26,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (object != null && !flag) { this.a((MovingObjectPosition) object); this.impulse = true; -diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFireball.java -+++ b/src/main/java/net/minecraft/server/EntityFireball.java +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java @@ -0,0 +0,0 @@ public abstract class EntityFireball extends IProjectile { MovingObjectPosition movingobjectposition = ProjectileHelper.a((Entity) this, this::a); @@ -48,10 +48,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.a(movingobjectposition); // CraftBukkit start - Fire ProjectileHitEvent -diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/EntityProjectile.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityProjectile.java -+++ b/src/main/java/net/minecraft/server/EntityProjectile.java +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityProjectile.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityProjectile.java @@ -0,0 +0,0 @@ public abstract class EntityProjectile extends IProjectile { } diff --git a/Spigot-Server-Patches/Add-Raw-Byte-ItemStack-Serialization.patch b/Spigot-Server-Patches/Add-Raw-Byte-ItemStack-Serialization.patch index 1dc6c01345..e5a5980cee 100644 --- a/Spigot-Server-Patches/Add-Raw-Byte-ItemStack-Serialization.patch +++ b/Spigot-Server-Patches/Add-Raw-Byte-ItemStack-Serialization.patch @@ -5,34 +5,10 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization Serializes using NBT which is safer for server data migrations than bukkits format. -diff --git a/src/main/java/net/minecraft/server/DataConverterRegistry.java b/src/main/java/net/minecraft/server/DataConverterRegistry.java +diff --git a/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DataConverterRegistry.java -+++ b/src/main/java/net/minecraft/server/DataConverterRegistry.java -@@ -0,0 +0,0 @@ public class DataConverterRegistry { - return datafixerbuilder.build(SystemUtils.e()); - } - -+ public static DataFixer getDataFixer() { return a(); } // Paper - OBFHELPER - public static DataFixer a() { - return DataConverterRegistry.c; - } -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - this.checkEmpty(); - } - -+ public static ItemStack fromCompound(NBTTagCompound nbttagcompound) { return a(nbttagcompound); } // Paper - OBFHELPER - public static ItemStack a(NBTTagCompound nbttagcompound) { - try { - return new ItemStack(nbttagcompound); -diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java +--- a/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java ++++ b/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java @@ -0,0 +0,0 @@ public class NBTCompressedStreamTools { return nbttagcompound; } @@ -49,6 +25,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static void a(NBTTagCompound nbttagcompound, OutputStream outputstream) throws IOException { DataOutputStream dataoutputstream = new DataOutputStream(new BufferedOutputStream(new GZIPOutputStream(outputstream))); Throwable throwable = null; +diff --git a/src/main/java/net/minecraft/util/datafix/DataConverterRegistry.java b/src/main/java/net/minecraft/util/datafix/DataConverterRegistry.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/util/datafix/DataConverterRegistry.java ++++ b/src/main/java/net/minecraft/util/datafix/DataConverterRegistry.java +@@ -0,0 +0,0 @@ public class DataConverterRegistry { + return datafixerbuilder.build(SystemUtils.e()); + } + ++ public static DataFixer getDataFixer() { return a(); } // Paper - OBFHELPER + public static DataFixer a() { + return DataConverterRegistry.c; + } +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -0,0 +0,0 @@ public final class ItemStack { + this.checkEmpty(); + } + ++ public static ItemStack fromCompound(NBTTagCompound nbttagcompound) { return a(nbttagcompound); } // Paper - OBFHELPER + public static ItemStack a(NBTTagCompound nbttagcompound) { + try { + return new ItemStack(nbttagcompound); diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -67,7 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + NBTTagCompound compound = (item instanceof CraftItemStack ? ((CraftItemStack) item).getHandle() : CraftItemStack.asNMSCopy(item)).save(new NBTTagCompound()); + compound.setInt("DataVersion", getDataVersion()); + try { -+ net.minecraft.server.NBTCompressedStreamTools.writeNBT( ++ net.minecraft.nbt.NBTCompressedStreamTools.writeNBT( + compound, + outputStream + ); @@ -84,14 +84,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + Preconditions.checkArgument(data.length > 0, "cannot deserialize nothing"); + + try { -+ NBTTagCompound compound = net.minecraft.server.NBTCompressedStreamTools.readNBT( ++ NBTTagCompound compound = net.minecraft.nbt.NBTCompressedStreamTools.readNBT( + new java.io.ByteArrayInputStream(data) + ); + int dataVersion = compound.getInt("DataVersion"); + + Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!"); + Dynamic<NBTBase> converted = DataConverterRegistry.getDataFixer().update(DataConverterTypes.ITEM_STACK, new Dynamic<NBTBase>(DynamicOpsNBT.a, compound), dataVersion, getDataVersion()); -+ return CraftItemStack.asCraftMirror(net.minecraft.server.ItemStack.fromCompound((NBTTagCompound) converted.getValue())); ++ return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.fromCompound((NBTTagCompound) converted.getValue())); + } catch (IOException ex) { + com.destroystokyo.paper.util.SneakyThrow.sneaky(ex); + throw new RuntimeException(); diff --git a/Spigot-Server-Patches/Add-StructureLocateEvent.patch b/Spigot-Server-Patches/Add-StructureLocateEvent.patch index b8f85c6922..afe6b4dc70 100644 --- a/Spigot-Server-Patches/Add-StructureLocateEvent.patch +++ b/Spigot-Server-Patches/Add-StructureLocateEvent.patch @@ -4,11 +4,11 @@ Date: Wed, 16 Sep 2020 01:12:29 -0700 Subject: [PATCH] Add StructureLocateEvent -diff --git a/src/main/java/net/minecraft/server/ChunkGenerator.java b/src/main/java/net/minecraft/server/ChunkGenerator.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkGenerator.java -+++ b/src/main/java/net/minecraft/server/ChunkGenerator.java -@@ -0,0 +0,0 @@ package net.minecraft.server; +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +@@ -0,0 +0,0 @@ package net.minecraft.world.level.chunk; import com.google.common.collect.Lists; import com.mojang.serialization.Codec; diff --git a/Spigot-Server-Patches/Add-TNTPrimeEvent.patch b/Spigot-Server-Patches/Add-TNTPrimeEvent.patch index 4bf4394d2c..053a677db9 100644 --- a/Spigot-Server-Patches/Add-TNTPrimeEvent.patch +++ b/Spigot-Server-Patches/Add-TNTPrimeEvent.patch @@ -4,11 +4,35 @@ Date: Mon, 16 Jul 2018 00:05:05 +0300 Subject: [PATCH] Add TNTPrimeEvent -diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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; +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java +@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.block.CraftBlock; + import org.bukkit.event.entity.EntityExplodeEvent; + import org.bukkit.event.entity.EntityRegainHealthEvent; + // CraftBukkit end ++import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent + + public class EntityEnderDragon extends EntityInsentient implements IMonster { + +@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { + }); + craftBlock.getNMS().dropNaturally((WorldServer) world, blockposition, ItemStack.b); + } ++ // Paper start - TNTPrimeEvent ++ org.bukkit.block.Block tntBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); ++ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getSource().getBukkitEntity()).callEvent()) ++ continue; ++ // Paper end + nmsBlock.wasExploded(world, blockposition, explosionSource); + + this.world.a(blockposition, false); +diff --git a/src/main/java/net/minecraft/world/level/block/BlockFire.java b/src/main/java/net/minecraft/world/level/block/BlockFire.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockFire.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockFire.java +@@ -0,0 +0,0 @@ package net.minecraft.world.level.block; import com.google.common.collect.ImmutableMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; @@ -39,14 +63,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BlockTNT.a(world, blockposition); } } -diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockTNT.java b/src/main/java/net/minecraft/world/level/block/BlockTNT.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockTNT.java -+++ b/src/main/java/net/minecraft/server/BlockTNT.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - - import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/level/block/BlockTNT.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockTNT.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.level.block.state.properties.BlockProperties; + import net.minecraft.world.level.block.state.properties.BlockStateBoolean; + import net.minecraft.world.phys.MovingObjectPositionBlock; +import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent public class BlockTNT extends Block { @@ -56,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!iblockdata1.a(iblockdata.getBlock())) { if (world.isBlockIndirectlyPowered(blockposition)) { + // Paper start - TNTPrimeEvent -+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);; ++ org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition);; + if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.REDSTONE, null).callEvent()) + return; + // Paper end @@ -68,7 +92,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) { if (world.isBlockIndirectlyPowered(blockposition)) { + // Paper start - TNTPrimeEvent -+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);; ++ org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition);; + if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.REDSTONE, null).callEvent()) + return; + // Paper end @@ -80,7 +104,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) { if (!world.isClientSide) { + // Paper start - TNTPrimeEvent -+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition); ++ org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition); + org.bukkit.entity.Entity source = explosion.source != null ? explosion.source.getBukkitEntity() : null; + if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, source).callEvent()) + return; @@ -93,7 +117,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return super.interact(iblockdata, world, blockposition, entityhuman, enumhand, movingobjectpositionblock); } else { + // Paper start - TNTPrimeEvent -+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition); ++ org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition); + if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.ITEM, entityhuman.getBukkitEntity()).callEvent()) + return EnumInteractionResult.FAIL; + // Paper end @@ -105,7 +129,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end + // Paper start - TNTPrimeEvent -+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition); ++ org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition); + if (!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.PROJECTILE, iprojectile.getBukkitEntity()).callEvent()) { + return; + } @@ -114,27 +138,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 a(world, blockposition, entity instanceof EntityLiving ? (EntityLiving) entity : null); 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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; - import org.bukkit.event.entity.EntityExplodeEvent; - import org.bukkit.event.entity.EntityRegainHealthEvent; - // CraftBukkit end -+import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent - - public class EntityEnderDragon extends EntityInsentient implements IMonster { - -@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { - }); - craftBlock.getNMS().dropNaturally((WorldServer) world, blockposition, ItemStack.b); - } -+ // Paper start - TNTPrimeEvent -+ org.bukkit.block.Block tntBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); -+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getSource().getBukkitEntity()).callEvent()) -+ continue; -+ // Paper end - nmsBlock.wasExploded(world, blockposition, explosionSource); - - this.world.a(blockposition, false); diff --git a/Spigot-Server-Patches/Add-ThrownEggHatchEvent.patch b/Spigot-Server-Patches/Add-ThrownEggHatchEvent.patch index ffeb02c6c3..183e2ac240 100644 --- a/Spigot-Server-Patches/Add-ThrownEggHatchEvent.patch +++ b/Spigot-Server-Patches/Add-ThrownEggHatchEvent.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add ThrownEggHatchEvent Adds a new event similar to PlayerEggThrowEvent, but without the Player requirement (dispensers can throw eggs to hatch them, too). -diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityEgg.java b/src/main/java/net/minecraft/world/entity/projectile/EntityEgg.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityEgg.java -+++ b/src/main/java/net/minecraft/server/EntityEgg.java +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityEgg.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityEgg.java @@ -0,0 +0,0 @@ public class EntityEgg extends EntityProjectileThrowable { hatchingType = event.getHatchingType(); } diff --git a/Spigot-Server-Patches/Add-UnknownCommandEvent.patch b/Spigot-Server-Patches/Add-UnknownCommandEvent.patch index d459cb3296..03a49a1e05 100644 --- a/Spigot-Server-Patches/Add-UnknownCommandEvent.patch +++ b/Spigot-Server-Patches/Add-UnknownCommandEvent.patch @@ -8,9 +8,9 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -0,0 +0,0 @@ import net.minecraft.server.WorldNBTStorage; - import net.minecraft.server.WorldServer; - import net.minecraft.server.WorldSettings; +@@ -0,0 +0,0 @@ import net.minecraft.world.level.storage.WorldNBTStorage; + import net.minecraft.world.level.storage.loot.LootTableRegistry; + import net.minecraft.world.phys.Vec3D; import org.apache.commons.lang.Validate; +import org.apache.commons.lang3.StringUtils; import org.bukkit.BanList; diff --git a/Spigot-Server-Patches/Add-Velocity-IP-Forwarding-Support.patch b/Spigot-Server-Patches/Add-Velocity-IP-Forwarding-Support.patch index 092abc62b9..98cd7878c9 100644 --- a/Spigot-Server-Patches/Add-Velocity-IP-Forwarding-Support.patch +++ b/Spigot-Server-Patches/Add-Velocity-IP-Forwarding-Support.patch @@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import net.minecraft.server.MinecraftKey; -+import net.minecraft.server.PacketDataSerializer; ++import net.minecraft.network.protocol.game.PacketDataSerializer; + +import java.net.InetAddress; +import java.security.InvalidKeyException; @@ -126,10 +126,72 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } +} -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java +diff --git a/src/main/java/net/minecraft/network/PacketDataSerializer.java b/src/main/java/net/minecraft/network/PacketDataSerializer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java +--- a/src/main/java/net/minecraft/network/PacketDataSerializer.java ++++ b/src/main/java/net/minecraft/network/PacketDataSerializer.java +@@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { + return this.d(oenum.ordinal()); + } + ++ public int readVarInt() { return i(); } // Paper - OBFHELPER + public int i() { + int i = 0; + int j = 0; +@@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { + return this; + } + ++ public UUID readUUID() { return k(); } // Paper - OBFHELPER + public UUID k() { + return new UUID(this.readLong(), this.readLong()); + } +@@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { + } + } + ++ public String readUTF(int maxLength) { return this.e(maxLength); } // Paper - OBFHELPER + public String e(int i) { + int j = this.i(); + +diff --git a/src/main/java/net/minecraft/network/protocol/login/PacketLoginInCustomPayload.java b/src/main/java/net/minecraft/network/protocol/login/PacketLoginInCustomPayload.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/protocol/login/PacketLoginInCustomPayload.java ++++ b/src/main/java/net/minecraft/network/protocol/login/PacketLoginInCustomPayload.java +@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.Packet; + + public class PacketLoginInCustomPayload implements Packet<PacketLoginInListener> { + +- private int a; +- private PacketDataSerializer b; ++ private int a; public int getId() { return a; } // Paper - OBFHELPER ++ private PacketDataSerializer b; public PacketDataSerializer getBuf() { return b; } // Paper - OBFHELPER + + public PacketLoginInCustomPayload() {} + +diff --git a/src/main/java/net/minecraft/network/protocol/login/PacketLoginOutCustomPayload.java b/src/main/java/net/minecraft/network/protocol/login/PacketLoginOutCustomPayload.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/protocol/login/PacketLoginOutCustomPayload.java ++++ b/src/main/java/net/minecraft/network/protocol/login/PacketLoginOutCustomPayload.java +@@ -0,0 +0,0 @@ public class PacketLoginOutCustomPayload implements Packet<PacketLoginOutListene + + public PacketLoginOutCustomPayload() {} + ++ // Paper start ++ public PacketLoginOutCustomPayload(int id, MinecraftKey channel, PacketDataSerializer buf) { ++ this.a = id; ++ this.b = channel; ++ this.c = buf; ++ } ++ // Paper end ++ + @Override + public void a(PacketDataSerializer packetdataserializer) throws IOException { + this.a = packetdataserializer.i(); +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerPreLoginEvent; @@ -210,68 +272,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.disconnect(new ChatMessage("multiplayer.disconnect.unexpected_query_response")); } -diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - return this.d(oenum.ordinal()); - } - -+ public int readVarInt() { return i(); } // Paper - OBFHELPER - public int i() { - int i = 0; - int j = 0; -@@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { - return this; - } - -+ public UUID readUUID() { return k(); } // Paper - OBFHELPER - public UUID k() { - return new UUID(this.readLong(), this.readLong()); - } -@@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { - } - } - -+ public String readUTF(int maxLength) { return this.e(maxLength); } // Paper - OBFHELPER - public String e(int i) { - int j = this.i(); - -diff --git a/src/main/java/net/minecraft/server/PacketLoginInCustomPayload.java b/src/main/java/net/minecraft/server/PacketLoginInCustomPayload.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketLoginInCustomPayload.java -+++ b/src/main/java/net/minecraft/server/PacketLoginInCustomPayload.java -@@ -0,0 +0,0 @@ import java.io.IOException; - - public class PacketLoginInCustomPayload implements Packet<PacketLoginInListener> { - -- private int a; -- private PacketDataSerializer b; -+ private int a; public int getId() { return a; } // Paper - OBFHELPER -+ private PacketDataSerializer b; public PacketDataSerializer getBuf() { return b; } // Paper - OBFHELPER - - public PacketLoginInCustomPayload() {} - -diff --git a/src/main/java/net/minecraft/server/PacketLoginOutCustomPayload.java b/src/main/java/net/minecraft/server/PacketLoginOutCustomPayload.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketLoginOutCustomPayload.java -+++ b/src/main/java/net/minecraft/server/PacketLoginOutCustomPayload.java -@@ -0,0 +0,0 @@ public class PacketLoginOutCustomPayload implements Packet<PacketLoginOutListene - - public PacketLoginOutCustomPayload() {} - -+ // Paper start -+ public PacketLoginOutCustomPayload(int id, MinecraftKey channel, PacketDataSerializer buf) { -+ this.a = id; -+ this.b = channel; -+ this.c = buf; -+ } -+ // Paper end -+ - @Override - public void a(PacketDataSerializer packetdataserializer) throws IOException { - this.a = packetdataserializer.i(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/Spigot-Server-Patches/Add-Wandering-Trader-spawn-rate-config-options.patch b/Spigot-Server-Patches/Add-Wandering-Trader-spawn-rate-config-options.patch index 9f8e606ebc..6b3e3b3a18 100644 --- a/Spigot-Server-Patches/Add-Wandering-Trader-spawn-rate-config-options.patch +++ b/Spigot-Server-Patches/Add-Wandering-Trader-spawn-rate-config-options.patch @@ -32,10 +32,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + wanderingTraderSpawnChanceMax = getInt("wandering-trader.spawn-chance-max", wanderingTraderSpawnChanceMax); + } } -diff --git a/src/main/java/net/minecraft/server/MobSpawnerTrader.java b/src/main/java/net/minecraft/server/MobSpawnerTrader.java +diff --git a/src/main/java/net/minecraft/world/entity/npc/MobSpawnerTrader.java b/src/main/java/net/minecraft/world/entity/npc/MobSpawnerTrader.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerTrader.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerTrader.java +--- a/src/main/java/net/minecraft/world/entity/npc/MobSpawnerTrader.java ++++ b/src/main/java/net/minecraft/world/entity/npc/MobSpawnerTrader.java @@ -0,0 +0,0 @@ public class MobSpawnerTrader implements MobSpawner { private final Random a = new Random(); diff --git a/Spigot-Server-Patches/Add-World-Util-Methods.patch b/Spigot-Server-Patches/Add-World-Util-Methods.patch index f9d960b1d1..3588eef5e8 100644 --- a/Spigot-Server-Patches/Add-World-Util-Methods.patch +++ b/Spigot-Server-Patches/Add-World-Util-Methods.patch @@ -5,10 +5,23 @@ 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 +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + public final Convertable.ConversionSession convertable; + public final UUID uuid; + +- public Chunk getChunkIfLoaded(int x, int z) { ++ @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI + return this.chunkProvider.getChunkAt(x, z, false); + } + +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } @@ -38,10 +51,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end @Override -diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java +diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldBorder.java -+++ b/src/main/java/net/minecraft/server/WorldBorder.java +--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java ++++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java @@ -0,0 +0,0 @@ public class WorldBorder { public WorldBorder() {} @@ -50,16 +63,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean a(BlockPosition blockposition) { return (double) (blockposition.getX() + 1) > this.e() && (double) blockposition.getX() < this.g() && (double) (blockposition.getZ() + 1) > this.f() && (double) blockposition.getZ() < this.h(); } -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - public final Convertable.ConversionSession convertable; - public final UUID uuid; - -- public Chunk getChunkIfLoaded(int x, int z) { -+ @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI - return this.chunkProvider.getChunkAt(x, z, false); - } - diff --git a/Spigot-Server-Patches/Add-a-way-to-get-translation-keys-for-blocks-entitie.patch b/Spigot-Server-Patches/Add-a-way-to-get-translation-keys-for-blocks-entitie.patch index 2e083bee2b..9e92e01b34 100644 --- a/Spigot-Server-Patches/Add-a-way-to-get-translation-keys-for-blocks-entitie.patch +++ b/Spigot-Server-Patches/Add-a-way-to-get-translation-keys-for-blocks-entitie.patch @@ -5,22 +5,10 @@ Subject: [PATCH] Add a way to get translation keys for blocks, entities and materials -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 extends BlockBase implements IMaterial { - return !this.material.isBuildable() && !this.material.isLiquid(); - } - -+ public String getDescriptionId() { return i(); } // Paper - OBFHELPER - public String i() { - if (this.name == null) { - this.name = SystemUtils.a("block", IRegistry.BLOCK.getKey(this)); -diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTypes.java -+++ b/src/main/java/net/minecraft/server/EntityTypes.java +--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java ++++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java @@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { return IRegistry.ENTITY_TYPE.getKey(entitytypes); } @@ -37,10 +25,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public String f() { if (this.bo == null) { this.bo = SystemUtils.a("entity", IRegistry.ENTITY_TYPE.getKey(this)); -diff --git a/src/main/java/net/minecraft/server/Item.java b/src/main/java/net/minecraft/server/Item.java +diff --git a/src/main/java/net/minecraft/world/item/Item.java b/src/main/java/net/minecraft/world/item/Item.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Item.java -+++ b/src/main/java/net/minecraft/server/Item.java +--- a/src/main/java/net/minecraft/world/item/Item.java ++++ b/src/main/java/net/minecraft/world/item/Item.java @@ -0,0 +0,0 @@ public class Item implements IMaterial { private final FoodInfo foodInfo; @@ -58,6 +46,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected String m() { if (this.name == null) { this.name = SystemUtils.a("item", IRegistry.ITEM.getKey(this)); +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java +@@ -0,0 +0,0 @@ public class Block extends BlockBase implements IMaterial { + return !this.material.isBuildable() && !this.material.isLiquid(); + } + ++ public String getDescriptionId() { return i(); } // Paper - OBFHELPER + public String i() { + if (this.name == null) { + this.name = SystemUtils.a("block", IRegistry.BLOCK.getKey(this)); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -105,7 +105,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + public String getTranslationKey(org.bukkit.entity.EntityType type) { -+ return net.minecraft.server.EntityTypes.getByName(type.getName()).map(net.minecraft.server.EntityTypes::getDescriptionId).orElse(null); ++ return net.minecraft.world.entity.EntityTypes.getByName(type.getName()).map(net.minecraft.world.entity.EntityTypes::getDescriptionId).orElse(null); + } + // Paper end diff --git a/Spigot-Server-Patches/Add-ability-to-configure-frosted_ice-properties.patch b/Spigot-Server-Patches/Add-ability-to-configure-frosted_ice-properties.patch index 87a465a350..086598e7f4 100644 --- a/Spigot-Server-Patches/Add-ability-to-configure-frosted_ice-properties.patch +++ b/Spigot-Server-Patches/Add-ability-to-configure-frosted_ice-properties.patch @@ -23,10 +23,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("Frosted Ice: " + (this.frostedIceEnabled ? "enabled" : "disabled") + " / delay: min=" + this.frostedIceDelayMin + ", max=" + this.frostedIceDelayMax); + } } -diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java b/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockIceFrost.java -+++ b/src/main/java/net/minecraft/server/BlockIceFrost.java +--- a/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java @@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce { @Override diff --git a/Spigot-Server-Patches/Add-and-implement-PlayerRecipeBookClickEvent.patch b/Spigot-Server-Patches/Add-and-implement-PlayerRecipeBookClickEvent.patch index 773b9d10da..cf0f23155a 100644 --- a/Spigot-Server-Patches/Add-and-implement-PlayerRecipeBookClickEvent.patch +++ b/Spigot-Server-Patches/Add-and-implement-PlayerRecipeBookClickEvent.patch @@ -4,10 +4,10 @@ Date: Fri, 5 Jun 2020 18:24:06 -0400 Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { PlayerConnectionUtils.ensureMainThread(packetplayinautorecipe, this, this.player.getWorldServer()); this.player.resetIdleTimer(); diff --git a/Spigot-Server-Patches/Add-config-to-disable-ender-dragon-legacy-check.patch b/Spigot-Server-Patches/Add-config-to-disable-ender-dragon-legacy-check.patch index 5a3fcba1ad..e13071e6ee 100644 --- a/Spigot-Server-Patches/Add-config-to-disable-ender-dragon-legacy-check.patch +++ b/Spigot-Server-Patches/Add-config-to-disable-ender-dragon-legacy-check.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true); + } } -diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java +diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EnderDragonBattle.java -+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java +--- a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java ++++ b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java @@ -0,0 +0,0 @@ public class EnderDragonBattle { private boolean dragonKilled; private boolean previouslyKilled; diff --git a/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch b/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch index 66a8613e41..86b908c97b 100644 --- a/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch +++ b/Spigot-Server-Patches/Add-configurable-despawn-distances-for-living-entiti.patch @@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + hardDespawnDistance = hardDespawnDistance*hardDespawnDistance; + } } -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { int i = this.getEntityType().e().f(); int j = i * i; diff --git a/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch b/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch index a57399eb17..584b4ae3a9 100644 --- a/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch +++ b/Spigot-Server-Patches/Add-configurable-portal-search-radius.patch @@ -22,11 +22,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + portalSearchVanillaDimensionScaling = getBoolean("portal-search-vanilla-dimension-scaling", true); + } } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne double d4 = DimensionManager.a(this.world.getDimensionManager(), worldserver.getDimensionManager()); BlockPosition blockposition = new BlockPosition(MathHelper.a(this.locX() * d4, d0, d2), this.locY(), MathHelper.a(this.locZ() * d4, d1, d3)); // CraftBukkit start @@ -41,10 +41,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (event == null) { return null; } -diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java +diff --git a/src/main/java/net/minecraft/world/level/portal/PortalTravelAgent.java b/src/main/java/net/minecraft/world/level/portal/PortalTravelAgent.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PortalTravelAgent.java -+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java +--- a/src/main/java/net/minecraft/world/level/portal/PortalTravelAgent.java ++++ b/src/main/java/net/minecraft/world/level/portal/PortalTravelAgent.java @@ -0,0 +0,0 @@ public class PortalTravelAgent { public Optional<BlockUtil.Rectangle> findPortal(BlockPosition blockposition, boolean flag) { diff --git a/Spigot-Server-Patches/Add-dropLeash-variable-to-EntityUnleashEvent.patch b/Spigot-Server-Patches/Add-dropLeash-variable-to-EntityUnleashEvent.patch index 58b44614e8..b334771bcf 100644 --- a/Spigot-Server-Patches/Add-dropLeash-variable-to-EntityUnleashEvent.patch +++ b/Spigot-Server-Patches/Add-dropLeash-variable-to-EntityUnleashEvent.patch @@ -4,10 +4,10 @@ Date: Fri, 29 Jan 2021 15:13:11 +0100 Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent -diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityCreature.java b/src/main/java/net/minecraft/world/entity/EntityCreature.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityCreature.java -+++ b/src/main/java/net/minecraft/server/EntityCreature.java +--- a/src/main/java/net/minecraft/world/entity/EntityCreature.java ++++ b/src/main/java/net/minecraft/world/entity/EntityCreature.java @@ -0,0 +0,0 @@ public abstract class EntityCreature extends EntityInsentient { if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) { @@ -36,10 +36,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.goalSelector.a(PathfinderGoal.Type.MOVE); } else if (f > 6.0F) { double d0 = (entity.locX() - this.locX()) / (double) f; -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java @@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTransformEvent; import org.bukkit.event.entity.EntityUnleashEvent; @@ -107,18 +107,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end } } -diff --git a/src/main/java/net/minecraft/server/EntityLeash.java b/src/main/java/net/minecraft/server/EntityLeash.java +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityLeash.java b/src/main/java/net/minecraft/world/entity/decoration/EntityLeash.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLeash.java -+++ b/src/main/java/net/minecraft/server/EntityLeash.java -@@ -0,0 +0,0 @@ import java.util.List; - import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityLeash.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityLeash.java +@@ -0,0 +0,0 @@ import net.minecraft.server.level.WorldServer; + import org.bukkit.craftbukkit.event.CraftEventFactory; + // CraftBukkit end - import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit +import org.bukkit.event.player.PlayerUnleashEntityEvent; // Paper - ++ public class EntityLeash extends EntityHanging { + public EntityLeash(EntityTypes<? extends EntityLeash> entitytypes, World world) { @@ -0,0 +0,0 @@ public class EntityLeash extends EntityHanging { entityinsentient = (EntityInsentient) iterator.next(); if (entityinsentient.isLeashed() && entityinsentient.getLeashHolder() == this) { diff --git a/Spigot-Server-Patches/Add-effect-to-block-break-naturally.patch b/Spigot-Server-Patches/Add-effect-to-block-break-naturally.patch index f7979377ce..4c183d1106 100644 --- a/Spigot-Server-Patches/Add-effect-to-block-break-naturally.patch +++ b/Spigot-Server-Patches/Add-effect-to-block-break-naturally.patch @@ -20,13 +20,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean breakNaturally(ItemStack item, boolean triggerEffect) { + // Paper end // Order matters here, need to drop before setting to air so skulls can get their data - net.minecraft.server.IBlockData iblockdata = this.getNMS(); - net.minecraft.server.Block block = iblockdata.getBlock(); + net.minecraft.world.level.block.state.IBlockData iblockdata = this.getNMS(); + net.minecraft.world.level.block.Block block = iblockdata.getBlock(); @@ -0,0 +0,0 @@ public class CraftBlock implements Block { // Modelled off EntityHuman#hasBlock if (block != Blocks.AIR && (item == null || !iblockdata.isRequiresSpecialTool() || nmsItem.canDestroySpecialBlock(iblockdata))) { - net.minecraft.server.Block.dropItems(iblockdata, world.getMinecraftWorld(), position, world.getTileEntity(position), null, nmsItem); -+ if (triggerEffect) world.triggerEffect(org.bukkit.Effect.STEP_SOUND.getId(), position, net.minecraft.server.Block.getCombinedId(block.getBlockData())); // Paper + net.minecraft.world.level.block.Block.dropItems(iblockdata, world.getMinecraftWorld(), position, world.getTileEntity(position), null, nmsItem); ++ if (triggerEffect) world.triggerEffect(org.bukkit.Effect.STEP_SOUND.getId(), position, net.minecraft.world.level.block.Block.getCombinedId(block.getBlockData())); // Paper result = true; } diff --git a/Spigot-Server-Patches/Add-entity-liquid-API.patch b/Spigot-Server-Patches/Add-entity-liquid-API.patch index d87154d276..a531656cd1 100644 --- a/Spigot-Server-Patches/Add-entity-liquid-API.patch +++ b/Spigot-Server-Patches/Add-entity-liquid-API.patch @@ -4,11 +4,11 @@ Date: Thu, 2 Jul 2020 18:11:43 -0500 Subject: [PATCH] Add entity liquid API -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return this.inWater; } @@ -23,7 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private boolean k() { return this.world.getType(this.getChunkCoordinates()).a(Blocks.BUBBLE_COLUMN); } -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return this.isInWater() || this.isInRain() || this.k(); } @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean aH() { return this.isInWater() || this.k(); } -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return this.O == tag; } diff --git a/Spigot-Server-Patches/Add-exception-reporting-event.patch b/Spigot-Server-Patches/Add-exception-reporting-event.patch index e79f6570b6..d7b92cf591 100644 --- a/Spigot-Server-Patches/Add-exception-reporting-event.patch +++ b/Spigot-Server-Patches/Add-exception-reporting-event.patch @@ -48,43 +48,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return internalTask; + } +} -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - -+import com.destroystokyo.paper.exception.ServerInternalException; - import com.google.common.collect.Maps; - import com.google.common.collect.Sets; - import it.unimi.dsi.fastutil.longs.LongOpenHashSet; -@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - this.tileEntities.remove(blockposition); - // Paper end - } else { -- System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() -- + " (" + getType(blockposition) + ") where there was no entity tile!"); -- System.out.println("Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16)); -- new Exception().printStackTrace(); -+ // Paper start -+ ServerInternalException e = new ServerInternalException( -+ "Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," -+ + tileentity.position.getY() + "," + tileentity.position.getZ() -+ + " (" + getType(blockposition) + ") where there was no entity tile!\n" + -+ "Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16)); -+ e.printStackTrace(); -+ ServerInternalException.reportInternalException(e); -+ // Paper end - // CraftBukkit end +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + return true; + } catch (Exception exception) { + PlayerChunkMap.LOGGER.error("Failed to save chunk {},{}", chunkcoordintpair.x, chunkcoordintpair.z, exception); ++ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper + return false; + } } - } -diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +diff --git a/src/main/java/net/minecraft/server/players/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/players/NameReferencingFileConverter.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +--- a/src/main/java/net/minecraft/server/players/NameReferencingFileConverter.java ++++ b/src/main/java/net/minecraft/server/players/NameReferencingFileConverter.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.server.players; +import com.destroystokyo.paper.exception.ServerInternalException; import com.google.common.collect.Lists; @@ -106,78 +87,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java b/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - return true; - } catch (Exception exception) { - PlayerChunkMap.LOGGER.error("Failed to save chunk {},{}", chunkcoordintpair.x, chunkcoordintpair.z, exception); -+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper - return false; - } - } -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - return true; - } - } catch (IOException ioexception) { -+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(ioexception); // Paper - return false; - } - } -@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { - filechannel.write(bytebuffer); - } catch (Throwable throwable1) { - throwable = throwable1; -+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(throwable); // Paper - throw throwable1; - } finally { - if (filechannel != null) { -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - - // CraftBukkit start -+import com.destroystokyo.paper.exception.ServerInternalException; - import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; - // CraftBukkit end - -@@ -0,0 +0,0 @@ public final class SpawnerCreature { - } - } catch (Exception exception) { - SpawnerCreature.LOGGER.warn("Failed to create mob", exception); -+ ServerInternalException.reportInternalException(exception); // Paper - return null; - } - } -@@ -0,0 +0,0 @@ public final class SpawnerCreature { - entity = biomesettingsmobs_c.c.a((World) worldaccess.getMinecraftWorld()); - } catch (Exception exception) { - SpawnerCreature.LOGGER.warn("Failed to create mob", exception); -+ ServerInternalException.reportInternalException(exception); // Paper - continue; - } - -diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/VillageSiege.java -+++ b/src/main/java/net/minecraft/server/VillageSiege.java +--- a/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java ++++ b/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.world.entity.ai.village; +import com.destroystokyo.paper.exception.ServerInternalException; + import java.util.Iterator; import javax.annotation.Nullable; - import org.apache.logging.log4j.LogManager; + import net.minecraft.core.BaseBlockPosition; @@ -0,0 +0,0 @@ public class VillageSiege implements MobSpawner { entityzombie.prepare(worldserver, worldserver.getDamageScaler(entityzombie.getChunkCoordinates()), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null); } catch (Exception exception) { @@ -186,12 +107,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return; } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/world/level/SpawnerCreature.java b/src/main/java/net/minecraft/world/level/SpawnerCreature.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/world/level/SpawnerCreature.java +@@ -0,0 +0,0 @@ public final class SpawnerCreature { + } + } catch (Exception exception) { + SpawnerCreature.LOGGER.warn("Failed to create mob", exception); ++ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper + return null; + } + } +@@ -0,0 +0,0 @@ public final class SpawnerCreature { + entity = biomesettingsmobs_c.c.a((World) worldaccess.getMinecraftWorld()); + } catch (Exception exception) { + SpawnerCreature.LOGGER.warn("Failed to create mob", exception); ++ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper + continue; + } + +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.world.level; +import co.aikar.timings.Timing; +import co.aikar.timings.Timings; @@ -226,10 +167,61 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entity.dead = true; return; // Paper end -diff --git a/src/main/java/net/minecraft/server/WorldPersistentData.java b/src/main/java/net/minecraft/server/WorldPersistentData.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldPersistentData.java -+++ b/src/main/java/net/minecraft/server/WorldPersistentData.java +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -0,0 +0,0 @@ + package net.minecraft.world.level.chunk; + ++import com.destroystokyo.paper.exception.ServerInternalException; + import com.google.common.collect.Maps; + import com.google.common.collect.Sets; + import it.unimi.dsi.fastutil.longs.LongOpenHashSet; +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + this.tileEntities.remove(blockposition); + // Paper end + } else { +- System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.getPosition().getX() + "," + tileentity.getPosition().getY() + "," + tileentity.getPosition().getZ() +- + " (" + getType(blockposition) + ") where there was no entity tile!"); +- System.out.println("Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16)); +- new Exception().printStackTrace(); ++ // Paper start ++ ServerInternalException e = new ServerInternalException( ++ "Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," ++ + tileentity.position.getY() + "," + tileentity.position.getZ() ++ + " (" + getType(blockposition) + ") where there was no entity tile!\n" + ++ "Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16)); ++ e.printStackTrace(); ++ ServerInternalException.reportInternalException(e); ++ // Paper end + // CraftBukkit end + } + } +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { + return true; + } + } catch (IOException ioexception) { ++ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(ioexception); // Paper + return false; + } + } +@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { + filechannel.write(bytebuffer); + } catch (Throwable throwable1) { + throwable = throwable1; ++ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(throwable); // Paper + throw throwable1; + } finally { + if (filechannel != null) { +diff --git a/src/main/java/net/minecraft/world/level/storage/WorldPersistentData.java b/src/main/java/net/minecraft/world/level/storage/WorldPersistentData.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/storage/WorldPersistentData.java ++++ b/src/main/java/net/minecraft/world/level/storage/WorldPersistentData.java @@ -0,0 +0,0 @@ public class WorldPersistentData { } } catch (Throwable throwable6) { diff --git a/Spigot-Server-Patches/Add-fast-alternative-constructor-for-Vector3f.patch b/Spigot-Server-Patches/Add-fast-alternative-constructor-for-Vector3f.patch index b95320d5e0..53affe4aba 100644 --- a/Spigot-Server-Patches/Add-fast-alternative-constructor-for-Vector3f.patch +++ b/Spigot-Server-Patches/Add-fast-alternative-constructor-for-Vector3f.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add fast alternative constructor for Vector3f Signed-off-by: Irmo van den Berge <irmo.vandenberge@ziggo.nl> -diff --git a/src/main/java/net/minecraft/server/Vector3f.java b/src/main/java/net/minecraft/server/Vector3f.java +diff --git a/src/main/java/net/minecraft/core/Vector3f.java b/src/main/java/net/minecraft/core/Vector3f.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Vector3f.java -+++ b/src/main/java/net/minecraft/server/Vector3f.java +--- a/src/main/java/net/minecraft/core/Vector3f.java ++++ b/src/main/java/net/minecraft/core/Vector3f.java @@ -0,0 +0,0 @@ public class Vector3f { this(nbttaglist.i(0), nbttaglist.i(1), nbttaglist.i(2)); } diff --git a/Spigot-Server-Patches/Add-hand-to-bucket-events.patch b/Spigot-Server-Patches/Add-hand-to-bucket-events.patch index 46a269939b..50ceef31fb 100644 --- a/Spigot-Server-Patches/Add-hand-to-bucket-events.patch +++ b/Spigot-Server-Patches/Add-hand-to-bucket-events.patch @@ -4,10 +4,41 @@ Date: Thu, 2 Aug 2018 08:44:35 -0500 Subject: [PATCH] Add hand to bucket events -diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityCow.java -+++ b/src/main/java/net/minecraft/server/EntityCow.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + this.getMinecraftServer().getPlayerList().sendAll(new PacketPlayOutSpawnPosition(blockposition, f)); + } + +- public BlockPosition getSpawn() { +- BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c()); +- +- if (!this.getWorldBorder().a(blockposition)) { +- blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); +- } +- +- return blockposition; +- } ++ // Paper - moved up to World ++ //public BlockPosition getSpawn() { ++ // BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c()); ++ // ++ // if (!this.getWorldBorder().a(blockposition)) { ++ // blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); ++ // } ++ // ++ // return blockposition; ++ //} ++ // Paper end + + public float v() { + return this.worldData.d(); +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityCow.java b/src/main/java/net/minecraft/world/entity/animal/EntityCow.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityCow.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityCow.java @@ -0,0 +0,0 @@ public class EntityCow extends EntityAnimal { if (itemstack.getItem() == Items.BUCKET && !this.isBaby()) { @@ -17,10 +48,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (event.isCancelled()) { return EnumInteractionResult.PASS; -diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java +diff --git a/src/main/java/net/minecraft/world/item/ItemBucket.java b/src/main/java/net/minecraft/world/item/ItemBucket.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemBucket.java -+++ b/src/main/java/net/minecraft/server/ItemBucket.java +--- a/src/main/java/net/minecraft/world/item/ItemBucket.java ++++ b/src/main/java/net/minecraft/world/item/ItemBucket.java @@ -0,0 +0,0 @@ public class ItemBucket extends Item { if (iblockdata.getBlock() instanceof IFluidSource) { // CraftBukkit start @@ -72,10 +103,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else if (world.getDimensionManager().isNether() && this.fluidType.a((Tag) TagsFluid.WATER)) { int i = blockposition.getX(); int j = blockposition.getY(); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } // Paper end @@ -94,37 +125,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public boolean s_() { return this.isClientSide; -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - this.getMinecraftServer().getPlayerList().sendAll(new PacketPlayOutSpawnPosition(blockposition, f)); - } - -- public BlockPosition getSpawn() { -- BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c()); -- -- if (!this.getWorldBorder().a(blockposition)) { -- blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); -- } -- -- return blockposition; -- } -+ // Paper - moved up to World -+ //public BlockPosition getSpawn() { -+ // BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c()); -+ // -+ // if (!this.getWorldBorder().a(blockposition)) { -+ // blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); -+ // } -+ // -+ // return blockposition; -+ //} -+ // Paper end - - public float v() { - return this.worldData.d(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -141,7 +141,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CraftEventFactory { } - private static PlayerEvent getPlayerBucketEvent(boolean isFilling, WorldServer world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item) { + private static PlayerEvent getPlayerBucketEvent(boolean isFilling, WorldServer world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.world.item.Item item) { + // Paper start - add enumHand + return getPlayerBucketEvent(isFilling, world, who, changed, clicked, clickedFace, itemstack, item, null); + } @@ -150,11 +150,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return (PlayerBucketEmptyEvent) getPlayerBucketEvent(false, world, who, changed, clicked, clickedFace, itemstack, Items.BUCKET, enumHand); + } + -+ public static PlayerBucketFillEvent callPlayerBucketFillEvent(World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemInHand, net.minecraft.server.Item bucket, EnumHand enumHand) { ++ public static PlayerBucketFillEvent callPlayerBucketFillEvent(World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemInHand, net.minecraft.world.item.Item bucket, EnumHand enumHand) { + return (PlayerBucketFillEvent) getPlayerBucketEvent(true, world, who, clicked, changed, clickedFace, itemInHand, bucket, enumHand); + } + -+ 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) { ++ private static PlayerEvent getPlayerBucketEvent(boolean isFilling, World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.world.item.Item item, EnumHand enumHand) { + // Paper end Player player = (Player) who.getBukkitEntity(); CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item); diff --git a/Spigot-Server-Patches/Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/Spigot-Server-Patches/Add-handshake-event-to-allow-plugins-to-handle-clien.patch index d0f73a3276..487774ff61 100644 --- a/Spigot-Server-Patches/Add-handshake-event-to-allow-plugins-to-handle-clien.patch +++ b/Spigot-Server-Patches/Add-handshake-event-to-allow-plugins-to-handle-clien.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client handshaking logic themselves -diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java +diff --git a/src/main/java/net/minecraft/server/network/HandshakeListener.java b/src/main/java/net/minecraft/server/network/HandshakeListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/HandshakeListener.java -+++ b/src/main/java/net/minecraft/server/HandshakeListener.java +--- a/src/main/java/net/minecraft/server/network/HandshakeListener.java ++++ b/src/main/java/net/minecraft/server/network/HandshakeListener.java @@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { // CraftBukkit end private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request"); diff --git a/Spigot-Server-Patches/Add-ignore-discounts-API.patch b/Spigot-Server-Patches/Add-ignore-discounts-API.patch index 74b3c45bbd..728df9b6ac 100644 --- a/Spigot-Server-Patches/Add-ignore-discounts-API.patch +++ b/Spigot-Server-Patches/Add-ignore-discounts-API.patch @@ -4,10 +4,10 @@ Date: Mon, 9 Nov 2020 20:44:51 +0100 Subject: [PATCH] Add ignore discounts API -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVillager.java -+++ b/src/main/java/net/minecraft/server/EntityVillager.java +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java @@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation while (iterator.hasNext()) { @@ -24,10 +24,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 double d0 = 0.3D + 0.0625D * (double) j; int k = (int) Math.floor(d0 * (double) merchantrecipe1.a().getCount()); -diff --git a/src/main/java/net/minecraft/server/MerchantRecipe.java b/src/main/java/net/minecraft/server/MerchantRecipe.java +diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantRecipe.java b/src/main/java/net/minecraft/world/item/trading/MerchantRecipe.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MerchantRecipe.java -+++ b/src/main/java/net/minecraft/server/MerchantRecipe.java +--- a/src/main/java/net/minecraft/world/item/trading/MerchantRecipe.java ++++ b/src/main/java/net/minecraft/world/item/trading/MerchantRecipe.java @@ -0,0 +0,0 @@ public class MerchantRecipe { private int demand; public float priceMultiplier; @@ -102,9 +102,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public CraftMerchantRecipe(ItemStack result, int uses, int maxUses, boolean experienceReward, int experience, float priceMultiplier, boolean ignoreDiscounts) { + super(result, uses, maxUses, experienceReward, experience, priceMultiplier, ignoreDiscounts); + // Paper end - this.handle = new net.minecraft.server.MerchantRecipe( - net.minecraft.server.ItemStack.b, - net.minecraft.server.ItemStack.b, + this.handle = new net.minecraft.world.item.trading.MerchantRecipe( + net.minecraft.world.item.ItemStack.b, + net.minecraft.world.item.ItemStack.b, @@ -0,0 +0,0 @@ public class CraftMerchantRecipe extends MerchantRecipe { maxUses, experience, @@ -129,7 +129,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end + - public net.minecraft.server.MerchantRecipe toMinecraft() { + public net.minecraft.world.item.trading.MerchantRecipe toMinecraft() { List<ItemStack> ingredients = getIngredients(); Preconditions.checkState(!ingredients.isEmpty(), "No offered ingredients"); @@ -0,0 +0,0 @@ public class CraftMerchantRecipe extends MerchantRecipe { diff --git a/Spigot-Server-Patches/Add-more-Evoker-API.patch b/Spigot-Server-Patches/Add-more-Evoker-API.patch index e9fad8ce79..770be64187 100644 --- a/Spigot-Server-Patches/Add-more-Evoker-API.patch +++ b/Spigot-Server-Patches/Add-more-Evoker-API.patch @@ -4,11 +4,11 @@ Date: Sun, 23 Aug 2020 15:28:35 +0200 Subject: [PATCH] Add more Evoker API -diff --git a/src/main/java/net/minecraft/server/EntityEvoker.java b/src/main/java/net/minecraft/server/EntityEvoker.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityEvoker.java b/src/main/java/net/minecraft/world/entity/monster/EntityEvoker.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityEvoker.java -+++ b/src/main/java/net/minecraft/server/EntityEvoker.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/entity/monster/EntityEvoker.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityEvoker.java +@@ -0,0 +0,0 @@ import net.minecraft.world.phys.shapes.VoxelShape; public class EntityEvoker extends EntityIllagerWizard { diff --git a/Spigot-Server-Patches/Add-more-Witch-API.patch b/Spigot-Server-Patches/Add-more-Witch-API.patch index 3adb90d808..056494c865 100644 --- a/Spigot-Server-Patches/Add-more-Witch-API.patch +++ b/Spigot-Server-Patches/Add-more-Witch-API.patch @@ -4,12 +4,12 @@ Date: Fri, 12 Oct 2018 14:10:46 -0500 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 +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java b/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityWitch.java -+++ b/src/main/java/net/minecraft/server/EntityWitch.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.world.entity.monster; +// Paper start +import com.destroystokyo.paper.event.entity.WitchReadyPotionEvent; @@ -108,11 +108,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/m index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.entity; - --import com.destroystokyo.paper.entity.CraftRangedEntity; // Paper - import net.minecraft.server.EntityWitch; +@@ -0,0 +0,0 @@ import net.minecraft.world.entity.monster.EntityWitch; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Witch; @@ -124,9 +120,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import org.bukkit.inventory.ItemStack; +// Paper end - public class CraftWitch extends CraftRaider implements Witch, CraftRangedEntity<EntityWitch> { // Paper + public class CraftWitch extends CraftRaider implements Witch, com.destroystokyo.paper.entity.CraftRangedEntity<EntityWitch> { // Paper public CraftWitch(CraftServer server, EntityWitch entity) { -@@ -0,0 +0,0 @@ public class CraftWitch extends CraftRaider implements Witch, CraftRangedEntity< +@@ -0,0 +0,0 @@ public class CraftWitch extends CraftRaider implements Witch, com.destroystokyo. public EntityType getType() { return EntityType.WITCH; } diff --git a/Spigot-Server-Patches/Add-more-Zombie-API.patch b/Spigot-Server-Patches/Add-more-Zombie-API.patch index e5fd2e3a94..189522f35d 100644 --- a/Spigot-Server-Patches/Add-more-Zombie-API.patch +++ b/Spigot-Server-Patches/Add-more-Zombie-API.patch @@ -4,10 +4,10 @@ Date: Sun, 7 Oct 2018 04:29:59 -0500 Subject: [PATCH] Add more Zombie API -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { private int bt; public int drownedConversionTime; diff --git a/Spigot-Server-Patches/Add-option-to-allow-iron-golems-to-spawn-in-air.patch b/Spigot-Server-Patches/Add-option-to-allow-iron-golems-to-spawn-in-air.patch index 4a23c8998f..68e6e34cd7 100644 --- a/Spigot-Server-Patches/Add-option-to-allow-iron-golems-to-spawn-in-air.patch +++ b/Spigot-Server-Patches/Add-option-to-allow-iron-golems-to-spawn-in-air.patch @@ -20,10 +20,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean armorStandEntityLookups = true; private void armorStandEntityLookups() { armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); -diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityIronGolem.java b/src/main/java/net/minecraft/world/entity/animal/EntityIronGolem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityIronGolem.java -+++ b/src/main/java/net/minecraft/server/EntityIronGolem.java +--- a/src/main/java/net/minecraft/world/entity/animal/EntityIronGolem.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityIronGolem.java @@ -0,0 +0,0 @@ public class EntityIronGolem extends EntityGolem implements IEntityAngerable { BlockPosition blockposition1 = blockposition.down(); IBlockData iblockdata = iworldreader.getType(blockposition1); diff --git a/Spigot-Server-Patches/Add-option-to-disable-pillager-patrols.patch b/Spigot-Server-Patches/Add-option-to-disable-pillager-patrols.patch index 221bf805c6..7eefb50579 100644 --- a/Spigot-Server-Patches/Add-option-to-disable-pillager-patrols.patch +++ b/Spigot-Server-Patches/Add-option-to-disable-pillager-patrols.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + disablePillagerPatrols = getBoolean("game-mechanics.disable-pillager-patrols", disablePillagerPatrols); + } } -diff --git a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java +diff --git a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java +--- a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java @@ -0,0 +0,0 @@ public class MobSpawnerPatrol implements MobSpawner { @Override diff --git a/Spigot-Server-Patches/Add-option-to-make-parrots-stay-on-shoulders-despite.patch b/Spigot-Server-Patches/Add-option-to-make-parrots-stay-on-shoulders-despite.patch index 871e042892..bdf6f0c58e 100644 --- a/Spigot-Server-Patches/Add-option-to-make-parrots-stay-on-shoulders-despite.patch +++ b/Spigot-Server-Patches/Add-option-to-make-parrots-stay-on-shoulders-despite.patch @@ -25,23 +25,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("Parrots are unaffected by player movement: " + parrotsHangOnBetter); + } } -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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.j(this.getShoulderEntityLeft()); - this.j(this.getShoulderEntityRight()); - if (!this.world.isClientSide && (this.fallDistance > 0.5F || this.isInWater()) || this.abilities.isFlying || this.isSleeping()) { -- this.releaseShoulderEntities(); -+ if (!this.world.paperConfig.parrotsHangOnBetter) this.releaseShoulderEntities(); // Paper - Hang on! - } - - } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { switch (packetplayinentityaction.c()) { case PRESS_SHIFT_KEY: @@ -56,3 +43,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 break; case RELEASE_SHIFT_KEY: this.player.setSneaking(false); +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { + this.j(this.getShoulderEntityLeft()); + this.j(this.getShoulderEntityRight()); + if (!this.world.isClientSide && (this.fallDistance > 0.5F || this.isInWater()) || this.abilities.isFlying || this.isSleeping()) { +- this.releaseShoulderEntities(); ++ if (!this.world.paperConfig.parrotsHangOnBetter) this.releaseShoulderEntities(); // Paper - Hang on! + } + + } diff --git a/Spigot-Server-Patches/Add-option-to-nerf-pigmen-from-nether-portals.patch b/Spigot-Server-Patches/Add-option-to-nerf-pigmen-from-nether-portals.patch index 988537d5ec..f6a40f3a29 100644 --- a/Spigot-Server-Patches/Add-option-to-nerf-pigmen-from-nether-portals.patch +++ b/Spigot-Server-Patches/Add-option-to-nerf-pigmen-from-nether-portals.patch @@ -18,24 +18,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen); + } } -diff --git a/src/main/java/net/minecraft/server/BlockPortal.java b/src/main/java/net/minecraft/server/BlockPortal.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockPortal.java -+++ b/src/main/java/net/minecraft/server/BlockPortal.java -@@ -0,0 +0,0 @@ public class BlockPortal extends Block { - - if (entity != null) { - entity.resetPortalCooldown(); -+ entity.fromNetherPortal = true; // Paper -+ if (worldserver.paperConfig.nerfNetherPortalPigmen) ((EntityInsentient) entity).aware = false; // Paper - } - } - } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public long activatedTick = Integer.MIN_VALUE; public boolean isTemporarilyActive = false; // Paper public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one @@ -43,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected int numCollisions = 0; // Paper public void inactiveTick() { } // Spigot end -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne if (spawnedViaMobSpawner) { nbttagcompound.setBoolean("Paper.FromMobSpawner", true); } @@ -53,7 +40,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end return nbttagcompound; } catch (Throwable throwable) { -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } spawnedViaMobSpawner = nbttagcompound.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status @@ -61,3 +48,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (nbttagcompound.hasKey("Paper.SpawnReason")) { String spawnReasonName = nbttagcompound.getString("Paper.SpawnReason"); try { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockPortal.java b/src/main/java/net/minecraft/world/level/block/BlockPortal.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockPortal.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockPortal.java +@@ -0,0 +0,0 @@ public class BlockPortal extends Block { + + if (entity != null) { + entity.resetPortalCooldown(); ++ entity.fromNetherPortal = true; // Paper ++ if (worldserver.paperConfig.nerfNetherPortalPigmen) ((EntityInsentient) entity).aware = false; // Paper + } + } + } diff --git a/Spigot-Server-Patches/Add-option-to-prevent-players-from-moving-into-unloa.patch b/Spigot-Server-Patches/Add-option-to-prevent-players-from-moving-into-unloa.patch index fa253277e7..6e0381d908 100644 --- a/Spigot-Server-Patches/Add-option-to-prevent-players-from-moving-into-unloa.patch +++ b/Spigot-Server-Patches/Add-option-to-prevent-players-from-moving-into-unloa.patch @@ -19,10 +19,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + preventMovingIntoUnloadedChunks = getBoolean("prevent-moving-into-unloaded-chunks", false); + } } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { } speed *= 2f; // TODO: Get the speed of the vehicle instead of the player diff --git a/Spigot-Server-Patches/Add-permission-for-command-blocks.patch b/Spigot-Server-Patches/Add-permission-for-command-blocks.patch index 1aac314e43..44f53b9d1c 100644 --- a/Spigot-Server-Patches/Add-permission-for-command-blocks.patch +++ b/Spigot-Server-Patches/Add-permission-for-command-blocks.patch @@ -4,36 +4,23 @@ Date: Sat, 16 May 2020 10:05:30 +0200 Subject: [PATCH] Add permission for command blocks -diff --git a/src/main/java/net/minecraft/server/BlockCommand.java b/src/main/java/net/minecraft/server/BlockCommand.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockCommand.java -+++ b/src/main/java/net/minecraft/server/BlockCommand.java -@@ -0,0 +0,0 @@ public class BlockCommand extends BlockTileEntity { - public EnumInteractionResult interact(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) { - TileEntity tileentity = world.getTileEntity(blockposition); +--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +@@ -0,0 +0,0 @@ public class PlayerInteractManager { + TileEntity tileentity = this.world.getTileEntity(blockposition); + Block block = iblockdata.getBlock(); -- if (tileentity instanceof TileEntityCommand && entityhuman.isCreativeAndOp()) { -+ if (tileentity instanceof TileEntityCommand && (entityhuman.isCreativeAndOp() || (entityhuman.isCreative() && entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission - entityhuman.a((TileEntityCommand) tileentity); - return EnumInteractionResult.a(world.isClientSide); - } else { -diff --git a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java +- if ((block instanceof BlockCommand || block instanceof BlockStructure || block instanceof BlockJigsaw) && !this.player.isCreativeAndOp()) { ++ if ((block instanceof BlockCommand || block instanceof BlockStructure || block instanceof BlockJigsaw) && !this.player.isCreativeAndOp() && !(block instanceof BlockCommand && (this.player.isCreative() && this.player.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission + this.world.notify(blockposition, iblockdata, iblockdata, 3); + return false; + } else if (this.player.a((World) this.world, blockposition, this.gamemode)) { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -+++ b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -@@ -0,0 +0,0 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { - } - - public EnumInteractionResult a(EntityHuman entityhuman) { -- if (!entityhuman.isCreativeAndOp()) { -+ if (!entityhuman.isCreativeAndOp() && !entityhuman.isCreative() && !entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission - return EnumInteractionResult.PASS; - } else { - if (entityhuman.getWorld().isClientSide) { -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandblock, this, this.player.getWorldServer()); if (!this.minecraftServer.getEnableCommandBlock()) { @@ -52,19 +39,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.player.sendMessage(new ChatMessage("advMode.notAllowed"), SystemUtils.b); } else { CommandBlockListenerAbstract commandblocklistenerabstract = packetplayinsetcommandminecart.a(this.player.world); -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java +diff --git a/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -0,0 +0,0 @@ public class PlayerInteractManager { - TileEntity tileentity = this.world.getTileEntity(blockposition); - Block block = iblockdata.getBlock(); +--- a/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java +@@ -0,0 +0,0 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { + } -- if ((block instanceof BlockCommand || block instanceof BlockStructure || block instanceof BlockJigsaw) && !this.player.isCreativeAndOp()) { -+ if ((block instanceof BlockCommand || block instanceof BlockStructure || block instanceof BlockJigsaw) && !this.player.isCreativeAndOp() && !(block instanceof BlockCommand && (this.player.isCreative() && this.player.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission - this.world.notify(blockposition, iblockdata, iblockdata, 3); - return false; - } else if (this.player.a((World) this.world, blockposition, this.gamemode)) { + public EnumInteractionResult a(EntityHuman entityhuman) { +- if (!entityhuman.isCreativeAndOp()) { ++ if (!entityhuman.isCreativeAndOp() && !entityhuman.isCreative() && !entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission + return EnumInteractionResult.PASS; + } else { + if (entityhuman.getWorld().isClientSide) { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockCommand.java b/src/main/java/net/minecraft/world/level/block/BlockCommand.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockCommand.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockCommand.java +@@ -0,0 +0,0 @@ public class BlockCommand extends BlockTileEntity { + public EnumInteractionResult interact(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) { + TileEntity tileentity = world.getTileEntity(blockposition); + +- if (tileentity instanceof TileEntityCommand && entityhuman.isCreativeAndOp()) { ++ if (tileentity instanceof TileEntityCommand && (entityhuman.isCreativeAndOp() || (entityhuman.isCreative() && entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission + entityhuman.a((TileEntityCommand) tileentity); + return EnumInteractionResult.a(world.isClientSide); + } else { diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java diff --git a/Spigot-Server-Patches/Add-phantom-creative-and-insomniac-controls.patch b/Spigot-Server-Patches/Add-phantom-creative-and-insomniac-controls.patch index acd8ba9011..fe371634ad 100644 --- a/Spigot-Server-Patches/Add-phantom-creative-and-insomniac-controls.patch +++ b/Spigot-Server-Patches/Add-phantom-creative-and-insomniac-controls.patch @@ -20,22 +20,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + phantomOnlyAttackInsomniacs = getBoolean("phantoms-only-attack-insomniacs", phantomOnlyAttackInsomniacs); + } } -diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java +diff --git a/src/main/java/net/minecraft/world/entity/IEntitySelector.java b/src/main/java/net/minecraft/world/entity/IEntitySelector.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - EntityHuman entityhuman = (EntityHuman) iterator.next(); - - if (EntityPhantom.this.a((EntityLiving) entityhuman, PathfinderTargetCondition.a)) { -+ if (!world.paperConfig.phantomOnlyAttackInsomniacs || IEntitySelector.isInsomniac.test(entityhuman)) // Paper - EntityPhantom.this.setGoalTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason - return true; - } -diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IEntitySelector.java -+++ b/src/main/java/net/minecraft/server/IEntitySelector.java +--- a/src/main/java/net/minecraft/world/entity/IEntitySelector.java ++++ b/src/main/java/net/minecraft/world/entity/IEntitySelector.java @@ -0,0 +0,0 @@ public final class IEntitySelector { public static final Predicate<Entity> g = (entity) -> { return !entity.isSpectator(); @@ -44,10 +32,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper start public static final Predicate<Entity> affectsSpawning = (entity) -> { -diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java b/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java +@@ -0,0 +0,0 @@ public class EntityPhantom extends EntityFlying implements IMonster { + EntityHuman entityhuman = (EntityHuman) iterator.next(); + + if (EntityPhantom.this.a((EntityLiving) entityhuman, PathfinderTargetCondition.a)) { ++ if (!world.paperConfig.phantomOnlyAttackInsomniacs || IEntitySelector.isInsomniac.test(entityhuman)) // Paper + EntityPhantom.this.setGoalTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason + return true; + } +diff --git a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java @@ -0,0 +0,0 @@ public class MobSpawnerPhantom implements MobSpawner { while (iterator.hasNext()) { EntityHuman entityhuman = (EntityHuman) iterator.next(); 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 27fcac60eb..d36b1e9f90 100644 --- a/Spigot-Server-Patches/Add-ray-tracing-methods-to-LivingEntity.patch +++ b/Spigot-Server-Patches/Add-ray-tracing-methods-to-LivingEntity.patch @@ -4,10 +4,10 @@ Date: Mon, 3 Sep 2018 18:20:03 -0500 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 +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { this.broadcastItemBreak(enumhand == EnumHand.MAIN_HAND ? EnumItemSlot.MAINHAND : EnumItemSlot.OFFHAND); } diff --git a/Spigot-Server-Patches/Add-recipe-to-cook-events.patch b/Spigot-Server-Patches/Add-recipe-to-cook-events.patch index 0a9dbb3d81..18228f2224 100644 --- a/Spigot-Server-Patches/Add-recipe-to-cook-events.patch +++ b/Spigot-Server-Patches/Add-recipe-to-cook-events.patch @@ -4,10 +4,10 @@ Date: Wed, 6 Jan 2021 12:04:03 -0800 Subject: [PATCH] Add recipe to cook events -diff --git a/src/main/java/net/minecraft/server/TileEntityCampfire.java b/src/main/java/net/minecraft/server/TileEntityCampfire.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityCampfire.java -+++ b/src/main/java/net/minecraft/server/TileEntityCampfire.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java @@ -0,0 +0,0 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickab if (this.cookingTimes[i] >= this.cookingTotalTimes[i]) { @@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.world.getServer().getPluginManager().callEvent(blockCookEvent); if (blockCookEvent.isCancelled()) { -diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityFurnace.java -+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java @@ -0,0 +0,0 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I CraftItemStack source = CraftItemStack.asCraftMirror(itemstack); org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1); diff --git a/Spigot-Server-Patches/Add-sendOpLevel-API.patch b/Spigot-Server-Patches/Add-sendOpLevel-API.patch index a119aec7fc..fd9e335ef8 100644 --- a/Spigot-Server-Patches/Add-sendOpLevel-API.patch +++ b/Spigot-Server-Patches/Add-sendOpLevel-API.patch @@ -4,10 +4,10 @@ Date: Tue, 29 Dec 2020 15:03:03 +0100 Subject: [PATCH] Add sendOpLevel API -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { } diff --git a/Spigot-Server-Patches/Add-setMaxPlayers-API.patch b/Spigot-Server-Patches/Add-setMaxPlayers-API.patch index 5fee1e632e..4feada0071 100644 --- a/Spigot-Server-Patches/Add-setMaxPlayers-API.patch +++ b/Spigot-Server-Patches/Add-setMaxPlayers-API.patch @@ -4,10 +4,10 @@ Date: Sat, 22 Aug 2020 23:59:30 +0200 Subject: [PATCH] Add #setMaxPlayers API -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { public final WorldNBTStorage playerFileData; private boolean hasWhitelist; diff --git a/Spigot-Server-Patches/Add-setPlayerProfile-API-for-Skulls.patch b/Spigot-Server-Patches/Add-setPlayerProfile-API-for-Skulls.patch index 63d4121f24..d38f2172eb 100644 --- a/Spigot-Server-Patches/Add-setPlayerProfile-API-for-Skulls.patch +++ b/Spigot-Server-Patches/Add-setPlayerProfile-API-for-Skulls.patch @@ -51,15 +51,15 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -@@ -0,0 +0,0 @@ import com.google.common.collect.ImmutableMap.Builder; - import com.mojang.authlib.GameProfile; - import java.util.Map; - import java.util.UUID; +@@ -0,0 +0,0 @@ import net.minecraft.nbt.GameProfileSerializer; + import net.minecraft.nbt.NBTBase; + import net.minecraft.nbt.NBTTagCompound; + import net.minecraft.world.level.block.entity.TileEntitySkull; +import com.destroystokyo.paper.profile.CraftPlayerProfile; +import com.destroystokyo.paper.profile.PlayerProfile; - import net.minecraft.server.GameProfileSerializer; - import net.minecraft.server.NBTBase; - import net.minecraft.server.NBTTagCompound; + import org.bukkit.Bukkit; + import org.bukkit.Material; + import org.bukkit.OfflinePlayer; @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.inventory.CraftMetaItem.SerializableMeta; import org.bukkit.craftbukkit.util.CraftMagicNumbers; import org.bukkit.inventory.meta.SkullMeta; @@ -88,3 +88,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public OfflinePlayer getOwningPlayer() { if (hasOwner()) { +@@ -0,0 +0,0 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { + } else { + // Paper start - Use Online Players Skull + GameProfile newProfile = null; +- net.minecraft.server.EntityPlayer player = net.minecraft.server.MinecraftServer.getServer().getPlayerList().getPlayer(name); ++ net.minecraft.server.level.EntityPlayer player = net.minecraft.server.MinecraftServer.getServer().getPlayerList().getPlayer(name); + if (player != null) newProfile = player.getProfile(); + if (newProfile == null) newProfile = new GameProfile(null, name); + setProfile(newProfile); diff --git a/Spigot-Server-Patches/Add-setting-for-proxy-online-mode-status.patch b/Spigot-Server-Patches/Add-setting-for-proxy-online-mode-status.patch index 4063aeb5f8..339e8c01aa 100644 --- a/Spigot-Server-Patches/Add-setting-for-proxy-online-mode-status.patch +++ b/Spigot-Server-Patches/Add-setting-for-proxy-online-mode-status.patch @@ -30,10 +30,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return Bukkit.getOnlineMode() || (SpigotConfig.bungee && bungeeOnlineMode); + } } -diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +diff --git a/src/main/java/net/minecraft/server/players/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/players/NameReferencingFileConverter.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java +--- a/src/main/java/net/minecraft/server/players/NameReferencingFileConverter.java ++++ b/src/main/java/net/minecraft/server/players/NameReferencingFileConverter.java @@ -0,0 +0,0 @@ public class NameReferencingFileConverter { return new String[i]; }); 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 28814afebc..4616deb6e2 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 @@ -8,10 +8,22 @@ If we detect unexpected state, log and try to recover 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 +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + } + } + }; ++ List<Entity> entitySlice = null; + // Paper end + + public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { if (k >= this.entitySlices.length) { k = this.entitySlices.length - 1; @@ -57,15 +69,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!this.entitySlices[i].remove(entity)) { return; } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 - } - } - }; -+ List<Entity> entitySlice = null; - // Paper end - - public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper diff --git a/Spigot-Server-Patches/Add-source-to-PlayerExpChangeEvent.patch b/Spigot-Server-Patches/Add-source-to-PlayerExpChangeEvent.patch index 6a8b4923db..aef0fa1e84 100644 --- a/Spigot-Server-Patches/Add-source-to-PlayerExpChangeEvent.patch +++ b/Spigot-Server-Patches/Add-source-to-PlayerExpChangeEvent.patch @@ -4,10 +4,10 @@ Date: Thu, 8 Sep 2016 08:48:33 -0700 Subject: [PATCH] Add source to PlayerExpChangeEvent -diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java -+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java +--- a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java ++++ b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java @@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity { } diff --git a/Spigot-Server-Patches/Add-sun-related-API.patch b/Spigot-Server-Patches/Add-sun-related-API.patch index ec4f07fb6b..cc41e5cd6a 100644 --- a/Spigot-Server-Patches/Add-sun-related-API.patch +++ b/Spigot-Server-Patches/Add-sun-related-API.patch @@ -4,10 +4,10 @@ Date: Sun, 7 Oct 2018 00:54:21 -0500 Subject: [PATCH] Add sun related API -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { } diff --git a/Spigot-Server-Patches/Add-toggle-for-always-placing-the-dragon-egg.patch b/Spigot-Server-Patches/Add-toggle-for-always-placing-the-dragon-egg.patch index 74450b10c6..d07d9b7771 100644 --- a/Spigot-Server-Patches/Add-toggle-for-always-placing-the-dragon-egg.patch +++ b/Spigot-Server-Patches/Add-toggle-for-always-placing-the-dragon-egg.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + enderDragonsDeathAlwaysPlacesDragonEgg = getBoolean("ender-dragons-death-always-places-dragon-egg", enderDragonsDeathAlwaysPlacesDragonEgg); + } } -diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java +diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EnderDragonBattle.java -+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java +--- a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java ++++ b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java @@ -0,0 +0,0 @@ public class EnderDragonBattle { this.bossBattle.setVisible(false); this.generateExitPortal(true); diff --git a/Spigot-Server-Patches/Add-velocity-warnings.patch b/Spigot-Server-Patches/Add-velocity-warnings.patch index 480c075228..65df38ca0b 100644 --- a/Spigot-Server-Patches/Add-velocity-warnings.patch +++ b/Spigot-Server-Patches/Add-velocity-warnings.patch @@ -68,7 +68,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/spigotmc/WatchdogThread.java @@ -0,0 +0,0 @@ public class WatchdogThread extends Thread log.log( Level.SEVERE, "During the run of the server, a physics stackoverflow was supressed" ); - log.log( Level.SEVERE, "near " + net.minecraft.server.World.lastPhysicsProblem ); + log.log( Level.SEVERE, "near " + net.minecraft.world.level.World.lastPhysicsProblem ); } - // + // Paper start - Warn in watchdog if an excessive velocity was ever set diff --git a/Spigot-Server-Patches/Add-version-history-to-version-command.patch b/Spigot-Server-Patches/Add-version-history-to-version-command.patch index 30dc2771ea..d732dae3c9 100644 --- a/Spigot-Server-Patches/Add-version-history-to-version-command.patch +++ b/Spigot-Server-Patches/Add-version-history-to-version-command.patch @@ -201,10 +201,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } +} -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer return false; } diff --git a/Spigot-Server-Patches/Add-villager-reputation-API.patch b/Spigot-Server-Patches/Add-villager-reputation-API.patch index ff3c135bf2..7257694b40 100644 --- a/Spigot-Server-Patches/Add-villager-reputation-API.patch +++ b/Spigot-Server-Patches/Add-villager-reputation-API.patch @@ -19,23 +19,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return new Reputation(values); + } +} -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java b/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 - this.bD = 0; - } - -+ public Reputation getReputation() { return this.fj(); } // Paper - OBFHELPER - public Reputation fj() { - return this.by; - } -diff --git a/src/main/java/net/minecraft/server/Reputation.java b/src/main/java/net/minecraft/server/Reputation.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Reputation.java -+++ b/src/main/java/net/minecraft/server/Reputation.java -@@ -0,0 +0,0 @@ import java.util.stream.Stream; +--- a/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java ++++ b/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java +@@ -0,0 +0,0 @@ import net.minecraft.core.MinecraftSerializableUUID; public class Reputation { @@ -87,24 +75,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } static class b { +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +@@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation + this.bD = 0; + } + ++ public Reputation getReputation() { return this.fj(); } // Paper - OBFHELPER + public Reputation fj() { + return this.by; + } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.entity; +@@ -0,0 +0,0 @@ import org.bukkit.entity.Villager; + import org.bukkit.entity.Villager.Profession; + import org.bukkit.entity.Villager.Type; -+import com.destroystokyo.paper.entity.villager.Reputation; // Paper - import com.google.common.base.Preconditions; -+import com.google.common.collect.Maps; // Paper - import java.util.Locale; - import net.minecraft.server.BlockBed; - import net.minecraft.server.BlockPosition; -+import java.util.Map; // Paper -+import java.util.UUID; // Paper - import net.minecraft.server.EntityVillager; - import net.minecraft.server.IBlockData; - import net.minecraft.server.IRegistry; ++// Paper start ++import com.destroystokyo.paper.entity.villager.Reputation; ++import com.google.common.collect.Maps; ++import java.util.Map; ++import java.util.UUID; ++// Paper end ++ + public class CraftVillager extends CraftAbstractVillager implements Villager { + + public CraftVillager(CraftServer server, EntityVillager entity) { @@ -0,0 +0,0 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { public static VillagerProfession bukkitToNmsProfession(Profession bukkit) { return IRegistry.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(bukkit.getKey())); diff --git a/Spigot-Server-Patches/Add-worldborder-events.patch b/Spigot-Server-Patches/Add-worldborder-events.patch index 1e788a80f9..42d8eacf1c 100644 --- a/Spigot-Server-Patches/Add-worldborder-events.patch +++ b/Spigot-Server-Patches/Add-worldborder-events.patch @@ -4,14 +4,14 @@ Date: Mon, 4 Jan 2021 22:40:34 -0800 Subject: [PATCH] Add worldborder events -diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java +diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldBorder.java -+++ b/src/main/java/net/minecraft/server/WorldBorder.java -@@ -0,0 +0,0 @@ import com.google.common.collect.Lists; - import com.mojang.serialization.DynamicLike; - import java.util.Iterator; - import java.util.List; +--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java ++++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java +@@ -0,0 +0,0 @@ import net.minecraft.world.phys.AxisAlignedBB; + import net.minecraft.world.phys.shapes.OperatorBoolean; + import net.minecraft.world.phys.shapes.VoxelShape; + import net.minecraft.world.phys.shapes.VoxelShapes; +import io.papermc.paper.event.world.border.WorldBorderBoundsChangeFinishEvent; // Paper +import io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent; // Paper +import io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent; // Paper diff --git a/Spigot-Server-Patches/Add-zombie-targets-turtle-egg-config.patch b/Spigot-Server-Patches/Add-zombie-targets-turtle-egg-config.patch index 7a3636838a..c1e5c0f3da 100644 --- a/Spigot-Server-Patches/Add-zombie-targets-turtle-egg-config.patch +++ b/Spigot-Server-Patches/Add-zombie-targets-turtle-egg-config.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + zombiesTargetTurtleEggs = getBoolean("zombies-target-turtle-eggs", zombiesTargetTurtleEggs); + } } -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { @Override diff --git a/Spigot-Server-Patches/Added-PlayerLecternPageChangeEvent.patch b/Spigot-Server-Patches/Added-PlayerLecternPageChangeEvent.patch index 053e8912e3..c6483f1fa3 100644 --- a/Spigot-Server-Patches/Added-PlayerLecternPageChangeEvent.patch +++ b/Spigot-Server-Patches/Added-PlayerLecternPageChangeEvent.patch @@ -4,10 +4,10 @@ Date: Mon, 23 Nov 2020 12:58:51 -0800 Subject: [PATCH] Added PlayerLecternPageChangeEvent -diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java +diff --git a/src/main/java/net/minecraft/world/inventory/Container.java b/src/main/java/net/minecraft/world/inventory/Container.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Container.java -+++ b/src/main/java/net/minecraft/server/Container.java +--- a/src/main/java/net/minecraft/world/inventory/Container.java ++++ b/src/main/java/net/minecraft/world/inventory/Container.java @@ -0,0 +0,0 @@ public abstract class Container { this.getSlot(i).set(itemstack); } @@ -16,10 +16,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void a(int i, int j) { ((ContainerProperty) this.d.get(i)).set(j); } -diff --git a/src/main/java/net/minecraft/server/ContainerLectern.java b/src/main/java/net/minecraft/server/ContainerLectern.java +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerLectern.java b/src/main/java/net/minecraft/world/inventory/ContainerLectern.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ContainerLectern.java -+++ b/src/main/java/net/minecraft/server/ContainerLectern.java +--- a/src/main/java/net/minecraft/world/inventory/ContainerLectern.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerLectern.java @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryView; import org.bukkit.entity.Player; import org.bukkit.event.player.PlayerTakeLecternBookEvent; diff --git a/Spigot-Server-Patches/Added-PlayerLoomPatternSelectEvent.patch b/Spigot-Server-Patches/Added-PlayerLoomPatternSelectEvent.patch index 116fc7edf9..0a28ecbdd2 100644 --- a/Spigot-Server-Patches/Added-PlayerLoomPatternSelectEvent.patch +++ b/Spigot-Server-Patches/Added-PlayerLoomPatternSelectEvent.patch @@ -4,10 +4,10 @@ Date: Wed, 25 Nov 2020 16:33:27 -0800 Subject: [PATCH] Added PlayerLoomPatternSelectEvent -diff --git a/src/main/java/net/minecraft/server/ContainerLoom.java b/src/main/java/net/minecraft/server/ContainerLoom.java +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerLoom.java b/src/main/java/net/minecraft/world/inventory/ContainerLoom.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ContainerLoom.java -+++ b/src/main/java/net/minecraft/server/ContainerLoom.java +--- a/src/main/java/net/minecraft/world/inventory/ContainerLoom.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerLoom.java @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryLoom; import org.bukkit.craftbukkit.inventory.CraftInventoryView; import org.bukkit.entity.Player; @@ -49,10 +49,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.j(); return true; } else { -diff --git a/src/main/java/net/minecraft/server/EnumBannerPatternType.java b/src/main/java/net/minecraft/server/EnumBannerPatternType.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/EnumBannerPatternType.java b/src/main/java/net/minecraft/world/level/block/entity/EnumBannerPatternType.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EnumBannerPatternType.java -+++ b/src/main/java/net/minecraft/server/EnumBannerPatternType.java +--- a/src/main/java/net/minecraft/world/level/block/entity/EnumBannerPatternType.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/EnumBannerPatternType.java @@ -0,0 +0,0 @@ public enum EnumBannerPatternType { this.T = flag; } diff --git a/Spigot-Server-Patches/Added-PlayerStonecutterRecipeSelectEvent.patch b/Spigot-Server-Patches/Added-PlayerStonecutterRecipeSelectEvent.patch index ea5fea46e1..0adfa6d6c5 100644 --- a/Spigot-Server-Patches/Added-PlayerStonecutterRecipeSelectEvent.patch +++ b/Spigot-Server-Patches/Added-PlayerStonecutterRecipeSelectEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Added PlayerStonecutterRecipeSelectEvent Co-Authored-By: MiniDigger | Martin <admin@minidigger.dev> -diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java +diff --git a/src/main/java/net/minecraft/world/inventory/Container.java b/src/main/java/net/minecraft/world/inventory/Container.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Container.java -+++ b/src/main/java/net/minecraft/server/Container.java +--- a/src/main/java/net/minecraft/world/inventory/Container.java ++++ b/src/main/java/net/minecraft/world/inventory/Container.java @@ -0,0 +0,0 @@ public abstract class Container { return slot; } @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.d.add(containerproperty); return containerproperty; } -diff --git a/src/main/java/net/minecraft/server/ContainerProperty.java b/src/main/java/net/minecraft/server/ContainerProperty.java +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerProperty.java b/src/main/java/net/minecraft/world/inventory/ContainerProperty.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ContainerProperty.java -+++ b/src/main/java/net/minecraft/server/ContainerProperty.java +--- a/src/main/java/net/minecraft/world/inventory/ContainerProperty.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerProperty.java @@ -0,0 +0,0 @@ public abstract class ContainerProperty { }; } @@ -40,10 +40,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int i = this.get(); boolean flag = i != this.a; -diff --git a/src/main/java/net/minecraft/server/ContainerStonecutter.java b/src/main/java/net/minecraft/server/ContainerStonecutter.java +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerStonecutter.java b/src/main/java/net/minecraft/world/inventory/ContainerStonecutter.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ContainerStonecutter.java -+++ b/src/main/java/net/minecraft/server/ContainerStonecutter.java +--- a/src/main/java/net/minecraft/world/inventory/ContainerStonecutter.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerStonecutter.java @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryStonecutter; import org.bukkit.craftbukkit.inventory.CraftInventoryView; import org.bukkit.entity.Player; diff --git a/Spigot-Server-Patches/Added-ServerResourcesReloadedEvent.patch b/Spigot-Server-Patches/Added-ServerResourcesReloadedEvent.patch index 762923dc97..5c979fa7d8 100644 --- a/Spigot-Server-Patches/Added-ServerResourcesReloadedEvent.patch +++ b/Spigot-Server-Patches/Added-ServerResourcesReloadedEvent.patch @@ -4,35 +4,6 @@ Date: Wed, 2 Dec 2020 20:04:01 -0800 Subject: [PATCH] Added ServerResourcesReloadedEvent -diff --git a/src/main/java/net/minecraft/server/CommandReload.java b/src/main/java/net/minecraft/server/CommandReload.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CommandReload.java -+++ b/src/main/java/net/minecraft/server/CommandReload.java -@@ -0,0 +0,0 @@ import java.util.Collection; - import java.util.Iterator; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -+import io.papermc.paper.event.server.ServerResourcesReloadedEvent; // Paper - - public class CommandReload { - - private static final Logger LOGGER = LogManager.getLogger(); - - public static void a(Collection<String> collection, CommandListenerWrapper commandlistenerwrapper) { -- commandlistenerwrapper.getServer().a(collection).exceptionally((throwable) -> { -+ commandlistenerwrapper.getServer().reloadServerResources(collection, ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally((throwable) -> { // Paper - CommandReload.LOGGER.warn("Failed to execute reload", throwable); - commandlistenerwrapper.sendFailureMessage(new ChatMessage("commands.reload.failure")); - return null; -@@ -0,0 +0,0 @@ public class CommandReload { - SaveData savedata = minecraftserver.getSaveData(); - Collection<String> collection = resourcepackrepository.d(); - Collection<String> collection1 = a(resourcepackrepository, savedata, collection); -- minecraftserver.a(collection1); -+ minecraftserver.reloadServerResources(collection1, ServerResourcesReloadedEvent.Cause.PLUGIN); // Paper - } - // CraftBukkit end - diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -47,16 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -@@ -0,0 +0,0 @@ import com.mojang.serialization.Lifecycle; - import com.google.common.collect.ImmutableSet; - // import jline.console.ConsoleReader; // Paper - import joptsimple.OptionSet; --import org.bukkit.Bukkit; --import org.bukkit.craftbukkit.CraftServer; --import org.bukkit.craftbukkit.Main; - import org.bukkit.event.server.ServerLoadEvent; - // CraftBukkit end - +@@ -0,0 +0,0 @@ import org.bukkit.event.server.ServerLoadEvent; import co.aikar.timings.MinecraftTimings; // Paper import org.spigotmc.SlackActivityAccountant; // Spigot import io.papermc.paper.util.PaperJvmChecker; // Paper @@ -86,3 +48,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (Thread.currentThread() != this.serverThread) return; // Paper //this.getPlayerList().savePlayers(); // Paper - we don't need to do this this.getPlayerList().reload(); +diff --git a/src/main/java/net/minecraft/server/commands/CommandReload.java b/src/main/java/net/minecraft/server/commands/CommandReload.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/commands/CommandReload.java ++++ b/src/main/java/net/minecraft/server/commands/CommandReload.java +@@ -0,0 +0,0 @@ import net.minecraft.server.packs.repository.ResourcePackRepository; + import net.minecraft.world.level.storage.SaveData; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; ++import io.papermc.paper.event.server.ServerResourcesReloadedEvent; // Paper + + public class CommandReload { + + private static final Logger LOGGER = LogManager.getLogger(); + + public static void a(Collection<String> collection, CommandListenerWrapper commandlistenerwrapper) { +- commandlistenerwrapper.getServer().a(collection).exceptionally((throwable) -> { ++ commandlistenerwrapper.getServer().reloadServerResources(collection, ServerResourcesReloadedEvent.Cause.COMMAND).exceptionally((throwable) -> { // Paper + CommandReload.LOGGER.warn("Failed to execute reload", throwable); + commandlistenerwrapper.sendFailureMessage(new ChatMessage("commands.reload.failure")); + return null; +@@ -0,0 +0,0 @@ public class CommandReload { + SaveData savedata = minecraftserver.getSaveData(); + Collection<String> collection = resourcepackrepository.d(); + Collection<String> collection1 = a(resourcepackrepository, savedata, collection); +- minecraftserver.a(collection1); ++ minecraftserver.reloadServerResources(collection1, ServerResourcesReloadedEvent.Cause.PLUGIN); // Paper + } + // CraftBukkit end + diff --git a/Spigot-Server-Patches/Added-Vanilla-Entity-Tags.patch b/Spigot-Server-Patches/Added-Vanilla-Entity-Tags.patch index 63472fd090..65f5f03299 100644 --- a/Spigot-Server-Patches/Added-Vanilla-Entity-Tags.patch +++ b/Spigot-Server-Patches/Added-Vanilla-Entity-Tags.patch @@ -12,10 +12,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package io.papermc.paper; + -+import net.minecraft.server.Entity; -+import net.minecraft.server.EntityTypes; -+import net.minecraft.server.MinecraftKey; -+import net.minecraft.server.Tags; ++import net.minecraft.resources.MinecraftKey; ++import net.minecraft.tags.Tags; ++import net.minecraft.world.entity.EntityTypes; +import org.bukkit.craftbukkit.tag.CraftTag; +import org.bukkit.craftbukkit.util.CraftMagicNumbers; +import org.bukkit.entity.EntityType; @@ -65,14 +64,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private static final Map<Material, Block> MATERIAL_BLOCK = new HashMap<>(); private static final Map<Material, FluidType> MATERIAL_FLUID = new HashMap<>(); + // Paper start -+ private static final Map<org.bukkit.entity.EntityType, net.minecraft.server.EntityTypes<?>> ENTITY_TYPE_ENTITY_TYPES = new HashMap<>(); -+ private static final Map<net.minecraft.server.EntityTypes<?>, org.bukkit.entity.EntityType> ENTITY_TYPES_ENTITY_TYPE = new HashMap<>(); ++ private static final Map<org.bukkit.entity.EntityType, net.minecraft.world.entity.EntityTypes<?>> ENTITY_TYPE_ENTITY_TYPES = new HashMap<>(); ++ private static final Map<net.minecraft.world.entity.EntityTypes<?>, org.bukkit.entity.EntityType> ENTITY_TYPES_ENTITY_TYPE = new HashMap<>(); static { + for (org.bukkit.entity.EntityType type : org.bukkit.entity.EntityType.values()) { + if (type == org.bukkit.entity.EntityType.UNKNOWN) continue; -+ ENTITY_TYPE_ENTITY_TYPES.put(type, net.minecraft.server.IRegistry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey()))); -+ ENTITY_TYPES_ENTITY_TYPE.put(net.minecraft.server.IRegistry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey())), type); ++ ENTITY_TYPE_ENTITY_TYPES.put(type, IRegistry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey()))); ++ ENTITY_TYPES_ENTITY_TYPE.put(IRegistry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey())), type); + } + // Paper end for (Block block : IRegistry.BLOCK) { @@ -83,10 +82,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return CraftNamespacedKey.toMinecraft(mat.getKey()); } + // Paper start -+ public static net.minecraft.server.EntityTypes<?> getEntityTypes(org.bukkit.entity.EntityType type) { ++ public static net.minecraft.world.entity.EntityTypes<?> getEntityTypes(org.bukkit.entity.EntityType type) { + return ENTITY_TYPE_ENTITY_TYPES.get(type); + } -+ public static org.bukkit.entity.EntityType getEntityType(net.minecraft.server.EntityTypes<?> entityTypes) { ++ public static org.bukkit.entity.EntityType getEntityType(net.minecraft.world.entity.EntityTypes<?> entityTypes) { + return ENTITY_TYPES_ENTITY_TYPE.get(entityTypes); + } + // Paper end diff --git a/Spigot-Server-Patches/Added-WorldGameRuleChangeEvent.patch b/Spigot-Server-Patches/Added-WorldGameRuleChangeEvent.patch index 3edf41d241..f2ee830b76 100644 --- a/Spigot-Server-Patches/Added-WorldGameRuleChangeEvent.patch +++ b/Spigot-Server-Patches/Added-WorldGameRuleChangeEvent.patch @@ -4,10 +4,10 @@ Date: Sun, 20 Dec 2020 16:41:44 -0800 Subject: [PATCH] Added WorldGameRuleChangeEvent -diff --git a/src/main/java/net/minecraft/server/CommandGamerule.java b/src/main/java/net/minecraft/server/CommandGamerule.java +diff --git a/src/main/java/net/minecraft/server/commands/CommandGamerule.java b/src/main/java/net/minecraft/server/commands/CommandGamerule.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CommandGamerule.java -+++ b/src/main/java/net/minecraft/server/CommandGamerule.java +--- a/src/main/java/net/minecraft/server/commands/CommandGamerule.java ++++ b/src/main/java/net/minecraft/server/commands/CommandGamerule.java @@ -0,0 +0,0 @@ public class CommandGamerule { CommandListenerWrapper commandlistenerwrapper = (CommandListenerWrapper) commandcontext.getSource(); T t0 = commandlistenerwrapper.getWorld().getGameRules().get(gamerules_gamerulekey); // CraftBukkit @@ -17,12 +17,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.set", new Object[]{gamerules_gamerulekey.a(), t0.toString()}), true); return t0.getIntValue(); } -diff --git a/src/main/java/net/minecraft/server/GameRules.java b/src/main/java/net/minecraft/server/GameRules.java +diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/GameRules.java -+++ b/src/main/java/net/minecraft/server/GameRules.java -@@ -0,0 +0,0 @@ import java.util.function.Supplier; - import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/level/GameRules.java ++++ b/src/main/java/net/minecraft/world/level/GameRules.java +@@ -0,0 +0,0 @@ import net.minecraft.server.MinecraftServer; + import net.minecraft.server.level.EntityPlayer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import io.papermc.paper.event.world.WorldGameRuleChangeEvent; // Paper diff --git a/Spigot-Server-Patches/Added-firing-of-PlayerChangeBeaconEffectEvent.patch b/Spigot-Server-Patches/Added-firing-of-PlayerChangeBeaconEffectEvent.patch index 4bf2caa580..586d57f720 100644 --- a/Spigot-Server-Patches/Added-firing-of-PlayerChangeBeaconEffectEvent.patch +++ b/Spigot-Server-Patches/Added-firing-of-PlayerChangeBeaconEffectEvent.patch @@ -4,20 +4,21 @@ Date: Wed, 24 Jun 2020 15:14:51 -0600 Subject: [PATCH] Added firing of PlayerChangeBeaconEffectEvent -diff --git a/src/main/java/net/minecraft/server/ContainerBeacon.java b/src/main/java/net/minecraft/server/ContainerBeacon.java +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerBeacon.java b/src/main/java/net/minecraft/world/inventory/ContainerBeacon.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ContainerBeacon.java -+++ b/src/main/java/net/minecraft/server/ContainerBeacon.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; +--- a/src/main/java/net/minecraft/world/inventory/ContainerBeacon.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerBeacon.java +@@ -0,0 +0,0 @@ import net.minecraft.world.entity.player.PlayerInventory; + import org.bukkit.craftbukkit.inventory.CraftInventoryView; + // CraftBukkit end - import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit +// Paper start +import io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent; +// Paper end - ++ public class ContainerBeacon extends Container { + private final IInventory beacon; @@ -0,0 +0,0 @@ public class ContainerBeacon extends Container { public void c(int i, int j) { diff --git a/Spigot-Server-Patches/Added-world-settings-for-mobs-picking-up-loot.patch b/Spigot-Server-Patches/Added-world-settings-for-mobs-picking-up-loot.patch index ad02d14ce4..d5f02bcb45 100644 --- a/Spigot-Server-Patches/Added-world-settings-for-mobs-picking-up-loot.patch +++ b/Spigot-Server-Patches/Added-world-settings-for-mobs-picking-up-loot.patch @@ -23,10 +23,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public int expMergeMaxValue; private void expMergeMaxValue() { expMergeMaxValue = getInt("experience-merge-max-value", -1); -diff --git a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java -+++ b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java @@ -0,0 +0,0 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR this.a(difficultydamagescaler); this.b(difficultydamagescaler); @@ -36,10 +36,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.getEquipment(EnumItemSlot.HEAD).isEmpty()) { LocalDate localdate = LocalDate.now(); int i = localdate.get(ChronoField.DAY_OF_MONTH); -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { Object object = super.prepare(worldaccess, difficultydamagescaler, enummobspawn, groupdataentity, nbttagcompound); float f = difficultydamagescaler.d(); diff --git a/Spigot-Server-Patches/Adventure.patch b/Spigot-Server-Patches/Adventure.patch index 2e08077092..309548fd0d 100644 --- a/Spigot-Server-Patches/Adventure.patch +++ b/Spigot-Server-Patches/Adventure.patch @@ -36,9 +36,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer; -+import net.minecraft.server.ChatModifier; -+import net.minecraft.server.IChatBaseComponent; -+import net.minecraft.server.IChatMutableComponent; ++import net.minecraft.network.chat.ChatModifier; ++import net.minecraft.network.chat.IChatBaseComponent; ++import net.minecraft.network.chat.IChatMutableComponent; +import org.checkerframework.checker.nullness.qual.MonotonicNonNull; +import org.checkerframework.checker.nullness.qual.Nullable; + @@ -123,9 +123,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextReplacementConfig; +import net.kyori.adventure.text.event.ClickEvent; -+import net.minecraft.server.EntityPlayer; -+import net.minecraft.server.IChatBaseComponent; ++import net.kyori.adventure.text.format.Style; ++import net.kyori.adventure.text.format.TextDecoration; ++import net.minecraft.network.chat.IChatBaseComponent; +import net.minecraft.server.MinecraftServer; ++import net.minecraft.server.level.EntityPlayer; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.entity.CraftPlayer; +import org.bukkit.craftbukkit.util.LazyPlayerSet; @@ -329,7 +331,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package io.papermc.paper.adventure; + -+import net.minecraft.server.EntityPlayer; ++import net.minecraft.server.level.EntityPlayer; +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.entity.CraftPlayer; + @@ -367,9 +369,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.kyori.adventure.text.serializer.gson.LegacyHoverEventSerializer; +import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer; +import net.kyori.adventure.util.Codec; -+import net.minecraft.server.MojangsonParser; -+import net.minecraft.server.NBTBase; -+import net.minecraft.server.NBTTagCompound; ++import net.minecraft.nbt.MojangsonParser; ++import net.minecraft.nbt.NBTBase; ++import net.minecraft.nbt.NBTTagCompound; + +final class NBTLegacyHoverEventSerializer implements LegacyHoverEventSerializer { + public static final NBTLegacyHoverEventSerializer INSTANCE = new NBTLegacyHoverEventSerializer(); @@ -473,17 +475,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer; +import net.kyori.adventure.translation.GlobalTranslator; +import net.kyori.adventure.util.Codec; -+import net.minecraft.server.BossBattle; -+import net.minecraft.server.EnumChatFormat; -+import net.minecraft.server.IChatBaseComponent; -+import net.minecraft.server.ItemStack; -+import net.minecraft.server.LocaleLanguage; -+import net.minecraft.server.MinecraftKey; -+import net.minecraft.server.MojangsonParser; -+import net.minecraft.server.NBTTagCompound; -+import net.minecraft.server.NBTTagList; -+import net.minecraft.server.NBTTagString; -+import net.minecraft.server.SoundCategory; ++import net.minecraft.EnumChatFormat; ++import net.minecraft.locale.LocaleLanguage; ++import net.minecraft.nbt.MojangsonParser; ++import net.minecraft.nbt.NBTTagCompound; ++import net.minecraft.nbt.NBTTagList; ++import net.minecraft.nbt.NBTTagString; ++import net.minecraft.network.chat.IChatBaseComponent; ++import net.minecraft.resources.MinecraftKey; ++import net.minecraft.sounds.SoundCategory; ++import net.minecraft.world.BossBattle; ++import net.minecraft.world.item.ItemStack; +import org.bukkit.ChatColor; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; @@ -717,7 +719,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Book + + public static ItemStack asItemStack(final Book book, final Locale locale) { -+ final ItemStack item = new ItemStack(net.minecraft.server.Items.WRITTEN_BOOK, 1); ++ final ItemStack item = new ItemStack(net.minecraft.world.item.Items.WRITTEN_BOOK, 1); + final NBTTagCompound tag = item.getOrCreateTag(); + tag.setString("title", asJsonString(book.title(), locale)); + tag.setString("author", asJsonString(book.author(), locale)); @@ -801,7 +803,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import java.util.function.Consumer; +import net.kyori.adventure.bossbar.BossBar; +import net.kyori.adventure.text.Component; -+import net.minecraft.server.PacketPlayOutBoss; ++import net.minecraft.network.protocol.game.PacketPlayOutBoss; +import org.checkerframework.checker.nullness.qual.NonNull; + +public final class VanillaBossBarListener implements BossBar.Listener { @@ -846,7 +848,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.serializer.ComponentSerializer; -+import net.minecraft.server.IChatBaseComponent; ++import net.minecraft.network.chat.IChatBaseComponent; + +final class WrapperAwareSerializer implements ComponentSerializer<Component, Component, IChatBaseComponent> { + @Override @@ -872,7 +874,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import io.papermc.paper.adventure.PaperAdventure; +import io.papermc.paper.adventure.VanillaBossBarListener; -+import net.minecraft.server.BossBattleServer; ++import net.minecraft.server.level.BossBattleServer; +import org.bukkit.craftbukkit.entity.CraftPlayer; + +public abstract class HackyBossBarPlatformBridge { @@ -904,121 +906,239 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } +} -diff --git a/src/main/java/net/minecraft/server/BossBattle.java b/src/main/java/net/minecraft/server/BossBattle.java +diff --git a/src/main/java/net/minecraft/EnumChatFormat.java b/src/main/java/net/minecraft/EnumChatFormat.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BossBattle.java -+++ b/src/main/java/net/minecraft/server/BossBattle.java +--- a/src/main/java/net/minecraft/EnumChatFormat.java ++++ b/src/main/java/net/minecraft/EnumChatFormat.java +@@ -0,0 +0,0 @@ public enum EnumChatFormat { + return !this.A && this != EnumChatFormat.RESET; + } + ++ @Nullable public Integer getHexValue() { return this.e(); } // Paper - OBFHELPER + @Nullable + public Integer e() { + return this.D; +@@ -0,0 +0,0 @@ public enum EnumChatFormat { + return s == null ? null : (EnumChatFormat) EnumChatFormat.w.get(c(s)); + } + ++ // Paper start ++ @Nullable public static EnumChatFormat getByHexValue(int i) { ++ for (EnumChatFormat value : values()) { ++ if (value.getHexValue() != null && value.getHexValue() == i) { ++ return value; ++ } ++ } ++ ++ return null; ++ } ++ // Paper end ++ + @Nullable + public static EnumChatFormat a(int i) { + if (i < 0) { +diff --git a/src/main/java/net/minecraft/nbt/NBTTagString.java b/src/main/java/net/minecraft/nbt/NBTTagString.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/nbt/NBTTagString.java ++++ b/src/main/java/net/minecraft/nbt/NBTTagString.java +@@ -0,0 +0,0 @@ public class NBTTagString implements NBTBase { + this.data = s; + } + ++ public static NBTTagString create(final String value) { return a(value); } // Paper - OBFHELPER + public static NBTTagString a(String s) { + return s.isEmpty() ? NBTTagString.b : new NBTTagString(s); + } +diff --git a/src/main/java/net/minecraft/network/PacketDataSerializer.java b/src/main/java/net/minecraft/network/PacketDataSerializer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/PacketDataSerializer.java ++++ b/src/main/java/net/minecraft/network/PacketDataSerializer.java +@@ -0,0 +0,0 @@ import io.netty.buffer.ByteBufOutputStream; + import io.netty.handler.codec.DecoderException; + import io.netty.handler.codec.EncoderException; + import io.netty.util.ByteProcessor; ++import io.papermc.paper.adventure.PaperAdventure; // Paper + import java.io.DataInput; + import java.io.DataOutput; + import java.io.IOException; +@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit + public class PacketDataSerializer extends ByteBuf { + + private final ByteBuf a; ++ public java.util.Locale adventure$locale; // Paper + + public PacketDataSerializer(ByteBuf bytebuf) { + this.a = bytebuf; +@@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { + return IChatBaseComponent.ChatSerializer.a(this.e(262144)); + } + ++ // Paper start ++ public PacketDataSerializer writeComponent(final net.kyori.adventure.text.Component component) { ++ return this.writeUtf(PaperAdventure.asJsonString(component, this.adventure$locale), 262144); ++ } ++ // Paper end ++ + public PacketDataSerializer a(IChatBaseComponent ichatbasecomponent) { +- return this.a(IChatBaseComponent.ChatSerializer.a(ichatbasecomponent), 262144); ++ //return this.a(IChatBaseComponent.ChatSerializer.a(ichatbasecomponent), 262144); // Paper - comment ++ return this.writeUtf(PaperAdventure.asJsonString(ichatbasecomponent, this.adventure$locale), 262144); // Paper + } + + public <T extends Enum<T>> T a(Class<T> oclass) { +@@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { + return this.a(s, 32767); + } + ++ public PacketDataSerializer writeUtf(final String string, final int maxLength) { return this.a(string, maxLength); } // Paper - OBFHELPER + public PacketDataSerializer a(String s, int i) { + byte[] abyte = s.getBytes(StandardCharsets.UTF_8); + +diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/PacketEncoder.java ++++ b/src/main/java/net/minecraft/network/PacketEncoder.java +@@ -0,0 +0,0 @@ package net.minecraft.network; + import io.netty.buffer.ByteBuf; + import io.netty.channel.ChannelHandlerContext; + import io.netty.handler.codec.MessageToByteEncoder; ++import io.papermc.paper.adventure.PaperAdventure; // Paper + import java.io.IOException; + import net.minecraft.network.protocol.EnumProtocolDirection; + import net.minecraft.network.protocol.Packet; +@@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { + throw new IOException("Can't serialize unregistered packet"); + } else { + PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf); ++ packetdataserializer.adventure$locale = channelhandlercontext.channel().attr(PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper + + packetdataserializer.d(integer); + +diff --git a/src/main/java/net/minecraft/network/chat/IChatBaseComponent.java b/src/main/java/net/minecraft/network/chat/IChatBaseComponent.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/chat/IChatBaseComponent.java ++++ b/src/main/java/net/minecraft/network/chat/IChatBaseComponent.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.network.chat; -+import io.papermc.paper.adventure.PaperAdventure; - import java.util.UUID; ++import io.papermc.paper.adventure.AdventureComponent; // Paper + import com.google.gson.Gson; + import com.google.gson.GsonBuilder; + import com.google.gson.JsonArray; +@@ -0,0 +0,0 @@ public interface IChatBaseComponent extends Message, IChatFormatted, Iterable<IC + GsonBuilder gsonbuilder = new GsonBuilder(); - public abstract class BossBattle { -@@ -0,0 +0,0 @@ public abstract class BossBattle { - protected boolean e; - protected boolean f; - protected boolean g; -+ public net.kyori.adventure.bossbar.BossBar adventure; // Paper + gsonbuilder.disableHtmlEscaping(); ++ gsonbuilder.registerTypeAdapter(AdventureComponent.class, new AdventureComponent.Serializer()); // Paper + gsonbuilder.registerTypeHierarchyAdapter(IChatBaseComponent.class, new IChatBaseComponent.ChatSerializer()); + gsonbuilder.registerTypeHierarchyAdapter(ChatModifier.class, new ChatModifier.ChatModifierSerializer()); + gsonbuilder.registerTypeAdapterFactory(new ChatTypeAdapterFactory()); +@@ -0,0 +0,0 @@ public interface IChatBaseComponent extends Message, IChatFormatted, Iterable<IC + return jsonobject; + } - public BossBattle(UUID uuid, IChatBaseComponent ichatbasecomponent, BossBattle.BarColor bossbattle_barcolor, BossBattle.BarStyle bossbattle_barstyle) { - this.h = uuid; -@@ -0,0 +0,0 @@ public abstract class BossBattle { - } ++ public static String componentToJson(final IChatBaseComponent component) { return a(component); } // Paper - OBFHELPER + public static String a(IChatBaseComponent ichatbasecomponent) { + return IChatBaseComponent.ChatSerializer.a.toJson(ichatbasecomponent); + } - public IChatBaseComponent j() { -+ if(this.adventure != null) return PaperAdventure.asVanilla(this.adventure.name()); // Paper - return this.title; - } ++ public static JsonElement toJsonTree(final IChatBaseComponent component) { return b(component); } // Paper - OBFHELPER + public static JsonElement b(IChatBaseComponent ichatbasecomponent) { + return IChatBaseComponent.ChatSerializer.a.toJsonTree(ichatbasecomponent); + } +@@ -0,0 +0,0 @@ public interface IChatBaseComponent extends Message, IChatFormatted, Iterable<IC + return (IChatMutableComponent) ChatDeserializer.a(IChatBaseComponent.ChatSerializer.a, s, IChatMutableComponent.class, false); + } - public void a(IChatBaseComponent ichatbasecomponent) { -+ if (this.adventure != null) this.adventure.name(PaperAdventure.asAdventure(ichatbasecomponent)); // Paper - this.title = ichatbasecomponent; - } - - public float getProgress() { -+ if (this.adventure != null) return this.adventure.progress(); // Paper - return this.b; - } - - public void a(float f) { -+ if (this.adventure != null) this.adventure.progress(f); // Paper - this.b = f; - } - - public BossBattle.BarColor l() { -+ if (this.adventure != null) return PaperAdventure.asVanilla(this.adventure.color()); // Paper - return this.color; - } - - public void a(BossBattle.BarColor bossbattle_barcolor) { -+ if(this.adventure != null) this.adventure.color(PaperAdventure.asAdventure(bossbattle_barcolor)); // Paper - this.color = bossbattle_barcolor; - } - - public BossBattle.BarStyle m() { -+ if(this.adventure != null) return PaperAdventure.asVanilla(this.adventure.overlay()); // Paper - return this.style; - } - - public void a(BossBattle.BarStyle bossbattle_barstyle) { -+ if(this.adventure != null) this.adventure.overlay(PaperAdventure.asAdventure(bossbattle_barstyle)); // Paper - this.style = bossbattle_barstyle; - } - - public boolean isDarkenSky() { -+ if(this.adventure != null) return this.adventure.hasFlag(net.kyori.adventure.bossbar.BossBar.Flag.DARKEN_SCREEN); // Paper - return this.e; - } - - public BossBattle a(boolean flag) { -+ if(this.adventure != null) PaperAdventure.setFlag(this.adventure, net.kyori.adventure.bossbar.BossBar.Flag.DARKEN_SCREEN, flag); // Paper - this.e = flag; - return this; - } - - public boolean isPlayMusic() { -+ if(this.adventure != null) return this.adventure.hasFlag(net.kyori.adventure.bossbar.BossBar.Flag.PLAY_BOSS_MUSIC); // Paper - return this.f; - } - - public BossBattle b(boolean flag) { -+ if(this.adventure != null) PaperAdventure.setFlag(this.adventure, net.kyori.adventure.bossbar.BossBar.Flag.PLAY_BOSS_MUSIC, flag); // Paper - this.f = flag; - return this; - } - - public BossBattle c(boolean flag) { -+ if(this.adventure != null) PaperAdventure.setFlag(this.adventure, net.kyori.adventure.bossbar.BossBar.Flag.CREATE_WORLD_FOG, flag); // Paper - this.g = flag; - return this; - } - - public boolean isCreateFog() { -+ if(this.adventure != null) return this.adventure.hasFlag(net.kyori.adventure.bossbar.BossBar.Flag.CREATE_WORLD_FOG); // Paper - return this.g; - } - -diff --git a/src/main/java/net/minecraft/server/Enchantment.java b/src/main/java/net/minecraft/server/Enchantment.java ++ public static @Nullable IChatBaseComponent fromJsonTree(final JsonElement json) { return a(json); } // Paper - OBFHELPER + @Nullable + public static IChatMutableComponent a(JsonElement jsonelement) { + return (IChatMutableComponent) IChatBaseComponent.ChatSerializer.a.fromJson(jsonelement, IChatMutableComponent.class); +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Enchantment.java -+++ b/src/main/java/net/minecraft/server/Enchantment.java -@@ -0,0 +0,0 @@ public abstract class Enchantment { - return this.f(); - } +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java +@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.Packet; + public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> { -+ public final IChatBaseComponent getTranslationComponentForLevel(int level) { return this.d(level); } // Paper - OBFHELPER - public IChatBaseComponent d(int i) { - ChatMessage chatmessage = new ChatMessage(this.g()); + private IChatBaseComponent a; ++ public net.kyori.adventure.text.Component adventure$message; // Paper + public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot + private ChatMessageType b; + private UUID c; +@@ -0,0 +0,0 @@ public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> { -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java + @Override + public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ // Paper start ++ if (this.adventure$message != null) { ++ packetdataserializer.writeComponent(this.adventure$message); ++ } else ++ // Paper end + // Spigot start + if (components != null) { + packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components)); +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutPlayerListHeaderFooter.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutPlayerListHeaderFooter.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutPlayerListHeaderFooter.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutPlayerListHeaderFooter.java +@@ -0,0 +0,0 @@ public class PacketPlayOutPlayerListHeaderFooter implements Packet<PacketListene - // CraftBukkit start + public IChatBaseComponent header; + public IChatBaseComponent footer; ++ // Paper start ++ public net.kyori.adventure.text.Component adventure$header; ++ public net.kyori.adventure.text.Component adventure$footer; ++ // Paper end + + public PacketPlayOutPlayerListHeaderFooter() {} + +@@ -0,0 +0,0 @@ public class PacketPlayOutPlayerListHeaderFooter implements Packet<PacketListene + + @Override + public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ // Paper start ++ if (this.adventure$header != null && this.adventure$footer != null) { ++ packetdataserializer.writeComponent(this.adventure$header); ++ packetdataserializer.writeComponent(this.adventure$footer); ++ return; ++ } ++ // Paper end + packetdataserializer.a(this.header); + packetdataserializer.a(this.footer); + } +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutTitle.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutTitle.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutTitle.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutTitle.java +@@ -0,0 +0,0 @@ public class PacketPlayOutTitle implements Packet<PacketListenerPlayOut> { + + private PacketPlayOutTitle.EnumTitleAction a; + private IChatBaseComponent b; ++ public net.kyori.adventure.text.Component adventure$text; // Paper + private int c; + private int d; + private int e; +@@ -0,0 +0,0 @@ public class PacketPlayOutTitle implements Packet<PacketListenerPlayOut> { + public void b(PacketDataSerializer packetdataserializer) throws IOException { + packetdataserializer.a((Enum) this.a); + if (this.a == PacketPlayOutTitle.EnumTitleAction.TITLE || this.a == PacketPlayOutTitle.EnumTitleAction.SUBTITLE || this.a == PacketPlayOutTitle.EnumTitleAction.ACTIONBAR) { ++ // Paper start ++ if (this.adventure$text != null) { ++ packetdataserializer.writeComponent(this.adventure$text); ++ } else ++ // Paper end + packetdataserializer.a(this.b); + } + +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -0,0 +0,0 @@ import net.minecraft.world.item.enchantment.EnchantmentManager; + import net.minecraft.world.level.block.BlockChest; + import net.minecraft.world.level.dimension.DimensionManager; + import net.minecraft.world.scores.Scoreboard; +import io.papermc.paper.adventure.PaperAdventure; // Paper import org.bukkit.Bukkit; import org.bukkit.GameMode; @@ -1086,85 +1206,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.clientViewDistance = packetplayinsettings.viewDistance; // CraftBukkit end this.bY = packetplayinsettings.d(); -diff --git a/src/main/java/net/minecraft/server/EnumChatFormat.java b/src/main/java/net/minecraft/server/EnumChatFormat.java +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EnumChatFormat.java -+++ b/src/main/java/net/minecraft/server/EnumChatFormat.java -@@ -0,0 +0,0 @@ public enum EnumChatFormat { - return !this.A && this != EnumChatFormat.RESET; - } - -+ @Nullable public Integer getHexValue() { return this.e(); } // Paper - OBFHELPER - @Nullable - public Integer e() { - return this.D; -@@ -0,0 +0,0 @@ public enum EnumChatFormat { - return s == null ? null : (EnumChatFormat) EnumChatFormat.w.get(c(s)); - } - -+ // Paper start -+ @Nullable public static EnumChatFormat getByHexValue(int i) { -+ for (EnumChatFormat value : values()) { -+ if (value.getHexValue() != null && value.getHexValue() == i) { -+ return value; -+ } -+ } -+ -+ return null; -+ } -+ // Paper end -+ - @Nullable - public static EnumChatFormat a(int i) { - if (i < 0) { -diff --git a/src/main/java/net/minecraft/server/IChatBaseComponent.java b/src/main/java/net/minecraft/server/IChatBaseComponent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IChatBaseComponent.java -+++ b/src/main/java/net/minecraft/server/IChatBaseComponent.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - -+import io.papermc.paper.adventure.AdventureComponent; // Paper - import com.google.gson.Gson; - import com.google.gson.GsonBuilder; - import com.google.gson.JsonArray; -@@ -0,0 +0,0 @@ public interface IChatBaseComponent extends Message, IChatFormatted, Iterable<IC - GsonBuilder gsonbuilder = new GsonBuilder(); - - gsonbuilder.disableHtmlEscaping(); -+ gsonbuilder.registerTypeAdapter(AdventureComponent.class, new AdventureComponent.Serializer()); // Paper - gsonbuilder.registerTypeHierarchyAdapter(IChatBaseComponent.class, new IChatBaseComponent.ChatSerializer()); - gsonbuilder.registerTypeHierarchyAdapter(ChatModifier.class, new ChatModifier.ChatModifierSerializer()); - gsonbuilder.registerTypeAdapterFactory(new ChatTypeAdapterFactory()); -@@ -0,0 +0,0 @@ public interface IChatBaseComponent extends Message, IChatFormatted, Iterable<IC - return jsonobject; - } - -+ public static String componentToJson(final IChatBaseComponent component) { return a(component); } // Paper - OBFHELPER - public static String a(IChatBaseComponent ichatbasecomponent) { - return IChatBaseComponent.ChatSerializer.a.toJson(ichatbasecomponent); - } - -+ public static JsonElement toJsonTree(final IChatBaseComponent component) { return b(component); } // Paper - OBFHELPER - public static JsonElement b(IChatBaseComponent ichatbasecomponent) { - return IChatBaseComponent.ChatSerializer.a.toJsonTree(ichatbasecomponent); - } -@@ -0,0 +0,0 @@ public interface IChatBaseComponent extends Message, IChatFormatted, Iterable<IC - return (IChatMutableComponent) ChatDeserializer.a(IChatBaseComponent.ChatSerializer.a, s, IChatMutableComponent.class, false); - } - -+ public static @Nullable IChatBaseComponent fromJsonTree(final JsonElement json) { return a(json); } // Paper - OBFHELPER - @Nullable - public static IChatMutableComponent a(JsonElement jsonelement) { - return (IChatMutableComponent) IChatBaseComponent.ChatSerializer.a.fromJson(jsonelement, IChatMutableComponent.class); -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java +@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; // CraftBukkit start + import net.minecraft.network.chat.ChatComponentText; +import io.papermc.paper.adventure.PaperAdventure; // Paper import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.event.player.AsyncPlayerPreLoginEvent; @@ -1193,164 +1242,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return; } } -diff --git a/src/main/java/net/minecraft/server/NBTTagString.java b/src/main/java/net/minecraft/server/NBTTagString.java +diff --git a/src/main/java/net/minecraft/server/network/PacketStatusListener.java b/src/main/java/net/minecraft/server/network/PacketStatusListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NBTTagString.java -+++ b/src/main/java/net/minecraft/server/NBTTagString.java -@@ -0,0 +0,0 @@ public class NBTTagString implements NBTBase { - this.data = s; - } - -+ public static NBTTagString create(final String value) { return a(value); } // Paper - OBFHELPER - public static NBTTagString a(String s) { - return s.isEmpty() ? NBTTagString.b : new NBTTagString(s); - } -diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketDataSerializer.java -+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java -@@ -0,0 +0,0 @@ import io.netty.buffer.ByteBufOutputStream; - import io.netty.handler.codec.DecoderException; - import io.netty.handler.codec.EncoderException; - import io.netty.util.ByteProcessor; -+import io.papermc.paper.adventure.PaperAdventure; // Paper - import java.io.DataInput; - import java.io.DataOutput; - import java.io.IOException; -@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit - public class PacketDataSerializer extends ByteBuf { - - private final ByteBuf a; -+ public java.util.Locale adventure$locale; // Paper - - public PacketDataSerializer(ByteBuf bytebuf) { - this.a = bytebuf; -@@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { - return IChatBaseComponent.ChatSerializer.a(this.e(262144)); - } - -+ // Paper start -+ public PacketDataSerializer writeComponent(final net.kyori.adventure.text.Component component) { -+ return this.writeUtf(PaperAdventure.asJsonString(component, this.adventure$locale), 262144); -+ } -+ // Paper end -+ - public PacketDataSerializer a(IChatBaseComponent ichatbasecomponent) { -- return this.a(IChatBaseComponent.ChatSerializer.a(ichatbasecomponent), 262144); -+ //return this.a(IChatBaseComponent.ChatSerializer.a(ichatbasecomponent), 262144); // Paper - comment -+ return this.writeUtf(PaperAdventure.asJsonString(ichatbasecomponent, this.adventure$locale), 262144); // Paper - } - - public <T extends Enum<T>> T a(Class<T> oclass) { -@@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { - return this.a(s, 32767); - } - -+ public PacketDataSerializer writeUtf(final String string, final int maxLength) { return this.a(string, maxLength); } // Paper - OBFHELPER - public PacketDataSerializer a(String s, int i) { - byte[] abyte = s.getBytes(StandardCharsets.UTF_8); - -diff --git a/src/main/java/net/minecraft/server/PacketEncoder.java b/src/main/java/net/minecraft/server/PacketEncoder.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketEncoder.java -+++ b/src/main/java/net/minecraft/server/PacketEncoder.java -@@ -0,0 +0,0 @@ package net.minecraft.server; - import io.netty.buffer.ByteBuf; - import io.netty.channel.ChannelHandlerContext; - import io.netty.handler.codec.MessageToByteEncoder; -+import io.papermc.paper.adventure.PaperAdventure; // Paper - import java.io.IOException; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { - throw new IOException("Can't serialize unregistered packet"); - } else { - PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf); -+ packetdataserializer.adventure$locale = channelhandlercontext.channel().attr(PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper - - packetdataserializer.d(integer); - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -0,0 +0,0 @@ import java.util.UUID; - public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> { - - private IChatBaseComponent a; -+ public net.kyori.adventure.text.Component adventure$message; // Paper - public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot - private ChatMessageType b; - private UUID c; -@@ -0,0 +0,0 @@ public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> { - - @Override - public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ // Paper start -+ if (this.adventure$message != null) { -+ packetdataserializer.writeComponent(this.adventure$message); -+ } else -+ // Paper end - // Spigot start - if (components != null) { - packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components)); -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java -@@ -0,0 +0,0 @@ public class PacketPlayOutPlayerListHeaderFooter implements Packet<PacketListene - - public IChatBaseComponent header; - public IChatBaseComponent footer; -+ // Paper start -+ public net.kyori.adventure.text.Component adventure$header; -+ public net.kyori.adventure.text.Component adventure$footer; -+ // Paper end - - public PacketPlayOutPlayerListHeaderFooter() {} - -@@ -0,0 +0,0 @@ public class PacketPlayOutPlayerListHeaderFooter implements Packet<PacketListene - - @Override - public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ // Paper start -+ if (this.adventure$header != null && this.adventure$footer != null) { -+ packetdataserializer.writeComponent(this.adventure$header); -+ packetdataserializer.writeComponent(this.adventure$footer); -+ return; -+ } -+ // Paper end - packetdataserializer.a(this.header); - packetdataserializer.a(this.footer); - } -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java -@@ -0,0 +0,0 @@ public class PacketPlayOutTitle implements Packet<PacketListenerPlayOut> { - - private PacketPlayOutTitle.EnumTitleAction a; - private IChatBaseComponent b; -+ public net.kyori.adventure.text.Component adventure$text; // Paper - private int c; - private int d; - private int e; -@@ -0,0 +0,0 @@ public class PacketPlayOutTitle implements Packet<PacketListenerPlayOut> { - public void b(PacketDataSerializer packetdataserializer) throws IOException { - packetdataserializer.a((Enum) this.a); - if (this.a == PacketPlayOutTitle.EnumTitleAction.TITLE || this.a == PacketPlayOutTitle.EnumTitleAction.SUBTITLE || this.a == PacketPlayOutTitle.EnumTitleAction.ACTIONBAR) { -+ // Paper start -+ if (this.adventure$text != null) { -+ packetdataserializer.writeComponent(this.adventure$text); -+ } else -+ // Paper end - packetdataserializer.a(this.b); - } - -diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketStatusListener.java -+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java +--- a/src/main/java/net/minecraft/server/network/PacketStatusListener.java ++++ b/src/main/java/net/minecraft/server/network/PacketStatusListener.java @@ -0,0 +0,0 @@ public class PacketStatusListener implements PacketStatusInListener { CraftIconCache icon = minecraftServer.server.getServerIcon(); @@ -1360,10 +1255,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @Override -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -1372,7 +1267,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import io.papermc.paper.adventure.PaperAdventure; // Paper import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; - import org.bukkit.Location; + import net.minecraft.network.protocol.game.PacketPlayOutAttachEntity; @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { return this.minecraftServer.a(this.player.getProfile()); } @@ -1477,10 +1372,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 tileentitysign.isEditable = false; } // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ import com.mojang.authlib.GameProfile; import com.mojang.serialization.DataResult; import com.mojang.serialization.Dynamic; @@ -1601,10 +1496,117 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java +diff --git a/src/main/java/net/minecraft/world/BossBattle.java b/src/main/java/net/minecraft/world/BossBattle.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldMap.java -+++ b/src/main/java/net/minecraft/server/WorldMap.java +--- a/src/main/java/net/minecraft/world/BossBattle.java ++++ b/src/main/java/net/minecraft/world/BossBattle.java +@@ -0,0 +0,0 @@ + package net.minecraft.world; + ++import io.papermc.paper.adventure.PaperAdventure; + import java.util.UUID; + import net.minecraft.EnumChatFormat; + import net.minecraft.network.chat.IChatBaseComponent; +@@ -0,0 +0,0 @@ public abstract class BossBattle { + protected boolean e; + protected boolean f; + protected boolean g; ++ public net.kyori.adventure.bossbar.BossBar adventure; // Paper + + public BossBattle(UUID uuid, IChatBaseComponent ichatbasecomponent, BossBattle.BarColor bossbattle_barcolor, BossBattle.BarStyle bossbattle_barstyle) { + this.h = uuid; +@@ -0,0 +0,0 @@ public abstract class BossBattle { + } + + public IChatBaseComponent j() { ++ if(this.adventure != null) return PaperAdventure.asVanilla(this.adventure.name()); // Paper + return this.title; + } + + public void a(IChatBaseComponent ichatbasecomponent) { ++ if (this.adventure != null) this.adventure.name(PaperAdventure.asAdventure(ichatbasecomponent)); // Paper + this.title = ichatbasecomponent; + } + + public float getProgress() { ++ if (this.adventure != null) return this.adventure.progress(); // Paper + return this.b; + } + + public void a(float f) { ++ if (this.adventure != null) this.adventure.progress(f); // Paper + this.b = f; + } + + public BossBattle.BarColor l() { ++ if (this.adventure != null) return PaperAdventure.asVanilla(this.adventure.color()); // Paper + return this.color; + } + + public void a(BossBattle.BarColor bossbattle_barcolor) { ++ if(this.adventure != null) this.adventure.color(PaperAdventure.asAdventure(bossbattle_barcolor)); // Paper + this.color = bossbattle_barcolor; + } + + public BossBattle.BarStyle m() { ++ if(this.adventure != null) return PaperAdventure.asVanilla(this.adventure.overlay()); // Paper + return this.style; + } + + public void a(BossBattle.BarStyle bossbattle_barstyle) { ++ if(this.adventure != null) this.adventure.overlay(PaperAdventure.asAdventure(bossbattle_barstyle)); // Paper + this.style = bossbattle_barstyle; + } + + public boolean isDarkenSky() { ++ if(this.adventure != null) return this.adventure.hasFlag(net.kyori.adventure.bossbar.BossBar.Flag.DARKEN_SCREEN); // Paper + return this.e; + } + + public BossBattle a(boolean flag) { ++ if(this.adventure != null) PaperAdventure.setFlag(this.adventure, net.kyori.adventure.bossbar.BossBar.Flag.DARKEN_SCREEN, flag); // Paper + this.e = flag; + return this; + } + + public boolean isPlayMusic() { ++ if(this.adventure != null) return this.adventure.hasFlag(net.kyori.adventure.bossbar.BossBar.Flag.PLAY_BOSS_MUSIC); // Paper + return this.f; + } + + public BossBattle b(boolean flag) { ++ if(this.adventure != null) PaperAdventure.setFlag(this.adventure, net.kyori.adventure.bossbar.BossBar.Flag.PLAY_BOSS_MUSIC, flag); // Paper + this.f = flag; + return this; + } + + public BossBattle c(boolean flag) { ++ if(this.adventure != null) PaperAdventure.setFlag(this.adventure, net.kyori.adventure.bossbar.BossBar.Flag.CREATE_WORLD_FOG, flag); // Paper + this.g = flag; + return this; + } + + public boolean isCreateFog() { ++ if(this.adventure != null) return this.adventure.hasFlag(net.kyori.adventure.bossbar.BossBar.Flag.CREATE_WORLD_FOG); // Paper + return this.g; + } + +diff --git a/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java b/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java ++++ b/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java +@@ -0,0 +0,0 @@ public abstract class Enchantment { + return this.f(); + } + ++ public final IChatBaseComponent getTranslationComponentForLevel(int level) { return this.d(level); } // Paper - OBFHELPER + public IChatBaseComponent d(int i) { + ChatMessage chatmessage = new ChatMessage(this.g()); + +diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java b/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java ++++ b/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -1739,7 +1741,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + @Override + public net.kyori.adventure.text.Component motd() { -+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(new net.minecraft.server.ChatComponentText(console.getMotd())); ++ return io.papermc.paper.adventure.PaperAdventure.asAdventure(new net.minecraft.network.chat.ChatComponentText(console.getMotd())); + } + // Paper end @Override @@ -1789,14 +1791,6 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftContainer.java b/sr index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftContainer.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.block; - - import net.minecraft.server.ChestLock; -+import net.minecraft.server.TileEntityBeacon; - import net.minecraft.server.TileEntityContainer; - import org.bukkit.Material; - import org.bukkit.block.Block; @@ -0,0 +0,0 @@ public abstract class CraftContainer<T extends TileEntityContainer> extends Craf this.getSnapshot().chestLock = (key == null) ? ChestLock.a : new ChestLock(key); } @@ -1990,20 +1984,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end - public net.minecraft.server.Enchantment getHandle() { + public net.minecraft.world.item.enchantment.Enchantment getHandle() { return target; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -0,0 +0,0 @@ import net.minecraft.server.EntityZombieVillager; - import net.minecraft.server.IChatBaseComponent; - import net.minecraft.server.NBTBase; - import net.minecraft.server.NBTTagCompound; -+import net.minecraft.server.TileEntityEnchantTable; - import org.bukkit.Chunk; // Paper - import org.bukkit.EntityEffect; - import org.bukkit.Location; @@ -0,0 +0,0 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return getHandle().getVehicle().getBukkitEntity(); } @@ -2262,7 +2248,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + public void sendMessage(final net.kyori.adventure.identity.Identity identity, final net.kyori.adventure.text.Component message, final net.kyori.adventure.audience.MessageType type) { -+ final PacketPlayOutChat packet = new PacketPlayOutChat(null, type == net.kyori.adventure.audience.MessageType.CHAT ? net.minecraft.server.ChatMessageType.CHAT : net.minecraft.server.ChatMessageType.SYSTEM, identity.uuid()); ++ final PacketPlayOutChat packet = new PacketPlayOutChat(null, type == net.kyori.adventure.audience.MessageType.CHAT ? net.minecraft.network.chat.ChatMessageType.CHAT : net.minecraft.network.chat.ChatMessageType.SYSTEM, identity.uuid()); + packet.adventure$message = message; + this.getHandle().playerConnection.sendPacket(packet); + } @@ -2350,7 +2336,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public void playSound(final net.kyori.adventure.sound.Sound sound, final double x, final double y, final double z) { + final MinecraftKey name = io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.name()); -+ final java.util.Optional<net.minecraft.server.SoundEffect> event = net.minecraft.server.IRegistry.SOUND_EVENT.getOptional(name); ++ final java.util.Optional<net.minecraft.sounds.SoundEffect> event = net.minecraft.core.IRegistry.SOUND_EVENT.getOptional(name); + if (event.isPresent()) { + this.getHandle().playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(event.get(), io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.source()), x, y, z, sound.volume(), sound.pitch())); + } else { @@ -2369,14 +2355,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public void openBook(final net.kyori.adventure.inventory.Book book) { + final java.util.Locale locale = this.getHandle().adventure$locale; -+ final net.minecraft.server.ItemStack item = io.papermc.paper.adventure.PaperAdventure.asItemStack(book, locale); ++ final net.minecraft.world.item.ItemStack item = io.papermc.paper.adventure.PaperAdventure.asItemStack(book, locale); + final EntityPlayer player = this.getHandle(); + final PlayerConnection connection = player.playerConnection; -+ final net.minecraft.server.PlayerInventory inventory = player.inventory; ++ final net.minecraft.world.entity.player.PlayerInventory inventory = player.inventory; + final int slot = inventory.items.size() + inventory.itemInHandIndex; -+ connection.sendPacket(new net.minecraft.server.PacketPlayOutSetSlot(0, slot, item)); -+ connection.sendPacket(new net.minecraft.server.PacketPlayOutOpenBook(net.minecraft.server.EnumHand.MAIN_HAND)); -+ connection.sendPacket(new net.minecraft.server.PacketPlayOutSetSlot(0, slot, inventory.getItemInHand())); ++ connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutSetSlot(0, slot, item)); ++ connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutOpenBook(net.minecraft.world.EnumHand.MAIN_HAND)); ++ connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutSetSlot(0, slot, inventory.getItemInHand())); + } + // Paper end + @@ -2592,7 +2578,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + @Override + public net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowItem> asHoverEvent(final ItemStack item, final java.util.function.UnaryOperator<net.kyori.adventure.text.event.HoverEvent.ShowItem> op) { -+ final net.minecraft.server.NBTTagCompound tag = CraftItemStack.asNMSCopy(item).getTag(); ++ final net.minecraft.nbt.NBTTagCompound tag = CraftItemStack.asNMSCopy(item).getTag(); + return net.kyori.adventure.text.event.HoverEvent.showItem(op.apply(net.kyori.adventure.text.event.HoverEvent.ShowItem.of(item.getType().getKey(), item.getAmount(), io.papermc.paper.adventure.PaperAdventure.asBinaryTagHolder(tag)))); + } + // Paper end @@ -2807,7 +2793,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 -import com.google.common.collect.ImmutableMap.Builder; +import com.google.common.collect.ImmutableMap; // Paper import java.util.Map; - import net.minecraft.server.NBTTagCompound; + import net.minecraft.nbt.NBTTagCompound; import org.bukkit.Material; @@ -0,0 +0,0 @@ class CraftMetaBookSigned extends CraftMetaBook implements BookMeta { } diff --git a/Spigot-Server-Patches/All-chunks-are-slime-spawn-chunks-toggle.patch b/Spigot-Server-Patches/All-chunks-are-slime-spawn-chunks-toggle.patch index 2f01b77bc6..48cbaf37cf 100644 --- a/Spigot-Server-Patches/All-chunks-are-slime-spawn-chunks-toggle.patch +++ b/Spigot-Server-Patches/All-chunks-are-slime-spawn-chunks-toggle.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false); + } } -diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java b/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntitySlime.java -+++ b/src/main/java/net/minecraft/server/EntitySlime.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java @@ -0,0 +0,0 @@ public class EntitySlime extends EntityInsentient implements IMonster { } diff --git a/Spigot-Server-Patches/Allow-Saving-of-Oversized-Chunks.patch b/Spigot-Server-Patches/Allow-Saving-of-Oversized-Chunks.patch index 3ef5db6ac7..151990de04 100644 --- a/Spigot-Server-Patches/Allow-Saving-of-Oversized-Chunks.patch +++ b/Spigot-Server-Patches/Allow-Saving-of-Oversized-Chunks.patch @@ -30,10 +30,10 @@ This fix also maintains compatability if someone switches server jars to one wit this fix, as the data will remain in the oversized file. Once the server returns to a jar with this fix, the data will be restored. -diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java +diff --git a/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java +--- a/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java ++++ b/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java @@ -0,0 +0,0 @@ public class NBTCompressedStreamTools { } @@ -50,19 +50,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static void a(NBTTagCompound nbttagcompound, DataOutput dataoutput) throws IOException { a((NBTBase) nbttagcompound, dataoutput); } -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -0,0 +0,0 @@ import java.nio.file.Files; - import java.nio.file.LinkOption; +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +@@ -0,0 +0,0 @@ import java.nio.file.LinkOption; + import java.nio.file.Path; import java.nio.file.StandardCopyOption; import java.nio.file.StandardOpenOption; +import java.util.zip.InflaterInputStream; // Paper + import javax.annotation.Nullable; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; + import net.minecraft.SystemUtils; + import net.minecraft.world.level.ChunkCoordIntPair; @@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { private final IntBuffer i; @VisibleForTesting @@ -73,13 +73,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this(file.toPath(), file1.toPath(), RegionFileCompression.b, flag); @@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { - public RegionFile(java.nio.file.Path java_nio_file_path, java.nio.file.Path java_nio_file_path1, RegionFileCompression regionfilecompression, boolean flag) throws IOException { + public RegionFile(Path path, Path path1, RegionFileCompression regionfilecompression, boolean flag) throws IOException { this.g = ByteBuffer.allocateDirect(8192); + this.file = java_nio_file_path.toFile(); // Paper + initOversizedState(); // Paper this.freeSectors = new RegionFileBitSet(); this.f = regionfilecompression; - if (!Files.isDirectory(java_nio_file_path1, new LinkOption[0])) { + if (!Files.isDirectory(path1, new LinkOption[0])) { @@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { void run() throws IOException; } @@ -155,10 +155,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 class ChunkBuffer extends ByteArrayOutputStream { private final ChunkCoordIntPair b; -diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegionFileCache.java -+++ b/src/main/java/net/minecraft/server/RegionFileCache.java +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java @@ -0,0 +0,0 @@ public final class RegionFileCache implements AutoCloseable { } } diff --git a/Spigot-Server-Patches/Allow-chests-to-be-placed-with-NBT-data.patch b/Spigot-Server-Patches/Allow-chests-to-be-placed-with-NBT-data.patch index 77eb5d51ab..f0dfa2fde8 100644 --- a/Spigot-Server-Patches/Allow-chests-to-be-placed-with-NBT-data.patch +++ b/Spigot-Server-Patches/Allow-chests-to-be-placed-with-NBT-data.patch @@ -4,10 +4,10 @@ Date: Sat, 8 Sep 2018 18:43:31 -0500 Subject: [PATCH] Allow chests to be placed with NBT data -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -0,0 +0,0 @@ public final class ItemStack { enuminteractionresult = EnumInteractionResult.FAIL; // cancel placement // PAIL: Remove this when MC-99075 fixed @@ -16,10 +16,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // revert back all captured blocks for (BlockState blockstate : blocks) { blockstate.update(true, false); -diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityChest.java -+++ b/src/main/java/net/minecraft/server/TileEntityChest.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java @@ -0,0 +0,0 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic // CraftBukkit start @Override diff --git a/Spigot-Server-Patches/Allow-delegation-to-vanilla-chunk-gen.patch b/Spigot-Server-Patches/Allow-delegation-to-vanilla-chunk-gen.patch index 674c7297f7..48120a2daf 100644 --- a/Spigot-Server-Patches/Allow-delegation-to-vanilla-chunk-gen.patch +++ b/Spigot-Server-Patches/Allow-delegation-to-vanilla-chunk-gen.patch @@ -4,10 +4,10 @@ Date: Wed, 29 Apr 2020 02:10:32 +0200 Subject: [PATCH] Allow delegation to vanilla chunk gen -diff --git a/src/main/java/net/minecraft/server/ChunkConverter.java b/src/main/java/net/minecraft/server/ChunkConverter.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkConverter.java b/src/main/java/net/minecraft/world/level/chunk/ChunkConverter.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkConverter.java -+++ b/src/main/java/net/minecraft/server/ChunkConverter.java +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkConverter.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkConverter.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; public class ChunkConverter { @@ -40,13 +40,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // get empty object + CraftChunkData data = (CraftChunkData) createChunkData(world); + // do bunch of vanilla shit -+ net.minecraft.server.WorldServer nmsWorld = ((CraftWorld) world).getHandle(); -+ net.minecraft.server.ProtoChunk protoChunk = new net.minecraft.server.ProtoChunk(new net.minecraft.server.ChunkCoordIntPair(x, z), net.minecraft.server.ChunkConverter.getEmptyConverter(), nmsWorld); -+ List<net.minecraft.server.IChunkAccess> list = new ArrayList<>(); ++ net.minecraft.server.level.WorldServer nmsWorld = ((CraftWorld) world).getHandle(); ++ net.minecraft.world.level.chunk.ProtoChunk protoChunk = new net.minecraft.world.level.chunk.ProtoChunk(new net.minecraft.world.level.ChunkCoordIntPair(x, z), net.minecraft.world.level.chunk.ChunkConverter.getEmptyConverter(), nmsWorld); ++ List<net.minecraft.world.level.chunk.IChunkAccess> list = new ArrayList<>(); + list.add(protoChunk); -+ net.minecraft.server.RegionLimitedWorldAccess genRegion = new net.minecraft.server.RegionLimitedWorldAccess(nmsWorld, list); ++ net.minecraft.server.level.RegionLimitedWorldAccess genRegion = new net.minecraft.server.level.RegionLimitedWorldAccess(nmsWorld, list); + // call vanilla generator, one feature after another. Order here is important! -+ net.minecraft.server.ChunkGenerator chunkGenerator = nmsWorld.getChunkProvider().chunkGenerator; ++ net.minecraft.world.level.chunk.ChunkGenerator chunkGenerator = nmsWorld.getChunkProvider().chunkGenerator; + if (chunkGenerator instanceof org.bukkit.craftbukkit.generator.CustomChunkGenerator) { + chunkGenerator = ((org.bukkit.craftbukkit.generator.CustomChunkGenerator) chunkGenerator).delegate; + } @@ -97,8 +97,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public class CustomChunkGenerator extends InternalChunkGenerator { -- private final net.minecraft.server.ChunkGenerator delegate; -+ public final net.minecraft.server.ChunkGenerator delegate; // Paper - public +- private final net.minecraft.world.level.chunk.ChunkGenerator delegate; ++ public final net.minecraft.world.level.chunk.ChunkGenerator delegate; // Paper - public private final ChunkGenerator generator; private final WorldServer world; private final Random random = new Random(); diff --git a/Spigot-Server-Patches/Allow-disabling-armour-stand-ticking.patch b/Spigot-Server-Patches/Allow-disabling-armour-stand-ticking.patch index f4c4fc359e..fd6e3e16c7 100644 --- a/Spigot-Server-Patches/Allow-disabling-armour-stand-ticking.patch +++ b/Spigot-Server-Patches/Allow-disabling-armour-stand-ticking.patch @@ -19,10 +19,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default"); + } } -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { public Vector3f leftLegPose; public Vector3f rightLegPose; diff --git a/Spigot-Server-Patches/Allow-disabling-mob-spawner-spawn-egg-transformation.patch b/Spigot-Server-Patches/Allow-disabling-mob-spawner-spawn-egg-transformation.patch index 34128a2496..b9ed7a75bb 100644 --- a/Spigot-Server-Patches/Allow-disabling-mob-spawner-spawn-egg-transformation.patch +++ b/Spigot-Server-Patches/Allow-disabling-mob-spawner-spawn-egg-transformation.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + disableMobSpawnerSpawnEggTransformation = getBoolean("game-mechanics.disable-mob-spawner-spawn-egg-transformation", disableMobSpawnerSpawnEggTransformation); + } } -diff --git a/src/main/java/net/minecraft/server/ItemMonsterEgg.java b/src/main/java/net/minecraft/server/ItemMonsterEgg.java +diff --git a/src/main/java/net/minecraft/world/item/ItemMonsterEgg.java b/src/main/java/net/minecraft/world/item/ItemMonsterEgg.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemMonsterEgg.java -+++ b/src/main/java/net/minecraft/server/ItemMonsterEgg.java +--- a/src/main/java/net/minecraft/world/item/ItemMonsterEgg.java ++++ b/src/main/java/net/minecraft/world/item/ItemMonsterEgg.java @@ -0,0 +0,0 @@ public class ItemMonsterEgg extends Item { EnumDirection enumdirection = itemactioncontext.getClickedFace(); IBlockData iblockdata = world.getType(blockposition); diff --git a/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch b/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch index d59afd362f..40ada8ba8a 100644 --- a/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch +++ b/Spigot-Server-Patches/Allow-for-toggling-of-spawn-chunks.patch @@ -19,10 +19,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("Keep spawn chunk loaded: " + keepSpawnInMemory); + } } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { }); // CraftBukkit end diff --git a/Spigot-Server-Patches/Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch b/Spigot-Server-Patches/Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch index b78c43df4b..2fee86152b 100644 --- a/Spigot-Server-Patches/Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch +++ b/Spigot-Server-Patches/Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch @@ -13,10 +13,10 @@ Use an ArrayDeque to store this Queue We make sure to also implement a pattern that is recursion safe too. -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public final CallbackExecutor callbackExecutor = new CallbackExecutor(); public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable { diff --git a/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch b/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch index 7519d06622..2b7b3fd0c1 100644 --- a/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch +++ b/Spigot-Server-Patches/Allow-nerfed-mobs-to-jump-and-take-water-damage.patch @@ -18,23 +18,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + nerfedMobsShouldJump = getBoolean("spawner-nerfed-mobs-should-jump", false); + } } -diff --git a/src/main/java/net/minecraft/server/ControllerJump.java b/src/main/java/net/minecraft/server/ControllerJump.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ControllerJump.java -+++ b/src/main/java/net/minecraft/server/ControllerJump.java -@@ -0,0 +0,0 @@ public class ControllerJump { - this.a = true; - } - -+ public final void jumpIfSet() { this.b(); } // Paper - OBFHELPER - public void b() { - this.b.setJumping(this.a); - this.a = false; -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return this.isInWater() || this.isInRain(); } @@ -42,10 +30,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean aG() { return this.isInWater() || this.isInRain() || this.k(); } -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { private final EntityAIBodyControl c; protected NavigationAbstract navigation; @@ -73,10 +61,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.world.getMethodProfiler().enter("sensing"); this.bo.a(); this.world.getMethodProfiler().exit(); -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/control/ControllerJump.java b/src/main/java/net/minecraft/world/entity/ai/control/ControllerJump.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java +--- a/src/main/java/net/minecraft/world/entity/ai/control/ControllerJump.java ++++ b/src/main/java/net/minecraft/world/entity/ai/control/ControllerJump.java +@@ -0,0 +0,0 @@ public class ControllerJump { + this.a = true; + } + ++ public final void jumpIfSet() { this.b(); } // Paper - OBFHELPER + public void b() { + this.b.setJumping(this.a); + this.a = false; +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalFloat.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalFloat.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalFloat.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalFloat.java @@ -0,0 +0,0 @@ public class PathfinderGoalFloat extends PathfinderGoal { public PathfinderGoalFloat(EntityInsentient entityinsentient) { diff --git a/Spigot-Server-Patches/Allow-setting-the-vex-s-summoner.patch b/Spigot-Server-Patches/Allow-setting-the-vex-s-summoner.patch index f618d65a99..38790f5f2b 100644 --- a/Spigot-Server-Patches/Allow-setting-the-vex-s-summoner.patch +++ b/Spigot-Server-Patches/Allow-setting-the-vex-s-summoner.patch @@ -4,10 +4,10 @@ Date: Sat, 6 Oct 2018 21:47:44 -0500 Subject: [PATCH] Allow setting the vex's summoner -diff --git a/src/main/java/net/minecraft/server/EntityVex.java b/src/main/java/net/minecraft/server/EntityVex.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityVex.java b/src/main/java/net/minecraft/world/entity/monster/EntityVex.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVex.java -+++ b/src/main/java/net/minecraft/server/EntityVex.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityVex.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityVex.java @@ -0,0 +0,0 @@ public class EntityVex extends EntityMonster { this.a(1, flag); } @@ -21,11 +21,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java @@ -0,0 +0,0 @@ public class CraftVex extends CraftMonster implements Vex { - EntityInsentient owner = getHandle().getOwner(); - return owner != null ? (Mob) owner.getBukkitEntity() : null; + net.minecraft.world.entity.EntityInsentient owner = getHandle().getOwner(); + return owner != null ? (org.bukkit.entity.Mob) owner.getBukkitEntity() : null; } + -+ public void setSummoner(Mob summoner) { ++ public void setSummoner(org.bukkit.entity.Mob summoner) { + getHandle().setOwner(summoner == null ? null : ((CraftMob) summoner).getHandle()); + } // Paper end diff --git a/Spigot-Server-Patches/Allow-specifying-a-custom-authentication-servers-dow.patch b/Spigot-Server-Patches/Allow-specifying-a-custom-authentication-servers-dow.patch index b4eb623efd..75e8645bd5 100644 --- a/Spigot-Server-Patches/Allow-specifying-a-custom-authentication-servers-dow.patch +++ b/Spigot-Server-Patches/Allow-specifying-a-custom-authentication-servers-dow.patch @@ -26,10 +26,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + authenticationServersDownKickMessage = Strings.emptyToNull(getString("messages.kick.authentication-servers-down", authenticationServersDownKickMessage)); + } } -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { LoginListener.this.i = LoginListener.this.a(gameprofile); LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; diff --git a/Spigot-Server-Patches/Allow-using-signs-inside-spawn-protection.patch b/Spigot-Server-Patches/Allow-using-signs-inside-spawn-protection.patch index faf50c240c..6054fb69cf 100644 --- a/Spigot-Server-Patches/Allow-using-signs-inside-spawn-protection.patch +++ b/Spigot-Server-Patches/Allow-using-signs-inside-spawn-protection.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + allowUsingSignsInsideSpawnProtection = getBoolean("allow-using-signs-inside-spawn-protection", allowUsingSignsInsideSpawnProtection); + } } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { this.player.resetIdleTimer(); diff --git a/Spigot-Server-Patches/Always-tick-falling-blocks.patch b/Spigot-Server-Patches/Always-tick-falling-blocks.patch index 4f7d01899e..d1254a90b5 100644 --- a/Spigot-Server-Patches/Always-tick-falling-blocks.patch +++ b/Spigot-Server-Patches/Always-tick-falling-blocks.patch @@ -8,14 +8,6 @@ diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -0,0 +0,0 @@ import net.minecraft.server.EntityCreature; - import net.minecraft.server.EntityCreeper; - import net.minecraft.server.EntityEnderCrystal; - import net.minecraft.server.EntityEnderDragon; -+import net.minecraft.server.EntityFallingBlock; // Paper - import net.minecraft.server.EntityFireball; - import net.minecraft.server.EntityFireworks; - import net.minecraft.server.EntityHuman; @@ -0,0 +0,0 @@ public class ActivationRange || entity instanceof EntityFireball || entity instanceof EntityLightning diff --git a/Spigot-Server-Patches/Anti-Xray.patch b/Spigot-Server-Patches/Anti-Xray.patch index 596e14c8b2..0c4cee1478 100644 --- a/Spigot-Server-Patches/Anti-Xray.patch +++ b/Spigot-Server-Patches/Anti-Xray.patch @@ -72,7 +72,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import net.minecraft.server.EnumDirection; +import net.minecraft.server.IBlockData; +import net.minecraft.server.IChunkAccess; -+import net.minecraft.server.PacketPlayOutMapChunk; ++import net.minecraft.network.protocol.game.PacketPlayOutMapChunk; +import net.minecraft.server.PlayerInteractManager; +import net.minecraft.server.World; + @@ -756,7 +756,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import net.minecraft.server.Chunk; +import net.minecraft.server.DataPalette; -+import net.minecraft.server.PacketPlayOutMapChunk; ++import net.minecraft.network.protocol.game.PacketPlayOutMapChunk; + +public class ChunkPacketInfo<T> { + @@ -843,7 +843,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import net.minecraft.server.Chunk; +import net.minecraft.server.IBlockData; -+import net.minecraft.server.PacketPlayOutMapChunk; ++import net.minecraft.network.protocol.game.PacketPlayOutMapChunk; + +public final class ChunkPacketInfoAntiXray extends ChunkPacketInfo<IBlockData> implements Runnable { + @@ -1011,10 +1011,199 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } +} -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java +@@ -0,0 +0,0 @@ + package net.minecraft.network.protocol.game; + ++import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info + import com.google.common.collect.Lists; + import io.netty.buffer.ByteBuf; + import io.netty.buffer.Unpooled; +@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { + private List<NBTTagCompound> g; + private boolean h; + +- public PacketPlayOutMapChunk() {} ++ // Paper start - Async-Anti-Xray - Set the ready flag to true ++ private volatile boolean ready; // Paper - Async-Anti-Xray - Ready flag for the network manager ++ public PacketPlayOutMapChunk() { ++ this.ready = true; ++ } ++ // Paper end ++ + // Paper start + private final java.util.List<Packet> extraPackets = new java.util.ArrayList<>(); + private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750); +@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { + return extraPackets; + } + // Paper end +- public PacketPlayOutMapChunk(Chunk chunk, int i) { ++ // Paper start - Anti-Xray - Add chunk packet info ++ @Deprecated public PacketPlayOutMapChunk(Chunk chunk, int i) { this(chunk, i, true); } // Notice for updates: Please make sure this constructor isn't used anywhere ++ public PacketPlayOutMapChunk(Chunk chunk, int i, boolean modifyBlocks) { ++ ChunkPacketInfo<IBlockData> chunkPacketInfo = modifyBlocks ? chunk.world.chunkPacketBlockController.getChunkPacketInfo(this, chunk, i) : null; ++ // Paper end + ChunkCoordIntPair chunkcoordintpair = chunk.getPos(); + + this.a = chunkcoordintpair.x; +@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { + } + + this.f = new byte[this.a(chunk, i)]; +- this.c = this.a(new PacketDataSerializer(this.j()), chunk, i); ++ // Paper start - Anti-Xray - Add chunk packet info ++ if (chunkPacketInfo != null) { ++ chunkPacketInfo.setData(this.getData()); ++ } ++ this.c = this.writeChunk(new PacketDataSerializer(this.j()), chunk, i, chunkPacketInfo); ++ // Paper end + this.g = Lists.newArrayList(); + iterator = chunk.getTileEntities().entrySet().iterator(); + int totalTileEntities = 0; // Paper +@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { + this.g.add(nbttagcompound); + } + } ++ chunk.world.chunkPacketBlockController.modifyBlocks(this, chunkPacketInfo); // Paper - Anti-Xray - Modify blocks ++ } + ++ // Paper start - Async-Anti-Xray - Getter and Setter for the ready flag ++ @Override ++ public boolean isReady() { ++ return this.ready; ++ } ++ ++ public void setReady(boolean ready) { ++ this.ready = ready; + } ++ // Paper end + + @Override + public void a(PacketDataSerializer packetdataserializer) throws IOException { +@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { + return bytebuf; + } + +- public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector) { return this.a(packetDataSerializer, chunk, chunkSectionSelector); } // Paper - OBFHELPER +- public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i) { ++ // Paper start - Anti-Xray - Add chunk packet info ++ @Deprecated public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector) { return this.a(packetDataSerializer, chunk, chunkSectionSelector); } // OBFHELPER // Notice for updates: Please make sure this method isn't used anywhere ++ @Deprecated public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i) { return this.writeChunk(packetdataserializer, chunk, i, null); } // Notice for updates: Please make sure this method isn't used anywhere ++ public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector, ChunkPacketInfo<IBlockData> chunkPacketInfo) { return this.a(packetDataSerializer, chunk, chunkSectionSelector, chunkPacketInfo); } // OBFHELPER ++ public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i, ChunkPacketInfo<IBlockData> chunkPacketInfo) { ++ // Paper end + int j = 0; + ChunkSection[] achunksection = chunk.getSections(); + int k = 0; +@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { + + if (chunksection != Chunk.a && (!this.f() || !chunksection.c()) && (i & 1 << k) != 0) { + j |= 1 << k; +- chunksection.b(packetdataserializer); ++ chunksection.writeChunkSection(packetdataserializer, chunkPacketInfo); // Paper - Anti-Xray - Add chunk packet info + } + } + +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + } + + this.g(chunkcoordintpair); +- return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a)); ++ return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a, this.world)); // Paper - Anti-Xray - Add parameter + }, this.executor); + } + +@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + + } + ++ private final void sendChunk(EntityPlayer entityplayer, Packet<?>[] apacket, Chunk chunk) { this.a(entityplayer, apacket, chunk); } // Paper - OBFHELPER + private void a(EntityPlayer entityplayer, Packet<?>[] apacket, Chunk chunk) { + if (apacket[0] == null) { +- apacket[0] = new PacketPlayOutMapChunk(chunk, 65535); ++ apacket[0] = new PacketPlayOutMapChunk(chunk, 65535, chunk.world.chunkPacketBlockController.shouldModify(entityplayer, chunk, 65535)); // Paper - Anti-Xray - Bypass + apacket[1] = new PacketPlayOutLightUpdate(chunk.getPos(), this.lightEngine, true); + } + +diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +@@ -0,0 +0,0 @@ public class PlayerInteractManager { + } + + } ++ ++ this.world.chunkPacketBlockController.onPlayerLeftClickBlock(this, blockposition, enumdirection); // Paper - Anti-Xray + } + + public void a(BlockPosition blockposition, PacketPlayInBlockDig.EnumPlayerDigType packetplayinblockdig_enumplayerdigtype, String s) { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + + // Add env and gen to constructor, WorldData -> WorldDataServer + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { +- super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env); ++ super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor + this.pvpMode = minecraftserver.getPVP(); + convertable = convertable_conversionsession; + uuid = WorldUUID.getUUID(convertable_conversionsession.folder.toFile()); +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -0,0 +0,0 @@ package net.minecraft.world.level; + + import co.aikar.timings.Timing; + import co.aikar.timings.Timings; ++import com.destroystokyo.paper.antixray.ChunkPacketBlockController; // Paper - Anti-Xray ++import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray; // Paper - Anti-Xray + import com.destroystokyo.paper.event.server.ServerExceptionEvent; + import com.destroystokyo.paper.exception.ServerInternalException; + import com.google.common.base.MoreObjects; +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot + + public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper ++ public final ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray + + public final co.aikar.timings.WorldTimingsHandler timings; // Paper + public static BlockPosition lastPhysicsProblem; // Spigot +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + return typeKey; + } + +- protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, final DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { ++ protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, final DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper + this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.WorldDataServer) worlddatamutable).getName()); // Spigot + this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.WorldDataServer) worlddatamutable).getName(), this.spigotConfig); // Paper ++ this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray + this.generator = gen; + this.world = new CraftWorld((WorldServer) this, gen, env); + this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + // CraftBukkit end + + IBlockData iblockdata1 = chunk.setType(blockposition, iblockdata, (i & 64) != 0, (i & 1024) == 0); // CraftBukkit custom NO_PLACE flag ++ this.chunkPacketBlockController.onBlockChange(this, blockposition, iblockdata, iblockdata1, i); // Paper - Anti-Xray + + if (iblockdata1 == null) { + // CraftBukkit start - remove blockstate if failed (or the same) +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { return null; } @@ -1024,10 +1213,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.sections[j >> 4] = chunksection; } -diff --git a/src/main/java/net/minecraft/server/ChunkEmpty.java b/src/main/java/net/minecraft/server/ChunkEmpty.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java b/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkEmpty.java -+++ b/src/main/java/net/minecraft/server/ChunkEmpty.java +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java @@ -0,0 +0,0 @@ public class ChunkEmpty extends Chunk { }); @@ -1037,40 +1226,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Paper start -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - byte b0 = nbttagcompound2.getByte("Y"); - - if (nbttagcompound2.hasKeyOfType("Palette", 9) && nbttagcompound2.hasKeyOfType("BlockStates", 12)) { -- ChunkSection chunksection = new ChunkSection(b0 << 4); -+ ChunkSection chunksection = new ChunkSection(b0 << 4, null, worldserver, false); // Paper - Anti-Xray - Add parameters - - chunksection.getBlocks().a(nbttagcompound2.getList("Palette", 10), nbttagcompound2.getLongArray("BlockStates")); - chunksection.recalcBlockCounts(); -@@ -0,0 +0,0 @@ public class ChunkRegionLoader { - // CraftBukkit end - }); - } else { -- ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1); -+ ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, worldserver); // Paper - Anti-Xray - Add parameter - - protochunk.a(biomestorage); - object = protochunk; -diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.world.level.chunk; import java.util.function.Predicate; +import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info import javax.annotation.Nullable; - - public class ChunkSection { + import net.minecraft.nbt.GameProfileSerializer; + import net.minecraft.network.PacketDataSerializer; @@ -0,0 +0,0 @@ public class ChunkSection { private short e; final DataPaletteBlock<IBlockData> blockIds; // Paper - package-private @@ -1116,12 +1283,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public int j() { -diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DataPaletteBlock.java -+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java +--- a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java ++++ b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.world.level.chunk; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; +import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info @@ -1237,145 +1404,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int j = along.length * 64 / 4096; if (this.h == this.b) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - -+import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info - import com.google.common.collect.Lists; - import io.netty.buffer.ByteBuf; - import io.netty.buffer.Unpooled; -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { - private List<NBTTagCompound> g; - private boolean h; - -- public PacketPlayOutMapChunk() {} -+ // Paper start - Async-Anti-Xray - Set the ready flag to true -+ private volatile boolean ready; // Paper - Async-Anti-Xray - Ready flag for the network manager -+ public PacketPlayOutMapChunk() { -+ this.ready = true; -+ } -+ // Paper end -+ - // Paper start - private final java.util.List<Packet> extraPackets = new java.util.ArrayList<>(); - private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750); -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { - return extraPackets; - } - // Paper end -- public PacketPlayOutMapChunk(Chunk chunk, int i) { -+ // Paper start - Anti-Xray - Add chunk packet info -+ @Deprecated public PacketPlayOutMapChunk(Chunk chunk, int i) { this(chunk, i, true); } // Notice for updates: Please make sure this constructor isn't used anywhere -+ public PacketPlayOutMapChunk(Chunk chunk, int i, boolean modifyBlocks) { -+ ChunkPacketInfo<IBlockData> chunkPacketInfo = modifyBlocks ? chunk.world.chunkPacketBlockController.getChunkPacketInfo(this, chunk, i) : null; -+ // Paper end - ChunkCoordIntPair chunkcoordintpair = chunk.getPos(); - - this.a = chunkcoordintpair.x; -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { - } - - this.f = new byte[this.a(chunk, i)]; -- this.c = this.a(new PacketDataSerializer(this.j()), chunk, i); -+ // Paper start - Anti-Xray - Add chunk packet info -+ if (chunkPacketInfo != null) { -+ chunkPacketInfo.setData(this.getData()); -+ } -+ this.c = this.writeChunk(new PacketDataSerializer(this.j()), chunk, i, chunkPacketInfo); -+ // Paper end - this.g = Lists.newArrayList(); - iterator = chunk.getTileEntities().entrySet().iterator(); - int totalTileEntities = 0; // Paper -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { - this.g.add(nbttagcompound); - } - } -+ chunk.world.chunkPacketBlockController.modifyBlocks(this, chunkPacketInfo); // Paper - Anti-Xray - Modify blocks -+ } - -+ // Paper start - Async-Anti-Xray - Getter and Setter for the ready flag -+ @Override -+ public boolean isReady() { -+ return this.ready; -+ } -+ -+ public void setReady(boolean ready) { -+ this.ready = ready; - } -+ // Paper end - - @Override - public void a(PacketDataSerializer packetdataserializer) throws IOException { -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { - return bytebuf; - } - -- public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector) { return this.a(packetDataSerializer, chunk, chunkSectionSelector); } // Paper - OBFHELPER -- public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i) { -+ // Paper start - Anti-Xray - Add chunk packet info -+ @Deprecated public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector) { return this.a(packetDataSerializer, chunk, chunkSectionSelector); } // OBFHELPER // Notice for updates: Please make sure this method isn't used anywhere -+ @Deprecated public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i) { return this.writeChunk(packetdataserializer, chunk, i, null); } // Notice for updates: Please make sure this method isn't used anywhere -+ public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector, ChunkPacketInfo<IBlockData> chunkPacketInfo) { return this.a(packetDataSerializer, chunk, chunkSectionSelector, chunkPacketInfo); } // OBFHELPER -+ public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i, ChunkPacketInfo<IBlockData> chunkPacketInfo) { -+ // Paper end - int j = 0; - ChunkSection[] achunksection = chunk.getSections(); - int k = 0; -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { - - if (chunksection != Chunk.a && (!this.f() || !chunksection.c()) && (i & 1 << k) != 0) { - j |= 1 << k; -- chunksection.b(packetdataserializer); -+ chunksection.writeChunkSection(packetdataserializer, chunkPacketInfo); // Paper - Anti-Xray - Add chunk packet info - } - } - -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - } - - this.g(chunkcoordintpair); -- return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a)); -+ return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a, this.world)); // Paper - Anti-Xray - Add parameter - }, this.executor); - } - -@@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - - } - -+ private final void sendChunk(EntityPlayer entityplayer, Packet<?>[] apacket, Chunk chunk) { this.a(entityplayer, apacket, chunk); } // Paper - OBFHELPER - private void a(EntityPlayer entityplayer, Packet<?>[] apacket, Chunk chunk) { - if (apacket[0] == null) { -- apacket[0] = new PacketPlayOutMapChunk(chunk, 65535); -+ apacket[0] = new PacketPlayOutMapChunk(chunk, 65535, chunk.world.chunkPacketBlockController.shouldModify(entityplayer, chunk, 65535)); // Paper - Anti-Xray - Bypass - apacket[1] = new PacketPlayOutLightUpdate(chunk.getPos(), this.lightEngine, true); - } - -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -0,0 +0,0 @@ public class PlayerInteractManager { - } - - } -+ -+ this.world.chunkPacketBlockController.onPlayerLeftClickBlock(this, blockposition, enumdirection); // Paper - Anti-Xray - } - - public void a(BlockPosition blockposition, PacketPlayInBlockDig.EnumPlayerDigType packetplayinblockdig_enumplayerdigtype, String s) { -diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ProtoChunk.java -+++ b/src/main/java/net/minecraft/server/ProtoChunk.java +--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java @@ -0,0 +0,0 @@ public class ProtoChunk implements IChunkAccess { private long s; private final Map<WorldGenStage.Features, BitSet> t; @@ -1413,10 +1445,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } return this.j[i]; -diff --git a/src/main/java/net/minecraft/server/ProtoChunkExtension.java b/src/main/java/net/minecraft/server/ProtoChunkExtension.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ProtoChunkExtension.java -+++ b/src/main/java/net/minecraft/server/ProtoChunkExtension.java +--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java @@ -0,0 +0,0 @@ public class ProtoChunkExtension extends ProtoChunk { private final Chunk a; @@ -1426,60 +1458,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.a = chunk; } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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; +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +@@ -0,0 +0,0 @@ public class ChunkRegionLoader { + byte b0 = nbttagcompound2.getByte("Y"); - import co.aikar.timings.Timing; - import co.aikar.timings.Timings; -+import com.destroystokyo.paper.antixray.ChunkPacketBlockController; // Paper - Anti-Xray -+import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray; // Paper - Anti-Xray - import com.destroystokyo.paper.event.server.ServerExceptionEvent; - import com.destroystokyo.paper.exception.ServerInternalException; - import com.google.common.base.MoreObjects; -@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot + if (nbttagcompound2.hasKeyOfType("Palette", 9) && nbttagcompound2.hasKeyOfType("BlockStates", 12)) { +- ChunkSection chunksection = new ChunkSection(b0 << 4); ++ ChunkSection chunksection = new ChunkSection(b0 << 4, null, worldserver, false); // Paper - Anti-Xray - Add parameters - public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper -+ public final ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray + chunksection.getBlocks().a(nbttagcompound2.getList("Palette", 10), nbttagcompound2.getLongArray("BlockStates")); + chunksection.recalcBlockCounts(); +@@ -0,0 +0,0 @@ public class ChunkRegionLoader { + // CraftBukkit end + }); + } else { +- ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1); ++ ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, worldserver); // Paper - Anti-Xray - Add parameter - public final co.aikar.timings.WorldTimingsHandler timings; // Paper - public static BlockPosition lastPhysicsProblem; // Spigot -@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - return typeKey; - } - -- protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, final DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { -+ protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, final DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot - this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((WorldDataServer) worlddatamutable).getName(), this.spigotConfig); // Paper -+ this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray - this.generator = gen; - this.world = new CraftWorld((WorldServer) this, gen, env); - this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit -@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - // CraftBukkit end - - IBlockData iblockdata1 = chunk.setType(blockposition, iblockdata, (i & 64) != 0, (i & 1024) == 0); // CraftBukkit custom NO_PLACE flag -+ this.chunkPacketBlockController.onBlockChange(this, blockposition, iblockdata, iblockdata1, i); // Paper - Anti-Xray - - if (iblockdata1 == null) { - // CraftBukkit start - remove blockstate if failed (or the same) -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - - // Add env and gen to constructor, WorldData -> WorldDataServer - public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { -- super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env); -+ super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor - this.pvpMode = minecraftserver.getPVP(); - convertable = convertable_conversionsession; - uuid = WorldUUID.getUUID(convertable_conversionsession.folder.toFile()); + protochunk.a(biomestorage); + object = protochunk; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -1492,13 +1492,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private static final DataPaletteBlock<IBlockData> emptyBlockIDs = new ChunkSection(0, null, null, true).getBlocks(); // Paper - Anti-Xray - Add parameters private static final byte[] emptyLight = new byte[2048]; - public CraftChunk(net.minecraft.server.Chunk chunk) { + public CraftChunk(net.minecraft.world.level.chunk.Chunk chunk) { @@ -0,0 +0,0 @@ public class CraftChunk implements Chunk { NBTTagCompound data = new NBTTagCompound(); cs[i].getBlocks().a(data, "Palette", "BlockStates"); -- DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData()); // TODO: snapshot whole ChunkSection -+ DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData(), null, false); // TODO: snapshot whole ChunkSection // Paper - Anti-Xray - Add no predefined block data and don't initialize because it's done in the line below internally +- DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.world.level.block.Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData()); // TODO: snapshot whole ChunkSection ++ DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.world.level.block.Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData(), null, false); // TODO: snapshot whole ChunkSection // Paper - Anti-Xray - Add no predefined block data and don't initialize because it's done in the line below internally blockids.a(data.getList("Palette", CraftMagicNumbers.NBT.TAG_COMPOUND), data.getLongArray("BlockStates")); sectionBlockIDs[i] = blockids; diff --git a/Spigot-Server-Patches/AnvilDamageEvent.patch b/Spigot-Server-Patches/AnvilDamageEvent.patch index 68fe5cac77..3e0d4b69e2 100644 --- a/Spigot-Server-Patches/AnvilDamageEvent.patch +++ b/Spigot-Server-Patches/AnvilDamageEvent.patch @@ -4,10 +4,10 @@ Date: Fri, 20 Jul 2018 23:37:03 -0500 Subject: [PATCH] AnvilDamageEvent -diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java b/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ContainerAnvil.java -+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java +--- a/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java @@ -0,0 +0,0 @@ public class ContainerAnvil extends ContainerAnvilAbstract { if (!entityhuman.abilities.canInstantlyBuild && iblockdata.a((Tag) TagsBlock.ANVIL) && entityhuman.getRandom().nextFloat() < 0.12F) { diff --git a/Spigot-Server-Patches/Async-command-map-building.patch b/Spigot-Server-Patches/Async-command-map-building.patch index 742ed9faf1..3c4300ae4f 100644 --- a/Spigot-Server-Patches/Async-command-map-building.patch +++ b/Spigot-Server-Patches/Async-command-map-building.patch @@ -4,10 +4,10 @@ Date: Wed, 8 Apr 2020 02:42:14 -0500 Subject: [PATCH] Async command map building -diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java +diff --git a/src/main/java/net/minecraft/commands/CommandDispatcher.java b/src/main/java/net/minecraft/commands/CommandDispatcher.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CommandDispatcher.java -+++ b/src/main/java/net/minecraft/server/CommandDispatcher.java +--- a/src/main/java/net/minecraft/commands/CommandDispatcher.java ++++ b/src/main/java/net/minecraft/commands/CommandDispatcher.java @@ -0,0 +0,0 @@ public class CommandDispatcher { if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot // CraftBukkit start diff --git a/Spigot-Server-Patches/AsyncTabCompleteEvent.patch b/Spigot-Server-Patches/AsyncTabCompleteEvent.patch index 5fa430455d..17de52ce5d 100644 --- a/Spigot-Server-Patches/AsyncTabCompleteEvent.patch +++ b/Spigot-Server-Patches/AsyncTabCompleteEvent.patch @@ -13,10 +13,10 @@ completion, such as offline players. Also adds isCommand and getLocation to the sync TabCompleteEvent -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override diff --git a/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch b/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch index 0975370b59..5be203836d 100644 --- a/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch +++ b/Spigot-Server-Patches/Asynchronous-chunk-IO-and-loading.patch @@ -2299,10 +2299,62 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + +} -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInTabComplete.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInTabComplete.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInTabComplete.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInTabComplete.java +@@ -0,0 +0,0 @@ public class PacketPlayInTabComplete implements Packet<PacketListenerPlayIn> { + @Override + public void a(PacketDataSerializer packetdataserializer) throws IOException { + this.a = packetdataserializer.i(); +- this.b = packetdataserializer.e(32500); ++ this.b = packetdataserializer.e(2048); + } + + @Override +diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/MCUtil.java ++++ b/src/main/java/net/minecraft/server/MCUtil.java +@@ -0,0 +0,0 @@ public final class MCUtil { + out.print(fileData); + } + } ++ ++ public static int getTicketLevelFor(ChunkStatus status) { ++ // TODO make sure the constant `33` is correct on future updates. See getChunkAt(int, int, ChunkStatus, boolean) ++ return 33 + ChunkStatus.getTicketLevelOffset(status); ++ } + } +diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/Main.java ++++ b/src/main/java/net/minecraft/server/Main.java +@@ -0,0 +0,0 @@ public class Main { + + convertable_conversionsession.a((IRegistryCustom) iregistrycustom_dimension, (SaveData) object); + */ ++ Class.forName("net.minecraft.server.VillagerTrades");// Paper - load this sync so it won't fail later async + final DedicatedServer dedicatedserver = (DedicatedServer) MinecraftServer.a((thread) -> { + DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, datapackconfiguration1, thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, null, dedicatedserversettings, DataConverterRegistry.a(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new); + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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<TickTas + this.getUserCache().b(false); // Paper + } + // Spigot end +- ++ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.close(true, true); // Paper + } + + public String getServerIp() { +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { return playerChunk.getAvailableChunkNow(); @@ -2486,525 +2538,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } finally { playerChunkMap.callbackExecutor.run(); -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet; - import it.unimi.dsi.fastutil.longs.LongSet; - import it.unimi.dsi.fastutil.shorts.ShortList; - import it.unimi.dsi.fastutil.shorts.ShortListIterator; -+import java.util.ArrayDeque; // Paper - import java.util.Arrays; - import java.util.BitSet; - import java.util.EnumSet; -@@ -0,0 +0,0 @@ public class ChunkRegionLoader { - - private static final Logger LOGGER = LogManager.getLogger(); - -+ // Paper start -+ public static final class InProgressChunkHolder { -+ -+ public final ProtoChunk protoChunk; -+ public final ArrayDeque<Runnable> tasks; -+ -+ public NBTTagCompound poiData; -+ -+ public InProgressChunkHolder(final ProtoChunk protoChunk, final ArrayDeque<Runnable> tasks) { -+ this.protoChunk = protoChunk; -+ this.tasks = tasks; -+ } -+ } -+ - public static ProtoChunk loadChunk(WorldServer worldserver, DefinedStructureManager definedstructuremanager, VillagePlace villageplace, ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) { -+ InProgressChunkHolder holder = loadChunk(worldserver, definedstructuremanager, villageplace, chunkcoordintpair, nbttagcompound, true); -+ holder.tasks.forEach(Runnable::run); -+ return holder.protoChunk; -+ } -+ -+ public static InProgressChunkHolder loadChunk(WorldServer worldserver, DefinedStructureManager definedstructuremanager, VillagePlace villageplace, ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound, boolean distinguish) { -+ ArrayDeque<Runnable> tasksToExecuteOnMain = new ArrayDeque<>(); -+ // Paper end - ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator(); - WorldChunkManager worldchunkmanager = chunkgenerator.getWorldChunkManager(); - NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level"); -@@ -0,0 +0,0 @@ public class ChunkRegionLoader { - LightEngine lightengine = chunkproviderserver.getLightEngine(); - - if (flag) { -- lightengine.b(chunkcoordintpair, true); -+ tasksToExecuteOnMain.add(() -> { // Paper - delay this task since we're executing off-main -+ lightengine.b(chunkcoordintpair, true); -+ }); // Paper - delay this task since we're executing off-main - } - - for (int i = 0; i < nbttaglist.size(); ++i) { -@@ -0,0 +0,0 @@ public class ChunkRegionLoader { - achunksection[b0] = chunksection; - } - -- villageplace.a(chunkcoordintpair, chunksection); -+ tasksToExecuteOnMain.add(() -> { // Paper - delay this task since we're executing off-main -+ villageplace.a(chunkcoordintpair, chunksection); -+ }); // Paper - delay this task since we're executing off-main - } - - if (flag) { - if (nbttagcompound2.hasKeyOfType("BlockLight", 7)) { -- lightengine.a(EnumSkyBlock.BLOCK, SectionPosition.a(chunkcoordintpair, b0), new NibbleArray(nbttagcompound2.getByteArray("BlockLight")), true); -+ // Paper start - delay this task since we're executing off-main -+ NibbleArray blockLight = new NibbleArray(nbttagcompound2.getByteArray("BlockLight")); -+ tasksToExecuteOnMain.add(() -> { -+ lightengine.a(EnumSkyBlock.BLOCK, SectionPosition.a(chunkcoordintpair, b0), blockLight, true); -+ }); -+ // Paper end - delay this task since we're executing off-main - } - - if (flag2 && nbttagcompound2.hasKeyOfType("SkyLight", 7)) { -- lightengine.a(EnumSkyBlock.SKY, SectionPosition.a(chunkcoordintpair, b0), new NibbleArray(nbttagcompound2.getByteArray("SkyLight")), true); -+ // Paper start - delay this task since we're executing off-main -+ NibbleArray skyLight = new NibbleArray(nbttagcompound2.getByteArray("SkyLight")); -+ tasksToExecuteOnMain.add(() -> { -+ lightengine.a(EnumSkyBlock.SKY, SectionPosition.a(chunkcoordintpair, b0), skyLight, true); -+ }); -+ // Paper end - delay this task since we're executing off-main - } - } - } -@@ -0,0 +0,0 @@ public class ChunkRegionLoader { - } - - if (chunkstatus_type == ChunkStatus.Type.LEVELCHUNK) { -- return new ProtoChunkExtension((Chunk) object); -+ return new InProgressChunkHolder(new ProtoChunkExtension((Chunk) object), tasksToExecuteOnMain); // Paper - Async chunk loading - } else { - ProtoChunk protochunk1 = (ProtoChunk) object; - -@@ -0,0 +0,0 @@ public class ChunkRegionLoader { - protochunk1.a(worldgenstage_features, BitSet.valueOf(nbttagcompound5.getByteArray(s1))); - } - -- return protochunk1; -+ return new InProgressChunkHolder(protochunk1, tasksToExecuteOnMain); // Paper - Async chunk loading -+ } -+ } -+ -+ // Paper start - async chunk save for unload -+ public static final class AsyncSaveData { -+ public final NibbleArray[] blockLight; // null or size of 17 (for indices -1 through 15) -+ public final NibbleArray[] skyLight; -+ -+ public final NBTTagList blockTickList; // non-null if we had to go to the server's tick list -+ public final NBTTagList fluidTickList; // non-null if we had to go to the server's tick list -+ -+ public final long worldTime; -+ -+ public AsyncSaveData(NibbleArray[] blockLight, NibbleArray[] skyLight, NBTTagList blockTickList, NBTTagList fluidTickList, -+ long worldTime) { -+ this.blockLight = blockLight; -+ this.skyLight = skyLight; -+ this.blockTickList = blockTickList; -+ this.fluidTickList = fluidTickList; -+ this.worldTime = worldTime; - } - } - -+ // must be called sync -+ public static AsyncSaveData getAsyncSaveData(WorldServer world, IChunkAccess chunk) { -+ org.spigotmc.AsyncCatcher.catchOp("preparation of chunk data for async save"); -+ ChunkCoordIntPair chunkPos = chunk.getPos(); -+ -+ LightEngineThreaded lightenginethreaded = world.getChunkProvider().getLightEngine(); -+ -+ NibbleArray[] blockLight = new NibbleArray[17 - (-1)]; -+ NibbleArray[] skyLight = new NibbleArray[17 - (-1)]; -+ -+ for (int i = -1; i < 17; ++i) { -+ NibbleArray blockArray = lightenginethreaded.a(EnumSkyBlock.BLOCK).a(SectionPosition.a(chunkPos, i)); -+ NibbleArray skyArray = lightenginethreaded.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkPos, i)); -+ -+ // copy data for safety -+ if (blockArray != null) { -+ blockArray = blockArray.copy(); -+ } -+ if (skyArray != null) { -+ skyArray = skyArray.copy(); -+ } -+ -+ // apply offset of 1 for -1 starting index -+ blockLight[i + 1] = blockArray; -+ skyLight[i + 1] = skyArray; -+ } -+ -+ TickList<Block> blockTickList = chunk.n(); -+ -+ NBTTagList blockTickListSerialized; -+ if (blockTickList instanceof ProtoChunkTickList || blockTickList instanceof TickListChunk) { -+ blockTickListSerialized = null; -+ } else { -+ blockTickListSerialized = world.getBlockTickList().a(chunkPos); -+ } -+ -+ TickList<FluidType> fluidTickList = chunk.o(); -+ -+ NBTTagList fluidTickListSerialized; -+ if (fluidTickList instanceof ProtoChunkTickList || fluidTickList instanceof TickListChunk) { -+ fluidTickListSerialized = null; -+ } else { -+ fluidTickListSerialized = world.getFluidTickList().a(chunkPos); -+ } -+ -+ return new AsyncSaveData(blockLight, skyLight, blockTickListSerialized, fluidTickListSerialized, world.getTime()); -+ } -+ - public static NBTTagCompound saveChunk(WorldServer worldserver, IChunkAccess ichunkaccess) { -+ return saveChunk(worldserver, ichunkaccess, null); -+ } -+ public static NBTTagCompound saveChunk(WorldServer worldserver, IChunkAccess ichunkaccess, AsyncSaveData asyncsavedata) { -+ // Paper end - ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos(); - NBTTagCompound nbttagcompound = new NBTTagCompound(); - NBTTagCompound nbttagcompound1 = new NBTTagCompound(); -@@ -0,0 +0,0 @@ public class ChunkRegionLoader { - nbttagcompound.set("Level", nbttagcompound1); - nbttagcompound1.setInt("xPos", chunkcoordintpair.x); - nbttagcompound1.setInt("zPos", chunkcoordintpair.z); -- nbttagcompound1.setLong("LastUpdate", worldserver.getTime()); -+ nbttagcompound1.setLong("LastUpdate", asyncsavedata != null ? asyncsavedata.worldTime : worldserver.getTime()); // Paper - async chunk unloading - nbttagcompound1.setLong("InhabitedTime", ichunkaccess.getInhabitedTime()); - nbttagcompound1.setString("Status", ichunkaccess.getChunkStatus().d()); - ChunkConverter chunkconverter = ichunkaccess.p(); -@@ -0,0 +0,0 @@ public class ChunkRegionLoader { - - NBTTagCompound nbttagcompound2; - -- for (int i = -1; i < 17; ++i) { -+ for (int i = -1; i < 17; ++i) { // Paper - conflict on loop parameter change - int finalI = i; // CraftBukkit - decompile errors - ChunkSection chunksection = (ChunkSection) Arrays.stream(achunksection).filter((chunksection1) -> { - return chunksection1 != null && chunksection1.getYPosition() >> 4 == finalI; // CraftBukkit - decompile errors - }).findFirst().orElse(Chunk.a); -- NibbleArray nibblearray = lightenginethreaded.a(EnumSkyBlock.BLOCK).a(SectionPosition.a(chunkcoordintpair, i)); -- NibbleArray nibblearray1 = lightenginethreaded.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkcoordintpair, i)); -- -+ // Paper start - async chunk save for unload -+ NibbleArray nibblearray; // block light -+ NibbleArray nibblearray1; // sky light -+ if (asyncsavedata == null) { -+ nibblearray = lightenginethreaded.a(EnumSkyBlock.BLOCK).a(SectionPosition.a(chunkcoordintpair, i)); /// Paper - diff on method change (see getAsyncSaveData) -+ nibblearray1 = lightenginethreaded.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkcoordintpair, i)); // Paper - diff on method change (see getAsyncSaveData) -+ } else { -+ nibblearray = asyncsavedata.blockLight[i + 1]; // +1 to offset the -1 starting index -+ nibblearray1 = asyncsavedata.skyLight[i + 1]; // +1 to offset the -1 starting index -+ } -+ // Paper end - if (chunksection != Chunk.a || nibblearray != null || nibblearray1 != null) { - nbttagcompound2 = new NBTTagCompound(); - nbttagcompound2.setByte("Y", (byte) (i & 255)); -@@ -0,0 +0,0 @@ public class ChunkRegionLoader { - Entity entity = (Entity) iterator1.next(); - 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 (asyncsavedata == null && !entity.dead && (int) Math.floor(entity.locX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.locZ()) >> 4 != chunk.getPos().z) { - toUpdate.add(entity); - continue; - } -@@ -0,0 +0,0 @@ public class ChunkRegionLoader { - } - - nbttagcompound1.set("Entities", nbttaglist2); -- TickList<Block> ticklist = ichunkaccess.n(); -+ TickList<Block> ticklist = ichunkaccess.n(); // Paper - diff on method change (see getAsyncSaveData) - - if (ticklist instanceof ProtoChunkTickList) { - nbttagcompound1.set("ToBeTicked", ((ProtoChunkTickList) ticklist).b()); - } else if (ticklist instanceof TickListChunk) { - nbttagcompound1.set("TileTicks", ((TickListChunk) ticklist).b()); -+ // Paper start - async chunk save for unload -+ } else if (asyncsavedata != null) { -+ nbttagcompound1.set("TileTicks", asyncsavedata.blockTickList); -+ // Paper end - } else { -- nbttagcompound1.set("TileTicks", worldserver.getBlockTickList().a(chunkcoordintpair)); -+ nbttagcompound1.set("TileTicks", worldserver.getBlockTickList().a(chunkcoordintpair)); // Paper - diff on method change (see getAsyncSaveData) - } - -- TickList<FluidType> ticklist1 = ichunkaccess.o(); -+ TickList<FluidType> ticklist1 = ichunkaccess.o(); // Paper - diff on method change (see getAsyncSaveData) - - if (ticklist1 instanceof ProtoChunkTickList) { - nbttagcompound1.set("LiquidsToBeTicked", ((ProtoChunkTickList) ticklist1).b()); - } else if (ticklist1 instanceof TickListChunk) { - nbttagcompound1.set("LiquidTicks", ((TickListChunk) ticklist1).b()); -+ // Paper start - async chunk save for unload -+ } else if (asyncsavedata != null) { -+ nbttagcompound1.set("LiquidTicks", asyncsavedata.fluidTickList); -+ // Paper end - } else { -- nbttagcompound1.set("LiquidTicks", worldserver.getFluidTickList().a(chunkcoordintpair)); -+ nbttagcompound1.set("LiquidTicks", worldserver.getFluidTickList().a(chunkcoordintpair)); // Paper - diff on method change (see getAsyncSaveData) - } - - nbttagcompound1.set("PostProcessing", a(ichunkaccess.l())); -diff --git a/src/main/java/net/minecraft/server/ChunkStatus.java b/src/main/java/net/minecraft/server/ChunkStatus.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkStatus.java -+++ b/src/main/java/net/minecraft/server/ChunkStatus.java -@@ -0,0 +0,0 @@ public class ChunkStatus { - return ChunkStatus.q.size(); - } - -+ public static int getTicketLevelOffset(ChunkStatus status) { return ChunkStatus.a(status); } // Paper - OBFHELPER - public static int a(ChunkStatus chunkstatus) { - return ChunkStatus.r.getInt(chunkstatus.c()); - } -@@ -0,0 +0,0 @@ public class ChunkStatus { - this.t = chunkstatus == null ? 0 : chunkstatus.c() + 1; - } - -+ public final int getStatusIndex() { return c(); } // Paper - OBFHELPER - public int c() { - return this.t; - } -@@ -0,0 +0,0 @@ public class ChunkStatus { - return this.s; - } - -- public ChunkStatus getPreviousStatus() { return this.e(); } // Paper - OBFHELPER -+ public final ChunkStatus getPreviousStatus() { return this.e(); } // Paper - OBFHELPER - public ChunkStatus e() { - return this.u; - } -@@ -0,0 +0,0 @@ public class ChunkStatus { - return this.w.doWork(this, worldserver, definedstructuremanager, lightenginethreaded, function, ichunkaccess); - } - -+ public final int getNeighborRadius() { return this.f(); } // Paper - OBFHELPER - public int f() { - return this.x; - } -@@ -0,0 +0,0 @@ public class ChunkStatus { - return this.z; - } - -+ public final boolean isAtLeastStatus(ChunkStatus chunkstatus) { return b(chunkstatus); } // Paper - OBFHELPER - public boolean b(ChunkStatus chunkstatus) { - return this.c() >= chunkstatus.c(); - } -diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -+++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -@@ -0,0 +0,0 @@ public abstract class IAsyncTaskHandler<R extends Runnable> implements Mailbox<R - - } - -- protected void executeAll() { -+ public void executeAll() { // Paper - protected -> public - while (this.executeNext()) { - ; - } -diff --git a/src/main/java/net/minecraft/server/IChunkLoader.java b/src/main/java/net/minecraft/server/IChunkLoader.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IChunkLoader.java -+++ b/src/main/java/net/minecraft/server/IChunkLoader.java -@@ -0,0 +0,0 @@ package net.minecraft.server; - import com.mojang.datafixers.DataFixer; - import java.io.File; - import java.io.IOException; -+// Paper start -+import java.util.concurrent.CompletableFuture; -+import java.util.concurrent.CompletionException; -+// Paper end - import java.util.function.Supplier; - import javax.annotation.Nullable; - - public class IChunkLoader implements AutoCloseable { - -- private final IOWorker a; public IOWorker getIOWorker() { return a; } // Paper - OBFHELPER -+ // Paper - OBFHELPER - nuke IOWorker - protected final DataFixer b; - @Nullable -- private PersistentStructureLegacy c; -+ private volatile PersistentStructureLegacy c; // Paper - async chunk loading -+ -+ private final Object persistentDataLock = new Object(); // Paper -+ protected final RegionFileCache regionFileCache; - - public IChunkLoader(File file, DataFixer datafixer, boolean flag) { -+ this.regionFileCache = new RegionFileCache(file, flag); // Paper - nuke IOWorker - this.b = datafixer; -- this.a = new IOWorker(file, flag, "chunk"); -+ // Paper - nuke IOWorker - } - - // CraftBukkit start - private boolean check(ChunkProviderServer cps, int x, int z) throws IOException { - ChunkCoordIntPair pos = new ChunkCoordIntPair(x, z); - if (cps != null) { -- com.google.common.base.Preconditions.checkState(org.bukkit.Bukkit.isPrimaryThread(), "primary thread"); -- if (cps.isLoaded(x, z)) { -+ //com.google.common.base.Preconditions.checkState(org.bukkit.Bukkit.isPrimaryThread(), "primary thread"); // Paper - this function is now MT-Safe -+ if (cps.getChunkAtIfCachedImmediately(x, z) != null) { // Paper - isLoaded is a ticket level check, not a chunk loaded check! - return true; - } - } - -- NBTTagCompound nbt = read(pos); -- if (nbt != null) { -- NBTTagCompound level = nbt.getCompound("Level"); -- if (level.getBoolean("TerrainPopulated")) { -- return true; -- } -+ -+ // Paper start - prioritize -+ NBTTagCompound nbt = cps == null ? read(pos) : -+ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.loadChunkData((WorldServer)cps.getWorld(), x, z, -+ com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHER_PRIORITY, false, true).chunkData; -+ // Paper end -+ if (nbt != null) { -+ NBTTagCompound level = nbt.getCompound("Level"); -+ if (level.getBoolean("TerrainPopulated")) { -+ return true; -+ } - - ChunkStatus status = ChunkStatus.a(level.getString("Status")); - if (status != null && status.b(ChunkStatus.FEATURES)) { -@@ -0,0 +0,0 @@ public class IChunkLoader implements AutoCloseable { - if (i < 1493) { - nbttagcompound = GameProfileSerializer.a(this.b, DataFixTypes.CHUNK, nbttagcompound, i, 1493); - if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) { -+ synchronized (this.persistentDataLock) { // Paper - Async chunk loading - if (this.c == null) { - this.c = PersistentStructureLegacy.a(resourcekey, (WorldPersistentData) supplier.get()); - } - - nbttagcompound = this.c.a(nbttagcompound); -+ } // Paper - Async chunk loading - } - } - -@@ -0,0 +0,0 @@ public class IChunkLoader implements AutoCloseable { - - @Nullable - public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException { -- return this.a.a(chunkcoordintpair); -+ return this.regionFileCache.read(chunkcoordintpair); - } - -- public void a(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) { -- this.a.a(chunkcoordintpair, nbttagcompound); -+ public void a(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { write(chunkcoordintpair, nbttagcompound); } // Paper OBFHELPER -+ public void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { // Paper - OBFHELPER - (Switched around for safety) -+ this.regionFileCache.write(chunkcoordintpair, nbttagcompound); - if (this.c != null) { -+ synchronized (this.persistentDataLock) { // Paper - Async chunk loading - this.c.a(chunkcoordintpair.pair()); -+ } // Paper - Async chunk loading} - } -- -- } -- -- public void i() { -- this.a.a().join(); - } - - public void close() throws IOException { -- this.a.close(); -+ this.regionFileCache.close(); - } - } -diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MCUtil.java -+++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -0,0 +0,0 @@ public final class MCUtil { - out.print(fileData); - } - } -+ -+ public static int getTicketLevelFor(ChunkStatus status) { -+ // TODO make sure the constant `33` is correct on future updates. See getChunkAt(int, int, ChunkStatus, boolean) -+ return 33 + ChunkStatus.getTicketLevelOffset(status); -+ } - } -diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Main.java -+++ b/src/main/java/net/minecraft/server/Main.java -@@ -0,0 +0,0 @@ public class Main { - - convertable_conversionsession.a((IRegistryCustom) iregistrycustom_dimension, (SaveData) object); - */ -+ Class.forName("net.minecraft.server.VillagerTrades");// Paper - load this sync so it won't fail later async - final DedicatedServer dedicatedserver = (DedicatedServer) MinecraftServer.a((thread) -> { - DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, datapackconfiguration1, thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, null, dedicatedserversettings, DataConverterRegistry.a(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new); - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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<TickTas - this.getUserCache().b(false); // Paper - } - // Spigot end -- -+ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.close(true, true); // Paper - } - - public String getServerIp() { -diff --git a/src/main/java/net/minecraft/server/NextTickListEntry.java b/src/main/java/net/minecraft/server/NextTickListEntry.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NextTickListEntry.java -+++ b/src/main/java/net/minecraft/server/NextTickListEntry.java -@@ -0,0 +0,0 @@ import java.util.Comparator; - - public class NextTickListEntry<T> { - -- private static long d; -+ private static final java.util.concurrent.atomic.AtomicLong COUNTER = new java.util.concurrent.atomic.AtomicLong(); // Paper - async chunk loading - private final T e; - public final BlockPosition a; - public final long b; -@@ -0,0 +0,0 @@ public class NextTickListEntry<T> { - } - - public NextTickListEntry(BlockPosition blockposition, T t0, long i, TickListPriority ticklistpriority) { -- this.f = (long) (NextTickListEntry.d++); -+ this.f = (long) (NextTickListEntry.COUNTER.getAndIncrement()); // Paper - async chunk loading - this.a = blockposition.immutableCopy(); - this.e = t0; - this.b = i; -diff --git a/src/main/java/net/minecraft/server/NibbleArray.java b/src/main/java/net/minecraft/server/NibbleArray.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NibbleArray.java -+++ b/src/main/java/net/minecraft/server/NibbleArray.java -@@ -0,0 +0,0 @@ public class NibbleArray { - return this.a; - } - -+ public NibbleArray copy() { return this.b(); } // Paper - OBFHELPER - public NibbleArray b() { - return this.a == null ? new NibbleArray() : new NibbleArray((byte[]) this.a.clone()); - } -diff --git a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -@@ -0,0 +0,0 @@ public class PacketPlayInTabComplete implements Packet<PacketListenerPlayIn> { - @Override - public void a(PacketDataSerializer packetdataserializer) throws IOException { - this.a = packetdataserializer.i(); -- this.b = packetdataserializer.e(32500); -+ this.b = packetdataserializer.e(2048); - } - - @Override -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { } return null; @@ -3046,10 +2583,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for (int i = flag1 ? chunkstatus1.c() + 1 : 0; i <= chunkstatus.c(); ++i) { completablefuture = (CompletableFuture) this.statusFutures.get(i); if (completablefuture != null) { -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private final LightEngineThreaded lightEngine; private final IAsyncTaskHandler<Runnable> executor; @@ -3496,10 +3033,127 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected VillagePlace h() { return this.m; } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/level/TicketType.java ++++ b/src/main/java/net/minecraft/server/level/TicketType.java +@@ -0,0 +0,0 @@ public class TicketType<T> { + public static final TicketType<Unit> PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit + public static final TicketType<org.bukkit.plugin.Plugin> PLUGIN_TICKET = a("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit + public static final TicketType<Long> FUTURE_AWAIT = a("future_await", Long::compareTo); // Paper ++ public static final TicketType<Long> ASYNC_LOAD = a("async_load", Long::compareTo); // Paper + + public static <T> TicketType<T> a(String s, Comparator<T> comparator) { + return new TicketType<>(s, comparator, 0L); +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + return this.chunkProvider.getChunkAt(x, z, false); + } + ++ // Paper start - Asynchronous IO ++ public final com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController poiDataController = new com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController() { ++ @Override ++ public void writeData(int x, int z, NBTTagCompound compound) throws java.io.IOException { ++ WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace().write(new ChunkCoordIntPair(x, z), compound); ++ } ++ ++ @Override ++ public NBTTagCompound readData(int x, int z) throws java.io.IOException { ++ return WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace().read(new ChunkCoordIntPair(x, z)); ++ } ++ ++ @Override ++ public <T> T computeForRegionFile(int chunkX, int chunkZ, java.util.function.Function<RegionFile, T> function) { ++ synchronized (WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace()) { ++ RegionFile file; ++ ++ try { ++ file = WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace().getFile(new ChunkCoordIntPair(chunkX, chunkZ), false); ++ } catch (java.io.IOException ex) { ++ throw new RuntimeException(ex); ++ } ++ ++ return function.apply(file); ++ } ++ } ++ ++ @Override ++ public <T> T computeForRegionFileIfLoaded(int chunkX, int chunkZ, java.util.function.Function<RegionFile, T> function) { ++ synchronized (WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace()) { ++ RegionFile file = WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace().getRegionFileIfLoaded(new ChunkCoordIntPair(chunkX, chunkZ)); ++ return function.apply(file); ++ } ++ } ++ }; ++ ++ public final com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController chunkDataController = new com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController() { ++ @Override ++ public void writeData(int x, int z, NBTTagCompound compound) throws java.io.IOException { ++ WorldServer.this.getChunkProvider().playerChunkMap.write(new ChunkCoordIntPair(x, z), compound); ++ } ++ ++ @Override ++ public NBTTagCompound readData(int x, int z) throws java.io.IOException { ++ return WorldServer.this.getChunkProvider().playerChunkMap.read(new ChunkCoordIntPair(x, z)); ++ } ++ ++ @Override ++ public <T> T computeForRegionFile(int chunkX, int chunkZ, java.util.function.Function<RegionFile, T> function) { ++ synchronized (WorldServer.this.getChunkProvider().playerChunkMap) { ++ RegionFile file; ++ ++ try { ++ file = WorldServer.this.getChunkProvider().playerChunkMap.regionFileCache.getFile(new ChunkCoordIntPair(chunkX, chunkZ), false); ++ } catch (java.io.IOException ex) { ++ throw new RuntimeException(ex); ++ } ++ ++ return function.apply(file); ++ } ++ } ++ ++ @Override ++ public <T> T computeForRegionFileIfLoaded(int chunkX, int chunkZ, java.util.function.Function<RegionFile, T> function) { ++ synchronized (WorldServer.this.getChunkProvider().playerChunkMap) { ++ RegionFile file = WorldServer.this.getChunkProvider().playerChunkMap.regionFileCache.getRegionFileIfLoaded(new ChunkCoordIntPair(chunkX, chunkZ)); ++ return function.apply(file); ++ } ++ } ++ }; ++ public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager; ++ // Paper end ++ + // Add env and gen to constructor, WorldData -> WorldDataServer + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { + super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + this.dragonBattle = null; + } + this.getServer().addWorld(this.getWorld()); // CraftBukkit ++ ++ this.asyncChunkTaskManager = new com.destroystokyo.paper.io.chunk.ChunkTaskManager(this); // Paper + } + + // CraftBukkit start +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + } + + MCUtil.getSpiralOutChunks(spawn, radiusInBlocks >> 4).forEach(pair -> { +- getChunkProvider().getChunkAtMainThread(pair.x, pair.z); ++ getChunkProvider().getChunkAtAsynchronously(pair.x, pair.z, true, false).exceptionally((ex) -> { ++ ex.printStackTrace(); ++ return null; ++ }); + }); + } + public void removeTicketsForSpawn(int radiusInBlocks, BlockPosition spawn) { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { minecraftServer.scheduleOnMain(() -> this.disconnect(new ChatMessage("disconnect.spam", new Object[0]))); // Paper return; @@ -3514,10 +3168,557 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end StringReader stringreader = new StringReader(packetplayintabcomplete.c()); -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java +diff --git a/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java b/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java +--- a/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java ++++ b/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java +@@ -0,0 +0,0 @@ public abstract class IAsyncTaskHandler<R extends Runnable> implements Mailbox<R + + } + +- protected void executeAll() { ++ public void executeAll() { // Paper - protected -> public + while (this.executeNext()) { + ; + } +diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java ++++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java +@@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { + private final VillagePlace.a a = new VillagePlace.a(); + private final LongSet b = new LongOpenHashSet(); + ++ private final WorldServer world; // Paper ++ + public VillagePlace(File file, DataFixer datafixer, boolean flag) { ++ // Paper start - add world parameter ++ this(file, datafixer, flag, null); ++ } ++ public VillagePlace(File file, DataFixer datafixer, boolean flag, WorldServer world) { + super(file, VillagePlaceSection::a, VillagePlaceSection::new, datafixer, DataFixTypes.POI_CHUNK, flag); ++ this.world = world; ++ // Paper end - add world parameter + } + + public void a(BlockPosition blockposition, VillagePlaceType villageplacetype) { +@@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { + + @Override + public void a(BooleanSupplier booleansupplier) { +- super.a(booleansupplier); ++ // Paper start - async chunk io ++ if (this.world == null) { ++ super.a(booleansupplier); ++ } else { ++ //super.a(booleansupplier); // re-implement below ++ while (!((RegionFileSection)this).d.isEmpty() && booleansupplier.getAsBoolean()) { ++ ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(((RegionFileSection)this).d.firstLong()).r(); ++ ++ NBTTagCompound data; ++ try (co.aikar.timings.Timing ignored1 = this.world.timings.poiSaveDataSerialization.startTiming()) { ++ data = this.getData(chunkcoordintpair); ++ } ++ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world, ++ chunkcoordintpair.x, chunkcoordintpair.z, data, null, com.destroystokyo.paper.io.PrioritizedTaskQueue.LOW_PRIORITY); ++ } ++ } ++ // Paper end + this.a.a(); + } + +@@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { + } + } + ++ // Paper start - Asynchronous chunk io ++ @javax.annotation.Nullable ++ @Override ++ public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws java.io.IOException { ++ if (this.world != null && Thread.currentThread() != com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE) { ++ NBTTagCompound ret = com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE ++ .loadChunkDataAsyncFuture(this.world, chunkcoordintpair.x, chunkcoordintpair.z, com.destroystokyo.paper.io.IOUtil.getPriorityForCurrentThread(), ++ true, false, true).join().poiData; ++ ++ if (ret == com.destroystokyo.paper.io.PaperFileIOThread.FAILURE_VALUE) { ++ throw new java.io.IOException("See logs for further detail"); ++ } ++ return ret; ++ } ++ return super.read(chunkcoordintpair); ++ } ++ ++ @Override ++ public void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws java.io.IOException { ++ if (this.world != null && Thread.currentThread() != com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE) { ++ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave( ++ this.world, chunkcoordintpair.x, chunkcoordintpair.z, nbttagcompound, null, ++ com.destroystokyo.paper.io.IOUtil.getPriorityForCurrentThread()); ++ return; ++ } ++ super.write(chunkcoordintpair, nbttagcompound); ++ } ++ // Paper end ++ + public static enum Occupancy { + + HAS_SPACE(VillagePlaceRecord::d), IS_OCCUPIED(VillagePlaceRecord::e), ANY((villageplacerecord) -> { +diff --git a/src/main/java/net/minecraft/world/level/NextTickListEntry.java b/src/main/java/net/minecraft/world/level/NextTickListEntry.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/NextTickListEntry.java ++++ b/src/main/java/net/minecraft/world/level/NextTickListEntry.java +@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPosition; + + public class NextTickListEntry<T> { + +- private static long d; ++ private static final java.util.concurrent.atomic.AtomicLong COUNTER = new java.util.concurrent.atomic.AtomicLong(); // Paper - async chunk loading + private final T e; + public final BlockPosition a; + public final long b; +@@ -0,0 +0,0 @@ public class NextTickListEntry<T> { + } + + public NextTickListEntry(BlockPosition blockposition, T t0, long i, TickListPriority ticklistpriority) { +- this.f = (long) (NextTickListEntry.d++); ++ this.f = (long) (NextTickListEntry.COUNTER.getAndIncrement()); // Paper - async chunk loading + this.a = blockposition.immutableCopy(); + this.e = t0; + this.b = i; +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java +@@ -0,0 +0,0 @@ public class ChunkStatus { + return ChunkStatus.q.size(); + } + ++ public static int getTicketLevelOffset(ChunkStatus status) { return ChunkStatus.a(status); } // Paper - OBFHELPER + public static int a(ChunkStatus chunkstatus) { + return ChunkStatus.r.getInt(chunkstatus.c()); + } +@@ -0,0 +0,0 @@ public class ChunkStatus { + this.t = chunkstatus == null ? 0 : chunkstatus.c() + 1; + } + ++ public final int getStatusIndex() { return c(); } // Paper - OBFHELPER + public int c() { + return this.t; + } +@@ -0,0 +0,0 @@ public class ChunkStatus { + return this.s; + } + +- public ChunkStatus getPreviousStatus() { return this.e(); } // Paper - OBFHELPER ++ public final ChunkStatus getPreviousStatus() { return this.e(); } // Paper - OBFHELPER + public ChunkStatus e() { + return this.u; + } +@@ -0,0 +0,0 @@ public class ChunkStatus { + return this.w.doWork(this, worldserver, definedstructuremanager, lightenginethreaded, function, ichunkaccess); + } + ++ public final int getNeighborRadius() { return this.f(); } // Paper - OBFHELPER + public int f() { + return this.x; + } +@@ -0,0 +0,0 @@ public class ChunkStatus { + return this.z; + } + ++ public final boolean isAtLeastStatus(ChunkStatus chunkstatus) { return b(chunkstatus); } // Paper - OBFHELPER + public boolean b(ChunkStatus chunkstatus) { + return this.c() >= chunkstatus.c(); + } +diff --git a/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java b/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java ++++ b/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java +@@ -0,0 +0,0 @@ public class NibbleArray { + return this.a; + } + ++ public NibbleArray copy() { return this.b(); } // Paper - OBFHELPER + public NibbleArray b() { + return this.a == null ? new NibbleArray() : new NibbleArray((byte[]) this.a.clone()); + } +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + import it.unimi.dsi.fastutil.longs.LongSet; + import it.unimi.dsi.fastutil.shorts.ShortList; + import it.unimi.dsi.fastutil.shorts.ShortListIterator; ++import java.util.ArrayDeque; // Paper + import java.util.Arrays; + import java.util.BitSet; + import java.util.EnumSet; +@@ -0,0 +0,0 @@ public class ChunkRegionLoader { + + private static final Logger LOGGER = LogManager.getLogger(); + ++ // Paper start ++ public static final class InProgressChunkHolder { ++ ++ public final ProtoChunk protoChunk; ++ public final ArrayDeque<Runnable> tasks; ++ ++ public NBTTagCompound poiData; ++ ++ public InProgressChunkHolder(final ProtoChunk protoChunk, final ArrayDeque<Runnable> tasks) { ++ this.protoChunk = protoChunk; ++ this.tasks = tasks; ++ } ++ } ++ + public static ProtoChunk loadChunk(WorldServer worldserver, DefinedStructureManager definedstructuremanager, VillagePlace villageplace, ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) { ++ InProgressChunkHolder holder = loadChunk(worldserver, definedstructuremanager, villageplace, chunkcoordintpair, nbttagcompound, true); ++ holder.tasks.forEach(Runnable::run); ++ return holder.protoChunk; ++ } ++ ++ public static InProgressChunkHolder loadChunk(WorldServer worldserver, DefinedStructureManager definedstructuremanager, VillagePlace villageplace, ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound, boolean distinguish) { ++ ArrayDeque<Runnable> tasksToExecuteOnMain = new ArrayDeque<>(); ++ // Paper end + ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator(); + WorldChunkManager worldchunkmanager = chunkgenerator.getWorldChunkManager(); + NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level"); +@@ -0,0 +0,0 @@ public class ChunkRegionLoader { + LightEngine lightengine = chunkproviderserver.getLightEngine(); + + if (flag) { +- lightengine.b(chunkcoordintpair, true); ++ tasksToExecuteOnMain.add(() -> { // Paper - delay this task since we're executing off-main ++ lightengine.b(chunkcoordintpair, true); ++ }); // Paper - delay this task since we're executing off-main + } + + for (int i = 0; i < nbttaglist.size(); ++i) { +@@ -0,0 +0,0 @@ public class ChunkRegionLoader { + achunksection[b0] = chunksection; + } + +- villageplace.a(chunkcoordintpair, chunksection); ++ tasksToExecuteOnMain.add(() -> { // Paper - delay this task since we're executing off-main ++ villageplace.a(chunkcoordintpair, chunksection); ++ }); // Paper - delay this task since we're executing off-main + } + + if (flag) { + if (nbttagcompound2.hasKeyOfType("BlockLight", 7)) { +- lightengine.a(EnumSkyBlock.BLOCK, SectionPosition.a(chunkcoordintpair, b0), new NibbleArray(nbttagcompound2.getByteArray("BlockLight")), true); ++ // Paper start - delay this task since we're executing off-main ++ NibbleArray blockLight = new NibbleArray(nbttagcompound2.getByteArray("BlockLight")); ++ tasksToExecuteOnMain.add(() -> { ++ lightengine.a(EnumSkyBlock.BLOCK, SectionPosition.a(chunkcoordintpair, b0), blockLight, true); ++ }); ++ // Paper end - delay this task since we're executing off-main + } + + if (flag2 && nbttagcompound2.hasKeyOfType("SkyLight", 7)) { +- lightengine.a(EnumSkyBlock.SKY, SectionPosition.a(chunkcoordintpair, b0), new NibbleArray(nbttagcompound2.getByteArray("SkyLight")), true); ++ // Paper start - delay this task since we're executing off-main ++ NibbleArray skyLight = new NibbleArray(nbttagcompound2.getByteArray("SkyLight")); ++ tasksToExecuteOnMain.add(() -> { ++ lightengine.a(EnumSkyBlock.SKY, SectionPosition.a(chunkcoordintpair, b0), skyLight, true); ++ }); ++ // Paper end - delay this task since we're executing off-main + } + } + } +@@ -0,0 +0,0 @@ public class ChunkRegionLoader { + } + + if (chunkstatus_type == ChunkStatus.Type.LEVELCHUNK) { +- return new ProtoChunkExtension((Chunk) object); ++ return new InProgressChunkHolder(new ProtoChunkExtension((Chunk) object), tasksToExecuteOnMain); // Paper - Async chunk loading + } else { + ProtoChunk protochunk1 = (ProtoChunk) object; + +@@ -0,0 +0,0 @@ public class ChunkRegionLoader { + protochunk1.a(worldgenstage_features, BitSet.valueOf(nbttagcompound5.getByteArray(s1))); + } + +- return protochunk1; ++ return new InProgressChunkHolder(protochunk1, tasksToExecuteOnMain); // Paper - Async chunk loading ++ } ++ } ++ ++ // Paper start - async chunk save for unload ++ public static final class AsyncSaveData { ++ public final NibbleArray[] blockLight; // null or size of 17 (for indices -1 through 15) ++ public final NibbleArray[] skyLight; ++ ++ public final NBTTagList blockTickList; // non-null if we had to go to the server's tick list ++ public final NBTTagList fluidTickList; // non-null if we had to go to the server's tick list ++ ++ public final long worldTime; ++ ++ public AsyncSaveData(NibbleArray[] blockLight, NibbleArray[] skyLight, NBTTagList blockTickList, NBTTagList fluidTickList, ++ long worldTime) { ++ this.blockLight = blockLight; ++ this.skyLight = skyLight; ++ this.blockTickList = blockTickList; ++ this.fluidTickList = fluidTickList; ++ this.worldTime = worldTime; + } + } + ++ // must be called sync ++ public static AsyncSaveData getAsyncSaveData(WorldServer world, IChunkAccess chunk) { ++ org.spigotmc.AsyncCatcher.catchOp("preparation of chunk data for async save"); ++ ChunkCoordIntPair chunkPos = chunk.getPos(); ++ ++ LightEngineThreaded lightenginethreaded = world.getChunkProvider().getLightEngine(); ++ ++ NibbleArray[] blockLight = new NibbleArray[17 - (-1)]; ++ NibbleArray[] skyLight = new NibbleArray[17 - (-1)]; ++ ++ for (int i = -1; i < 17; ++i) { ++ NibbleArray blockArray = lightenginethreaded.a(EnumSkyBlock.BLOCK).a(SectionPosition.a(chunkPos, i)); ++ NibbleArray skyArray = lightenginethreaded.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkPos, i)); ++ ++ // copy data for safety ++ if (blockArray != null) { ++ blockArray = blockArray.copy(); ++ } ++ if (skyArray != null) { ++ skyArray = skyArray.copy(); ++ } ++ ++ // apply offset of 1 for -1 starting index ++ blockLight[i + 1] = blockArray; ++ skyLight[i + 1] = skyArray; ++ } ++ ++ TickList<Block> blockTickList = chunk.n(); ++ ++ NBTTagList blockTickListSerialized; ++ if (blockTickList instanceof ProtoChunkTickList || blockTickList instanceof TickListChunk) { ++ blockTickListSerialized = null; ++ } else { ++ blockTickListSerialized = world.getBlockTickList().a(chunkPos); ++ } ++ ++ TickList<FluidType> fluidTickList = chunk.o(); ++ ++ NBTTagList fluidTickListSerialized; ++ if (fluidTickList instanceof ProtoChunkTickList || fluidTickList instanceof TickListChunk) { ++ fluidTickListSerialized = null; ++ } else { ++ fluidTickListSerialized = world.getFluidTickList().a(chunkPos); ++ } ++ ++ return new AsyncSaveData(blockLight, skyLight, blockTickListSerialized, fluidTickListSerialized, world.getTime()); ++ } ++ + public static NBTTagCompound saveChunk(WorldServer worldserver, IChunkAccess ichunkaccess) { ++ return saveChunk(worldserver, ichunkaccess, null); ++ } ++ public static NBTTagCompound saveChunk(WorldServer worldserver, IChunkAccess ichunkaccess, AsyncSaveData asyncsavedata) { ++ // Paper end + ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos(); + NBTTagCompound nbttagcompound = new NBTTagCompound(); + NBTTagCompound nbttagcompound1 = new NBTTagCompound(); +@@ -0,0 +0,0 @@ public class ChunkRegionLoader { + nbttagcompound.set("Level", nbttagcompound1); + nbttagcompound1.setInt("xPos", chunkcoordintpair.x); + nbttagcompound1.setInt("zPos", chunkcoordintpair.z); +- nbttagcompound1.setLong("LastUpdate", worldserver.getTime()); ++ nbttagcompound1.setLong("LastUpdate", asyncsavedata != null ? asyncsavedata.worldTime : worldserver.getTime()); // Paper - async chunk unloading + nbttagcompound1.setLong("InhabitedTime", ichunkaccess.getInhabitedTime()); + nbttagcompound1.setString("Status", ichunkaccess.getChunkStatus().d()); + ChunkConverter chunkconverter = ichunkaccess.p(); +@@ -0,0 +0,0 @@ public class ChunkRegionLoader { + + NBTTagCompound nbttagcompound2; + +- for (int i = -1; i < 17; ++i) { ++ for (int i = -1; i < 17; ++i) { // Paper - conflict on loop parameter change + int finalI = i; // CraftBukkit - decompile errors + ChunkSection chunksection = (ChunkSection) Arrays.stream(achunksection).filter((chunksection1) -> { + return chunksection1 != null && chunksection1.getYPosition() >> 4 == finalI; // CraftBukkit - decompile errors + }).findFirst().orElse(Chunk.a); +- NibbleArray nibblearray = lightenginethreaded.a(EnumSkyBlock.BLOCK).a(SectionPosition.a(chunkcoordintpair, i)); +- NibbleArray nibblearray1 = lightenginethreaded.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkcoordintpair, i)); +- ++ // Paper start - async chunk save for unload ++ NibbleArray nibblearray; // block light ++ NibbleArray nibblearray1; // sky light ++ if (asyncsavedata == null) { ++ nibblearray = lightenginethreaded.a(EnumSkyBlock.BLOCK).a(SectionPosition.a(chunkcoordintpair, i)); /// Paper - diff on method change (see getAsyncSaveData) ++ nibblearray1 = lightenginethreaded.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkcoordintpair, i)); // Paper - diff on method change (see getAsyncSaveData) ++ } else { ++ nibblearray = asyncsavedata.blockLight[i + 1]; // +1 to offset the -1 starting index ++ nibblearray1 = asyncsavedata.skyLight[i + 1]; // +1 to offset the -1 starting index ++ } ++ // Paper end + if (chunksection != Chunk.a || nibblearray != null || nibblearray1 != null) { + nbttagcompound2 = new NBTTagCompound(); + nbttagcompound2.setByte("Y", (byte) (i & 255)); +@@ -0,0 +0,0 @@ public class ChunkRegionLoader { + Entity entity = (Entity) iterator1.next(); + 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 (asyncsavedata == null && !entity.dead && (int) Math.floor(entity.locX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.locZ()) >> 4 != chunk.getPos().z) { + toUpdate.add(entity); + continue; + } +@@ -0,0 +0,0 @@ public class ChunkRegionLoader { + } + + nbttagcompound1.set("Entities", nbttaglist2); +- TickList<Block> ticklist = ichunkaccess.n(); ++ TickList<Block> ticklist = ichunkaccess.n(); // Paper - diff on method change (see getAsyncSaveData) + + if (ticklist instanceof ProtoChunkTickList) { + nbttagcompound1.set("ToBeTicked", ((ProtoChunkTickList) ticklist).b()); + } else if (ticklist instanceof TickListChunk) { + nbttagcompound1.set("TileTicks", ((TickListChunk) ticklist).b()); ++ // Paper start - async chunk save for unload ++ } else if (asyncsavedata != null) { ++ nbttagcompound1.set("TileTicks", asyncsavedata.blockTickList); ++ // Paper end + } else { +- nbttagcompound1.set("TileTicks", worldserver.getBlockTickList().a(chunkcoordintpair)); ++ nbttagcompound1.set("TileTicks", worldserver.getBlockTickList().a(chunkcoordintpair)); // Paper - diff on method change (see getAsyncSaveData) + } + +- TickList<FluidType> ticklist1 = ichunkaccess.o(); ++ TickList<FluidType> ticklist1 = ichunkaccess.o(); // Paper - diff on method change (see getAsyncSaveData) + + if (ticklist1 instanceof ProtoChunkTickList) { + nbttagcompound1.set("LiquidsToBeTicked", ((ProtoChunkTickList) ticklist1).b()); + } else if (ticklist1 instanceof TickListChunk) { + nbttagcompound1.set("LiquidTicks", ((TickListChunk) ticklist1).b()); ++ // Paper start - async chunk save for unload ++ } else if (asyncsavedata != null) { ++ nbttagcompound1.set("LiquidTicks", asyncsavedata.fluidTickList); ++ // Paper end + } else { +- nbttagcompound1.set("LiquidTicks", worldserver.getFluidTickList().a(chunkcoordintpair)); ++ nbttagcompound1.set("LiquidTicks", worldserver.getFluidTickList().a(chunkcoordintpair)); // Paper - diff on method change (see getAsyncSaveData) + } + + nbttagcompound1.set("PostProcessing", a(ichunkaccess.l())); +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java +@@ -0,0 +0,0 @@ package net.minecraft.world.level.chunk.storage; + import com.mojang.datafixers.DataFixer; + import java.io.File; + import java.io.IOException; ++// Paper start ++import java.util.concurrent.CompletableFuture; ++import java.util.concurrent.CompletionException; ++// Paper end + import java.util.function.Supplier; + import javax.annotation.Nullable; + import net.minecraft.SharedConstants; +@@ -0,0 +0,0 @@ import net.minecraft.world.level.dimension.DimensionManager; + + public class IChunkLoader implements AutoCloseable { + +- private final IOWorker a; public IOWorker getIOWorker() { return a; } // Paper - OBFHELPER ++ // Paper - OBFHELPER - nuke IOWorker + protected final DataFixer b; + @Nullable +- private PersistentStructureLegacy c; ++ private volatile PersistentStructureLegacy c; // Paper - async chunk loading ++ ++ private final Object persistentDataLock = new Object(); // Paper ++ protected final RegionFileCache regionFileCache; + + public IChunkLoader(File file, DataFixer datafixer, boolean flag) { ++ this.regionFileCache = new RegionFileCache(file, flag); // Paper - nuke IOWorker + this.b = datafixer; +- this.a = new IOWorker(file, flag, "chunk"); ++ // Paper - nuke IOWorker + } + + // CraftBukkit start + private boolean check(ChunkProviderServer cps, int x, int z) throws IOException { + ChunkCoordIntPair pos = new ChunkCoordIntPair(x, z); + if (cps != null) { +- com.google.common.base.Preconditions.checkState(org.bukkit.Bukkit.isPrimaryThread(), "primary thread"); +- if (cps.isLoaded(x, z)) { ++ //com.google.common.base.Preconditions.checkState(org.bukkit.Bukkit.isPrimaryThread(), "primary thread"); // Paper - this function is now MT-Safe ++ if (cps.getChunkAtIfCachedImmediately(x, z) != null) { // Paper - isLoaded is a ticket level check, not a chunk loaded check! + return true; + } + } + +- NBTTagCompound nbt = read(pos); +- if (nbt != null) { +- NBTTagCompound level = nbt.getCompound("Level"); +- if (level.getBoolean("TerrainPopulated")) { +- return true; +- } ++ ++ // Paper start - prioritize ++ NBTTagCompound nbt = cps == null ? read(pos) : ++ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.loadChunkData((WorldServer)cps.getWorld(), x, z, ++ com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHER_PRIORITY, false, true).chunkData; ++ // Paper end ++ if (nbt != null) { ++ NBTTagCompound level = nbt.getCompound("Level"); ++ if (level.getBoolean("TerrainPopulated")) { ++ return true; ++ } + + ChunkStatus status = ChunkStatus.a(level.getString("Status")); + if (status != null && status.b(ChunkStatus.FEATURES)) { +@@ -0,0 +0,0 @@ public class IChunkLoader implements AutoCloseable { + if (i < 1493) { + nbttagcompound = GameProfileSerializer.a(this.b, DataFixTypes.CHUNK, nbttagcompound, i, 1493); + if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) { ++ synchronized (this.persistentDataLock) { // Paper - Async chunk loading + if (this.c == null) { + this.c = PersistentStructureLegacy.a(resourcekey, (WorldPersistentData) supplier.get()); + } + + nbttagcompound = this.c.a(nbttagcompound); ++ } // Paper - Async chunk loading + } + } + +@@ -0,0 +0,0 @@ public class IChunkLoader implements AutoCloseable { + + @Nullable + public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException { +- return this.a.a(chunkcoordintpair); ++ return this.regionFileCache.read(chunkcoordintpair); + } + +- public void a(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) { +- this.a.a(chunkcoordintpair, nbttagcompound); ++ public void a(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { write(chunkcoordintpair, nbttagcompound); } // Paper OBFHELPER ++ public void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { // Paper - OBFHELPER - (Switched around for safety) ++ this.regionFileCache.write(chunkcoordintpair, nbttagcompound); + if (this.c != null) { ++ synchronized (this.persistentDataLock) { // Paper - Async chunk loading + this.c.a(chunkcoordintpair.pair()); ++ } // Paper - Async chunk loading} + } +- +- } +- +- public void i() { +- this.a.a().join(); + } + + public void close() throws IOException { +- this.a.close(); ++ this.regionFileCache.close(); + } + } +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java @@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { protected final RegionFileBitSet freeSectors; public final File file; // Paper @@ -3559,13 +3760,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } -diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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.File; - import java.io.IOException; - import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java +@@ -0,0 +0,0 @@ import net.minecraft.nbt.NBTTagCompound; + import net.minecraft.util.ExceptionSuppressor; + import net.minecraft.world.level.ChunkCoordIntPair; -public final class RegionFileCache implements AutoCloseable { +public class RegionFileCache implements AutoCloseable { // Paper - no final @@ -3672,11 +3873,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // CraftBukkit end } -diff --git a/src/main/java/net/minecraft/server/RegionFileSection.java b/src/main/java/net/minecraft/server/RegionFileSection.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSection.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegionFileSection.java -+++ b/src/main/java/net/minecraft/server/RegionFileSection.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSection.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.World; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -3807,222 +4008,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + // Paper end } -diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TicketType.java -+++ b/src/main/java/net/minecraft/server/TicketType.java -@@ -0,0 +0,0 @@ public class TicketType<T> { - public static final TicketType<Unit> PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit - public static final TicketType<org.bukkit.plugin.Plugin> PLUGIN_TICKET = a("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit - public static final TicketType<Long> FUTURE_AWAIT = a("future_await", Long::compareTo); // Paper -+ public static final TicketType<Long> ASYNC_LOAD = a("async_load", Long::compareTo); // Paper - - public static <T> TicketType<T> a(String s, Comparator<T> comparator) { - return new TicketType<>(s, comparator, 0L); -diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/VillagePlace.java -+++ b/src/main/java/net/minecraft/server/VillagePlace.java -@@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { - private final VillagePlace.a a = new VillagePlace.a(); - private final LongSet b = new LongOpenHashSet(); - -+ private final WorldServer world; // Paper -+ - public VillagePlace(File file, DataFixer datafixer, boolean flag) { -+ // Paper start - add world parameter -+ this(file, datafixer, flag, null); -+ } -+ public VillagePlace(File file, DataFixer datafixer, boolean flag, WorldServer world) { - super(file, VillagePlaceSection::a, VillagePlaceSection::new, datafixer, DataFixTypes.POI_CHUNK, flag); -+ this.world = world; -+ // Paper end - add world parameter - } - - public void a(BlockPosition blockposition, VillagePlaceType villageplacetype) { -@@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { - - @Override - public void a(BooleanSupplier booleansupplier) { -- super.a(booleansupplier); -+ // Paper start - async chunk io -+ if (this.world == null) { -+ super.a(booleansupplier); -+ } else { -+ //super.a(booleansupplier); // re-implement below -+ while (!((RegionFileSection)this).d.isEmpty() && booleansupplier.getAsBoolean()) { -+ ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(((RegionFileSection)this).d.firstLong()).r(); -+ -+ NBTTagCompound data; -+ try (co.aikar.timings.Timing ignored1 = this.world.timings.poiSaveDataSerialization.startTiming()) { -+ data = this.getData(chunkcoordintpair); -+ } -+ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world, -+ chunkcoordintpair.x, chunkcoordintpair.z, data, null, com.destroystokyo.paper.io.PrioritizedTaskQueue.LOW_PRIORITY); -+ } -+ } -+ // Paper end - this.a.a(); - } - -@@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { - } - } - -+ // Paper start - Asynchronous chunk io -+ @javax.annotation.Nullable -+ @Override -+ public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws java.io.IOException { -+ if (this.world != null && Thread.currentThread() != com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE) { -+ NBTTagCompound ret = com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE -+ .loadChunkDataAsyncFuture(this.world, chunkcoordintpair.x, chunkcoordintpair.z, com.destroystokyo.paper.io.IOUtil.getPriorityForCurrentThread(), -+ true, false, true).join().poiData; -+ -+ if (ret == com.destroystokyo.paper.io.PaperFileIOThread.FAILURE_VALUE) { -+ throw new java.io.IOException("See logs for further detail"); -+ } -+ return ret; -+ } -+ return super.read(chunkcoordintpair); -+ } -+ -+ @Override -+ public void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws java.io.IOException { -+ if (this.world != null && Thread.currentThread() != com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE) { -+ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave( -+ this.world, chunkcoordintpair.x, chunkcoordintpair.z, nbttagcompound, null, -+ com.destroystokyo.paper.io.IOUtil.getPriorityForCurrentThread()); -+ return; -+ } -+ super.write(chunkcoordintpair, nbttagcompound); -+ } -+ // Paper end -+ - public static enum Occupancy { - - HAS_SPACE(VillagePlaceRecord::d), IS_OCCUPIED(VillagePlaceRecord::e), ANY((villageplacerecord) -> { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - return this.chunkProvider.getChunkAt(x, z, false); - } - -+ // Paper start - Asynchronous IO -+ public final com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController poiDataController = new com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController() { -+ @Override -+ public void writeData(int x, int z, NBTTagCompound compound) throws java.io.IOException { -+ WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace().write(new ChunkCoordIntPair(x, z), compound); -+ } -+ -+ @Override -+ public NBTTagCompound readData(int x, int z) throws java.io.IOException { -+ return WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace().read(new ChunkCoordIntPair(x, z)); -+ } -+ -+ @Override -+ public <T> T computeForRegionFile(int chunkX, int chunkZ, java.util.function.Function<RegionFile, T> function) { -+ synchronized (WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace()) { -+ RegionFile file; -+ -+ try { -+ file = WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace().getFile(new ChunkCoordIntPair(chunkX, chunkZ), false); -+ } catch (java.io.IOException ex) { -+ throw new RuntimeException(ex); -+ } -+ -+ return function.apply(file); -+ } -+ } -+ -+ @Override -+ public <T> T computeForRegionFileIfLoaded(int chunkX, int chunkZ, java.util.function.Function<RegionFile, T> function) { -+ synchronized (WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace()) { -+ RegionFile file = WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace().getRegionFileIfLoaded(new ChunkCoordIntPair(chunkX, chunkZ)); -+ return function.apply(file); -+ } -+ } -+ }; -+ -+ public final com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController chunkDataController = new com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController() { -+ @Override -+ public void writeData(int x, int z, NBTTagCompound compound) throws java.io.IOException { -+ WorldServer.this.getChunkProvider().playerChunkMap.write(new ChunkCoordIntPair(x, z), compound); -+ } -+ -+ @Override -+ public NBTTagCompound readData(int x, int z) throws java.io.IOException { -+ return WorldServer.this.getChunkProvider().playerChunkMap.read(new ChunkCoordIntPair(x, z)); -+ } -+ -+ @Override -+ public <T> T computeForRegionFile(int chunkX, int chunkZ, java.util.function.Function<RegionFile, T> function) { -+ synchronized (WorldServer.this.getChunkProvider().playerChunkMap) { -+ RegionFile file; -+ -+ try { -+ file = WorldServer.this.getChunkProvider().playerChunkMap.regionFileCache.getFile(new ChunkCoordIntPair(chunkX, chunkZ), false); -+ } catch (java.io.IOException ex) { -+ throw new RuntimeException(ex); -+ } -+ -+ return function.apply(file); -+ } -+ } -+ -+ @Override -+ public <T> T computeForRegionFileIfLoaded(int chunkX, int chunkZ, java.util.function.Function<RegionFile, T> function) { -+ synchronized (WorldServer.this.getChunkProvider().playerChunkMap) { -+ RegionFile file = WorldServer.this.getChunkProvider().playerChunkMap.regionFileCache.getRegionFileIfLoaded(new ChunkCoordIntPair(chunkX, chunkZ)); -+ return function.apply(file); -+ } -+ } -+ }; -+ public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager; -+ // Paper end -+ - // Add env and gen to constructor, WorldData -> WorldDataServer - public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { - super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor -@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { - this.dragonBattle = null; - } - this.getServer().addWorld(this.getWorld()); // CraftBukkit -+ -+ this.asyncChunkTaskManager = new com.destroystokyo.paper.io.chunk.ChunkTaskManager(this); // Paper - } - - // CraftBukkit start -@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { - } - - MCUtil.getSpiralOutChunks(spawn, radiusInBlocks >> 4).forEach(pair -> { -- getChunkProvider().getChunkAtMainThread(pair.x, pair.z); -+ getChunkProvider().getChunkAtAsynchronously(pair.x, pair.z, true, false).exceptionally((ex) -> { -+ ex.printStackTrace(); -+ return null; -+ }); - }); - } - public void removeTicketsForSpawn(int radiusInBlocks, BlockPosition spawn) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -0,0 +0,0 @@ import net.minecraft.server.IBlockData; - import net.minecraft.server.IChunkAccess; - import net.minecraft.server.IRegistry; - import net.minecraft.server.MinecraftKey; -+import net.minecraft.server.MinecraftServer; - import net.minecraft.server.MovingObjectPosition; - import net.minecraft.server.PacketPlayOutCustomSoundEffect; - import net.minecraft.server.PacketPlayOutUpdateTime; @@ -0,0 +0,0 @@ public class CraftWorld implements World { return true; } -- net.minecraft.server.RegionFile file; +- net.minecraft.world.level.chunk.storage.RegionFile file; - try { - file = world.getChunkProvider().playerChunkMap.getIOWorker().getRegionFileCache().getFile(chunkPos, false); - } catch (IOException ex) { @@ -4040,7 +4034,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (status == null) { // at this stage we don't know what it is on disk IChunkAccess chunk = world.getChunkProvider().getChunkAt(x, z, ChunkStatus.EMPTY, true); - if (!(chunk instanceof ProtoChunkExtension) && !(chunk instanceof net.minecraft.server.Chunk)) { + if (!(chunk instanceof ProtoChunkExtension) && !(chunk instanceof net.minecraft.world.level.chunk.Chunk)) { return false; } + } else if (status != ChunkStatus.FULL) { @@ -4058,7 +4052,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public CompletableFuture<Chunk> getChunkAtAsync(int x, int z, boolean gen, boolean urgent) { + if (Bukkit.isPrimaryThread()) { -+ net.minecraft.server.Chunk immediate = this.world.getChunkProvider().getChunkAtIfLoadedImmediately(x, z); ++ net.minecraft.world.level.chunk.Chunk immediate = this.world.getChunkProvider().getChunkAtIfLoadedImmediately(x, z); + if (immediate != null) { + return CompletableFuture.completedFuture(immediate.getBukkitChunk()); + } @@ -4077,9 +4071,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + return this.world.getChunkProvider().getChunkAtAsynchronously(x, z, gen, urgent).thenComposeAsync((either) -> { -+ net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) either.left().orElse(null); ++ net.minecraft.world.level.chunk.Chunk chunk = (net.minecraft.world.level.chunk.Chunk) either.left().orElse(null); + return CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk()); -+ }, MinecraftServer.getServer()); ++ }, net.minecraft.server.MinecraftServer.getServer()); + } + // Paper end diff --git a/Spigot-Server-Patches/Auto-fix-bad-Y-levels-on-player-login.patch b/Spigot-Server-Patches/Auto-fix-bad-Y-levels-on-player-login.patch index 6242dbaed0..62d47a55dc 100644 --- a/Spigot-Server-Patches/Auto-fix-bad-Y-levels-on-player-login.patch +++ b/Spigot-Server-Patches/Auto-fix-bad-Y-levels-on-player-login.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Auto fix bad Y levels on player login Bring down to a saner Y level if super high, as this can cause the server to crash -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @Override public void loadData(NBTTagCompound nbttagcompound) { diff --git a/Spigot-Server-Patches/Avoid-NPE-in-PathfinderGoalTempt.patch b/Spigot-Server-Patches/Avoid-NPE-in-PathfinderGoalTempt.patch index a73f8d45ab..0d3b2428af 100644 --- a/Spigot-Server-Patches/Avoid-NPE-in-PathfinderGoalTempt.patch +++ b/Spigot-Server-Patches/Avoid-NPE-in-PathfinderGoalTempt.patch @@ -4,10 +4,10 @@ Date: Wed, 29 Nov 2017 22:18:54 -0500 Subject: [PATCH] Avoid NPE in PathfinderGoalTempt -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java @@ -0,0 +0,0 @@ public class PathfinderGoalTempt extends PathfinderGoal { } this.target = (event.getTarget() == null) ? null : ((CraftLivingEntity) event.getTarget()).getHandle(); diff --git a/Spigot-Server-Patches/Avoid-blocking-on-Network-Manager-creation.patch b/Spigot-Server-Patches/Avoid-blocking-on-Network-Manager-creation.patch index dbc7a40619..4f9163776d 100644 --- a/Spigot-Server-Patches/Avoid-blocking-on-Network-Manager-creation.patch +++ b/Spigot-Server-Patches/Avoid-blocking-on-Network-Manager-creation.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Avoid blocking on Network Manager creation Per Paper issue 294 -diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/ServerConnection.java b/src/main/java/net/minecraft/server/network/ServerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ServerConnection.java -+++ b/src/main/java/net/minecraft/server/ServerConnection.java +--- a/src/main/java/net/minecraft/server/network/ServerConnection.java ++++ b/src/main/java/net/minecraft/server/network/ServerConnection.java @@ -0,0 +0,0 @@ public class ServerConnection { public volatile boolean c; private final List<ChannelFuture> listeningChannels = Collections.synchronizedList(Lists.newArrayList()); diff --git a/Spigot-Server-Patches/Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch b/Spigot-Server-Patches/Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch index 7da87fcf0d..9db6147e86 100644 --- a/Spigot-Server-Patches/Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch +++ b/Spigot-Server-Patches/Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Avoid error bubbling up when item stack is empty in fishing This can realistically only happen if there's custom loot active on fishing which can return 0 items. This would disconnect the player who's fishing. -diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFishingHook.java -+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java @@ -0,0 +0,0 @@ public class EntityFishingHook extends IProjectile { while (iterator.hasNext()) { diff --git a/Spigot-Server-Patches/Avoid-hopper-searches-if-there-are-no-items.patch b/Spigot-Server-Patches/Avoid-hopper-searches-if-there-are-no-items.patch index cdafb436fd..81771016c1 100644 --- a/Spigot-Server-Patches/Avoid-hopper-searches-if-there-are-no-items.patch +++ b/Spigot-Server-Patches/Avoid-hopper-searches-if-there-are-no-items.patch @@ -13,10 +13,22 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear Combined, this adds up a lot. -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/world/entity/IEntitySelector.java b/src/main/java/net/minecraft/world/entity/IEntitySelector.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java +--- a/src/main/java/net/minecraft/world/entity/IEntitySelector.java ++++ b/src/main/java/net/minecraft/world/entity/IEntitySelector.java +@@ -0,0 +0,0 @@ public final class IEntitySelector { + public static final Predicate<Entity> c = (entity) -> { + return entity.isAlive() && !entity.isVehicle() && !entity.isPassenger(); + }; ++ public static final Predicate<Entity> isInventory() { return d; } // Paper - OBFHELPER + public static final Predicate<Entity> d = (entity) -> { + return entity instanceof IInventory && entity.isAlive(); + }; +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { return removed; } @@ -99,15 +111,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 while (iterator.hasNext()) { T t0 = (T) iterator.next(); // CraftBukkit - decompile error if (t0.shouldBeRemoved) continue; // Paper -diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IEntitySelector.java -+++ b/src/main/java/net/minecraft/server/IEntitySelector.java -@@ -0,0 +0,0 @@ public final class IEntitySelector { - public static final Predicate<Entity> c = (entity) -> { - return entity.isAlive() && !entity.isVehicle() && !entity.isPassenger(); - }; -+ public static final Predicate<Entity> isInventory() { return d; } // Paper - OBFHELPER - public static final Predicate<Entity> d = (entity) -> { - return entity instanceof IInventory && entity.isAlive(); - }; diff --git a/Spigot-Server-Patches/Avoid-item-merge-if-stack-size-above-max-stack-size.patch b/Spigot-Server-Patches/Avoid-item-merge-if-stack-size-above-max-stack-size.patch index ccf361b5a0..8ee1a77385 100644 --- a/Spigot-Server-Patches/Avoid-item-merge-if-stack-size-above-max-stack-size.patch +++ b/Spigot-Server-Patches/Avoid-item-merge-if-stack-size-above-max-stack-size.patch @@ -4,10 +4,10 @@ Date: Mon, 16 Jul 2018 12:42:20 +0200 Subject: [PATCH] Avoid item merge if stack size above max stack size -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java +--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java @@ -0,0 +0,0 @@ public class EntityItem extends Entity { private void mergeNearby() { diff --git a/Spigot-Server-Patches/Basic-PlayerProfile-API.patch b/Spigot-Server-Patches/Basic-PlayerProfile-API.patch index 896bc43fb2..36c474e6ea 100644 --- a/Spigot-Server-Patches/Basic-PlayerProfile-API.patch +++ b/Spigot-Server-Patches/Basic-PlayerProfile-API.patch @@ -439,6 +439,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import com.destroystokyo.paper.profile.PlayerProfile; import com.google.common.util.concurrent.ThreadFactoryBuilder; import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; + import net.minecraft.core.BlockPosition; +@@ -0,0 +0,0 @@ import net.minecraft.world.level.ChunkCoordIntPair; + import net.minecraft.world.level.RayTrace; + import net.minecraft.world.level.World; import org.apache.commons.lang.exception.ExceptionUtils; +import com.mojang.authlib.GameProfile; import org.bukkit.Location; @@ -468,10 +472,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService(); GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.b.getName())); -diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java +diff --git a/src/main/java/net/minecraft/server/players/UserCache.java b/src/main/java/net/minecraft/server/players/UserCache.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/UserCache.java -+++ b/src/main/java/net/minecraft/server/UserCache.java +--- a/src/main/java/net/minecraft/server/players/UserCache.java ++++ b/src/main/java/net/minecraft/server/players/UserCache.java @@ -0,0 +0,0 @@ public class UserCache { private static final Logger LOGGER = LogManager.getLogger(); diff --git a/Spigot-Server-Patches/Beacon-API-custom-effect-ranges.patch b/Spigot-Server-Patches/Beacon-API-custom-effect-ranges.patch index 581e73ce61..1b0ffdf1cf 100644 --- a/Spigot-Server-Patches/Beacon-API-custom-effect-ranges.patch +++ b/Spigot-Server-Patches/Beacon-API-custom-effect-ranges.patch @@ -4,10 +4,10 @@ Date: Wed, 24 Jun 2020 12:39:08 -0600 Subject: [PATCH] Beacon API - custom effect ranges -diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityBeacon.java -+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java @@ -0,0 +0,0 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic return (hasSecondaryEffect()) ? CraftPotionUtil.toBukkit(new MobEffect(this.secondaryEffect, getLevel(), getAmplification(), true, true)) : null; } diff --git a/Spigot-Server-Patches/Bees-get-gravity-in-void.-Fixes-MC-167279.patch b/Spigot-Server-Patches/Bees-get-gravity-in-void.-Fixes-MC-167279.patch index 9ccfc8ef64..baffd443c9 100644 --- a/Spigot-Server-Patches/Bees-get-gravity-in-void.-Fixes-MC-167279.patch +++ b/Spigot-Server-Patches/Bees-get-gravity-in-void.-Fixes-MC-167279.patch @@ -4,11 +4,11 @@ Date: Sun, 26 Jan 2020 16:30:19 -0600 Subject: [PATCH] Bees get gravity in void. Fixes MC-167279 -diff --git a/src/main/java/net/minecraft/server/ControllerMove.java b/src/main/java/net/minecraft/server/ControllerMove.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/control/ControllerMove.java b/src/main/java/net/minecraft/world/entity/ai/control/ControllerMove.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ControllerMove.java -+++ b/src/main/java/net/minecraft/server/ControllerMove.java -@@ -0,0 +0,0 @@ package net.minecraft.server; +--- a/src/main/java/net/minecraft/world/entity/ai/control/ControllerMove.java ++++ b/src/main/java/net/minecraft/world/entity/ai/control/ControllerMove.java +@@ -0,0 +0,0 @@ import net.minecraft.world.phys.shapes.VoxelShape; public class ControllerMove { @@ -17,10 +17,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected double b; protected double c; protected double d; -diff --git a/src/main/java/net/minecraft/server/ControllerMoveFlying.java b/src/main/java/net/minecraft/server/ControllerMoveFlying.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/control/ControllerMoveFlying.java b/src/main/java/net/minecraft/world/entity/ai/control/ControllerMoveFlying.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ControllerMoveFlying.java -+++ b/src/main/java/net/minecraft/server/ControllerMoveFlying.java +--- a/src/main/java/net/minecraft/world/entity/ai/control/ControllerMoveFlying.java ++++ b/src/main/java/net/minecraft/world/entity/ai/control/ControllerMoveFlying.java @@ -0,0 +0,0 @@ public class ControllerMoveFlying extends ControllerMove { } @@ -30,10 +30,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.h == ControllerMove.Operation.MOVE_TO) { this.h = ControllerMove.Operation.WAIT; this.a.setNoGravity(true); -diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/net/minecraft/server/EntityBee.java +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityBee.java b/src/main/java/net/minecraft/world/entity/animal/EntityBee.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityBee.java -+++ b/src/main/java/net/minecraft/server/EntityBee.java +--- a/src/main/java/net/minecraft/world/entity/animal/EntityBee.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityBee.java @@ -0,0 +0,0 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB public EntityBee(EntityTypes<? extends EntityBee> entitytypes, World world) { diff --git a/Spigot-Server-Patches/Block-Enderpearl-Travel-Exploit.patch b/Spigot-Server-Patches/Block-Enderpearl-Travel-Exploit.patch index dba4656a0b..f252ae46ae 100644 --- a/Spigot-Server-Patches/Block-Enderpearl-Travel-Exploit.patch +++ b/Spigot-Server-Patches/Block-Enderpearl-Travel-Exploit.patch @@ -26,10 +26,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled")); + } } -diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IProjectile.java -+++ b/src/main/java/net/minecraft/server/IProjectile.java +--- a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java @@ -0,0 +0,0 @@ public abstract class IProjectile extends Entity { protected void loadData(NBTTagCompound nbttagcompound) { if (nbttagcompound.b("Owner")) { diff --git a/Spigot-Server-Patches/Block-player-logins-during-server-shutdown.patch b/Spigot-Server-Patches/Block-player-logins-during-server-shutdown.patch index f85fa00b95..542217531f 100644 --- a/Spigot-Server-Patches/Block-player-logins-during-server-shutdown.patch +++ b/Spigot-Server-Patches/Block-player-logins-during-server-shutdown.patch @@ -4,10 +4,10 @@ Date: Sun, 2 Jul 2017 21:35:56 -0500 Subject: [PATCH] Block player logins during server shutdown -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { } diff --git a/Spigot-Server-Patches/BlockDestroyEvent.patch b/Spigot-Server-Patches/BlockDestroyEvent.patch index a73e5da21e..64b19cc8a9 100644 --- a/Spigot-Server-Patches/BlockDestroyEvent.patch +++ b/Spigot-Server-Patches/BlockDestroyEvent.patch @@ -10,10 +10,10 @@ 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 +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return false; } else { diff --git a/Spigot-Server-Patches/Book-Size-Limits.patch b/Spigot-Server-Patches/Book-Size-Limits.patch index 803e79634d..0a4db2d6bf 100644 --- a/Spigot-Server-Patches/Book-Size-Limits.patch +++ b/Spigot-Server-Patches/Book-Size-Limits.patch @@ -21,18 +21,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + maxBookTotalSizeMultiplier = getDouble("settings.book-size.total-multiplier", maxBookTotalSizeMultiplier); + } } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ import java.util.function.Consumer; - import java.util.stream.Collectors; - import java.util.stream.Stream; - import javax.annotation.Nullable; -+import org.apache.commons.lang3.StringEscapeUtils; - import org.apache.commons.lang3.StringUtils; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override diff --git a/Spigot-Server-Patches/Bound-Treasure-Maps-to-World-Border.patch b/Spigot-Server-Patches/Bound-Treasure-Maps-to-World-Border.patch index a9aa588cf4..215089e4df 100644 --- a/Spigot-Server-Patches/Bound-Treasure-Maps-to-World-Border.patch +++ b/Spigot-Server-Patches/Bound-Treasure-Maps-to-World-Border.patch @@ -10,22 +10,10 @@ This also would help the case where a players close to the border, and one that is outside happens to be closer, but unreachable, yet another reachable one is in border that would of been missed. -diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java +diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/StructureGenerator.java -+++ b/src/main/java/net/minecraft/server/StructureGenerator.java -@@ -0,0 +0,0 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration> - int i2 = l + k * k1; - int j2 = i1 + k * l1; - ChunkCoordIntPair chunkcoordintpair = this.a(structuresettingsfeature, j, seededrandom, i2, j2); -+ if (!iworldreader.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper - IChunkAccess ichunkaccess = iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS); - StructureStart<?> structurestart = structuremanager.a(SectionPosition.a(ichunkaccess.getPos(), 0), this, ichunkaccess); - -diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldBorder.java -+++ b/src/main/java/net/minecraft/server/WorldBorder.java +--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java ++++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java @@ -0,0 +0,0 @@ public class WorldBorder { return (double) (blockposition.getX() + 1) > this.e() && (double) blockposition.getX() < this.g() && (double) (blockposition.getZ() + 1) > this.f() && (double) blockposition.getZ() < this.h(); } @@ -45,3 +33,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean isInBounds(ChunkCoordIntPair chunkcoordintpair) { return (double) chunkcoordintpair.f() > this.e() && (double) chunkcoordintpair.d() < this.g() && (double) chunkcoordintpair.g() > this.f() && (double) chunkcoordintpair.e() < this.h(); } +diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java +@@ -0,0 +0,0 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration> + int i2 = l + k * k1; + int j2 = i1 + k * l1; + ChunkCoordIntPair chunkcoordintpair = this.a(structuresettingsfeature, j, seededrandom, i2, j2); ++ if (!iworldreader.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper + IChunkAccess ichunkaccess = iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS); + StructureStart<?> structurestart = structuremanager.a(SectionPosition.a(ichunkaccess.getPos(), 0), this, ichunkaccess); + 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 bdab574494..f2286f54ef 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 @@ -44,10 +44,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit); + } } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { // CraftBukkit start - multithreaded fields private volatile int chatThrottle; diff --git a/Spigot-Server-Patches/Broadcast-join-message-to-console.patch b/Spigot-Server-Patches/Broadcast-join-message-to-console.patch index 9a63a0945a..409e9c683e 100644 --- a/Spigot-Server-Patches/Broadcast-join-message-to-console.patch +++ b/Spigot-Server-Patches/Broadcast-join-message-to-console.patch @@ -4,10 +4,10 @@ Date: Fri, 17 Apr 2020 00:15:23 +0100 Subject: [PATCH] Broadcast join message to console -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure diff --git a/Spigot-Server-Patches/Buffer-joins-to-world.patch b/Spigot-Server-Patches/Buffer-joins-to-world.patch index e3a6866676..0e072e7de6 100644 --- a/Spigot-Server-Patches/Buffer-joins-to-world.patch +++ b/Spigot-Server-Patches/Buffer-joins-to-world.patch @@ -21,10 +21,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + maxJoinsPerTick = getInt("settings.max-joins-per-tick", 3); + } } -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java +diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java +--- a/src/main/java/net/minecraft/network/NetworkManager.java ++++ b/src/main/java/net/minecraft/network/NetworkManager.java @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { } // Paper end diff --git a/Spigot-Server-Patches/Cache-burn-durations.patch b/Spigot-Server-Patches/Cache-burn-durations.patch index a5e6310e3b..2520a3394a 100644 --- a/Spigot-Server-Patches/Cache-burn-durations.patch +++ b/Spigot-Server-Patches/Cache-burn-durations.patch @@ -4,12 +4,12 @@ Date: Sun, 27 Dec 2020 16:47:00 +0100 Subject: [PATCH] Cache burn durations -diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityFurnace.java -+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.world.level.block.entity; +import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; diff --git a/Spigot-Server-Patches/Cache-user-authenticator-threads.patch b/Spigot-Server-Patches/Cache-user-authenticator-threads.patch index 02db3c60e0..85b74cbfcd 100644 --- a/Spigot-Server-Patches/Cache-user-authenticator-threads.patch +++ b/Spigot-Server-Patches/Cache-user-authenticator-threads.patch @@ -4,10 +4,10 @@ Date: Wed, 23 Nov 2016 08:31:45 -0500 Subject: [PATCH] Cache user authenticator threads -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ import com.google.common.collect.Lists; import com.mojang.authlib.GameProfile; import com.mojang.datafixers.util.Either; diff --git a/Spigot-Server-Patches/Call-PaperServerListPingEvent-for-legacy-pings.patch b/Spigot-Server-Patches/Call-PaperServerListPingEvent-for-legacy-pings.patch index 5bf4f89ea4..073db9e8fd 100644 --- a/Spigot-Server-Patches/Call-PaperServerListPingEvent-for-legacy-pings.patch +++ b/Spigot-Server-Patches/Call-PaperServerListPingEvent-for-legacy-pings.patch @@ -83,12 +83,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + +} -diff --git a/src/main/java/net/minecraft/server/LegacyPingHandler.java b/src/main/java/net/minecraft/server/LegacyPingHandler.java +diff --git a/src/main/java/net/minecraft/server/network/LegacyPingHandler.java b/src/main/java/net/minecraft/server/network/LegacyPingHandler.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LegacyPingHandler.java -+++ b/src/main/java/net/minecraft/server/LegacyPingHandler.java +--- a/src/main/java/net/minecraft/server/network/LegacyPingHandler.java ++++ b/src/main/java/net/minecraft/server/network/LegacyPingHandler.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.server.network; +import com.destroystokyo.paper.network.PaperLegacyStatusClient; + diff --git a/Spigot-Server-Patches/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch b/Spigot-Server-Patches/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch index 986b453714..c4e0343e14 100644 --- a/Spigot-Server-Patches/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch +++ b/Spigot-Server-Patches/Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch @@ -4,10 +4,10 @@ Date: Wed, 13 Mar 2019 20:08:09 +0200 Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { } diff --git a/Spigot-Server-Patches/Call-player-spectator-target-events-and-improve-impl.patch b/Spigot-Server-Patches/Call-player-spectator-target-events-and-improve-impl.patch index 6bb2fe43d0..999c80995b 100644 --- a/Spigot-Server-Patches/Call-player-spectator-target-events-and-improve-impl.patch +++ b/Spigot-Server-Patches/Call-player-spectator-target-events-and-improve-impl.patch @@ -18,10 +18,10 @@ spectate the target entity. Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com> -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { return (Entity) (this.spectatedEntity == null ? this : this.spectatedEntity); } @@ -87,10 +87,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @Override -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { } diff --git a/Spigot-Server-Patches/Cap-Entity-Collisions.patch b/Spigot-Server-Patches/Cap-Entity-Collisions.patch index 7ae32aacdc..923d549fb2 100644 --- a/Spigot-Server-Patches/Cap-Entity-Collisions.patch +++ b/Spigot-Server-Patches/Cap-Entity-Collisions.patch @@ -26,11 +26,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log( "Max Entity Collisions: " + maxCollisionsPerEntity ); + } } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; public long activatedTick = Integer.MIN_VALUE; @@ -38,10 +38,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void inactiveTick() { } // Spigot end -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } } diff --git a/Spigot-Server-Patches/Catch-JsonParseException-in-Entity-and-TE-names.patch b/Spigot-Server-Patches/Catch-JsonParseException-in-Entity-and-TE-names.patch index 7e9c2b1d8d..ab1085ab3d 100644 --- a/Spigot-Server-Patches/Catch-JsonParseException-in-Entity-and-TE-names.patch +++ b/Spigot-Server-Patches/Catch-JsonParseException-in-Entity-and-TE-names.patch @@ -12,19 +12,6 @@ Shulkers) may need to be changed in order for it to re-save properly No more crashing though. -diff --git a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -+++ b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -@@ -0,0 +0,0 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { - this.command = nbttagcompound.getString("Command"); - this.successCount = nbttagcompound.getInt("SuccessCount"); - if (nbttagcompound.hasKeyOfType("CustomName", 8)) { -- this.setName(IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"))); -+ this.setName(MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound)); // Paper - Catch ParseException - } - - if (nbttagcompound.hasKeyOfType("TrackOutput", 1)) { diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java @@ -49,10 +36,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return null; + } } -diff --git a/src/main/java/net/minecraft/server/TileEntityBanner.java b/src/main/java/net/minecraft/server/TileEntityBanner.java +diff --git a/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityBanner.java -+++ b/src/main/java/net/minecraft/server/TileEntityBanner.java +--- a/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java +@@ -0,0 +0,0 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { + this.command = nbttagcompound.getString("Command"); + this.successCount = nbttagcompound.getInt("SuccessCount"); + if (nbttagcompound.hasKeyOfType("CustomName", 8)) { +- this.setName(IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"))); ++ this.setName(MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound)); // Paper - Catch ParseException + } + + if (nbttagcompound.hasKeyOfType("TrackOutput", 1)) { +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBanner.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBanner.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBanner.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBanner.java @@ -0,0 +0,0 @@ public class TileEntityBanner extends TileEntity implements INamableTileEntity { public void load(IBlockData iblockdata, NBTTagCompound nbttagcompound) { super.load(iblockdata, nbttagcompound); @@ -62,10 +62,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } if (this.hasWorld()) { -diff --git a/src/main/java/net/minecraft/server/TileEntityContainer.java b/src/main/java/net/minecraft/server/TileEntityContainer.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityContainer.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityContainer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityContainer.java -+++ b/src/main/java/net/minecraft/server/TileEntityContainer.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityContainer.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityContainer.java @@ -0,0 +0,0 @@ public abstract class TileEntityContainer extends TileEntity implements IInvento super.load(iblockdata, nbttagcompound); this.chestLock = ChestLock.b(nbttagcompound); diff --git a/Spigot-Server-Patches/Catch-exceptions-from-dispenser-entity-spawns.patch b/Spigot-Server-Patches/Catch-exceptions-from-dispenser-entity-spawns.patch index 9ff195872f..96ad5a7c45 100644 --- a/Spigot-Server-Patches/Catch-exceptions-from-dispenser-entity-spawns.patch +++ b/Spigot-Server-Patches/Catch-exceptions-from-dispenser-entity-spawns.patch @@ -4,10 +4,10 @@ Date: Mon, 10 Jun 2019 09:36:40 +0100 Subject: [PATCH] Catch exceptions from dispenser entity spawns -diff --git a/src/main/java/net/minecraft/server/IDispenseBehavior.java b/src/main/java/net/minecraft/server/IDispenseBehavior.java +diff --git a/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IDispenseBehavior.java -+++ b/src/main/java/net/minecraft/server/IDispenseBehavior.java +--- a/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java ++++ b/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java @@ -0,0 +0,0 @@ public interface IDispenseBehavior { } } diff --git a/Spigot-Server-Patches/Change-implementation-of-tile-entity-removal-list.patch b/Spigot-Server-Patches/Change-implementation-of-tile-entity-removal-list.patch index 1e9cd879f4..6beb221b0a 100644 --- a/Spigot-Server-Patches/Change-implementation-of-tile-entity-removal-list.patch +++ b/Spigot-Server-Patches/Change-implementation-of-tile-entity-removal-list.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Change implementation of (tile)entity removal list use sets for faster removal -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public final List<TileEntity> tileEntityList = Lists.newArrayList(); public final List<TileEntity> tileEntityListTick = Lists.newArrayList(); diff --git a/Spigot-Server-Patches/Check-Drowned-for-Villager-Aggression-Config.patch b/Spigot-Server-Patches/Check-Drowned-for-Villager-Aggression-Config.patch index 7ad8a6e3fb..aba90b0b18 100644 --- a/Spigot-Server-Patches/Check-Drowned-for-Villager-Aggression-Config.patch +++ b/Spigot-Server-Patches/Check-Drowned-for-Villager-Aggression-Config.patch @@ -4,10 +4,10 @@ Date: Wed, 10 Oct 2018 21:22:44 -0500 Subject: [PATCH] Check Drowned for Villager Aggression Config -diff --git a/src/main/java/net/minecraft/server/EntityDrowned.java b/src/main/java/net/minecraft/server/EntityDrowned.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityDrowned.java b/src/main/java/net/minecraft/world/entity/monster/EntityDrowned.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityDrowned.java -+++ b/src/main/java/net/minecraft/server/EntityDrowned.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityDrowned.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityDrowned.java @@ -0,0 +0,0 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D)); this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityDrowned.class})).a(EntityPigZombie.class)); diff --git a/Spigot-Server-Patches/Check-online-mode-before-converting-and-renaming-pla.patch b/Spigot-Server-Patches/Check-online-mode-before-converting-and-renaming-pla.patch index bf04c65165..0324b67f96 100644 --- a/Spigot-Server-Patches/Check-online-mode-before-converting-and-renaming-pla.patch +++ b/Spigot-Server-Patches/Check-online-mode-before-converting-and-renaming-pla.patch @@ -4,10 +4,10 @@ Date: Wed, 2 Mar 2016 00:03:55 -0600 Subject: [PATCH] Check online mode before converting and renaming player data -diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java +diff --git a/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java b/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldNBTStorage.java -+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java +--- a/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java ++++ b/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java @@ -0,0 +0,0 @@ public class WorldNBTStorage { File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat"); // Spigot Start diff --git a/Spigot-Server-Patches/Chunk-Save-Reattempt.patch b/Spigot-Server-Patches/Chunk-Save-Reattempt.patch index 6f63b33c1f..76a074ecc0 100644 --- a/Spigot-Server-Patches/Chunk-Save-Reattempt.patch +++ b/Spigot-Server-Patches/Chunk-Save-Reattempt.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Chunk Save Reattempt We commonly have "Stream Closed" errors on chunk saving, so this code should re-try to save the chunk in the event of failure and hopefully prevent rollbacks. -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java @@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { return true; } @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return false; } } -diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegionFileCache.java -+++ b/src/main/java/net/minecraft/server/RegionFileCache.java +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java @@ -0,0 +0,0 @@ public final class RegionFileCache implements AutoCloseable { protected void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { diff --git a/Spigot-Server-Patches/Chunk-debug-command.patch b/Spigot-Server-Patches/Chunk-debug-command.patch index 89dd583fa9..9488ec7029 100644 --- a/Spigot-Server-Patches/Chunk-debug-command.patch +++ b/Spigot-Server-Patches/Chunk-debug-command.patch @@ -35,17 +35,19 @@ diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java -@@ -0,0 +0,0 @@ import net.minecraft.server.ChunkCoordIntPair; - import net.minecraft.server.ChunkProviderServer; - import net.minecraft.server.Entity; - import net.minecraft.server.EntityTypes; -+import net.minecraft.server.MCUtil; - import net.minecraft.server.MinecraftKey; +@@ -0,0 +0,0 @@ import com.google.common.collect.Maps; + import net.minecraft.resources.MinecraftKey; import net.minecraft.server.MinecraftServer; -+import net.minecraft.server.PlayerChunk; - import net.minecraft.server.WorldServer; + import net.minecraft.server.level.ChunkProviderServer; ++import net.minecraft.server.level.PlayerChunk; + import net.minecraft.server.level.WorldServer; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityTypes; + import net.minecraft.world.level.ChunkCoordIntPair; ++import net.minecraft.server.MCUtil; import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.Pair; + import org.bukkit.Bukkit; @@ -0,0 +0,0 @@ import java.util.stream.Collectors; public class PaperCommand extends Command { @@ -205,26 +207,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 /* * Ported from MinecraftForge - author: LexManos <LexManos@gmail.com> - License: LGPLv2.1 */ -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - - public class ChunkProviderServer extends IChunkProvider { - -- private static final List<ChunkStatus> b = ChunkStatus.a(); -+ private static final List<ChunkStatus> b = ChunkStatus.a(); static final List<ChunkStatus> getPossibleChunkStatuses() { return ChunkProviderServer.b; } // Paper - OBFHELPER - private final ChunkMapDistance chunkMapDistance; - public final ChunkGenerator chunkGenerator; - private final WorldServer world; diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -0,0 +0,0 @@ import com.destroystokyo.paper.profile.PlayerProfile; - import com.google.common.util.concurrent.ThreadFactoryBuilder; - import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; +@@ -0,0 +0,0 @@ import net.minecraft.world.level.ChunkCoordIntPair; + import net.minecraft.world.level.RayTrace; + import net.minecraft.world.level.World; import org.apache.commons.lang.exception.ExceptionUtils; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; @@ -419,10 +408,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } } -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper + + public class ChunkProviderServer extends IChunkProvider { + +- private static final List<ChunkStatus> b = ChunkStatus.a(); ++ private static final List<ChunkStatus> b = ChunkStatus.a(); static final List<ChunkStatus> getPossibleChunkStatuses() { return ChunkProviderServer.b; } // Paper - OBFHELPER + private final ChunkMapDistance chunkMapDistance; + public final ChunkGenerator chunkGenerator; + private final WorldServer world; +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { public int oldTicketLevel; private int ticketLevel; @@ -432,10 +434,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private boolean p; private final ShortSet[] dirtyBlocks; private int r; -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public final Long2ObjectLinkedOpenHashMap<PlayerChunk> updatingChunks = new Long2ObjectLinkedOpenHashMap(); public volatile Long2ObjectLinkedOpenHashMap<PlayerChunk> visibleChunks; @@ -445,10 +447,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public final WorldServer world; private final LightEngineThreaded lightEngine; private final IAsyncTaskHandler<Runnable> executor; -diff --git a/src/main/java/net/minecraft/server/Ticket.java b/src/main/java/net/minecraft/server/Ticket.java +diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Ticket.java -+++ b/src/main/java/net/minecraft/server/Ticket.java +--- a/src/main/java/net/minecraft/server/level/Ticket.java ++++ b/src/main/java/net/minecraft/server/level/Ticket.java @@ -0,0 +0,0 @@ public final class Ticket<T> implements Comparable<Ticket<?>> { private final TicketType<T> a; diff --git a/Spigot-Server-Patches/Chunk-registration-fixes.patch b/Spigot-Server-Patches/Chunk-registration-fixes.patch index ebff68bba4..283f012baa 100644 --- a/Spigot-Server-Patches/Chunk-registration-fixes.patch +++ b/Spigot-Server-Patches/Chunk-registration-fixes.patch @@ -7,10 +7,10 @@ World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is tr Keep them consistent -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { if (entity.cl()) { this.getMethodProfiler().enter("chunkCheck"); diff --git a/Spigot-Server-Patches/ChunkMapDistance-CME.patch b/Spigot-Server-Patches/ChunkMapDistance-CME.patch index a13ae349ae..84c520675f 100644 --- a/Spigot-Server-Patches/ChunkMapDistance-CME.patch +++ b/Spigot-Server-Patches/ChunkMapDistance-CME.patch @@ -4,10 +4,10 @@ Date: Wed, 29 May 2019 04:01:22 +0100 Subject: [PATCH] ChunkMapDistance CME -diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkMapDistance.java -+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java +--- a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java @@ -0,0 +0,0 @@ public abstract class ChunkMapDistance { private final ChunkMapDistance.a ticketLevelTracker = new ChunkMapDistance.a(); private final ChunkMapDistance.b f = new ChunkMapDistance.b(8); @@ -69,10 +69,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 byte b0 = it_unimi_dsi_fastutil_longs_long2bytemap_entry.getByteValue(); long j = it_unimi_dsi_fastutil_longs_long2bytemap_entry.getLongKey(); -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { private static final CompletableFuture<Either<Chunk, PlayerChunk.Failure>> UNLOADED_CHUNK_FUTURE = CompletableFuture.completedFuture(PlayerChunk.UNLOADED_CHUNK); private static final List<ChunkStatus> CHUNK_STATUSES = ChunkStatus.a(); diff --git a/Spigot-Server-Patches/Clean-up-duplicated-GameProfile-Properties.patch b/Spigot-Server-Patches/Clean-up-duplicated-GameProfile-Properties.patch index 9a346080ce..f5395c0446 100644 --- a/Spigot-Server-Patches/Clean-up-duplicated-GameProfile-Properties.patch +++ b/Spigot-Server-Patches/Clean-up-duplicated-GameProfile-Properties.patch @@ -8,10 +8,10 @@ growing to large sizes and preventing login. This now automatically cleans up the extra properties. -diff --git a/src/main/java/net/minecraft/server/GameProfileSerializer.java b/src/main/java/net/minecraft/server/GameProfileSerializer.java +diff --git a/src/main/java/net/minecraft/nbt/GameProfileSerializer.java b/src/main/java/net/minecraft/nbt/GameProfileSerializer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/GameProfileSerializer.java -+++ b/src/main/java/net/minecraft/server/GameProfileSerializer.java +--- a/src/main/java/net/minecraft/nbt/GameProfileSerializer.java ++++ b/src/main/java/net/minecraft/nbt/GameProfileSerializer.java @@ -0,0 +0,0 @@ public final class GameProfileSerializer { while (iterator.hasNext()) { String s1 = (String) iterator.next(); @@ -43,10 +43,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public static NBTTagCompound a(DataFixer datafixer, DataFixTypes datafixtypes, NBTTagCompound nbttagcompound, int i) { -diff --git a/src/main/java/net/minecraft/server/ItemSkullPlayer.java b/src/main/java/net/minecraft/server/ItemSkullPlayer.java +diff --git a/src/main/java/net/minecraft/world/item/ItemSkullPlayer.java b/src/main/java/net/minecraft/world/item/ItemSkullPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemSkullPlayer.java -+++ b/src/main/java/net/minecraft/server/ItemSkullPlayer.java +--- a/src/main/java/net/minecraft/world/item/ItemSkullPlayer.java ++++ b/src/main/java/net/minecraft/world/item/ItemSkullPlayer.java @@ -0,0 +0,0 @@ public class ItemSkullPlayer extends ItemBlockWallable { return true; } else { @@ -54,15 +54,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - clean up old duplicated properties + NBTTagCompound properties = nbttagcompound.getCompound("SkullOwner").getCompound("Properties"); + for (String key : properties.getKeys()) { -+ NBTTagList values = properties.getList(key, 10); ++ net.minecraft.nbt.NBTTagList values = properties.getList(key, 10); + if (values.size() > 1) { -+ NBTBase texture = values.get(values.size() - 1); -+ values = new NBTTagList(); ++ net.minecraft.nbt.NBTBase texture = values.get(values.size() - 1); ++ values = new net.minecraft.nbt.NBTTagList(); + values.add(texture); + properties.set(key, values); + } + } + // Paper end - NBTTagList textures = nbttagcompound.getCompound("SkullOwner").getCompound("Properties").getList("textures", 10); // Safe due to method contracts + net.minecraft.nbt.NBTTagList textures = nbttagcompound.getCompound("SkullOwner").getCompound("Properties").getList("textures", 10); // Safe due to method contracts for (int i = 0; i < textures.size(); i++) { if (textures.get(i) instanceof NBTTagCompound && !((NBTTagCompound) textures.get(i)).hasKeyOfType("Signature", 8) && ((NBTTagCompound) textures.get(i)).getString("Value").trim().isEmpty()) { diff --git a/Spigot-Server-Patches/Climbing-should-not-bypass-cramming-gamerule.patch b/Spigot-Server-Patches/Climbing-should-not-bypass-cramming-gamerule.patch index 28248c2ef8..42f1a3a483 100644 --- a/Spigot-Server-Patches/Climbing-should-not-bypass-cramming-gamerule.patch +++ b/Spigot-Server-Patches/Climbing-should-not-bypass-cramming-gamerule.patch @@ -18,11 +18,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + fixClimbingBypassingCrammingRule = getBoolean("fix-climbing-bypassing-cramming-rule", fixClimbingBypassingCrammingRule); + } } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public boolean isCollidable() { @@ -35,62 +35,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return false; } -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - } - - @Override -- public boolean isCollidable() { -+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - return false; - } - -diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityBat.java -+++ b/src/main/java/net/minecraft/server/EntityBat.java -@@ -0,0 +0,0 @@ public class EntityBat extends EntityAmbient { - } - - @Override -- public boolean isCollidable() { -+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - return false; - } - -diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityBoat.java -+++ b/src/main/java/net/minecraft/server/EntityBoat.java -@@ -0,0 +0,0 @@ public class EntityBoat extends Entity { - } - - @Override -- public boolean isCollidable() { -+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - return true; - } - -diff --git a/src/main/java/net/minecraft/server/EntityHorseAbstract.java b/src/main/java/net/minecraft/server/EntityHorseAbstract.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHorseAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityHorseAbstract.java -@@ -0,0 +0,0 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven - } - - @Override -- public boolean isCollidable() { -+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - return !this.isVehicle(); - } - -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityTeleportEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; // CraftBukkit end @@ -126,38 +74,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // CraftBukkit start - collidable API -diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +diff --git a/src/main/java/net/minecraft/world/entity/IEntitySelector.java b/src/main/java/net/minecraft/world/entity/IEntitySelector.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -@@ -0,0 +0,0 @@ public abstract class EntityMinecartAbstract extends Entity { - } - - @Override -- public boolean isCollidable() { -+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - return true; - } - -diff --git a/src/main/java/net/minecraft/server/EntityParrot.java b/src/main/java/net/minecraft/server/EntityParrot.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityParrot.java -+++ b/src/main/java/net/minecraft/server/EntityParrot.java -@@ -0,0 +0,0 @@ public class EntityParrot extends EntityPerchable implements EntityBird { - } - - @Override -- public boolean isCollidable() { -- return super.isCollidable(); // CraftBukkit - collidable API -+ public boolean isCollidable(boolean ignoreClimbing) { // Paper -+ return super.isCollidable(ignoreClimbing); // CraftBukkit - collidable API // Paper - } - - @Override -diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IEntitySelector.java -+++ b/src/main/java/net/minecraft/server/IEntitySelector.java +--- a/src/main/java/net/minecraft/world/entity/IEntitySelector.java ++++ b/src/main/java/net/minecraft/world/entity/IEntitySelector.java @@ -0,0 +0,0 @@ public final class IEntitySelector { } @@ -177,3 +97,83 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return false; } else if (entity.world.isClientSide && (!(entity1 instanceof EntityHuman) || !((EntityHuman) entity1).ez())) { return false; +diff --git a/src/main/java/net/minecraft/world/entity/ambient/EntityBat.java b/src/main/java/net/minecraft/world/entity/ambient/EntityBat.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/ambient/EntityBat.java ++++ b/src/main/java/net/minecraft/world/entity/ambient/EntityBat.java +@@ -0,0 +0,0 @@ public class EntityBat extends EntityAmbient { + } + + @Override +- public boolean isCollidable() { ++ public boolean isCollidable(boolean ignoreClimbing) { // Paper + return false; + } + +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityParrot.java b/src/main/java/net/minecraft/world/entity/animal/EntityParrot.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityParrot.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityParrot.java +@@ -0,0 +0,0 @@ public class EntityParrot extends EntityPerchable implements EntityBird { + } + + @Override +- public boolean isCollidable() { +- return super.isCollidable(); // CraftBukkit - collidable API ++ public boolean isCollidable(boolean ignoreClimbing) { // Paper ++ return super.isCollidable(ignoreClimbing); // CraftBukkit - collidable API // Paper + } + + @Override +diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java b/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java +@@ -0,0 +0,0 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven + } + + @Override +- public boolean isCollidable() { ++ public boolean isCollidable(boolean ignoreClimbing) { // Paper + return !this.isVehicle(); + } + +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { + } + + @Override +- public boolean isCollidable() { ++ public boolean isCollidable(boolean ignoreClimbing) { // Paper + return false; + } + +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java +@@ -0,0 +0,0 @@ public class EntityBoat extends Entity { + } + + @Override +- public boolean isCollidable() { ++ public boolean isCollidable(boolean ignoreClimbing) { // Paper + return true; + } + +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java +@@ -0,0 +0,0 @@ public abstract class EntityMinecartAbstract extends Entity { + } + + @Override +- public boolean isCollidable() { ++ public boolean isCollidable(boolean ignoreClimbing) { // Paper + return true; + } + diff --git a/Spigot-Server-Patches/Collision-option-for-requiring-a-player-participant.patch b/Spigot-Server-Patches/Collision-option-for-requiring-a-player-participant.patch index 779d07f6d2..ec8ebf4c83 100644 --- a/Spigot-Server-Patches/Collision-option-for-requiring-a-player-participant.patch +++ b/Spigot-Server-Patches/Collision-option-for-requiring-a-player-participant.patch @@ -27,11 +27,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public int wanderingTraderSpawnMinuteTicks = 1200; public int wanderingTraderSpawnDayTicks = 24000; public int wanderingTraderSpawnChanceFailureIncrement = 25; -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public void collide(Entity entity) { if (!this.isSameVehicle(entity)) { if (!entity.noclip && !this.noclip) { @@ -39,10 +39,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 double d0 = entity.locX() - this.locX(); double d1 = entity.locZ() - this.locZ(); double d2 = MathHelper.a(d0, d1); -diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityBoat.java -+++ b/src/main/java/net/minecraft/server/EntityBoat.java +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java @@ -0,0 +0,0 @@ public class EntityBoat extends Entity { @Override @@ -51,10 +51,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (entity instanceof EntityBoat) { if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) { // CraftBukkit start -diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java @@ -0,0 +0,0 @@ public abstract class EntityMinecartAbstract extends Entity { public void collide(Entity entity) { if (!this.world.isClientSide) { diff --git a/Spigot-Server-Patches/Complete-resource-pack-API.patch b/Spigot-Server-Patches/Complete-resource-pack-API.patch index c790f7dbdb..8b227d16b4 100644 --- a/Spigot-Server-Patches/Complete-resource-pack-API.patch +++ b/Spigot-Server-Patches/Complete-resource-pack-API.patch @@ -4,10 +4,10 @@ Date: Sat, 4 Apr 2015 23:17:52 -0400 Subject: [PATCH] Complete resource pack API -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { // CraftBukkit start public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) { diff --git a/Spigot-Server-Patches/Configurable-Alternative-LootPool-Luck-Formula.patch b/Spigot-Server-Patches/Configurable-Alternative-LootPool-Luck-Formula.patch index cead2ac570..3048e10002 100644 --- a/Spigot-Server-Patches/Configurable-Alternative-LootPool-Luck-Formula.patch +++ b/Spigot-Server-Patches/Configurable-Alternative-LootPool-Luck-Formula.patch @@ -52,10 +52,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } } -diff --git a/src/main/java/net/minecraft/server/LootSelectorEntry.java b/src/main/java/net/minecraft/server/LootSelectorEntry.java +diff --git a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootSelectorEntry.java b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootSelectorEntry.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LootSelectorEntry.java -+++ b/src/main/java/net/minecraft/server/LootSelectorEntry.java +--- a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootSelectorEntry.java ++++ b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootSelectorEntry.java @@ -0,0 +0,0 @@ import org.apache.commons.lang3.ArrayUtils; public abstract class LootSelectorEntry extends LootEntryAbstract { diff --git a/Spigot-Server-Patches/Configurable-Cartographer-Treasure-Maps.patch b/Spigot-Server-Patches/Configurable-Cartographer-Treasure-Maps.patch index 806863ba43..1db2b7b30d 100644 --- a/Spigot-Server-Patches/Configurable-Cartographer-Treasure-Maps.patch +++ b/Spigot-Server-Patches/Configurable-Cartographer-Treasure-Maps.patch @@ -27,10 +27,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } } -diff --git a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java +diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java -+++ b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java +--- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java ++++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java +@@ -0,0 +0,0 @@ public class VillagerTrades { + return null; + } else { + WorldServer worldserver = (WorldServer) entity.world; +- BlockPosition blockposition = worldserver.a(this.b, entity.getChunkCoordinates(), 100, true); ++ if (!worldserver.paperConfig.enableTreasureMaps) return null; // Paper ++ BlockPosition blockposition = worldserver.a(this.b, entity.getChunkCoordinates(), 100, !worldserver.paperConfig.treasureMapsAlreadyDiscovered); // Paper + + if (blockposition != null) { + ItemStack itemstack = ItemWorldMap.createFilledMapView(worldserver, blockposition.getX(), blockposition.getZ(), (byte) 2, true, true); +diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/LootItemFunctionExplorationMap.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/LootItemFunctionExplorationMap.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/storage/loot/functions/LootItemFunctionExplorationMap.java ++++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/LootItemFunctionExplorationMap.java @@ -0,0 +0,0 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional if (vec3d != null) { @@ -49,17 +63,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (blockposition != null) { ItemStack itemstack1 = ItemWorldMap.createFilledMapView(worldserver, blockposition.getX(), blockposition.getZ(), this.g, true, true); -diff --git a/src/main/java/net/minecraft/server/VillagerTrades.java b/src/main/java/net/minecraft/server/VillagerTrades.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/VillagerTrades.java -+++ b/src/main/java/net/minecraft/server/VillagerTrades.java -@@ -0,0 +0,0 @@ public class VillagerTrades { - return null; - } else { - WorldServer worldserver = (WorldServer) entity.world; -- BlockPosition blockposition = worldserver.a(this.b, entity.getChunkCoordinates(), 100, true); -+ if (!worldserver.paperConfig.enableTreasureMaps) return null; // Paper -+ BlockPosition blockposition = worldserver.a(this.b, entity.getChunkCoordinates(), 100, !worldserver.paperConfig.treasureMapsAlreadyDiscovered); // Paper - - if (blockposition != null) { - ItemStack itemstack = ItemWorldMap.createFilledMapView(worldserver, blockposition.getX(), blockposition.getZ(), (byte) 2, true, true); diff --git a/Spigot-Server-Patches/Configurable-Chunk-Inhabited-Time.patch b/Spigot-Server-Patches/Configurable-Chunk-Inhabited-Time.patch index 1d72a0192d..3c0704a53d 100644 --- a/Spigot-Server-Patches/Configurable-Chunk-Inhabited-Time.patch +++ b/Spigot-Server-Patches/Configurable-Chunk-Inhabited-Time.patch @@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + fixedInhabitedTime = getInt("fixed-chunk-inhabited-time", -1); + } } -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { @Override diff --git a/Spigot-Server-Patches/Configurable-Disabling-Cat-Chest-Detection.patch b/Spigot-Server-Patches/Configurable-Disabling-Cat-Chest-Detection.patch index 35a71731b0..28bf04eaad 100644 --- a/Spigot-Server-Patches/Configurable-Disabling-Cat-Chest-Detection.patch +++ b/Spigot-Server-Patches/Configurable-Disabling-Cat-Chest-Detection.patch @@ -19,10 +19,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + disableChestCatDetection = getBoolean("game-mechanics.disable-chest-cat-detection", false); + } } -diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockChest.java b/src/main/java/net/minecraft/world/level/block/BlockChest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockChest.java -+++ b/src/main/java/net/minecraft/server/BlockChest.java +--- a/src/main/java/net/minecraft/world/level/block/BlockChest.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockChest.java @@ -0,0 +0,0 @@ public class BlockChest extends BlockChestAbstract<TileEntityChest> implements I } diff --git a/Spigot-Server-Patches/Configurable-Grass-Spread-Tick-Rate.patch b/Spigot-Server-Patches/Configurable-Grass-Spread-Tick-Rate.patch index ad7d353739..f7be964c69 100644 --- a/Spigot-Server-Patches/Configurable-Grass-Spread-Tick-Rate.patch +++ b/Spigot-Server-Patches/Configurable-Grass-Spread-Tick-Rate.patch @@ -19,10 +19,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("Grass Spread Tick Rate: " + grassUpdateRate); + } } -diff --git a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java b/src/main/java/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java -+++ b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java +--- a/src/main/java/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java @@ -0,0 +0,0 @@ public abstract class BlockDirtSnowSpreadable extends BlockDirtSnow { @Override diff --git a/Spigot-Server-Patches/Configurable-Keep-Spawn-Loaded-range-per-world.patch b/Spigot-Server-Patches/Configurable-Keep-Spawn-Loaded-range-per-world.patch index 3a4a0233c6..0d03fbd5e4 100644 --- a/Spigot-Server-Patches/Configurable-Keep-Spawn-Loaded-range-per-world.patch +++ b/Spigot-Server-Patches/Configurable-Keep-Spawn-Loaded-range-per-world.patch @@ -74,52 +74,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (true) { WorldServer worldserver1 = worldserver; -diff --git a/src/main/java/net/minecraft/server/WorldLoadListener.java b/src/main/java/net/minecraft/server/WorldLoadListener.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldLoadListener.java -+++ b/src/main/java/net/minecraft/server/WorldLoadListener.java -@@ -0,0 +0,0 @@ public interface WorldLoadListener { - void a(ChunkCoordIntPair chunkcoordintpair, @Nullable ChunkStatus chunkstatus); - - void b(); -+ -+ void setChunkRadius(int radius); // Paper - allow changing chunk radius - } -diff --git a/src/main/java/net/minecraft/server/WorldLoadListenerLogger.java b/src/main/java/net/minecraft/server/WorldLoadListenerLogger.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldLoadListenerLogger.java -+++ b/src/main/java/net/minecraft/server/WorldLoadListenerLogger.java -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - public class WorldLoadListenerLogger implements WorldLoadListener { - - private static final Logger LOGGER = LogManager.getLogger(); -- private final int b; -+ private int b; // Paper - remove final - private int c; - private long d; - private long e = Long.MAX_VALUE; - - public WorldLoadListenerLogger(int i) { -- int j = i * 2 + 1; -+ // Paper start - Allow changing radius later for configurable spawn patch -+ this.setChunkRadius(i); // Move to method -+ } -+ -+ @Override -+ public void setChunkRadius(int radius) { -+ // Paper - copied from above -+ int j = radius * 2 + 1; - - this.b = j * j; - } -+ // Paper end - - @Override - public void a(ChunkCoordIntPair chunkcoordintpair) { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { return ((PersistentIdCounts) this.getMinecraftServer().E().getWorldPersistentData().a(PersistentIdCounts::new, "idcounts")).a(); } @@ -212,6 +170,48 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.getMinecraftServer().getPlayerList().sendAll(new PacketPlayOutSpawnPosition(blockposition, f)); } +diff --git a/src/main/java/net/minecraft/server/level/progress/WorldLoadListener.java b/src/main/java/net/minecraft/server/level/progress/WorldLoadListener.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/progress/WorldLoadListener.java ++++ b/src/main/java/net/minecraft/server/level/progress/WorldLoadListener.java +@@ -0,0 +0,0 @@ public interface WorldLoadListener { + void a(ChunkCoordIntPair chunkcoordintpair, @Nullable ChunkStatus chunkstatus); + + void b(); ++ ++ void setChunkRadius(int radius); // Paper - allow changing chunk radius + } +diff --git a/src/main/java/net/minecraft/server/level/progress/WorldLoadListenerLogger.java b/src/main/java/net/minecraft/server/level/progress/WorldLoadListenerLogger.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/progress/WorldLoadListenerLogger.java ++++ b/src/main/java/net/minecraft/server/level/progress/WorldLoadListenerLogger.java +@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; + public class WorldLoadListenerLogger implements WorldLoadListener { + + private static final Logger LOGGER = LogManager.getLogger(); +- private final int b; ++ private int b; // Paper - remove final + private int c; + private long d; + private long e = Long.MAX_VALUE; + + public WorldLoadListenerLogger(int i) { +- int j = i * 2 + 1; ++ // Paper start - Allow changing radius later for configurable spawn patch ++ this.setChunkRadius(i); // Move to method ++ } ++ ++ @Override ++ public void setChunkRadius(int radius) { ++ // Paper - copied from above ++ int j = radius * 2 + 1; + + this.b = j * j; + } ++ // Paper end + + @Override + public void a(ChunkCoordIntPair chunkcoordintpair) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/Spigot-Server-Patches/Configurable-Non-Player-Arrow-Despawn-Rate.patch b/Spigot-Server-Patches/Configurable-Non-Player-Arrow-Despawn-Rate.patch index ec1cd10e36..c1621a49aa 100644 --- a/Spigot-Server-Patches/Configurable-Non-Player-Arrow-Despawn-Rate.patch +++ b/Spigot-Server-Patches/Configurable-Non-Player-Arrow-Despawn-Rate.patch @@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("Creative Arrow Despawn Rate: " + creativeArrowDespawnRate); + } } -diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityArrow.java -+++ b/src/main/java/net/minecraft/server/EntityArrow.java +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java @@ -0,0 +0,0 @@ public abstract class EntityArrow extends IProjectile { protected void h() { diff --git a/Spigot-Server-Patches/Configurable-Player-Collision.patch b/Spigot-Server-Patches/Configurable-Player-Collision.patch index d385b2cb8f..fc40d51729 100644 --- a/Spigot-Server-Patches/Configurable-Player-Collision.patch +++ b/Spigot-Server-Patches/Configurable-Player-Collision.patch @@ -18,6 +18,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + enablePlayerCollisions = getBoolean("settings.enable-player-collisions", true); + } } +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutScoreboardTeam.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutScoreboardTeam.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutScoreboardTeam.java +@@ -0,0 +0,0 @@ public class PacketPlayOutScoreboardTeam implements Packet<PacketListenerPlayOut + packetdataserializer.a(this.b); + packetdataserializer.writeByte(this.j); + packetdataserializer.a(this.e); +- packetdataserializer.a(this.f); ++ packetdataserializer.a(!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions ? "never" : this.f); // Paper + packetdataserializer.a((Enum) this.g); + packetdataserializer.a(this.c); + packetdataserializer.a(this.d); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -43,23 +56,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.server.enablePlugins(org.bukkit.plugin.PluginLoadOrder.POSTWORLD); this.server.getPluginManager().callEvent(new ServerLoadEvent(ServerLoadEvent.LoadType.STARTUP)); this.serverConnection.acceptConnections(); -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutScoreboardTeam.java -@@ -0,0 +0,0 @@ public class PacketPlayOutScoreboardTeam implements Packet<PacketListenerPlayOut - packetdataserializer.a(this.b); - packetdataserializer.writeByte(this.j); - packetdataserializer.a(this.e); -- packetdataserializer.a(this.f); -+ packetdataserializer.a(!com.destroystokyo.paper.PaperConfig.enablePlayerCollisions ? "never" : this.f); // Paper - packetdataserializer.a((Enum) this.g); - packetdataserializer.a(this.c); - packetdataserializer.a(this.d); -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { // CraftBukkit start private CraftServer cserver; diff --git a/Spigot-Server-Patches/Configurable-RCON-IP-address.patch b/Spigot-Server-Patches/Configurable-RCON-IP-address.patch index 6db45b0c73..e35ad00e49 100644 --- a/Spigot-Server-Patches/Configurable-RCON-IP-address.patch +++ b/Spigot-Server-Patches/Configurable-RCON-IP-address.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable RCON IP address For servers with multiple IP's, ability to bind to a specific interface. -diff --git a/src/main/java/net/minecraft/server/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/DedicatedServerProperties.java +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServerProperties.java -+++ b/src/main/java/net/minecraft/server/DedicatedServerProperties.java +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java @@ -0,0 +0,0 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr public final PropertyManager<DedicatedServerProperties>.EditableProperty<Boolean> whiteList; public final GeneratorSettings generatorSettings; @@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.generatorSettings = GeneratorSettings.a(iregistrycustom, properties); } -diff --git a/src/main/java/net/minecraft/server/PropertyManager.java b/src/main/java/net/minecraft/server/PropertyManager.java +diff --git a/src/main/java/net/minecraft/server/dedicated/PropertyManager.java b/src/main/java/net/minecraft/server/dedicated/PropertyManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PropertyManager.java -+++ b/src/main/java/net/minecraft/server/PropertyManager.java +--- a/src/main/java/net/minecraft/server/dedicated/PropertyManager.java ++++ b/src/main/java/net/minecraft/server/dedicated/PropertyManager.java @@ -0,0 +0,0 @@ public abstract class PropertyManager<T extends PropertyManager<T>> { }; } @@ -44,10 +44,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return (String) getOverride(s, this.properties.getProperty(s)); // CraftBukkit } -diff --git a/src/main/java/net/minecraft/server/RemoteControlListener.java b/src/main/java/net/minecraft/server/RemoteControlListener.java +diff --git a/src/main/java/net/minecraft/server/rcon/thread/RemoteControlListener.java b/src/main/java/net/minecraft/server/rcon/thread/RemoteControlListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RemoteControlListener.java -+++ b/src/main/java/net/minecraft/server/RemoteControlListener.java +--- a/src/main/java/net/minecraft/server/rcon/thread/RemoteControlListener.java ++++ b/src/main/java/net/minecraft/server/rcon/thread/RemoteControlListener.java @@ -0,0 +0,0 @@ public class RemoteControlListener extends RemoteConnectionThread { @Nullable public static RemoteControlListener a(IMinecraftServer iminecraftserver) { diff --git a/Spigot-Server-Patches/Configurable-baby-zombie-movement-speed.patch b/Spigot-Server-Patches/Configurable-baby-zombie-movement-speed.patch index 87db7f138e..ac9b2a945f 100644 --- a/Spigot-Server-Patches/Configurable-baby-zombie-movement-speed.patch +++ b/Spigot-Server-Patches/Configurable-baby-zombie-movement-speed.patch @@ -24,10 +24,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("Baby zombies will move at the speed of " + babyZombieMovementModifier); + } } -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java @@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityTransformEvent; public class EntityZombie extends EntityMonster { diff --git a/Spigot-Server-Patches/Configurable-cactus-bamboo-and-reed-growth-heights.patch b/Spigot-Server-Patches/Configurable-cactus-bamboo-and-reed-growth-heights.patch index 0bdab2f8d8..9a9af0ff0c 100644 --- a/Spigot-Server-Patches/Configurable-cactus-bamboo-and-reed-growth-heights.patch +++ b/Spigot-Server-Patches/Configurable-cactus-bamboo-and-reed-growth-heights.patch @@ -28,10 +28,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + } } -diff --git a/src/main/java/net/minecraft/server/BlockBamboo.java b/src/main/java/net/minecraft/server/BlockBamboo.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockBamboo.java b/src/main/java/net/minecraft/world/level/block/BlockBamboo.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockBamboo.java -+++ b/src/main/java/net/minecraft/server/BlockBamboo.java +--- a/src/main/java/net/minecraft/world/level/block/BlockBamboo.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockBamboo.java @@ -0,0 +0,0 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { if (random.nextInt(Math.max(1, (int) (100.0F / worldserver.spigotConfig.bambooModifier) * 3)) == 0 && worldserver.isEmpty(blockposition.up()) && worldserver.getLightLevel(blockposition.up(), 0) >= 9) { // Spigot int i = this.b(worldserver, blockposition) + 1; @@ -86,10 +86,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ; } -diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockCactus.java b/src/main/java/net/minecraft/world/level/block/BlockCactus.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockCactus.java -+++ b/src/main/java/net/minecraft/server/BlockCactus.java +--- a/src/main/java/net/minecraft/world/level/block/BlockCactus.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockCactus.java @@ -0,0 +0,0 @@ public class BlockCactus extends Block { ; } @@ -99,10 +99,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int j = (Integer) iblockdata.get(BlockCactus.AGE); if (j >= (byte) range(3, ((100.0F / worldserver.spigotConfig.cactusModifier) * 15) + 0.5F, 15)) { // Spigot -diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockReed.java b/src/main/java/net/minecraft/world/level/block/BlockReed.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockReed.java -+++ b/src/main/java/net/minecraft/server/BlockReed.java +--- a/src/main/java/net/minecraft/world/level/block/BlockReed.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockReed.java @@ -0,0 +0,0 @@ public class BlockReed extends Block { ; } diff --git a/Spigot-Server-Patches/Configurable-chance-of-villager-zombie-infection.patch b/Spigot-Server-Patches/Configurable-chance-of-villager-zombie-infection.patch index 3085084468..09eca278d0 100644 --- a/Spigot-Server-Patches/Configurable-chance-of-villager-zombie-infection.patch +++ b/Spigot-Server-Patches/Configurable-chance-of-villager-zombie-infection.patch @@ -21,10 +21,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance); + } } -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { @Override public void a(WorldServer worldserver, EntityLiving entityliving) { diff --git a/Spigot-Server-Patches/Configurable-connection-throttle-kick-message.patch b/Spigot-Server-Patches/Configurable-connection-throttle-kick-message.patch index 541bd3cf0b..7af28c95de 100644 --- a/Spigot-Server-Patches/Configurable-connection-throttle-kick-message.patch +++ b/Spigot-Server-Patches/Configurable-connection-throttle-kick-message.patch @@ -20,10 +20,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private static void savePlayerData() { Object val = config.get("settings.save-player-data"); if (val instanceof Boolean) { -diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java +diff --git a/src/main/java/net/minecraft/server/network/HandshakeListener.java b/src/main/java/net/minecraft/server/network/HandshakeListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/HandshakeListener.java -+++ b/src/main/java/net/minecraft/server/HandshakeListener.java +--- a/src/main/java/net/minecraft/server/network/HandshakeListener.java ++++ b/src/main/java/net/minecraft/server/network/HandshakeListener.java @@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { synchronized (throttleTracker) { if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) { diff --git a/Spigot-Server-Patches/Configurable-container-update-tick-rate.patch b/Spigot-Server-Patches/Configurable-container-update-tick-rate.patch index 32021339ce..13cf2d78b0 100644 --- a/Spigot-Server-Patches/Configurable-container-update-tick-rate.patch +++ b/Spigot-Server-Patches/Configurable-container-update-tick-rate.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + containerUpdateTickRate = getInt("container-update-tick-rate", 1); + } } -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public boolean e; public int ping; diff --git a/Spigot-Server-Patches/Configurable-door-breaking-difficulty.patch b/Spigot-Server-Patches/Configurable-door-breaking-difficulty.patch index 0d38b66740..bdbd1fa723 100644 --- a/Spigot-Server-Patches/Configurable-door-breaking-difficulty.patch +++ b/Spigot-Server-Patches/Configurable-door-breaking-difficulty.patch @@ -57,11 +57,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + ); + } } -diff --git a/src/main/java/net/minecraft/server/EntityVindicator.java b/src/main/java/net/minecraft/server/EntityVindicator.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java b/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVindicator.java -+++ b/src/main/java/net/minecraft/server/EntityVindicator.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.WorldAccess; public class EntityVindicator extends EntityIllagerAbstract { @@ -78,10 +78,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.a(EnumSet.of(PathfinderGoal.Type.MOVE)); } -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { private static final DataWatcherObject<Boolean> d = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); private static final DataWatcherObject<Integer> bo = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b); diff --git a/Spigot-Server-Patches/Configurable-end-credits.patch b/Spigot-Server-Patches/Configurable-end-credits.patch index f7d8f935a6..becd02ee01 100644 --- a/Spigot-Server-Patches/Configurable-end-credits.patch +++ b/Spigot-Server-Patches/Configurable-end-credits.patch @@ -19,10 +19,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("End credits disabled: " + disableEndCredits); + } } -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { private long ca = SystemUtils.getMonotonicMillis(); private Entity spectatedEntity; diff --git a/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch b/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch index 7272b85674..7952235d02 100644 --- a/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch +++ b/Spigot-Server-Patches/Configurable-fishing-time-ranges.patch @@ -21,10 +21,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("Fishing time ranges are between " + fishingMinTicks +" and " + fishingMaxTicks + " ticks"); + } } -diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFishingHook.java -+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java @@ -0,0 +0,0 @@ public class EntityFishingHook extends IProjectile { entityhuman.hookedFish = this; this.an = Math.max(0, i); diff --git a/Spigot-Server-Patches/Configurable-flying-kick-messages.patch b/Spigot-Server-Patches/Configurable-flying-kick-messages.patch index fdc7aa0f0e..a46d5752f9 100644 --- a/Spigot-Server-Patches/Configurable-flying-kick-messages.patch +++ b/Spigot-Server-Patches/Configurable-flying-kick-messages.patch @@ -20,10 +20,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + flyingKickVehicleMessage = getString("messages.kick.flying-vehicle", flyingKickVehicleMessage); + } } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { if (this.B && !this.player.isSleeping()) { if (++this.C > 80) { diff --git a/Spigot-Server-Patches/Configurable-max-leash-distance.patch b/Spigot-Server-Patches/Configurable-max-leash-distance.patch index 7f31bb791d..a5880f394f 100644 --- a/Spigot-Server-Patches/Configurable-max-leash-distance.patch +++ b/Spigot-Server-Patches/Configurable-max-leash-distance.patch @@ -21,10 +21,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean disableEndCredits; private void disableEndCredits() { disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false); -diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityCreature.java b/src/main/java/net/minecraft/world/entity/EntityCreature.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityCreature.java -+++ b/src/main/java/net/minecraft/server/EntityCreature.java +--- a/src/main/java/net/minecraft/world/entity/EntityCreature.java ++++ b/src/main/java/net/minecraft/world/entity/EntityCreature.java @@ -0,0 +0,0 @@ public abstract class EntityCreature extends EntityInsentient { float f = this.g(entity); diff --git a/Spigot-Server-Patches/Configurable-mob-spawner-tick-rate.patch b/Spigot-Server-Patches/Configurable-mob-spawner-tick-rate.patch index 02cae60806..fe01a25206 100644 --- a/Spigot-Server-Patches/Configurable-mob-spawner-tick-rate.patch +++ b/Spigot-Server-Patches/Configurable-mob-spawner-tick-rate.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + mobSpawnerTickRate = getInt("mob-spawner-tick-rate", 1); + } } -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { public int maxNearbyEntities = 6; public int requiredPlayerRange = 16; diff --git a/Spigot-Server-Patches/Configurable-packet-in-spam-threshold.patch b/Spigot-Server-Patches/Configurable-packet-in-spam-threshold.patch index c69a0f004f..d2d7766003 100644 --- a/Spigot-Server-Patches/Configurable-packet-in-spam-threshold.patch +++ b/Spigot-Server-Patches/Configurable-packet-in-spam-threshold.patch @@ -22,10 +22,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + packetInSpamThreshold = getInt("settings.incoming-packet-spam-threshold", 300); + } } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { // Spigot start - limit place/interactions private int limitedPackets; diff --git a/Spigot-Server-Patches/Configurable-projectile-relative-velocity.patch b/Spigot-Server-Patches/Configurable-projectile-relative-velocity.patch index 8ace9e0ee2..b4c27332db 100644 --- a/Spigot-Server-Patches/Configurable-projectile-relative-velocity.patch +++ b/Spigot-Server-Patches/Configurable-projectile-relative-velocity.patch @@ -38,10 +38,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + disableRelativeProjectileVelocity = getBoolean("game-mechanics.disable-relative-projectile-velocity", false); + } } -diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IProjectile.java -+++ b/src/main/java/net/minecraft/server/IProjectile.java +--- a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java @@ -0,0 +0,0 @@ public abstract class IProjectile extends Entity { this.shoot((double) f5, (double) f6, (double) f7, f3, f4); Vec3D vec3d = entity.getMot(); diff --git a/Spigot-Server-Patches/Configurable-spawn-chances-for-skeleton-horses.patch b/Spigot-Server-Patches/Configurable-spawn-chances-for-skeleton-horses.patch index 098a23aebe..6e3e87a434 100644 --- a/Spigot-Server-Patches/Configurable-spawn-chances-for-skeleton-horses.patch +++ b/Spigot-Server-Patches/Configurable-spawn-chances-for-skeleton-horses.patch @@ -21,10 +21,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } } -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { blockposition = this.a(this.a(j, 0, k, 15)); if (this.isRainingAt(blockposition)) { 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 26449fed76..97fd314b67 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 @@ -19,10 +19,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("Water over lava flow speed: " + waterOverLavaFlowSpeed); + } } -diff --git a/src/main/java/net/minecraft/server/BlockFluids.java b/src/main/java/net/minecraft/server/BlockFluids.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockFluids.java b/src/main/java/net/minecraft/world/level/block/BlockFluids.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockFluids.java -+++ b/src/main/java/net/minecraft/server/BlockFluids.java +--- a/src/main/java/net/minecraft/world/level/block/BlockFluids.java ++++ b/src/main/java/net/minecraft/world/level/block/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) { diff --git a/Spigot-Server-Patches/Configurable-sprint-interruption-on-attack.patch b/Spigot-Server-Patches/Configurable-sprint-interruption-on-attack.patch index 326e772269..3120f02ae9 100644 --- a/Spigot-Server-Patches/Configurable-sprint-interruption-on-attack.patch +++ b/Spigot-Server-Patches/Configurable-sprint-interruption-on-attack.patch @@ -19,10 +19,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + disableSprintInterruptionOnAttack = getBoolean("game-mechanics.disable-sprint-interruption-on-attack", false); + } } -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { } diff --git a/Spigot-Server-Patches/Configurable-top-of-nether-void-damage.patch b/Spigot-Server-Patches/Configurable-top-of-nether-void-damage.patch index e769f122d7..1853b80edc 100644 --- a/Spigot-Server-Patches/Configurable-top-of-nether-void-damage.patch +++ b/Spigot-Server-Patches/Configurable-top-of-nether-void-damage.patch @@ -28,11 +28,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne this.fallDistance *= 0.5F; } @@ -49,7 +49,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!this.world.isClientSide) { this.setFlag(0, this.fireTicks > 0); -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne this.setFireTicks(0); } @@ -67,10 +67,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected void an() { this.die(); } -diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java @@ -0,0 +0,0 @@ public abstract class EntityMinecartAbstract extends Entity { this.setDamage(this.getDamage() - 1.0F); } diff --git a/Spigot-Server-Patches/Create-HoverEvent-from-ItemStack-Entity.patch b/Spigot-Server-Patches/Create-HoverEvent-from-ItemStack-Entity.patch index 35083eee90..2b896e95c9 100644 --- a/Spigot-Server-Patches/Create-HoverEvent-from-ItemStack-Entity.patch +++ b/Spigot-Server-Patches/Create-HoverEvent-from-ItemStack-Entity.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java @@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory { - return nms != null ? net.minecraft.server.LocaleLanguage.getInstance().translateKey(nms.getItem().getName()) : null; + return nms != null ? net.minecraft.locale.LocaleLanguage.getInstance().translateKey(nms.getItem().getName()) : null; } + + @Override diff --git a/Spigot-Server-Patches/Custom-replacement-for-eaten-items.patch b/Spigot-Server-Patches/Custom-replacement-for-eaten-items.patch index 95aa3cc8e6..add86c6525 100644 --- a/Spigot-Server-Patches/Custom-replacement-for-eaten-items.patch +++ b/Spigot-Server-Patches/Custom-replacement-for-eaten-items.patch @@ -4,10 +4,10 @@ Date: Sun, 21 Jun 2015 15:07:20 -0400 Subject: [PATCH] Custom replacement for eaten items -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { this.b(this.activeItem, 16); // CraftBukkit start - fire PlayerItemConsumeEvent diff --git a/Spigot-Server-Patches/Dead-Player-s-shouldn-t-be-able-to-move.patch b/Spigot-Server-Patches/Dead-Player-s-shouldn-t-be-able-to-move.patch index aa3f82051d..a696558333 100644 --- a/Spigot-Server-Patches/Dead-Player-s-shouldn-t-be-able-to-move.patch +++ b/Spigot-Server-Patches/Dead-Player-s-shouldn-t-be-able-to-move.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Dead Player's shouldn't be able to move This fixes a lot of game state issues where packets were delayed for processing due to 1.15's new queue but processed while dead. -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { @Override diff --git a/Spigot-Server-Patches/Delay-Chunk-Unloads-based-on-Player-Movement.patch b/Spigot-Server-Patches/Delay-Chunk-Unloads-based-on-Player-Movement.patch index 11429dfed7..80a820eff0 100644 --- a/Spigot-Server-Patches/Delay-Chunk-Unloads-based-on-Player-Movement.patch +++ b/Spigot-Server-Patches/Delay-Chunk-Unloads-based-on-Player-Movement.patch @@ -34,10 +34,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } } -diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkMapDistance.java -+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java +--- a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java @@ -0,0 +0,0 @@ public abstract class ChunkMapDistance { boolean removed = false; // CraftBukkit if (arraysetsorted.remove(ticket)) { @@ -66,10 +66,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } if (arraysetsorted.isEmpty()) { -diff --git a/src/main/java/net/minecraft/server/Ticket.java b/src/main/java/net/minecraft/server/Ticket.java +diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Ticket.java -+++ b/src/main/java/net/minecraft/server/Ticket.java +--- a/src/main/java/net/minecraft/server/level/Ticket.java ++++ b/src/main/java/net/minecraft/server/level/Ticket.java @@ -0,0 +0,0 @@ public final class Ticket<T> implements Comparable<Ticket<?>> { public final T identifier; public final T getObjectReason() { return this.identifier; } // Paper - OBFHELPER private long d; public final long getCreationTick() { return this.d; } // Paper - OBFHELPER @@ -93,10 +93,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return j != 0L && i - this.d > j; } -diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java +diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TicketType.java -+++ b/src/main/java/net/minecraft/server/TicketType.java +--- a/src/main/java/net/minecraft/server/level/TicketType.java ++++ b/src/main/java/net/minecraft/server/level/TicketType.java @@ -0,0 +0,0 @@ public class TicketType<T> { public static final TicketType<Long> ASYNC_LOAD = a("async_load", Long::compareTo); // Paper public static final TicketType<ChunkCoordIntPair> PRIORITY = a("priority", Comparator.comparingLong(ChunkCoordIntPair::pair), 300); // Paper diff --git a/Spigot-Server-Patches/Delay-unsafe-actions-until-after-entity-ticking-is-d.patch b/Spigot-Server-Patches/Delay-unsafe-actions-until-after-entity-ticking-is-d.patch index 533cad8881..fe26bb9687 100644 --- a/Spigot-Server-Patches/Delay-unsafe-actions-until-after-entity-ticking-is-d.patch +++ b/Spigot-Server-Patches/Delay-unsafe-actions-until-after-entity-ticking-is-d.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Delay unsafe actions until after entity ticking is done This will help prevent many cases of unregistering entities during entity ticking -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { public final List<EntityPlayer> players = Lists.newArrayList(); // Paper - private -> public public final ChunkProviderServer chunkProvider; // Paper - public diff --git a/Spigot-Server-Patches/Disable-Explicit-Network-Manager-Flushing.patch b/Spigot-Server-Patches/Disable-Explicit-Network-Manager-Flushing.patch index 7bbcdfeef1..f5b7a8d008 100644 --- a/Spigot-Server-Patches/Disable-Explicit-Network-Manager-Flushing.patch +++ b/Spigot-Server-Patches/Disable-Explicit-Network-Manager-Flushing.patch @@ -11,10 +11,10 @@ flushing on the netty event loop, so it won't do the flush on the main thread. Renable flushing by passing -Dpaper.explicit-flush=true -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java +diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java +--- a/src/main/java/net/minecraft/network/NetworkManager.java ++++ b/src/main/java/net/minecraft/network/NetworkManager.java @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { // Paper start - NetworkClient implementation public int protocolVersion; diff --git a/Spigot-Server-Patches/Disable-Scoreboards-for-non-players-by-default.patch b/Spigot-Server-Patches/Disable-Scoreboards-for-non-players-by-default.patch index eaca4bc3e8..6f972cc9b2 100644 --- a/Spigot-Server-Patches/Disable-Scoreboards-for-non-players-by-default.patch +++ b/Spigot-Server-Patches/Disable-Scoreboards-for-non-players-by-default.patch @@ -24,11 +24,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + nonPlayerEntitiesOnScoreboards = getBoolean("allow-non-player-entities-on-scoreboards", false); + } } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne @Nullable public ScoreboardTeamBase getScoreboardTeam() { @@ -36,10 +36,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.world.getScoreboard().getPlayerTeam(this.getName()); } -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { if (nbttagcompound.hasKeyOfType("Team", 8)) { String s = nbttagcompound.getString("Team"); diff --git a/Spigot-Server-Patches/Disable-explosion-knockback.patch b/Spigot-Server-Patches/Disable-explosion-knockback.patch index 0b4313a6a5..00137e7b4f 100644 --- a/Spigot-Server-Patches/Disable-explosion-knockback.patch +++ b/Spigot-Server-Patches/Disable-explosion-knockback.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + disableExplosionKnockback = getBoolean("disable-explosion-knockback", false); + } } -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } } @@ -46,10 +46,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.dl()) { if (!this.f(damagesource)) { SoundEffect soundeffect = this.getSoundDeath(); -diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java +diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Explosion.java -+++ b/src/main/java/net/minecraft/server/Explosion.java +--- a/src/main/java/net/minecraft/world/level/Explosion.java ++++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -0,0 +0,0 @@ public class Explosion { double d14 = d13; diff --git a/Spigot-Server-Patches/Disable-ice-and-snow.patch b/Spigot-Server-Patches/Disable-ice-and-snow.patch index 6342a07597..60ab67faa2 100644 --- a/Spigot-Server-Patches/Disable-ice-and-snow.patch +++ b/Spigot-Server-Patches/Disable-ice-and-snow.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + disableIceAndSnow = getBoolean("disable-ice-and-snow", false); + } } -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { } diff --git a/Spigot-Server-Patches/Disable-spigot-tick-limiters.patch b/Spigot-Server-Patches/Disable-spigot-tick-limiters.patch index 4781fcc7ed..61b8226545 100644 --- a/Spigot-Server-Patches/Disable-spigot-tick-limiters.patch +++ b/Spigot-Server-Patches/Disable-spigot-tick-limiters.patch @@ -4,10 +4,10 @@ Date: Wed, 2 Mar 2016 23:45:17 -0600 Subject: [PATCH] Disable spigot tick limiters -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // Spigot start // Iterator iterator = this.tileEntityListTick.iterator(); diff --git a/Spigot-Server-Patches/Disable-thunder.patch b/Spigot-Server-Patches/Disable-thunder.patch index 96879cd74d..e68a19d729 100644 --- a/Spigot-Server-Patches/Disable-thunder.patch +++ b/Spigot-Server-Patches/Disable-thunder.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + disableThunder = getBoolean("disable-thunder", false); + } } -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { gameprofilerfiller.enter("thunder"); BlockPosition blockposition; diff --git a/Spigot-Server-Patches/Do-not-allow-bees-to-load-chunks-for-beehives.patch b/Spigot-Server-Patches/Do-not-allow-bees-to-load-chunks-for-beehives.patch index 9028abc3d3..9de794cc9b 100644 --- a/Spigot-Server-Patches/Do-not-allow-bees-to-load-chunks-for-beehives.patch +++ b/Spigot-Server-Patches/Do-not-allow-bees-to-load-chunks-for-beehives.patch @@ -4,10 +4,10 @@ Date: Tue, 17 Mar 2020 14:18:50 -0500 Subject: [PATCH] Do not allow bees to load chunks for beehives -diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/net/minecraft/server/EntityBee.java +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityBee.java b/src/main/java/net/minecraft/world/entity/animal/EntityBee.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityBee.java -+++ b/src/main/java/net/minecraft/server/EntityBee.java +--- a/src/main/java/net/minecraft/world/entity/animal/EntityBee.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityBee.java @@ -0,0 +0,0 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB if (this.hivePos == null) { return false; diff --git a/Spigot-Server-Patches/Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch b/Spigot-Server-Patches/Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch index 2898e5c626..c256938f1d 100644 --- a/Spigot-Server-Patches/Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch +++ b/Spigot-Server-Patches/Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Do not crash from invalid ingredient lists in VillagerAcquireTradeEvent -diff --git a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java @@ -0,0 +0,0 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP Bukkit.getPluginManager().callEvent(event); } diff --git a/Spigot-Server-Patches/Do-not-let-armorstands-drown.patch b/Spigot-Server-Patches/Do-not-let-armorstands-drown.patch index 2ea77dfbde..78f6d24636 100644 --- a/Spigot-Server-Patches/Do-not-let-armorstands-drown.patch +++ b/Spigot-Server-Patches/Do-not-let-armorstands-drown.patch @@ -4,25 +4,10 @@ Date: Sat, 18 Feb 2017 19:29:58 -0600 Subject: [PATCH] Do not let armorstands drown -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - super.move(moveType, vec3d); - } - } -+ -+ @Override -+ public boolean canBreatheUnderwater() { // Skips a bit of damage handling code, probably a micro-optimization -+ return true; -+ } - // Paper end - } -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { super.a(d0, flag, iblockdata, blockposition); } @@ -40,3 +25,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.setAirTicks(this.l(this.getAirTicks())); if (this.getAirTicks() == -20) { this.setAirTicks(0); +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { + super.move(moveType, vec3d); + } + } ++ ++ @Override ++ public boolean canBreatheUnderwater() { // Skips a bit of damage handling code, probably a micro-optimization ++ return true; ++ } + // Paper end + } diff --git a/Spigot-Server-Patches/Do-not-let-the-server-load-chunks-from-newer-version.patch b/Spigot-Server-Patches/Do-not-let-the-server-load-chunks-from-newer-version.patch index 475be16010..c6b153248f 100644 --- a/Spigot-Server-Patches/Do-not-let-the-server-load-chunks-from-newer-version.patch +++ b/Spigot-Server-Patches/Do-not-let-the-server-load-chunks-from-newer-version.patch @@ -8,10 +8,10 @@ the game, immediately stop the server to prevent data corruption. You can override this functionality at your own peril. -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java @@ -0,0 +0,0 @@ public class ChunkRegionLoader { return holder.protoChunk; } diff --git a/Spigot-Server-Patches/Do-not-load-chunks-for-Pathfinding.patch b/Spigot-Server-Patches/Do-not-load-chunks-for-Pathfinding.patch index 7875c809de..758bdef853 100644 --- a/Spigot-Server-Patches/Do-not-load-chunks-for-Pathfinding.patch +++ b/Spigot-Server-Patches/Do-not-load-chunks-for-Pathfinding.patch @@ -4,10 +4,10 @@ Date: Thu, 31 Mar 2016 19:17:58 -0400 Subject: [PATCH] Do not load chunks for Pathfinding -diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NavigationAbstract.java -+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java @@ -0,0 +0,0 @@ public abstract class NavigationAbstract { private BlockPosition p; private int q; @@ -17,10 +17,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private boolean t; public NavigationAbstract(EntityInsentient entityinsentient, World world) { -diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java b/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Pathfinder.java -+++ b/src/main/java/net/minecraft/server/Pathfinder.java +--- a/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java @@ -0,0 +0,0 @@ public class Pathfinder { private final PathPoint[] a = new PathPoint[32]; @@ -30,10 +30,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private final Path d = new Path(); public Pathfinder(PathfinderAbstract pathfinderabstract, int i) { -diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderNormal.java -+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java +--- a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java @@ -0,0 +0,0 @@ public class PathfinderNormal extends PathfinderAbstract { for (int j1 = -1; j1 <= 1; ++j1) { if (l != 0 || j1 != 0) { diff --git a/Spigot-Server-Patches/Don-t-allow-digging-into-unloaded-chunks.patch b/Spigot-Server-Patches/Don-t-allow-digging-into-unloaded-chunks.patch index 7295da66e6..bfb94fc217 100644 --- a/Spigot-Server-Patches/Don-t-allow-digging-into-unloaded-chunks.patch +++ b/Spigot-Server-Patches/Don-t-allow-digging-into-unloaded-chunks.patch @@ -4,26 +4,10 @@ Date: Sun, 11 Nov 2018 21:01:09 +0000 Subject: [PATCH] Don't allow digging into unloaded chunks -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - case START_DESTROY_BLOCK: - case ABORT_DESTROY_BLOCK: - case STOP_DESTROY_BLOCK: -+ // Paper start - Don't allow digging in unloaded chunks -+ if (this.player.world.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) { -+ return; -+ } -+ // Paper end - Don't allow digging in unloaded chunks - this.player.playerInteractManager.a(blockposition, packetplayinblockdig_enumplayerdigtype, packetplayinblockdig.c(), this.minecraftServer.getMaxBuildHeight()); - return; - default: -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java +--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java @@ -0,0 +0,0 @@ public class PlayerInteractManager { IBlockData iblockdata; @@ -66,3 +50,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } this.world.a(this.player.getId(), blockposition, -1); +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { + case START_DESTROY_BLOCK: + case ABORT_DESTROY_BLOCK: + case STOP_DESTROY_BLOCK: ++ // Paper start - Don't allow digging in unloaded chunks ++ if (this.player.world.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) { ++ return; ++ } ++ // Paper end - Don't allow digging in unloaded chunks + this.player.playerInteractManager.a(blockposition, packetplayinblockdig_enumplayerdigtype, packetplayinblockdig.c(), this.minecraftServer.getMaxBuildHeight()); + return; + default: diff --git a/Spigot-Server-Patches/Don-t-allow-entities-to-ride-themselves-572.patch b/Spigot-Server-Patches/Don-t-allow-entities-to-ride-themselves-572.patch index 2ea7cf5988..932c57cd1c 100644 --- a/Spigot-Server-Patches/Don-t-allow-entities-to-ride-themselves-572.patch +++ b/Spigot-Server-Patches/Don-t-allow-entities-to-ride-themselves-572.patch @@ -4,11 +4,11 @@ Date: Sun, 8 Jan 2017 04:31:36 +0000 Subject: [PATCH] Don't allow entities to ride themselves - #572 -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } protected boolean addPassenger(Entity entity) { // CraftBukkit diff --git a/Spigot-Server-Patches/Don-t-allow-null-UUID-s-for-chat.patch b/Spigot-Server-Patches/Don-t-allow-null-UUID-s-for-chat.patch index 0f275760e4..b1e6502216 100644 --- a/Spigot-Server-Patches/Don-t-allow-null-UUID-s-for-chat.patch +++ b/Spigot-Server-Patches/Don-t-allow-null-UUID-s-for-chat.patch @@ -4,10 +4,10 @@ Date: Sun, 28 Jun 2020 19:36:55 -0400 Subject: [PATCH] Don't allow null UUID's for chat -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java @@ -0,0 +0,0 @@ public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> { public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, ChatMessageType chatmessagetype, UUID uuid) { this.a = ichatbasecomponent; 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 4fd0b14ae6..79420ffc6a 100644 --- a/Spigot-Server-Patches/Don-t-call-getItemMeta-on-hasItemMeta.patch +++ b/Spigot-Server-Patches/Don-t-call-getItemMeta-on-hasItemMeta.patch @@ -22,25 +22,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return hasItemMeta(handle) && (handle.getDamage() != 0 || (handle.getTag() != null && handle.getTag().map.size() >= (handle.getTag().hasKey(CraftMetaItem.DAMAGE.NBT) ? 2 : 1))); // Paper - keep 1.12 CraftBukkit behavior without calling getItemMeta } - static boolean hasItemMeta(net.minecraft.server.ItemStack item) { + static boolean hasItemMeta(net.minecraft.world.item.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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 @@ package org.bukkit.craftbukkit.inventory; - - 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; -+ -+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)); } @@ -55,7 +41,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + stack.setDurability((short) 2); + assertThat("ItemStack with non-zero durability should have ItemMeta", stack.hasItemMeta(), is(true)); + -+ stack.setLore(Collections.singletonList("Lore")); ++ stack.setLore(java.util.Collections.singletonList("Lore")); + assertThat("ItemStack with lore and durability should have ItemMeta", stack.hasItemMeta(), is(true)); + + stack.setDurability((short) 0); diff --git a/Spigot-Server-Patches/Don-t-change-the-Entity-Random-seed-for-squids.patch b/Spigot-Server-Patches/Don-t-change-the-Entity-Random-seed-for-squids.patch index 16835ae2d1..9c244aeb03 100644 --- a/Spigot-Server-Patches/Don-t-change-the-Entity-Random-seed-for-squids.patch +++ b/Spigot-Server-Patches/Don-t-change-the-Entity-Random-seed-for-squids.patch @@ -4,10 +4,10 @@ Date: Thu, 19 Jul 2018 01:05:00 -0400 Subject: [PATCH] Don't change the Entity Random seed for squids -diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java b/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntitySquid.java -+++ b/src/main/java/net/minecraft/server/EntitySquid.java +--- a/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java @@ -0,0 +0,0 @@ public class EntitySquid extends EntityWaterAnimal { public EntitySquid(EntityTypes<? extends EntitySquid> entitytypes, World world) { diff --git a/Spigot-Server-Patches/Don-t-check-ConvertSigns-boolean-every-sign-save.patch b/Spigot-Server-Patches/Don-t-check-ConvertSigns-boolean-every-sign-save.patch index c4a6200bf9..a97e02ff99 100644 --- a/Spigot-Server-Patches/Don-t-check-ConvertSigns-boolean-every-sign-save.patch +++ b/Spigot-Server-Patches/Don-t-check-ConvertSigns-boolean-every-sign-save.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Don't check ConvertSigns boolean every sign save property lookups arent super cheap. they synchronize, validate and check security managers. -diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntitySign.java -+++ b/src/main/java/net/minecraft/server/TileEntitySign.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java @@ -0,0 +0,0 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // private final FormattedString[] g; private EnumColor color; diff --git a/Spigot-Server-Patches/Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch b/Spigot-Server-Patches/Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch index ff389c51f8..322f2263d8 100644 --- a/Spigot-Server-Patches/Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch +++ b/Spigot-Server-Patches/Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch @@ -4,10 +4,10 @@ Date: Sun, 5 Jul 2020 14:59:31 -0400 Subject: [PATCH] Don't check chunk for portal on world gen entity add -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { Entity entity = this.getVehicle(); diff --git a/Spigot-Server-Patches/Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch b/Spigot-Server-Patches/Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch index 8a16518afa..637f8d6877 100644 --- a/Spigot-Server-Patches/Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch +++ b/Spigot-Server-Patches/Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Don't crash if player is attempted to be removed from I suspect it deals with teleporting as it uses players current x/y/z -diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkMapDistance.java -+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java +--- a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java @@ -0,0 +0,0 @@ public abstract class ChunkMapDistance { ObjectSet<EntityPlayer> objectset = (ObjectSet) this.c.get(i); if (objectset == null) return; // CraftBukkit - SPIGOT-6208 diff --git a/Spigot-Server-Patches/Don-t-fire-BlockFade-on-worldgen-threads.patch b/Spigot-Server-Patches/Don-t-fire-BlockFade-on-worldgen-threads.patch index ea6b460cec..84adb23237 100644 --- a/Spigot-Server-Patches/Don-t-fire-BlockFade-on-worldgen-threads.patch +++ b/Spigot-Server-Patches/Don-t-fire-BlockFade-on-worldgen-threads.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't fire BlockFade on worldgen threads Caused a deadlock -diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockFire.java b/src/main/java/net/minecraft/world/level/block/BlockFire.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockFire.java -+++ b/src/main/java/net/minecraft/server/BlockFire.java +--- a/src/main/java/net/minecraft/world/level/block/BlockFire.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockFire.java @@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract { @Override public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) { diff --git a/Spigot-Server-Patches/Don-t-let-fishinghooks-use-portals.patch b/Spigot-Server-Patches/Don-t-let-fishinghooks-use-portals.patch index 8734c661cc..c03d023707 100644 --- a/Spigot-Server-Patches/Don-t-let-fishinghooks-use-portals.patch +++ b/Spigot-Server-Patches/Don-t-let-fishinghooks-use-portals.patch @@ -4,10 +4,10 @@ Date: Fri, 16 Dec 2016 16:03:19 -0600 Subject: [PATCH] Don't let fishinghooks use portals -diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFishingHook.java -+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java @@ -0,0 +0,0 @@ public class EntityFishingHook extends IProjectile { this.setMot(this.getMot().a(0.92D)); diff --git a/Spigot-Server-Patches/Don-t-load-Chunks-from-Hoppers-and-other-things.patch b/Spigot-Server-Patches/Don-t-load-Chunks-from-Hoppers-and-other-things.patch index f9461e3223..7fa77b15d2 100644 --- a/Spigot-Server-Patches/Don-t-load-Chunks-from-Hoppers-and-other-things.patch +++ b/Spigot-Server-Patches/Don-t-load-Chunks-from-Hoppers-and-other-things.patch @@ -12,10 +12,10 @@ only to be reloaded again the next tick. This of course is undesirable, so just return the loaded side as "primary" and treat it as a single chest if the other sides are unloaded -diff --git a/src/main/java/net/minecraft/server/DoubleBlockFinder.java b/src/main/java/net/minecraft/server/DoubleBlockFinder.java +diff --git a/src/main/java/net/minecraft/world/level/block/DoubleBlockFinder.java b/src/main/java/net/minecraft/world/level/block/DoubleBlockFinder.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DoubleBlockFinder.java -+++ b/src/main/java/net/minecraft/server/DoubleBlockFinder.java +--- a/src/main/java/net/minecraft/world/level/block/DoubleBlockFinder.java ++++ b/src/main/java/net/minecraft/world/level/block/DoubleBlockFinder.java @@ -0,0 +0,0 @@ public class DoubleBlockFinder { return new DoubleBlockFinder.Result.Single<>(s0); } else { diff --git a/Spigot-Server-Patches/Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch b/Spigot-Server-Patches/Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch index 62ef06f5dc..cb8f6d67f2 100644 --- a/Spigot-Server-Patches/Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch +++ b/Spigot-Server-Patches/Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch @@ -4,10 +4,10 @@ Date: Sat, 16 Jul 2016 19:11:17 -0500 Subject: [PATCH] Don't lookup game profiles that have no UUID and no name -diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java +diff --git a/src/main/java/net/minecraft/server/players/UserCache.java b/src/main/java/net/minecraft/server/players/UserCache.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/UserCache.java -+++ b/src/main/java/net/minecraft/server/UserCache.java +--- a/src/main/java/net/minecraft/server/players/UserCache.java ++++ b/src/main/java/net/minecraft/server/players/UserCache.java @@ -0,0 +0,0 @@ public class UserCache { gameprofilerepository.findProfilesByNames(new String[]{s}, Agent.MINECRAFT, profilelookupcallback); GameProfile gameprofile = (GameProfile) atomicreference.get(); diff --git a/Spigot-Server-Patches/Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch b/Spigot-Server-Patches/Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch index d63780062b..bed15a3ab0 100644 --- a/Spigot-Server-Patches/Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch +++ b/Spigot-Server-Patches/Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch @@ -4,10 +4,10 @@ Date: Sun, 27 Sep 2020 16:25:24 +0200 Subject: [PATCH] Don't mark dirty in invalid locations (SPIGOT-6086) -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { } diff --git a/Spigot-Server-Patches/Don-t-mark-null-chunk-sections-for-block-updates.patch b/Spigot-Server-Patches/Don-t-mark-null-chunk-sections-for-block-updates.patch index b718c4c741..80b20211fe 100644 --- a/Spigot-Server-Patches/Don-t-mark-null-chunk-sections-for-block-updates.patch +++ b/Spigot-Server-Patches/Don-t-mark-null-chunk-sections-for-block-updates.patch @@ -4,10 +4,10 @@ Date: Fri, 14 Aug 2020 23:41:19 +0200 Subject: [PATCH] Don't mark null chunk sections for block updates -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { this.a(world, blockposition, iblockdata); } else { diff --git a/Spigot-Server-Patches/Don-t-move-existing-players-to-world-spawn.patch b/Spigot-Server-Patches/Don-t-move-existing-players-to-world-spawn.patch index 952abfb3bd..d660d400fa 100644 --- a/Spigot-Server-Patches/Don-t-move-existing-players-to-world-spawn.patch +++ b/Spigot-Server-Patches/Don-t-move-existing-players-to-world-spawn.patch @@ -9,10 +9,10 @@ larger than the keep loaded range. By skipping this, we avoid potential for a large spike on server start. -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.serverStatisticManager = minecraftserver.getPlayerList().getStatisticManager(this); this.advancementDataPlayer = minecraftserver.getPlayerList().f(this); @@ -39,10 +39,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } this.playerInteractManager.a((WorldServer) world); } -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { worldserver1 = worldserver; } diff --git a/Spigot-Server-Patches/Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch b/Spigot-Server-Patches/Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch index 59ccc44c0f..2a519f1c65 100644 --- a/Spigot-Server-Patches/Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch +++ b/Spigot-Server-Patches/Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't nest if we don't need to when cerealising text components -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java @@ -0,0 +0,0 @@ public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> { // Paper end // Spigot start diff --git a/Spigot-Server-Patches/Don-t-require-FACING-data.patch b/Spigot-Server-Patches/Don-t-require-FACING-data.patch index 08a415add6..e2b2af0870 100644 --- a/Spigot-Server-Patches/Don-t-require-FACING-data.patch +++ b/Spigot-Server-Patches/Don-t-require-FACING-data.patch @@ -4,10 +4,10 @@ Date: Sun, 23 Aug 2020 19:01:04 +0200 Subject: [PATCH] Don't require FACING data -diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorItem.java b/src/main/java/net/minecraft/server/DispenseBehaviorItem.java +diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseBehaviorItem.java b/src/main/java/net/minecraft/core/dispenser/DispenseBehaviorItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DispenseBehaviorItem.java -+++ b/src/main/java/net/minecraft/server/DispenseBehaviorItem.java +--- a/src/main/java/net/minecraft/core/dispenser/DispenseBehaviorItem.java ++++ b/src/main/java/net/minecraft/core/dispenser/DispenseBehaviorItem.java @@ -0,0 +0,0 @@ import org.bukkit.event.block.BlockDispenseEvent; // CraftBukkit end diff --git a/Spigot-Server-Patches/Don-t-run-entity-collision-code-if-not-needed.patch b/Spigot-Server-Patches/Don-t-run-entity-collision-code-if-not-needed.patch index aaf43a8ecd..8d22fb3c5d 100644 --- a/Spigot-Server-Patches/Don-t-run-entity-collision-code-if-not-needed.patch +++ b/Spigot-Server-Patches/Don-t-run-entity-collision-code-if-not-needed.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Don't run entity collision code if not needed Will not run if max entity craming is disabled and the max collisions per entity is less than or equal to 0 -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { protected void doTick() {} diff --git a/Spigot-Server-Patches/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch b/Spigot-Server-Patches/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch index 97b60685fc..240c806b19 100644 --- a/Spigot-Server-Patches/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch +++ b/Spigot-Server-Patches/Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + saveEmptyScoreboardTeams = getBoolean("settings.save-empty-scoreboard-teams", false); + } } -diff --git a/src/main/java/net/minecraft/server/PersistentScoreboard.java b/src/main/java/net/minecraft/server/PersistentScoreboard.java +diff --git a/src/main/java/net/minecraft/world/scores/PersistentScoreboard.java b/src/main/java/net/minecraft/world/scores/PersistentScoreboard.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PersistentScoreboard.java -+++ b/src/main/java/net/minecraft/server/PersistentScoreboard.java +--- a/src/main/java/net/minecraft/world/scores/PersistentScoreboard.java ++++ b/src/main/java/net/minecraft/world/scores/PersistentScoreboard.java @@ -0,0 +0,0 @@ public class PersistentScoreboard extends PersistentBase { while (iterator.hasNext()) { diff --git a/Spigot-Server-Patches/Don-t-tick-Skulls-unused-code.patch b/Spigot-Server-Patches/Don-t-tick-Skulls-unused-code.patch index 9002d10cda..deb2a4be9b 100644 --- a/Spigot-Server-Patches/Don-t-tick-Skulls-unused-code.patch +++ b/Spigot-Server-Patches/Don-t-tick-Skulls-unused-code.patch @@ -4,12 +4,12 @@ Date: Wed, 13 Apr 2016 00:30:10 -0400 Subject: [PATCH] Don't tick Skulls - unused code -diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntitySkull.java -+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java -@@ -0,0 +0,0 @@ import com.mojang.authlib.ProfileLookupCallback; - import java.util.concurrent.Callable; +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java +@@ -0,0 +0,0 @@ import net.minecraft.server.MinecraftServer; + import net.minecraft.world.entity.player.EntityHuman; // Spigot end -public class TileEntitySkull extends TileEntity implements ITickable { diff --git a/Spigot-Server-Patches/Don-t-tick-dead-players.patch b/Spigot-Server-Patches/Don-t-tick-dead-players.patch index b9e63c162d..1080a57a49 100644 --- a/Spigot-Server-Patches/Don-t-tick-dead-players.patch +++ b/Spigot-Server-Patches/Don-t-tick-dead-players.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Don't tick dead players Causes sync chunk loads and who knows what all else. This is safe because Spectators are skipped in unloaded chunks too in vanilla. -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void playerTick() { diff --git a/Spigot-Server-Patches/Drop-falling-block-and-tnt-entities-at-the-specified.patch b/Spigot-Server-Patches/Drop-falling-block-and-tnt-entities-at-the-specified.patch index a64e1d0419..3ae8b46d78 100644 --- a/Spigot-Server-Patches/Drop-falling-block-and-tnt-entities-at-the-specified.patch +++ b/Spigot-Server-Patches/Drop-falling-block-and-tnt-entities-at-the-specified.patch @@ -24,11 +24,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf); + } } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return this.a(itemstack, 0.0F); } @@ -36,10 +36,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Nullable public EntityItem a(ItemStack itemstack, float f) { if (itemstack.isEmpty()) { -diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java +--- a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java @@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { } @@ -58,27 +58,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!this.world.isClientSide) { blockposition = this.getChunkCoordinates(); boolean flag = this.block.getBlock() instanceof BlockConcretePowder; -diff --git a/src/main/java/net/minecraft/server/EntityMinecartTNT.java b/src/main/java/net/minecraft/server/EntityMinecartTNT.java +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartTNT.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartTNT.java -@@ -0,0 +0,0 @@ public class EntityMinecartTNT extends EntityMinecartAbstract { - public void tick() { - super.tick(); - if (this.b > 0) { -+ // Paper start - Configurable TNT entity height nerf -+ if (this.world.paperConfig.entityTNTHeightNerf != 0 && this.locY() > this.world.paperConfig.entityTNTHeightNerf) { -+ this.die(); -+ return; -+ } -+ // Paper end - --this.b; - this.world.addParticle(Particles.SMOKE, this.locX(), this.locY() + 0.5D, this.locZ(), 0.0D, 0.0D, 0.0D); - } else if (this.b == 0) { -diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +--- a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java @@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity { } @@ -92,3 +75,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.setMot(this.getMot().a(0.98D)); if (this.onGround) { this.setMot(this.getMot().d(0.7D, -0.5D, 0.7D)); +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java +@@ -0,0 +0,0 @@ public class EntityMinecartTNT extends EntityMinecartAbstract { + public void tick() { + super.tick(); + if (this.b > 0) { ++ // Paper start - Configurable TNT entity height nerf ++ if (this.world.paperConfig.entityTNTHeightNerf != 0 && this.locY() > this.world.paperConfig.entityTNTHeightNerf) { ++ this.die(); ++ return; ++ } ++ // Paper end + --this.b; + this.world.addParticle(Particles.SMOKE, this.locX(), this.locY() + 0.5D, this.locZ(), 0.0D, 0.0D, 0.0D); + } else if (this.b == 0) { diff --git a/Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch b/Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch index fe838c4214..5942feaaf0 100644 --- a/Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch +++ b/Spigot-Server-Patches/Duplicate-UUID-Resolve-Option.patch @@ -80,36 +80,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } } -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - if (i != this.loc.x || j != this.loc.z) { - Chunk.LOGGER.warn("Wrong location! ({}, {}) should be ({}, {}), {}", i, j, this.loc.x, this.loc.z, entity); - entity.dead = true; -+ return; // Paper - } - - int k = MathHelper.floor(entity.locY() / 16.0D); -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 final void setUUID(UUID uuid) { a_(uuid); } // Paper - OBFHELPER - public void a_(UUID uuid) { - this.uniqueID = uuid; - this.ae = this.uniqueID.toString(); -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.server.level; import co.aikar.timings.Timing; // Paper +import com.destroystokyo.paper.PaperWorldConfig; // Paper @@ -137,7 +113,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // CraftBukkit start - these are spawned serialized (DefinedStructure) and we don't call an add event below at the moment due to ordering complexities boolean needsRemoval = false; - if (chunk.needsDecoration && !this.world.getServer().getServer().getSpawnNPCs() && entity instanceof NPC) { + if (chunk.needsDecoration && !this.world.getServer().getServer().getSpawnNPCs() && entity instanceof net.minecraft.world.entity.npc.NPC) { - entity.die(); + entity.dead = true; // Paper needsRemoval = true; @@ -196,10 +172,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public CompletableFuture<Either<Chunk, PlayerChunk.Failure>> a(PlayerChunk playerchunk) { ChunkCoordIntPair chunkcoordintpair = playerchunk.i(); CompletableFuture<Either<List<IChunkAccess>, PlayerChunk.Failure>> completablefuture = this.a(chunkcoordintpair, 1, (i) -> { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Iterables; import co.aikar.timings.TimingHistory; // Paper @@ -232,3 +208,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return true; } } +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + }); + } + ++ public final void setUUID(UUID uuid) { a_(uuid); } // Paper - OBFHELPER + public void a_(UUID uuid) { + this.uniqueID = uuid; + this.ae = this.uniqueID.toString(); +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + if (i != this.loc.x || j != this.loc.z) { + Chunk.LOGGER.warn("Wrong location! ({}, {}) should be ({}, {}), {}", i, j, this.loc.x, this.loc.z, entity); + entity.dead = true; ++ return; // Paper + } + + int k = MathHelper.floor(entity.locY() / 16.0D); diff --git a/Spigot-Server-Patches/Empty-commands-shall-not-be-dispatched.patch b/Spigot-Server-Patches/Empty-commands-shall-not-be-dispatched.patch index 32ffcabf59..6d12505db1 100644 --- a/Spigot-Server-Patches/Empty-commands-shall-not-be-dispatched.patch +++ b/Spigot-Server-Patches/Empty-commands-shall-not-be-dispatched.patch @@ -4,10 +4,10 @@ Date: Wed, 6 Jan 2021 23:38:43 +0100 Subject: [PATCH] Empty commands shall not be dispatched -diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java +diff --git a/src/main/java/net/minecraft/commands/CommandDispatcher.java b/src/main/java/net/minecraft/commands/CommandDispatcher.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CommandDispatcher.java -+++ b/src/main/java/net/minecraft/server/CommandDispatcher.java +--- a/src/main/java/net/minecraft/commands/CommandDispatcher.java ++++ b/src/main/java/net/minecraft/commands/CommandDispatcher.java @@ -0,0 +0,0 @@ public class CommandDispatcher { command = event.getCommand(); diff --git a/Spigot-Server-Patches/EnderDragon-Events.patch b/Spigot-Server-Patches/EnderDragon-Events.patch index ef0a19b150..0d80801733 100644 --- a/Spigot-Server-Patches/EnderDragon-Events.patch +++ b/Spigot-Server-Patches/EnderDragon-Events.patch @@ -4,10 +4,10 @@ Date: Sat, 21 Jul 2018 01:51:27 -0500 Subject: [PATCH] EnderDragon Events -diff --git a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java -+++ b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java @@ -0,0 +0,0 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded this.d.setDuration(200); this.d.setParticle(Particles.DRAGON_BREATH); @@ -31,10 +31,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.d != null) { this.d.die(); this.d = null; -diff --git a/src/main/java/net/minecraft/server/DragonControllerStrafe.java b/src/main/java/net/minecraft/server/DragonControllerStrafe.java +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerStrafe.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerStrafe.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DragonControllerStrafe.java -+++ b/src/main/java/net/minecraft/server/DragonControllerStrafe.java +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerStrafe.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerStrafe.java @@ -0,0 +0,0 @@ public class DragonControllerStrafe extends AbstractDragonController { EntityDragonFireball entitydragonfireball = new EntityDragonFireball(this.a.world, this.a, d9, d10, d11); @@ -45,10 +45,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.c = 0; if (this.d != null) { while (!this.d.c()) { -diff --git a/src/main/java/net/minecraft/server/EntityDragonFireball.java b/src/main/java/net/minecraft/server/EntityDragonFireball.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityDragonFireball.java b/src/main/java/net/minecraft/world/entity/projectile/EntityDragonFireball.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityDragonFireball.java -+++ b/src/main/java/net/minecraft/server/EntityDragonFireball.java +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityDragonFireball.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityDragonFireball.java @@ -0,0 +0,0 @@ public class EntityDragonFireball extends EntityFireball { } } diff --git a/Spigot-Server-Patches/Enderman.teleportRandomly.patch b/Spigot-Server-Patches/Enderman.teleportRandomly.patch index c797bd6630..a23005b1f7 100644 --- a/Spigot-Server-Patches/Enderman.teleportRandomly.patch +++ b/Spigot-Server-Patches/Enderman.teleportRandomly.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Enderman.teleportRandomly() Ability to trigger the vanilla "teleport randomly" mechanic of an enderman. -diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderman.java -+++ b/src/main/java/net/minecraft/server/EntityEnderman.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java @@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { super.mobTick(); } diff --git a/Spigot-Server-Patches/EndermanAttackPlayerEvent.patch b/Spigot-Server-Patches/EndermanAttackPlayerEvent.patch index 98ee95c200..de2055282d 100644 --- a/Spigot-Server-Patches/EndermanAttackPlayerEvent.patch +++ b/Spigot-Server-Patches/EndermanAttackPlayerEvent.patch @@ -7,10 +7,10 @@ Allow control over whether or not an enderman aggros a player. This allows you to override/extend the pumpkin/stare logic. -diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderman.java -+++ b/src/main/java/net/minecraft/server/EntityEnderman.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java @@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { this.a((WorldServer) this.world, nbttagcompound); } diff --git a/Spigot-Server-Patches/EndermanEscapeEvent.patch b/Spigot-Server-Patches/EndermanEscapeEvent.patch index 017e62edb0..7f469747c7 100644 --- a/Spigot-Server-Patches/EndermanEscapeEvent.patch +++ b/Spigot-Server-Patches/EndermanEscapeEvent.patch @@ -7,11 +7,11 @@ Fires an event anytime an enderman intends to teleport away from the player You may cancel this, enabling ranged attacks to damage the enderman for example. -diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderman.java -+++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -0,0 +0,0 @@ package net.minecraft.server; +--- a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java +@@ -0,0 +0,0 @@ package net.minecraft.world.entity.monster; import java.util.EnumSet; import java.util.Optional; diff --git a/Spigot-Server-Patches/Enforce-Sync-Player-Saves.patch b/Spigot-Server-Patches/Enforce-Sync-Player-Saves.patch index 336e1e0ab1..e17331a33e 100644 --- a/Spigot-Server-Patches/Enforce-Sync-Player-Saves.patch +++ b/Spigot-Server-Patches/Enforce-Sync-Player-Saves.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Enforce Sync Player Saves Saving players async is extremely dangerous. This will force it to main the same way we handle async chunk loads. -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { } diff --git a/Spigot-Server-Patches/Ensure-Entity-AABB-s-are-never-invalid.patch b/Spigot-Server-Patches/Ensure-Entity-AABB-s-are-never-invalid.patch index a333dff3ee..9f12d6cfde 100644 --- a/Spigot-Server-Patches/Ensure-Entity-AABB-s-are-never-invalid.patch +++ b/Spigot-Server-Patches/Ensure-Entity-AABB-s-are-never-invalid.patch @@ -4,11 +4,11 @@ Date: Sun, 10 May 2020 22:12:46 -0400 Subject: [PATCH] Ensure Entity AABB's are never invalid -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public void setPosition(double d0, double d1, double d2) { this.setPositionRaw(d0, d1, d2); @@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit } -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return new AxisAlignedBB(vec3d, vec3d1); } @@ -25,7 +25,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void a(AxisAlignedBB axisalignedbb) { // CraftBukkit start - block invalid bounding boxes double minX = axisalignedbb.minX, -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public void setPositionRaw(double d0, double d1, double d2) { diff --git a/Spigot-Server-Patches/Ensure-Entity-is-never-double-registered.patch b/Spigot-Server-Patches/Ensure-Entity-is-never-double-registered.patch index 9f0c804159..769658188b 100644 --- a/Spigot-Server-Patches/Ensure-Entity-is-never-double-registered.patch +++ b/Spigot-Server-Patches/Ensure-Entity-is-never-double-registered.patch @@ -10,22 +10,10 @@ Vs behavior of non ticking of just overwriting state. We will now simply log a warning when this happens instead of crashing the server. -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 - } - - // Paper start -+ boolean isQueuedForRegister = false; - public static Random SHARED_RANDOM = new Random() { - private boolean locked = false; - @Override -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { Entity entity2; @@ -77,3 +65,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.entitiesById.put(entity.getId(), entity); if (entity instanceof EntityEnderDragon) { EntityComplexPart[] aentitycomplexpart = ((EntityEnderDragon) entity).eJ(); +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + } + + // Paper start ++ boolean isQueuedForRegister = false; + public static Random SHARED_RANDOM = new Random() { + private boolean locked = false; + @Override diff --git a/Spigot-Server-Patches/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch b/Spigot-Server-Patches/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch index c13ad11390..c105af6116 100644 --- a/Spigot-Server-Patches/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch +++ b/Spigot-Server-Patches/Ensure-EntityRaider-respects-game-and-entity-rules-f.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Ensure EntityRaider respects game and entity rules for picking up items -diff --git a/src/main/java/net/minecraft/server/EntityRaider.java b/src/main/java/net/minecraft/server/EntityRaider.java +diff --git a/src/main/java/net/minecraft/world/entity/raid/EntityRaider.java b/src/main/java/net/minecraft/world/entity/raid/EntityRaider.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityRaider.java -+++ b/src/main/java/net/minecraft/server/EntityRaider.java +--- a/src/main/java/net/minecraft/world/entity/raid/EntityRaider.java ++++ b/src/main/java/net/minecraft/world/entity/raid/EntityRaider.java @@ -0,0 +0,0 @@ public abstract class EntityRaider extends EntityMonsterPatrolling { public class b<T extends EntityRaider> extends PathfinderGoal { diff --git a/Spigot-Server-Patches/Ensure-commands-are-not-ran-async.patch b/Spigot-Server-Patches/Ensure-commands-are-not-ran-async.patch index d35f5bbf2e..3c2d0809c3 100644 --- a/Spigot-Server-Patches/Ensure-commands-are-not-ran-async.patch +++ b/Spigot-Server-Patches/Ensure-commands-are-not-ran-async.patch @@ -13,10 +13,10 @@ This change will synchronize the command execution back to the main thread, caus big slowdown in execution but throwing an exception at same time to raise awareness that it is happening so that plugin authors can fix their code to stop executing commands async. -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { } diff --git a/Spigot-Server-Patches/Ensure-inv-drag-is-in-bounds.patch b/Spigot-Server-Patches/Ensure-inv-drag-is-in-bounds.patch index 4f52b2754e..4b3dbbdee9 100644 --- a/Spigot-Server-Patches/Ensure-inv-drag-is-in-bounds.patch +++ b/Spigot-Server-Patches/Ensure-inv-drag-is-in-bounds.patch @@ -4,10 +4,10 @@ Date: Thu, 3 Mar 2016 02:33:53 -0600 Subject: [PATCH] Ensure inv drag is in bounds -diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java +diff --git a/src/main/java/net/minecraft/world/inventory/Container.java b/src/main/java/net/minecraft/world/inventory/Container.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Container.java -+++ b/src/main/java/net/minecraft/server/Container.java +--- a/src/main/java/net/minecraft/world/inventory/Container.java ++++ b/src/main/java/net/minecraft/world/inventory/Container.java @@ -0,0 +0,0 @@ public abstract class Container { this.d(); } diff --git a/Spigot-Server-Patches/Ensure-safe-gateway-teleport.patch b/Spigot-Server-Patches/Ensure-safe-gateway-teleport.patch index fda28f4b91..195a92603b 100644 --- a/Spigot-Server-Patches/Ensure-safe-gateway-teleport.patch +++ b/Spigot-Server-Patches/Ensure-safe-gateway-teleport.patch @@ -4,10 +4,10 @@ Date: Fri, 15 May 2020 01:10:03 -0400 Subject: [PATCH] Ensure safe gateway teleport -diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java -+++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java @@ -0,0 +0,0 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick } else if (!this.world.isClientSide) { List<Entity> list = this.world.a(Entity.class, new AxisAlignedBB(this.getPosition()), TileEntityEndGateway::a); diff --git a/Spigot-Server-Patches/Entity-Activation-Range-2.0.patch b/Spigot-Server-Patches/Entity-Activation-Range-2.0.patch index b9229ed8a9..c72771920a 100644 --- a/Spigot-Server-Patches/Entity-Activation-Range-2.0.patch +++ b/Spigot-Server-Patches/Entity-Activation-Range-2.0.patch @@ -13,345 +13,10 @@ Adds water Mobs to activation range config and nerfs fish Adds flying monsters to control ghast and phantoms Adds villagers as separate config -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 boolean Y; - public boolean impulse; - public int portalCooldown; -- protected boolean inPortal; -+ public boolean inPortal; // Paper - public - protected int portalTicks; - protected BlockPosition ac; - private boolean invulnerable; -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); - public final boolean defaultActivationState; - public long activatedTick = Integer.MIN_VALUE; -+ public boolean isTemporarilyActive = false; // Paper - public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one - protected int numCollisions = 0; // Paper - public void inactiveTick() { } -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - this.recalcPosition(); - } else { - if (enummovetype == EnumMoveType.PISTON) { -+ this.activatedTick = MinecraftServer.currentTick + 20; // Paper - vec3d = this.b(vec3d); - if (vec3d.equals(Vec3D.ORIGIN)) { - return; -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - this.x = Vec3D.ORIGIN; - this.setMot(Vec3D.ORIGIN); - } -+ // Paper start - ignore movement changes while inactive. -+ if (isTemporarilyActive && !(this instanceof EntityItem || this instanceof EntityMinecartAbstract) && vec3d == getMot() && enummovetype == EnumMoveType.SELF) { -+ setMot(Vec3D.ORIGIN); -+ this.world.getMethodProfiler().exit(); -+ return; -+ } -+ // Paper end - - vec3d = this.a(vec3d, enummovetype); - Vec3D vec3d1 = this.g(vec3d); -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } - } - -+ public void syncPositionOf(Entity entity) { k(entity); } // Paper - OBFHELPER - public void k(Entity entity) { - this.a(entity, Entity::setPosition); - } -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - return this.ae; - } - -+ public final boolean isPushedByWater() { return this.bV(); } // Paper - OBFHELPER - the below is not an obfhelper, don't use it! - public boolean bV() { - // Paper start - return this.pushedByWater(); -diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityCreature.java -+++ b/src/main/java/net/minecraft/server/EntityCreature.java -@@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityUnleashEvent; - public abstract class EntityCreature extends EntityInsentient { - - public org.bukkit.craftbukkit.entity.CraftCreature getBukkitCreature() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper -+ public BlockPosition movingTarget = null; public BlockPosition getMovingTarget() { return movingTarget; } // Paper - - protected EntityCreature(EntityTypes<? extends EntityCreature> entitytypes, World world) { - super(entitytypes, world); -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { - public MinecraftKey lootTableKey; - public long lootTableSeed; - @Nullable -- private Entity leashHolder; -+ public Entity leashHolder; // Paper - private -> public - private int bx; - @Nullable - private NBTTagCompound by; -@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { - return this.lookController; - } - -+ // Paper start -+ @Override -+ public void inactiveTick() { -+ super.inactiveTick(); -+ if (this.goalSelector.inactiveTick()) { -+ this.goalSelector.doTick(); -+ } -+ if (this.targetSelector.inactiveTick()) { -+ this.targetSelector.doTick(); -+ } -+ } -+ // Paper end -+ - public ControllerMove getControllerMove() { - if (this.isPassenger() && this.getVehicle() instanceof EntityInsentient) { - EntityInsentient entityinsentient = (EntityInsentient) this.getVehicle(); -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - protected float aN; - protected int aO;protected int getKillCount() { return this.aO; } // Paper - OBFHELPER - public float lastDamage; -- protected boolean jumping; -+ public boolean jumping; // Paper protected -> public - public float aR; - public float aS; - public float aT; -diff --git a/src/main/java/net/minecraft/server/EntityLlama.java b/src/main/java/net/minecraft/server/EntityLlama.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLlama.java -+++ b/src/main/java/net/minecraft/server/EntityLlama.java -@@ -0,0 +0,0 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn - return this.bC != null; - } - -+ public final boolean inCaravan() { return this.fC(); } // Paper - OBFHELPER - public boolean fC() { - return this.bB != null; - } -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 - @Override - public void inactiveTick() { - // SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :( -- if (world.spigotConfig.tickInactiveVillagers && this.doAITick()) { -- this.mobTick(); -+ // Paper start -+ if (this.getUnhappy() > 0) { -+ this.setUnhappy(this.getUnhappy() - 1); - } -+ if (this.doAITick()) { -+ if (world.spigotConfig.tickInactiveVillagers) { -+ this.mobTick(); -+ } else { -+ this.mobTick(true); -+ } -+ } -+ doReputationTick(); -+ // Paper end -+ - super.inactiveTick(); - } - // Spigot End - - @Override -- protected void mobTick() { -+ protected void mobTick() { mobTick(false); } -+ protected void mobTick(boolean inactive) { - this.world.getMethodProfiler().enter("villagerBrain"); -- this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error -+ if (!inactive) this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error // Paper - this.world.getMethodProfiler().exit(); - if (this.bF) { - this.bF = false; -@@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation - this.bv = null; - } - -- if (!this.isNoAI() && this.random.nextInt(100) == 0) { -+ if (!inactive && !this.isNoAI() && this.random.nextInt(100) == 0) { // Paper - Raid raid = ((WorldServer) this.world).b_(this.getChunkCoordinates()); - - if (raid != null && raid.v() && !raid.a()) { -@@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation - if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.eN()) { - this.eT(); - } -+ if (inactive) return; // Paper - - super.mobTick(); - } -@@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation - } - } - -+ private void doReputationTick() { fw(); } // Paper - OBFHELPER - private void fw() { - long i = this.world.getTime(); - -diff --git a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -@@ -0,0 +0,0 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP - return super.prepare(worldaccess, difficultydamagescaler, enummobspawn, (GroupDataEntity) groupdataentity, nbttagcompound); - } - -+ public final int getUnhappy() { return eK(); } // Paper - OBFHELPER - public int eK() { - return (Integer) this.datawatcher.get(EntityVillagerAbstract.bp); - } - -+ public final void setUnhappy(int i) { s(i); } // Paper - OBFHELPER - public void s(int i) { - this.datawatcher.set(EntityVillagerAbstract.bp, i); - } -diff --git a/src/main/java/net/minecraft/server/PathfinderGoal.java b/src/main/java/net/minecraft/server/PathfinderGoal.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoal.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoal.java -@@ -0,0 +0,0 @@ public abstract class PathfinderGoal { - - public void c() {} - -- public void d() {} -+ public void d() { -+ onTaskReset(); // Paper -+ } -+ public void onTaskReset() {} // Paper - - public void e() {} - -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java -@@ -0,0 +0,0 @@ import java.util.EnumSet; - - public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { - -- protected final EntityCreature a; -+ protected final EntityCreature a;public EntityCreature getEntity() { return a; } // Paper - OBFHELPER - public final double b; - protected int c; - protected int d; - private int g; -- protected BlockPosition e;public final BlockPosition getTargetPosition() { return this.e; } // Paper - OBFHELPER -+ protected BlockPosition e; public final BlockPosition getTargetPosition() { return this.e; } public void setTargetPosition(BlockPosition pos) { this.e = pos; getEntity().movingTarget = pos != BlockPosition.ZERO ? pos : null; } // Paper - OBFHELPER - private boolean h; - private final int i; - private final int j; -@@ -0,0 +0,0 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { - public PathfinderGoalGotoTarget(EntityCreature entitycreature, double d0, int i) { - this(entitycreature, d0, i, 1); - } -+ // Paper start - activation range improvements -+ @Override -+ public void onTaskReset() { -+ super.onTaskReset(); -+ setTargetPosition(BlockPosition.ZERO); -+ } -+ // Paper end - - public PathfinderGoalGotoTarget(EntityCreature entitycreature, double d0, int i, int j) { - this.e = BlockPosition.ZERO; -@@ -0,0 +0,0 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { - blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, i1, k - 1, j1); - if (this.a.a((BlockPosition) blockposition_mutableblockposition) && this.a(this.a.world, blockposition_mutableblockposition)) { - this.e = blockposition_mutableblockposition; -+ setTargetPosition(blockposition_mutableblockposition.immutableCopy()); // Paper - return true; - } - } -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -@@ -0,0 +0,0 @@ public class PathfinderGoalSelector { - } - }; - private final Map<PathfinderGoal.Type, PathfinderGoalWrapped> c = new EnumMap(PathfinderGoal.Type.class); -- private final Set<PathfinderGoalWrapped> d = Sets.newLinkedHashSet(); -+ private final Set<PathfinderGoalWrapped> d = Sets.newLinkedHashSet(); private Set<PathfinderGoalWrapped> getTasks() { return d; }// Paper - OBFHELPER - private final Supplier<GameProfilerFiller> e; - private final EnumSet<PathfinderGoal.Type> f = EnumSet.noneOf(PathfinderGoal.Type.class); -- private int g = 3; -+ private int g = 3;private int getTickRate() { return g; } // Paper - OBFHELPER -+ private int curRate;private int getCurRate() { return curRate; } private void incRate() { this.curRate++; } // Paper TODO - - public PathfinderGoalSelector(Supplier<GameProfilerFiller> supplier) { - this.e = supplier; -@@ -0,0 +0,0 @@ public class PathfinderGoalSelector { - this.d.add(new PathfinderGoalWrapped(i, pathfindergoal)); - } - -+ // Paper start -+ public boolean inactiveTick() { -+ incRate(); -+ return getCurRate() % getTickRate() == 0; -+ } -+ public boolean hasTasks() { -+ for (PathfinderGoalWrapped task : getTasks()) { -+ if (task.isRunning()) { -+ return true; -+ } -+ } -+ return false; -+ } -+ // Paper end -+ - public void a(PathfinderGoal pathfindergoal) { - this.d.stream().filter((pathfindergoalwrapped) -> { - return pathfindergoalwrapped.j() == pathfindergoal; -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java -@@ -0,0 +0,0 @@ public class PathfinderGoalWrapped extends PathfinderGoal { - return this.a.i(); - } - -+ public boolean isRunning() { return this.g(); } // Paper - OBFHELPER - public boolean g() { - return this.c; - } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - public long ticksPerWaterSpawns; - public long ticksPerWaterAmbientSpawns; - public long ticksPerAmbientSpawns; -+ // Paper start -+ public int wakeupInactiveRemainingAnimals; -+ public int wakeupInactiveRemainingFlying; -+ public int wakeupInactiveRemainingMonsters; -+ public int wakeupInactiveRemainingVillagers; -+ // Paper end - public boolean populating; - public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { ++TimingHistory.entityTicks; // Paper - timings // Spigot start @@ -439,62 +104,365 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } else { +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + public boolean Y; + public boolean impulse; + public int portalCooldown; +- protected boolean inPortal; ++ public boolean inPortal; // Paper - public + protected int portalTicks; + protected BlockPosition ac; + private boolean invulnerable; +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); + public final boolean defaultActivationState; + public long activatedTick = Integer.MIN_VALUE; ++ public boolean isTemporarilyActive = false; // Paper + public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one + protected int numCollisions = 0; // Paper + public void inactiveTick() { } +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + this.recalcPosition(); + } else { + if (enummovetype == EnumMoveType.PISTON) { ++ this.activatedTick = MinecraftServer.currentTick + 20; // Paper + vec3d = this.b(vec3d); + if (vec3d.equals(Vec3D.ORIGIN)) { + return; +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + this.x = Vec3D.ORIGIN; + this.setMot(Vec3D.ORIGIN); + } ++ // Paper start - ignore movement changes while inactive. ++ if (isTemporarilyActive && !(this instanceof EntityItem || this instanceof EntityMinecartAbstract) && vec3d == getMot() && enummovetype == EnumMoveType.SELF) { ++ setMot(Vec3D.ORIGIN); ++ this.world.getMethodProfiler().exit(); ++ return; ++ } ++ // Paper end + + vec3d = this.a(vec3d, enummovetype); + Vec3D vec3d1 = this.g(vec3d); +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + } + } + ++ public void syncPositionOf(Entity entity) { k(entity); } // Paper - OBFHELPER + public void k(Entity entity) { + this.a(entity, Entity::setPosition); + } +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + return this.ae; + } + ++ public final boolean isPushedByWater() { return this.bV(); } // Paper - OBFHELPER - the below is not an obfhelper, don't use it! + public boolean bV() { + // Paper start + return this.pushedByWater(); +diff --git a/src/main/java/net/minecraft/world/entity/EntityCreature.java b/src/main/java/net/minecraft/world/entity/EntityCreature.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityCreature.java ++++ b/src/main/java/net/minecraft/world/entity/EntityCreature.java +@@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityUnleashEvent; + public abstract class EntityCreature extends EntityInsentient { + + public org.bukkit.craftbukkit.entity.CraftCreature getBukkitCreature() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper ++ public BlockPosition movingTarget = null; public BlockPosition getMovingTarget() { return movingTarget; } // Paper + + protected EntityCreature(EntityTypes<? extends EntityCreature> entitytypes, World world) { + super(entitytypes, world); +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { + public MinecraftKey lootTableKey; + public long lootTableSeed; + @Nullable +- private Entity leashHolder; ++ public Entity leashHolder; // Paper - private -> public + private int bx; + @Nullable + private NBTTagCompound by; +@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { + return this.lookController; + } + ++ // Paper start ++ @Override ++ public void inactiveTick() { ++ super.inactiveTick(); ++ if (this.goalSelector.inactiveTick()) { ++ this.goalSelector.doTick(); ++ } ++ if (this.targetSelector.inactiveTick()) { ++ this.targetSelector.doTick(); ++ } ++ } ++ // Paper end ++ + public ControllerMove getControllerMove() { + if (this.isPassenger() && this.getVehicle() instanceof EntityInsentient) { + EntityInsentient entityinsentient = (EntityInsentient) this.getVehicle(); +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + protected float aN; + protected int aO;protected int getKillCount() { return this.aO; } // Paper - OBFHELPER + public float lastDamage; +- protected boolean jumping; ++ public boolean jumping; // Paper protected -> public + public float aR; + public float aS; + public float aT; +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java +@@ -0,0 +0,0 @@ public abstract class PathfinderGoal { + + public void c() {} + +- public void d() {} ++ public void d() { ++ onTaskReset(); // Paper ++ } ++ public void onTaskReset() {} // Paper + + public void e() {} + +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalGotoTarget.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalGotoTarget.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalGotoTarget.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalGotoTarget.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.IWorldReader; + + public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { + +- protected final EntityCreature a; ++ protected final EntityCreature a;public EntityCreature getEntity() { return a; } // Paper - OBFHELPER + public final double b; + protected int c; + protected int d; + private int g; +- protected BlockPosition e;public final BlockPosition getTargetPosition() { return this.e; } // Paper - OBFHELPER ++ protected BlockPosition e; public final BlockPosition getTargetPosition() { return this.e; } public void setTargetPosition(BlockPosition pos) { this.e = pos; getEntity().movingTarget = pos != BlockPosition.ZERO ? pos : null; } // Paper - OBFHELPER + private boolean h; + private final int i; + private final int j; +@@ -0,0 +0,0 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { + public PathfinderGoalGotoTarget(EntityCreature entitycreature, double d0, int i) { + this(entitycreature, d0, i, 1); + } ++ // Paper start - activation range improvements ++ @Override ++ public void onTaskReset() { ++ super.onTaskReset(); ++ setTargetPosition(BlockPosition.ZERO); ++ } ++ // Paper end + + public PathfinderGoalGotoTarget(EntityCreature entitycreature, double d0, int i, int j) { + this.e = BlockPosition.ZERO; +@@ -0,0 +0,0 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { + blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, i1, k - 1, j1); + if (this.a.a((BlockPosition) blockposition_mutableblockposition) && this.a(this.a.world, blockposition_mutableblockposition)) { + this.e = blockposition_mutableblockposition; ++ setTargetPosition(blockposition_mutableblockposition.immutableCopy()); // Paper + return true; + } + } +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java +@@ -0,0 +0,0 @@ public class PathfinderGoalSelector { + } + }; + private final Map<PathfinderGoal.Type, PathfinderGoalWrapped> c = new EnumMap(PathfinderGoal.Type.class); +- private final Set<PathfinderGoalWrapped> d = Sets.newLinkedHashSet(); ++ private final Set<PathfinderGoalWrapped> d = Sets.newLinkedHashSet(); private Set<PathfinderGoalWrapped> getTasks() { return d; }// Paper - OBFHELPER + private final Supplier<GameProfilerFiller> e; + private final EnumSet<PathfinderGoal.Type> f = EnumSet.noneOf(PathfinderGoal.Type.class); +- private int g = 3; ++ private int g = 3;private int getTickRate() { return g; } // Paper - OBFHELPER ++ private int curRate;private int getCurRate() { return curRate; } private void incRate() { this.curRate++; } // Paper TODO + + public PathfinderGoalSelector(Supplier<GameProfilerFiller> supplier) { + this.e = supplier; +@@ -0,0 +0,0 @@ public class PathfinderGoalSelector { + this.d.add(new PathfinderGoalWrapped(i, pathfindergoal)); + } + ++ // Paper start ++ public boolean inactiveTick() { ++ incRate(); ++ return getCurRate() % getTickRate() == 0; ++ } ++ public boolean hasTasks() { ++ for (PathfinderGoalWrapped task : getTasks()) { ++ if (task.isRunning()) { ++ return true; ++ } ++ } ++ return false; ++ } ++ // Paper end ++ + public void a(PathfinderGoal pathfindergoal) { + this.d.stream().filter((pathfindergoalwrapped) -> { + return pathfindergoalwrapped.j() == pathfindergoal; +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java +@@ -0,0 +0,0 @@ public class PathfinderGoalWrapped extends PathfinderGoal { + return this.a.i(); + } + ++ public boolean isRunning() { return this.g(); } // Paper - OBFHELPER + public boolean g() { + return this.c; + } +diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/EntityLlama.java b/src/main/java/net/minecraft/world/entity/animal/horse/EntityLlama.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/horse/EntityLlama.java ++++ b/src/main/java/net/minecraft/world/entity/animal/horse/EntityLlama.java +@@ -0,0 +0,0 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn + return this.bC != null; + } + ++ public final boolean inCaravan() { return this.fC(); } // Paper - OBFHELPER + public boolean fC() { + return this.bB != null; + } +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +@@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation + @Override + public void inactiveTick() { + // SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :( +- if (world.spigotConfig.tickInactiveVillagers && this.doAITick()) { +- this.mobTick(); ++ // Paper start ++ if (this.getUnhappy() > 0) { ++ this.setUnhappy(this.getUnhappy() - 1); + } ++ if (this.doAITick()) { ++ if (world.spigotConfig.tickInactiveVillagers) { ++ this.mobTick(); ++ } else { ++ this.mobTick(true); ++ } ++ } ++ doReputationTick(); ++ // Paper end ++ + super.inactiveTick(); + } + // Spigot End + + @Override +- protected void mobTick() { ++ protected void mobTick() { mobTick(false); } ++ protected void mobTick(boolean inactive) { + this.world.getMethodProfiler().enter("villagerBrain"); +- this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error ++ if (!inactive) this.getBehaviorController().a((WorldServer) this.world, this); // CraftBukkit - decompile error // Paper + this.world.getMethodProfiler().exit(); + if (this.bF) { + this.bF = false; +@@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation + this.bv = null; + } + +- if (!this.isNoAI() && this.random.nextInt(100) == 0) { ++ if (!inactive && !this.isNoAI() && this.random.nextInt(100) == 0) { // Paper + Raid raid = ((WorldServer) this.world).b_(this.getChunkCoordinates()); + + if (raid != null && raid.v() && !raid.a()) { +@@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation + if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.eN()) { + this.eT(); + } ++ if (inactive) return; // Paper + + super.mobTick(); + } +@@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation + } + } + ++ private void doReputationTick() { fw(); } // Paper - OBFHELPER + private void fw() { + long i = this.world.getTime(); + +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java +@@ -0,0 +0,0 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP + return super.prepare(worldaccess, difficultydamagescaler, enummobspawn, (GroupDataEntity) groupdataentity, nbttagcompound); + } + ++ public final int getUnhappy() { return eK(); } // Paper - OBFHELPER + public int eK() { + return (Integer) this.datawatcher.get(EntityVillagerAbstract.bp); + } + ++ public final void setUnhappy(int i) { s(i); } // Paper - OBFHELPER + public void s(int i) { + this.datawatcher.set(EntityVillagerAbstract.bp, i); + } +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public long ticksPerWaterSpawns; + public long ticksPerWaterAmbientSpawns; + public long ticksPerAmbientSpawns; ++ // Paper start ++ public int wakeupInactiveRemainingAnimals; ++ public int wakeupInactiveRemainingFlying; ++ public int wakeupInactiveRemainingMonsters; ++ public int wakeupInactiveRemainingVillagers; ++ // Paper end + public boolean populating; + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot + diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -0,0 +0,0 @@ - package org.spigotmc; - - import java.util.Collection; -+import java.util.List; -+ -+import net.minecraft.server.Activity; - import net.minecraft.server.AxisAlignedBB; -+import net.minecraft.server.BehaviorController; -+import net.minecraft.server.BlockPosition; - import net.minecraft.server.Chunk; -+import net.minecraft.server.ChunkProviderServer; // Paper - import net.minecraft.server.Entity; - import net.minecraft.server.EntityAmbient; - import net.minecraft.server.EntityAnimal; - import net.minecraft.server.EntityArrow; -+import net.minecraft.server.EntityBee; - import net.minecraft.server.EntityComplexPart; - import net.minecraft.server.EntityCreature; - import net.minecraft.server.EntityCreeper; - import net.minecraft.server.EntityEnderCrystal; - import net.minecraft.server.EntityEnderDragon; -+import net.minecraft.server.EntityEnderSignal; - import net.minecraft.server.EntityFallingBlock; // Paper - import net.minecraft.server.EntityFireball; - import net.minecraft.server.EntityFireworks; -+import net.minecraft.server.EntityFlying; - import net.minecraft.server.EntityHuman; - import net.minecraft.server.EntityLightning; - import net.minecraft.server.EntityLiving; - import net.minecraft.server.EntityMonster; -+import net.minecraft.server.EntityPillager; -+import net.minecraft.server.EntityPlayer; - import net.minecraft.server.EntityProjectile; - import net.minecraft.server.EntityRaider; - import net.minecraft.server.EntitySheep; -@@ -0,0 +0,0 @@ import net.minecraft.server.EntityTNTPrimed; - import net.minecraft.server.EntityThrownTrident; - import net.minecraft.server.EntityVillager; - import net.minecraft.server.EntityWither; -+import net.minecraft.server.IMonster; - import net.minecraft.server.MathHelper; -+import net.minecraft.server.MemoryModuleType; - import net.minecraft.server.MinecraftServer; - import net.minecraft.server.World; +@@ -0,0 +0,0 @@ import net.minecraft.world.level.chunk.Chunk; + import net.minecraft.world.phys.AxisAlignedBB; import co.aikar.timings.MinecraftTimings; -+// Paper start -+import net.minecraft.server.EntityInsentient; -+import net.minecraft.server.EntityLlama; -+import net.minecraft.server.EntityWaterAnimal; -+// Paper end ++// Paper start ++import net.minecraft.core.BlockPosition; ++import net.minecraft.server.level.ChunkProviderServer; ++import net.minecraft.world.entity.EntityFlying; ++import net.minecraft.world.entity.EntityInsentient; ++import net.minecraft.world.entity.ai.BehaviorController; ++import net.minecraft.world.entity.animal.EntityBee; ++import net.minecraft.world.entity.animal.EntityWaterAnimal; ++import net.minecraft.world.entity.animal.horse.EntityLlama; ++import net.minecraft.world.entity.monster.EntityPillager; ++import net.minecraft.world.entity.monster.IMonster; ++import net.minecraft.world.entity.schedule.Activity; ++import net.minecraft.world.entity.item.EntityFallingBlock; ++import net.minecraft.world.entity.projectile.EntityEnderSignal; ++// Paper end ++ public class ActivationRange { @@ -742,7 +710,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + } -+ if ( entity instanceof EntityLlama && ( (EntityLlama ) entity ).inCaravan() ) ++ if ( entity instanceof EntityLlama && ( (EntityLlama) entity ).inCaravan() ) { - return true; + return 1; diff --git a/Spigot-Server-Patches/Entity-AddTo-RemoveFrom-World-Events.patch b/Spigot-Server-Patches/Entity-AddTo-RemoveFrom-World-Events.patch index 4f30b18bb3..12926adffd 100644 --- a/Spigot-Server-Patches/Entity-AddTo-RemoveFrom-World-Events.patch +++ b/Spigot-Server-Patches/Entity-AddTo-RemoveFrom-World-Events.patch @@ -4,10 +4,10 @@ Date: Mon, 28 Mar 2016 20:32:58 -0400 Subject: [PATCH] Entity AddTo/RemoveFrom World Events -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { if (entity instanceof EntityInsentient) { this.navigators.remove(((EntityInsentient) entity).getNavigation()); diff --git a/Spigot-Server-Patches/Entity-Jump-API.patch b/Spigot-Server-Patches/Entity-Jump-API.patch index 7b755aa5ff..47219a7201 100644 --- a/Spigot-Server-Patches/Entity-Jump-API.patch +++ b/Spigot-Server-Patches/Entity-Jump-API.patch @@ -4,10 +4,10 @@ Date: Sat, 8 Feb 2020 23:26:11 -0600 Subject: [PATCH] Entity Jump API -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } else if (this.aQ() && (!this.onGround || d7 > d8)) { this.c((Tag) TagsFluid.LAVA); @@ -19,10 +19,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } else { this.jumpTicks = 0; -diff --git a/src/main/java/net/minecraft/server/EntityPanda.java b/src/main/java/net/minecraft/server/EntityPanda.java +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityPanda.java b/src/main/java/net/minecraft/world/entity/animal/EntityPanda.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPanda.java -+++ b/src/main/java/net/minecraft/server/EntityPanda.java +--- a/src/main/java/net/minecraft/world/entity/animal/EntityPanda.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityPanda.java @@ -0,0 +0,0 @@ public class EntityPanda extends EntityAnimal { EntityPanda entitypanda = (EntityPanda) iterator.next(); diff --git a/Spigot-Server-Patches/Entity-Origin-API.patch b/Spigot-Server-Patches/Entity-Origin-API.patch index 35bf273d2a..5e5aefe45a 100644 --- a/Spigot-Server-Patches/Entity-Origin-API.patch +++ b/Spigot-Server-Patches/Entity-Origin-API.patch @@ -4,11 +4,39 @@ Date: Tue, 1 Mar 2016 23:45:08 -0600 Subject: [PATCH] Entity Origin API -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/nbt/NBTTagList.java b/src/main/java/net/minecraft/nbt/NBTTagList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/nbt/NBTTagList.java ++++ b/src/main/java/net/minecraft/nbt/NBTTagList.java +@@ -0,0 +0,0 @@ public class NBTTagList extends NBTList<NBTBase> { + return new int[0]; + } + ++ public final double getDoubleAt(int i) { return this.h(i); } // Paper - OBFHELPER + public double h(int i) { + if (i >= 0 && i < this.list.size()) { + NBTBase nbtbase = (NBTBase) this.list.get(i); +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + this.navigators.add(((EntityInsentient) entity).getNavigation()); + } + entity.valid = true; // CraftBukkit ++ // Paper start - Set origin location when the entity is being added to the world ++ if (entity.origin == null) { ++ entity.origin = entity.getBukkitEntity().getLocation(); ++ } ++ // Paper end + } + + } +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only public boolean forceExplosionKnockback; // SPIGOT-949 public boolean persistentInvisibility = false; @@ -16,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Spigot start public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne this.bukkitEntity.storeBukkitValues(nbttagcompound); } // CraftBukkit end @@ -28,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return nbttagcompound; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT"); -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } // CraftBukkit end @@ -42,7 +70,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded"); -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne protected abstract void saveData(NBTTagCompound nbttagcompound); @@ -50,10 +78,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected NBTTagList a(double... adouble) { NBTTagList nbttaglist = new NBTTagList(); double[] adouble1 = adouble; -diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java +--- a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java @@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { this.block = Blocks.SAND.getBlockData(); } @@ -69,10 +97,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public void a(boolean flag) { -diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +--- a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java @@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity { @Override protected void loadData(NBTTagCompound nbttagcompound) { @@ -88,34 +116,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @Nullable -diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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<NBTBase> { - return new int[0]; - } - -+ public final double getDoubleAt(int i) { return this.h(i); } // Paper - OBFHELPER - public double h(int i) { - if (i >= 0 && i < this.list.size()) { - NBTBase nbtbase = (NBTBase) this.list.get(i); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - this.navigators.add(((EntityInsentient) entity).getNavigation()); - } - entity.valid = true; // CraftBukkit -+ // Paper start - Set origin location when the entity is being added to the world -+ if (entity.origin == null) { -+ entity.origin = entity.getBukkitEntity().getLocation(); -+ } -+ // Paper end - } - - } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/Spigot-Server-Patches/Entity-fromMobSpawner.patch b/Spigot-Server-Patches/Entity-fromMobSpawner.patch index 48b9e4424a..a4301e1783 100644 --- a/Spigot-Server-Patches/Entity-fromMobSpawner.patch +++ b/Spigot-Server-Patches/Entity-fromMobSpawner.patch @@ -4,11 +4,11 @@ Date: Sun, 18 Jun 2017 18:17:05 -0500 Subject: [PATCH] Entity#fromMobSpawner() -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; public long activatedTick = Integer.MIN_VALUE; @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected int numCollisions = 0; // Paper public void inactiveTick() { } // Spigot end -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne if (this.origin != null) { nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ())); } @@ -27,7 +27,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end return nbttagcompound; } catch (Throwable throwable) { -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne if (!originTag.isEmpty()) { origin = new org.bukkit.Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2)); } @@ -36,10 +36,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end } catch (Throwable throwable) { -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { } // Spigot End diff --git a/Spigot-Server-Patches/Entity-getEntitySpawnReason.patch b/Spigot-Server-Patches/Entity-getEntitySpawnReason.patch index 4eab3abf73..a18254c5ad 100644 --- a/Spigot-Server-Patches/Entity-getEntitySpawnReason.patch +++ b/Spigot-Server-Patches/Entity-getEntitySpawnReason.patch @@ -9,11 +9,36 @@ Pre existing entities will return NATURAL if it was a non persistenting Living Entity, SPAWNER for spawners, or DEFAULT since data was not stored. -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + // CraftBukkit start + private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) { + org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot ++ if (entity.spawnReason == null) entity.spawnReason = spawnReason; // Paper + // Paper start + if (entity.valid) { + MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable()); +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -0,0 +0,0 @@ public abstract class PlayerList { + // CraftBukkit start + WorldServer finalWorldServer = worldserver1; + Entity entity = EntityTypes.a(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> { +- return !finalWorldServer.addEntitySerialized(entity1) ? null : entity1; ++ return !finalWorldServer.addEntitySerialized(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // Paper + // CraftBukkit end + }); + +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } }; List<Entity> entitySlice = null; @@ -21,7 +46,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne if (this.origin != null) { nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ())); } @@ -31,7 +56,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Save entity's from mob spawner status if (spawnedViaMobSpawner) { nbttagcompound.setBoolean("Paper.FromMobSpawner", true); -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } spawnedViaMobSpawner = nbttagcompound.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status @@ -58,10 +83,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end } catch (Throwable throwable) { -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { // Spigot End } @@ -70,31 +95,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 flag = true; // Paper // Spigot Start if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) { -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - // CraftBukkit start - WorldServer finalWorldServer = worldserver1; - Entity entity = EntityTypes.a(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> { -- return !finalWorldServer.addEntitySerialized(entity1) ? null : entity1; -+ return !finalWorldServer.addEntitySerialized(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // Paper - // CraftBukkit end - }); - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - // CraftBukkit start - private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) { - org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot -+ if (entity.spawnReason == null) entity.spawnReason = spawnReason; // Paper - // Paper start - if (entity.valid) { - MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java diff --git a/Spigot-Server-Patches/Entity-isTicking.patch b/Spigot-Server-Patches/Entity-isTicking.patch index 66a5f91584..dfc9015d1b 100644 --- a/Spigot-Server-Patches/Entity-isTicking.patch +++ b/Spigot-Server-Patches/Entity-isTicking.patch @@ -4,11 +4,11 @@ Date: Sat, 3 Oct 2020 21:39:16 -0500 Subject: [PATCH] Entity#isTicking -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public static int nextEntityId() { return entityCount.incrementAndGet(); } diff --git a/Spigot-Server-Patches/Entity-load-save-limit-per-chunk.patch b/Spigot-Server-Patches/Entity-load-save-limit-per-chunk.patch index ee05e8bb8e..229cf90e9c 100644 --- a/Spigot-Server-Patches/Entity-load-save-limit-per-chunk.patch +++ b/Spigot-Server-Patches/Entity-load-save-limit-per-chunk.patch @@ -39,10 +39,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + }); + } } -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java @@ -0,0 +0,0 @@ public class ChunkRegionLoader { chunk.d(false); diff --git a/Spigot-Server-Patches/EntityMoveEvent.patch b/Spigot-Server-Patches/EntityMoveEvent.patch index e119c15c8c..ba216703a2 100644 --- a/Spigot-Server-Patches/EntityMoveEvent.patch +++ b/Spigot-Server-Patches/EntityMoveEvent.patch @@ -4,10 +4,42 @@ Date: Tue, 11 Feb 2020 21:56:48 -0600 Subject: [PATCH] EntityMoveEvent -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -0,0 +0,0 @@ import com.mojang.datafixers.DataFixer; + import io.netty.buffer.ByteBuf; + import io.netty.buffer.ByteBufOutputStream; + import io.netty.buffer.Unpooled; ++import io.papermc.paper.event.entity.EntityMoveEvent; + import it.unimi.dsi.fastutil.longs.LongIterator; + import java.awt.image.BufferedImage; + import java.io.BufferedWriter; +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas + while (iterator.hasNext()) { + WorldServer worldserver = (WorldServer) iterator.next(); + worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper ++ worldserver.hasEntityMoveEvent = EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper + TileEntityHopper.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper + + this.methodProfiler.a(() -> { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + public final Convertable.ConversionSession convertable; + public final UUID uuid; + boolean hasPhysicsEvent = true; // Paper ++ boolean hasEntityMoveEvent = false; // Paper + private static Throwable getAddToWorldStackTrace(Entity entity) { + return new Throwable(entity + " Added to world at " + new java.util.Date()); + } +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ import com.mojang.datafixers.util.Pair; import com.mojang.serialization.DataResult; import com.mojang.serialization.Dynamic; @@ -37,35 +69,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!this.world.isClientSide && this.dO() && this.aG()) { this.damageEntity(DamageSource.DROWN, 1.0F); } -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -0,0 +0,0 @@ import com.mojang.datafixers.DataFixer; - import io.netty.buffer.ByteBuf; - import io.netty.buffer.ByteBufOutputStream; - import io.netty.buffer.Unpooled; -+import io.papermc.paper.event.entity.EntityMoveEvent; - import it.unimi.dsi.fastutil.longs.LongIterator; - import java.awt.image.BufferedImage; - import java.io.BufferedWriter; -@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas - while (iterator.hasNext()) { - WorldServer worldserver = (WorldServer) iterator.next(); - worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper -+ worldserver.hasEntityMoveEvent = EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - TileEntityHopper.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - - this.methodProfiler.a(() -> { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - public final Convertable.ConversionSession convertable; - public final UUID uuid; - boolean hasPhysicsEvent = true; // Paper -+ boolean hasEntityMoveEvent = false; // Paper - private static Throwable getAddToWorldStackTrace(Entity entity) { - return new Throwable(entity + " Added to world at " + new java.util.Date()); - } diff --git a/Spigot-Server-Patches/EntityPathfindEvent.patch b/Spigot-Server-Patches/EntityPathfindEvent.patch index 2164ff0c74..0800748ea2 100644 --- a/Spigot-Server-Patches/EntityPathfindEvent.patch +++ b/Spigot-Server-Patches/EntityPathfindEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] EntityPathfindEvent Fires when an Entity decides to start moving to a location. -diff --git a/src/main/java/net/minecraft/server/Navigation.java b/src/main/java/net/minecraft/server/Navigation.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/Navigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/Navigation.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Navigation.java -+++ b/src/main/java/net/minecraft/server/Navigation.java +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/Navigation.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/Navigation.java @@ -0,0 +0,0 @@ public class Navigation extends NavigationAbstract { @Override @@ -18,11 +18,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } private int u() { -diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NavigationAbstract.java -+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java +@@ -0,0 +0,0 @@ import net.minecraft.world.phys.Vec3D; public abstract class NavigationAbstract { @@ -84,10 +84,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.b.getMethodProfiler().enter("pathfind"); float f = (float) this.a.b(GenericAttributes.FOLLOW_RANGE); BlockPosition blockposition = flag ? this.a.getChunkCoordinates().up() : this.a.getChunkCoordinates(); -diff --git a/src/main/java/net/minecraft/server/NavigationFlying.java b/src/main/java/net/minecraft/server/NavigationFlying.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationFlying.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationFlying.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NavigationFlying.java -+++ b/src/main/java/net/minecraft/server/NavigationFlying.java +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationFlying.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationFlying.java @@ -0,0 +0,0 @@ public class NavigationFlying extends NavigationAbstract { @Override diff --git a/Spigot-Server-Patches/EntityRegainHealthEvent-isFastRegen-API.patch b/Spigot-Server-Patches/EntityRegainHealthEvent-isFastRegen-API.patch index 582cf3c7ad..29e28198c1 100644 --- a/Spigot-Server-Patches/EntityRegainHealthEvent-isFastRegen-API.patch +++ b/Spigot-Server-Patches/EntityRegainHealthEvent-isFastRegen-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] EntityRegainHealthEvent isFastRegen API Don't even get me started -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } @@ -27,10 +27,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Suppress during worldgen if (this.valid) { this.world.getServer().getPluginManager().callEvent(event); -diff --git a/src/main/java/net/minecraft/server/FoodMetaData.java b/src/main/java/net/minecraft/server/FoodMetaData.java +diff --git a/src/main/java/net/minecraft/world/food/FoodMetaData.java b/src/main/java/net/minecraft/world/food/FoodMetaData.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/FoodMetaData.java -+++ b/src/main/java/net/minecraft/server/FoodMetaData.java +--- a/src/main/java/net/minecraft/world/food/FoodMetaData.java ++++ b/src/main/java/net/minecraft/world/food/FoodMetaData.java @@ -0,0 +0,0 @@ public class FoodMetaData { if (this.foodTickTimer >= this.saturatedRegenRate) { // CraftBukkit float f = Math.min(this.saturationLevel, 6.0F); diff --git a/Spigot-Server-Patches/Expand-World.spawnParticle-API-and-add-Builder.patch b/Spigot-Server-Patches/Expand-World.spawnParticle-API-and-add-Builder.patch index 9543ff2949..93cc71f053 100644 --- a/Spigot-Server-Patches/Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/Spigot-Server-Patches/Expand-World.spawnParticle-API-and-add-Builder.patch @@ -9,10 +9,10 @@ Adds an option to control the force mode of the particle. This adds a new Builder API which is much friendlier to use. -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { public final Int2ObjectMap<Entity> entitiesById = new Int2ObjectLinkedOpenHashMap(); private final Map<UUID, Entity> entitiesByUUID = Maps.newHashMap(); diff --git a/Spigot-Server-Patches/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/Spigot-Server-Patches/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index bdbc3c1a61..82c926aa01 100644 --- a/Spigot-Server-Patches/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/Spigot-Server-Patches/ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -7,69 +7,23 @@ Adds lots of information about why this orb exists. Replaces isFromBottle() with logic that persists entity reloads too. -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 extends BlockBase implements IMaterial { - } - } +--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +@@ -0,0 +0,0 @@ public class PlayerInteractManager { -- protected void dropExperience(WorldServer worldserver, BlockPosition blockposition, int i) { -+ protected void dropExperience(WorldServer worldserver, BlockPosition blockposition, int i, EntityPlayer player) { // Paper - if (worldserver.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)) { - while (i > 0) { - int j = EntityExperienceOrb.getOrbValue(i); - - i -= j; -- worldserver.addEntity(new EntityExperienceOrb(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, j)); -+ worldserver.addEntity(new EntityExperienceOrb(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, j, org.bukkit.entity.ExperienceOrb.SpawnReason.BLOCK_BREAK, player)); // Paper - } - } - -diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/main/java/net/minecraft/server/ContainerGrindstone.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ContainerGrindstone.java -+++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java -@@ -0,0 +0,0 @@ public class ContainerGrindstone extends Container { - int k = EntityExperienceOrb.getOrbValue(j); - - j -= k; -- world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX(), (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, k)); -+ world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX(), (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, k, org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, entityhuman)); // Paper - } - - world.triggerEffect(1042, blockposition, 0); -diff --git a/src/main/java/net/minecraft/server/EntityAnimal.java b/src/main/java/net/minecraft/server/EntityAnimal.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityAnimal.java -+++ b/src/main/java/net/minecraft/server/EntityAnimal.java -@@ -0,0 +0,0 @@ public abstract class EntityAnimal extends EntityAgeable { - if (worldserver.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { - // CraftBukkit start - use event experience - if (experience > 0) { -- worldserver.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), experience)); -+ worldserver.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityageable)); // Paper + // Drop event experience + if (flag && event != null) { +- iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop()); ++ iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop(), this.player); // Paper } - // CraftBukkit end - } -diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderDragon.java -+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java -@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { - int j = EntityExperienceOrb.getOrbValue(i); - i -= j; -- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j)); -+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j, org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, this.killer, this)); // Paper - } - - } -diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java + return true; +diff --git a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java -+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java +--- a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java ++++ b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java @@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity { public int value; private EntityHuman targetPlayer; @@ -146,36 +100,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @Override -diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFishingHook.java -+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java -@@ -0,0 +0,0 @@ public class EntityFishingHook extends IProjectile { - this.world.addEntity(entityitem); - // CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop() - if (playerFishEvent.getExpToDrop() > 0) { -- entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop())); -+ entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.FISHING, this.getOwner(), this)); // Paper - } - // CraftBukkit end - if (itemstack1.getItem().a((Tag) TagsItem.FISHES)) { -diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFox.java -+++ b/src/main/java/net/minecraft/server/EntityFox.java -@@ -0,0 +0,0 @@ public class EntityFox extends EntityAnimal { - if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { - // CraftBukkit start - use event experience - if (experience > 0) { -- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience)); -+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityfox)); // Paper - } - // CraftBukkit end - } -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { int j = EntityExperienceOrb.getOrbValue(i); @@ -186,23 +114,36 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } this.expToDrop = 0; } -diff --git a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityAnimal.java b/src/main/java/net/minecraft/world/entity/animal/EntityAnimal.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java -+++ b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java -@@ -0,0 +0,0 @@ public class EntityThrownExpBottle extends EntityProjectileThrowable { - int j = EntityExperienceOrb.getOrbValue(i); - - i -= j; -- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j)); -+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j, org.bukkit.entity.ExperienceOrb.SpawnReason.EXP_BOTTLE, getShooter(), this)); // Paper +--- a/src/main/java/net/minecraft/world/entity/animal/EntityAnimal.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityAnimal.java +@@ -0,0 +0,0 @@ public abstract class EntityAnimal extends EntityAgeable { + if (worldserver.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { + // CraftBukkit start - use event experience + if (experience > 0) { +- worldserver.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), experience)); ++ worldserver.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityageable)); // Paper + } + // CraftBukkit end } - - this.die(); -diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityFox.java b/src/main/java/net/minecraft/world/entity/animal/EntityFox.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTurtle.java -+++ b/src/main/java/net/minecraft/server/EntityTurtle.java +--- a/src/main/java/net/minecraft/world/entity/animal/EntityFox.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityFox.java +@@ -0,0 +0,0 @@ public class EntityFox extends EntityAnimal { + if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { + // CraftBukkit start - use event experience + if (experience > 0) { +- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience)); ++ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityfox)); // Paper + } + // CraftBukkit end + } +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java b/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java @@ -0,0 +0,0 @@ public class EntityTurtle extends EntityAnimal { Random random = this.animal.getRandom(); @@ -212,10 +153,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVillager.java -+++ b/src/main/java/net/minecraft/server/EntityVillager.java +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java +@@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { + int j = EntityExperienceOrb.getOrbValue(i); + + i -= j; +- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j)); ++ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j, org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, this.killer, this)); // Paper + } + + } +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java @@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation } @@ -225,10 +179,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -diff --git a/src/main/java/net/minecraft/server/EntityVillagerTrader.java b/src/main/java/net/minecraft/server/EntityVillagerTrader.java +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerTrader.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerTrader.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVillagerTrader.java -+++ b/src/main/java/net/minecraft/server/EntityVillagerTrader.java +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerTrader.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerTrader.java @@ -0,0 +0,0 @@ public class EntityVillagerTrader extends EntityVillagerAbstract { if (merchantrecipe.isRewardExp()) { int i = 3 + this.random.nextInt(4); @@ -238,24 +192,50 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -0,0 +0,0 @@ public class PlayerInteractManager { - - // Drop event experience - if (flag && event != null) { -- iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop()); -+ iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop(), this.player); // Paper - } - - return true; -diff --git a/src/main/java/net/minecraft/server/SlotFurnaceResult.java b/src/main/java/net/minecraft/server/SlotFurnaceResult.java +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java +@@ -0,0 +0,0 @@ public class EntityFishingHook extends IProjectile { + this.world.addEntity(entityitem); + // CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop() + if (playerFishEvent.getExpToDrop() > 0) { +- entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop())); ++ entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.FISHING, this.getOwner(), this)); // Paper + } + // CraftBukkit end + if (itemstack1.getItem().a((Tag) TagsItem.FISHES)) { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java b/src/main/java/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SlotFurnaceResult.java -+++ b/src/main/java/net/minecraft/server/SlotFurnaceResult.java -@@ -0,0 +0,0 @@ package net.minecraft.server; +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java +@@ -0,0 +0,0 @@ public class EntityThrownExpBottle extends EntityProjectileThrowable { + int j = EntityExperienceOrb.getOrbValue(i); + + i -= j; +- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j)); ++ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j, org.bukkit.entity.ExperienceOrb.SpawnReason.EXP_BOTTLE, getShooter(), this)); // Paper + } + + this.die(); +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java b/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java +@@ -0,0 +0,0 @@ public class ContainerGrindstone extends Container { + int k = EntityExperienceOrb.getOrbValue(j); + + j -= k; +- world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX(), (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, k)); ++ world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX(), (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, k, org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, entityhuman)); // Paper + } + + world.triggerEffect(1042, blockposition, 0); +diff --git a/src/main/java/net/minecraft/world/inventory/SlotFurnaceResult.java b/src/main/java/net/minecraft/world/inventory/SlotFurnaceResult.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/inventory/SlotFurnaceResult.java ++++ b/src/main/java/net/minecraft/world/inventory/SlotFurnaceResult.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.entity.TileEntityFurnace; public class SlotFurnaceResult extends Slot { @@ -264,10 +244,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private int b; public SlotFurnaceResult(EntityHuman entityhuman, IInventory iinventory, int i, int j, int k) { -diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityFurnace.java -+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java +@@ -0,0 +0,0 @@ public class Block extends BlockBase implements IMaterial { + } + } + +- public void dropExperience(WorldServer worldserver, BlockPosition blockposition, int i) { ++ public void dropExperience(WorldServer worldserver, BlockPosition blockposition, int i, net.minecraft.server.level.EntityPlayer player) { // Paper + if (worldserver.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)) { + while (i > 0) { + int j = EntityExperienceOrb.getOrbValue(i); + + i -= j; +- worldserver.addEntity(new EntityExperienceOrb(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, j)); ++ worldserver.addEntity(new EntityExperienceOrb(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, j, org.bukkit.entity.ExperienceOrb.SpawnReason.BLOCK_BREAK, player)); // Paper + } + } + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java @@ -0,0 +0,0 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I int k = EntityExperienceOrb.getOrbValue(j); diff --git a/Spigot-Server-Patches/Expose-Arrow-getItemStack.patch b/Spigot-Server-Patches/Expose-Arrow-getItemStack.patch index ad81ce0990..3fef098cb0 100644 --- a/Spigot-Server-Patches/Expose-Arrow-getItemStack.patch +++ b/Spigot-Server-Patches/Expose-Arrow-getItemStack.patch @@ -4,10 +4,10 @@ Date: Sat, 23 May 2020 10:31:11 -0400 Subject: [PATCH] Expose Arrow getItemStack -diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityArrow.java -+++ b/src/main/java/net/minecraft/server/EntityArrow.java +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java @@ -0,0 +0,0 @@ public abstract class EntityArrow extends IProjectile { } } diff --git a/Spigot-Server-Patches/Expose-LivingEntity-hurt-direction.patch b/Spigot-Server-Patches/Expose-LivingEntity-hurt-direction.patch index 3bc7ef618b..a7913458fc 100644 --- a/Spigot-Server-Patches/Expose-LivingEntity-hurt-direction.patch +++ b/Spigot-Server-Patches/Expose-LivingEntity-hurt-direction.patch @@ -4,10 +4,10 @@ Date: Sun, 13 Dec 2020 05:32:05 +0200 Subject: [PATCH] Expose LivingEntity hurt direction -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { public int am; public int hurtTicks; diff --git a/Spigot-Server-Patches/Expose-Tracked-Players.patch b/Spigot-Server-Patches/Expose-Tracked-Players.patch index 98fd26c3c9..5227b17327 100644 --- a/Spigot-Server-Patches/Expose-Tracked-Players.patch +++ b/Spigot-Server-Patches/Expose-Tracked-Players.patch @@ -4,11 +4,11 @@ Date: Fri, 26 Feb 2021 16:24:25 -0600 Subject: [PATCH] Expose Tracked Players -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper private CraftEntity bukkitEntity; 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 f28846366f..64e7c908fb 100644 --- a/Spigot-Server-Patches/Expose-attack-cooldown-methods-for-Player.patch +++ b/Spigot-Server-Patches/Expose-attack-cooldown-methods-for-Player.patch @@ -4,10 +4,10 @@ Date: Tue, 4 Sep 2018 15:02:00 -0500 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 +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { this.datawatcher.set(EntityHuman.bl, nbttagcompound); } @@ -21,8 +21,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- 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 { - connection.sendPacket(new net.minecraft.server.PacketPlayOutOpenBook(net.minecraft.server.EnumHand.MAIN_HAND)); - connection.sendPacket(new net.minecraft.server.PacketPlayOutSetSlot(0, slot, inventory.getItemInHand())); + connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutOpenBook(net.minecraft.world.EnumHand.MAIN_HAND)); + connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutSetSlot(0, slot, inventory.getItemInHand())); } + + public float getCooldownPeriod() { diff --git a/Spigot-Server-Patches/Expose-client-protocol-version-and-virtual-host.patch b/Spigot-Server-Patches/Expose-client-protocol-version-and-virtual-host.patch index 6db99f5924..87b6f94d4c 100644 --- a/Spigot-Server-Patches/Expose-client-protocol-version-and-virtual-host.patch +++ b/Spigot-Server-Patches/Expose-client-protocol-version-and-virtual-host.patch @@ -60,25 +60,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + +} -diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java +diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/HandshakeListener.java -+++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { - throw new UnsupportedOperationException("Invalid intention " + packethandshakinginsetprotocol.b()); - } - -+ // Paper start - NetworkClient implementation -+ this.getNetworkManager().protocolVersion = packethandshakinginsetprotocol.getProtocolVersion(); -+ this.getNetworkManager().virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(packethandshakinginsetprotocol.hostname, packethandshakinginsetprotocol.port); -+ // Paper end - } - - @Override -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java +--- a/src/main/java/net/minecraft/network/NetworkManager.java ++++ b/src/main/java/net/minecraft/network/NetworkManager.java @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { private float s; private int t; @@ -90,10 +75,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public NetworkManager(EnumProtocolDirection enumprotocoldirection) { this.h = enumprotocoldirection; -diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java +diff --git a/src/main/java/net/minecraft/network/protocol/handshake/PacketHandshakingInSetProtocol.java b/src/main/java/net/minecraft/network/protocol/handshake/PacketHandshakingInSetProtocol.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -+++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java +--- a/src/main/java/net/minecraft/network/protocol/handshake/PacketHandshakingInSetProtocol.java ++++ b/src/main/java/net/minecraft/network/protocol/handshake/PacketHandshakingInSetProtocol.java @@ -0,0 +0,0 @@ public class PacketHandshakingInSetProtocol implements Packet<PacketHandshakingI return this.d; } @@ -102,6 +87,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public int c() { return this.a; } +diff --git a/src/main/java/net/minecraft/server/network/HandshakeListener.java b/src/main/java/net/minecraft/server/network/HandshakeListener.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/HandshakeListener.java ++++ b/src/main/java/net/minecraft/server/network/HandshakeListener.java +@@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { + throw new UnsupportedOperationException("Invalid intention " + packethandshakinginsetprotocol.b()); + } + ++ // Paper start - NetworkClient implementation ++ this.getNetworkManager().protocolVersion = packethandshakinginsetprotocol.getProtocolVersion(); ++ this.getNetworkManager().virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(packethandshakinginsetprotocol.hostname, packethandshakinginsetprotocol.port); ++ // Paper end + } + + @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/Spigot-Server-Patches/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/Spigot-Server-Patches/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch index 9dc0804021..76a689e3fd 100644 --- a/Spigot-Server-Patches/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ b/Spigot-Server-Patches/Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and non-conflicting Entity Ids -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne void accept(Entity entity, double d0, double d1, double d2); } @@ -25,11 +25,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues { - return net.minecraft.server.EntityTypes.getByName(type.getName()).map(net.minecraft.server.EntityTypes::getDescriptionId).orElse(null); + return net.minecraft.world.entity.EntityTypes.getByName(type.getName()).map(net.minecraft.world.entity.EntityTypes::getDescriptionId).orElse(null); } + public int nextEntityId() { -+ return net.minecraft.server.Entity.nextEntityId(); ++ return net.minecraft.world.entity.Entity.nextEntityId(); + } + // Paper end diff --git a/Spigot-Server-Patches/Expose-world-spawn-angle.patch b/Spigot-Server-Patches/Expose-world-spawn-angle.patch index 0feb4539fe..e4345c19f5 100644 --- a/Spigot-Server-Patches/Expose-world-spawn-angle.patch +++ b/Spigot-Server-Patches/Expose-world-spawn-angle.patch @@ -4,10 +4,10 @@ Date: Tue, 17 Nov 2020 19:13:09 +0200 Subject: [PATCH] Expose world spawn angle -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { if (location == null) { worldserver1 = this.server.getWorldServer(World.OVERWORLD); @@ -17,10 +17,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } Player respawnPlayer = cserver.getPlayer(entityplayer1); -diff --git a/src/main/java/net/minecraft/server/WorldData.java b/src/main/java/net/minecraft/server/WorldData.java +diff --git a/src/main/java/net/minecraft/world/level/storage/WorldData.java b/src/main/java/net/minecraft/world/level/storage/WorldData.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldData.java -+++ b/src/main/java/net/minecraft/server/WorldData.java +--- a/src/main/java/net/minecraft/world/level/storage/WorldData.java ++++ b/src/main/java/net/minecraft/world/level/storage/WorldData.java @@ -0,0 +0,0 @@ public interface WorldData { int c(); diff --git a/Spigot-Server-Patches/Extend-Player-Interact-cancellation.patch b/Spigot-Server-Patches/Extend-Player-Interact-cancellation.patch index 17501ef9de..ee9110d018 100644 --- a/Spigot-Server-Patches/Extend-Player-Interact-cancellation.patch +++ b/Spigot-Server-Patches/Extend-Player-Interact-cancellation.patch @@ -12,10 +12,10 @@ also resolves this. Update adjacent blocks of doors, double plants, pistons and beds when cancelling interaction. -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java +--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java @@ -0,0 +0,0 @@ public class PlayerInteractManager { PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND); if (event.isCancelled()) { diff --git a/Spigot-Server-Patches/Extend-block-drop-capture-to-capture-all-items-added.patch b/Spigot-Server-Patches/Extend-block-drop-capture-to-capture-all-items-added.patch index b8e3ca834d..a3b392ef6a 100644 --- a/Spigot-Server-Patches/Extend-block-drop-capture-to-capture-all-items-added.patch +++ b/Spigot-Server-Patches/Extend-block-drop-capture-to-capture-all-items-added.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Extend block drop capture to capture all items added to the world -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java +--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java @@ -0,0 +0,0 @@ public class PlayerInteractManager { // return true; // CraftBukkit } @@ -24,10 +24,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Drop event experience if (flag && event != null) { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { } else if (this.isUUIDTaken(entity)) { return false; diff --git a/Spigot-Server-Patches/Faster-redstone-torch-rapid-clock-removal.patch b/Spigot-Server-Patches/Faster-redstone-torch-rapid-clock-removal.patch index c8bd18c282..c2156cc673 100644 --- a/Spigot-Server-Patches/Faster-redstone-torch-rapid-clock-removal.patch +++ b/Spigot-Server-Patches/Faster-redstone-torch-rapid-clock-removal.patch @@ -5,10 +5,22 @@ Subject: [PATCH] Faster redstone torch rapid clock removal Only resize the the redstone torch list once, since resizing arrays / lists is costly -diff --git a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockRedstoneTorch.java -+++ b/src/main/java/net/minecraft/server/BlockRedstoneTorch.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + private org.spigotmc.TickLimiter tileLimiter; + private int tileTickPosition; + public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions ++ public java.util.ArrayDeque<BlockRedstoneTorch.RedstoneUpdateInfo> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here + + public CraftWorld getWorld() { + return this.world; +diff --git a/src/main/java/net/minecraft/world/level/block/BlockRedstoneTorch.java b/src/main/java/net/minecraft/world/level/block/BlockRedstoneTorch.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockRedstoneTorch.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockRedstoneTorch.java @@ -0,0 +0,0 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit public class BlockRedstoneTorch extends BlockTorch { @@ -76,15 +88,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public RedstoneUpdateInfo(BlockPosition blockposition, long i) { this.a = blockposition; -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - private org.spigotmc.TickLimiter tileLimiter; - private int tileTickPosition; - public final Map<Explosion.CacheKey, Float> explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions -+ public java.util.ArrayDeque<BlockRedstoneTorch.RedstoneUpdateInfo> redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here - - public CraftWorld getWorld() { - return this.world; diff --git a/Spigot-Server-Patches/Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch b/Spigot-Server-Patches/Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch index 5df98b2968..b94709a61f 100644 --- a/Spigot-Server-Patches/Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch +++ b/Spigot-Server-Patches/Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch @@ -29,10 +29,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } } -diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java +--- a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java @@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { @Override protected void loadData(NBTTagCompound nbttagcompound) { diff --git a/Spigot-Server-Patches/Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch b/Spigot-Server-Patches/Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch index 264f712801..b706fccec8 100644 --- a/Spigot-Server-Patches/Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch +++ b/Spigot-Server-Patches/Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch @@ -23,10 +23,10 @@ to WHY that was ever intended to be the case. Instead we opt to remove the check entirely so that the event fires for all piston types. -diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java +diff --git a/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java b/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockPiston.java -+++ b/src/main/java/net/minecraft/server/BlockPiston.java +--- a/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java ++++ b/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java @@ -0,0 +0,0 @@ public class BlockPiston extends BlockDirectional { } diff --git a/Spigot-Server-Patches/Fire-event-on-GS4-query.patch b/Spigot-Server-Patches/Fire-event-on-GS4-query.patch index 5753fd972d..cc3a8d2e4a 100644 --- a/Spigot-Server-Patches/Fire-event-on-GS4-query.patch +++ b/Spigot-Server-Patches/Fire-event-on-GS4-query.patch @@ -4,10 +4,42 @@ Date: Sun, 17 Mar 2019 21:46:56 +0200 Subject: [PATCH] Fire event on GS4 query -diff --git a/src/main/java/net/minecraft/server/RemoteStatusListener.java b/src/main/java/net/minecraft/server/RemoteStatusListener.java +diff --git a/src/main/java/net/minecraft/server/rcon/RemoteStatusReply.java b/src/main/java/net/minecraft/server/rcon/RemoteStatusReply.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RemoteStatusListener.java -+++ b/src/main/java/net/minecraft/server/RemoteStatusListener.java +--- a/src/main/java/net/minecraft/server/rcon/RemoteStatusReply.java ++++ b/src/main/java/net/minecraft/server/rcon/RemoteStatusReply.java +@@ -0,0 +0,0 @@ public class RemoteStatusReply { + this.b.write(abyte, 0, abyte.length); + } + ++ public void writeString(String string) throws IOException { this.a(string); } // Paper - OBFHELPER + public void a(String s) throws IOException { + this.b.writeBytes(s); + this.b.write(0); + } ++ // Paper start - unchecked exception variant to use in Stream API ++ public void writeStringUnchecked(String string) { ++ try { ++ writeString(string); ++ } catch (IOException e) { ++ com.destroystokyo.paper.util.SneakyThrow.sneaky(e); ++ } ++ } ++ // Paper end + ++ public void writeInt(int i) throws IOException { this.a(i); } // Paper - OBFHELPER + public void a(int i) throws IOException { + this.b.write(i); + } + ++ public void writeShort(short i) throws IOException { this.a(i); } // Paper - OBFHELPER + public void a(short short0) throws IOException { + this.b.writeShort(Short.reverseBytes(short0)); + } +diff --git a/src/main/java/net/minecraft/server/rcon/thread/RemoteStatusListener.java b/src/main/java/net/minecraft/server/rcon/thread/RemoteStatusListener.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/rcon/thread/RemoteStatusListener.java ++++ b/src/main/java/net/minecraft/server/rcon/thread/RemoteStatusListener.java @@ -0,0 +0,0 @@ public class RemoteStatusListener extends RemoteConnectionThread { private static final Logger LOGGER = LogManager.getLogger(); private long e; @@ -162,35 +194,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.p.a(); } } -diff --git a/src/main/java/net/minecraft/server/RemoteStatusReply.java b/src/main/java/net/minecraft/server/RemoteStatusReply.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RemoteStatusReply.java -+++ b/src/main/java/net/minecraft/server/RemoteStatusReply.java -@@ -0,0 +0,0 @@ public class RemoteStatusReply { - this.b.write(abyte, 0, abyte.length); - } - -+ public void writeString(String string) throws IOException { this.a(string); } // Paper - OBFHELPER - public void a(String s) throws IOException { - this.b.writeBytes(s); - this.b.write(0); - } -+ // Paper start - unchecked exception variant to use in Stream API -+ public void writeStringUnchecked(String string) { -+ try { -+ writeString(string); -+ } catch (IOException e) { -+ com.destroystokyo.paper.util.SneakyThrow.sneaky(e); -+ } -+ } -+ // Paper end - -+ public void writeInt(int i) throws IOException { this.a(i); } // Paper - OBFHELPER - public void a(int i) throws IOException { - this.b.write(i); - } - -+ public void writeShort(short i) throws IOException { this.a(i); } // Paper - OBFHELPER - public void a(short short0) throws IOException { - this.b.writeShort(Short.reverseBytes(short0)); - } diff --git a/Spigot-Server-Patches/Firework-API-s.patch b/Spigot-Server-Patches/Firework-API-s.patch index 790f6fe91a..00c02bd3cd 100644 --- a/Spigot-Server-Patches/Firework-API-s.patch +++ b/Spigot-Server-Patches/Firework-API-s.patch @@ -4,10 +4,22 @@ Date: Wed, 28 Dec 2016 07:18:33 +0100 Subject: [PATCH] Firework API's -diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java +diff --git a/src/main/java/net/minecraft/nbt/NBTTagCompound.java b/src/main/java/net/minecraft/nbt/NBTTagCompound.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFireworks.java -+++ b/src/main/java/net/minecraft/server/EntityFireworks.java +--- a/src/main/java/net/minecraft/nbt/NBTTagCompound.java ++++ b/src/main/java/net/minecraft/nbt/NBTTagCompound.java +@@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { + return GameProfileSerializer.a(this.get(s)); + } + ++ public final boolean hasUUID(String s) { return this.b(s); } // Paper - OBFHELPER + public boolean b(String s) { + NBTBase nbtbase = this.get(s); + +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFireworks.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFireworks.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFireworks.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFireworks.java @@ -0,0 +0,0 @@ public class EntityFireworks extends IProjectile { public static final DataWatcherObject<Boolean> SHOT_AT_ANGLE = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i); private int ticksFlown; @@ -43,10 +55,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @Override -diff --git a/src/main/java/net/minecraft/server/ItemCrossbow.java b/src/main/java/net/minecraft/server/ItemCrossbow.java +diff --git a/src/main/java/net/minecraft/world/item/ItemCrossbow.java b/src/main/java/net/minecraft/world/item/ItemCrossbow.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemCrossbow.java -+++ b/src/main/java/net/minecraft/server/ItemCrossbow.java +--- a/src/main/java/net/minecraft/world/item/ItemCrossbow.java ++++ b/src/main/java/net/minecraft/world/item/ItemCrossbow.java @@ -0,0 +0,0 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable if (flag1) { @@ -55,10 +67,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { object = a(world, entityliving, itemstack, itemstack1); if (flag || f3 != 0.0F) { -diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java +diff --git a/src/main/java/net/minecraft/world/item/ItemFireworks.java b/src/main/java/net/minecraft/world/item/ItemFireworks.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemFireworks.java -+++ b/src/main/java/net/minecraft/server/ItemFireworks.java +--- a/src/main/java/net/minecraft/world/item/ItemFireworks.java ++++ b/src/main/java/net/minecraft/world/item/ItemFireworks.java @@ -0,0 +0,0 @@ public class ItemFireworks extends Item { Vec3D vec3d = itemactioncontext.getPos(); EnumDirection enumdirection = itemactioncontext.getClickedFace(); @@ -80,18 +92,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!entityhuman.abilities.canInstantlyBuild) { itemstack.subtract(1); } -diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NBTTagCompound.java -+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java -@@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { - return GameProfileSerializer.a(this.get(s)); - } - -+ public final boolean hasUUID(String s) { return this.b(s); } // Paper - OBFHELPER - public boolean b(String s) { - NBTBase nbtbase = this.get(s); - diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java diff --git a/Spigot-Server-Patches/Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch b/Spigot-Server-Patches/Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch index 45217c120f..2862ac62e2 100644 --- a/Spigot-Server-Patches/Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch +++ b/Spigot-Server-Patches/Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch @@ -8,26 +8,11 @@ Move the criterion storage to the AdvancementDataPlayer object itself, so the criterion object stores no references - and thus needs no cleanup. -diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java +diff --git a/src/main/java/net/minecraft/advancements/critereon/CriterionTriggerAbstract.java b/src/main/java/net/minecraft/advancements/critereon/CriterionTriggerAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -+++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -@@ -0,0 +0,0 @@ public class AdvancementDataPlayer { - private Advancement l; - private boolean m = true; - -+ // Paper start - fix advancement data player leakage -+ final Map<CriterionTriggerAbstract, Set<CriterionTrigger.a>> criterionData = Maps.newIdentityHashMap(); -+ // Paper end - fix advancement data player leakage -+ - public AdvancementDataPlayer(DataFixer datafixer, PlayerList playerlist, AdvancementDataWorld advancementdataworld, File file, EntityPlayer entityplayer) { - this.d = datafixer; - this.e = playerlist; -diff --git a/src/main/java/net/minecraft/server/CriterionTriggerAbstract.java b/src/main/java/net/minecraft/server/CriterionTriggerAbstract.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CriterionTriggerAbstract.java -+++ b/src/main/java/net/minecraft/server/CriterionTriggerAbstract.java -@@ -0,0 +0,0 @@ import java.util.function.Predicate; +--- a/src/main/java/net/minecraft/advancements/critereon/CriterionTriggerAbstract.java ++++ b/src/main/java/net/minecraft/advancements/critereon/CriterionTriggerAbstract.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.storage.loot.LootTableInfo; public abstract class CriterionTriggerAbstract<T extends CriterionInstanceAbstract> implements CriterionTrigger<T> { @@ -84,3 +69,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (t0.b().a(loottableinfo) && predicate.test(t0)) { if (list == null) { +diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java ++++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java +@@ -0,0 +0,0 @@ public class AdvancementDataPlayer { + private Advancement l; + private boolean m = true; + ++ // Paper start - fix advancement data player leakage ++ final Map<CriterionTriggerAbstract, Set<CriterionTrigger.a>> criterionData = Maps.newIdentityHashMap(); ++ // Paper end - fix advancement data player leakage ++ + public AdvancementDataPlayer(DataFixer datafixer, PlayerList playerlist, AdvancementDataWorld advancementdataworld, File file, EntityPlayer entityplayer) { + this.d = datafixer; + this.e = playerlist; diff --git a/Spigot-Server-Patches/Fix-AssertionError-when-player-hand-set-to-empty-typ.patch b/Spigot-Server-Patches/Fix-AssertionError-when-player-hand-set-to-empty-typ.patch index 4422b90b90..b82de9b4cc 100644 --- a/Spigot-Server-Patches/Fix-AssertionError-when-player-hand-set-to-empty-typ.patch +++ b/Spigot-Server-Patches/Fix-AssertionError-when-player-hand-set-to-empty-typ.patch @@ -6,22 +6,10 @@ Subject: [PATCH] Fix AssertionError when player hand set to empty type Fixes an AssertionError when setting the player's item in hand to null or a new ItemStack of Air in PlayerInteractEvent Fixes GH-2718 -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - return predicate.test(this.getItemInMainHand().getItem()) || predicate.test(this.getItemInOffHand().getItem()); - } - -+ public final ItemStack getItemInHand(EnumHand enumhand) { return this.b(enumhand); } // Paper - OBFHELPER - public ItemStack b(EnumHand enumhand) { - if (enumhand == EnumHand.MAIN_HAND) { - return this.getEquipment(EnumItemSlot.MAINHAND); -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524 return; @@ -33,3 +21,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 EnumInteractionResult enuminteractionresult = this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand); if (enuminteractionresult.b()) { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + return predicate.test(this.getItemInMainHand().getItem()) || predicate.test(this.getItemInOffHand().getItem()); + } + ++ public final ItemStack getItemInHand(EnumHand enumhand) { return this.b(enumhand); } // Paper - OBFHELPER + public ItemStack b(EnumHand enumhand) { + if (enumhand == EnumHand.MAIN_HAND) { + return this.getEquipment(EnumItemSlot.MAINHAND); diff --git a/Spigot-Server-Patches/Fix-CB-call-to-changed-postToMainThread-method.patch b/Spigot-Server-Patches/Fix-CB-call-to-changed-postToMainThread-method.patch index dd2a17c58d..659181a05d 100644 --- a/Spigot-Server-Patches/Fix-CB-call-to-changed-postToMainThread-method.patch +++ b/Spigot-Server-Patches/Fix-CB-call-to-changed-postToMainThread-method.patch @@ -4,10 +4,10 @@ Date: Fri, 10 May 2019 18:38:19 +0100 Subject: [PATCH] Fix CB call to changed postToMainThread method -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { this.networkManager.getClass(); diff --git a/Spigot-Server-Patches/Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch b/Spigot-Server-Patches/Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch index eeff232b6d..fdf6f5072d 100644 --- a/Spigot-Server-Patches/Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch +++ b/Spigot-Server-Patches/Fix-CME-on-adding-a-passenger-in-CreatureSpawnEvent.patch @@ -4,11 +4,11 @@ Date: Sun, 4 Oct 2020 19:55:25 -0700 Subject: [PATCH] Fix CME on adding a passenger in CreatureSpawnEvent -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public Stream<Entity> recursiveStream() { diff --git a/Spigot-Server-Patches/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/Spigot-Server-Patches/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch index e07fdb5397..65601e031c 100644 --- a/Spigot-Server-Patches/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch +++ b/Spigot-Server-Patches/Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch @@ -4,10 +4,10 @@ Date: Sun, 3 Apr 2016 17:48:50 -0400 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 +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public void b(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {} diff --git a/Spigot-Server-Patches/Fix-Chunk-Post-Processing-deadlock-risk.patch b/Spigot-Server-Patches/Fix-Chunk-Post-Processing-deadlock-risk.patch index 2251aae288..d2e39d5cbc 100644 --- a/Spigot-Server-Patches/Fix-Chunk-Post-Processing-deadlock-risk.patch +++ b/Spigot-Server-Patches/Fix-Chunk-Post-Processing-deadlock-risk.patch @@ -24,10 +24,10 @@ the executor so that the mailbox ChunkQueue is now considered empty. This successfully fixed a reoccurring and highly reproduceable crash for heightmaps. -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { return super.executeNext() || execChunkTask; // Paper } @@ -36,10 +36,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 playerChunkMap.callbackExecutor.run(); } // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { }; // CraftBukkit end diff --git a/Spigot-Server-Patches/Fix-Concurrency-issue-in-WeightedList.patch b/Spigot-Server-Patches/Fix-Concurrency-issue-in-WeightedList.patch index a97472a245..e977fb8c15 100644 --- a/Spigot-Server-Patches/Fix-Concurrency-issue-in-WeightedList.patch +++ b/Spigot-Server-Patches/Fix-Concurrency-issue-in-WeightedList.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix Concurrency issue in WeightedList if multiple threads from worldgen sort at same time, it will crash. So make a copy of the list for sorting purposes. -diff --git a/src/main/java/net/minecraft/server/BehaviorGate.java b/src/main/java/net/minecraft/server/BehaviorGate.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorGate.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorGate.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BehaviorGate.java -+++ b/src/main/java/net/minecraft/server/BehaviorGate.java +--- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorGate.java ++++ b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorGate.java @@ -0,0 +0,0 @@ public class BehaviorGate<E extends EntityLiving> extends Behavior<E> { private final Set<MemoryModuleType<?>> b; private final BehaviorGate.Order c; @@ -40,10 +40,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.c = consumer; } -diff --git a/src/main/java/net/minecraft/server/WeightedList.java b/src/main/java/net/minecraft/server/WeightedList.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/WeightedList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/WeightedList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WeightedList.java -+++ b/src/main/java/net/minecraft/server/WeightedList.java +--- a/src/main/java/net/minecraft/world/entity/ai/behavior/WeightedList.java ++++ b/src/main/java/net/minecraft/world/entity/ai/behavior/WeightedList.java @@ -0,0 +0,0 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; import com.mojang.serialization.Dynamic; diff --git a/Spigot-Server-Patches/Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch b/Spigot-Server-Patches/Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch index b3fc79f16c..5f9ccd08d4 100644 --- a/Spigot-Server-Patches/Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch +++ b/Spigot-Server-Patches/Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch @@ -9,10 +9,10 @@ This made the Bukkit RecipeChoice API not work for Shapeless. This reimplements vanilla logic using the same test logic as Shaped -diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java +diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipes.java b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipes.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ShapelessRecipes.java -+++ b/src/main/java/net/minecraft/server/ShapelessRecipes.java +--- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipes.java ++++ b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipes.java @@ -0,0 +0,0 @@ public class ShapelessRecipes implements RecipeCrafting { AutoRecipeStackManager autorecipestackmanager = new AutoRecipeStackManager(); int i = 0; diff --git a/Spigot-Server-Patches/Fix-Double-World-Add-issues.patch b/Spigot-Server-Patches/Fix-Double-World-Add-issues.patch index 8232620a50..ba2afb67b3 100644 --- a/Spigot-Server-Patches/Fix-Double-World-Add-issues.patch +++ b/Spigot-Server-Patches/Fix-Double-World-Add-issues.patch @@ -7,10 +7,10 @@ Vanilla will double add Spider Jockeys to the world, so ignore already added. Also add debug if something else tries to, and abort before world gets bad state -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { // CraftBukkit start private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) { diff --git a/Spigot-Server-Patches/Fix-Dragon-Server-Crashes.patch b/Spigot-Server-Patches/Fix-Dragon-Server-Crashes.patch index a95f656511..f8bb0eb299 100644 --- a/Spigot-Server-Patches/Fix-Dragon-Server-Crashes.patch +++ b/Spigot-Server-Patches/Fix-Dragon-Server-Crashes.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix Dragon Server Crashes If the dragon tries to find "ground" and hits a hole, or off edge, it will infinitely keep looking for non air and eventually crash. -diff --git a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java -+++ b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java @@ -0,0 +0,0 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded double d3 = d2; BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(d0, d2, d1); diff --git a/Spigot-Server-Patches/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch b/Spigot-Server-Patches/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch index 7af28cc7b1..3b556e771d 100644 --- a/Spigot-Server-Patches/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch +++ b/Spigot-Server-Patches/Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch @@ -8,36 +8,10 @@ as this is how Vanilla teleports entities. Cancel any pending motion when teleported. -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 - - // CraftBukkit start - private static final int CURRENT_LEVEL = 2; -+ boolean preserveMotion = true; // Paper - keep initial motion on first setPositionRotation - static boolean isLevelAtLeast(NBTTagCompound tag, int level) { - return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; - } -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } - - public void setPositionRotation(double d0, double d1, double d2, float f, float f1) { -+ // Paper - cancel entity velocity if teleported -+ if (!preserveMotion) { -+ this.mot = Vec3D.ORIGIN; -+ } else { -+ this.preserveMotion = false; -+ } -+ // Paper end - this.g(d0, d1, d2); - this.yaw = f; - this.pitch = f1; -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) { PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.getWorldServer()); @@ -56,6 +30,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.player.forceCheckHighPriority(); // Paper this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait)); } +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + + // CraftBukkit start + private static final int CURRENT_LEVEL = 2; ++ boolean preserveMotion = true; // Paper - keep initial motion on first setPositionRotation + static boolean isLevelAtLeast(NBTTagCompound tag, int level) { + return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; + } +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + } + + public void setPositionRotation(double d0, double d1, double d2, float f, float f1) { ++ // Paper - cancel entity velocity if teleported ++ if (!preserveMotion) { ++ this.mot = Vec3D.ORIGIN; ++ } else { ++ this.preserveMotion = false; ++ } ++ // Paper end + this.g(d0, d1, d2); + this.yaw = f; + this.pitch = f1; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -68,4 +68,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); // Paper - use proper setPosition, as per vanilla teleporting // SPIGOT-619: Force sync head rotation also entity.setHeadRotation(location.getYaw()); - ((net.minecraft.server.WorldServer) entity.world).chunkCheck(entity); // Spigot - register to new chunk + ((net.minecraft.server.level.WorldServer) entity.world).chunkCheck(entity); // Spigot - register to new chunk diff --git a/Spigot-Server-Patches/Fix-Light-Command.patch b/Spigot-Server-Patches/Fix-Light-Command.patch index b4db629a00..795810b36f 100644 --- a/Spigot-Server-Patches/Fix-Light-Command.patch +++ b/Spigot-Server-Patches/Fix-Light-Command.patch @@ -10,25 +10,31 @@ diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java -@@ -0,0 +0,0 @@ import com.google.common.collect.Maps; +@@ -0,0 +0,0 @@ import com.google.common.collect.ImmutableSet; + import com.google.common.collect.Iterables; + import com.google.common.collect.Lists; + import com.google.common.collect.Maps; ++import net.minecraft.core.BlockPosition; ++import net.minecraft.network.protocol.game.PacketPlayOutLightUpdate; + import net.minecraft.resources.MinecraftKey; import com.google.gson.JsonObject; import com.google.gson.internal.Streams; - import com.google.gson.stream.JsonWriter; -+import net.minecraft.server.BlockPosition; -+import net.minecraft.server.Chunk; - import net.minecraft.server.ChunkCoordIntPair; - import net.minecraft.server.ChunkProviderServer; - import net.minecraft.server.Entity; -+import net.minecraft.server.EntityPlayer; - import net.minecraft.server.EntityTypes; -+import net.minecraft.server.LightEngineThreaded; +@@ -0,0 +0,0 @@ import com.google.gson.stream.JsonWriter; import net.minecraft.server.MCUtil; - import net.minecraft.server.MinecraftKey; import net.minecraft.server.MinecraftServer; -+import net.minecraft.server.PacketPlayOutLightUpdate; - import net.minecraft.server.PlayerChunk; - import net.minecraft.server.WorldServer; + import net.minecraft.server.level.ChunkProviderServer; ++import net.minecraft.server.level.EntityPlayer; ++import net.minecraft.server.level.LightEngineThreaded; + import net.minecraft.server.level.PlayerChunk; + import net.minecraft.server.level.WorldServer; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityTypes; + import net.minecraft.world.level.ChunkCoordIntPair; +-import net.minecraft.server.MCUtil; ++import net.minecraft.world.level.chunk.Chunk; import org.apache.commons.lang3.tuple.MutablePair; + import org.apache.commons.lang3.tuple.Pair; + import org.bukkit.Bukkit; @@ -0,0 +0,0 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.craftbukkit.CraftServer; @@ -91,7 +97,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + CraftPlayer player = (CraftPlayer) sender; + EntityPlayer handle = player.getHandle(); -+ net.minecraft.server.WorldServer world = (WorldServer) handle.world; ++ WorldServer world = (WorldServer) handle.world; + LightEngineThreaded lightengine = world.getChunkProvider().getLightEngine(); + + BlockPosition center = MCUtil.toBlockPosition(player.getLocation()); @@ -147,10 +153,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private void doSyncLoadInfo(CommandSender sender, String[] args) { if (!SyncLoadFinder.ENABLED) { sender.sendMessage(ChatColor.RED + "This command requires the server startup flag '-Dpaper.debug-sync-loads=true' to be set."); -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { } @@ -159,10 +165,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private void a(Packet<?> packet, boolean flag) { // Paper start - per player view distance // there can be potential desync with player's last mapped section and the view distance map, so use the -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private final ChunkTaskQueueSorter p; private final Mailbox<ChunkTaskQueueSorter.a<Runnable>> mailboxWorldGen; diff --git a/Spigot-Server-Patches/Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch b/Spigot-Server-Patches/Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch index 2579ce27b1..e511abd2fb 100644 --- a/Spigot-Server-Patches/Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch +++ b/Spigot-Server-Patches/Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch @@ -27,10 +27,10 @@ This was very non deterministic. This change will ensure every plugin receives a deterministic result, and should no longer require 1 tick delays anymore. -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public double maxHealthCache; public boolean joining = true; @@ -39,10 +39,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public Integer clientViewDistance; // CraftBukkit end public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { .printStackTrace(); return; @@ -51,10 +51,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end if (!(entity instanceof EntityComplexPart)) { EntityTypes<?> entitytypes = entity.getEntityType(); -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { this.j.put(entityplayer.getUniqueID(), entityplayer); // this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer})); // CraftBukkit - replaced with loop below @@ -76,7 +76,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + ((WorldServer)entityplayer.world).getChunkProvider().playerChunkMap.addEntity(entityplayer); // Paper - track entity now // CraftBukkit end - entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.datawatcher, true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn + entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.getDataWatcher(), true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn @@ -0,0 +0,0 @@ public abstract class PlayerList { playerconnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobeffect)); } 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 778318b9f5..93dda02681 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 @@ -4,10 +4,10 @@ Date: Wed, 9 Aug 2017 17:51:22 -0500 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 +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { gameprofilerfiller.enter("blockEntities"); timings.tileEntityTick.startTiming(); // Spigot diff --git a/Spigot-Server-Patches/Fix-MC-158900.patch b/Spigot-Server-Patches/Fix-MC-158900.patch index e58b6146fe..3fa552211c 100644 --- a/Spigot-Server-Patches/Fix-MC-158900.patch +++ b/Spigot-Server-Patches/Fix-MC-158900.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix MC-158900 The problem was we were checking isExpired() on the entry, but if it was expired at that point, then it would be null. -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { Player player = entity.getBukkitEntity(); PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.networkManager.getRawAddress()).getAddress()); diff --git a/Spigot-Server-Patches/Fix-MC-161754.patch b/Spigot-Server-Patches/Fix-MC-161754.patch index ecb8057b72..0e0f6f62be 100644 --- a/Spigot-Server-Patches/Fix-MC-161754.patch +++ b/Spigot-Server-Patches/Fix-MC-161754.patch @@ -8,10 +8,10 @@ Fixes https://github.com/PaperMC/Paper/issues/2580 We can use an entity valid check since this method is invoked for each inventory iteraction (thanks to CB) and on player tick (vanilla). -diff --git a/src/main/java/net/minecraft/server/ContainerHorse.java b/src/main/java/net/minecraft/server/ContainerHorse.java +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerHorse.java b/src/main/java/net/minecraft/world/inventory/ContainerHorse.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ContainerHorse.java -+++ b/src/main/java/net/minecraft/server/ContainerHorse.java +--- a/src/main/java/net/minecraft/world/inventory/ContainerHorse.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerHorse.java @@ -0,0 +0,0 @@ public class ContainerHorse extends Container { @Override diff --git a/Spigot-Server-Patches/Fix-MC-187716-Use-configured-height.patch b/Spigot-Server-Patches/Fix-MC-187716-Use-configured-height.patch index 7c4a1b7309..abc8f6cb86 100644 --- a/Spigot-Server-Patches/Fix-MC-187716-Use-configured-height.patch +++ b/Spigot-Server-Patches/Fix-MC-187716-Use-configured-height.patch @@ -4,10 +4,10 @@ Date: Sat, 15 Aug 2020 08:04:49 -0500 Subject: [PATCH] Fix MC-187716 Use configured height -diff --git a/src/main/java/net/minecraft/server/WorldGenSurfaceNether.java b/src/main/java/net/minecraft/server/WorldGenSurfaceNether.java +diff --git a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/WorldGenSurfaceNether.java b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/WorldGenSurfaceNether.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldGenSurfaceNether.java -+++ b/src/main/java/net/minecraft/server/WorldGenSurfaceNether.java +--- a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/WorldGenSurfaceNether.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/WorldGenSurfaceNether.java @@ -0,0 +0,0 @@ public class WorldGenSurfaceNether extends WorldGenSurface<WorldGenSurfaceConfig IBlockData iblockdata2 = worldgensurfaceconfigurationbase.a(); IBlockData iblockdata3 = worldgensurfaceconfigurationbase.b(); @@ -17,10 +17,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 blockposition_mutableblockposition.d(k1, k2, l1); IBlockData iblockdata4 = ichunkaccess.getType(blockposition_mutableblockposition); -diff --git a/src/main/java/net/minecraft/server/WorldGenSurfaceNetherAbstract.java b/src/main/java/net/minecraft/server/WorldGenSurfaceNetherAbstract.java +diff --git a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/WorldGenSurfaceNetherAbstract.java b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/WorldGenSurfaceNetherAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldGenSurfaceNetherAbstract.java -+++ b/src/main/java/net/minecraft/server/WorldGenSurfaceNetherAbstract.java +--- a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/WorldGenSurfaceNetherAbstract.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/WorldGenSurfaceNetherAbstract.java @@ -0,0 +0,0 @@ public abstract class WorldGenSurfaceNetherAbstract extends WorldGenSurface<Worl BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); IBlockData iblockdata4 = ichunkaccess.getType(blockposition_mutableblockposition.d(k1, 128, l1)); @@ -30,10 +30,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 blockposition_mutableblockposition.d(k1, k2, l1); IBlockData iblockdata5 = ichunkaccess.getType(blockposition_mutableblockposition); int l2; -diff --git a/src/main/java/net/minecraft/server/WorldGenSurfaceNetherForest.java b/src/main/java/net/minecraft/server/WorldGenSurfaceNetherForest.java +diff --git a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/WorldGenSurfaceNetherForest.java b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/WorldGenSurfaceNetherForest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldGenSurfaceNetherForest.java -+++ b/src/main/java/net/minecraft/server/WorldGenSurfaceNetherForest.java +--- a/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/WorldGenSurfaceNetherForest.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/surfacebuilders/WorldGenSurfaceNetherForest.java @@ -0,0 +0,0 @@ public class WorldGenSurfaceNetherForest extends WorldGenSurface<WorldGenSurface int j2 = -1; IBlockData iblockdata2 = worldgensurfaceconfigurationbase.b(); diff --git a/Spigot-Server-Patches/Fix-MC-197271.patch b/Spigot-Server-Patches/Fix-MC-197271.patch index ec0a8b8df9..0d804913d5 100644 --- a/Spigot-Server-Patches/Fix-MC-197271.patch +++ b/Spigot-Server-Patches/Fix-MC-197271.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-197271 This patch only fixes an issue for servers running OpenJ9. -diff --git a/src/main/java/net/minecraft/server/RegistryGeneration.java b/src/main/java/net/minecraft/server/RegistryGeneration.java +diff --git a/src/main/java/net/minecraft/data/RegistryGeneration.java b/src/main/java/net/minecraft/data/RegistryGeneration.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegistryGeneration.java -+++ b/src/main/java/net/minecraft/server/RegistryGeneration.java +--- a/src/main/java/net/minecraft/data/RegistryGeneration.java ++++ b/src/main/java/net/minecraft/data/RegistryGeneration.java @@ -0,0 +0,0 @@ public class RegistryGeneration { public static final IRegistry<ProcessorList> g = a(IRegistry.aw, () -> { return ProcessorLists.b; diff --git a/Spigot-Server-Patches/Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch b/Spigot-Server-Patches/Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch index 7130dee881..db90121d4b 100644 --- a/Spigot-Server-Patches/Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch +++ b/Spigot-Server-Patches/Fix-MC-99259-Wither-Boss-Bar-doesn-t-update-until-in.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix MC-99259 Wither Boss Bar doesn't update until invulnerability period is over -diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java +diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityWither.java -+++ b/src/main/java/net/minecraft/server/EntityWither.java +--- a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java ++++ b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java @@ -0,0 +0,0 @@ public class EntityWither extends EntityMonster implements IRangedEntity { this.heal(1.0F, EntityRegainHealthEvent.RegainReason.REGEN); // CraftBukkit } diff --git a/Spigot-Server-Patches/Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch b/Spigot-Server-Patches/Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch index 213a07eb81..80ed2edd5b 100644 --- a/Spigot-Server-Patches/Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch +++ b/Spigot-Server-Patches/Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch @@ -15,10 +15,10 @@ full chunks so this was really starting to hurt. We further improve it by making a copy of the nbt tag with only the memory it needs, so that we dont have to hold a copy to the entire compound. -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java @@ -0,0 +0,0 @@ public class ChunkRegionLoader { object2 = protochunkticklist1; } @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - object = new Chunk(worldserver.getMinecraftWorld(), chunkcoordintpair, biomestorage, chunkconverter, (TickList) object1, (TickList) object2, j, achunksection, (chunk) -> { - loadEntities(nbttagcompound1, chunk); - // CraftBukkit start - load chunk persistent data from nbt -- NBTBase persistentBase = nbttagcompound1.get("ChunkBukkitValues"); +- net.minecraft.nbt.NBTBase persistentBase = nbttagcompound1.get("ChunkBukkitValues"); - if (persistentBase instanceof NBTTagCompound) { - chunk.persistentDataContainer.putAll((NBTTagCompound) persistentBase); - } diff --git a/Spigot-Server-Patches/Fix-Not-a-string-Map-Conversion-spam.patch b/Spigot-Server-Patches/Fix-Not-a-string-Map-Conversion-spam.patch index 1bebdf982c..349453455f 100644 --- a/Spigot-Server-Patches/Fix-Not-a-string-Map-Conversion-spam.patch +++ b/Spigot-Server-Patches/Fix-Not-a-string-Map-Conversion-spam.patch @@ -9,10 +9,10 @@ implementing this logic incorrectly. This stops the spam by converting the old format to new before requesting the world. -diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java +diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java b/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldMap.java -+++ b/src/main/java/net/minecraft/server/WorldMap.java +--- a/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java ++++ b/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { @Override diff --git a/Spigot-Server-Patches/Fix-Old-Sign-Conversion.patch b/Spigot-Server-Patches/Fix-Old-Sign-Conversion.patch index 322059dc07..c676680f10 100644 --- a/Spigot-Server-Patches/Fix-Old-Sign-Conversion.patch +++ b/Spigot-Server-Patches/Fix-Old-Sign-Conversion.patch @@ -8,27 +8,11 @@ Subject: [PATCH] Fix Old Sign Conversion 2) New Mojang Schematic system has Tile Entities in the new converted format, but missing the Bukkit.isConverted flag This causes Igloos and such to render broken signs. We fix this by ignoring sign conversion for Defined Structures -diff --git a/src/main/java/net/minecraft/server/DefinedStructure.java b/src/main/java/net/minecraft/server/DefinedStructure.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DefinedStructure.java -+++ b/src/main/java/net/minecraft/server/DefinedStructure.java -@@ -0,0 +0,0 @@ public class DefinedStructure { - definedstructure_blockinfo.c.setLong("LootTableSeed", random.nextLong()); - } - -+ tileentity.isLoadingStructure = true; // Paper - tileentity.load(definedstructure_blockinfo.b, definedstructure_blockinfo.c); - tileentity.a(definedstructureinfo.c()); - tileentity.a(definedstructureinfo.d()); -+ tileentity.isLoadingStructure = false; // Paper - } - } - -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +@@ -0,0 +0,0 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / public CraftPersistentDataContainer persistentDataContainer; // CraftBukkit end private static final Logger LOGGER = LogManager.getLogger(); @@ -36,10 +20,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private final TileEntityTypes<?> tileType; public TileEntityTypes getTileEntityType() { return tileType; } // Paper - OBFHELPER @Nullable protected World world; -diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntitySign.java -+++ b/src/main/java/net/minecraft/server/TileEntitySign.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java @@ -0,0 +0,0 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // } @@ -57,3 +41,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.world instanceof WorldServer) { try { +diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java +@@ -0,0 +0,0 @@ public class DefinedStructure { + definedstructure_blockinfo.c.setLong("LootTableSeed", random.nextLong()); + } + ++ tileentity.isLoadingStructure = true; // Paper + tileentity.load(definedstructure_blockinfo.b, definedstructure_blockinfo.c); + tileentity.a(definedstructureinfo.c()); + tileentity.a(definedstructureinfo.d()); ++ tileentity.isLoadingStructure = false; // Paper + } + } + diff --git a/Spigot-Server-Patches/Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/Spigot-Server-Patches/Fix-Per-World-Difficulty-Remembering-Difficulty.patch index 21f973cc38..77e8bbddd8 100644 --- a/Spigot-Server-Patches/Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/Spigot-Server-Patches/Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -7,37 +7,6 @@ Fixes per world difficulty with /difficulty command and also makes it so that the server keeps the last difficulty used instead of restoring the server.properties every single load. -diff --git a/src/main/java/net/minecraft/server/CommandDifficulty.java b/src/main/java/net/minecraft/server/CommandDifficulty.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CommandDifficulty.java -+++ b/src/main/java/net/minecraft/server/CommandDifficulty.java -@@ -0,0 +0,0 @@ public class CommandDifficulty { - public static int a(CommandListenerWrapper commandlistenerwrapper, EnumDifficulty enumdifficulty) throws CommandSyntaxException { - MinecraftServer minecraftserver = commandlistenerwrapper.getServer(); - -- if (minecraftserver.getSaveData().getDifficulty() == enumdifficulty) { -+ WorldServer world = commandlistenerwrapper.getWorld(); // Paper -+ if (world.worldDataServer.getDifficulty() == enumdifficulty) { // Paper - throw CommandDifficulty.a.create(enumdifficulty.c()); - } else { -- minecraftserver.a(enumdifficulty, true); -+ minecraftserver.a(world, enumdifficulty, true); // Paper - commandlistenerwrapper.sendMessage(new ChatMessage("commands.difficulty.success", new Object[]{enumdifficulty.b()}), true); - return 0; - } -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 - - @Override - public void updateWorldSettings() { -- this.a(this.getDedicatedServerProperties().difficulty, true); -+ //this.a(this.getDedicatedServerProperties().difficulty, true); // Paper - Don't overwrite level.dat's difficulty, keep current - } - - @Override diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -63,10 +32,41 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/commands/CommandDifficulty.java b/src/main/java/net/minecraft/server/commands/CommandDifficulty.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/commands/CommandDifficulty.java ++++ b/src/main/java/net/minecraft/server/commands/CommandDifficulty.java +@@ -0,0 +0,0 @@ public class CommandDifficulty { + public static int a(CommandListenerWrapper commandlistenerwrapper, EnumDifficulty enumdifficulty) throws CommandSyntaxException { + MinecraftServer minecraftserver = commandlistenerwrapper.getServer(); + +- if (minecraftserver.getSaveData().getDifficulty() == enumdifficulty) { ++ WorldServer world = commandlistenerwrapper.getWorld(); // Paper ++ if (world.worldDataServer.getDifficulty() == enumdifficulty) { // Paper + throw CommandDifficulty.a.create(enumdifficulty.c()); + } else { +- minecraftserver.a(enumdifficulty, true); ++ minecraftserver.a(world, enumdifficulty, true); // Paper + commandlistenerwrapper.sendMessage(new ChatMessage("commands.difficulty.success", new Object[]{enumdifficulty.b()}), true); + return 0; + } +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + + @Override + public void updateWorldSettings() { +- this.a(this.getDedicatedServerProperties().difficulty, true); ++ //this.a(this.getDedicatedServerProperties().difficulty, true); // Paper - Don't overwrite level.dat's difficulty, keep current + } + + @Override +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { public void a(PacketPlayInDifficultyChange packetplayindifficultychange) { PlayerConnectionUtils.ensureMainThread(packetplayindifficultychange, this, this.player.getWorldServer()); diff --git a/Spigot-Server-Patches/Fix-SPIGOT-5989.patch b/Spigot-Server-Patches/Fix-SPIGOT-5989.patch index 77a0aa5607..94c1e96a76 100644 --- a/Spigot-Server-Patches/Fix-SPIGOT-5989.patch +++ b/Spigot-Server-Patches/Fix-SPIGOT-5989.patch @@ -9,10 +9,10 @@ PlayerRespawnEvent, the anchor would still lose some charge. This fixes that by checking if the modified spawn location is still at a respawn anchor. -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { // Paper start boolean isBedSpawn = false; diff --git a/Spigot-Server-Patches/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/Spigot-Server-Patches/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch index 4b9b1d611e..0b95d61e3a 100644 --- a/Spigot-Server-Patches/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch +++ b/Spigot-Server-Patches/Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -4,10 +4,10 @@ Date: Sat, 22 Aug 2020 23:36:21 +0200 Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { } // Paper end diff --git a/Spigot-Server-Patches/Fix-SpongeAbsortEvent-handling.patch b/Spigot-Server-Patches/Fix-SpongeAbsortEvent-handling.patch index 3acd4206e2..704352fb3e 100644 --- a/Spigot-Server-Patches/Fix-SpongeAbsortEvent-handling.patch +++ b/Spigot-Server-Patches/Fix-SpongeAbsortEvent-handling.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix SpongeAbsortEvent handling Only process drops when the block is actually going to be removed -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Block.java -+++ b/src/main/java/net/minecraft/server/Block.java +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java @@ -0,0 +0,0 @@ public class Block extends BlockBase implements IMaterial { } @@ -17,10 +17,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static void a(IBlockData iblockdata, GeneratorAccess generatoraccess, BlockPosition blockposition, @Nullable TileEntity tileentity) { if (generatoraccess instanceof WorldServer) { a(iblockdata, (WorldServer) generatoraccess, blockposition, tileentity).forEach((itemstack) -> { -diff --git a/src/main/java/net/minecraft/server/BlockSponge.java b/src/main/java/net/minecraft/server/BlockSponge.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockSponge.java b/src/main/java/net/minecraft/world/level/block/BlockSponge.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockSponge.java -+++ b/src/main/java/net/minecraft/server/BlockSponge.java +--- a/src/main/java/net/minecraft/world/level/block/BlockSponge.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockSponge.java @@ -0,0 +0,0 @@ public class BlockSponge extends Block { // NOP } else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) { diff --git a/Spigot-Server-Patches/Fix-World-isChunkGenerated-calls.patch b/Spigot-Server-Patches/Fix-World-isChunkGenerated-calls.patch index ff5698a9c5..e713905896 100644 --- a/Spigot-Server-Patches/Fix-World-isChunkGenerated-calls.patch +++ b/Spigot-Server-Patches/Fix-World-isChunkGenerated-calls.patch @@ -7,10 +7,10 @@ Optimize World#loadChunk() too This patch also adds a chunk status cache on region files (note that its only purpose is to cache the status on DISK) -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { private final WorldServer world; public final Thread serverThread; // Paper - private -> public @@ -42,75 +42,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end @Nullable -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - } - // Paper end - -+ // Paper start -+ public static ChunkStatus getStatus(NBTTagCompound compound) { -+ if (compound == null) { -+ return null; -+ } -+ -+ // Note: Copied from below -+ return ChunkStatus.getStatus(compound.getCompound("Level").getString("Status")); -+ } -+ // Paper end -+ - public static ChunkStatus.Type a(@Nullable NBTTagCompound nbttagcompound) { - if (nbttagcompound != null) { - ChunkStatus chunkstatus = ChunkStatus.a(nbttagcompound.getCompound("Level").getString("Status")); -diff --git a/src/main/java/net/minecraft/server/ChunkStatus.java b/src/main/java/net/minecraft/server/ChunkStatus.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkStatus.java -+++ b/src/main/java/net/minecraft/server/ChunkStatus.java -@@ -0,0 +0,0 @@ public class ChunkStatus { - return this.s; - } - -+ public ChunkStatus getPreviousStatus() { return this.e(); } // Paper - OBFHELPER - public ChunkStatus e() { - return this.u; - } -@@ -0,0 +0,0 @@ public class ChunkStatus { - return this.y; - } - -+ // Paper start -+ public static ChunkStatus getStatus(String name) { -+ try { -+ // We need this otherwise we return EMPTY for invalid names -+ MinecraftKey key = new MinecraftKey(name); -+ return IRegistry.CHUNK_STATUS.getOptional(key).orElse(null); -+ } catch (Exception ex) { -+ return null; // invalid name -+ } -+ } -+ // Paper end - public static ChunkStatus a(String s) { - return (ChunkStatus) IRegistry.CHUNK_STATUS.get(MinecraftKey.a(s)); - } -diff --git a/src/main/java/net/minecraft/server/IChunkLoader.java b/src/main/java/net/minecraft/server/IChunkLoader.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IChunkLoader.java -+++ b/src/main/java/net/minecraft/server/IChunkLoader.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; - - public class IChunkLoader implements AutoCloseable { - -- private final IOWorker a; -+ private final IOWorker a; public IOWorker getIOWorker() { return a; } // Paper - OBFHELPER - protected final DataFixer b; - @Nullable - private PersistentStructureLegacy c; -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { Either<IChunkAccess, PlayerChunk.Failure> either = (Either<IChunkAccess, PlayerChunk.Failure>) statusFuture.getNow(null); return either == null ? null : (Chunk) either.left().orElse(null); @@ -131,10 +66,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> getStatusFutureUnchecked(ChunkStatus chunkstatus) { -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } @@ -199,10 +134,75 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) { // Spigot start return isOutsideOfRange(chunkcoordintpair, false); -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java +@@ -0,0 +0,0 @@ public class ChunkStatus { + return this.s; + } + ++ public ChunkStatus getPreviousStatus() { return this.e(); } // Paper - OBFHELPER + public ChunkStatus e() { + return this.u; + } +@@ -0,0 +0,0 @@ public class ChunkStatus { + return this.y; + } + ++ // Paper start ++ public static ChunkStatus getStatus(String name) { ++ try { ++ // We need this otherwise we return EMPTY for invalid names ++ MinecraftKey key = new MinecraftKey(name); ++ return IRegistry.CHUNK_STATUS.getOptional(key).orElse(null); ++ } catch (Exception ex) { ++ return null; // invalid name ++ } ++ } ++ // Paper end + public static ChunkStatus a(String s) { + return (ChunkStatus) IRegistry.CHUNK_STATUS.get(MinecraftKey.a(s)); + } +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +@@ -0,0 +0,0 @@ public class ChunkRegionLoader { + } + // Paper end + ++ // Paper start ++ public static ChunkStatus getStatus(NBTTagCompound compound) { ++ if (compound == null) { ++ return null; ++ } ++ ++ // Note: Copied from below ++ return ChunkStatus.getStatus(compound.getCompound("Level").getString("Status")); ++ } ++ // Paper end ++ + public static ChunkStatus.Type a(@Nullable NBTTagCompound nbttagcompound) { + if (nbttagcompound != null) { + ChunkStatus chunkstatus = ChunkStatus.a(nbttagcompound.getCompound("Level").getString("Status")); +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.dimension.DimensionManager; + + public class IChunkLoader implements AutoCloseable { + +- private final IOWorker a; ++ private final IOWorker a; public IOWorker getIOWorker() { return a; } // Paper - OBFHELPER + protected final DataFixer b; + @Nullable + private PersistentStructureLegacy c; +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java @@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { protected final RegionFileBitSet freeSectors; public final File file; // Paper @@ -248,10 +248,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 try { this.d(); } finally { -diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegionFileCache.java -+++ b/src/main/java/net/minecraft/server/RegionFileCache.java +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java @@ -0,0 +0,0 @@ public final class RegionFileCache implements AutoCloseable { this.c = flag; } @@ -287,7 +287,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import java.util.concurrent.CompletableFuture; import java.util.function.Predicate; import java.util.stream.Collectors; - import net.minecraft.server.ArraySetSorted; + import net.minecraft.core.BlockPosition; @@ -0,0 +0,0 @@ public class CraftWorld implements World { @Override @@ -326,24 +326,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - chunk = world.getChunkProvider().getChunkAt(x, z, ChunkStatus.FULL, true); - } + if (!generate) { - -- if (chunk instanceof net.minecraft.server.Chunk) { -- world.getChunkProvider().addTicket(TicketType.PLUGIN, new ChunkCoordIntPair(x, z), 1, Unit.INSTANCE); -- return true; + IChunkAccess immediate = world.getChunkProvider().getChunkAtImmediately(x, z); + if (immediate == null) { + immediate = world.getChunkProvider().playerChunkMap.getUnloadingChunk(x, z); + } + if (immediate != null) { -+ if (!(immediate instanceof ProtoChunkExtension) && !(immediate instanceof net.minecraft.server.Chunk)) { ++ if (!(immediate instanceof ProtoChunkExtension) && !(immediate instanceof net.minecraft.world.level.chunk.Chunk)) { + return false; // not full status + } + world.getChunkProvider().addTicket(TicketType.PLUGIN, chunkPos, 1, Unit.INSTANCE); + world.getChunkAt(x, z); // make sure we're at ticket level 32 or lower + return true; + } -+ -+ net.minecraft.server.RegionFile file; + +- if (chunk instanceof net.minecraft.world.level.chunk.Chunk) { +- world.getChunkProvider().addTicket(TicketType.PLUGIN, new ChunkCoordIntPair(x, z), 1, Unit.INSTANCE); +- return true; ++ net.minecraft.world.level.chunk.storage.RegionFile file; + try { + file = world.getChunkProvider().playerChunkMap.getIOWorker().getRegionFileCache().getFile(chunkPos, false); + } catch (IOException ex) { @@ -356,7 +355,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + + IChunkAccess chunk = world.getChunkProvider().getChunkAt(x, z, ChunkStatus.EMPTY, true); -+ if (!(chunk instanceof ProtoChunkExtension) && !(chunk instanceof net.minecraft.server.Chunk)) { ++ if (!(chunk instanceof ProtoChunkExtension) && !(chunk instanceof net.minecraft.world.level.chunk.Chunk)) { + return false; + } + diff --git a/Spigot-Server-Patches/Fix-arrows-never-despawning-MC-125757.patch b/Spigot-Server-Patches/Fix-arrows-never-despawning-MC-125757.patch index 7e3ee14ef3..2e4681ab18 100644 --- a/Spigot-Server-Patches/Fix-arrows-never-despawning-MC-125757.patch +++ b/Spigot-Server-Patches/Fix-arrows-never-despawning-MC-125757.patch @@ -8,10 +8,10 @@ state after the arrow has been alive for 200 ticks (10 seconds) instead of getting stuck in a never despawn state (bubble columns, etc). -diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityArrow.java -+++ b/src/main/java/net/minecraft/server/EntityArrow.java +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java @@ -0,0 +0,0 @@ public abstract class EntityArrow extends IProjectile { ++this.c; 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 0df1a6363c..1a263a5ad3 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 @@ -11,23 +11,10 @@ the texture payload, or random. 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 +diff --git a/src/main/java/net/minecraft/network/PacketDataSerializer.java b/src/main/java/net/minecraft/network/PacketDataSerializer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - private int g; - @Deprecated - private Item item; -- private NBTTagCompound tag; -+ NBTTagCompound tag; // Paper -> package private - private boolean j; - private Entity k; - private ShapeDetectorBlock l; -diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketDataSerializer.java -+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java +--- a/src/main/java/net/minecraft/network/PacketDataSerializer.java ++++ b/src/main/java/net/minecraft/network/PacketDataSerializer.java @@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { if (item.usesDurability() || item.n()) { // Spigot start - filter @@ -66,10 +53,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // CraftBukkit end return itemstack; -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { if (this.f() || (i & 1 << j) != 0) { @@ -78,10 +65,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.g.add(nbttagcompound); } -diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntitySkull.java -+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -0,0 +0,0 @@ public final class ItemStack { + private int g; + @Deprecated + private Item item; +- private NBTTagCompound tag; ++ NBTTagCompound tag; // Paper -> package private + private boolean j; + private Entity k; + private ShapeDetectorBlock l; +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java @@ -0,0 +0,0 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa @Nullable @Override diff --git a/Spigot-Server-Patches/Fix-console-spam-when-removing-chests-in-water.patch b/Spigot-Server-Patches/Fix-console-spam-when-removing-chests-in-water.patch index 8fa44d663b..1753ff91a2 100644 --- a/Spigot-Server-Patches/Fix-console-spam-when-removing-chests-in-water.patch +++ b/Spigot-Server-Patches/Fix-console-spam-when-removing-chests-in-water.patch @@ -4,10 +4,10 @@ Date: Thu, 19 Nov 2020 02:07:10 +0000 Subject: [PATCH] Fix console spam when removing chests in water -diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockChest.java b/src/main/java/net/minecraft/world/level/block/BlockChest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockChest.java -+++ b/src/main/java/net/minecraft/server/BlockChest.java +--- a/src/main/java/net/minecraft/world/level/block/BlockChest.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockChest.java @@ -0,0 +0,0 @@ public class BlockChest extends BlockChestAbstract<TileEntityChest> implements I @Override public void remove(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) { diff --git a/Spigot-Server-Patches/Fix-curing-villager-makes-equipment-disappear.patch b/Spigot-Server-Patches/Fix-curing-villager-makes-equipment-disappear.patch index 0b27f1144f..f98af9a805 100644 --- a/Spigot-Server-Patches/Fix-curing-villager-makes-equipment-disappear.patch +++ b/Spigot-Server-Patches/Fix-curing-villager-makes-equipment-disappear.patch @@ -8,10 +8,10 @@ equipment (weapons/armor) causes the items to disappear instead of drop to the ground by forcing the items to drop instead of going to the drops field for the EntityDeathEvent which does not fire for entity conversions. -diff --git a/src/main/java/net/minecraft/server/EntityZombieVillager.java b/src/main/java/net/minecraft/server/EntityZombieVillager.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombieVillager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityZombieVillager.java -+++ b/src/main/java/net/minecraft/server/EntityZombieVillager.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombieVillager.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombieVillager.java @@ -0,0 +0,0 @@ public class EntityZombieVillager extends EntityZombie implements VillagerDataHo double d0 = (double) this.e(enumitemslot); diff --git a/Spigot-Server-Patches/Fix-curing-zombie-villager-discount-exploit.patch b/Spigot-Server-Patches/Fix-curing-zombie-villager-discount-exploit.patch index 1cba0097b8..47f59b8240 100644 --- a/Spigot-Server-Patches/Fix-curing-zombie-villager-discount-exploit.patch +++ b/Spigot-Server-Patches/Fix-curing-zombie-villager-discount-exploit.patch @@ -21,10 +21,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + fixCuringZombieVillagerDiscountExploit = getBoolean("game-mechanics.fix-curing-zombie-villager-discount-exploit", fixCuringZombieVillagerDiscountExploit); + } } -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java b/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVillager.java -+++ b/src/main/java/net/minecraft/server/EntityVillager.java +--- a/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java ++++ b/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java +@@ -0,0 +0,0 @@ public class Reputation { + + } + ++ public final void removeReputationForType(ReputationType reputationType) { this.b(reputationType); } // Paper - OBFHELPER + public void b(ReputationType reputationtype) { + this.a.removeInt(reputationtype); + } +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java @@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @Override public void a(ReputationEvent reputationevent, Entity entity) { @@ -41,15 +53,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.by.a(entity.getUniqueID(), ReputationType.MAJOR_POSITIVE, 20); this.by.a(entity.getUniqueID(), ReputationType.MINOR_POSITIVE, 25); } else if (reputationevent == ReputationEvent.e) { -diff --git a/src/main/java/net/minecraft/server/Reputation.java b/src/main/java/net/minecraft/server/Reputation.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Reputation.java -+++ b/src/main/java/net/minecraft/server/Reputation.java -@@ -0,0 +0,0 @@ public class Reputation { - - } - -+ public final void removeReputationForType(ReputationType reputationType) { this.b(reputationType); } // Paper - OBFHELPER - public void b(ReputationType reputationtype) { - this.a.removeInt(reputationtype); - } diff --git a/Spigot-Server-Patches/Fix-enderdragon-exp-dupe.patch b/Spigot-Server-Patches/Fix-enderdragon-exp-dupe.patch index 5a9ebdb591..9ce9e2dd24 100644 --- a/Spigot-Server-Patches/Fix-enderdragon-exp-dupe.patch +++ b/Spigot-Server-Patches/Fix-enderdragon-exp-dupe.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix enderdragon exp dupe Properly track death stage when unloading/loading in the dragon -diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderDragon.java -+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java @@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { public void saveData(NBTTagCompound nbttagcompound) { super.saveData(nbttagcompound); diff --git a/Spigot-Server-Patches/Fix-exploit-that-allowed-colored-signs-to-be-created.patch b/Spigot-Server-Patches/Fix-exploit-that-allowed-colored-signs-to-be-created.patch index a747273222..fbf83424f5 100644 --- a/Spigot-Server-Patches/Fix-exploit-that-allowed-colored-signs-to-be-created.patch +++ b/Spigot-Server-Patches/Fix-exploit-that-allowed-colored-signs-to-be-created.patch @@ -4,10 +4,22 @@ Date: Thu, 26 Apr 2018 04:41:11 -0400 Subject: [PATCH] Fix exploit that allowed colored signs to be created -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/SharedConstants.java b/src/main/java/net/minecraft/SharedConstants.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/SharedConstants.java ++++ b/src/main/java/net/minecraft/SharedConstants.java +@@ -0,0 +0,0 @@ public class SharedConstants { + return c0 != 167 && c0 >= ' ' && c0 != 127; + } + ++ public static String filterAllowedChatCharacters(String input) { return a(input); } // Paper - OBFHELPER + public static String a(String s) { + StringBuilder stringbuilder = new StringBuilder(); + char[] achar = s.toCharArray(); +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { List<net.kyori.adventure.text.Component> lines = new java.util.ArrayList<>(); @@ -17,15 +29,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } SignChangeEvent event = new SignChangeEvent(org.bukkit.craftbukkit.block.CraftBlock.at(worldserver, blockposition), this.getPlayer(), lines); this.server.getPluginManager().callEvent(event); -diff --git a/src/main/java/net/minecraft/server/SharedConstants.java b/src/main/java/net/minecraft/server/SharedConstants.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SharedConstants.java -+++ b/src/main/java/net/minecraft/server/SharedConstants.java -@@ -0,0 +0,0 @@ public class SharedConstants { - return c0 != 167 && c0 >= ' ' && c0 != 127; - } - -+ public static String filterAllowedChatCharacters(String input) { return a(input); } // Paper - OBFHELPER - public static String a(String s) { - StringBuilder stringbuilder = new StringBuilder(); - char[] achar = s.toCharArray(); diff --git a/Spigot-Server-Patches/Fix-for-large-move-vectors-crashing-server.patch b/Spigot-Server-Patches/Fix-for-large-move-vectors-crashing-server.patch index d2ac10a8b2..42c87fec18 100644 --- a/Spigot-Server-Patches/Fix-for-large-move-vectors-crashing-server.patch +++ b/Spigot-Server-Patches/Fix-for-large-move-vectors-crashing-server.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix for large move vectors crashing server Check movement distance also based on current position. -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { if (entity != this.player && entity.getRidingPassenger() == this.player && entity == this.r) { diff --git a/Spigot-Server-Patches/Fix-harming-potion-dupe.patch b/Spigot-Server-Patches/Fix-harming-potion-dupe.patch index 025f51a04d..53e71b0b87 100644 --- a/Spigot-Server-Patches/Fix-harming-potion-dupe.patch +++ b/Spigot-Server-Patches/Fix-harming-potion-dupe.patch @@ -7,10 +7,10 @@ EntityLiving#applyInstantEffect() immediately kills the player and drops their i Before this patch, instant effects would be applied before the potion ItemStack is removed and replaced with a glass bottle. This caused the potion ItemStack to be dropped before it was supposed to be removed from the inventory. It also caused the glass bottle to be put into a dead player's inventory. This patch makes it so that instant effects are applied after the potion ItemStack is removed, and the glass bottle is only put into the player's inventory if the player is not dead. Otherwise, the glass bottle is dropped on the ground. -diff --git a/src/main/java/net/minecraft/server/ItemPotion.java b/src/main/java/net/minecraft/server/ItemPotion.java +diff --git a/src/main/java/net/minecraft/world/item/ItemPotion.java b/src/main/java/net/minecraft/world/item/ItemPotion.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemPotion.java -+++ b/src/main/java/net/minecraft/server/ItemPotion.java +--- a/src/main/java/net/minecraft/world/item/ItemPotion.java ++++ b/src/main/java/net/minecraft/world/item/ItemPotion.java @@ -0,0 +0,0 @@ public class ItemPotion extends Item { CriterionTriggers.z.a((EntityPlayer) entityhuman, itemstack); } diff --git a/Spigot-Server-Patches/Fix-hex-colors-not-working-in-some-kick-messages.patch b/Spigot-Server-Patches/Fix-hex-colors-not-working-in-some-kick-messages.patch index 5e49154170..a79f3ccd91 100644 --- a/Spigot-Server-Patches/Fix-hex-colors-not-working-in-some-kick-messages.patch +++ b/Spigot-Server-Patches/Fix-hex-colors-not-working-in-some-kick-messages.patch @@ -4,10 +4,10 @@ Date: Thu, 27 Aug 2020 16:57:25 -0400 Subject: [PATCH] Fix hex colors not working in some kick messages -diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java +diff --git a/src/main/java/net/minecraft/server/network/HandshakeListener.java b/src/main/java/net/minecraft/server/network/HandshakeListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/HandshakeListener.java -+++ b/src/main/java/net/minecraft/server/HandshakeListener.java +--- a/src/main/java/net/minecraft/server/network/HandshakeListener.java ++++ b/src/main/java/net/minecraft/server/network/HandshakeListener.java @@ -0,0 +0,0 @@ public class HandshakeListener implements PacketHandshakingInListener { synchronized (throttleTracker) { if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) { @@ -42,10 +42,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.getNetworkManager().sendPacket(new PacketLoginOutDisconnect(chatmessage)); this.getNetworkManager().close(chatmessage); return; -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { // CraftBukkit start @Deprecated diff --git a/Spigot-Server-Patches/Fix-interact-event-not-being-called-in-adventure.patch b/Spigot-Server-Patches/Fix-interact-event-not-being-called-in-adventure.patch index 572aa1cbf1..206b781c2b 100644 --- a/Spigot-Server-Patches/Fix-interact-event-not-being-called-in-adventure.patch +++ b/Spigot-Server-Patches/Fix-interact-event-not-being-called-in-adventure.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix interact event not being called in adventure Call PlayerInteractEvent when left-clicking on a block in adventure mode -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { IChatMutableComponent ichatmutablecomponent = (new ChatMessage("build.tooHigh", new Object[]{this.minecraftServer.getMaxBuildHeight()})).a(EnumChatFormat.RED); diff --git a/Spigot-Server-Patches/Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch b/Spigot-Server-Patches/Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch index c5c254897a..600115f34a 100644 --- a/Spigot-Server-Patches/Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch +++ b/Spigot-Server-Patches/Fix-issues-with-entity-loss-due-to-unloaded-chunks.patch @@ -18,10 +18,10 @@ for these reasons, nor is it really logical. This change ensures the chunks are always loaded when entities are added to the world, or a valid entity moves between chunks. -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { int k = MathHelper.floor(entity.locZ() / 16.0D); diff --git a/Spigot-Server-Patches/Fix-item-locations-dropped-from-campfires.patch b/Spigot-Server-Patches/Fix-item-locations-dropped-from-campfires.patch index 605d42a3ff..8cd8c34e2e 100644 --- a/Spigot-Server-Patches/Fix-item-locations-dropped-from-campfires.patch +++ b/Spigot-Server-Patches/Fix-item-locations-dropped-from-campfires.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix item locations dropped from campfires Fixes #4259 by not flooring the blockposition among other weirdness -diff --git a/src/main/java/net/minecraft/server/TileEntityCampfire.java b/src/main/java/net/minecraft/server/TileEntityCampfire.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityCampfire.java -+++ b/src/main/java/net/minecraft/server/TileEntityCampfire.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java @@ -0,0 +0,0 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickab result = blockCookEvent.getResult(); itemstack1 = CraftItemStack.asNMSCopy(result); diff --git a/Spigot-Server-Patches/Fix-items-not-falling-correctly.patch b/Spigot-Server-Patches/Fix-items-not-falling-correctly.patch index ffe447b03f..69bff970cc 100644 --- a/Spigot-Server-Patches/Fix-items-not-falling-correctly.patch +++ b/Spigot-Server-Patches/Fix-items-not-falling-correctly.patch @@ -14,10 +14,10 @@ due to its move method never being called. This patch resolves the conflict by offsetting checking an item's move method from Spigot's entity activation range check. -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java +--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java @@ -0,0 +0,0 @@ public class EntityItem extends Entity { } } diff --git a/Spigot-Server-Patches/Fix-items-vanishing-through-end-portal.patch b/Spigot-Server-Patches/Fix-items-vanishing-through-end-portal.patch index b7d864913e..0ed2564cc5 100644 --- a/Spigot-Server-Patches/Fix-items-vanishing-through-end-portal.patch +++ b/Spigot-Server-Patches/Fix-items-vanishing-through-end-portal.patch @@ -12,11 +12,11 @@ only searching the heightmap if the chunk is loaded. Quickly loading the exact world spawn chunk before searching the heightmap resolves the issue without having to load all spawn chunks. -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne BlockPosition blockposition1; if (flag1) { diff --git a/Spigot-Server-Patches/Fix-lag-from-explosions-processing-dead-entities.patch b/Spigot-Server-Patches/Fix-lag-from-explosions-processing-dead-entities.patch index 83aabc2a03..fc9fdbf52a 100644 --- a/Spigot-Server-Patches/Fix-lag-from-explosions-processing-dead-entities.patch +++ b/Spigot-Server-Patches/Fix-lag-from-explosions-processing-dead-entities.patch @@ -4,10 +4,10 @@ Date: Wed, 2 Mar 2016 01:39:52 -0600 Subject: [PATCH] Fix lag from explosions processing dead entities -diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java +diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Explosion.java -+++ b/src/main/java/net/minecraft/server/Explosion.java +--- a/src/main/java/net/minecraft/world/level/Explosion.java ++++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -0,0 +0,0 @@ public class Explosion { int i1 = MathHelper.floor(this.posY + (double) f2 + 1.0D); int j1 = MathHelper.floor(this.posZ - (double) f2 - 1.0D); diff --git a/Spigot-Server-Patches/Fix-last-firework-in-stack-not-having-effects-when-d.patch b/Spigot-Server-Patches/Fix-last-firework-in-stack-not-having-effects-when-d.patch index 43ba0c661f..d82c491966 100644 --- a/Spigot-Server-Patches/Fix-last-firework-in-stack-not-having-effects-when-d.patch +++ b/Spigot-Server-Patches/Fix-last-firework-in-stack-not-having-effects-when-d.patch @@ -8,10 +8,10 @@ CB used the resulting item in the dispenser rather than the item dispensed. The resulting item would have size == 0 and therefore be convertered to air, hence why the effects disappeared. -diff --git a/src/main/java/net/minecraft/server/IDispenseBehavior.java b/src/main/java/net/minecraft/server/IDispenseBehavior.java +diff --git a/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IDispenseBehavior.java -+++ b/src/main/java/net/minecraft/server/IDispenseBehavior.java +--- a/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java ++++ b/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java @@ -0,0 +0,0 @@ public interface IDispenseBehavior { } diff --git a/Spigot-Server-Patches/Fix-missing-chunks-due-to-integer-overflow.patch b/Spigot-Server-Patches/Fix-missing-chunks-due-to-integer-overflow.patch index d4ccb46591..a02a965a2c 100644 --- a/Spigot-Server-Patches/Fix-missing-chunks-due-to-integer-overflow.patch +++ b/Spigot-Server-Patches/Fix-missing-chunks-due-to-integer-overflow.patch @@ -12,10 +12,10 @@ is a few hundred thousand block gap before end land resuming to generate at The fix for the issue is quite simple, casting chunk coordinates to longs allows the distance calculation to avoid overflow and work as intended. -diff --git a/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java b/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java +diff --git a/src/main/java/net/minecraft/world/level/biome/WorldChunkManagerTheEnd.java b/src/main/java/net/minecraft/world/level/biome/WorldChunkManagerTheEnd.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java -+++ b/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java +--- a/src/main/java/net/minecraft/world/level/biome/WorldChunkManagerTheEnd.java ++++ b/src/main/java/net/minecraft/world/level/biome/WorldChunkManagerTheEnd.java @@ -0,0 +0,0 @@ public class WorldChunkManagerTheEnd extends WorldChunkManager { int l = j / 2; int i1 = i % 2; diff --git a/Spigot-Server-Patches/Fix-nerfed-slime-when-splitting.patch b/Spigot-Server-Patches/Fix-nerfed-slime-when-splitting.patch index e836e7c144..807a2ce72c 100644 --- a/Spigot-Server-Patches/Fix-nerfed-slime-when-splitting.patch +++ b/Spigot-Server-Patches/Fix-nerfed-slime-when-splitting.patch @@ -4,10 +4,10 @@ Date: Mon, 24 Aug 2020 08:39:06 -0700 Subject: [PATCH] Fix nerfed slime when splitting -diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java b/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntitySlime.java -+++ b/src/main/java/net/minecraft/server/EntitySlime.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java @@ -0,0 +0,0 @@ public class EntitySlime extends EntityInsentient implements IMonster { entityslime.setPersistent(); } diff --git a/Spigot-Server-Patches/Fix-numerous-item-duplication-issues-and-teleport-is.patch b/Spigot-Server-Patches/Fix-numerous-item-duplication-issues-and-teleport-is.patch index 15bef9aadf..86cbe8626a 100644 --- a/Spigot-Server-Patches/Fix-numerous-item-duplication-issues-and-teleport-is.patch +++ b/Spigot-Server-Patches/Fix-numerous-item-duplication-issues-and-teleport-is.patch @@ -15,11 +15,11 @@ clean up stage. So even if something NEW comes up, it would be impossible to drop the same item twice because the source was destroyed. -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } else { // CraftBukkit start - Capture drops for death event if (this instanceof EntityLiving && !((EntityLiving) this).forceDrops) { @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entityitem.defaultPickupDelay(); // CraftBukkit start -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne @Nullable public Entity teleportTo(WorldServer worldserver, BlockPosition location) { // CraftBukkit end @@ -47,7 +47,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.world instanceof WorldServer && !this.dead) { this.world.getMethodProfiler().enter("changeDimension"); // CraftBukkit start -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne // CraftBukkit end this.world.getMethodProfiler().exitEnter("reloading"); @@ -59,7 +59,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Entity entity = this.getEntityType().a((World) worldserver); if (entity != null) { -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne // CraftBukkit start - Forward the CraftEntity to the new entity this.getBukkitEntity().setHandle(entity); entity.bukkitEntity = this.getBukkitEntity(); @@ -70,7 +70,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end } -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public boolean canPortal() { @@ -79,10 +79,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public float a(Explosion explosion, IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata, Fluid fluid, float f) { -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { for (i = 0; i < this.handItems.size(); ++i) { itemstack = (ItemStack) this.handItems.get(i); diff --git a/Spigot-Server-Patches/Fix-piston-physics-inconsistency-MC-188840.patch b/Spigot-Server-Patches/Fix-piston-physics-inconsistency-MC-188840.patch index 01afaaa425..6ced3c8536 100644 --- a/Spigot-Server-Patches/Fix-piston-physics-inconsistency-MC-188840.patch +++ b/Spigot-Server-Patches/Fix-piston-physics-inconsistency-MC-188840.patch @@ -46,10 +46,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + set("settings.unsupported-settings.allow-tnt-duplication", null); + } } -diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java +diff --git a/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java b/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockPiston.java -+++ b/src/main/java/net/minecraft/server/BlockPiston.java +--- a/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java ++++ b/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java @@ -0,0 +0,0 @@ public class BlockPiston extends BlockDirectional { } @@ -78,10 +78,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 aiblockdata[j++] = iblockdata1; } -diff --git a/src/main/java/net/minecraft/server/TileEntityPiston.java b/src/main/java/net/minecraft/server/TileEntityPiston.java +diff --git a/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java b/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityPiston.java -+++ b/src/main/java/net/minecraft/server/TileEntityPiston.java +--- a/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java ++++ b/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java @@ -0,0 +0,0 @@ public class TileEntityPiston extends TileEntity implements ITickable { IBlockData iblockdata = Block.b(this.a, (GeneratorAccess) this.world, this.position); diff --git a/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch b/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch index 4eec2445e9..d2ffbe614b 100644 --- a/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch +++ b/Spigot-Server-Patches/Fix-reducedDebugInfo-not-initialized-on-client.patch @@ -4,10 +4,10 @@ Date: Sat, 2 Apr 2016 20:37:03 -0400 Subject: [PATCH] Fix reducedDebugInfo not initialized on client -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { playerconnection.sendPacket(new PacketPlayOutHeldItemSlot(entityplayer.inventory.itemInHandIndex)); playerconnection.sendPacket(new PacketPlayOutRecipeUpdate(this.server.getCraftingManager().b())); diff --git a/Spigot-Server-Patches/Fix-regex-mistake-in-CB-NBT-int-deserialization.patch b/Spigot-Server-Patches/Fix-regex-mistake-in-CB-NBT-int-deserialization.patch index 7eaec93454..2a81479287 100644 --- a/Spigot-Server-Patches/Fix-regex-mistake-in-CB-NBT-int-deserialization.patch +++ b/Spigot-Server-Patches/Fix-regex-mistake-in-CB-NBT-int-deserialization.patch @@ -16,7 +16,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftNBTTagConfigSerializer.java -@@ -0,0 +0,0 @@ import net.minecraft.server.NBTTagString; +@@ -0,0 +0,0 @@ import net.minecraft.nbt.NBTTagString; public class CraftNBTTagConfigSerializer { private static final Pattern ARRAY = Pattern.compile("^\\[.*]"); diff --git a/Spigot-Server-Patches/Fix-sand-duping.patch b/Spigot-Server-Patches/Fix-sand-duping.patch index 266c9b02c2..ee660b7d9e 100644 --- a/Spigot-Server-Patches/Fix-sand-duping.patch +++ b/Spigot-Server-Patches/Fix-sand-duping.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix sand duping If the falling block dies during teleportation (entity#move), then we need to detect that by placing a check after the move. -diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java +--- a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java @@ -0,0 +0,0 @@ public class EntityFallingBlock extends Entity { @Override diff --git a/Spigot-Server-Patches/Fix-sign-edit-memory-leak.patch b/Spigot-Server-Patches/Fix-sign-edit-memory-leak.patch index 08c03092c3..49c7b72ab3 100644 --- a/Spigot-Server-Patches/Fix-sign-edit-memory-leak.patch +++ b/Spigot-Server-Patches/Fix-sign-edit-memory-leak.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix sign edit memory leak when a player edits a sign, a reference to their Entity is never cleand up. -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { TileEntitySign tileentitysign = (TileEntitySign) tileentity; @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getDisplayName().getString()); this.sendPacket(tileentity.getUpdatePacket()); // CraftBukkit return; -diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntitySign.java -+++ b/src/main/java/net/minecraft/server/TileEntitySign.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java @@ -0,0 +0,0 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // private EntityHuman c; private final FormattedString[] g; diff --git a/Spigot-Server-Patches/Fix-some-rails-connecting-improperly.patch b/Spigot-Server-Patches/Fix-some-rails-connecting-improperly.patch index 31d82e2b18..b9515aae81 100644 --- a/Spigot-Server-Patches/Fix-some-rails-connecting-improperly.patch +++ b/Spigot-Server-Patches/Fix-some-rails-connecting-improperly.patch @@ -4,10 +4,10 @@ Date: Fri, 24 Jul 2020 15:56:05 -0700 Subject: [PATCH] Fix some rails connecting improperly -diff --git a/src/main/java/net/minecraft/server/BlockMinecartDetector.java b/src/main/java/net/minecraft/server/BlockMinecartDetector.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockMinecartDetector.java b/src/main/java/net/minecraft/world/level/block/BlockMinecartDetector.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockMinecartDetector.java -+++ b/src/main/java/net/minecraft/server/BlockMinecartDetector.java +--- a/src/main/java/net/minecraft/world/level/block/BlockMinecartDetector.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockMinecartDetector.java @@ -0,0 +0,0 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract { private void a(World world, BlockPosition blockposition, IBlockData iblockdata) { @@ -16,10 +16,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 boolean flag = (Boolean) iblockdata.get(BlockMinecartDetector.POWERED); boolean flag1 = false; List<EntityMinecartAbstract> list = this.a(world, blockposition, EntityMinecartAbstract.class, (Predicate) null); -diff --git a/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockMinecartTrackAbstract.java b/src/main/java/net/minecraft/world/level/block/BlockMinecartTrackAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java -+++ b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java +--- a/src/main/java/net/minecraft/world/level/block/BlockMinecartTrackAbstract.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockMinecartTrackAbstract.java @@ -0,0 +0,0 @@ public abstract class BlockMinecartTrackAbstract extends Block { iblockdata = this.a(world, blockposition, iblockdata, true); if (this.c) { @@ -28,11 +28,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } return iblockdata; -diff --git a/src/main/java/net/minecraft/server/MinecartTrackLogic.java b/src/main/java/net/minecraft/server/MinecartTrackLogic.java +diff --git a/src/main/java/net/minecraft/world/level/block/MinecartTrackLogic.java b/src/main/java/net/minecraft/world/level/block/MinecartTrackLogic.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MinecartTrackLogic.java -+++ b/src/main/java/net/minecraft/server/MinecartTrackLogic.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/level/block/MinecartTrackLogic.java ++++ b/src/main/java/net/minecraft/world/level/block/MinecartTrackLogic.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.state.properties.BlockPropertyTrackPositi public class MinecartTrackLogic { diff --git a/Spigot-Server-Patches/Fix-sounds-when-item-frames-are-modified-MC-123450.patch b/Spigot-Server-Patches/Fix-sounds-when-item-frames-are-modified-MC-123450.patch index ea9539b774..699eecaed7 100644 --- a/Spigot-Server-Patches/Fix-sounds-when-item-frames-are-modified-MC-123450.patch +++ b/Spigot-Server-Patches/Fix-sounds-when-item-frames-are-modified-MC-123450.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix sounds when item frames are modified (MC-123450) This also fixes the adding sound playing when the item frame direction is changed. -diff --git a/src/main/java/net/minecraft/server/EntityItemFrame.java b/src/main/java/net/minecraft/server/EntityItemFrame.java +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/EntityItemFrame.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityItemFrame.java -+++ b/src/main/java/net/minecraft/server/EntityItemFrame.java +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityItemFrame.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityItemFrame.java @@ -0,0 +0,0 @@ public class EntityItemFrame extends EntityHanging { } diff --git a/Spigot-Server-Patches/Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch b/Spigot-Server-Patches/Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch index f682048736..db9f230d16 100644 --- a/Spigot-Server-Patches/Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch +++ b/Spigot-Server-Patches/Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch @@ -4,10 +4,10 @@ Date: Wed, 9 Oct 2019 21:51:43 -0500 Subject: [PATCH] Fix stuck in sneak when changing worlds (MC-10657) -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.lastHealthSent = -1.0F; this.lastFoodSent = -1; @@ -17,10 +17,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld()); this.world.getServer().getPluginManager().callEvent(changeEvent); -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect)); } diff --git a/Spigot-Server-Patches/Fix-unregistering-entities-from-unloading-chunks.patch b/Spigot-Server-Patches/Fix-unregistering-entities-from-unloading-chunks.patch index 18e9b12652..b726036f8d 100644 --- a/Spigot-Server-Patches/Fix-unregistering-entities-from-unloading-chunks.patch +++ b/Spigot-Server-Patches/Fix-unregistering-entities-from-unloading-chunks.patch @@ -14,10 +14,10 @@ This then results in dead entities lingering in the Chunk. Combine that with a buggy detail of the previous implementation of the Dupe UUID patch, then this was the likely source of the "Ghost entities" -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { } diff --git a/Spigot-Server-Patches/Fix-villager-boat-exploit.patch b/Spigot-Server-Patches/Fix-villager-boat-exploit.patch index b6a39f48d0..fd646ac8c5 100644 --- a/Spigot-Server-Patches/Fix-villager-boat-exploit.patch +++ b/Spigot-Server-Patches/Fix-villager-boat-exploit.patch @@ -4,10 +4,10 @@ Date: Mon, 11 Jan 2021 12:43:51 -0800 Subject: [PATCH] Fix villager boat exploit -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { for (Iterator iterator = entity.getAllPassengers().iterator(); iterator.hasNext(); entity1.dead = true) { diff --git a/Spigot-Server-Patches/Fix-villager-trading-demand-MC-163962.patch b/Spigot-Server-Patches/Fix-villager-trading-demand-MC-163962.patch index d3eeffb66a..f0a985f29b 100644 --- a/Spigot-Server-Patches/Fix-villager-trading-demand-MC-163962.patch +++ b/Spigot-Server-Patches/Fix-villager-trading-demand-MC-163962.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix villager trading demand - MC-163962 Prevent demand from going negative and tending to negative infinity -diff --git a/src/main/java/net/minecraft/server/MerchantRecipe.java b/src/main/java/net/minecraft/server/MerchantRecipe.java +diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantRecipe.java b/src/main/java/net/minecraft/world/item/trading/MerchantRecipe.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MerchantRecipe.java -+++ b/src/main/java/net/minecraft/server/MerchantRecipe.java +--- a/src/main/java/net/minecraft/world/item/trading/MerchantRecipe.java ++++ b/src/main/java/net/minecraft/world/item/trading/MerchantRecipe.java @@ -0,0 +0,0 @@ public class MerchantRecipe { } diff --git a/Spigot-Server-Patches/Fixed-TileEntityBell-memory-leak.patch b/Spigot-Server-Patches/Fixed-TileEntityBell-memory-leak.patch index 1be23813ac..c51b56feb6 100644 --- a/Spigot-Server-Patches/Fixed-TileEntityBell-memory-leak.patch +++ b/Spigot-Server-Patches/Fixed-TileEntityBell-memory-leak.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fixed TileEntityBell memory leak TileEntityBell has a list of entities (entitiesAtRing) that was not being cleared at the right time, causing leaks whenever a bell would be rung near a crowd of entities. -diff --git a/src/main/java/net/minecraft/server/TileEntityBell.java b/src/main/java/net/minecraft/server/TileEntityBell.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBell.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBell.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityBell.java -+++ b/src/main/java/net/minecraft/server/TileEntityBell.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBell.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBell.java @@ -0,0 +0,0 @@ public class TileEntityBell extends TileEntity implements ITickable { public int a; public boolean b; diff --git a/Spigot-Server-Patches/Generator-Settings.patch b/Spigot-Server-Patches/Generator-Settings.patch index 6a941080aa..d369838eec 100644 --- a/Spigot-Server-Patches/Generator-Settings.patch +++ b/Spigot-Server-Patches/Generator-Settings.patch @@ -18,10 +18,46 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", false); + } } -diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -+++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java +--- a/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java ++++ b/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java +@@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; + + public interface IChunkAccess extends IBlockAccess, IStructureAccess { + ++ // Paper start ++ default boolean generateFlatBedrock() { ++ if (this instanceof ProtoChunk) { ++ return ((ProtoChunk)this).world.paperConfig.generateFlatBedrock; ++ } else if (this instanceof Chunk) { ++ return ((Chunk)this).world.paperConfig.generateFlatBedrock; ++ } else { ++ return false; ++ } ++ } ++ // Paper end ++ + IBlockData getType(final int x, final int y, final int z); // Paper + @Nullable + IBlockData setType(BlockPosition blockposition, IBlockData iblockdata, boolean flag); +diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +@@ -0,0 +0,0 @@ public class ProtoChunk implements IChunkAccess { + private long s; + private final Map<WorldGenStage.Features, BitSet> t; + private volatile boolean u; +- private final World world; // Paper - Anti-Xray - Add world ++ final World world; // Paper - Anti-Xray - Add world // Paper - private -> default + + // Paper start - Anti-Xray - Add world + @Deprecated public ProtoChunk(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter) { this(chunkcoordintpair, chunkconverter, null); } // Notice for updates: Please make sure this constructor isn't used anywhere +diff --git a/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java @@ -0,0 +0,0 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { int i = ichunkaccess.getPos().d(); int j = ichunkaccess.getPos().e(); @@ -51,39 +87,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ichunkaccess.setType(blockposition_mutableblockposition.d(blockposition.getX(), k + i1, blockposition.getZ()), Blocks.BEDROCK.getBlockData(), false); } } -diff --git a/src/main/java/net/minecraft/server/IChunkAccess.java b/src/main/java/net/minecraft/server/IChunkAccess.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IChunkAccess.java -+++ b/src/main/java/net/minecraft/server/IChunkAccess.java -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; - - public interface IChunkAccess extends IBlockAccess, IStructureAccess { - -+ // Paper start -+ default boolean generateFlatBedrock() { -+ if (this instanceof ProtoChunk) { -+ return ((ProtoChunk)this).world.paperConfig.generateFlatBedrock; -+ } else if (this instanceof Chunk) { -+ return ((Chunk)this).world.paperConfig.generateFlatBedrock; -+ } else { -+ return false; -+ } -+ } -+ // Paper end -+ - IBlockData getType(final int x, final int y, final int z); // Paper - @Nullable - IBlockData setType(BlockPosition blockposition, IBlockData iblockdata, boolean flag); -diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ProtoChunk.java -+++ b/src/main/java/net/minecraft/server/ProtoChunk.java -@@ -0,0 +0,0 @@ public class ProtoChunk implements IChunkAccess { - private long s; - private final Map<WorldGenStage.Features, BitSet> t; - private volatile boolean u; -- private final World world; // Paper - Anti-Xray - Add world -+ final World world; // Paper - Anti-Xray - Add world // Paper - private -> default - - // Paper start - Anti-Xray - Add world - @Deprecated public ProtoChunk(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter) { this(chunkcoordintpair, chunkconverter, null); } // Notice for updates: Please make sure this constructor isn't used anywhere diff --git a/Spigot-Server-Patches/Guard-against-serializing-mismatching-chunk-coordina.patch b/Spigot-Server-Patches/Guard-against-serializing-mismatching-chunk-coordina.patch index 26c0d59940..d2e193379b 100644 --- a/Spigot-Server-Patches/Guard-against-serializing-mismatching-chunk-coordina.patch +++ b/Spigot-Server-Patches/Guard-against-serializing-mismatching-chunk-coordina.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Guard against serializing mismatching chunk coordinate Should help if something dumb happens -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java @@ -0,0 +0,0 @@ public class ChunkRegionLoader { private static final Logger LOGGER = LogManager.getLogger(); @@ -34,10 +34,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!Objects.equals(chunkcoordintpair, chunkcoordintpair1)) { ChunkRegionLoader.LOGGER.error("Chunk file at {} is in the wrong location; relocating. (Expected {}, got {})", chunkcoordintpair, chunkcoordintpair, chunkcoordintpair1); -diff --git a/src/main/java/net/minecraft/server/IChunkLoader.java b/src/main/java/net/minecraft/server/IChunkLoader.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IChunkLoader.java -+++ b/src/main/java/net/minecraft/server/IChunkLoader.java +--- a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java @@ -0,0 +0,0 @@ public class IChunkLoader implements AutoCloseable { public void a(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { write(chunkcoordintpair, nbttagcompound); } // Paper OBFHELPER diff --git a/Spigot-Server-Patches/Guardian-beam-workaround.patch b/Spigot-Server-Patches/Guardian-beam-workaround.patch index 9916c3268c..de78d7f8b5 100644 --- a/Spigot-Server-Patches/Guardian-beam-workaround.patch +++ b/Spigot-Server-Patches/Guardian-beam-workaround.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Guardian beam workaround This patch is a workaround for MC-165595 -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutUpdateTime.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutUpdateTime.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java -@@ -0,0 +0,0 @@ import java.io.IOException; +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutUpdateTime.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutUpdateTime.java +@@ -0,0 +0,0 @@ import net.minecraft.network.protocol.Packet; public class PacketPlayOutUpdateTime implements Packet<PacketListenerPlayOut> { diff --git a/Spigot-Server-Patches/Handle-Item-Meta-Inconsistencies.patch b/Spigot-Server-Patches/Handle-Item-Meta-Inconsistencies.patch index ff6d4260a4..1d2011c4f3 100644 --- a/Spigot-Server-Patches/Handle-Item-Meta-Inconsistencies.patch +++ b/Spigot-Server-Patches/Handle-Item-Meta-Inconsistencies.patch @@ -17,10 +17,10 @@ was added, resulting in 2 different ways to modify an items enchantments. For consistency, the old API methods now forward to use the ItemMeta API equivalents, and should deprecate the old API's. -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -0,0 +0,0 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.text.DecimalFormat; @@ -115,7 +115,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end } - static boolean makeTag(net.minecraft.server.ItemStack item) { + static boolean makeTag(net.minecraft.world.item.ItemStack item) { @@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack { @Override @@ -192,7 +192,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return hasItemMeta() ? getItemMeta().getEnchants() : ImmutableMap.<Enchantment, Integer>of(); // Paper - use Item Meta } - static Map<Enchantment, Integer> getEnchantments(net.minecraft.server.ItemStack item) { + static Map<Enchantment, Integer> getEnchantments(net.minecraft.world.item.ItemStack item) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java diff --git a/Spigot-Server-Patches/Handle-Large-Packets-disconnecting-client.patch b/Spigot-Server-Patches/Handle-Large-Packets-disconnecting-client.patch index 9e1e95d4e9..532830ac0d 100644 --- a/Spigot-Server-Patches/Handle-Large-Packets-disconnecting-client.patch +++ b/Spigot-Server-Patches/Handle-Large-Packets-disconnecting-client.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Handle Large Packets disconnecting client If a players inventory is too big to send in a single packet, split the inventory set into multiple packets instead. -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java +diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java +--- a/src/main/java/net/minecraft/network/NetworkManager.java ++++ b/src/main/java/net/minecraft/network/NetworkManager.java @@ -0,0 +0,0 @@ import io.netty.channel.epoll.EpollEventLoopGroup; import io.netty.channel.local.LocalChannel; import io.netty.channel.local.LocalServerChannel; @@ -34,27 +34,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (throwable instanceof SkipEncodeException) { NetworkManager.LOGGER.debug("Skipping packet due to errors", throwable.getCause()); } else { -diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java +diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Packet.java -+++ b/src/main/java/net/minecraft/server/Packet.java -@@ -0,0 +0,0 @@ public interface Packet<T extends PacketListener> { - - void a(T t0); - -+ // Paper start -+ default boolean packetTooLarge(NetworkManager manager) { -+ return false; -+ } -+ // Paper end -+ - default boolean a() { - return false; - } -diff --git a/src/main/java/net/minecraft/server/PacketEncoder.java b/src/main/java/net/minecraft/server/PacketEncoder.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketEncoder.java -+++ b/src/main/java/net/minecraft/server/PacketEncoder.java +--- a/src/main/java/net/minecraft/network/PacketEncoder.java ++++ b/src/main/java/net/minecraft/network/PacketEncoder.java @@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { throw throwable; } @@ -87,10 +70,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end } -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +diff --git a/src/main/java/net/minecraft/network/protocol/Packet.java b/src/main/java/net/minecraft/network/protocol/Packet.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +--- a/src/main/java/net/minecraft/network/protocol/Packet.java ++++ b/src/main/java/net/minecraft/network/protocol/Packet.java +@@ -0,0 +0,0 @@ public interface Packet<T extends PacketListener> { + + void a(T t0); + ++ // Paper start ++ default boolean packetTooLarge(NetworkManager manager) { ++ return false; ++ } ++ // Paper end ++ + default boolean a() { + return false; + } +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { int i = packetdataserializer.i(); @@ -100,10 +100,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 throw new RuntimeException("Chunk Packet trying to allocate too much memory on read."); } else { this.f = new byte[i]; -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutWindowItems.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutWindowItems.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutWindowItems.java @@ -0,0 +0,0 @@ public class PacketPlayOutWindowItems implements Packet<PacketListenerPlayOut> { private int a; private List<ItemStack> b; diff --git a/Spigot-Server-Patches/Handle-Oversized-Tile-Entities-in-chunks.patch b/Spigot-Server-Patches/Handle-Oversized-Tile-Entities-in-chunks.patch index 9b4d6b7548..857f5f2541 100644 --- a/Spigot-Server-Patches/Handle-Oversized-Tile-Entities-in-chunks.patch +++ b/Spigot-Server-Patches/Handle-Oversized-Tile-Entities-in-chunks.patch @@ -8,10 +8,10 @@ creating too large of a packet to sed. Co authored by Spottedleaf -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java @@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { private boolean h; diff --git a/Spigot-Server-Patches/Here-s-Johnny.patch b/Spigot-Server-Patches/Here-s-Johnny.patch index 89177e3e06..715a877bad 100644 --- a/Spigot-Server-Patches/Here-s-Johnny.patch +++ b/Spigot-Server-Patches/Here-s-Johnny.patch @@ -4,10 +4,10 @@ Date: Fri, 12 Oct 2018 01:37:22 -0500 Subject: [PATCH] Here's Johnny! -diff --git a/src/main/java/net/minecraft/server/EntityVindicator.java b/src/main/java/net/minecraft/server/EntityVindicator.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java b/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVindicator.java -+++ b/src/main/java/net/minecraft/server/EntityVindicator.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java @@ -0,0 +0,0 @@ public class EntityVindicator extends EntityIllagerAbstract { private static final Predicate<EnumDifficulty> b = (enumdifficulty) -> { return enumdifficulty == EnumDifficulty.NORMAL || enumdifficulty == EnumDifficulty.HARD; diff --git a/Spigot-Server-Patches/Hide-sync-chunk-writes-behind-flag.patch b/Spigot-Server-Patches/Hide-sync-chunk-writes-behind-flag.patch index 4a0b0832a6..6c68bfef29 100644 --- a/Spigot-Server-Patches/Hide-sync-chunk-writes-behind-flag.patch +++ b/Spigot-Server-Patches/Hide-sync-chunk-writes-behind-flag.patch @@ -8,10 +8,10 @@ on harddrives. -DPaper.enable-sync-chunk-writes=true to enable -diff --git a/src/main/java/net/minecraft/server/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/DedicatedServerProperties.java +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServerProperties.java -+++ b/src/main/java/net/minecraft/server/DedicatedServerProperties.java +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java @@ -0,0 +0,0 @@ public class DedicatedServerProperties extends PropertyManager<DedicatedServerPr this.maxWorldSize = this.a("max-world-size", (integer) -> { return MathHelper.clamp(integer, 1, 29999984); diff --git a/Spigot-Server-Patches/Honor-EntityAgeable.ageLock.patch b/Spigot-Server-Patches/Honor-EntityAgeable.ageLock.patch index 8f944382d8..3074961968 100644 --- a/Spigot-Server-Patches/Honor-EntityAgeable.ageLock.patch +++ b/Spigot-Server-Patches/Honor-EntityAgeable.ageLock.patch @@ -4,10 +4,10 @@ Date: Sun, 23 Sep 2018 20:59:53 -0500 Subject: [PATCH] Honor EntityAgeable.ageLock -diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityAgeable.java b/src/main/java/net/minecraft/world/entity/EntityAgeable.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityAgeable.java -+++ b/src/main/java/net/minecraft/server/EntityAgeable.java +--- a/src/main/java/net/minecraft/world/entity/EntityAgeable.java ++++ b/src/main/java/net/minecraft/world/entity/EntityAgeable.java @@ -0,0 +0,0 @@ public abstract class EntityAgeable extends EntityCreature { } 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 5c3aa1cd28..0dbc75bda4 100644 --- a/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch +++ b/Spigot-Server-Patches/Ignore-Dead-Entities-in-entityList-iteration.patch @@ -22,10 +22,42 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 MutablePair<Integer, Map<ChunkCoordIntPair, Integer>> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap())); ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.chunkX, e.chunkZ); -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + entity.origin = entity.getBukkitEntity().getLocation(); + } + // Paper end ++ entity.shouldBeRemoved = false; // Paper - shouldn't be removed after being re-added + new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid + } + +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + this.removeEntityFromChunk(entity); + this.entitiesById.remove(entity.getId()); + this.unregisterEntity(entity); ++ entity.shouldBeRemoved = true; // Paper + } + } + +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + protected int numCollisions = 0; // Paper + public void inactiveTick() { } + // Spigot end ++ public boolean shouldBeRemoved; // Paper + + public float getBukkitYaw() { + return this.yaw; +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { for (int i1 = 0; i1 < l; ++i1) { @@ -50,54 +82,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 - protected int numCollisions = 0; // Paper - public void inactiveTick() { } - // Spigot end -+ public boolean shouldBeRemoved; // Paper - - 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - entity.origin = entity.getBukkitEntity().getLocation(); - } - // Paper end -+ entity.shouldBeRemoved = false; // Paper - shouldn't be removed after being re-added - new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid - } - -@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { - this.removeEntityFromChunk(entity); - this.entitiesById.remove(entity.getId()); - this.unregisterEntity(entity); -+ entity.shouldBeRemoved = true; // Paper - } - } - diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { for (Object o : world.entitiesById.values()) { - if (o instanceof net.minecraft.server.Entity) { - net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity) o; + if (o instanceof net.minecraft.world.entity.Entity) { + net.minecraft.world.entity.Entity mcEnt = (net.minecraft.world.entity.Entity) o; + if (mcEnt.shouldBeRemoved) continue; // Paper Entity bukkitEntity = mcEnt.getBukkitEntity(); // Assuming that bukkitEntity isn't null @@ -0,0 +0,0 @@ public class CraftWorld implements World { for (Object o : world.entitiesById.values()) { - if (o instanceof net.minecraft.server.Entity) { - net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity) o; + if (o instanceof net.minecraft.world.entity.Entity) { + net.minecraft.world.entity.Entity mcEnt = (net.minecraft.world.entity.Entity) o; + if (mcEnt.shouldBeRemoved) continue; // Paper Entity bukkitEntity = mcEnt.getBukkitEntity(); @@ -105,16 +105,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class CraftWorld implements World { for (Object entity: world.entitiesById.values()) { - if (entity instanceof net.minecraft.server.Entity) { -+ if (((net.minecraft.server.Entity) entity).shouldBeRemoved) continue; // Paper - Entity bukkitEntity = ((net.minecraft.server.Entity) entity).getBukkitEntity(); + if (entity instanceof net.minecraft.world.entity.Entity) { ++ if (((net.minecraft.world.entity.Entity) entity).shouldBeRemoved) continue; // Paper + Entity bukkitEntity = ((net.minecraft.world.entity.Entity) entity).getBukkitEntity(); if (bukkitEntity == null) { @@ -0,0 +0,0 @@ public class CraftWorld implements World { for (Object entity: world.entitiesById.values()) { - if (entity instanceof net.minecraft.server.Entity) { -+ if (((net.minecraft.server.Entity) entity).shouldBeRemoved) continue; // Paper - Entity bukkitEntity = ((net.minecraft.server.Entity) entity).getBukkitEntity(); + if (entity instanceof net.minecraft.world.entity.Entity) { ++ if (((net.minecraft.world.entity.Entity) entity).shouldBeRemoved) continue; // Paper + Entity bukkitEntity = ((net.minecraft.world.entity.Entity) entity).getBukkitEntity(); if (bukkitEntity == null) { diff --git a/Spigot-Server-Patches/Implement-API-to-expose-exact-interaction-point.patch b/Spigot-Server-Patches/Implement-API-to-expose-exact-interaction-point.patch index abafdf5b29..a43e3ca631 100644 --- a/Spigot-Server-Patches/Implement-API-to-expose-exact-interaction-point.patch +++ b/Spigot-Server-Patches/Implement-API-to-expose-exact-interaction-point.patch @@ -4,10 +4,10 @@ Date: Mon, 4 Jan 2021 16:40:27 +1000 Subject: [PATCH] Implement API to expose exact interaction point -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java +--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java @@ -0,0 +0,0 @@ public class PlayerInteractManager { cancelledBlock = true; } @@ -21,15 +21,11 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 @@ import net.minecraft.server.NPC; - import net.minecraft.server.PacketPlayInCloseWindow; - import net.minecraft.server.Raid; - import net.minecraft.server.Unit; -+import net.minecraft.server.Vec3D; - import net.minecraft.server.World; - import net.minecraft.server.WorldServer; +@@ -0,0 +0,0 @@ import net.minecraft.world.phys.MovingObjectPosition; + import net.minecraft.world.phys.MovingObjectPositionBlock; + import net.minecraft.world.phys.MovingObjectPositionEntity; import org.bukkit.Bukkit; -+import org.bukkit.Location; ++import org.bukkit.Location; // Paper import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.Server; diff --git a/Spigot-Server-Patches/Implement-API-to-get-Material-from-Boats-and-Minecar.patch b/Spigot-Server-Patches/Implement-API-to-get-Material-from-Boats-and-Minecar.patch index 883bf359bd..ac3f58e31b 100644 --- a/Spigot-Server-Patches/Implement-API-to-get-Material-from-Boats-and-Minecar.patch +++ b/Spigot-Server-Patches/Implement-API-to-get-Material-from-Boats-and-Minecar.patch @@ -4,10 +4,10 @@ Date: Thu, 31 Dec 2020 12:48:19 +1000 Subject: [PATCH] Implement API to get Material from Boats and Minecarts -diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityBoat.java -+++ b/src/main/java/net/minecraft/server/EntityBoat.java +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java @@ -0,0 +0,0 @@ public class EntityBoat extends Entity { } @@ -23,11 +23,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ package org.bukkit.craftbukkit.entity; - import net.minecraft.server.EntityBoat; -+import org.bukkit.Material; + import net.minecraft.world.entity.vehicle.EntityBoat; ++import org.bukkit.Material; // Paper import org.bukkit.TreeSpecies; import org.bukkit.craftbukkit.CraftServer; -+import org.bukkit.craftbukkit.util.CraftMagicNumbers; ++import org.bukkit.craftbukkit.util.CraftMagicNumbers; // Paper import org.bukkit.entity.Boat; import org.bukkit.entity.EntityType; @@ -49,13 +49,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/sr index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java -@@ -0,0 +0,0 @@ package org.bukkit.craftbukkit.entity; - import net.minecraft.server.Blocks; - import net.minecraft.server.EntityMinecartAbstract; - import net.minecraft.server.IBlockData; -+import net.minecraft.server.Item; -+import net.minecraft.server.Items; -+import org.bukkit.Material; +@@ -0,0 +0,0 @@ + package org.bukkit.craftbukkit.entity; + + import net.minecraft.world.entity.vehicle.EntityMinecartAbstract; ++import net.minecraft.world.item.Items; // Paper + import net.minecraft.world.level.block.Blocks; + import net.minecraft.world.level.block.state.IBlockData; ++import org.bukkit.Material; // Paper import org.bukkit.block.data.BlockData; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.block.data.CraftBlockData; @@ -66,7 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start + @Override + public Material getMinecartMaterial() { -+ Item minecartItem; ++ net.minecraft.world.item.Item minecartItem; + switch (getHandle().getMinecartType()) { + case CHEST: + minecartItem = Items.CHEST_MINECART; diff --git a/Spigot-Server-Patches/Implement-BlockPreDispenseEvent.patch b/Spigot-Server-Patches/Implement-BlockPreDispenseEvent.patch index 592a4aad11..f57251754a 100644 --- a/Spigot-Server-Patches/Implement-BlockPreDispenseEvent.patch +++ b/Spigot-Server-Patches/Implement-BlockPreDispenseEvent.patch @@ -4,10 +4,10 @@ Date: Sun, 17 Jan 2021 13:16:09 +1000 Subject: [PATCH] Implement BlockPreDispenseEvent -diff --git a/src/main/java/net/minecraft/server/BlockDispenser.java b/src/main/java/net/minecraft/server/BlockDispenser.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockDispenser.java b/src/main/java/net/minecraft/world/level/block/BlockDispenser.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockDispenser.java -+++ b/src/main/java/net/minecraft/server/BlockDispenser.java +--- a/src/main/java/net/minecraft/world/level/block/BlockDispenser.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockDispenser.java @@ -0,0 +0,0 @@ public class BlockDispenser extends BlockTileEntity { IDispenseBehavior idispensebehavior = this.a(itemstack); @@ -20,14 +20,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 @@ import java.util.List; - import java.util.Map; - import java.util.stream.Collectors; - import javax.annotation.Nullable; -+import io.papermc.paper.event.block.BlockPreDispenseEvent; - import net.minecraft.server.BlockPosition; - import net.minecraft.server.BlockPropertyInstrument; - import net.minecraft.server.Container; +@@ -0,0 +0,0 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParameters; + import net.minecraft.world.phys.MovingObjectPosition; + import net.minecraft.world.phys.MovingObjectPositionBlock; + import net.minecraft.world.phys.MovingObjectPositionEntity; ++import io.papermc.paper.event.block.BlockPreDispenseEvent; // Paper + import org.bukkit.Bukkit; + import org.bukkit.Location; // Paper + import org.bukkit.Material; @@ -0,0 +0,0 @@ public class CraftEventFactory { BlockFailedDispenseEvent event = new BlockFailedDispenseEvent(block); return event.callEvent(); diff --git a/Spigot-Server-Patches/Implement-Brigadier-Mojang-API.patch b/Spigot-Server-Patches/Implement-Brigadier-Mojang-API.patch index e5103e04e9..825a34750a 100644 --- a/Spigot-Server-Patches/Implement-Brigadier-Mojang-API.patch +++ b/Spigot-Server-Patches/Implement-Brigadier-Mojang-API.patch @@ -9,10 +9,10 @@ Adds AsyncPlayerSendCommandsEvent Adds CommandRegisteredEvent - Allows manipulating the CommandNode to add more children/metadata for the client -diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java +diff --git a/src/main/java/net/minecraft/commands/CommandDispatcher.java b/src/main/java/net/minecraft/commands/CommandDispatcher.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CommandDispatcher.java -+++ b/src/main/java/net/minecraft/server/CommandDispatcher.java +--- a/src/main/java/net/minecraft/commands/CommandDispatcher.java ++++ b/src/main/java/net/minecraft/commands/CommandDispatcher.java @@ -0,0 +0,0 @@ public class CommandDispatcher { bukkit.add(node.getName()); } @@ -29,11 +29,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 PlayerCommandSendEvent event = new PlayerCommandSendEvent(entityplayer.getBukkitEntity(), new LinkedHashSet<>(bukkit)); event.getPlayer().getServer().getPluginManager().callEvent(event); -diff --git a/src/main/java/net/minecraft/server/CommandListenerWrapper.java b/src/main/java/net/minecraft/server/CommandListenerWrapper.java +diff --git a/src/main/java/net/minecraft/commands/CommandListenerWrapper.java b/src/main/java/net/minecraft/commands/CommandListenerWrapper.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CommandListenerWrapper.java -+++ b/src/main/java/net/minecraft/server/CommandListenerWrapper.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/commands/CommandListenerWrapper.java ++++ b/src/main/java/net/minecraft/commands/CommandListenerWrapper.java +@@ -0,0 +0,0 @@ import net.minecraft.world.phys.Vec3D; import com.mojang.brigadier.tree.CommandNode; // CraftBukkit @@ -68,10 +68,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public boolean hasPermission(int i) { // CraftBukkit start -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { ParseResults<CommandListenerWrapper> parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener()); @@ -104,7 +104,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.j index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java +++ b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java -@@ -0,0 +0,0 @@ import net.minecraft.server.CommandListenerWrapper; +@@ -0,0 +0,0 @@ import net.minecraft.commands.CommandListenerWrapper; import org.bukkit.command.Command; import org.bukkit.craftbukkit.CraftServer; diff --git a/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-Chunks.patch b/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-Chunks.patch index 43c2f32dfe..e95fbb1ccf 100644 --- a/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-Chunks.patch +++ b/Spigot-Server-Patches/Implement-Chunk-Priority-Urgency-System-for-Chunks.patch @@ -77,24 +77,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java +diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -+++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -@@ -0,0 +0,0 @@ public class ChunkCoordIntPair { - return "[" + this.x + ", " + this.z + "]"; - } - -+ public final BlockPosition asPosition() { return l(); } // Paper - OBFHELPER - public BlockPosition l() { - return new BlockPosition(this.d(), 0, this.e()); - } -diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java +--- a/src/main/java/net/minecraft/server/MCUtil.java ++++ b/src/main/java/net/minecraft/server/MCUtil.java +@@ -0,0 +0,0 @@ public final class MCUtil { + chunkData.addProperty("x", playerChunk.location.x); + chunkData.addProperty("z", playerChunk.location.z); + chunkData.addProperty("ticket-level", playerChunk.getTicketLevel()); ++ chunkData.addProperty("priority", playerChunk.getCurrentPriority()); + chunkData.addProperty("state", PlayerChunk.getChunkState(playerChunk.getTicketLevel()).toString()); + chunkData.addProperty("queued-for-unload", chunkMap.unloadQueue.contains(playerChunk.location.pair())); + chunkData.addProperty("status", status == null ? "unloaded" : status.toString()); +diff --git a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkMapDistance.java -+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java -@@ -0,0 +0,0 @@ import java.util.concurrent.Executor; - import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.chunk.Chunk; + import net.minecraft.world.level.chunk.ChunkStatus; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.spigotmc.AsyncCatcher; // Paper @@ -482,10 +482,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override protected int c(long i) { return this.a.get(i); -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { public <T> void removeTicketAtLevel(TicketType<T> ticketType, ChunkCoordIntPair chunkPos, int ticketLevel, T identifier) { this.chunkMapDistance.removeTicketAtLevel(ticketType, chunkPos, ticketLevel, identifier); @@ -568,10 +568,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 boolean flag = this.chunkMapDistance.a(this.playerChunkMap); boolean flag1 = this.playerChunkMap.b(); -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { private int lastArmorScored = Integer.MIN_VALUE; private int lastExpLevelScored = Integer.MIN_VALUE; @@ -615,24 +615,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for (int i = 0; i < this.inventory.getSize(); ++i) { ItemStack itemstack = this.inventory.getItem(i); -diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MCUtil.java -+++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -0,0 +0,0 @@ public final class MCUtil { - chunkData.addProperty("x", playerChunk.location.x); - chunkData.addProperty("z", playerChunk.location.z); - chunkData.addProperty("ticket-level", playerChunk.getTicketLevel()); -+ chunkData.addProperty("priority", playerChunk.getCurrentPriority()); - chunkData.addProperty("state", PlayerChunk.getChunkState(playerChunk.getTicketLevel()).toString()); - chunkData.addProperty("queued-for-unload", chunkMap.unloadQueue.contains(playerChunk.location.pair())); - chunkData.addProperty("status", status == null ? "unloaded" : status.toString()); -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.server.level; import com.mojang.datafixers.util.Either; +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper @@ -888,10 +876,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 void a(ChunkCoordIntPair chunkcoordintpair, IntSupplier intsupplier, int i, IntConsumer intconsumer); } -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ByteMap; @@ -1145,10 +1133,43 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 }); } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/level/Ticket.java ++++ b/src/main/java/net/minecraft/server/level/Ticket.java +@@ -0,0 +0,0 @@ public final class Ticket<T> implements Comparable<Ticket<?>> { + private final int b; + public final T identifier; public final T getObjectReason() { return this.identifier; } // Paper - OBFHELPER + private long d; public final long getCreationTick() { return this.d; } // Paper - OBFHELPER ++ public int priority = 0; // Paper + + protected Ticket(TicketType<T> tickettype, int i, T t0) { + this.a = tickettype; +@@ -0,0 +0,0 @@ public final class Ticket<T> implements Comparable<Ticket<?>> { + return this.b; + } + ++ public final void setCurrentTick(long i) { this.a(i); } // Paper - OBFHELPER + protected void a(long i) { + this.d = i; + } +diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/TicketType.java ++++ b/src/main/java/net/minecraft/server/level/TicketType.java +@@ -0,0 +0,0 @@ public class TicketType<T> { + public static final TicketType<org.bukkit.plugin.Plugin> PLUGIN_TICKET = a("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit + public static final TicketType<Long> FUTURE_AWAIT = a("future_await", Long::compareTo); // Paper + public static final TicketType<Long> ASYNC_LOAD = a("async_load", Long::compareTo); // Paper ++ public static final TicketType<ChunkCoordIntPair> PRIORITY = a("priority", Comparator.comparingLong(ChunkCoordIntPair::pair), 300); // Paper ++ public static final TicketType<ChunkCoordIntPair> URGENT = a("urgent", Comparator.comparingLong(ChunkCoordIntPair::pair), 300); // Paper + + public static <T> TicketType<T> a(String s, Comparator<T> comparator) { + return new TicketType<>(s, comparator, 0L); +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { this.A = this.e; @@ -1157,10 +1178,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait)); } -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { final ChunkCoordIntPair pos = new ChunkCoordIntPair(chunkX, chunkZ); PlayerChunkMap playerChunkMap = worldserver1.getChunkProvider().playerChunkMap; @@ -1188,39 +1209,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 while (avoidSuffocation && !worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) { entityplayer1.setPosition(entityplayer1.locX(), entityplayer1.locY() + 1.0D, entityplayer1.locZ()); } -diff --git a/src/main/java/net/minecraft/server/Ticket.java b/src/main/java/net/minecraft/server/Ticket.java +diff --git a/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java b/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Ticket.java -+++ b/src/main/java/net/minecraft/server/Ticket.java -@@ -0,0 +0,0 @@ public final class Ticket<T> implements Comparable<Ticket<?>> { - private final int b; - public final T identifier; public final T getObjectReason() { return this.identifier; } // Paper - OBFHELPER - private long d; public final long getCreationTick() { return this.d; } // Paper - OBFHELPER -+ public int priority = 0; // Paper - - protected Ticket(TicketType<T> tickettype, int i, T t0) { - this.a = tickettype; -@@ -0,0 +0,0 @@ public final class Ticket<T> implements Comparable<Ticket<?>> { - return this.b; +--- a/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java ++++ b/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java +@@ -0,0 +0,0 @@ public class ChunkCoordIntPair { + return "[" + this.x + ", " + this.z + "]"; } -+ public final void setCurrentTick(long i) { this.a(i); } // Paper - OBFHELPER - protected void a(long i) { - this.d = i; ++ public final BlockPosition asPosition() { return l(); } // Paper - OBFHELPER + public BlockPosition l() { + return new BlockPosition(this.d(), 0, this.e()); } -diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TicketType.java -+++ b/src/main/java/net/minecraft/server/TicketType.java -@@ -0,0 +0,0 @@ public class TicketType<T> { - public static final TicketType<org.bukkit.plugin.Plugin> PLUGIN_TICKET = a("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit - public static final TicketType<Long> FUTURE_AWAIT = a("future_await", Long::compareTo); // Paper - public static final TicketType<Long> ASYNC_LOAD = a("async_load", Long::compareTo); // Paper -+ public static final TicketType<ChunkCoordIntPair> PRIORITY = a("priority", Comparator.comparingLong(ChunkCoordIntPair::pair), 300); // Paper -+ public static final TicketType<ChunkCoordIntPair> URGENT = a("urgent", Comparator.comparingLong(ChunkCoordIntPair::pair), 300); // Paper - - public static <T> TicketType<T> a(String s, Comparator<T> comparator) { - return new TicketType<>(s, comparator, 0L); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1234,7 +1234,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + world.getChunkProvider().markHighPriority(new ChunkCoordIntPair(x, z), 1); + } return this.world.getChunkProvider().getChunkAtAsynchronously(x, z, gen, urgent).thenComposeAsync((either) -> { - net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) either.left().orElse(null); + net.minecraft.world.level.chunk.Chunk chunk = (net.minecraft.world.level.chunk.Chunk) either.left().orElse(null); return CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 diff --git a/Spigot-Server-Patches/Implement-CraftBlockSoundGroup.patch b/Spigot-Server-Patches/Implement-CraftBlockSoundGroup.patch index 82e1024299..1e3cf7690a 100644 --- a/Spigot-Server-Patches/Implement-CraftBlockSoundGroup.patch +++ b/Spigot-Server-Patches/Implement-CraftBlockSoundGroup.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package com.destroystokyo.paper.block; + -+import net.minecraft.server.SoundEffectType; ++import net.minecraft.world.level.block.SoundEffectType; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.CraftSound; + @@ -48,10 +48,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return CraftSound.getBukkit(soundEffectType.getFallSound()); + } +} -diff --git a/src/main/java/net/minecraft/server/SoundEffectType.java b/src/main/java/net/minecraft/server/SoundEffectType.java +diff --git a/src/main/java/net/minecraft/world/level/block/SoundEffectType.java b/src/main/java/net/minecraft/world/level/block/SoundEffectType.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SoundEffectType.java -+++ b/src/main/java/net/minecraft/server/SoundEffectType.java +--- a/src/main/java/net/minecraft/world/level/block/SoundEffectType.java ++++ b/src/main/java/net/minecraft/world/level/block/SoundEffectType.java @@ -0,0 +0,0 @@ public class SoundEffectType { public static final SoundEffectType U = new SoundEffectType(1.0F, 1.0F, SoundEffects.BLOCK_GILDED_BLACKSTONE_BREAK, SoundEffects.BLOCK_GILDED_BLACKSTONE_STEP, SoundEffects.BLOCK_GILDED_BLACKSTONE_PLACE, SoundEffects.BLOCK_GILDED_BLACKSTONE_HIT, SoundEffects.BLOCK_GILDED_BLACKSTONE_FALL); public final float volume; diff --git a/Spigot-Server-Patches/Implement-EntityKnockbackByEntityEvent.patch b/Spigot-Server-Patches/Implement-EntityKnockbackByEntityEvent.patch index 8317c3e3a0..4a2c341244 100644 --- a/Spigot-Server-Patches/Implement-EntityKnockbackByEntityEvent.patch +++ b/Spigot-Server-Patches/Implement-EntityKnockbackByEntityEvent.patch @@ -5,32 +5,10 @@ Subject: [PATCH] Implement EntityKnockbackByEntityEvent This event is called when an entity receives knockback by another entity. -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - if (flag5) { - if (i > 0) { - if (entity instanceof EntityLiving) { -- ((EntityLiving) entity).a((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F))); -+ ((EntityLiving) entity).doKnockback((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); // Paper - } else { - entity.i((double) (-MathHelper.sin(this.yaw * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 0.017453292F) * (float) i * 0.5F)); - } -@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h((Entity) entityliving) < 9.0D) { - // CraftBukkit start - Only apply knockback if the damage hits - if (entityliving.damageEntity(DamageSource.playerAttack(this).sweep(), f4)) { -- entityliving.a(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F))); -+ entityliving.doKnockback(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); // Paper - } - // CraftBukkit end - } -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { if (flag) { @@ -40,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.setMot(this.getMot().d(0.6D, 1.0D, 0.6D)); } -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { } @@ -91,3 +69,25 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { + if (flag5) { + if (i > 0) { + if (entity instanceof EntityLiving) { +- ((EntityLiving) entity).a((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F))); ++ ((EntityLiving) entity).doKnockback((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); // Paper + } else { + entity.i((double) (-MathHelper.sin(this.yaw * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 0.017453292F) * (float) i * 0.5F)); + } +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { + if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h((Entity) entityliving) < 9.0D) { + // CraftBukkit start - Only apply knockback if the damage hits + if (entityliving.damageEntity(DamageSource.playerAttack(this).sweep(), f4)) { +- entityliving.a(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F))); ++ entityliving.doKnockback(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); // Paper + } + // CraftBukkit end + } diff --git a/Spigot-Server-Patches/Implement-EntityTeleportEndGatewayEvent.patch b/Spigot-Server-Patches/Implement-EntityTeleportEndGatewayEvent.patch index e8bd4c4b18..c056b09c51 100644 --- a/Spigot-Server-Patches/Implement-EntityTeleportEndGatewayEvent.patch +++ b/Spigot-Server-Patches/Implement-EntityTeleportEndGatewayEvent.patch @@ -4,10 +4,10 @@ Date: Sat, 9 Jun 2018 14:08:39 +0200 Subject: [PATCH] Implement EntityTeleportEndGatewayEvent -diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java -+++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java @@ -0,0 +0,0 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick } diff --git a/Spigot-Server-Patches/Implement-Expanded-ArmorStand-API.patch b/Spigot-Server-Patches/Implement-Expanded-ArmorStand-API.patch index 4bb2c564f8..36ff2ae059 100644 --- a/Spigot-Server-Patches/Implement-Expanded-ArmorStand-API.patch +++ b/Spigot-Server-Patches/Implement-Expanded-ArmorStand-API.patch @@ -7,10 +7,10 @@ Add the following: - Add proper methods for getting and setting items in both hands. Deprecates old methods - Enable/Disable slot interactions -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { return enumitemslot; } diff --git a/Spigot-Server-Patches/Implement-Keyed-on-World.patch b/Spigot-Server-Patches/Implement-Keyed-on-World.patch index 544f8de2a8..0e06b28a63 100644 --- a/Spigot-Server-Patches/Implement-Keyed-on-World.patch +++ b/Spigot-Server-Patches/Implement-Keyed-on-World.patch @@ -4,10 +4,10 @@ Date: Wed, 6 Jan 2021 00:34:04 -0800 Subject: [PATCH] Implement Keyed on World -diff --git a/src/main/java/net/minecraft/server/IRegistry.java b/src/main/java/net/minecraft/server/IRegistry.java +diff --git a/src/main/java/net/minecraft/core/IRegistry.java b/src/main/java/net/minecraft/core/IRegistry.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IRegistry.java -+++ b/src/main/java/net/minecraft/server/IRegistry.java +--- a/src/main/java/net/minecraft/core/IRegistry.java ++++ b/src/main/java/net/minecraft/core/IRegistry.java @@ -0,0 +0,0 @@ public abstract class IRegistry<T> implements Codec<T>, Keyable, Registry<T> { public static final ResourceKey<IRegistry<LootItemFunctionType>> I = a("loot_function_type"); public static final ResourceKey<IRegistry<LootItemConditionType>> J = a("loot_condition_type"); @@ -43,10 +43,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } static { -diff --git a/src/main/java/net/minecraft/server/ResourceKey.java b/src/main/java/net/minecraft/server/ResourceKey.java +diff --git a/src/main/java/net/minecraft/resources/ResourceKey.java b/src/main/java/net/minecraft/resources/ResourceKey.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ResourceKey.java -+++ b/src/main/java/net/minecraft/server/ResourceKey.java +--- a/src/main/java/net/minecraft/resources/ResourceKey.java ++++ b/src/main/java/net/minecraft/resources/ResourceKey.java @@ -0,0 +0,0 @@ public class ResourceKey<T> { private final MinecraftKey b; private final MinecraftKey c; @@ -71,8 +71,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 chunkgenerator = worlddimension.c(); } -- ResourceKey<net.minecraft.server.World> worldKey = ResourceKey.a(IRegistry.L, new MinecraftKey(name.toLowerCase(java.util.Locale.ENGLISH))); -+ ResourceKey<net.minecraft.server.World> worldKey = ResourceKey.newResourceKey(IRegistry.getWorldRegistry(), new MinecraftKey(creator.key().getNamespace().toLowerCase(java.util.Locale.ENGLISH), creator.key().getKey().toLowerCase(java.util.Locale.ENGLISH))); // Paper +- ResourceKey<net.minecraft.world.level.World> worldKey = ResourceKey.a(IRegistry.L, new MinecraftKey(name.toLowerCase(java.util.Locale.ENGLISH))); ++ ResourceKey<net.minecraft.world.level.World> worldKey = ResourceKey.newResourceKey(IRegistry.getWorldRegistry(), new MinecraftKey(creator.key().getNamespace().toLowerCase(java.util.Locale.ENGLISH), creator.key().getKey().toLowerCase(java.util.Locale.ENGLISH))); // Paper WorldServer internal = (WorldServer) new WorldServer(console, console.executorService, worldSession, worlddata, worldKey, dimensionmanager, getServer().worldLoadListenerFactory.create(11), chunkgenerator, worlddata.getGeneratorSettings().isDebugWorld(), j, creator.environment() == Environment.NORMAL ? list : ImmutableList.of(), true, creator.environment(), generator); @@ -98,7 +98,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -0,0 +0,0 @@ public class CraftWorld implements World { return CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk()); - }, MinecraftServer.getServer()); + }, net.minecraft.server.MinecraftServer.getServer()); } + + @Override diff --git a/Spigot-Server-Patches/Implement-Mob-Goal-API.patch b/Spigot-Server-Patches/Implement-Mob-Goal-API.patch index c0db9fda5d..cea9a0ca6b 100644 --- a/Spigot-Server-Patches/Implement-Mob-Goal-API.patch +++ b/Spigot-Server-Patches/Implement-Mob-Goal-API.patch @@ -757,10 +757,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return (this.backingSet & (1L << element.ordinal())) != 0; + } } -diff --git a/src/main/java/net/minecraft/server/PathfinderGoal.java b/src/main/java/net/minecraft/server/PathfinderGoal.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoal.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoal.java +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java @@ -0,0 +0,0 @@ public abstract class PathfinderGoal { private final EnumSet<PathfinderGoal.Type> a = EnumSet.noneOf(PathfinderGoal.Type.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be. private final OptimizedSmallEnumSet<Type> goalTypes = new OptimizedSmallEnumSet<>(PathfinderGoal.Type.class); // Paper - remove streams from pathfindergoalselector @@ -818,10 +818,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private Type() {} } -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java @@ -0,0 +0,0 @@ public class PathfinderGoalSelector { } }; @@ -857,10 +857,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public Stream<PathfinderGoalWrapped> d() { return this.d.stream().filter(PathfinderGoalWrapped::g); } -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java @@ -0,0 +0,0 @@ import javax.annotation.Nullable; public class PathfinderGoalWrapped extends PathfinderGoal { diff --git a/Spigot-Server-Patches/Implement-Player-Client-Options-API.patch b/Spigot-Server-Patches/Implement-Player-Client-Options-API.patch index 5c0ae0a90d..e9d8ac3c3e 100644 --- a/Spigot-Server-Patches/Implement-Player-Client-Options-API.patch +++ b/Spigot-Server-Patches/Implement-Player-Client-Options-API.patch @@ -84,24 +84,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + .toString(); + } +} -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInSettings.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInSettings.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - private static final Map<EntityPose, EntitySize> b = ImmutableMap.<EntityPose, EntitySize>builder().put(EntityPose.STANDING, EntityHuman.bh).put(EntityPose.SLEEPING, EntityHuman.ah).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build(); - private static final DataWatcherObject<Float> c = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.c); - private static final DataWatcherObject<Integer> d = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.b); -- protected static final DataWatcherObject<Byte> bi = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); -+ protected static final DataWatcherObject<Byte> bi = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); public static DataWatcherObject<Byte> getSkinPartsWatcher() { return bi; } // Paper - OBFHELPER - protected static final DataWatcherObject<Byte> bj = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); - protected static final DataWatcherObject<NBTTagCompound> bk = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); - protected static final DataWatcherObject<NBTTagCompound> bl = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInSettings.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInSettings.java +@@ -0,0 +0,0 @@ public class PacketPlayInSettings implements Packet<PacketListenerPlayIn> { + packetlistenerplayin.a(this); + } + ++ public EnumChatVisibility getChatVisibility() { return d(); } // Paper - OBFHELPER + public EnumChatVisibility d() { + return this.c; + } + ++ public boolean hasChatColorsEnabled() { return e(); } // Paper - OBFHELPER + public boolean e() { + return this.d; + } + ++ public int getSkinParts() { return f(); } // Paper - OBFHELPER + public int f() { + return this.e; + } +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -0,0 +0,0 @@ package net.minecraft.server; +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -0,0 +0,0 @@ package net.minecraft.server.level; import com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent; import com.google.common.collect.Lists; @@ -126,28 +135,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start if (getMainHand() != packetplayinsettings.getMainHand()) { PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT); -diff --git a/src/main/java/net/minecraft/server/PacketPlayInSettings.java b/src/main/java/net/minecraft/server/PacketPlayInSettings.java +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInSettings.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInSettings.java -@@ -0,0 +0,0 @@ public class PacketPlayInSettings implements Packet<PacketListenerPlayIn> { - packetlistenerplayin.a(this); - } - -+ public EnumChatVisibility getChatVisibility() { return d(); } // Paper - OBFHELPER - public EnumChatVisibility d() { - return this.c; - } - -+ public boolean hasChatColorsEnabled() { return e(); } // Paper - OBFHELPER - public boolean e() { - return this.d; - } - -+ public int getSkinParts() { return f(); } // Paper - OBFHELPER - public int f() { - return this.e; - } +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { + private static final Map<EntityPose, EntitySize> b = ImmutableMap.<EntityPose, EntitySize>builder().put(EntityPose.STANDING, EntityHuman.bh).put(EntityPose.SLEEPING, EntityHuman.ah).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build(); + private static final DataWatcherObject<Float> c = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.c); + private static final DataWatcherObject<Integer> d = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.b); +- protected static final DataWatcherObject<Byte> bi = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); ++ protected static final DataWatcherObject<Byte> bi = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); public static DataWatcherObject<Byte> getSkinPartsWatcher() { return bi; } // Paper - OBFHELPER + protected static final DataWatcherObject<Byte> bj = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); + protected static final DataWatcherObject<NBTTagCompound> bk = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); + protected static final DataWatcherObject<NBTTagCompound> bl = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/Spigot-Server-Patches/Implement-PlayerFlowerPotManipulateEvent.patch b/Spigot-Server-Patches/Implement-PlayerFlowerPotManipulateEvent.patch index 49e761b7fe..63b16a0876 100644 --- a/Spigot-Server-Patches/Implement-PlayerFlowerPotManipulateEvent.patch +++ b/Spigot-Server-Patches/Implement-PlayerFlowerPotManipulateEvent.patch @@ -4,13 +4,13 @@ Date: Tue, 13 Aug 2019 19:45:06 -0700 Subject: [PATCH] Implement PlayerFlowerPotManipulateEvent -diff --git a/src/main/java/net/minecraft/server/BlockFlowerPot.java b/src/main/java/net/minecraft/server/BlockFlowerPot.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockFlowerPot.java b/src/main/java/net/minecraft/world/level/block/BlockFlowerPot.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockFlowerPot.java -+++ b/src/main/java/net/minecraft/server/BlockFlowerPot.java -@@ -0,0 +0,0 @@ package net.minecraft.server; - import com.google.common.collect.Maps; - import java.util.Map; +--- a/src/main/java/net/minecraft/world/level/block/BlockFlowerPot.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockFlowerPot.java +@@ -0,0 +0,0 @@ import net.minecraft.world.phys.MovingObjectPositionBlock; + import net.minecraft.world.phys.shapes.VoxelShape; + import net.minecraft.world.phys.shapes.VoxelShapeCollision; +import io.papermc.paper.event.player.PlayerFlowerPotManipulateEvent; // Paper + diff --git a/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch b/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch index 180897ecb4..b17b69f64c 100644 --- a/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch +++ b/Spigot-Server-Patches/Implement-PlayerLocaleChangeEvent.patch @@ -4,10 +4,10 @@ Date: Tue, 19 Apr 2016 14:09:31 -0500 Subject: [PATCH] Implement PlayerLocaleChangeEvent -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { return s; } diff --git a/Spigot-Server-Patches/Implement-PlayerPostRespawnEvent.patch b/Spigot-Server-Patches/Implement-PlayerPostRespawnEvent.patch index 88df875693..1c48e3be5d 100644 --- a/Spigot-Server-Patches/Implement-PlayerPostRespawnEvent.patch +++ b/Spigot-Server-Patches/Implement-PlayerPostRespawnEvent.patch @@ -4,10 +4,10 @@ Date: Fri, 26 Oct 2018 21:31:00 -0700 Subject: [PATCH] Implement PlayerPostRespawnEvent -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { // this.a(entityplayer1, entityplayer, worldserver1); // CraftBukkit - removed boolean flag2 = false; diff --git a/Spigot-Server-Patches/Implement-TargetHitEvent.patch b/Spigot-Server-Patches/Implement-TargetHitEvent.patch index f28c99a575..888f960e03 100644 --- a/Spigot-Server-Patches/Implement-TargetHitEvent.patch +++ b/Spigot-Server-Patches/Implement-TargetHitEvent.patch @@ -4,17 +4,17 @@ Date: Wed, 25 Nov 2020 23:20:44 -0800 Subject: [PATCH] Implement TargetHitEvent -diff --git a/src/main/java/net/minecraft/server/BlockTarget.java b/src/main/java/net/minecraft/server/BlockTarget.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockTarget.java b/src/main/java/net/minecraft/world/level/block/BlockTarget.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockTarget.java -+++ b/src/main/java/net/minecraft/server/BlockTarget.java +--- a/src/main/java/net/minecraft/world/level/block/BlockTarget.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockTarget.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.world.level.block; +import io.papermc.paper.event.block.TargetHitEvent; // Paper - Need to import because 'io' class exists in nms import java.util.Random; - - public class BlockTarget extends Block { + import net.minecraft.advancements.CriterionTriggers; + import net.minecraft.core.BlockPosition; @@ -0,0 +0,0 @@ public class BlockTarget extends Block { @Override public void a(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) { diff --git a/Spigot-Server-Patches/Implement-alternative-item-despawn-rate.patch b/Spigot-Server-Patches/Implement-alternative-item-despawn-rate.patch index 1a6c5e7900..bbd21c7d53 100644 --- a/Spigot-Server-Patches/Implement-alternative-item-despawn-rate.patch +++ b/Spigot-Server-Patches/Implement-alternative-item-despawn-rate.patch @@ -77,14 +77,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } } -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -0,0 +0,0 @@ import java.util.UUID; - import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +@@ -0,0 +0,0 @@ import net.minecraft.world.phys.Vec3D; // CraftBukkit start + import net.minecraft.server.MinecraftServer; +import org.bukkit.Material; // Paper import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent; 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 edfb7b9df4..7bf11946f3 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 @@ -4,10 +4,10 @@ Date: Wed, 12 Sep 2018 18:53:55 +0300 Subject: [PATCH] Implement an API for CanPlaceOn and CanDestroy NBT values -diff --git a/src/main/java/net/minecraft/server/ArgumentBlock.java b/src/main/java/net/minecraft/server/ArgumentBlock.java +diff --git a/src/main/java/net/minecraft/commands/arguments/blocks/ArgumentBlock.java b/src/main/java/net/minecraft/commands/arguments/blocks/ArgumentBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ArgumentBlock.java -+++ b/src/main/java/net/minecraft/server/ArgumentBlock.java +--- a/src/main/java/net/minecraft/commands/arguments/blocks/ArgumentBlock.java ++++ b/src/main/java/net/minecraft/commands/arguments/blocks/ArgumentBlock.java @@ -0,0 +0,0 @@ public class ArgumentBlock { private final boolean j; private final Map<IBlockState<?>, Comparable<?>> k = Maps.newLinkedHashMap(); // CraftBukkit - stable diff --git a/Spigot-Server-Patches/Implement-ensureServerConversions-API.patch b/Spigot-Server-Patches/Implement-ensureServerConversions-API.patch index 6e0e96ffeb..0cfb2eccf5 100644 --- a/Spigot-Server-Patches/Implement-ensureServerConversions-API.patch +++ b/Spigot-Server-Patches/Implement-ensureServerConversions-API.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java @@ -0,0 +0,0 @@ public final class CraftItemFactory implements ItemFactory { - final net.minecraft.server.NBTTagCompound tag = CraftItemStack.asNMSCopy(item).getTag(); + final net.minecraft.nbt.NBTTagCompound tag = CraftItemStack.asNMSCopy(item).getTag(); return net.kyori.adventure.text.event.HoverEvent.showItem(op.apply(net.kyori.adventure.text.event.HoverEvent.ShowItem.of(item.getType().getKey(), item.getAmount(), io.papermc.paper.adventure.PaperAdventure.asBinaryTagHolder(tag)))); } + diff --git a/Spigot-Server-Patches/Implement-extended-PaperServerListPingEvent.patch b/Spigot-Server-Patches/Implement-extended-PaperServerListPingEvent.patch index 129becd7c0..268e9aaaab 100644 --- a/Spigot-Server-Patches/Implement-extended-PaperServerListPingEvent.patch +++ b/Spigot-Server-Patches/Implement-extended-PaperServerListPingEvent.patch @@ -77,7 +77,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import javax.annotation.Nonnull; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.NetworkManager; -+import net.minecraft.server.PacketStatusOutServerInfo; ++import net.minecraft.network.protocol.game.PacketStatusOutServerInfo; +import net.minecraft.server.ServerPing; + +public final class StandardPaperServerListPingEventImpl extends PaperServerListPingEventImpl { @@ -174,6 +174,54 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + +} +diff --git a/src/main/java/net/minecraft/network/protocol/status/PacketStatusOutServerInfo.java b/src/main/java/net/minecraft/network/protocol/status/PacketStatusOutServerInfo.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/protocol/status/PacketStatusOutServerInfo.java ++++ b/src/main/java/net/minecraft/network/protocol/status/PacketStatusOutServerInfo.java +@@ -0,0 +0,0 @@ package net.minecraft.network.protocol.status; + + import com.google.gson.Gson; + import com.google.gson.GsonBuilder; ++import io.papermc.paper.adventure.AdventureComponent; // Paper + import java.io.IOException; + import net.minecraft.network.PacketDataSerializer; + import net.minecraft.network.chat.ChatModifier; +@@ -0,0 +0,0 @@ import net.minecraft.util.ChatTypeAdapterFactory; + + public class PacketStatusOutServerInfo implements Packet<PacketStatusOutListener> { + +- private static final Gson a = (new GsonBuilder()).registerTypeAdapter(ServerPing.ServerData.class, new ServerPing.ServerData.Serializer()).registerTypeAdapter(ServerPing.ServerPingPlayerSample.class, new ServerPing.ServerPingPlayerSample.Serializer()).registerTypeAdapter(ServerPing.class, new ServerPing.Serializer()).registerTypeHierarchyAdapter(IChatBaseComponent.class, new IChatBaseComponent.ChatSerializer()).registerTypeHierarchyAdapter(ChatModifier.class, new ChatModifier.ChatModifierSerializer()).registerTypeAdapterFactory(new ChatTypeAdapterFactory()).create(); ++ private static final Gson a = (new GsonBuilder()).registerTypeAdapter(ServerPing.ServerData.class, new ServerPing.ServerData.Serializer()).registerTypeAdapter(ServerPing.ServerPingPlayerSample.class, new ServerPing.ServerPingPlayerSample.Serializer()).registerTypeAdapter(ServerPing.class, new ServerPing.Serializer()).registerTypeHierarchyAdapter(IChatBaseComponent.class, new IChatBaseComponent.ChatSerializer()).registerTypeHierarchyAdapter(ChatModifier.class, new ChatModifier.ChatModifierSerializer()).registerTypeAdapterFactory(new ChatTypeAdapterFactory()) ++ .registerTypeAdapter(AdventureComponent.class, new AdventureComponent.Serializer()) ++ .create(); + private ServerPing b; + + public PacketStatusOutServerInfo() {} +diff --git a/src/main/java/net/minecraft/network/protocol/status/ServerPing.java b/src/main/java/net/minecraft/network/protocol/status/ServerPing.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/protocol/status/ServerPing.java ++++ b/src/main/java/net/minecraft/network/protocol/status/ServerPing.java +@@ -0,0 +0,0 @@ public class ServerPing { + this.a = ichatbasecomponent; + } + ++ public ServerPingPlayerSample getPlayers() { return b(); } // Paper - OBFHELPER + public ServerPing.ServerPingPlayerSample b() { + return this.b; + } +@@ -0,0 +0,0 @@ public class ServerPing { + return this.b; + } + ++ public GameProfile[] getSample() { return c(); } // Paper - OBFHELPER + public GameProfile[] c() { + return this.c; + } + ++ public void setSample(GameProfile[] sample) { a(sample); } // Paper - OBFHELPER + public void a(GameProfile[] agameprofile) { + this.c = agameprofile; + } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -197,10 +245,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 int j = MathHelper.nextInt(this.r, 0, this.getPlayerCount() - agameprofile.length); for (int k = 0; k < agameprofile.length; ++k) { -diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java +diff --git a/src/main/java/net/minecraft/server/network/PacketStatusListener.java b/src/main/java/net/minecraft/server/network/PacketStatusListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketStatusListener.java -+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java +--- a/src/main/java/net/minecraft/server/network/PacketStatusListener.java ++++ b/src/main/java/net/minecraft/server/network/PacketStatusListener.java @@ -0,0 +0,0 @@ public class PacketStatusListener implements PacketStatusInListener { this.networkManager.close(PacketStatusListener.a); } else { @@ -220,51 +268,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // CraftBukkit end } -diff --git a/src/main/java/net/minecraft/server/PacketStatusOutServerInfo.java b/src/main/java/net/minecraft/server/PacketStatusOutServerInfo.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketStatusOutServerInfo.java -+++ b/src/main/java/net/minecraft/server/PacketStatusOutServerInfo.java -@@ -0,0 +0,0 @@ package net.minecraft.server; - - import com.google.gson.Gson; - import com.google.gson.GsonBuilder; -+import io.papermc.paper.adventure.AdventureComponent; // Paper - import java.io.IOException; - - public class PacketStatusOutServerInfo implements Packet<PacketStatusOutListener> { - -- private static final Gson a = (new GsonBuilder()).registerTypeAdapter(ServerPing.ServerData.class, new ServerPing.ServerData.Serializer()).registerTypeAdapter(ServerPing.ServerPingPlayerSample.class, new ServerPing.ServerPingPlayerSample.Serializer()).registerTypeAdapter(ServerPing.class, new ServerPing.Serializer()).registerTypeHierarchyAdapter(IChatBaseComponent.class, new IChatBaseComponent.ChatSerializer()).registerTypeHierarchyAdapter(ChatModifier.class, new ChatModifier.ChatModifierSerializer()).registerTypeAdapterFactory(new ChatTypeAdapterFactory()).create(); -+ private static final Gson a = (new GsonBuilder()).registerTypeAdapter(ServerPing.ServerData.class, new ServerPing.ServerData.Serializer()).registerTypeAdapter(ServerPing.ServerPingPlayerSample.class, new ServerPing.ServerPingPlayerSample.Serializer()).registerTypeAdapter(ServerPing.class, new ServerPing.Serializer()).registerTypeHierarchyAdapter(IChatBaseComponent.class, new IChatBaseComponent.ChatSerializer()).registerTypeHierarchyAdapter(ChatModifier.class, new ChatModifier.ChatModifierSerializer()).registerTypeAdapterFactory(new ChatTypeAdapterFactory()) -+ .registerTypeAdapter(AdventureComponent.class, new AdventureComponent.Serializer()) -+ .create(); - private ServerPing b; - - public PacketStatusOutServerInfo() {} -diff --git a/src/main/java/net/minecraft/server/ServerPing.java b/src/main/java/net/minecraft/server/ServerPing.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ServerPing.java -+++ b/src/main/java/net/minecraft/server/ServerPing.java -@@ -0,0 +0,0 @@ public class ServerPing { - this.a = ichatbasecomponent; - } - -+ public ServerPingPlayerSample getPlayers() { return b(); } // Paper - OBFHELPER - public ServerPing.ServerPingPlayerSample b() { - return this.b; - } -@@ -0,0 +0,0 @@ public class ServerPing { - return this.b; - } - -+ public GameProfile[] getSample() { return c(); } // Paper - OBFHELPER - public GameProfile[] c() { - return this.c; - } - -+ public void setSample(GameProfile[] sample) { a(sample); } // Paper - OBFHELPER - public void a(GameProfile[] agameprofile) { - this.c = agameprofile; - } diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java diff --git a/Spigot-Server-Patches/Implement-furnace-cook-speed-multiplier-API.patch b/Spigot-Server-Patches/Implement-furnace-cook-speed-multiplier-API.patch index 9502351860..6ab78f1b46 100644 --- a/Spigot-Server-Patches/Implement-furnace-cook-speed-multiplier-API.patch +++ b/Spigot-Server-Patches/Implement-furnace-cook-speed-multiplier-API.patch @@ -10,12 +10,12 @@ to the nearest Integer when updating its current cook time. Modified by: Eric Su <ericsu@alumni.usc.edu> -diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityFurnace.java -+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java -@@ -0,0 +0,0 @@ import java.util.Map; - import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.phys.Vec3D; // CraftBukkit start +import java.util.List; diff --git a/Spigot-Server-Patches/Implement-getI18NDisplayName.patch b/Spigot-Server-Patches/Implement-getI18NDisplayName.patch index 76837e9405..9990e53298 100644 --- a/Spigot-Server-Patches/Implement-getI18NDisplayName.patch +++ b/Spigot-Server-Patches/Implement-getI18NDisplayName.patch @@ -7,10 +7,10 @@ Gets the Display name as seen in the Client. Currently the server only supports the English language. To override this, You must replace the language file embedded in the server jar. -diff --git a/src/main/java/net/minecraft/server/LocaleLanguage.java b/src/main/java/net/minecraft/server/LocaleLanguage.java +diff --git a/src/main/java/net/minecraft/locale/LocaleLanguage.java b/src/main/java/net/minecraft/locale/LocaleLanguage.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LocaleLanguage.java -+++ b/src/main/java/net/minecraft/server/LocaleLanguage.java +--- a/src/main/java/net/minecraft/locale/LocaleLanguage.java ++++ b/src/main/java/net/minecraft/locale/LocaleLanguage.java @@ -0,0 +0,0 @@ public abstract class LocaleLanguage { private static LocaleLanguage c() { @@ -44,7 +44,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + @Override + public String getI18NDisplayName(ItemStack item) { -+ net.minecraft.server.ItemStack nms = null; ++ net.minecraft.world.item.ItemStack nms = null; + if (item instanceof CraftItemStack) { + nms = ((CraftItemStack) item).handle; + } @@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + nms = CraftItemStack.asNMSCopy(item); + } + -+ return nms != null ? net.minecraft.server.LocaleLanguage.getInstance().translateKey(nms.getItem().getName()) : null; ++ return nms != null ? net.minecraft.locale.LocaleLanguage.getInstance().translateKey(nms.getItem().getName()) : null; + } // Paper end } diff --git a/Spigot-Server-Patches/Implemented-BlockFailedDispenseEvent.patch b/Spigot-Server-Patches/Implemented-BlockFailedDispenseEvent.patch index bcf7aab3f3..418a08e302 100644 --- a/Spigot-Server-Patches/Implemented-BlockFailedDispenseEvent.patch +++ b/Spigot-Server-Patches/Implemented-BlockFailedDispenseEvent.patch @@ -4,10 +4,10 @@ Date: Wed, 22 Apr 2020 09:40:38 +0200 Subject: [PATCH] Implemented BlockFailedDispenseEvent -diff --git a/src/main/java/net/minecraft/server/BlockDispenser.java b/src/main/java/net/minecraft/server/BlockDispenser.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockDispenser.java b/src/main/java/net/minecraft/world/level/block/BlockDispenser.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockDispenser.java -+++ b/src/main/java/net/minecraft/server/BlockDispenser.java +--- a/src/main/java/net/minecraft/world/level/block/BlockDispenser.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockDispenser.java @@ -0,0 +0,0 @@ public class BlockDispenser extends BlockTileEntity { int i = tileentitydispenser.h(); @@ -16,10 +16,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 worldserver.triggerEffect(1001, blockposition, 0); } else { ItemStack itemstack = tileentitydispenser.getItem(i); -diff --git a/src/main/java/net/minecraft/server/BlockDropper.java b/src/main/java/net/minecraft/server/BlockDropper.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockDropper.java b/src/main/java/net/minecraft/world/level/block/BlockDropper.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockDropper.java -+++ b/src/main/java/net/minecraft/server/BlockDropper.java +--- a/src/main/java/net/minecraft/world/level/block/BlockDropper.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockDropper.java @@ -0,0 +0,0 @@ public class BlockDropper extends BlockDispenser { int i = tileentitydispenser.h(); diff --git a/Spigot-Server-Patches/Import-fastutil-classes.patch b/Spigot-Server-Patches/Import-fastutil-classes.patch index d7768bd32a..67ca893d47 100644 --- a/Spigot-Server-Patches/Import-fastutil-classes.patch +++ b/Spigot-Server-Patches/Import-fastutil-classes.patch @@ -4,14 +4,14 @@ Date: Wed, 12 Aug 2020 11:33:04 +0200 Subject: [PATCH] Import fastutil classes -diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java +diff --git a/src/main/java/net/minecraft/network/syncher/DataWatcher.java b/src/main/java/net/minecraft/network/syncher/DataWatcher.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DataWatcher.java -+++ b/src/main/java/net/minecraft/server/DataWatcher.java -@@ -0,0 +0,0 @@ import java.util.Map; - import java.util.concurrent.locks.ReadWriteLock; - import java.util.concurrent.locks.ReentrantReadWriteLock; - import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/network/syncher/DataWatcher.java ++++ b/src/main/java/net/minecraft/network/syncher/DataWatcher.java +@@ -0,0 +0,0 @@ import net.minecraft.CrashReportSystemDetails; + import net.minecraft.ReportedException; + import net.minecraft.network.PacketDataSerializer; + import net.minecraft.world.entity.Entity; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; // Paper import org.apache.commons.lang3.ObjectUtils; import org.apache.logging.log4j.LogManager; diff --git a/Spigot-Server-Patches/Improve-BlockPosition-inlining.patch b/Spigot-Server-Patches/Improve-BlockPosition-inlining.patch index 5561d27712..b4f67f97ea 100644 --- a/Spigot-Server-Patches/Improve-BlockPosition-inlining.patch +++ b/Spigot-Server-Patches/Improve-BlockPosition-inlining.patch @@ -20,10 +20,10 @@ This should result in an across the board speedup in anything that accesses bloc This is based upon conclusions drawn from inspecting the assenmbly generated bythe JIT compiler on my microbenchmarks. They had 'callq' (invoke) instead of 'mov' (get from memory) instructions. -diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java +diff --git a/src/main/java/net/minecraft/core/BaseBlockPosition.java b/src/main/java/net/minecraft/core/BaseBlockPosition.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BaseBlockPosition.java -+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java +--- a/src/main/java/net/minecraft/core/BaseBlockPosition.java ++++ b/src/main/java/net/minecraft/core/BaseBlockPosition.java @@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> { this(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); } @@ -61,10 +61,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.e; } -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java +diff --git a/src/main/java/net/minecraft/core/BlockPosition.java b/src/main/java/net/minecraft/core/BlockPosition.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java +--- a/src/main/java/net/minecraft/core/BlockPosition.java ++++ b/src/main/java/net/minecraft/core/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { return a(this.getX(), this.getY(), this.getZ()); } diff --git a/Spigot-Server-Patches/Improve-Chunk-Status-Transition-Speed.patch b/Spigot-Server-Patches/Improve-Chunk-Status-Transition-Speed.patch index b18c0d5013..9f76c26f75 100644 --- a/Spigot-Server-Patches/Improve-Chunk-Status-Transition-Speed.patch +++ b/Spigot-Server-Patches/Improve-Chunk-Status-Transition-Speed.patch @@ -35,10 +35,10 @@ scenario / path: Previously would have hopped to SERVER around 12+ times there extra. -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { this.playersInChunkTickRange = this.chunkMap.playerChunkTickRangeMap.getObjectsInRange(key); } @@ -53,10 +53,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper start - no-tick view distance public final Chunk getSendingChunk() { -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return either.mapLeft((list) -> { return (Chunk) list.get(list.size() / 2); diff --git a/Spigot-Server-Patches/Improve-EntityShootBowEvent.patch b/Spigot-Server-Patches/Improve-EntityShootBowEvent.patch index 2288e3565c..2759a893a3 100644 --- a/Spigot-Server-Patches/Improve-EntityShootBowEvent.patch +++ b/Spigot-Server-Patches/Improve-EntityShootBowEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Improve EntityShootBowEvent Adds missing call to Illagers and also adds Arrow ItemStack to skeltons -diff --git a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java b/src/main/java/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java -+++ b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java @@ -0,0 +0,0 @@ public class EntityIllagerIllusioner extends EntityIllagerWizard implements IRan double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2); @@ -29,16 +29,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } class a extends EntityIllagerWizard.PathfinderGoalCastSpell { -diff --git a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java -+++ b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java @@ -0,0 +0,0 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4)); // CraftBukkit start -- org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), null, entityarrow, EnumHand.MAIN_HAND, 0.8F, true); -+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), entityarrow.getOriginalItemStack(), entityarrow, EnumHand.MAIN_HAND, 0.8F, true); // Paper +- org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), null, entityarrow, net.minecraft.world.EnumHand.MAIN_HAND, 0.8F, true); ++ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), entityarrow.getOriginalItemStack(), entityarrow, net.minecraft.world.EnumHand.MAIN_HAND, 0.8F, true); // Paper if (event.isCancelled()) { event.getProjectile().remove(); return; diff --git a/Spigot-Server-Patches/Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch b/Spigot-Server-Patches/Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch index b6fc68bc8d..13b95abc78 100644 --- a/Spigot-Server-Patches/Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch +++ b/Spigot-Server-Patches/Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Improve EntityTargetLivingEntityEvent for 1.16 mobs CraftBukkit has a bug in their implementation and is incorrectly handling forget Also adds more target reasons for why it forgot target. -diff --git a/src/main/java/net/minecraft/server/BehaviorAttackTargetForget.java b/src/main/java/net/minecraft/server/BehaviorAttackTargetForget.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BehaviorAttackTargetForget.java -+++ b/src/main/java/net/minecraft/server/BehaviorAttackTargetForget.java +--- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.java ++++ b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.java @@ -0,0 +0,0 @@ public class BehaviorAttackTargetForget<E extends EntityInsentient> extends Beha protected void a(WorldServer worldserver, E e0, long i) { diff --git a/Spigot-Server-Patches/Improve-Maps-in-item-frames-performance-and-bug-fixe.patch b/Spigot-Server-Patches/Improve-Maps-in-item-frames-performance-and-bug-fixe.patch index 7f5a361730..0b84ffaa95 100644 --- a/Spigot-Server-Patches/Improve-Maps-in-item-frames-performance-and-bug-fixe.patch +++ b/Spigot-Server-Patches/Improve-Maps-in-item-frames-performance-and-bug-fixe.patch @@ -12,10 +12,22 @@ custom renderers are in use, defaulting to the much simpler Vanilla system. Additionally, numerous issues to player position tracking on maps has been fixed. -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + { + if ( iter.next().trackee == entity ) + { ++ map.decorations.remove(entity.getDisplayName().getString()); // Paper + iter.remove(); + } + } +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { return null; } @@ -29,10 +41,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return entityitem; } -diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java +diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java b/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldMap.java -+++ b/src/main/java/net/minecraft/server/WorldMap.java +--- a/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java ++++ b/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java @@ -0,0 +0,0 @@ public class WorldMap extends PersistentBase { private final Map<String, MapIconBanner> m = Maps.newHashMap(); public final Map<String, MapIcon> decorations = Maps.newLinkedHashMap(); @@ -101,18 +113,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for ( org.bukkit.map.MapCursor cursor : render.cursors) { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - { - if ( iter.next().trackee == entity ) - { -+ map.decorations.remove(entity.getDisplayName().getString()); // Paper - iter.remove(); - } - } diff --git a/src/main/java/org/bukkit/craftbukkit/map/RenderData.java b/src/main/java/org/bukkit/craftbukkit/map/RenderData.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/map/RenderData.java diff --git a/Spigot-Server-Patches/Improve-Server-Thread-Pool-and-Thread-Priorities.patch b/Spigot-Server-Patches/Improve-Server-Thread-Pool-and-Thread-Priorities.patch index 2906c69395..df6f2dcdf3 100644 --- a/Spigot-Server-Patches/Improve-Server-Thread-Pool-and-Thread-Priorities.patch +++ b/Spigot-Server-Patches/Improve-Server-Thread-Pool-and-Thread-Priorities.patch @@ -11,41 +11,10 @@ server threads Allow usage of a single thread executor by not using ForkJoin so single core CPU's. -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +diff --git a/src/main/java/net/minecraft/SystemUtils.java b/src/main/java/net/minecraft/SystemUtils.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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<TickTas - S s0 = function.apply(thread); // CraftBukkit - decompile error - - atomicreference.set(s0); -+ thread.setPriority(Thread.NORM_PRIORITY+2); // Paper - boost priority - thread.start(); - return s0; - } -diff --git a/src/main/java/net/minecraft/server/ServerWorkerThread.java b/src/main/java/net/minecraft/server/ServerWorkerThread.java -new file mode 100644 -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/ServerWorkerThread.java -@@ -0,0 +0,0 @@ -+package net.minecraft.server; -+ -+import java.util.concurrent.atomic.AtomicInteger; -+ -+public class ServerWorkerThread extends Thread { -+ private static final AtomicInteger threadId = new AtomicInteger(1); -+ public ServerWorkerThread(Runnable target, String poolName, int prioritityModifier) { -+ super(target, "Worker-" + poolName + "-" + threadId.getAndIncrement()); -+ setPriority(Thread.NORM_PRIORITY+prioritityModifier); // Deprioritize over main -+ this.setDaemon(true); -+ this.setUncaughtExceptionHandler(SystemUtils::onThreadError); -+ } -+} -diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SystemUtils.java -+++ b/src/main/java/net/minecraft/server/SystemUtils.java +--- a/src/main/java/net/minecraft/SystemUtils.java ++++ b/src/main/java/net/minecraft/SystemUtils.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; public class SystemUtils { @@ -97,3 +66,35 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private static void a(Thread thread, Throwable throwable) { c(throwable); if (throwable instanceof CompletionException) { +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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<TickTas + S s0 = function.apply(thread); // CraftBukkit - decompile error + + atomicreference.set(s0); ++ thread.setPriority(Thread.NORM_PRIORITY+2); // Paper - boost priority + thread.start(); + return s0; + } +diff --git a/src/main/java/net/minecraft/server/ServerWorkerThread.java b/src/main/java/net/minecraft/server/ServerWorkerThread.java +new file mode 100644 +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/ServerWorkerThread.java +@@ -0,0 +0,0 @@ ++package net.minecraft.server; ++ ++import net.minecraft.SystemUtils; ++import java.util.concurrent.atomic.AtomicInteger; ++ ++public class ServerWorkerThread extends Thread { ++ private static final AtomicInteger threadId = new AtomicInteger(1); ++ public ServerWorkerThread(Runnable target, String poolName, int prioritityModifier) { ++ super(target, "Worker-" + poolName + "-" + threadId.getAndIncrement()); ++ setPriority(Thread.NORM_PRIORITY+prioritityModifier); // Deprioritize over main ++ this.setDaemon(true); ++ this.setUncaughtExceptionHandler(SystemUtils::onThreadError); ++ } ++} diff --git a/Spigot-Server-Patches/Improve-ServerGUI.patch b/Spigot-Server-Patches/Improve-ServerGUI.patch index a1b3acabfd..f52900de1d 100644 --- a/Spigot-Server-Patches/Improve-ServerGUI.patch +++ b/Spigot-Server-Patches/Improve-ServerGUI.patch @@ -39,10 +39,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); + } } -diff --git a/src/main/java/net/minecraft/server/GuiStatsComponent.java b/src/main/java/net/minecraft/server/GuiStatsComponent.java +diff --git a/src/main/java/net/minecraft/server/gui/GuiStatsComponent.java b/src/main/java/net/minecraft/server/gui/GuiStatsComponent.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/GuiStatsComponent.java -+++ b/src/main/java/net/minecraft/server/GuiStatsComponent.java +--- a/src/main/java/net/minecraft/server/gui/GuiStatsComponent.java ++++ b/src/main/java/net/minecraft/server/gui/GuiStatsComponent.java @@ -0,0 +0,0 @@ public class GuiStatsComponent extends JComponent { }); private final int[] b = new int[256]; @@ -82,12 +82,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end } -diff --git a/src/main/java/net/minecraft/server/ServerGUI.java b/src/main/java/net/minecraft/server/ServerGUI.java +diff --git a/src/main/java/net/minecraft/server/gui/ServerGUI.java b/src/main/java/net/minecraft/server/gui/ServerGUI.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ServerGUI.java -+++ b/src/main/java/net/minecraft/server/ServerGUI.java -@@ -0,0 +0,0 @@ import javax.swing.text.BadLocationException; - import javax.swing.text.Document; +--- a/src/main/java/net/minecraft/server/gui/ServerGUI.java ++++ b/src/main/java/net/minecraft/server/gui/ServerGUI.java +@@ -0,0 +0,0 @@ import net.minecraft.DefaultUncaughtExceptionHandler; + import net.minecraft.server.dedicated.DedicatedServer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +// Paper start diff --git a/Spigot-Server-Patches/Improve-death-events.patch b/Spigot-Server-Patches/Improve-death-events.patch index dce167cb26..4efaaff622 100644 --- a/Spigot-Server-Patches/Improve-death-events.patch +++ b/Spigot-Server-Patches/Improve-death-events.patch @@ -14,10 +14,61 @@ to cancel the death which has the benefit of also receiving the dropped items and experience which is otherwise only properly possible by using internal code. -diff --git a/src/main/java/net/minecraft/server/CombatTracker.java b/src/main/java/net/minecraft/server/CombatTracker.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CombatTracker.java -+++ b/src/main/java/net/minecraft/server/CombatTracker.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + public int ping; + public boolean viewingCredits; + private int containerUpdateDelay; // Paper ++ // Paper start - cancellable death event ++ public boolean queueHealthUpdatePacket = false; ++ public net.minecraft.network.protocol.game.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; ++ // Paper end + + // CraftBukkit start + public String displayName; +@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + IChatBaseComponent defaultMessage = this.getCombatTracker().getDeathMessage(); + + org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, PaperAdventure.asAdventure(defaultMessage), defaultMessage.getString(), keepInventory); // Paper - Adventure ++ // Paper start - cancellable death event ++ if (event.isCancelled()) { ++ // make compatible with plugins that might have already set the health in an event listener ++ if (this.getHealth() <= 0) { ++ this.setHealth((float) event.getReviveHealth()); ++ } ++ return; ++ } ++ // Paper end + + // SPIGOT-943 - only call if they have an inventory open + if (this.activeContainer != this.defaultContainer) { +@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + } + } + } +- +- return super.damageEntity(damagesource, f); ++ // Paper start - cancellable death events ++ //return super.damageEntity(damagesource, f); ++ this.queueHealthUpdatePacket = true; ++ boolean damaged = super.damageEntity(damagesource, f); ++ this.queueHealthUpdatePacket = false; ++ if (this.queuedHealthUpdatePacket != null) { ++ this.playerConnection.sendPacket(this.queuedHealthUpdatePacket); ++ this.queuedHealthUpdatePacket = null; ++ } ++ return damaged; ++ // Paper end + } + } + } +diff --git a/src/main/java/net/minecraft/world/damagesource/CombatTracker.java b/src/main/java/net/minecraft/world/damagesource/CombatTracker.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/damagesource/CombatTracker.java ++++ b/src/main/java/net/minecraft/world/damagesource/CombatTracker.java @@ -0,0 +0,0 @@ public class CombatTracker { this.h = null; } @@ -26,11 +77,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void g() { int i = this.f ? 300 : 100; -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } // CraftBukkit end @@ -38,7 +89,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void a(Entity entity, int i, DamageSource damagesource) { if (entity instanceof EntityPlayer) { CriterionTriggers.c.a((EntityPlayer) entity, this, damagesource); -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne this.fallDistance = 0.0F; } @@ -46,82 +97,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void a(WorldServer worldserver, EntityLiving entityliving) {} protected void l(double d0, double d1, double d2) { -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - - @Override - public void killEntity() { -- org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event -+ org.bukkit.event.entity.EntityDeathEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event // Paper - make cancellable -+ if (event.isCancelled()) return; // Paper - make cancellable - this.die(); - } - -diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFox.java -+++ b/src/main/java/net/minecraft/server/EntityFox.java -@@ -0,0 +0,0 @@ public class EntityFox extends EntityAnimal { - } - - @Override -- protected void d(DamageSource damagesource) { -- ItemStack itemstack = this.getEquipment(EnumItemSlot.MAINHAND); -+ protected org.bukkit.event.entity.EntityDeathEvent d(DamageSource damagesource) { // Paper -+ ItemStack itemstack = this.getEquipment(EnumItemSlot.MAINHAND).cloneItemStack(); // Paper -+ -+ // Paper start - Cancellable death event -+ org.bukkit.event.entity.EntityDeathEvent deathEvent = super.d(damagesource); -+ -+ // Below is code to drop -+ -+ if (deathEvent == null || deathEvent.isCancelled()) { -+ return deathEvent; -+ } -+ // Paper end - - if (!itemstack.isEmpty()) { - this.a(itemstack); - this.setSlot(EnumItemSlot.MAINHAND, ItemStack.b); - } - -- super.d(damagesource); -+ return deathEvent; // Paper - } - - public static boolean a(EntityFox entityfox, EntityLiving entityliving) { -diff --git a/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java b/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java -@@ -0,0 +0,0 @@ public abstract class EntityHorseChestedAbstract extends EntityHorseAbstract { - this.a((IMaterial) Blocks.CHEST); - } - -- this.setCarryingChest(false); -+ //this.setCarryingChest(false); // Paper - moved to post death logic - } - - } - -+ // Paper start -+ protected void postDeathDropItems(org.bukkit.event.entity.EntityDeathEvent event) { -+ if (this.isCarryingChest() && (event == null || !event.isCancelled())) { -+ this.setCarryingChest(false); -+ } -+ } -+ // Paper end -+ - @Override - public void saveData(NBTTagCompound nbttagcompound) { - super.saveData(nbttagcompound); -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { protected float aL; protected float aM; @@ -273,57 +252,78 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected float dH() { 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 +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityFox.java b/src/main/java/net/minecraft/world/entity/animal/EntityFox.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - public int ping; - public boolean viewingCredits; - private int containerUpdateDelay; // Paper -+ // Paper start - cancellable death event -+ public boolean queueHealthUpdatePacket = false; -+ public net.minecraft.server.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; -+ // Paper end +--- a/src/main/java/net/minecraft/world/entity/animal/EntityFox.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityFox.java +@@ -0,0 +0,0 @@ public class EntityFox extends EntityAnimal { + } - // CraftBukkit start - public String displayName; -@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - IChatBaseComponent defaultMessage = this.getCombatTracker().getDeathMessage(); - - org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, PaperAdventure.asAdventure(defaultMessage), defaultMessage.getString(), keepInventory); // Paper - Adventure -+ // Paper start - cancellable death event -+ if (event.isCancelled()) { -+ // make compatible with plugins that might have already set the health in an event listener -+ if (this.getHealth() <= 0) { -+ this.setHealth((float) event.getReviveHealth()); -+ } -+ return; + @Override +- protected void d(DamageSource damagesource) { +- ItemStack itemstack = this.getEquipment(EnumItemSlot.MAINHAND); ++ protected org.bukkit.event.entity.EntityDeathEvent d(DamageSource damagesource) { // Paper ++ ItemStack itemstack = this.getEquipment(EnumItemSlot.MAINHAND).cloneItemStack(); // Paper ++ ++ // Paper start - Cancellable death event ++ org.bukkit.event.entity.EntityDeathEvent deathEvent = super.d(damagesource); ++ ++ // Below is code to drop ++ ++ if (deathEvent == null || deathEvent.isCancelled()) { ++ return deathEvent; + } + // Paper end - // SPIGOT-943 - only call if they have an inventory open - if (this.activeContainer != this.defaultContainer) { -@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - } - } - } -- -- return super.damageEntity(damagesource, f); -+ // Paper start - cancellable death events -+ //return super.damageEntity(damagesource, f); -+ this.queueHealthUpdatePacket = true; -+ boolean damaged = super.damageEntity(damagesource, f); -+ this.queueHealthUpdatePacket = false; -+ if (this.queuedHealthUpdatePacket != null) { -+ this.playerConnection.sendPacket(this.queuedHealthUpdatePacket); -+ this.queuedHealthUpdatePacket = null; -+ } -+ return damaged; -+ // Paper end - } + if (!itemstack.isEmpty()) { + this.a(itemstack); + this.setSlot(EnumItemSlot.MAINHAND, ItemStack.b); } + +- super.d(damagesource); ++ return deathEvent; // Paper } + + public static boolean a(EntityFox entityfox, EntityLiving entityliving) { +diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseChestedAbstract.java b/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseChestedAbstract.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseChestedAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseChestedAbstract.java +@@ -0,0 +0,0 @@ public abstract class EntityHorseChestedAbstract extends EntityHorseAbstract { + this.a((IMaterial) Blocks.CHEST); + } + +- this.setCarryingChest(false); ++ //this.setCarryingChest(false); // Paper - moved to post death logic + } + + } + ++ // Paper start ++ protected void postDeathDropItems(org.bukkit.event.entity.EntityDeathEvent event) { ++ if (this.isCarryingChest() && (event == null || !event.isCancelled())) { ++ this.setCarryingChest(false); ++ } ++ } ++ // Paper end ++ + @Override + public void saveData(NBTTagCompound nbttagcompound) { + super.saveData(nbttagcompound); +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { + + @Override + public void killEntity() { +- org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event ++ org.bukkit.event.entity.EntityDeathEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event // Paper - make cancellable ++ if (event.isCancelled()) return; // Paper - make cancellable + this.die(); + } + diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/Spigot-Server-Patches/Improve-inlinig-for-some-hot-IBlockData-methods.patch b/Spigot-Server-Patches/Improve-inlinig-for-some-hot-IBlockData-methods.patch index 77be634af2..0644013f7d 100644 --- a/Spigot-Server-Patches/Improve-inlinig-for-some-hot-IBlockData-methods.patch +++ b/Spigot-Server-Patches/Improve-inlinig-for-some-hot-IBlockData-methods.patch @@ -4,10 +4,10 @@ Date: Mon, 6 Jul 2020 20:46:50 -0700 Subject: [PATCH] Improve inlinig for some hot IBlockData methods -diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java +diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockBase.java -+++ b/src/main/java/net/minecraft/server/BlockBase.java +--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java ++++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java @@ -0,0 +0,0 @@ public abstract class BlockBase { } // Paper end @@ -73,10 +73,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public SoundEffectType getStepSound() { -diff --git a/src/main/java/net/minecraft/server/Fluid.java b/src/main/java/net/minecraft/server/Fluid.java +diff --git a/src/main/java/net/minecraft/world/level/material/Fluid.java b/src/main/java/net/minecraft/world/level/material/Fluid.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Fluid.java -+++ b/src/main/java/net/minecraft/server/Fluid.java +--- a/src/main/java/net/minecraft/world/level/material/Fluid.java ++++ b/src/main/java/net/minecraft/world/level/material/Fluid.java @@ -0,0 +0,0 @@ public final class Fluid extends IBlockDataHolder<FluidType, Fluid> { public static final Codec<Fluid> a = a((Codec) IRegistry.FLUID, FluidType::h).stable(); diff --git a/Spigot-Server-Patches/Improve-the-Saddle-API-for-Horses.patch b/Spigot-Server-Patches/Improve-the-Saddle-API-for-Horses.patch index 09e1fdb7e5..79bc259ca8 100644 --- a/Spigot-Server-Patches/Improve-the-Saddle-API-for-Horses.patch +++ b/Spigot-Server-Patches/Improve-the-Saddle-API-for-Horses.patch @@ -10,7 +10,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java -@@ -0,0 +0,0 @@ import net.minecraft.server.GenericAttributes; +@@ -0,0 +0,0 @@ import net.minecraft.world.entity.animal.horse.EntityHorseAbstract; import org.apache.commons.lang.Validate; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.inventory.CraftInventoryAbstractHorse; @@ -30,7 +30,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse. index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java -@@ -0,0 +0,0 @@ import net.minecraft.server.IInventory; +@@ -0,0 +0,0 @@ import net.minecraft.world.IInventory; import org.bukkit.inventory.HorseInventory; import org.bukkit.inventory.ItemStack; diff --git a/Spigot-Server-Patches/Improved-Watchdog-Support.patch b/Spigot-Server-Patches/Improved-Watchdog-Support.patch index f42f1e2a26..8cac6c5279 100644 --- a/Spigot-Server-Patches/Improved-Watchdog-Support.patch +++ b/Spigot-Server-Patches/Improved-Watchdog-Support.patch @@ -58,10 +58,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Many servers tend to restart at a fixed time at xx:00 which causes an uneven distribution of requests on the // bStats backend. To circumvent this problem, we introduce some randomness into the initial and second delay. -diff --git a/src/main/java/net/minecraft/server/CrashReport.java b/src/main/java/net/minecraft/server/CrashReport.java +diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CrashReport.java -+++ b/src/main/java/net/minecraft/server/CrashReport.java +--- a/src/main/java/net/minecraft/CrashReport.java ++++ b/src/main/java/net/minecraft/CrashReport.java @@ -0,0 +0,0 @@ public class CrashReport { } @@ -70,48 +70,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 while (throwable instanceof CompletionException && throwable.getCause() != null) { throwable = throwable.getCause(); } -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java +diff --git a/src/main/java/net/minecraft/SystemUtils.java b/src/main/java/net/minecraft/SystemUtils.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 - long j = SystemUtils.getMonotonicNanos() - i; - String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D); - -- DedicatedServer.LOGGER.info("Done ({})! For help, type \"help\"", s); -+ //DedicatedServer.LOGGER.info("Done ({})! For help, type \"help\"", s); // Paper moved to after init - if (dedicatedserverproperties.announcePlayerAchievements != null) { - ((GameRules.GameRuleBoolean) this.getGameRules().get(GameRules.ANNOUNCE_ADVANCEMENTS)).a(dedicatedserverproperties.announcePlayerAchievements, (MinecraftServer) this); - } -@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - //this.remoteStatusListener.b(); // Paper - don't wait for remote connections - } - -+ hasFullyShutdown = true; // Paper - System.exit(0); // CraftBukkit +--- a/src/main/java/net/minecraft/SystemUtils.java ++++ b/src/main/java/net/minecraft/SystemUtils.java +@@ -0,0 +0,0 @@ public class SystemUtils { + return SystemUtils.f; } -@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - @Override - public void stop() { - super.stop(); -- SystemUtils.h(); -+ //SystemUtils.h(); // Paper - moved into super - } - - @Override -diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -+++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -@@ -0,0 +0,0 @@ public abstract class IAsyncTaskHandler<R extends Runnable> implements Mailbox<R - try { - r0.run(); - } catch (Exception exception) { -+ if (exception.getCause() instanceof ThreadDeath) throw exception; // Paper - IAsyncTaskHandler.LOGGER.fatal("Error executing task on {}", this.bj(), exception); - } - ++ public static void shutdownServerThreadPool() { h(); } // Paper - OBFHELPER + public static void h() { + a(SystemUtils.e); + a(SystemUtils.f); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -246,7 +216,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas @Override - protected TickTask postToMainThread(Runnable runnable) { + public TickTask postToMainThread(Runnable runnable) { + // Paper start - anything that does try to post to main during watchdog crash, run on watchdog + if (this.hasStopped && Thread.currentThread().equals(shutdownThread)) { + runnable.run(); @@ -274,10 +244,40 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.getPlayerList().reload(); this.customFunctionData.a(this.dataPackResources.a()); this.ak.a(this.dataPackResources.h()); -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + long j = SystemUtils.getMonotonicNanos() - i; + String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D); + +- DedicatedServer.LOGGER.info("Done ({})! For help, type \"help\"", s); ++ //DedicatedServer.LOGGER.info("Done ({})! For help, type \"help\"", s); // Paper moved to after init + if (dedicatedserverproperties.announcePlayerAchievements != null) { + ((GameRules.GameRuleBoolean) this.getGameRules().get(GameRules.ANNOUNCE_ADVANCEMENTS)).a(dedicatedserverproperties.announcePlayerAchievements, (MinecraftServer) this); + } +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + //this.remoteStatusListener.b(); // Paper - don't wait for remote connections + } + ++ hasFullyShutdown = true; // Paper + System.exit(0); // CraftBukkit + } + +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + @Override + public void stop() { + super.stop(); +- SystemUtils.h(); ++ //SystemUtils.h(); // Paper - moved into super + } + + @Override +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { MutableBoolean mutableboolean = new MutableBoolean(); @@ -286,10 +286,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 mutableboolean.setFalse(); list.stream().map((playerchunk) -> { CompletableFuture completablefuture; -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + private final Queue<Entity> entitiesToAdd = Queues.newArrayDeque(); + public final List<EntityPlayer> players = Lists.newArrayList(); // Paper - private -> public + public final ChunkProviderServer chunkProvider; // Paper - public +- boolean tickingEntities; ++ public boolean tickingEntities; // Paper - expose for watchdog + // Paper start + List<java.lang.Runnable> afterEntityTickingTasks = Lists.newArrayList(); + public void doIfNotEntityTicking(java.lang.Runnable run) { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { cserver.getPluginManager().callEvent(playerQuitEvent); entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); @@ -299,22 +312,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit end // Paper start - Remove from collideRule team if needed -diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java +diff --git a/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java b/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SystemUtils.java -+++ b/src/main/java/net/minecraft/server/SystemUtils.java -@@ -0,0 +0,0 @@ public class SystemUtils { - return SystemUtils.f; - } +--- a/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java ++++ b/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java +@@ -0,0 +0,0 @@ public abstract class IAsyncTaskHandler<R extends Runnable> implements Mailbox<R + try { + r0.run(); + } catch (Exception exception) { ++ if (exception.getCause() instanceof ThreadDeath) throw exception; // Paper + IAsyncTaskHandler.LOGGER.fatal("Error executing task on {}", this.bj(), exception); + } -+ public static void shutdownServerThreadPool() { h(); } // Paper - OBFHELPER - public static void h() { - a(SystemUtils.e); - a(SystemUtils.f); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { gameprofilerfiller.exit(); @@ -331,19 +344,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper start - Prevent tile entity and entity crashes String msg = "Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX() + "," + entity.locY() + "," + entity.locZ(); System.err.println(msg); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - private final Queue<Entity> entitiesToAdd = Queues.newArrayDeque(); - public final List<EntityPlayer> players = Lists.newArrayList(); // Paper - private -> public - public final ChunkProviderServer chunkProvider; // Paper - public -- boolean tickingEntities; -+ public boolean tickingEntities; // Paper - expose for watchdog - // Paper start - List<java.lang.Runnable> afterEntityTickingTasks = Lists.newArrayList(); - public void doIfNotEntityTicking(java.lang.Runnable run) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/Spigot-Server-Patches/Incremental-player-saving.patch b/Spigot-Server-Patches/Incremental-player-saving.patch index 1843a32c65..e4000726c4 100644 --- a/Spigot-Server-Patches/Incremental-player-saving.patch +++ b/Spigot-Server-Patches/Incremental-player-saving.patch @@ -24,18 +24,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } } -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -0,0 +0,0 @@ import org.bukkit.inventory.MainHand; - public class EntityPlayer extends EntityHuman implements ICrafting { - - private static final Logger LOGGER = LogManager.getLogger(); -+ public long lastSave = MinecraftServer.currentTick; // Paper - public PlayerConnection playerConnection; - public NetworkManager networkManager; // Paper - public final MinecraftServer server; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -58,10 +46,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 }// Paper // Paper start for (WorldServer world : getWorlds()) { -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -0,0 +0,0 @@ import org.bukkit.inventory.MainHand; + public class EntityPlayer extends EntityHuman implements ICrafting { + + private static final Logger LOGGER = LogManager.getLogger(); ++ public long lastSave = MinecraftServer.currentTick; // Paper + public PlayerConnection playerConnection; + public NetworkManager networkManager; // Paper + public final MinecraftServer server; +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { protected void savePlayerFile(EntityPlayer entityplayer) { if (!entityplayer.getBukkitEntity().isPersistent()) return; // CraftBukkit diff --git a/Spigot-Server-Patches/Inline-shift-direction-fields.patch b/Spigot-Server-Patches/Inline-shift-direction-fields.patch index b8aa048894..a8839ad63d 100644 --- a/Spigot-Server-Patches/Inline-shift-direction-fields.patch +++ b/Spigot-Server-Patches/Inline-shift-direction-fields.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Inline shift direction fields Removes a layer of indirection for EnumDirection.getAdjacent(X|Y|Z)(), which is in the critical section for much of the server, including the lighting engine. -diff --git a/src/main/java/net/minecraft/server/EnumDirection.java b/src/main/java/net/minecraft/server/EnumDirection.java +diff --git a/src/main/java/net/minecraft/core/EnumDirection.java b/src/main/java/net/minecraft/core/EnumDirection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EnumDirection.java -+++ b/src/main/java/net/minecraft/server/EnumDirection.java +--- a/src/main/java/net/minecraft/core/EnumDirection.java ++++ b/src/main/java/net/minecraft/core/EnumDirection.java @@ -0,0 +0,0 @@ public enum EnumDirection implements INamable { }, (enumdirection, enumdirection1) -> { throw new IllegalArgumentException("Duplicate keys"); diff --git a/Spigot-Server-Patches/InventoryCloseEvent-Reason-API.patch b/Spigot-Server-Patches/InventoryCloseEvent-Reason-API.patch index 34225209fd..24cc5dd572 100644 --- a/Spigot-Server-Patches/InventoryCloseEvent-Reason-API.patch +++ b/Spigot-Server-Patches/InventoryCloseEvent-Reason-API.patch @@ -6,37 +6,10 @@ Subject: [PATCH] InventoryCloseEvent Reason API Allows you to determine why an inventory was closed, enabling plugin developers to "confirm" things based on if it was player triggered close or not. -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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.et(); - super.tick(); - if (!this.world.isClientSide && this.activeContainer != null && !this.activeContainer.canUse(this)) { -- this.closeInventory(); -+ this.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper - this.activeContainer = this.defaultContainer; - } - -@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { - return 20; - } - -+ // Paper start - unused code, but to keep signatures aligned -+ public void closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) { -+ closeInventory(); -+ this.activeContainer = this.defaultContainer; -+ } -+ // Paper end -+ - public void closeInventory() { - this.activeContainer = this.defaultContainer; - } -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } // Paper end @@ -87,10 +60,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId)); this.o(); } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + for (TileEntity tileentity : chunk.getTileEntities().values()) { + if (tileentity instanceof net.minecraft.world.IInventory) { + for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((net.minecraft.world.IInventory) tileentity).getViewers())) { +- h.closeInventory(); ++ h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper + } + } + } +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + // Spigot Start + if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder) { + for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) { +- h.closeInventory(); ++ h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper + } + } + // Spigot End +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.CraftItemEvent; import org.bukkit.event.inventory.InventoryAction; @@ -116,10 +111,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.player.o(); } -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { // CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it // See SPIGOT-5799, SPIGOT-6145 @@ -129,28 +124,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getName()))); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - for (TileEntity tileentity : chunk.getTileEntities().values()) { - if (tileentity instanceof IInventory) { - for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((IInventory) tileentity).getViewers())) { -- h.closeInventory(); -+ h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper - } - } +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { + this.et(); + super.tick(); + if (!this.world.isClientSide && this.activeContainer != null && !this.activeContainer.canUse(this)) { +- this.closeInventory(); ++ this.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper + this.activeContainer = this.defaultContainer; } -@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { - // Spigot Start - if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder) { - for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) { -- h.closeInventory(); -+ h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper - } - } - // Spigot End + +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { + return 20; + } + ++ // Paper start - unused code, but to keep signatures aligned ++ public void closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) { ++ closeInventory(); ++ this.activeContainer = this.defaultContainer; ++ } ++ // Paper end ++ + public void closeInventory() { + this.activeContainer = this.defaultContainer; + } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java diff --git a/Spigot-Server-Patches/Item-Rarity-API.patch b/Spigot-Server-Patches/Item-Rarity-API.patch index 3dbf194cdb..84e941ddbc 100644 --- a/Spigot-Server-Patches/Item-Rarity-API.patch +++ b/Spigot-Server-Patches/Item-Rarity-API.patch @@ -4,10 +4,10 @@ Date: Fri, 12 Mar 2021 17:09:42 -0800 Subject: [PATCH] Item Rarity API -diff --git a/src/main/java/net/minecraft/server/Item.java b/src/main/java/net/minecraft/server/Item.java +diff --git a/src/main/java/net/minecraft/world/item/Item.java b/src/main/java/net/minecraft/world/item/Item.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Item.java -+++ b/src/main/java/net/minecraft/server/Item.java +--- a/src/main/java/net/minecraft/world/item/Item.java ++++ b/src/main/java/net/minecraft/world/item/Item.java @@ -0,0 +0,0 @@ public class Item implements IMaterial { protected static final UUID g = UUID.fromString("FA233E1C-4180-4865-B01B-BCCE9785ACA3"); protected static final Random RANDOM = new Random(); @@ -30,7 +30,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues { - return net.minecraft.server.Entity.nextEntityId(); + return net.minecraft.world.entity.Entity.nextEntityId(); } + @Override diff --git a/Spigot-Server-Patches/Item-canEntityPickup.patch b/Spigot-Server-Patches/Item-canEntityPickup.patch index 2f343a1c39..7d40d6629a 100644 --- a/Spigot-Server-Patches/Item-canEntityPickup.patch +++ b/Spigot-Server-Patches/Item-canEntityPickup.patch @@ -4,10 +4,10 @@ Date: Fri, 5 May 2017 03:57:17 -0500 Subject: [PATCH] Item#canEntityPickup -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java @@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { EntityItem entityitem = (EntityItem) iterator.next(); @@ -20,10 +20,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.b(entityitem); } } -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java +--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java @@ -0,0 +0,0 @@ public class EntityItem extends Entity { private UUID owner; public final float b; diff --git a/Spigot-Server-Patches/ItemStack-getMaxItemUseDuration.patch b/Spigot-Server-Patches/ItemStack-getMaxItemUseDuration.patch index c06e7fc429..ad228f3fa5 100644 --- a/Spigot-Server-Patches/ItemStack-getMaxItemUseDuration.patch +++ b/Spigot-Server-Patches/ItemStack-getMaxItemUseDuration.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack#getMaxItemUseDuration Allows you to determine how long it takes to use a usable/consumable item -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -0,0 +0,0 @@ public final class ItemStack { this.getItem().b(this, world, entityhuman); } diff --git a/Spigot-Server-Patches/Lag-compensate-eating.patch b/Spigot-Server-Patches/Lag-compensate-eating.patch index 357e997ecf..9c37cd06e9 100644 --- a/Spigot-Server-Patches/Lag-compensate-eating.patch +++ b/Spigot-Server-Patches/Lag-compensate-eating.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Lag compensate eating When the server is lagging, players will wait longer when eating. Change to also use a time check instead if it passes. -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { private int jumpTicks; private float bw; diff --git a/Spigot-Server-Patches/Lazily-track-plugin-scoreboards-by-default.patch b/Spigot-Server-Patches/Lazily-track-plugin-scoreboards-by-default.patch index 3e53804831..dcf183ed18 100644 --- a/Spigot-Server-Patches/Lazily-track-plugin-scoreboards-by-default.patch +++ b/Spigot-Server-Patches/Lazily-track-plugin-scoreboards-by-default.patch @@ -58,7 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java @@ -0,0 +0,0 @@ public final class CraftScoreboardManager implements ScoreboardManager { - public CraftScoreboardManager(MinecraftServer minecraftserver, net.minecraft.server.Scoreboard scoreboardServer) { + public CraftScoreboardManager(MinecraftServer minecraftserver, net.minecraft.world.scores.Scoreboard scoreboardServer) { mainScoreboard = new CraftScoreboard(scoreboardServer); + mainScoreboard.registeredGlobally = true; // Paper server = minecraftserver; diff --git a/Spigot-Server-Patches/Limit-Client-Sign-length-more.patch b/Spigot-Server-Patches/Limit-Client-Sign-length-more.patch index 9fb3467d31..80b4eab604 100644 --- a/Spigot-Server-Patches/Limit-Client-Sign-length-more.patch +++ b/Spigot-Server-Patches/Limit-Client-Sign-length-more.patch @@ -21,10 +21,10 @@ it only impacts data sent from the client. Set -DPaper.maxSignLength=XX to change limit or -1 to disable -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { private int E; private int receivedMovePackets; diff --git a/Spigot-Server-Patches/Limit-lightning-strike-effect-distance.patch b/Spigot-Server-Patches/Limit-lightning-strike-effect-distance.patch index 1fe55e6757..9744c5ddd7 100644 --- a/Spigot-Server-Patches/Limit-lightning-strike-effect-distance.patch +++ b/Spigot-Server-Patches/Limit-lightning-strike-effect-distance.patch @@ -35,10 +35,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } } -diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLightning.java b/src/main/java/net/minecraft/world/entity/EntityLightning.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLightning.java -+++ b/src/main/java/net/minecraft/server/EntityLightning.java +--- a/src/main/java/net/minecraft/world/entity/EntityLightning.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLightning.java @@ -0,0 +0,0 @@ public class EntityLightning extends Entity { double deltaX = this.locX() - player.locX(); double deltaZ = this.locZ() - player.locZ(); diff --git a/Spigot-Server-Patches/Limit-recipe-packets.patch b/Spigot-Server-Patches/Limit-recipe-packets.patch index 2444a150ec..d93fd17af2 100644 --- a/Spigot-Server-Patches/Limit-recipe-packets.patch +++ b/Spigot-Server-Patches/Limit-recipe-packets.patch @@ -22,32 +22,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static boolean velocitySupport; public static boolean velocityOnlineMode; public static byte[] velocitySecretKey; -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.server.network; +import com.destroystokyo.paper.PaperConfig; import com.google.common.collect.Lists; import com.google.common.primitives.Doubles; import com.google.common.primitives.Floats; -@@ -0,0 +0,0 @@ import java.util.function.Consumer; - import java.util.stream.Collectors; - import java.util.stream.Stream; - import javax.annotation.Nullable; --import org.apache.commons.lang3.StringEscapeUtils; -+ - import org.apache.commons.lang3.StringUtils; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -0,0 +0,0 @@ import io.papermc.paper.adventure.ChatProcessor; // Paper - import io.papermc.paper.adventure.PaperAdventure; // Paper - import java.util.concurrent.ExecutionException; - import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; -+ -+import org.bukkit.Bukkit; +@@ -0,0 +0,0 @@ import net.minecraft.world.inventory.InventoryClickType; + import net.minecraft.world.item.crafting.IRecipe; + import net.minecraft.world.level.RayTrace; + import net.minecraft.world.phys.MovingObjectPosition; ++import org.bukkit.Bukkit; // Paper import org.bukkit.Location; import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.event.CraftEventFactory; diff --git a/Spigot-Server-Patches/LivingEntity-Hand-Raised-Item-Use-API.patch b/Spigot-Server-Patches/LivingEntity-Hand-Raised-Item-Use-API.patch index 135ee86950..2c0d3d8f81 100644 --- a/Spigot-Server-Patches/LivingEntity-Hand-Raised-Item-Use-API.patch +++ b/Spigot-Server-Patches/LivingEntity-Hand-Raised-Item-Use-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] LivingEntity Hand Raised/Item Use API How long an entity has raised hands to charge an attack or use an item -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { private float bu; private int jumpTicks; diff --git a/Spigot-Server-Patches/LivingEntity-setKiller.patch b/Spigot-Server-Patches/LivingEntity-setKiller.patch index 14d6fe494b..fe5da2ba4e 100644 --- a/Spigot-Server-Patches/LivingEntity-setKiller.patch +++ b/Spigot-Server-Patches/LivingEntity-setKiller.patch @@ -4,10 +4,10 @@ Date: Mon, 31 Jul 2017 01:49:48 -0500 Subject: [PATCH] LivingEntity#setKiller -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { public float aE; @Nullable diff --git a/Spigot-Server-Patches/Load-Chunks-for-Login-Asynchronously.patch b/Spigot-Server-Patches/Load-Chunks-for-Login-Asynchronously.patch index 157f5060dd..ca8a9d1811 100644 --- a/Spigot-Server-Patches/Load-Chunks-for-Login-Asynchronously.patch +++ b/Spigot-Server-Patches/Load-Chunks-for-Login-Asynchronously.patch @@ -4,10 +4,10 @@ Date: Sun, 19 Apr 2020 04:28:29 -0400 Subject: [PATCH] Load Chunks for Login Asynchronously -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { return this.serverThreadQueue.executeNext(); } @@ -17,23 +17,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 boolean flag = this.chunkMapDistance.a(this.playerChunkMap); boolean flag1 = this.playerChunkMap.b(); -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 - this.lastY = d1; - this.lastZ = d4; - this.setPosition(d3, d1, d4); -- world.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit -+ if (valid) world.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit // Paper - } - - public void d(Vec3D vec3d) { -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { private static final Logger LOGGER = LogManager.getLogger(); @@ -50,10 +37,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public Integer clientViewDistance; // CraftBukkit end public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java +diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java +--- a/src/main/java/net/minecraft/server/level/TicketType.java ++++ b/src/main/java/net/minecraft/server/level/TicketType.java +@@ -0,0 +0,0 @@ public class TicketType<T> { + public static final TicketType<ChunkCoordIntPair> FORCED = a("forced", Comparator.comparingLong(ChunkCoordIntPair::pair)); + public static final TicketType<ChunkCoordIntPair> LIGHT = a("light", Comparator.comparingLong(ChunkCoordIntPair::pair)); + public static final TicketType<BlockPosition> PORTAL = a("portal", BaseBlockPosition::compareTo, 300); ++ public static final TicketType<Long> LOGIN = a("login", Long::compareTo, 100); // Paper + public static final TicketType<Integer> POST_TELEPORT = a("post_teleport", Integer::compareTo, 5); + public static final TicketType<ChunkCoordIntPair> UNKNOWN = a("unknown", Comparator.comparingLong(ChunkCoordIntPair::pair), 1); + public static final TicketType<Unit> PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { } // Paper end @@ -72,10 +71,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (entityplayer != null) { this.g = LoginListener.EnumProtocolState.DELAY_ACCEPT; -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { private static final Logger LOGGER = LogManager.getLogger(); public final NetworkManager networkManager; @@ -109,10 +108,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.minecraftServer.getMethodProfiler().enter("keepAlive"); // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { private static final SimpleDateFormat g = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z"); private final MinecraftServer server; @@ -254,15 +253,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Iterator iterator = list.iterator(); -diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TicketType.java -+++ b/src/main/java/net/minecraft/server/TicketType.java -@@ -0,0 +0,0 @@ public class TicketType<T> { - public static final TicketType<ChunkCoordIntPair> FORCED = a("forced", Comparator.comparingLong(ChunkCoordIntPair::pair)); - public static final TicketType<ChunkCoordIntPair> LIGHT = a("light", Comparator.comparingLong(ChunkCoordIntPair::pair)); - public static final TicketType<BlockPosition> PORTAL = a("portal", BaseBlockPosition::compareTo, 300); -+ public static final TicketType<Long> LOGIN = a("login", Long::compareTo, 100); // Paper - public static final TicketType<Integer> POST_TELEPORT = a("post_teleport", Integer::compareTo, 5); - public static final TicketType<ChunkCoordIntPair> UNKNOWN = a("unknown", Comparator.comparingLong(ChunkCoordIntPair::pair), 1); - public static final TicketType<Unit> PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + this.lastY = d1; + this.lastZ = d4; + this.setPosition(d3, d1, d4); +- world.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit ++ if (valid) world.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit // Paper + } + + public void d(Vec3D vec3d) { diff --git a/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch b/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch index 4ece59adcc..3c7ced6215 100644 --- a/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch +++ b/Spigot-Server-Patches/LootTable-API-Replenishable-Lootables-Feature.patch @@ -49,9 +49,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package com.destroystokyo.paper.loottable; + -+import net.minecraft.server.BlockPosition; -+import net.minecraft.server.TileEntityLootable; -+import net.minecraft.server.World; ++import net.minecraft.core.BlockPosition; ++import net.minecraft.world.level.World; ++import net.minecraft.world.level.block.entity.TileEntityLootable; +import org.bukkit.Chunk; +import org.bukkit.block.Block; + @@ -88,12 +88,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package com.destroystokyo.paper.loottable; + -+import net.minecraft.server.World; ++import net.minecraft.world.level.World; +import org.bukkit.entity.Entity; + +public interface PaperLootableEntityInventory extends LootableEntityInventory, PaperLootableInventory { + -+ net.minecraft.server.Entity getHandle(); ++ net.minecraft.world.entity.Entity getHandle(); + + @Override + default LootableInventory getAPILootableInventory() { @@ -122,7 +122,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package com.destroystokyo.paper.loottable; + -+import net.minecraft.server.World; ++import net.minecraft.world.level.World; +import org.bukkit.loot.Lootable; + +import java.util.UUID; @@ -200,7 +200,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +package com.destroystokyo.paper.loottable; + +import com.destroystokyo.paper.PaperWorldConfig; -+import net.minecraft.server.*; ++import net.minecraft.nbt.NBTTagCompound; ++import net.minecraft.nbt.NBTTagList; ++import net.minecraft.world.entity.player.EntityHuman; +import org.bukkit.entity.Player; +import org.bukkit.loot.LootTable; + @@ -384,10 +386,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package com.destroystokyo.paper.loottable; + -+import net.minecraft.server.Entity; -+import net.minecraft.server.EntityMinecartContainer; -+import net.minecraft.server.MinecraftKey; -+import net.minecraft.server.World; ++import net.minecraft.world.entity.Entity; ++import net.minecraft.world.entity.vehicle.EntityMinecartContainer; ++import net.minecraft.world.level.World; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.util.CraftNamespacedKey; + @@ -454,9 +455,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +package com.destroystokyo.paper.loottable; + +import net.minecraft.server.MCUtil; -+import net.minecraft.server.MinecraftKey; -+import net.minecraft.server.TileEntityLootable; -+import net.minecraft.server.World; ++import net.minecraft.world.level.World; ++import net.minecraft.world.level.block.entity.TileEntityLootable; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.util.CraftNamespacedKey; + @@ -517,11 +517,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return tileEntityLootable.getWorld(); + } +} -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne }; // Paper end @@ -529,10 +529,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private CraftEntity bukkitEntity; public CraftEntity getBukkitEntity() { -diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartContainer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartContainer.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartContainer.java @@ -0,0 +0,0 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp public long lootTableSeed; @@ -588,10 +588,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.ORIGIN, this.getPositionVector()).a(this.lootTableSeed); if (entityhuman != null) { -diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityLootable.java -+++ b/src/main/java/net/minecraft/server/TileEntityLootable.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java @@ -0,0 +0,0 @@ public abstract class TileEntityLootable extends TileEntityContainer { @Nullable public MinecraftKey lootTable; @@ -677,19 +677,12 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.block; - -+import com.destroystokyo.paper.loottable.PaperLootableBlockInventory; - import net.minecraft.server.MinecraftKey; - import net.minecraft.server.TileEntityLootable; - import org.bukkit.Bukkit; @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey; import org.bukkit.loot.LootTable; import org.bukkit.loot.Lootable; -public abstract class CraftLootable<T extends TileEntityLootable> extends CraftContainer<T> implements Nameable, Lootable { -+public abstract class CraftLootable<T extends TileEntityLootable> extends CraftContainer<T> implements Nameable, Lootable, PaperLootableBlockInventory { // Paper ++public abstract class CraftLootable<T extends TileEntityLootable> extends CraftContainer<T> implements Nameable, Lootable, com.destroystokyo.paper.loottable.PaperLootableBlockInventory { // Paper public CraftLootable(Block block, Class<T> tileEntityClass) { super(block, tileEntityClass); @@ -706,19 +699,12 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.loottable.PaperLootableEntityInventory; // Paper - import net.minecraft.server.EntityMinecartChest; - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.inventory.CraftInventory; @@ -0,0 +0,0 @@ import org.bukkit.entity.minecart.StorageMinecart; import org.bukkit.inventory.Inventory; @SuppressWarnings("deprecation") -public class CraftMinecartChest extends CraftMinecartContainer implements StorageMinecart { -+public class CraftMinecartChest extends CraftMinecartContainer implements StorageMinecart, PaperLootableEntityInventory { // Paper ++public class CraftMinecartChest extends CraftMinecartContainer implements StorageMinecart, com.destroystokyo.paper.loottable.PaperLootableEntityInventory { // Paper private final CraftInventory inventory; public CraftMinecartChest(CraftServer server, EntityMinecartChest entity) { @@ -739,19 +725,12 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.loottable.PaperLootableEntityInventory; // Paper - import net.minecraft.server.EntityMinecartHopper; - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.inventory.CraftInventory; @@ -0,0 +0,0 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.minecart.HopperMinecart; import org.bukkit.inventory.Inventory; -public final class CraftMinecartHopper extends CraftMinecartContainer implements HopperMinecart { -+public final class CraftMinecartHopper extends CraftMinecartContainer implements HopperMinecart, PaperLootableEntityInventory { // Paper ++public final class CraftMinecartHopper extends CraftMinecartContainer implements HopperMinecart, com.destroystokyo.paper.loottable.PaperLootableEntityInventory { // Paper private final CraftInventory inventory; public CraftMinecartHopper(CraftServer server, EntityMinecartHopper entity) { diff --git a/Spigot-Server-Patches/MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch b/Spigot-Server-Patches/MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch index 16487401c2..79bcd84bcf 100644 --- a/Spigot-Server-Patches/MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch +++ b/Spigot-Server-Patches/MC-114618-Fix-EntityAreaEffectCloud-from-going-negat.patch @@ -5,10 +5,10 @@ Subject: [PATCH] MC-114618 - Fix EntityAreaEffectCloud from going negative size -diff --git a/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java b/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityAreaEffectCloud.java b/src/main/java/net/minecraft/world/entity/EntityAreaEffectCloud.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java -+++ b/src/main/java/net/minecraft/server/EntityAreaEffectCloud.java +--- a/src/main/java/net/minecraft/world/entity/EntityAreaEffectCloud.java ++++ b/src/main/java/net/minecraft/world/entity/EntityAreaEffectCloud.java @@ -0,0 +0,0 @@ public class EntityAreaEffectCloud extends Entity { super.tick(); boolean flag = this.k(); 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 13380aac18..30c477e40d 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 @@ -4,10 +4,10 @@ Date: Fri, 3 Aug 2018 00:04:54 -0400 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 +diff --git a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java -+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java +--- a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java ++++ b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java @@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity { public void saveData(NBTTagCompound nbttagcompound) { nbttagcompound.setShort("Health", (short) this.e); diff --git a/Spigot-Server-Patches/MC-145260-Fix-Whitelist-On-Off-inconsistency.patch b/Spigot-Server-Patches/MC-145260-Fix-Whitelist-On-Off-inconsistency.patch index a8888d55f8..803e510225 100644 --- a/Spigot-Server-Patches/MC-145260-Fix-Whitelist-On-Off-inconsistency.patch +++ b/Spigot-Server-Patches/MC-145260-Fix-Whitelist-On-Off-inconsistency.patch @@ -10,10 +10,10 @@ everything to the Whitelist object. https://github.com/PaperMC/Paper/issues/1880 -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { } public boolean isWhitelisted(GameProfile gameprofile, org.bukkit.event.player.PlayerLoginEvent loginEvent) { diff --git a/Spigot-Server-Patches/MC-145656-Fix-Follow-Range-Initial-Target.patch b/Spigot-Server-Patches/MC-145656-Fix-Follow-Range-Initial-Target.patch index 6f243e25a6..4b4528644a 100644 --- a/Spigot-Server-Patches/MC-145656-Fix-Follow-Range-Initial-Target.patch +++ b/Spigot-Server-Patches/MC-145656-Fix-Follow-Range-Initial-Target.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + entitiesTargetWithFollowRange = getBoolean("entities-target-with-follow-range", entitiesTargetWithFollowRange); + } } -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java b/src/main/java/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java +--- a/src/main/java/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java @@ -0,0 +0,0 @@ public class PathfinderGoalNearestAttackableTarget<T extends EntityLiving> exten this.b = i; this.a(EnumSet.of(PathfinderGoal.Type.TARGET)); @@ -30,10 +30,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @Override -diff --git a/src/main/java/net/minecraft/server/PathfinderTargetCondition.java b/src/main/java/net/minecraft/server/PathfinderTargetCondition.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/PathfinderTargetCondition.java b/src/main/java/net/minecraft/world/entity/ai/targeting/PathfinderTargetCondition.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderTargetCondition.java -+++ b/src/main/java/net/minecraft/server/PathfinderTargetCondition.java +--- a/src/main/java/net/minecraft/world/entity/ai/targeting/PathfinderTargetCondition.java ++++ b/src/main/java/net/minecraft/world/entity/ai/targeting/PathfinderTargetCondition.java @@ -0,0 +0,0 @@ public class PathfinderTargetCondition { if (this.b > 0.0D) { diff --git a/Spigot-Server-Patches/MC-147729-Drop-items-that-are-extra-from-a-crafting-.patch b/Spigot-Server-Patches/MC-147729-Drop-items-that-are-extra-from-a-crafting-.patch index 12b886d75f..8959119e76 100644 --- a/Spigot-Server-Patches/MC-147729-Drop-items-that-are-extra-from-a-crafting-.patch +++ b/Spigot-Server-Patches/MC-147729-Drop-items-that-are-extra-from-a-crafting-.patch @@ -4,10 +4,10 @@ Date: Wed, 18 Mar 2020 00:07:46 -0500 Subject: [PATCH] MC-147729: Drop items that are extra from a crafting recipe -diff --git a/src/main/java/net/minecraft/server/AutoRecipe.java b/src/main/java/net/minecraft/server/AutoRecipe.java +diff --git a/src/main/java/net/minecraft/recipebook/AutoRecipe.java b/src/main/java/net/minecraft/recipebook/AutoRecipe.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/AutoRecipe.java -+++ b/src/main/java/net/minecraft/server/AutoRecipe.java +--- a/src/main/java/net/minecraft/recipebook/AutoRecipe.java ++++ b/src/main/java/net/minecraft/recipebook/AutoRecipe.java @@ -0,0 +0,0 @@ public class AutoRecipe<C extends IInventory> implements AutoRecipeAbstract<Inte if (j == -1) { j = this.c.getFirstEmptySlotIndex(); diff --git a/Spigot-Server-Patches/MC-29274-Fix-Wither-hostility-towards-players.patch b/Spigot-Server-Patches/MC-29274-Fix-Wither-hostility-towards-players.patch index a925228dae..9d393a6752 100644 --- a/Spigot-Server-Patches/MC-29274-Fix-Wither-hostility-towards-players.patch +++ b/Spigot-Server-Patches/MC-29274-Fix-Wither-hostility-towards-players.patch @@ -19,10 +19,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("Withers properly target players: " + fixWitherTargetingBug); + } } -diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java +diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityWither.java -+++ b/src/main/java/net/minecraft/server/EntityWither.java +--- a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java ++++ b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java @@ -0,0 +0,0 @@ public class EntityWither extends EntityMonster implements IRangedEntity { this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F)); this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this)); diff --git a/Spigot-Server-Patches/MC-4-Fix-item-position-desync.patch b/Spigot-Server-Patches/MC-4-Fix-item-position-desync.patch index 5122442b0d..8022542323 100644 --- a/Spigot-Server-Patches/MC-4-Fix-item-position-desync.patch +++ b/Spigot-Server-Patches/MC-4-Fix-item-position-desync.patch @@ -22,10 +22,49 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + fixEntityPositionDesync = getBoolean("settings.fix-entity-position-desync", fixEntityPositionDesync); + } } -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutEntity.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutEntity.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutEntity.java +@@ -0,0 +0,0 @@ public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> { + protected boolean i; + + public static long a(double d0) { +- return MathHelper.d(d0 * 4096.0D); ++ return MathHelper.d(d0 * 4096.0D); // Paper - check EntityItem#setPositionRaw on update + } + + public static Vec3D a(long i, long j, long k) { +- return (new Vec3D((double) i, (double) j, (double) k)).a(2.44140625E-4D); ++ return (new Vec3D((double) i, (double) j, (double) k)).a(2.44140625E-4D); // Paper - check EntityItem#setPositionRaw on update + } + + public PacketPlayOutEntity() {} +diff --git a/src/main/java/net/minecraft/util/MathHelper.java b/src/main/java/net/minecraft/util/MathHelper.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/util/MathHelper.java ++++ b/src/main/java/net/minecraft/util/MathHelper.java +@@ -0,0 +0,0 @@ import net.minecraft.core.BaseBlockPosition; + public class MathHelper { + + public static final float a = c(2.0F); +- private static final float[] b = (float[]) SystemUtils.a((Object) (new float[65536]), (afloat) -> { ++ private static final float[] b = (float[]) SystemUtils.a((new float[65536]), (afloat) -> { // Paper - decompile error + for (int i = 0; i < afloat.length; ++i) { + afloat[i] = (float) Math.sin((double) i * 3.141592653589793D * 2.0D / 65536.0D); + } +@@ -0,0 +0,0 @@ public class MathHelper { + return d0 < (double) i ? i - 1 : i; + } + ++ public static long floorLong(double d0) { return d(d0); } // Paper - OBFHELPER + public static long d(double d0) { + long i = (long) d0; + +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java @@ -0,0 +0,0 @@ public class EntityItem extends Entity { public Packet<?> P() { return new PacketPlayOutSpawnEntity(this); @@ -43,42 +82,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end - fix MC-4 } -diff --git a/src/main/java/net/minecraft/server/MathHelper.java b/src/main/java/net/minecraft/server/MathHelper.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MathHelper.java -+++ b/src/main/java/net/minecraft/server/MathHelper.java -@@ -0,0 +0,0 @@ import java.util.function.IntPredicate; - public class MathHelper { - - public static final float a = c(2.0F); -- private static final float[] b = (float[]) SystemUtils.a((Object) (new float[65536]), (afloat) -> { -+ private static final float[] b = (float[]) SystemUtils.a((new float[65536]), (afloat) -> { // Paper - decompile error - for (int i = 0; i < afloat.length; ++i) { - afloat[i] = (float) Math.sin((double) i * 3.141592653589793D * 2.0D / 65536.0D); - } -@@ -0,0 +0,0 @@ public class MathHelper { - return d0 < (double) i ? i - 1 : i; - } - -+ public static long floorLong(double d0) { return d(d0); } // Paper - OBFHELPER - public static long d(double d0) { - long i = (long) d0; - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -@@ -0,0 +0,0 @@ public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> { - protected boolean i; - - public static long a(double d0) { -- return MathHelper.d(d0 * 4096.0D); -+ return MathHelper.d(d0 * 4096.0D); // Paper - check EntityItem#setPositionRaw on update - } - - public static Vec3D a(long i, long j, long k) { -- return (new Vec3D((double) i, (double) j, (double) k)).a(2.44140625E-4D); -+ return (new Vec3D((double) i, (double) j, (double) k)).a(2.44140625E-4D); // Paper - check EntityItem#setPositionRaw on update - } - - public PacketPlayOutEntity() {} diff --git a/Spigot-Server-Patches/MC-50319-Check-other-worlds-for-shooter-of-projectil.patch b/Spigot-Server-Patches/MC-50319-Check-other-worlds-for-shooter-of-projectil.patch index f0d6b6a720..38833ae95c 100644 --- a/Spigot-Server-Patches/MC-50319-Check-other-worlds-for-shooter-of-projectil.patch +++ b/Spigot-Server-Patches/MC-50319-Check-other-worlds-for-shooter-of-projectil.patch @@ -10,10 +10,10 @@ because the entity is in another world. If the projectile fails to find the shooter in the current world, check other worlds. -diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IProjectile.java -+++ b/src/main/java/net/minecraft/server/IProjectile.java +--- a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java @@ -0,0 +0,0 @@ public abstract class IProjectile extends Entity { @Nullable diff --git a/Spigot-Server-Patches/MC-Dev-fixes.patch b/Spigot-Server-Patches/MC-Dev-fixes.patch index aa5e0d08e4..6403dffa53 100644 --- a/Spigot-Server-Patches/MC-Dev-fixes.patch +++ b/Spigot-Server-Patches/MC-Dev-fixes.patch @@ -4,85 +4,54 @@ Date: Wed, 30 Mar 2016 19:36:20 -0400 Subject: [PATCH] MC Dev fixes -diff --git a/src/main/java/net/minecraft/server/ArraySetSorted.java b/src/main/java/net/minecraft/server/ArraySetSorted.java +diff --git a/src/main/java/net/minecraft/SystemUtils.java b/src/main/java/net/minecraft/SystemUtils.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ArraySetSorted.java -+++ b/src/main/java/net/minecraft/server/ArraySetSorted.java -@@ -0,0 +0,0 @@ public class ArraySetSorted<T> extends AbstractSet<T> { +--- a/src/main/java/net/minecraft/SystemUtils.java ++++ b/src/main/java/net/minecraft/SystemUtils.java +@@ -0,0 +0,0 @@ public class SystemUtils { + return Collectors.toMap(Entry::getKey, Entry::getValue); } - public static <T extends Comparable<T>> ArraySetSorted<T> a(int i) { -- return new ArraySetSorted<>(i, Comparator.naturalOrder()); -+ return new ArraySetSorted<>(i, (Comparator)Comparator.naturalOrder()); // Paper - decompile fix +- public static <T extends Comparable<T>> String a(IBlockState<T> iblockstate, Object object) { +- return iblockstate.a((Comparable) object); ++ public static <T extends Comparable<T>> String a(IBlockState<T> iblockstate, T object) { // Paper - decompile fix ++ return iblockstate.a(object); // Paper - decompile fix } - private static <T> T[] a(Object[] aobject) { -- return (Object[]) aobject; -+ return (T[])aobject; // Paper - decompile fix + public static String a(String s, @Nullable MinecraftKey minecraftkey) { +@@ -0,0 +0,0 @@ public class SystemUtils { + public static <T> T b(Iterable<T> iterable, @Nullable T t0) { + Iterator<T> iterator = iterable.iterator(); + +- Object object; +- Object object1; ++ T object; // Paper - decompile fix ++ T object1; // Paper - decompile fix + + for (object1 = null; iterator.hasNext(); object1 = object) { + object = iterator.next(); +@@ -0,0 +0,0 @@ public class SystemUtils { } - private int c(T t0) { -@@ -0,0 +0,0 @@ public class ArraySetSorted<T> extends AbstractSet<T> { + public static <K> Strategy<K> k() { +- return SystemUtils.IdentityHashingStrategy.INSTANCE; ++ return (Strategy<K>) SystemUtils.IdentityHashingStrategy.INSTANCE; // Paper - decompile fix } - public boolean remove(Object object) { -- int i = this.c(object); -+ int i = this.c((T)object); // Paper - decompile fix + public static <V> CompletableFuture<List<V>> b(List<? extends CompletableFuture<? extends V>> list) { +@@ -0,0 +0,0 @@ public class SystemUtils { + list.forEach((completablefuture1) -> { + int i = list1.size(); - if (i >= 0) { - this.d(i); -@@ -0,0 +0,0 @@ public class ArraySetSorted<T> extends AbstractSet<T> { - } - - public boolean contains(Object object) { -- int i = this.c(object); -+ int i = this.c((T)object); // Paper - decompile fix - - return i >= 0; - } -@@ -0,0 +0,0 @@ public class ArraySetSorted<T> extends AbstractSet<T> { - - public <U> U[] toArray(U[] au) { - if (au.length < this.c) { -- return (Object[]) Arrays.copyOf(this.b, this.c, au.getClass()); -+ return (U[])Arrays.copyOf(this.b, this.c, au.getClass()); // Paper - decompile fix - } else { - System.arraycopy(this.b, 0, au, 0, this.c); - if (au.length > this.c) { -diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java +- list1.add((Object) null); ++ list1.add(null); // Paper - decompile fix + acompletablefuture[i] = completablefuture1.whenComplete((object, throwable) -> { + if (throwable != null) { + completablefuture.completeExceptionally(throwable); +diff --git a/src/main/java/net/minecraft/core/BlockPosition.java b/src/main/java/net/minecraft/core/BlockPosition.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BiomeBase.java -+++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - public final class BiomeBase { - - public static final Logger LOGGER = LogManager.getLogger(); -+ // Paper start -+ private static class dProxy extends BiomeBase.d { -+ private dProxy(Precipitation biomebase_precipitation, float f, TemperatureModifier biomebase_temperaturemodifier, float f1) { -+ super(biomebase_precipitation, f, biomebase_temperaturemodifier, f1); -+ } -+ }; -+ // Paper end - public static final Codec<BiomeBase> b = RecordCodecBuilder.create((instance) -> { -- return instance.group(BiomeBase.d.a.forGetter((biomebase) -> { -+ return instance.group(dProxy.a.forGetter((biomebase) -> { // Paper - return biomebase.j; - }), BiomeBase.Geography.r.fieldOf("category").forGetter((biomebase) -> { - return biomebase.o; -@@ -0,0 +0,0 @@ public final class BiomeBase { - })).apply(instance, BiomeBase::new); - }); - public static final Codec<BiomeBase> c = RecordCodecBuilder.create((instance) -> { -- return instance.group(BiomeBase.d.a.forGetter((biomebase) -> { -+ return instance.group(dProxy.a.forGetter((biomebase) -> { // Paper - return biomebase.j; - }), BiomeBase.Geography.r.fieldOf("category").forGetter((biomebase) -> { - return biomebase.o; -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java +--- a/src/main/java/net/minecraft/core/BlockPosition.java ++++ b/src/main/java/net/minecraft/core/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { }; } @@ -138,66 +107,84 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private int h = -1; private int i; private int j; -diff --git a/src/main/java/net/minecraft/server/BlockStateEnum.java b/src/main/java/net/minecraft/server/BlockStateEnum.java +diff --git a/src/main/java/net/minecraft/core/RegistryBlockID.java b/src/main/java/net/minecraft/core/RegistryBlockID.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockStateEnum.java -+++ b/src/main/java/net/minecraft/server/BlockStateEnum.java -@@ -0,0 +0,0 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends IBlockState<T> - protected BlockStateEnum(String s, Class<T> oclass, Collection<T> collection) { - super(s, oclass); - this.a = ImmutableSet.copyOf(collection); -- Iterator iterator = collection.iterator(); -+ Iterator<T> iterator = collection.iterator(); // Paper - decompile fix +--- a/src/main/java/net/minecraft/core/RegistryBlockID.java ++++ b/src/main/java/net/minecraft/core/RegistryBlockID.java +@@ -0,0 +0,0 @@ public class RegistryBlockID<T> implements Registry<T> { + this.b.put(t0, i); - while (iterator.hasNext()) { -- T t0 = (Enum) iterator.next(); -+ T t0 = iterator.next(); // Paper - Decompile fix - String s1 = ((INamable) t0).getName(); - - if (this.b.containsKey(s1)) { -diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CraftingManager.java -+++ b/src/main/java/net/minecraft/server/CraftingManager.java -@@ -0,0 +0,0 @@ public class CraftingManager extends ResourceDataJson { + while (this.c.size() <= i) { +- this.c.add((Object) null); ++ this.c.add(null); // Paper - decompile fix } - this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> { -- return (entry1.getValue()); // CraftBukkit -+ return entry1.getValue(); // CraftBukkit // Paper - decompile fix - *shrugs internally* - })); - CraftingManager.LOGGER.info("Loaded {} recipes", map1.size()); + this.c.set(i, t0); +@@ -0,0 +0,0 @@ public class RegistryBlockID<T> implements Registry<T> { + this.a(t0, this.a); } -diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java + ++ // Paper start - decompile fix ++ @Override ++ public int a(T t) { ++ return getId(t); ++ } ++ // Paper end ++ + public int getId(T t0) { + Integer integer = (Integer) this.b.get(t0); + +diff --git a/src/main/java/net/minecraft/nbt/NBTBase.java b/src/main/java/net/minecraft/nbt/NBTBase.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - } +--- a/src/main/java/net/minecraft/nbt/NBTBase.java ++++ b/src/main/java/net/minecraft/nbt/NBTBase.java +@@ -0,0 +0,0 @@ public interface NBTBase { + + NBTTagType<?> b(); + +- NBTBase clone(); ++ public NBTBase clone(); // Paper - decompile fix + + default String asString() { + return this.toString(); +diff --git a/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java ++++ b/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java +@@ -0,0 +0,0 @@ import java.util.zip.GZIPOutputStream; + import net.minecraft.CrashReport; + import net.minecraft.CrashReportSystemDetails; + import net.minecraft.ReportedException; ++import io.netty.buffer.ByteBufInputStream; // Paper + + public class NBTCompressedStreamTools { + +@@ -0,0 +0,0 @@ public class NBTCompressedStreamTools { + + public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) throws IOException { + // Spigot start +- if ( datainput instanceof io.netty.buffer.ByteBufInputStream ) ++ if ( datainput instanceof ByteBufInputStream) // Paper + { + datainput = new DataInputStream(new org.spigotmc.LimitStream((InputStream) datainput, nbtreadlimiter)); } - -- worldgenendtrophy.b((WorldGenFeatureConfiguration) WorldGenFeatureConfiguration.k).a(this.world, this.world.getChunkProvider().getChunkGenerator(), new Random(), this.exitPortalLocation); -+ worldgenendtrophy.b(WorldGenFeatureConfiguration.k).a(this.world, this.world.getChunkProvider().getChunkGenerator(), new Random(), this.exitPortalLocation); // 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 +diff --git a/src/main/java/net/minecraft/nbt/NBTTagList.java b/src/main/java/net/minecraft/nbt/NBTTagList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVindicator.java -+++ b/src/main/java/net/minecraft/server/EntityVindicator.java -@@ -0,0 +0,0 @@ public class EntityVindicator extends EntityIllagerAbstract { - this.goalSelector.a(2, new EntityIllagerAbstract.b(this)); - this.goalSelector.a(3, new EntityRaider.a(this, 10.0F)); - this.goalSelector.a(4, new EntityVindicator.c(this)); -- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a()); -+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a(new Class[0])); // Paper - decompile fix - this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)); - this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, true)); - this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true)); -diff --git a/src/main/java/net/minecraft/server/EnumProtocol.java b/src/main/java/net/minecraft/server/EnumProtocol.java +--- a/src/main/java/net/minecraft/nbt/NBTTagList.java ++++ b/src/main/java/net/minecraft/nbt/NBTTagList.java +@@ -0,0 +0,0 @@ public class NBTTagList extends NBTList<NBTBase> { + 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<NBTBase> list; + private byte type; + +diff --git a/src/main/java/net/minecraft/network/EnumProtocol.java b/src/main/java/net/minecraft/network/EnumProtocol.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EnumProtocol.java -+++ b/src/main/java/net/minecraft/server/EnumProtocol.java +--- a/src/main/java/net/minecraft/network/EnumProtocol.java ++++ b/src/main/java/net/minecraft/network/EnumProtocol.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; public enum EnumProtocol { @@ -217,10 +204,160 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 object2intopenhashmap.defaultReturnValue(-1); }); this.b = Lists.newArrayList(); -diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -+++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java +--- 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<TickTas + ResourcePackRepository resourcepackrepository = this.resourcePackRepository; + + this.resourcePackRepository.getClass(); +- return stream.map(resourcepackrepository::a).filter(Objects::nonNull).map(ResourcePackLoader::d).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error ++ return stream.<ResourcePackLoader>map(resourcepackrepository::a).filter(Objects::nonNull).map(ResourcePackLoader::d).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error // Paper - decompile error + }, this).thenCompose((immutablelist) -> { +- return DataPackResources.a(immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this); ++ return DataPackResources.a((List<IResourcePack>) immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this); // Paper - decompile error + }).thenAcceptAsync((datapackresources) -> { + this.dataPackResources.close(); + this.dataPackResources = datapackresources; +diff --git a/src/main/java/net/minecraft/server/level/LightEngineThreaded.java b/src/main/java/net/minecraft/server/level/LightEngineThreaded.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/LightEngineThreaded.java ++++ b/src/main/java/net/minecraft/server/level/LightEngineThreaded.java +@@ -0,0 +0,0 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { + + public void queueUpdate() { + if ((!this.c.isEmpty() || super.a()) && this.g.compareAndSet(false, true)) { +- this.b.a((Object) (() -> { ++ this.b.a((() -> { // Paper - decompile error + this.b(); + this.g.set(false); + })); +diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/Ticket.java ++++ b/src/main/java/net/minecraft/server/level/Ticket.java +@@ -0,0 +0,0 @@ public final class Ticket<T> implements Comparable<Ticket<?>> { + } else { + int j = Integer.compare(System.identityHashCode(this.a), System.identityHashCode(ticket.a)); + +- return j != 0 ? j : this.a.a().compare(this.identifier, ticket.identifier); ++ return j != 0 ? j : this.a.a().compare(this.identifier, (T)ticket.identifier); // Paper - decompile fix + } + } + +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + } + + // CraftBukkit - decompile error +- return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<MinecraftKey>::getIntValue).reversed()).limit(5L).map((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> { ++ return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(Object2IntMap.Entry<MinecraftKey>::getIntValue).reversed()).limit(5L).map((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> { // Paper - decompile fix + return it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey() + ":" + it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue(); + }).collect(Collectors.joining(",")); + } catch (Exception exception) { +diff --git a/src/main/java/net/minecraft/stats/ServerStatisticManager.java b/src/main/java/net/minecraft/stats/ServerStatisticManager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/stats/ServerStatisticManager.java ++++ b/src/main/java/net/minecraft/stats/ServerStatisticManager.java +@@ -0,0 +0,0 @@ public class ServerStatisticManager extends StatisticManager { + ObjectIterator objectiterator = this.a.object2IntEntrySet().iterator(); + + while (objectiterator.hasNext()) { +- it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<Statistic<?>> it_unimi_dsi_fastutil_objects_object2intmap_entry = (it.unimi.dsi.fastutil.objects.Object2IntMap.Entry) objectiterator.next(); ++ Object2IntMap.Entry<Statistic<?>> it_unimi_dsi_fastutil_objects_object2intmap_entry = (Object2IntMap.Entry) objectiterator.next(); // Paper - decompile fix + Statistic<?> statistic = (Statistic) it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey(); + + ((JsonObject) map.computeIfAbsent(statistic.getWrapper(), (statisticwrapper) -> { +diff --git a/src/main/java/net/minecraft/util/ArraySetSorted.java b/src/main/java/net/minecraft/util/ArraySetSorted.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/util/ArraySetSorted.java ++++ b/src/main/java/net/minecraft/util/ArraySetSorted.java +@@ -0,0 +0,0 @@ public class ArraySetSorted<T> extends AbstractSet<T> { + } + + public static <T extends Comparable<T>> ArraySetSorted<T> a(int i) { +- return new ArraySetSorted<>(i, Comparator.naturalOrder()); ++ return new ArraySetSorted<>(i, (Comparator)Comparator.naturalOrder()); // Paper - decompile fix + } + + private static <T> T[] a(Object[] aobject) { +- return (Object[]) aobject; ++ return (T[])aobject; // Paper - decompile fix + } + + private int c(T t0) { +@@ -0,0 +0,0 @@ public class ArraySetSorted<T> extends AbstractSet<T> { + } + + public boolean remove(Object object) { +- int i = this.c(object); ++ int i = this.c((T)object); // Paper - decompile fix + + if (i >= 0) { + this.d(i); +@@ -0,0 +0,0 @@ public class ArraySetSorted<T> extends AbstractSet<T> { + } + + public boolean contains(Object object) { +- int i = this.c(object); ++ int i = this.c((T)object); // Paper - decompile fix + + return i >= 0; + } +@@ -0,0 +0,0 @@ public class ArraySetSorted<T> extends AbstractSet<T> { + + public <U> U[] toArray(U[] au) { + if (au.length < this.c) { +- return (Object[]) Arrays.copyOf(this.b, this.c, au.getClass()); ++ return (U[])Arrays.copyOf(this.b, this.c, au.getClass()); // Paper - decompile fix + } else { + System.arraycopy(this.b, 0, au, 0, this.c); + if (au.length > this.c) { +diff --git a/src/main/java/net/minecraft/util/RegistryID.java b/src/main/java/net/minecraft/util/RegistryID.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/util/RegistryID.java ++++ b/src/main/java/net/minecraft/util/RegistryID.java +@@ -0,0 +0,0 @@ public class RegistryID<K> implements Registry<K> { + + public RegistryID(int i) { + i = (int) ((float) i / 0.8F); +- this.b = (Object[]) (new Object[i]); ++ this.b = (K[]) (new Object[i]); // Paper - decompile fix + this.c = new int[i]; +- this.d = (Object[]) (new Object[i]); ++ this.d = (K[]) (new Object[i]); // Paper - decompile fix + } + ++ // Paper start - decompile fix ++ @Override ++ public int a(K k) { ++ return getId(k); ++ } ++ // Paper end ++ + public int getId(@Nullable K k0) { + return this.c(this.b(k0, this.d(k0))); + } +@@ -0,0 +0,0 @@ public class RegistryID<K> implements Registry<K> { + K[] ak = this.b; + int[] aint = this.c; + +- this.b = (Object[]) (new Object[i]); ++ this.b = (K[]) (new Object[i]); // Paper - decompile fix + this.c = new int[i]; +- this.d = (Object[]) (new Object[i]); ++ this.d = (K[]) (new Object[i]); // Paper - decompile fix + this.e = 0; + this.f = 0; + +diff --git a/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java b/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java ++++ b/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java @@ -0,0 +0,0 @@ public abstract class IAsyncTaskHandler<R extends Runnable> implements Mailbox<R return this.executeFuture(runnable); } else { @@ -247,10 +384,212 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return true; } } -diff --git a/src/main/java/net/minecraft/server/IBlockDataHolder.java b/src/main/java/net/minecraft/server/IBlockDataHolder.java +diff --git a/src/main/java/net/minecraft/util/thread/ThreadedMailbox.java b/src/main/java/net/minecraft/util/thread/ThreadedMailbox.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IBlockDataHolder.java -+++ b/src/main/java/net/minecraft/server/IBlockDataHolder.java +--- a/src/main/java/net/minecraft/util/thread/ThreadedMailbox.java ++++ b/src/main/java/net/minecraft/util/thread/ThreadedMailbox.java +@@ -0,0 +0,0 @@ public class ThreadedMailbox<T> implements Mailbox<T>, AutoCloseable, Runnable { + + public void run() { + try { +- this.a((i) -> { ++ this.a((int i) -> { // Paper - decompile fix + return i == 0; + }); + } finally { +diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java ++++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java +@@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { + } + + private static boolean a(ChunkSection chunksection) { +- Set set = VillagePlaceType.x; ++ Set<IBlockData> set = VillagePlaceType.x; // Paper - decompile error + +- set.getClass(); ++ //set.getClass(); // Paper - decompile error + return chunksection.a(set::contains); + } + +@@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { + SectionPosition.b(new ChunkCoordIntPair(blockposition), Math.floorDiv(i, 16)).map((sectionposition) -> { + return Pair.of(sectionposition, this.d(sectionposition.s())); + }).filter((pair) -> { +- return !(Boolean) ((Optional) pair.getSecond()).map(VillagePlaceSection::a).orElse(false); ++ return !(Boolean) (pair.getSecond()).map(VillagePlaceSection::a).orElse(false); // Paper - decompile fix + }).map((pair) -> { + return ((SectionPosition) pair.getFirst()).r(); + }).filter((chunkcoordintpair) -> { +@@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { + + private final Predicate<? super VillagePlaceRecord> d; + +- private Occupancy(Predicate predicate) { ++ private Occupancy(Predicate<? super VillagePlaceRecord> predicate) { // Paper - decompile fix + this.d = predicate; + } + +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java b/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java +@@ -0,0 +0,0 @@ public class EntityVindicator extends EntityIllagerAbstract { + this.goalSelector.a(2, new EntityIllagerAbstract.b(this)); + this.goalSelector.a(3, new EntityRaider.a(this, 10.0F)); + this.goalSelector.a(4, new EntityVindicator.c(this)); +- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a()); ++ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a(new Class[0])); // Paper - decompile fix + this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)); + this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, true)); + this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true)); +diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java ++++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.saveddata.maps.WorldMap; + + public class VillagerTrades { + +- public static final Map<VillagerProfession, Int2ObjectMap<VillagerTrades.IMerchantRecipeOption[]>> a = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> { ++ public static final Map<VillagerProfession, Int2ObjectMap<VillagerTrades.IMerchantRecipeOption[]>> a = SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // Paper - decompile fix + hashmap.put(VillagerProfession.FARMER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WHEAT, 20, 16, 2), new VillagerTrades.b(Items.POTATO, 26, 16, 2), new VillagerTrades.b(Items.CARROT, 22, 16, 2), new VillagerTrades.b(Items.BEETROOT, 15, 16, 2), new VillagerTrades.h(Items.BREAD, 1, 6, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Blocks.PUMPKIN, 6, 12, 10), new VillagerTrades.h(Items.PUMPKIN_PIE, 1, 4, 5), new VillagerTrades.h(Items.APPLE, 1, 4, 16, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.COOKIE, 3, 18, 10), new VillagerTrades.b(Blocks.MELON, 4, 12, 20)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Blocks.CAKE, 1, 1, 12, 15), new VillagerTrades.i(MobEffects.NIGHT_VISION, 100, 15), new VillagerTrades.i(MobEffects.JUMP, 160, 15), new VillagerTrades.i(MobEffects.WEAKNESS, 140, 15), new VillagerTrades.i(MobEffects.BLINDNESS, 120, 15), new VillagerTrades.i(MobEffects.POISON, 280, 15), new VillagerTrades.i(MobEffects.SATURATION, 7, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.GOLDEN_CARROT, 3, 3, 30), new VillagerTrades.h(Items.GLISTERING_MELON_SLICE, 4, 3, 30)}))); +- hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 20, 16, 2), new VillagerTrades.b(Items.COAL, 10, 16, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 16, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COD, 15, 16, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 16, 5), new VillagerTrades.h(Items.rn, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SALMON, 13, 16, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 3, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.TROPICAL_FISH, 6, 12, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PUFFERFISH, 4, 12, 30), new VillagerTrades.c(1, 12, 30, ImmutableMap.builder().put(VillagerType.PLAINS, Items.OAK_BOAT).put(VillagerType.TAIGA, Items.SPRUCE_BOAT).put(VillagerType.SNOW, Items.SPRUCE_BOAT).put(VillagerType.DESERT, Items.JUNGLE_BOAT).put(VillagerType.JUNGLE, Items.JUNGLE_BOAT).put(VillagerType.SAVANNA, Items.ACACIA_BOAT).put(VillagerType.SWAMP, Items.DARK_OAK_BOAT).build())}))); ++ hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 20, 16, 2), new VillagerTrades.b(Items.COAL, 10, 16, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 16, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COD, 15, 16, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 16, 5), new VillagerTrades.h(Items.rn, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SALMON, 13, 16, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 3, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.TROPICAL_FISH, 6, 12, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PUFFERFISH, 4, 12, 30), new VillagerTrades.c(1, 12, 30, ImmutableMap.<VillagerType, Item>builder().put(VillagerType.PLAINS, Items.OAK_BOAT).put(VillagerType.TAIGA, Items.SPRUCE_BOAT).put(VillagerType.SNOW, Items.SPRUCE_BOAT).put(VillagerType.DESERT, Items.JUNGLE_BOAT).put(VillagerType.JUNGLE, Items.JUNGLE_BOAT).put(VillagerType.SAVANNA, Items.ACACIA_BOAT).put(VillagerType.SWAMP, Items.DARK_OAK_BOAT).build())}))); // Paper - add <VillagerType, Item> to ImmutableMap.<VillagerType, Item>.builder() + hashmap.put(VillagerProfession.SHEPHERD, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Blocks.WHITE_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.BROWN_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.BLACK_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.GRAY_WOOL, 18, 16, 2), new VillagerTrades.h(Items.SHEARS, 2, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WHITE_DYE, 12, 16, 10), new VillagerTrades.b(Items.GRAY_DYE, 12, 16, 10), new VillagerTrades.b(Items.BLACK_DYE, 12, 16, 10), new VillagerTrades.b(Items.LIGHT_BLUE_DYE, 12, 16, 10), new VillagerTrades.b(Items.LIME_DYE, 12, 16, 10), new VillagerTrades.h(Blocks.WHITE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.ORANGE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.MAGENTA_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIGHT_BLUE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.YELLOW_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIME_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.PINK_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.GRAY_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIGHT_GRAY_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.CYAN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.PURPLE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BLUE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BROWN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.GREEN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.RED_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BLACK_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.WHITE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.ORANGE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.MAGENTA_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIGHT_BLUE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.YELLOW_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIME_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.PINK_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.GRAY_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIGHT_GRAY_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.CYAN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.PURPLE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BLUE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BROWN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.GREEN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.RED_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BLACK_CARPET, 1, 4, 16, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.YELLOW_DYE, 12, 16, 20), new VillagerTrades.b(Items.LIGHT_GRAY_DYE, 12, 16, 20), new VillagerTrades.b(Items.ORANGE_DYE, 12, 16, 20), new VillagerTrades.b(Items.RED_DYE, 12, 16, 20), new VillagerTrades.b(Items.PINK_DYE, 12, 16, 20), new VillagerTrades.h(Blocks.WHITE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.YELLOW_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.RED_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BLACK_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BLUE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BROWN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.CYAN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.GRAY_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.GREEN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIGHT_BLUE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIGHT_GRAY_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIME_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.MAGENTA_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.ORANGE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.PINK_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.PURPLE_BED, 3, 1, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BROWN_DYE, 12, 16, 30), new VillagerTrades.b(Items.PURPLE_DYE, 12, 16, 30), new VillagerTrades.b(Items.BLUE_DYE, 12, 16, 30), new VillagerTrades.b(Items.GREEN_DYE, 12, 16, 30), new VillagerTrades.b(Items.MAGENTA_DYE, 12, 16, 30), new VillagerTrades.b(Items.CYAN_DYE, 12, 16, 30), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 12, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.PAINTING, 2, 3, 30)}))); + hashmap.put(VillagerProfession.FLETCHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STICK, 32, 16, 2), new VillagerTrades.h(Items.ARROW, 1, 16, 1), new VillagerTrades.g(Blocks.GRAVEL, 10, Items.FLINT, 10, 12, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.FLINT, 26, 12, 10), new VillagerTrades.h(Items.BOW, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 14, 16, 20), new VillagerTrades.h(Items.CROSSBOW, 3, 1, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.FEATHER, 24, 16, 30), new VillagerTrades.e(Items.BOW, 2, 3, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.es, 8, 12, 30), new VillagerTrades.e(Items.CROSSBOW, 3, 3, 15), new VillagerTrades.j(Items.ARROW, 5, Items.TIPPED_ARROW, 5, 2, 12, 30)}))); +- hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.builder().put(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 9, 1, 12, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BOOK, 4, 12, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.rk, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.INK_SAC, 5, 12, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.az, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 12, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); ++ hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.<Integer, IMerchantRecipeOption[]>builder().put(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 9, 1, 12, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BOOK, 4, 12, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.rk, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.INK_SAC, 5, 12, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.az, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 12, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); // Paper - add <Integer, IMerchantRecipeOption[]> to ImmutableMap.<Integer, IMerchantRecipeOption[]>.builder() + hashmap.put(VillagerProfession.CARTOGRAPHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.h(Items.MAP, 7, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.dP, 11, 16, 10), new VillagerTrades.k(13, StructureGenerator.MONUMENT, MapIcon.Type.MONUMENT, 12, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COMPASS, 1, 12, 20), new VillagerTrades.k(14, StructureGenerator.MANSION, MapIcon.Type.MANSION, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.ITEM_FRAME, 7, 1, 15), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.GLOBE_BANNER_PATTERN, 8, 1, 30)}))); + hashmap.put(VillagerProfession.CLERIC, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.ROTTEN_FLESH, 32, 16, 2), new VillagerTrades.h(Items.REDSTONE, 1, 2, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.GOLD_INGOT, 3, 12, 10), new VillagerTrades.h(Items.LAPIS_LAZULI, 1, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.RABBIT_FOOT, 2, 12, 20), new VillagerTrades.h(Blocks.GLOWSTONE, 4, 1, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SCUTE, 4, 12, 30), new VillagerTrades.b(Items.GLASS_BOTTLE, 9, 12, 30), new VillagerTrades.h(Items.ENDER_PEARL, 5, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.NETHER_WART, 22, 12, 30), new VillagerTrades.h(Items.EXPERIENCE_BOTTLE, 3, 1, 30)}))); + hashmap.put(VillagerProfession.ARMORER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COAL, 15, 16, 2), new VillagerTrades.h(new ItemStack(Items.IRON_LEGGINGS), 7, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_BOOTS), 4, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_HELMET), 5, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_CHESTPLATE), 9, 1, 12, 1, 0.2F)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.IRON_INGOT, 4, 12, 10), new VillagerTrades.h(new ItemStack(Items.rj), 36, 1, 12, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_BOOTS), 1, 1, 12, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_LEGGINGS), 3, 1, 12, 5, 0.2F)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.LAVA_BUCKET, 1, 12, 20), new VillagerTrades.b(Items.DIAMOND, 1, 12, 20), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_HELMET), 1, 1, 12, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_CHESTPLATE), 4, 1, 12, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.SHIELD), 5, 1, 12, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.e(Items.DIAMOND_LEGGINGS, 14, 3, 15, 0.2F), new VillagerTrades.e(Items.DIAMOND_BOOTS, 8, 3, 15, 0.2F)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.e(Items.DIAMOND_HELMET, 8, 3, 30, 0.2F), new VillagerTrades.e(Items.DIAMOND_CHESTPLATE, 16, 3, 30, 0.2F)}))); +diff --git a/src/main/java/net/minecraft/world/item/crafting/CraftingManager.java b/src/main/java/net/minecraft/world/item/crafting/CraftingManager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/item/crafting/CraftingManager.java ++++ b/src/main/java/net/minecraft/world/item/crafting/CraftingManager.java +@@ -0,0 +0,0 @@ public class CraftingManager extends ResourceDataJson { + } + + this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> { +- return (entry1.getValue()); // CraftBukkit ++ return entry1.getValue(); // CraftBukkit // Paper - decompile fix - *shrugs internally* + })); + CraftingManager.LOGGER.info("Loaded {} recipes", map1.size()); + } +diff --git a/src/main/java/net/minecraft/world/level/IEntityAccess.java b/src/main/java/net/minecraft/world/level/IEntityAccess.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/IEntityAccess.java ++++ b/src/main/java/net/minecraft/world/level/IEntityAccess.java +@@ -0,0 +0,0 @@ public interface IEntityAccess { + + @Nullable + default <T extends EntityLiving> T a(Class<? extends T> oclass, PathfinderTargetCondition pathfindertargetcondition, @Nullable EntityLiving entityliving, double d0, double d1, double d2, AxisAlignedBB axisalignedbb) { +- return this.a(this.a(oclass, axisalignedbb, (Predicate) null), pathfindertargetcondition, entityliving, d0, d1, d2); ++ return this.a(this.a(oclass, axisalignedbb, null), pathfindertargetcondition, entityliving, d0, d1, d2); // Paper - decompile fix + } + + @Nullable + default <T extends EntityLiving> T b(Class<? extends T> oclass, PathfinderTargetCondition pathfindertargetcondition, @Nullable EntityLiving entityliving, double d0, double d1, double d2, AxisAlignedBB axisalignedbb) { +- return this.a(this.b(oclass, axisalignedbb, (Predicate) null), pathfindertargetcondition, entityliving, d0, d1, d2); ++ return this.a(this.b(oclass, axisalignedbb, null), pathfindertargetcondition, entityliving, d0, d1, d2); // Paper - decompile fix + } + + @Nullable + default <T extends EntityLiving> T a(List<? extends T> list, PathfinderTargetCondition pathfindertargetcondition, @Nullable EntityLiving entityliving, double d0, double d1, double d2) { + double d3 = -1.0D; + T t0 = null; +- Iterator iterator = list.iterator(); ++ Iterator<? extends T> iterator = list.iterator(); // Paper - decompile fix + + while (iterator.hasNext()) { +- T t1 = (EntityLiving) iterator.next(); ++ T t1 = iterator.next(); // Paper - decompile fix + + if (pathfindertargetcondition.a(entityliving, t1)) { + double d4 = t1.h(d0, d1, d2); +@@ -0,0 +0,0 @@ public interface IEntityAccess { + default <T extends EntityLiving> List<T> a(Class<? extends T> oclass, PathfinderTargetCondition pathfindertargetcondition, EntityLiving entityliving, AxisAlignedBB axisalignedbb) { + List<T> list = this.a(oclass, axisalignedbb, (Predicate) null); + List<T> list1 = Lists.newArrayList(); +- Iterator iterator = list.iterator(); ++ Iterator<T> iterator = list.iterator(); // Paper - decompile fix + + while (iterator.hasNext()) { +- T t0 = (EntityLiving) iterator.next(); ++ T t0 = iterator.next(); // Paper - decompile fix + + if (pathfindertargetcondition.a(entityliving, t0)) { + list1.add(t0); +diff --git a/src/main/java/net/minecraft/world/level/NextTickListEntry.java b/src/main/java/net/minecraft/world/level/NextTickListEntry.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/NextTickListEntry.java ++++ b/src/main/java/net/minecraft/world/level/NextTickListEntry.java +@@ -0,0 +0,0 @@ public class NextTickListEntry<T> { + return this.a.hashCode(); + } + +- public static <T> Comparator<NextTickListEntry<T>> a() { ++ public static <T> Comparator<Object> a() { // Paper - decompile fix + return Comparator.comparingLong((nextticklistentry) -> { +- return nextticklistentry.b; ++ return ((NextTickListEntry<T>) nextticklistentry).b; // Paper - decompile fix + }).thenComparing((nextticklistentry) -> { +- return nextticklistentry.c; ++ return ((NextTickListEntry<T>) nextticklistentry).c; // Paper - decompile fix + }).thenComparingLong((nextticklistentry) -> { +- return nextticklistentry.f; ++ return ((NextTickListEntry<T>) nextticklistentry).f; // Paper - decompile fix + }); + } + +diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeBase.java b/src/main/java/net/minecraft/world/level/biome/BiomeBase.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/biome/BiomeBase.java ++++ b/src/main/java/net/minecraft/world/level/biome/BiomeBase.java +@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; + public final class BiomeBase { + + public static final Logger LOGGER = LogManager.getLogger(); ++ // Paper start ++ private static class dProxy extends BiomeBase.d { ++ private dProxy(Precipitation biomebase_precipitation, float f, TemperatureModifier biomebase_temperaturemodifier, float f1) { ++ super(biomebase_precipitation, f, biomebase_temperaturemodifier, f1); ++ } ++ }; ++ // Paper end + public static final Codec<BiomeBase> b = RecordCodecBuilder.create((instance) -> { +- return instance.group(BiomeBase.d.a.forGetter((biomebase) -> { ++ return instance.group(dProxy.a.forGetter((biomebase) -> { // Paper + return biomebase.j; + }), BiomeBase.Geography.r.fieldOf("category").forGetter((biomebase) -> { + return biomebase.o; +@@ -0,0 +0,0 @@ public final class BiomeBase { + })).apply(instance, BiomeBase::new); + }); + public static final Codec<BiomeBase> c = RecordCodecBuilder.create((instance) -> { +- return instance.group(BiomeBase.d.a.forGetter((biomebase) -> { ++ return instance.group(dProxy.a.forGetter((biomebase) -> { // Paper + return biomebase.j; + }), BiomeBase.Geography.r.fieldOf("category").forGetter((biomebase) -> { + return biomebase.o; +diff --git a/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java b/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java ++++ b/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java +@@ -0,0 +0,0 @@ public class TileEntityPiston extends TileEntity implements ITickable { + private static void a(EnumDirection enumdirection, Entity entity, double d0, EnumDirection enumdirection1) { + TileEntityPiston.h.set(enumdirection); + entity.move(EnumMoveType.PISTON, new Vec3D(d0 * (double) enumdirection1.getAdjacentX(), d0 * (double) enumdirection1.getAdjacentY(), d0 * (double) enumdirection1.getAdjacentZ())); +- TileEntityPiston.h.set((Object) null); ++ TileEntityPiston.h.set(null); // Paper - decompile fix + } + + private void g(float f) { +diff --git a/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java b/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java ++++ b/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java @@ -0,0 +0,0 @@ public abstract class IBlockDataHolder<O, S> { } else { IBlockState<?> iblockstate = (IBlockState) entry.getKey(); @@ -306,10 +645,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return s0.getStateMap().isEmpty() ? Codec.unit(s0) : s0.d.fieldOf("Properties").codec(); }); -diff --git a/src/main/java/net/minecraft/server/IBlockState.java b/src/main/java/net/minecraft/server/IBlockState.java +diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IBlockState.java -+++ b/src/main/java/net/minecraft/server/IBlockState.java +--- a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java ++++ b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java +@@ -0,0 +0,0 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends IBlockState<T> + protected BlockStateEnum(String s, Class<T> oclass, Collection<T> collection) { + super(s, oclass); + this.a = ImmutableSet.copyOf(collection); +- Iterator iterator = collection.iterator(); ++ Iterator<T> iterator = collection.iterator(); // Paper - decompile fix + + while (iterator.hasNext()) { +- T t0 = (Enum) iterator.next(); ++ T t0 = iterator.next(); // Paper - Decompile fix + String s1 = ((INamable) t0).getName(); + + if (this.b.containsKey(s1)) { +diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java b/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java ++++ b/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java @@ -0,0 +0,0 @@ public abstract class IBlockState<T extends Comparable<T>> { private final Codec<IBlockState.a<T>> e; @@ -327,54 +683,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.a = oclass; this.b = s; } -diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java b/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IEntityAccess.java -+++ b/src/main/java/net/minecraft/server/IEntityAccess.java -@@ -0,0 +0,0 @@ public interface IEntityAccess { - - @Nullable - default <T extends EntityLiving> T a(Class<? extends T> oclass, PathfinderTargetCondition pathfindertargetcondition, @Nullable EntityLiving entityliving, double d0, double d1, double d2, AxisAlignedBB axisalignedbb) { -- return this.a(this.a(oclass, axisalignedbb, (Predicate) null), pathfindertargetcondition, entityliving, d0, d1, d2); -+ return this.a(this.a(oclass, axisalignedbb, null), pathfindertargetcondition, entityliving, d0, d1, d2); // Paper - decompile fix - } - - @Nullable - default <T extends EntityLiving> T b(Class<? extends T> oclass, PathfinderTargetCondition pathfindertargetcondition, @Nullable EntityLiving entityliving, double d0, double d1, double d2, AxisAlignedBB axisalignedbb) { -- return this.a(this.b(oclass, axisalignedbb, (Predicate) null), pathfindertargetcondition, entityliving, d0, d1, d2); -+ return this.a(this.b(oclass, axisalignedbb, null), pathfindertargetcondition, entityliving, d0, d1, d2); // Paper - decompile fix - } - - @Nullable - default <T extends EntityLiving> T a(List<? extends T> list, PathfinderTargetCondition pathfindertargetcondition, @Nullable EntityLiving entityliving, double d0, double d1, double d2) { - double d3 = -1.0D; - T t0 = null; -- Iterator iterator = list.iterator(); -+ Iterator<? extends T> iterator = list.iterator(); // Paper - decompile fix - - while (iterator.hasNext()) { -- T t1 = (EntityLiving) iterator.next(); -+ T t1 = iterator.next(); // Paper - decompile fix - - if (pathfindertargetcondition.a(entityliving, t1)) { - double d4 = t1.h(d0, d1, d2); -@@ -0,0 +0,0 @@ public interface IEntityAccess { - default <T extends EntityLiving> List<T> a(Class<? extends T> oclass, PathfinderTargetCondition pathfindertargetcondition, EntityLiving entityliving, AxisAlignedBB axisalignedbb) { - List<T> list = this.a(oclass, axisalignedbb, (Predicate) null); - List<T> list1 = Lists.newArrayList(); -- Iterator iterator = list.iterator(); -+ Iterator<T> iterator = list.iterator(); // Paper - decompile fix - - while (iterator.hasNext()) { -- T t0 = (EntityLiving) iterator.next(); -+ T t0 = iterator.next(); // Paper - decompile fix - - if (pathfindertargetcondition.a(entityliving, t0)) { - list1.add(t0); -diff --git a/src/main/java/net/minecraft/server/IOWorker.java b/src/main/java/net/minecraft/server/IOWorker.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IOWorker.java -+++ b/src/main/java/net/minecraft/server/IOWorker.java +--- a/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java @@ -0,0 +0,0 @@ public class IOWorker implements AutoCloseable { return this.a(() -> { try { @@ -400,256 +712,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } catch (Exception exception) { IOWorker.LOGGER.error("Failed to store chunk {}", chunkcoordintpair, exception); ioworker_a.b.completeExceptionally(exception); -diff --git a/src/main/java/net/minecraft/server/LightEngineStorageSky.java b/src/main/java/net/minecraft/server/LightEngineStorageSky.java +diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorageSky.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorageSky.java -@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage - int l = lightenginestoragesky_a.c.get(SectionPosition.f(j)); - - if (l != lightenginestoragesky_a.b && k < l) { -- NibbleArray nibblearray = this.a((LightEngineStorageArray) lightenginestoragesky_a, j); -+ NibbleArray nibblearray = this.a(lightenginestoragesky_a, j); // Paper - decompile fix - - if (nibblearray == null) { -- for (i = BlockPosition.f(i); nibblearray == null; nibblearray = this.a((LightEngineStorageArray) lightenginestoragesky_a, j)) { -+ for (i = BlockPosition.f(i); nibblearray == null; nibblearray = this.a(lightenginestoragesky_a, j)) { // Paper - decompile fix - j = SectionPosition.a(j, EnumDirection.UP); - ++k; - if (k >= l) { -diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineThreaded.java -+++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java -@@ -0,0 +0,0 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { - - public void queueUpdate() { - if ((!this.c.isEmpty() || super.a()) && this.g.compareAndSet(false, true)) { -- this.b.a((Object) (() -> { -+ this.b.a((() -> { // Paper - decompile error - this.b(); - this.g.set(false); - })); -diff --git a/src/main/java/net/minecraft/server/LootEntryAbstract.java b/src/main/java/net/minecraft/server/LootEntryAbstract.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LootEntryAbstract.java -+++ b/src/main/java/net/minecraft/server/LootEntryAbstract.java -@@ -0,0 +0,0 @@ public abstract class LootEntryAbstract implements LootEntryChildren { - - // CraftBukkit start - @Override -- public final void a(JsonObject jsonobject, T t0, JsonSerializationContext jsonserializationcontext) { -+ public void a(JsonObject jsonobject, T t0, JsonSerializationContext jsonserializationcontext) { // Paper - remove final - if (!org.apache.commons.lang3.ArrayUtils.isEmpty(t0.d)) { - jsonobject.add("conditions", jsonserializationcontext.serialize(t0.d)); +--- a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java ++++ b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java +@@ -0,0 +0,0 @@ public class EnderDragonBattle { } -diff --git a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java -+++ b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java -@@ -0,0 +0,0 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional - public b() {} - - public void a(JsonObject jsonobject, LootItemFunctionExplorationMap lootitemfunctionexplorationmap, JsonSerializationContext jsonserializationcontext) { -- super.a(jsonobject, (LootItemFunctionConditional) lootitemfunctionexplorationmap, jsonserializationcontext); -+ super.a(jsonobject, lootitemfunctionexplorationmap, jsonserializationcontext); // Paper - decompile fix - if (!lootitemfunctionexplorationmap.e.equals(LootItemFunctionExplorationMap.a)) { - jsonobject.add("destination", jsonserializationcontext.serialize(lootitemfunctionexplorationmap.e.i())); - } -diff --git a/src/main/java/net/minecraft/server/LootSelectorEntry.java b/src/main/java/net/minecraft/server/LootSelectorEntry.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LootSelectorEntry.java -+++ b/src/main/java/net/minecraft/server/LootSelectorEntry.java -@@ -0,0 +0,0 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { - @Override - public T b(LootItemFunction.a lootitemfunction_a) { - this.c.add(lootitemfunction_a.b()); -- return (LootSelectorEntry.a) this.d(); -+ return this.d(); // Paper - decompile fix } - protected LootItemFunction[] a() { -@@ -0,0 +0,0 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { - - public T a(int i) { - this.a = i; -- return (LootSelectorEntry.a) this.d(); -+ return this.d(); // Paper - decompile fix - } - - public T b(int i) { - this.b = i; -- return (LootSelectorEntry.a) this.d(); -+ return this.d(); // Paper - decompile fix - } +- worldgenendtrophy.b((WorldGenFeatureConfiguration) WorldGenFeatureConfiguration.k).a(this.world, this.world.getChunkProvider().getChunkGenerator(), new Random(), this.exitPortalLocation); ++ worldgenendtrophy.b(WorldGenFeatureConfiguration.k).a(this.world, this.world.getChunkProvider().getChunkGenerator(), new Random(), this.exitPortalLocation); // Paper - decompile fix } -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java + private EntityEnderDragon o() { +diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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<TickTas - ResourcePackRepository resourcepackrepository = this.resourcePackRepository; - - this.resourcePackRepository.getClass(); -- return stream.map(resourcepackrepository::a).filter(Objects::nonNull).map(ResourcePackLoader::d).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error -+ return stream.<ResourcePackLoader>map(resourcepackrepository::a).filter(Objects::nonNull).map(ResourcePackLoader::d).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error // Paper - decompile error - }, this).thenCompose((immutablelist) -> { -- return DataPackResources.a(immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this); -+ return DataPackResources.a((List<IResourcePack>) immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this); // Paper - decompile error - }).thenAcceptAsync((datapackresources) -> { - this.dataPackResources.close(); - this.dataPackResources = datapackresources; -diff --git a/src/main/java/net/minecraft/server/NBTBase.java b/src/main/java/net/minecraft/server/NBTBase.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NBTBase.java -+++ b/src/main/java/net/minecraft/server/NBTBase.java -@@ -0,0 +0,0 @@ public interface NBTBase { - - NBTTagType<?> b(); - -- NBTBase clone(); -+ public NBTBase clone(); // Paper - decompile fix - - default String asString() { - return this.toString(); -diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -@@ -0,0 +0,0 @@ import java.io.InputStream; - import java.io.OutputStream; - import java.util.zip.GZIPInputStream; - import java.util.zip.GZIPOutputStream; -+import io.netty.buffer.ByteBufInputStream; // Paper - - public class NBTCompressedStreamTools { - -@@ -0,0 +0,0 @@ public class NBTCompressedStreamTools { - - public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) throws IOException { - // Spigot start -- if ( datainput instanceof io.netty.buffer.ByteBufInputStream ) -+ if ( datainput instanceof ByteBufInputStream) // Paper - { - datainput = new DataInputStream(new org.spigotmc.LimitStream((InputStream) datainput, nbtreadlimiter)); - } -diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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<NBTBase> { - 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<NBTBase> 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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<T> { - return this.a.hashCode(); - } - -- public static <T> Comparator<NextTickListEntry<T>> a() { -+ public static <T> Comparator<Object> a() { // Paper - decompile fix - return Comparator.comparingLong((nextticklistentry) -> { -- return nextticklistentry.b; -+ return ((NextTickListEntry<T>) nextticklistentry).b; // Paper - decompile fix - }).thenComparing((nextticklistentry) -> { -- return nextticklistentry.c; -+ return ((NextTickListEntry<T>) nextticklistentry).c; // Paper - decompile fix - }).thenComparingLong((nextticklistentry) -> { -- return nextticklistentry.f; -+ return ((NextTickListEntry<T>) nextticklistentry).f; // Paper - decompile fix - }); - } - -diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegistryBlockID.java -+++ b/src/main/java/net/minecraft/server/RegistryBlockID.java -@@ -0,0 +0,0 @@ public class RegistryBlockID<T> implements Registry<T> { - this.b.put(t0, i); - - while (this.c.size() <= i) { -- this.c.add((Object) null); -+ this.c.add(null); // Paper - decompile fix - } - - this.c.set(i, t0); -@@ -0,0 +0,0 @@ public class RegistryBlockID<T> implements Registry<T> { - this.a(t0, this.a); - } - -+ // Paper start - decompile fix -+ @Override -+ public int a(T t) { -+ return getId(t); -+ } -+ // Paper end -+ - public int getId(T t0) { - Integer integer = (Integer) this.b.get(t0); - -diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegistryID.java -+++ b/src/main/java/net/minecraft/server/RegistryID.java -@@ -0,0 +0,0 @@ public class RegistryID<K> implements Registry<K> { - - public RegistryID(int i) { - i = (int) ((float) i / 0.8F); -- this.b = (Object[]) (new Object[i]); -+ this.b = (K[]) (new Object[i]); // Paper - decompile fix - this.c = new int[i]; -- this.d = (Object[]) (new Object[i]); -+ this.d = (K[]) (new Object[i]); // Paper - decompile fix - } - -+ // Paper start - decompile fix -+ @Override -+ public int a(K k) { -+ return getId(k); -+ } -+ // Paper end -+ - public int getId(@Nullable K k0) { - return this.c(this.b(k0, this.d(k0))); - } -@@ -0,0 +0,0 @@ public class RegistryID<K> implements Registry<K> { - K[] ak = this.b; - int[] aint = this.c; - -- this.b = (Object[]) (new Object[i]); -+ this.b = (K[]) (new Object[i]); // Paper - decompile fix - this.c = new int[i]; -- this.d = (Object[]) (new Object[i]); -+ this.d = (K[]) (new Object[i]); // Paper - decompile fix - this.e = 0; - this.f = 0; - -diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ServerStatisticManager.java -+++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java -@@ -0,0 +0,0 @@ public class ServerStatisticManager extends StatisticManager { - ObjectIterator objectiterator = this.a.object2IntEntrySet().iterator(); - - while (objectiterator.hasNext()) { -- it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<Statistic<?>> it_unimi_dsi_fastutil_objects_object2intmap_entry = (it.unimi.dsi.fastutil.objects.Object2IntMap.Entry) objectiterator.next(); -+ Object2IntMap.Entry<Statistic<?>> it_unimi_dsi_fastutil_objects_object2intmap_entry = (Object2IntMap.Entry) objectiterator.next(); // Paper - decompile fix - Statistic<?> statistic = (Statistic) it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey(); - - ((JsonObject) map.computeIfAbsent(statistic.getWrapper(), (statisticwrapper) -> { -diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/StructureGenerator.java -+++ b/src/main/java/net/minecraft/server/StructureGenerator.java +--- a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java @@ -0,0 +0,0 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration> public static final StructureGenerator<WorldGenFeatureVillageConfiguration> BASTION_REMNANT = a("Bastion_Remnant", new WorldGenFeatureBastionRemnant(WorldGenFeatureVillageConfiguration.a), WorldGenStage.Decoration.SURFACE_STRUCTURES); public static final List<StructureGenerator<?>> t = ImmutableList.of(StructureGenerator.PILLAGER_OUTPOST, StructureGenerator.VILLAGE, StructureGenerator.NETHER_FOSSIL); @@ -666,160 +745,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public StructureGenerator(Codec<C> codec) { -diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SystemUtils.java -+++ b/src/main/java/net/minecraft/server/SystemUtils.java -@@ -0,0 +0,0 @@ public class SystemUtils { - return Collectors.toMap(Entry::getKey, Entry::getValue); - } +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java +@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage + int l = lightenginestoragesky_a.c.get(SectionPosition.f(j)); -- public static <T extends Comparable<T>> String a(IBlockState<T> iblockstate, Object object) { -- return iblockstate.a((Comparable) object); -+ public static <T extends Comparable<T>> String a(IBlockState<T> iblockstate, T object) { // Paper - decompile fix -+ return iblockstate.a(object); // Paper - decompile fix - } + if (l != lightenginestoragesky_a.b && k < l) { +- NibbleArray nibblearray = this.a((LightEngineStorageArray) lightenginestoragesky_a, j); ++ NibbleArray nibblearray = this.a(lightenginestoragesky_a, j); // Paper - decompile fix - public static String a(String s, @Nullable MinecraftKey minecraftkey) { -@@ -0,0 +0,0 @@ public class SystemUtils { - public static <T> T b(Iterable<T> iterable, @Nullable T t0) { - Iterator<T> iterator = iterable.iterator(); - -- Object object; -- Object object1; -+ T object; // Paper - decompile fix -+ T object1; // Paper - decompile fix - - for (object1 = null; iterator.hasNext(); object1 = object) { - object = iterator.next(); -@@ -0,0 +0,0 @@ public class SystemUtils { - } - - public static <K> Strategy<K> k() { -- return SystemUtils.IdentityHashingStrategy.INSTANCE; -+ return (Strategy<K>) SystemUtils.IdentityHashingStrategy.INSTANCE; // Paper - decompile fix - } - - public static <V> CompletableFuture<List<V>> b(List<? extends CompletableFuture<? extends V>> list) { -@@ -0,0 +0,0 @@ public class SystemUtils { - list.forEach((completablefuture1) -> { - int i = list1.size(); - -- list1.add((Object) null); -+ list1.add(null); // Paper - decompile fix - acompletablefuture[i] = completablefuture1.whenComplete((object, throwable) -> { - if (throwable != null) { - completablefuture.completeExceptionally(throwable); -diff --git a/src/main/java/net/minecraft/server/ThreadedMailbox.java b/src/main/java/net/minecraft/server/ThreadedMailbox.java + if (nibblearray == null) { +- for (i = BlockPosition.f(i); nibblearray == null; nibblearray = this.a((LightEngineStorageArray) lightenginestoragesky_a, j)) { ++ for (i = BlockPosition.f(i); nibblearray == null; nibblearray = this.a(lightenginestoragesky_a, j)) { // Paper - decompile fix + j = SectionPosition.a(j, EnumDirection.UP); + ++k; + if (k >= l) { +diff --git a/src/main/java/net/minecraft/world/level/storage/WorldPersistentData.java b/src/main/java/net/minecraft/world/level/storage/WorldPersistentData.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ThreadedMailbox.java -+++ b/src/main/java/net/minecraft/server/ThreadedMailbox.java -@@ -0,0 +0,0 @@ public class ThreadedMailbox<T> implements Mailbox<T>, AutoCloseable, Runnable { - - public void run() { - try { -- this.a((i) -> { -+ this.a((int i) -> { // Paper - decompile fix - return i == 0; - }); - } finally { -diff --git a/src/main/java/net/minecraft/server/Ticket.java b/src/main/java/net/minecraft/server/Ticket.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Ticket.java -+++ b/src/main/java/net/minecraft/server/Ticket.java -@@ -0,0 +0,0 @@ public final class Ticket<T> implements Comparable<Ticket<?>> { - } else { - int j = Integer.compare(System.identityHashCode(this.a), System.identityHashCode(ticket.a)); - -- return j != 0 ? j : this.a.a().compare(this.identifier, ticket.identifier); -+ return j != 0 ? j : this.a.a().compare(this.identifier, (T)ticket.identifier); // Paper - decompile fix - } - } - -diff --git a/src/main/java/net/minecraft/server/TileEntityPiston.java b/src/main/java/net/minecraft/server/TileEntityPiston.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityPiston.java -+++ b/src/main/java/net/minecraft/server/TileEntityPiston.java -@@ -0,0 +0,0 @@ public class TileEntityPiston extends TileEntity implements ITickable { - private static void a(EnumDirection enumdirection, Entity entity, double d0, EnumDirection enumdirection1) { - TileEntityPiston.h.set(enumdirection); - entity.move(EnumMoveType.PISTON, new Vec3D(d0 * (double) enumdirection1.getAdjacentX(), d0 * (double) enumdirection1.getAdjacentY(), d0 * (double) enumdirection1.getAdjacentZ())); -- TileEntityPiston.h.set((Object) null); -+ TileEntityPiston.h.set(null); // Paper - decompile fix - } - - private void g(float f) { -diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/VillagePlace.java -+++ b/src/main/java/net/minecraft/server/VillagePlace.java -@@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { - } - - private static boolean a(ChunkSection chunksection) { -- Set set = VillagePlaceType.x; -+ Set<IBlockData> set = VillagePlaceType.x; // Paper - decompile error - -- set.getClass(); -+ //set.getClass(); // Paper - decompile error - return chunksection.a(set::contains); - } - -@@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { - SectionPosition.b(new ChunkCoordIntPair(blockposition), Math.floorDiv(i, 16)).map((sectionposition) -> { - return Pair.of(sectionposition, this.d(sectionposition.s())); - }).filter((pair) -> { -- return !(Boolean) ((Optional) pair.getSecond()).map(VillagePlaceSection::a).orElse(false); -+ return !(Boolean) (pair.getSecond()).map(VillagePlaceSection::a).orElse(false); // Paper - decompile fix - }).map((pair) -> { - return ((SectionPosition) pair.getFirst()).r(); - }).filter((chunkcoordintpair) -> { -@@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { - - private final Predicate<? super VillagePlaceRecord> d; - -- private Occupancy(Predicate predicate) { -+ private Occupancy(Predicate<? super VillagePlaceRecord> predicate) { // Paper - decompile fix - this.d = predicate; - } - -diff --git a/src/main/java/net/minecraft/server/VillagerTrades.java b/src/main/java/net/minecraft/server/VillagerTrades.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/VillagerTrades.java -+++ b/src/main/java/net/minecraft/server/VillagerTrades.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; - - public class VillagerTrades { - -- public static final Map<VillagerProfession, Int2ObjectMap<VillagerTrades.IMerchantRecipeOption[]>> a = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> { -+ public static final Map<VillagerProfession, Int2ObjectMap<VillagerTrades.IMerchantRecipeOption[]>> a = SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // Paper - decompile fix - hashmap.put(VillagerProfession.FARMER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WHEAT, 20, 16, 2), new VillagerTrades.b(Items.POTATO, 26, 16, 2), new VillagerTrades.b(Items.CARROT, 22, 16, 2), new VillagerTrades.b(Items.BEETROOT, 15, 16, 2), new VillagerTrades.h(Items.BREAD, 1, 6, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Blocks.PUMPKIN, 6, 12, 10), new VillagerTrades.h(Items.PUMPKIN_PIE, 1, 4, 5), new VillagerTrades.h(Items.APPLE, 1, 4, 16, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.COOKIE, 3, 18, 10), new VillagerTrades.b(Blocks.MELON, 4, 12, 20)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Blocks.CAKE, 1, 1, 12, 15), new VillagerTrades.i(MobEffects.NIGHT_VISION, 100, 15), new VillagerTrades.i(MobEffects.JUMP, 160, 15), new VillagerTrades.i(MobEffects.WEAKNESS, 140, 15), new VillagerTrades.i(MobEffects.BLINDNESS, 120, 15), new VillagerTrades.i(MobEffects.POISON, 280, 15), new VillagerTrades.i(MobEffects.SATURATION, 7, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.GOLDEN_CARROT, 3, 3, 30), new VillagerTrades.h(Items.GLISTERING_MELON_SLICE, 4, 3, 30)}))); -- hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 20, 16, 2), new VillagerTrades.b(Items.COAL, 10, 16, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 16, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COD, 15, 16, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 16, 5), new VillagerTrades.h(Items.rn, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SALMON, 13, 16, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 3, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.TROPICAL_FISH, 6, 12, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PUFFERFISH, 4, 12, 30), new VillagerTrades.c(1, 12, 30, ImmutableMap.builder().put(VillagerType.PLAINS, Items.OAK_BOAT).put(VillagerType.TAIGA, Items.SPRUCE_BOAT).put(VillagerType.SNOW, Items.SPRUCE_BOAT).put(VillagerType.DESERT, Items.JUNGLE_BOAT).put(VillagerType.JUNGLE, Items.JUNGLE_BOAT).put(VillagerType.SAVANNA, Items.ACACIA_BOAT).put(VillagerType.SWAMP, Items.DARK_OAK_BOAT).build())}))); -+ hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 20, 16, 2), new VillagerTrades.b(Items.COAL, 10, 16, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 16, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COD, 15, 16, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 16, 5), new VillagerTrades.h(Items.rn, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SALMON, 13, 16, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 3, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.TROPICAL_FISH, 6, 12, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PUFFERFISH, 4, 12, 30), new VillagerTrades.c(1, 12, 30, ImmutableMap.<VillagerType, Item>builder().put(VillagerType.PLAINS, Items.OAK_BOAT).put(VillagerType.TAIGA, Items.SPRUCE_BOAT).put(VillagerType.SNOW, Items.SPRUCE_BOAT).put(VillagerType.DESERT, Items.JUNGLE_BOAT).put(VillagerType.JUNGLE, Items.JUNGLE_BOAT).put(VillagerType.SAVANNA, Items.ACACIA_BOAT).put(VillagerType.SWAMP, Items.DARK_OAK_BOAT).build())}))); // Paper - add <VillagerType, Item> to ImmutableMap.<VillagerType, Item>.builder() - hashmap.put(VillagerProfession.SHEPHERD, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Blocks.WHITE_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.BROWN_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.BLACK_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.GRAY_WOOL, 18, 16, 2), new VillagerTrades.h(Items.SHEARS, 2, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WHITE_DYE, 12, 16, 10), new VillagerTrades.b(Items.GRAY_DYE, 12, 16, 10), new VillagerTrades.b(Items.BLACK_DYE, 12, 16, 10), new VillagerTrades.b(Items.LIGHT_BLUE_DYE, 12, 16, 10), new VillagerTrades.b(Items.LIME_DYE, 12, 16, 10), new VillagerTrades.h(Blocks.WHITE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.ORANGE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.MAGENTA_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIGHT_BLUE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.YELLOW_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIME_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.PINK_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.GRAY_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIGHT_GRAY_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.CYAN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.PURPLE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BLUE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BROWN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.GREEN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.RED_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BLACK_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.WHITE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.ORANGE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.MAGENTA_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIGHT_BLUE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.YELLOW_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIME_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.PINK_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.GRAY_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIGHT_GRAY_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.CYAN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.PURPLE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BLUE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BROWN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.GREEN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.RED_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BLACK_CARPET, 1, 4, 16, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.YELLOW_DYE, 12, 16, 20), new VillagerTrades.b(Items.LIGHT_GRAY_DYE, 12, 16, 20), new VillagerTrades.b(Items.ORANGE_DYE, 12, 16, 20), new VillagerTrades.b(Items.RED_DYE, 12, 16, 20), new VillagerTrades.b(Items.PINK_DYE, 12, 16, 20), new VillagerTrades.h(Blocks.WHITE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.YELLOW_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.RED_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BLACK_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BLUE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BROWN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.CYAN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.GRAY_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.GREEN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIGHT_BLUE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIGHT_GRAY_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIME_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.MAGENTA_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.ORANGE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.PINK_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.PURPLE_BED, 3, 1, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BROWN_DYE, 12, 16, 30), new VillagerTrades.b(Items.PURPLE_DYE, 12, 16, 30), new VillagerTrades.b(Items.BLUE_DYE, 12, 16, 30), new VillagerTrades.b(Items.GREEN_DYE, 12, 16, 30), new VillagerTrades.b(Items.MAGENTA_DYE, 12, 16, 30), new VillagerTrades.b(Items.CYAN_DYE, 12, 16, 30), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 12, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.PAINTING, 2, 3, 30)}))); - hashmap.put(VillagerProfession.FLETCHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STICK, 32, 16, 2), new VillagerTrades.h(Items.ARROW, 1, 16, 1), new VillagerTrades.g(Blocks.GRAVEL, 10, Items.FLINT, 10, 12, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.FLINT, 26, 12, 10), new VillagerTrades.h(Items.BOW, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 14, 16, 20), new VillagerTrades.h(Items.CROSSBOW, 3, 1, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.FEATHER, 24, 16, 30), new VillagerTrades.e(Items.BOW, 2, 3, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.es, 8, 12, 30), new VillagerTrades.e(Items.CROSSBOW, 3, 3, 15), new VillagerTrades.j(Items.ARROW, 5, Items.TIPPED_ARROW, 5, 2, 12, 30)}))); -- hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.builder().put(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 9, 1, 12, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BOOK, 4, 12, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.rk, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.INK_SAC, 5, 12, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.az, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 12, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); -+ hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.<Integer, IMerchantRecipeOption[]>builder().put(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 9, 1, 12, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BOOK, 4, 12, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.rk, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.INK_SAC, 5, 12, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.az, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 12, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); // Paper - add <Integer, IMerchantRecipeOption[]> to ImmutableMap.<Integer, IMerchantRecipeOption[]>.builder() - hashmap.put(VillagerProfession.CARTOGRAPHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.h(Items.MAP, 7, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.dP, 11, 16, 10), new VillagerTrades.k(13, StructureGenerator.MONUMENT, MapIcon.Type.MONUMENT, 12, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COMPASS, 1, 12, 20), new VillagerTrades.k(14, StructureGenerator.MANSION, MapIcon.Type.MANSION, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.ITEM_FRAME, 7, 1, 15), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.GLOBE_BANNER_PATTERN, 8, 1, 30)}))); - hashmap.put(VillagerProfession.CLERIC, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.ROTTEN_FLESH, 32, 16, 2), new VillagerTrades.h(Items.REDSTONE, 1, 2, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.GOLD_INGOT, 3, 12, 10), new VillagerTrades.h(Items.LAPIS_LAZULI, 1, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.RABBIT_FOOT, 2, 12, 20), new VillagerTrades.h(Blocks.GLOWSTONE, 4, 1, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SCUTE, 4, 12, 30), new VillagerTrades.b(Items.GLASS_BOTTLE, 9, 12, 30), new VillagerTrades.h(Items.ENDER_PEARL, 5, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.NETHER_WART, 22, 12, 30), new VillagerTrades.h(Items.EXPERIENCE_BOTTLE, 3, 1, 30)}))); - hashmap.put(VillagerProfession.ARMORER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COAL, 15, 16, 2), new VillagerTrades.h(new ItemStack(Items.IRON_LEGGINGS), 7, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_BOOTS), 4, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_HELMET), 5, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_CHESTPLATE), 9, 1, 12, 1, 0.2F)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.IRON_INGOT, 4, 12, 10), new VillagerTrades.h(new ItemStack(Items.rj), 36, 1, 12, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_BOOTS), 1, 1, 12, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_LEGGINGS), 3, 1, 12, 5, 0.2F)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.LAVA_BUCKET, 1, 12, 20), new VillagerTrades.b(Items.DIAMOND, 1, 12, 20), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_HELMET), 1, 1, 12, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_CHESTPLATE), 4, 1, 12, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.SHIELD), 5, 1, 12, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.e(Items.DIAMOND_LEGGINGS, 14, 3, 15, 0.2F), new VillagerTrades.e(Items.DIAMOND_BOOTS, 8, 3, 15, 0.2F)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.e(Items.DIAMOND_HELMET, 8, 3, 30, 0.2F), new VillagerTrades.e(Items.DIAMOND_CHESTPLATE, 16, 3, 30, 0.2F)}))); -diff --git a/src/main/java/net/minecraft/server/VoxelShapeMergerList.java b/src/main/java/net/minecraft/server/VoxelShapeMergerList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapeMergerList.java -+++ b/src/main/java/net/minecraft/server/VoxelShapeMergerList.java -@@ -0,0 +0,0 @@ public final class VoxelShapeMergerList implements VoxelShapeMerger { - double d1 = flag4 ? doublelist.getDouble(i++) : doublelist1.getDouble(j++); - - if ((i != 0 && flag2 || flag4 || flag1) && (j != 0 && flag3 || !flag4 || flag)) { -- if (d0 < d1 - 1.0E-7D) { -+ if (!(d0 >= d1 - 1.0E-7D)) { // Paper - decompile error - welcome to hell - this.b.add(i - 1); - this.c.add(j - 1); - this.a.add(d1); -diff --git a/src/main/java/net/minecraft/server/WorldPersistentData.java b/src/main/java/net/minecraft/server/WorldPersistentData.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldPersistentData.java -+++ b/src/main/java/net/minecraft/server/WorldPersistentData.java +--- a/src/main/java/net/minecraft/world/level/storage/WorldPersistentData.java ++++ b/src/main/java/net/minecraft/world/level/storage/WorldPersistentData.java @@ -0,0 +0,0 @@ public class WorldPersistentData { if (t0 != null) { return t0; @@ -847,16 +793,70 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 NBTTagCompound nbttagcompound = this.a(s, SharedConstants.getGameVersion().getWorldVersion()); t0.a(nbttagcompound.getCompound("data")); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootEntryAbstract.java b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootEntryAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - } +--- a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootEntryAbstract.java ++++ b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootEntryAbstract.java +@@ -0,0 +0,0 @@ public abstract class LootEntryAbstract implements LootEntryChildren { - // CraftBukkit - decompile error -- return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<MinecraftKey>::getIntValue).reversed()).limit(5L).map((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> { -+ return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(Object2IntMap.Entry<MinecraftKey>::getIntValue).reversed()).limit(5L).map((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> { // Paper - decompile fix - return it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey() + ":" + it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue(); - }).collect(Collectors.joining(",")); - } catch (Exception exception) { + // CraftBukkit start + @Override +- public final void a(JsonObject jsonobject, T t0, JsonSerializationContext jsonserializationcontext) { ++ public void a(JsonObject jsonobject, T t0, JsonSerializationContext jsonserializationcontext) { // Paper - remove final + if (!org.apache.commons.lang3.ArrayUtils.isEmpty(t0.d)) { + jsonobject.add("conditions", jsonserializationcontext.serialize(t0.d)); + } +diff --git a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootSelectorEntry.java b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootSelectorEntry.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootSelectorEntry.java ++++ b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootSelectorEntry.java +@@ -0,0 +0,0 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { + @Override + public T b(LootItemFunction.a lootitemfunction_a) { + this.c.add(lootitemfunction_a.b()); +- return (LootSelectorEntry.a) this.d(); ++ return this.d(); // Paper - decompile fix + } + + protected LootItemFunction[] a() { +@@ -0,0 +0,0 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { + + public T a(int i) { + this.a = i; +- return (LootSelectorEntry.a) this.d(); ++ return this.d(); // Paper - decompile fix + } + + public T b(int i) { + this.b = i; +- return (LootSelectorEntry.a) this.d(); ++ return this.d(); // Paper - decompile fix + } + } + +diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/LootItemFunctionExplorationMap.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/LootItemFunctionExplorationMap.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/storage/loot/functions/LootItemFunctionExplorationMap.java ++++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/LootItemFunctionExplorationMap.java +@@ -0,0 +0,0 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional + public b() {} + + public void a(JsonObject jsonobject, LootItemFunctionExplorationMap lootitemfunctionexplorationmap, JsonSerializationContext jsonserializationcontext) { +- super.a(jsonobject, (LootItemFunctionConditional) lootitemfunctionexplorationmap, jsonserializationcontext); ++ super.a(jsonobject, lootitemfunctionexplorationmap, jsonserializationcontext); // Paper - decompile fix + if (!lootitemfunctionexplorationmap.e.equals(LootItemFunctionExplorationMap.a)) { + jsonobject.add("destination", jsonserializationcontext.serialize(lootitemfunctionexplorationmap.e.i())); + } +diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMergerList.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMergerList.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMergerList.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMergerList.java +@@ -0,0 +0,0 @@ public final class VoxelShapeMergerList implements VoxelShapeMerger { + double d1 = flag4 ? doublelist.getDouble(i++) : doublelist1.getDouble(j++); + + if ((i != 0 && flag2 || flag4 || flag1) && (j != 0 && flag3 || !flag4 || flag)) { +- if (d0 < d1 - 1.0E-7D) { ++ if (!(d0 >= d1 - 1.0E-7D)) { // Paper - decompile error - welcome to hell + this.b.add(i - 1); + this.c.add(j - 1); + this.a.add(d1); diff --git a/Spigot-Server-Patches/MC-Utils.patch b/Spigot-Server-Patches/MC-Utils.patch index 1a91cb496d..2b5c7152a1 100644 --- a/Spigot-Server-Patches/MC-Utils.patch +++ b/Spigot-Server-Patches/MC-Utils.patch @@ -463,8 +463,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +package com.destroystokyo.paper.util.maplist; + +import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap; -+import net.minecraft.server.Chunk; -+import net.minecraft.server.MCUtil; ++import net.minecraft.world.level.chunk.Chunk; +import java.util.Arrays; +import java.util.Iterator; +import java.util.NoSuchElementException; @@ -598,7 +597,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +package com.destroystokyo.paper.util.maplist; + +import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; -+import net.minecraft.server.Entity; ++import net.minecraft.world.entity.Entity; +import java.util.Arrays; +import java.util.Iterator; +import java.util.NoSuchElementException; @@ -733,9 +732,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import it.unimi.dsi.fastutil.longs.LongIterator; +import it.unimi.dsi.fastutil.shorts.Short2LongOpenHashMap; -+import net.minecraft.server.ChunkSection; -+import net.minecraft.server.DataPaletteGlobal; -+import net.minecraft.server.IBlockData; ++import net.minecraft.world.level.block.state.IBlockData; ++import net.minecraft.world.level.chunk.ChunkSection; ++import net.minecraft.world.level.chunk.DataPaletteGlobal; +import java.util.Arrays; + +/** @@ -743,7 +742,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + */ +public final class IBlockDataList { + -+ static final DataPaletteGlobal<IBlockData> GLOBAL_PALETTE = (DataPaletteGlobal)ChunkSection.GLOBAL_PALETTE; ++ static final DataPaletteGlobal<IBlockData> GLOBAL_PALETTE = (DataPaletteGlobal) ChunkSection.GLOBAL_PALETTE; + + // map of location -> (index | (location << 16) | (palette id << 32)) + private final Short2LongOpenHashMap map = new Short2LongOpenHashMap(2, 0.8f); @@ -1106,9 +1105,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; -+import net.minecraft.server.ChunkCoordIntPair; +import net.minecraft.server.MCUtil; +import net.minecraft.server.MinecraftServer; ++import net.minecraft.world.level.ChunkCoordIntPair; +import javax.annotation.Nullable; +import java.util.Iterator; + @@ -1562,8 +1561,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +import com.destroystokyo.paper.util.math.IntegerUtil; +import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap; -+import net.minecraft.server.ChunkCoordIntPair; +import net.minecraft.server.MCUtil; ++import net.minecraft.world.level.ChunkCoordIntPair; + +/** @author Spottedleaf */ +public abstract class DistanceTrackingAreaMap<E> extends AreaMap<E> { @@ -1741,7 +1740,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package com.destroystokyo.paper.util.misc; + -+import net.minecraft.server.EntityPlayer; ++import net.minecraft.server.level.EntityPlayer; + +/** + * @author Spottedleaf @@ -1779,7 +1778,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package com.destroystokyo.paper.util.misc; + -+import net.minecraft.server.EntityPlayer; ++import net.minecraft.server.level.EntityPlayer; + +public class PlayerDistanceTrackingAreaMap extends DistanceTrackingAreaMap<EntityPlayer> { + @@ -2258,35 +2257,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return (other.backingSet & this.backingSet) != 0; + } +} -diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java +diff --git a/src/main/java/net/minecraft/SystemUtils.java b/src/main/java/net/minecraft/SystemUtils.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/AxisAlignedBB.java -+++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java -@@ -0,0 +0,0 @@ public class AxisAlignedBB { - return this.d(vec3d.x, vec3d.y, vec3d.z); +--- a/src/main/java/net/minecraft/SystemUtils.java ++++ b/src/main/java/net/minecraft/SystemUtils.java +@@ -0,0 +0,0 @@ public class SystemUtils { } -+ public final boolean intersects(AxisAlignedBB axisalignedbb) { return this.c(axisalignedbb); } // Paper - OBFHELPER - public boolean c(AxisAlignedBB axisalignedbb) { - return this.a(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ); + public static long getMonotonicNanos() { +- return SystemUtils.a.getAsLong(); ++ return System.nanoTime(); // Paper } -+ public final boolean intersects(double d0, double d1, double d2, double d3, double d4, double d5) { return a(d0, d1, d2, d3, d4, d5); } // Paper - OBFHELPER - public boolean a(double d0, double d1, double d2, double d3, double d4, double d5) { - return this.minX < d3 && this.maxX > d0 && this.minY < d4 && this.maxY > d1 && this.minZ < d5 && this.maxZ > d2; - } -@@ -0,0 +0,0 @@ public class AxisAlignedBB { - return d0 >= this.minX && d0 < this.maxX && d1 >= this.minY && d1 < this.maxY && d2 >= this.minZ && d2 < this.maxZ; - } - -+ public final double getAverageSideLength(){return a();} // Paper - OBFHELPER - public double a() { - double d0 = this.b(); - double d1 = this.c(); -diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java + public static long getTimeMillis() { +diff --git a/src/main/java/net/minecraft/core/BaseBlockPosition.java b/src/main/java/net/minecraft/core/BaseBlockPosition.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BaseBlockPosition.java -+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java +--- a/src/main/java/net/minecraft/core/BaseBlockPosition.java ++++ b/src/main/java/net/minecraft/core/BaseBlockPosition.java @@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> { return IntStream.of(new int[]{baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()}); }); @@ -2327,45 +2314,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public double j(BaseBlockPosition baseblockposition) { return this.distanceSquared((double) baseblockposition.getX(), (double) baseblockposition.getY(), (double) baseblockposition.getZ(), true); } -diff --git a/src/main/java/net/minecraft/server/BlockAccessAir.java b/src/main/java/net/minecraft/server/BlockAccessAir.java +diff --git a/src/main/java/net/minecraft/core/BlockPosition.java b/src/main/java/net/minecraft/core/BlockPosition.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockAccessAir.java -+++ b/src/main/java/net/minecraft/server/BlockAccessAir.java -@@ -0,0 +0,0 @@ public enum BlockAccessAir implements IBlockAccess { - return null; - } - -+ // Paper start - If loaded util -+ @Override -+ public Fluid getFluidIfLoaded(BlockPosition blockposition) { -+ return this.getFluid(blockposition); -+ } -+ -+ @Override -+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) { -+ return this.getType(blockposition); -+ } -+ // Paper end -+ - @Override - public IBlockData getType(BlockPosition blockposition) { - return Blocks.AIR.getBlockData(); -diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockBase.java -+++ b/src/main/java/net/minecraft/server/BlockBase.java -@@ -0,0 +0,0 @@ public abstract class BlockBase { - return this.a != null ? this.a.d : Block.a(this.getCollisionShape(iblockaccess, blockposition)); - } - -+ public final IBlockData getBlockData() { return p(); } // Paper - OBFHELPER - protected abstract IBlockData p(); - - public boolean isRequiresSpecialTool() { -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java +--- a/src/main/java/net/minecraft/core/BlockPosition.java ++++ b/src/main/java/net/minecraft/core/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { return d0 == 0.0D && d1 == 0.0D && d2 == 0.0D ? this : new BlockPosition((double) this.getX() + d0, (double) this.getY() + d1, (double) this.getZ() + d2); } @@ -2410,888 +2362,136 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public BlockPosition immutableCopy() { -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/core/RegistryBlockID.java b/src/main/java/net/minecraft/core/RegistryBlockID.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { +--- a/src/main/java/net/minecraft/core/RegistryBlockID.java ++++ b/src/main/java/net/minecraft/core/RegistryBlockID.java +@@ -0,0 +0,0 @@ public class RegistryBlockID<T> implements Registry<T> { + return Iterators.filter(this.c.iterator(), Predicates.notNull()); + } - private static final Logger LOGGER = LogManager.getLogger(); - @Nullable -- public static final ChunkSection a = null; -+ public static final ChunkSection a = null; public static final ChunkSection EMPTY_CHUNK_SECTION = a; // Paper - OBFHELPER - private final ChunkSection[] sections; - private BiomeStorage d; - private final Map<BlockPosition, NBTTagCompound> e; -@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - private Supplier<PlayerChunk.State> u; - @Nullable - private Consumer<Chunk> v; -- private final ChunkCoordIntPair loc; -+ private final ChunkCoordIntPair loc; public final long coordinateKey; public final int locX; public final int locZ; // Paper - cache coordinate key - private volatile boolean x; - - public Chunk(World world, ChunkCoordIntPair chunkcoordintpair, BiomeStorage biomestorage) { -@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - this.n = new ShortList[16]; - this.entitySlices = (List[]) (new List[16]); // Spigot - this.world = (WorldServer) world; // CraftBukkit - type -- this.loc = chunkcoordintpair; -+ this.locX = chunkcoordintpair.x; this.locZ = chunkcoordintpair.z; // Paper - reduce need for field look ups -+ this.loc = chunkcoordintpair; this.coordinateKey = ChunkCoordIntPair.pair(locX, locZ); // Paper - cache long key - this.i = chunkconverter; - HeightMap.Type[] aheightmap_type = HeightMap.Type.values(); - int j = aheightmap_type.length; -@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(DATA_TYPE_REGISTRY); - // CraftBukkit end - -+ // Paper start -+ public final com.destroystokyo.paper.util.maplist.EntityList entities = new com.destroystokyo.paper.util.maplist.EntityList(); -+ public PlayerChunk playerChunk; -+ -+ static final int NEIGHBOUR_CACHE_RADIUS = 3; -+ public static int getNeighbourCacheRadius() { -+ return NEIGHBOUR_CACHE_RADIUS; -+ } -+ -+ boolean loadedTicketLevel; -+ private long neighbourChunksLoadedBitset; -+ private final Chunk[] loadedNeighbourChunks = new Chunk[(NEIGHBOUR_CACHE_RADIUS * 2 + 1) * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)]; -+ -+ private static int getNeighbourIndex(final int relativeX, final int relativeZ) { -+ // index = (relativeX + NEIGHBOUR_CACHE_RADIUS) + (relativeZ + NEIGHBOUR_CACHE_RADIUS) * (NEIGHBOUR_CACHE_RADIUS * 2 + 1) -+ // optimised variant of the above by moving some of the ops to compile time -+ return relativeX + (relativeZ * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)) + (NEIGHBOUR_CACHE_RADIUS + NEIGHBOUR_CACHE_RADIUS * ((NEIGHBOUR_CACHE_RADIUS * 2 + 1))); -+ } -+ -+ public final Chunk getRelativeNeighbourIfLoaded(final int relativeX, final int relativeZ) { -+ return this.loadedNeighbourChunks[getNeighbourIndex(relativeX, relativeZ)]; -+ } -+ -+ public final boolean isNeighbourLoaded(final int relativeX, final int relativeZ) { -+ return (this.neighbourChunksLoadedBitset & (1L << getNeighbourIndex(relativeX, relativeZ))) != 0; -+ } -+ -+ public final void setNeighbourLoaded(final int relativeX, final int relativeZ, final Chunk chunk) { -+ if (chunk == null) { -+ throw new IllegalArgumentException("Chunk must be non-null, neighbour: (" + relativeX + "," + relativeZ + "), chunk: " + this.loc); -+ } -+ final long before = this.neighbourChunksLoadedBitset; -+ final int index = getNeighbourIndex(relativeX, relativeZ); -+ this.loadedNeighbourChunks[index] = chunk; -+ this.neighbourChunksLoadedBitset |= (1L << index); -+ this.onNeighbourChange(before, this.neighbourChunksLoadedBitset); -+ } -+ -+ public final void setNeighbourUnloaded(final int relativeX, final int relativeZ) { -+ final long before = this.neighbourChunksLoadedBitset; -+ final int index = getNeighbourIndex(relativeX, relativeZ); -+ this.loadedNeighbourChunks[index] = null; -+ this.neighbourChunksLoadedBitset &= ~(1L << index); -+ this.onNeighbourChange(before, this.neighbourChunksLoadedBitset); -+ } -+ -+ public final void resetNeighbours() { -+ final long before = this.neighbourChunksLoadedBitset; -+ this.neighbourChunksLoadedBitset = 0L; -+ java.util.Arrays.fill(this.loadedNeighbourChunks, null); -+ this.onNeighbourChange(before, 0L); -+ } -+ -+ protected void onNeighbourChange(final long bitsetBefore, final long bitsetAfter) { -+ -+ } -+ -+ public final boolean isAnyNeighborsLoaded() { -+ return neighbourChunksLoadedBitset != 0; -+ } -+ public final boolean areNeighboursLoaded(final int radius) { -+ return Chunk.areNeighboursLoaded(this.neighbourChunksLoadedBitset, radius); -+ } -+ -+ public static boolean areNeighboursLoaded(final long bitset, final int radius) { -+ // index = relativeX + (relativeZ * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)) + (NEIGHBOUR_CACHE_RADIUS + NEIGHBOUR_CACHE_RADIUS * ((NEIGHBOUR_CACHE_RADIUS * 2 + 1))) -+ switch (radius) { -+ case 0: { -+ return (bitset & (1L << getNeighbourIndex(0, 0))) != 0; -+ } -+ case 1: { -+ long mask = 0L; -+ for (int dx = -1; dx <= 1; ++dx) { -+ for (int dz = -1; dz <= 1; ++dz) { -+ mask |= (1L << getNeighbourIndex(dx, dz)); -+ } -+ } -+ return (bitset & mask) == mask; -+ } -+ case 2: { -+ long mask = 0L; -+ for (int dx = -2; dx <= 2; ++dx) { -+ for (int dz = -2; dz <= 2; ++dz) { -+ mask |= (1L << getNeighbourIndex(dx, dz)); -+ } -+ } -+ return (bitset & mask) == mask; -+ } -+ case 3: { -+ long mask = 0L; -+ for (int dx = -3; dx <= 3; ++dx) { -+ for (int dz = -3; dz <= 3; ++dz) { -+ mask |= (1L << getNeighbourIndex(dx, dz)); -+ } -+ } -+ return (bitset & mask) == mask; -+ } -+ -+ default: -+ throw new IllegalArgumentException("Radius not recognized: " + radius); -+ } -+ } -+ // Paper end -+ - public Chunk(World world, ProtoChunk protochunk) { - this(world, protochunk.getPos(), protochunk.getBiomeIndex(), protochunk.p(), protochunk.n(), protochunk.o(), protochunk.getInhabitedTime(), protochunk.getSections(), (Consumer) null); - Iterator iterator = protochunk.y().iterator(); -@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { ++ public int size() { return this.a(); } // Paper - OBFHELPER + public int a() { + return this.b.size(); + } +diff --git a/src/main/java/net/minecraft/nbt/NBTTagCompound.java b/src/main/java/net/minecraft/nbt/NBTTagCompound.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/nbt/NBTTagCompound.java ++++ b/src/main/java/net/minecraft/nbt/NBTTagCompound.java +@@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { + return "TAG_Compound"; } - } - -+ // Paper start - If loaded util -+ @Override -+ public Fluid getFluidIfLoaded(BlockPosition blockposition) { -+ return this.getFluid(blockposition); -+ } -+ -+ @Override -+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) { -+ return this.getType(blockposition); -+ } -+ // Paper end -+ - @Override - public Fluid getFluid(BlockPosition blockposition) { - return this.a(blockposition.getX(), blockposition.getY(), blockposition.getZ()); -@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - entity.chunkX = this.loc.x; - entity.chunkY = k; - entity.chunkZ = this.loc.z; -+ this.entities.add(entity); // Paper - per chunk entity list - this.entitySlices[k].add(entity); - } - -@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - } - - this.entitySlices[i].remove(entity); -+ this.entities.remove(entity); // Paper - } - - @Override -@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - return this.a(blockposition, Chunk.EnumTileEntityState.CHECK); - } - -+ @Nullable public final TileEntity getTileEntityImmediately(BlockPosition pos) { return this.a(pos, EnumTileEntityState.IMMEDIATE); } // Paper - OBFHELPER - @Nullable - public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) { - // CraftBukkit start -@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - - // CraftBukkit start - public void loadCallback() { -+ // Paper start - neighbour cache -+ int chunkX = this.loc.x; -+ int chunkZ = this.loc.z; -+ ChunkProviderServer chunkProvider = ((WorldServer)this.world).getChunkProvider(); -+ for (int dx = -NEIGHBOUR_CACHE_RADIUS; dx <= NEIGHBOUR_CACHE_RADIUS; ++dx) { -+ for (int dz = -NEIGHBOUR_CACHE_RADIUS; dz <= NEIGHBOUR_CACHE_RADIUS; ++dz) { -+ Chunk neighbour = chunkProvider.getChunkAtIfLoadedMainThreadNoCache(chunkX + dx, chunkZ + dz); -+ if (neighbour != null) { -+ neighbour.setNeighbourLoaded(-dx, -dz, this); -+ // should be in cached already -+ this.setNeighbourLoaded(dx, dz, neighbour); -+ } -+ } -+ } -+ this.setNeighbourLoaded(0, 0, this); -+ this.loadedTicketLevel = true; -+ // Paper end - neighbour cache - org.bukkit.Server server = this.world.getServer(); -+ ((WorldServer)this.world).getChunkProvider().addLoadedChunk(this); // Paper - if (server != null) { - /* - * If it's a new world, the first few chunks are generated inside -@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - server.getPluginManager().callEvent(unloadEvent); - // note: saving can be prevented, but not forced if no saving is actually required - this.mustNotSave = !unloadEvent.isSaveChunk(); -+ ((WorldServer)this.world).getChunkProvider().removeLoadedChunk(this); // Paper -+ // Paper start - neighbour cache -+ int chunkX = this.loc.x; -+ int chunkZ = this.loc.z; -+ ChunkProviderServer chunkProvider = ((WorldServer)this.world).getChunkProvider(); -+ for (int dx = -NEIGHBOUR_CACHE_RADIUS; dx <= NEIGHBOUR_CACHE_RADIUS; ++dx) { -+ for (int dz = -NEIGHBOUR_CACHE_RADIUS; dz <= NEIGHBOUR_CACHE_RADIUS; ++dz) { -+ Chunk neighbour = chunkProvider.getChunkAtIfLoadedMainThreadNoCache(chunkX + dx, chunkZ + dz); -+ if (neighbour != null) { -+ neighbour.setNeighbourUnloaded(-dx, -dz); -+ } -+ } -+ } -+ this.loadedTicketLevel = false; -+ this.resetNeighbours(); -+ // Paper end - } - // CraftBukkit end - -diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - - for (k = this.a; k <= i; ++k) { - for (l = this.b; l <= j; ++l) { -- this.c[k - this.a][l - this.b] = ichunkprovider.a(k, l); -+ this.c[k - this.a][l - this.b] = ((WorldServer)world).getChunkProvider().getChunkAtIfLoadedMainThreadNoCache(k, l); // Paper - } - } - -@@ -0,0 +0,0 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { - int k = i - this.a; - int l = j - this.b; - -- if (k >= 0 && k < this.c.length && l >= 0 && l < this.c[k].length) { -+ if (k >= 0 && k < this.c.length && l >= 0 && l < this.c[k].length) { // Paper - if this changes, update getChunkIfLoaded below - IChunkAccess ichunkaccess = this.c[k][l]; - - return (IChunkAccess) (ichunkaccess != null ? ichunkaccess : new ChunkEmpty(this.e, new ChunkCoordIntPair(i, j))); -@@ -0,0 +0,0 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { - return this.a(i, j); - } - -+ // Paper start - if loaded util -+ private IChunkAccess getChunkIfLoaded(int x, int z) { -+ int k = x - this.a; -+ int l = z - this.b; -+ -+ if (k >= 0 && k < this.c.length && l >= 0 && l < this.c[k].length) { -+ return this.c[k][l]; -+ } -+ return null; -+ } -+ @Override -+ public Fluid getFluidIfLoaded(BlockPosition blockposition) { -+ IChunkAccess chunk = getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); -+ return chunk == null ? null : chunk.getFluid(blockposition); -+ } -+ -+ @Override -+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) { -+ IChunkAccess chunk = getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); -+ return chunk == null ? null : chunk.getType(blockposition); -+ } -+ // Paper end -+ - @Nullable - @Override - public TileEntity getTileEntity(BlockPosition blockposition) { -diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -+++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -@@ -0,0 +0,0 @@ public class ChunkCoordIntPair { - public static final long a = pair(1875016, 1875016); - public final int x; - public final int z; -+ public final long longKey; // Paper - - public ChunkCoordIntPair(int i, int j) { - this.x = i; - this.z = j; -+ this.longKey = pair(this.x, this.z); // Paper - } - - public ChunkCoordIntPair(BlockPosition blockposition) { - this.x = blockposition.getX() >> 4; - this.z = blockposition.getZ() >> 4; -+ this.longKey = pair(this.x, this.z); // Paper - } - - public ChunkCoordIntPair(long i) { - this.x = (int) i; - this.z = (int) (i >> 32); -+ this.longKey = pair(this.x, this.z); // Paper - } - - public long pair() { -- return pair(this.x, this.z); -+ return longKey; // Paper - } - -- public static long pair(int i, int j) { -+ public static long pair(final BlockPosition pos) { return pair(pos.getX() >> 4, pos.getZ() >> 4); } // Paper - OBFHELPER -+ public static long pair(int i, int j) { - return (long) i & 4294967295L | ((long) j & 4294967295L) << 32; - } - -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -0,0 +0,0 @@ import java.util.function.Consumer; - import java.util.function.Function; - import java.util.function.Supplier; - import javax.annotation.Nullable; -+import com.destroystokyo.paper.exception.ServerInternalException; -+import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; - - public class ChunkProviderServer extends IChunkProvider { - -@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { - private final ChunkMapDistance chunkMapDistance; - public final ChunkGenerator chunkGenerator; - private final WorldServer world; -- private final Thread serverThread; -+ public final Thread serverThread; // Paper - private -> public - private final LightEngineThreaded lightEngine; - private final ChunkProviderServer.a serverThreadQueue; - public final PlayerChunkMap playerChunkMap; -@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { - private final IChunkAccess[] cacheChunk = new IChunkAccess[4]; - @Nullable - private SpawnerCreature.d p; -+ // Paper start -+ final com.destroystokyo.paper.util.concurrent.WeakSeqLock loadedChunkMapSeqLock = new com.destroystokyo.paper.util.concurrent.WeakSeqLock(); -+ final Long2ObjectOpenHashMap<Chunk> loadedChunkMap = new Long2ObjectOpenHashMap<>(8192, 0.5f); -+ -+ private final Chunk[] lastLoadedChunks = new Chunk[4 * 4]; -+ -+ private static int getChunkCacheKey(int x, int z) { -+ return x & 3 | ((z & 3) << 2); -+ } -+ -+ void addLoadedChunk(Chunk chunk) { -+ this.loadedChunkMapSeqLock.acquireWrite(); -+ try { -+ this.loadedChunkMap.put(chunk.coordinateKey, chunk); -+ } finally { -+ this.loadedChunkMapSeqLock.releaseWrite(); -+ } -+ -+ // rewrite cache if we have to -+ // we do this since we also cache null chunks -+ int cacheKey = getChunkCacheKey(chunk.locX, chunk.locZ); -+ -+ this.lastLoadedChunks[cacheKey] = chunk; -+ } -+ -+ void removeLoadedChunk(Chunk chunk) { -+ this.loadedChunkMapSeqLock.acquireWrite(); -+ try { -+ this.loadedChunkMap.remove(chunk.coordinateKey); -+ } finally { -+ this.loadedChunkMapSeqLock.releaseWrite(); -+ } -+ -+ // rewrite cache if we have to -+ // we do this since we also cache null chunks -+ int cacheKey = getChunkCacheKey(chunk.locX, chunk.locZ); -+ -+ Chunk cachedChunk = this.lastLoadedChunks[cacheKey]; -+ if (cachedChunk != null && cachedChunk.coordinateKey == chunk.coordinateKey) { -+ this.lastLoadedChunks[cacheKey] = null; -+ } -+ } -+ -+ public final Chunk getChunkAtIfLoadedMainThread(int x, int z) { -+ int cacheKey = getChunkCacheKey(x, z); -+ -+ Chunk cachedChunk = this.lastLoadedChunks[cacheKey]; -+ if (cachedChunk != null && cachedChunk.locX == x & cachedChunk.locZ == z) { -+ return this.lastLoadedChunks[cacheKey]; -+ } -+ -+ long chunkKey = ChunkCoordIntPair.pair(x, z); -+ -+ cachedChunk = this.loadedChunkMap.get(chunkKey); -+ // Skipping a null check to avoid extra instructions to improve inline capability -+ this.lastLoadedChunks[cacheKey] = cachedChunk; -+ return cachedChunk; -+ } -+ -+ public final Chunk getChunkAtIfLoadedMainThreadNoCache(int x, int z) { -+ return this.loadedChunkMap.get(ChunkCoordIntPair.pair(x, z)); -+ } -+ -+ public final Chunk getChunkAtMainThread(int x, int z) { -+ Chunk ret = this.getChunkAtIfLoadedMainThread(x, z); -+ if (ret != null) { -+ return ret; -+ } -+ return (Chunk)this.getChunkAt(x, z, ChunkStatus.FULL, true); -+ } -+ -+ private long chunkFutureAwaitCounter; -+ -+ public void getEntityTickingChunkAsync(int x, int z, java.util.function.Consumer<Chunk> onLoad) { -+ if (Thread.currentThread() != this.serverThread) { -+ this.serverThreadQueue.execute(() -> { -+ ChunkProviderServer.this.getEntityTickingChunkAsync(x, z, onLoad); -+ }); -+ return; -+ } -+ this.getChunkFutureAsynchronously(x, z, 31, PlayerChunk::getEntityTickingFuture, onLoad); -+ } -+ -+ public void getTickingChunkAsync(int x, int z, java.util.function.Consumer<Chunk> onLoad) { -+ if (Thread.currentThread() != this.serverThread) { -+ this.serverThreadQueue.execute(() -> { -+ ChunkProviderServer.this.getTickingChunkAsync(x, z, onLoad); -+ }); -+ return; -+ } -+ this.getChunkFutureAsynchronously(x, z, 32, PlayerChunk::getTickingFuture, onLoad); -+ } -+ -+ public void getFullChunkAsync(int x, int z, java.util.function.Consumer<Chunk> onLoad) { -+ if (Thread.currentThread() != this.serverThread) { -+ this.serverThreadQueue.execute(() -> { -+ ChunkProviderServer.this.getFullChunkAsync(x, z, onLoad); -+ }); -+ return; -+ } -+ this.getChunkFutureAsynchronously(x, z, 33, PlayerChunk::getFullChunkFuture, onLoad); -+ } -+ -+ private void getChunkFutureAsynchronously(int x, int z, int ticketLevel, Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>> futureGet, java.util.function.Consumer<Chunk> onLoad) { -+ if (Thread.currentThread() != this.serverThread) { -+ throw new IllegalStateException(); -+ } -+ ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(x, z); -+ Long identifier = this.chunkFutureAwaitCounter++; -+ this.chunkMapDistance.addTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier); -+ this.tickDistanceManager(); -+ -+ PlayerChunk chunk = this.playerChunkMap.getUpdatingChunk(chunkPos.pair()); -+ -+ if (chunk == null) { -+ throw new IllegalStateException("Expected playerchunk " + chunkPos + " in world '" + this.world.getWorld().getName() + "'"); -+ } -+ -+ CompletableFuture<Either<Chunk, PlayerChunk.Failure>> future = futureGet.apply(chunk); -+ -+ future.whenCompleteAsync((either, throwable) -> { -+ try { -+ if (throwable != null) { -+ if (throwable instanceof ThreadDeath) { -+ throw (ThreadDeath)throwable; -+ } -+ MinecraftServer.LOGGER.fatal("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ChunkProviderServer.this.world.getWorld().getName() + "'", throwable); -+ } else if (either.right().isPresent()) { -+ MinecraftServer.LOGGER.fatal("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ChunkProviderServer.this.world.getWorld().getName() + "': " + either.right().get().toString()); -+ } -+ -+ try { -+ if (onLoad != null) { -+ playerChunkMap.callbackExecutor.execute(() -> { -+ onLoad.accept(either == null ? null : either.left().orElse(null)); // indicate failure to the callback. -+ }); -+ } -+ } catch (Throwable thr) { -+ if (thr instanceof ThreadDeath) { -+ throw (ThreadDeath)thr; -+ } -+ MinecraftServer.LOGGER.fatal("Load callback for future await failed " + chunkPos.toString() + " in world '" + ChunkProviderServer.this.world.getWorld().getName() + "'", thr); -+ return; -+ } -+ } finally { -+ // due to odd behaviour with CB unload implementation we need to have these AFTER the load callback. -+ ChunkProviderServer.this.chunkMapDistance.addTicketAtLevel(TicketType.UNKNOWN, chunkPos, ticketLevel, chunkPos); -+ ChunkProviderServer.this.chunkMapDistance.removeTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier); -+ } -+ }, this.serverThreadQueue); -+ } -+ // Paper end - - public ChunkProviderServer(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator chunkgenerator, int i, boolean flag, WorldLoadListener worldloadlistener, Supplier<WorldPersistentData> supplier) { - this.world = worldserver; -@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { - this.cacheChunk[0] = ichunkaccess; - } - -+ // Paper start - "real" get chunk if loaded -+ // Note: Partially copied from the getChunkAt method below -+ @Nullable -+ public Chunk getChunkAtIfCachedImmediately(int x, int z) { -+ long k = ChunkCoordIntPair.pair(x, z); -+ -+ // Note: Bypass cache since we need to check ticket level, and to make this MT-Safe -+ -+ PlayerChunk playerChunk = this.getChunk(k); -+ if (playerChunk == null) { -+ return null; -+ } -+ -+ return playerChunk.getFullChunkIfCached(); -+ } -+ -+ @Nullable -+ public Chunk getChunkAtIfLoadedImmediately(int x, int z) { -+ long k = ChunkCoordIntPair.pair(x, z); -+ -+ if (Thread.currentThread() == this.serverThread) { -+ return this.getChunkAtIfLoadedMainThread(x, z); -+ } -+ -+ Chunk ret = null; -+ long readlock; -+ do { -+ readlock = this.loadedChunkMapSeqLock.acquireRead(); -+ try { -+ ret = this.loadedChunkMap.get(k); -+ } catch (Throwable thr) { -+ if (thr instanceof ThreadDeath) { -+ throw (ThreadDeath)thr; -+ } -+ // re-try, this means a CME occurred... -+ continue; -+ } -+ } while (!this.loadedChunkMapSeqLock.tryReleaseRead(readlock)); -+ -+ return ret; -+ } -+ // Paper end -+ - @Nullable - @Override - public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) { -@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { - - this.p = spawnercreature_d; - this.world.getMethodProfiler().exit(); -- List<PlayerChunk> list = Lists.newArrayList(this.playerChunkMap.f()); -- -- Collections.shuffle(list); -- list.forEach((playerchunk) -> { -+ //List<PlayerChunk> list = Lists.newArrayList(this.playerChunkMap.f()); // Paper -+ //Collections.shuffle(list); // Paper -+ this.playerChunkMap.f().forEach((playerchunk) -> { // Paper - no... just no... - Optional<Chunk> optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); - - if (optional.isPresent()) { -diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -0,0 +0,0 @@ public class ChunkSection { - return this.blockIds; - } - -+ public void writeChunkSection(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER - public void b(PacketDataSerializer packetdataserializer) { - packetdataserializer.writeShort(this.nonEmptyBlockCount); - this.blockIds.b(packetdataserializer); -diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DataBits.java -+++ b/src/main/java/net/minecraft/server/DataBits.java -@@ -0,0 +0,0 @@ public class DataBits { - return (int) (k >> l & this.d); - } - -+ public final long[] getDataBits() { return this.a(); } // Paper - OBFHELPER - public long[] a() { - return this.b; - } -diff --git a/src/main/java/net/minecraft/server/DataPalette.java b/src/main/java/net/minecraft/server/DataPalette.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DataPalette.java -+++ b/src/main/java/net/minecraft/server/DataPalette.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; - - public interface DataPalette<T> { - -+ default int getOrCreateIdFor(T object) { return this.a(object); } // Paper - OBFHELPER - int a(T t0); - - boolean a(Predicate<T> predicate); - -+ @Nullable default T getObject(int dataBits) { return this.a(dataBits); } // Paper - OBFHELPER - @Nullable - T a(int i); - -diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DataPaletteBlock.java -+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java -@@ -0,0 +0,0 @@ import java.util.stream.Collectors; - - public class DataPaletteBlock<T> implements DataPaletteExpandable<T> { - -- private final DataPalette<T> b; -+ private final DataPalette<T> b; private final DataPalette<T> getDataPaletteGlobal() { return this.b; } // Paper - OBFHELPER - private final DataPaletteExpandable<T> c = (i, object) -> { - return 0; }; -@@ -0,0 +0,0 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> { - private final Function<NBTTagCompound, T> e; - private final Function<T, NBTTagCompound> f; - private final T g; -- protected DataBits a; -- private DataPalette<T> h; -- private int i; -+ protected DataBits a; public final DataBits getDataBits() { return this.a; } // Paper - OBFHELPER -+ private DataPalette<T> h; private DataPalette<T> getDataPalette() { return this.h; } // Paper - OBFHELPER -+ private int i; private int getBitsPerObject() { return this.i; } // Paper - OBFHELPER - private final ReentrantLock j = new ReentrantLock(); +- private final Map<String, NBTBase> map; ++ public final Map<String, NBTBase> map; // Paper - public void a() { -@@ -0,0 +0,0 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> { - return j << 8 | k << 4 | i; + protected NBTTagCompound(Map<String, NBTBase> map) { + this.map = map; +@@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { + this.map.put(s, NBTTagLong.a(i)); } -+ private void initialize(int bitsPerObject) { this.b(bitsPerObject); } // Paper - OBFHELPER - private void b(int i) { - if (i != this.i) { - this.i = i; -@@ -0,0 +0,0 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> { - return t0 == null ? this.g : t0; ++ public void setUUID(String prefix, UUID uuid) { a(prefix, uuid); } // Paper - OBFHELPER + public void a(String s, UUID uuid) { + this.map.put(s, GameProfileSerializer.a(uuid)); } -+ public void writeDataPaletteBlock(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER - public void b(PacketDataSerializer packetdataserializer) { - this.a(); - packetdataserializer.writeByte(this.i); -diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityCreature.java -+++ b/src/main/java/net/minecraft/server/EntityCreature.java -@@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityUnleashEvent; - - public abstract class EntityCreature extends EntityInsentient { - -+ public org.bukkit.craftbukkit.entity.CraftCreature getBukkitCreature() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper + - protected EntityCreature(EntityTypes<? extends EntityCreature> entitytypes, World world) { - super(entitytypes, world); ++ @Nullable public UUID getUUID(String prefix) { return a(prefix); } // Paper - OBFHELPER ++ @Nullable + public UUID a(String s) { + return GameProfileSerializer.a(this.get(s)); } -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { - return this.goalTarget; - } - -+ public org.bukkit.craftbukkit.entity.CraftMob getBukkitMob() { return (org.bukkit.craftbukkit.entity.CraftMob) super.getBukkitEntity(); } // Paper - public void setGoalTarget(@Nullable EntityLiving entityliving) { - // CraftBukkit start - fire event - setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true); -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - public boolean collides = true; - public Set<UUID> collidableExemptions = new HashSet<>(); - public boolean canPickUpLoot; -+ public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper - - @Override - public float getBukkitYaw() { -diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityMonster.java -+++ b/src/main/java/net/minecraft/server/EntityMonster.java -@@ -0,0 +0,0 @@ import java.util.function.Predicate; - - public abstract class EntityMonster extends EntityCreature implements IMonster { - -+ public org.bukkit.craftbukkit.entity.CraftMonster getBukkitMonster() { return (org.bukkit.craftbukkit.entity.CraftMonster) super.getBukkitEntity(); } // Paper - protected EntityMonster(EntityTypes<? extends EntityMonster> entitytypes, World world) { - super(entitytypes, world); - this.f = 5; -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - public Integer clientViewDistance; - // CraftBukkit end - -+ public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> cachedSingleHashSet; // Paper -+ - public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { - super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); - this.spawnDimension = World.OVERWORLD; -@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - this.c(worldserver); - this.co = minecraftserver.a(this); - -+ this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper -+ - // CraftBukkit start - this.displayName = this.getName(); - this.canPickUpLoot = true; -diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTypes.java -+++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -0,0 +0,0 @@ package net.minecraft.server; - import com.google.common.collect.ImmutableSet; - import java.util.Optional; - import java.util.Set; // Paper -+import java.util.Map; // Paper - import java.util.UUID; - import java.util.function.Function; - import java.util.stream.Stream; -@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { - return this.br.height; - } - -- @Nullable -- public T a(World world) { -+ public T create(World world) { return this.a(world); } // Paper - OBFHELPER -+ @Nullable public T a(World world) { // Paper - OBFHELPER - return this.bf.create(this, world); - } - -diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -+++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -@@ -0,0 +0,0 @@ public abstract class IAsyncTaskHandler<R extends Runnable> implements Mailbox<R +--- a/src/main/java/net/minecraft/network/NetworkManager.java ++++ b/src/main/java/net/minecraft/network/NetworkManager.java +@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { } -+ // Paper start -+ public void scheduleOnMain(Runnable r0) { -+ // postToMainThread does not work the same as older versions of mc -+ // This method is actually used to create a TickTask, which can then be posted onto main -+ this.addTask(this.postToMainThread(r0)); -+ } -+ // Paper end -+ -+ public final void addTask(R r0) { a(r0); }; // Paper - OBFHELPER - public void a(R r0) { - this.d.add(r0); - LockSupport.unpark(this.getThread()); -diff --git a/src/main/java/net/minecraft/server/IBlockAccess.java b/src/main/java/net/minecraft/server/IBlockAccess.java ++ private void dispatchPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericFutureListener) { this.b(packet, genericFutureListener); } // Paper - OBFHELPER + private void b(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) { + EnumProtocol enumprotocol = EnumProtocol.a(packet); + EnumProtocol enumprotocol1 = (EnumProtocol) this.channel.attr(NetworkManager.c).get(); +@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { + + } + ++ private void sendPacketQueue() { this.p(); } // Paper - OBFHELPER + private void p() { + if (this.channel != null && this.channel.isOpen()) { + Queue queue = this.packetQueue; +@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { + + static class QueuedPacket { + +- private final Packet<?> a; ++ private final Packet<?> a; private final Packet<?> getPacket() { return this.a; } // Paper - OBFHELPER + @Nullable +- private final GenericFutureListener<? extends Future<? super Void>> b; ++ private final GenericFutureListener<? extends Future<? super Void>> b; private final GenericFutureListener<? extends Future<? super Void>> getGenericFutureListener() { return this.b; } // Paper - OBFHELPER + + public QueuedPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) { + this.a = packet; +diff --git a/src/main/java/net/minecraft/network/PacketDataSerializer.java b/src/main/java/net/minecraft/network/PacketDataSerializer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IBlockAccess.java -+++ b/src/main/java/net/minecraft/server/IBlockAccess.java -@@ -0,0 +0,0 @@ public interface IBlockAccess { - TileEntity getTileEntity(BlockPosition blockposition); +--- a/src/main/java/net/minecraft/network/PacketDataSerializer.java ++++ b/src/main/java/net/minecraft/network/PacketDataSerializer.java +@@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { + this.a = bytebuf; + } - IBlockData getType(BlockPosition blockposition); -+ // Paper start - if loaded util -+ IBlockData getTypeIfLoaded(BlockPosition blockposition); -+ default Material getMaterialIfLoaded(BlockPosition blockposition) { -+ IBlockData type = this.getTypeIfLoaded(blockposition); -+ return type == null ? null : type.getMaterial(); -+ } -+ -+ default Block getBlockIfLoaded(BlockPosition blockposition) { -+ IBlockData type = this.getTypeIfLoaded(blockposition); -+ return type == null ? null : type.getBlock(); -+ } -+ Fluid getFluidIfLoaded(BlockPosition blockposition); -+ // Paper end - - Fluid getFluid(BlockPosition blockposition); - -diff --git a/src/main/java/net/minecraft/server/IOWorker.java b/src/main/java/net/minecraft/server/IOWorker.java ++ public static int countBytes(int i) { return PacketDataSerializer.a(i); } // Paper - OBFHELPER + public static int a(int i) { + for (int j = 1; j < 5; ++j) { + if ((i & -1 << j * 7) == 0) { +diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IOWorker.java -+++ b/src/main/java/net/minecraft/server/IOWorker.java -@@ -0,0 +0,0 @@ public class IOWorker implements AutoCloseable { - private static final Logger LOGGER = LogManager.getLogger(); - private final AtomicBoolean b = new AtomicBoolean(); - private final ThreadedMailbox<PairedQueue.b> c; -- private final RegionFileCache d; -+ private final RegionFileCache d;public RegionFileCache getRegionFileCache() { return d; } // Paper - OBFHELPER - private final Map<ChunkCoordIntPair, IOWorker.a> e = Maps.newLinkedHashMap(); - - protected IOWorker(File file, boolean flag, String s) { -diff --git a/src/main/java/net/minecraft/server/IWorldReader.java b/src/main/java/net/minecraft/server/IWorldReader.java +--- a/src/main/java/net/minecraft/network/PacketEncoder.java ++++ b/src/main/java/net/minecraft/network/PacketEncoder.java +@@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { + packet.b(packetdataserializer); + } catch (Throwable throwable) { + PacketEncoder.LOGGER.error(throwable); ++ throwable.printStackTrace(); // Paper - WHAT WAS IT? WHO DID THIS TO YOU? WHAT DID YOU SEE? + if (packet.a()) { + throw new SkipEncodeException(throwable); + } else { +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInBEdit.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInBEdit.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IWorldReader.java -+++ b/src/main/java/net/minecraft/server/IWorldReader.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInBEdit.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInBEdit.java +@@ -0,0 +0,0 @@ import net.minecraft.world.item.ItemStack; - public interface IWorldReader extends IBlockLightAccess, ICollisionAccess, BiomeManager.Provider { + public class PacketPlayInBEdit implements Packet<PacketListenerPlayIn> { -+ @Nullable IChunkAccess getChunkIfLoadedImmediately(int x, int z); // Paper - ifLoaded api (we need this since current impl blocks if the chunk is loading) +- private ItemStack a; ++ private ItemStack a; public ItemStack getBook() { return a; } // Paper - OBFHELPER + private boolean b; + private int c; + +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java +@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { + private NBTTagCompound d; @Nullable - IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag); + private int[] e; +- private byte[] f; ++ private byte[] f; private byte[] getData() { return this.f; } // Paper - OBFHELPER + private List<NBTTagCompound> g; + private boolean h; -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - })).apply(instance, ItemStack::new); - }); - private static final Logger LOGGER = LogManager.getLogger(); -- public static final ItemStack b = new ItemStack((Item) null); -+ public static final ItemStack b = new ItemStack((Item) null);public static final ItemStack NULL_ITEM = b; // Paper - OBFHELPER - public static final DecimalFormat c = (DecimalFormat) SystemUtils.a((new DecimalFormat("#.##")), (decimalformat) -> { // CraftBukkit - decompile error - decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); - }); -@@ -0,0 +0,0 @@ public final class ItemStack { - return this.tag != null ? this.tag.getList("Enchantments", 10) : new NBTTagList(); +@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { + return bytebuf; } -+ // Paper start - (this is just a good no conflict location) -+ public org.bukkit.inventory.ItemStack asBukkitMirror() { -+ return CraftItemStack.asCraftMirror(this); -+ } -+ public org.bukkit.inventory.ItemStack asBukkitCopy() { -+ return CraftItemStack.asCraftMirror(this.cloneItemStack()); -+ } -+ public static ItemStack fromBukkitCopy(org.bukkit.inventory.ItemStack itemstack) { -+ return CraftItemStack.asNMSCopy(itemstack); -+ } -+ private org.bukkit.craftbukkit.inventory.CraftItemStack bukkitStack; -+ public org.bukkit.inventory.ItemStack getBukkitStack() { -+ if (bukkitStack == null || bukkitStack.getHandle() != this) { -+ bukkitStack = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(this); -+ } -+ return bukkitStack; -+ } -+ // Paper end - public void setTag(@Nullable NBTTagCompound nbttagcompound) { - this.tag = nbttagcompound; - if (this.getItem().usesDurability()) { -@@ -0,0 +0,0 @@ public final class ItemStack { - return this.tag != null && this.tag.hasKeyOfType("Enchantments", 9) ? !this.tag.getList("Enchantments", 10).isEmpty() : false; - } - -+ public void getOrCreateTagAndSet(String s, NBTBase nbtbase) { a(s, nbtbase);} // Paper - OBFHELPER - public void a(String s, NBTBase nbtbase) { - this.getOrCreateTag().set(s, nbtbase); - } -@@ -0,0 +0,0 @@ public final class ItemStack { - // CraftBukkit start - @Deprecated - public void setItem(Item item) { -+ this.bukkitStack = null; // Paper - this.item = item; - } - // CraftBukkit end ++ public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector) { return this.a(packetDataSerializer, chunk, chunkSectionSelector); } // Paper - OBFHELPER + public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i) { + int j = 0; + ChunkSection[] achunksection = chunk.getSections(); diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 @@ -3303,6 +2503,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import com.destroystokyo.paper.block.TargetBlockInfo; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; ++import net.minecraft.core.BlockPosition; ++import net.minecraft.core.EnumDirection; ++import net.minecraft.server.level.WorldServer; ++import net.minecraft.world.entity.Entity; ++import net.minecraft.world.level.ChunkCoordIntPair; ++import net.minecraft.world.level.RayTrace; ++import net.minecraft.world.level.World; +import org.apache.commons.lang.exception.ExceptionUtils; +import org.bukkit.Location; +import org.bukkit.block.BlockFace; @@ -3815,128 +3022,276 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (org.spigotmc.SpigotConfig.saveUserCacheOnStopOnly) { LOGGER.info("Saving usercache.json"); this.getUserCache().b(); -diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NBTTagCompound.java -+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java -@@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { - return "TAG_Compound"; - } - }; -- private final Map<String, NBTBase> map; -+ public final Map<String, NBTBase> map; // Paper +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.DefinedStruct + import net.minecraft.world.level.storage.Convertable; + import net.minecraft.world.level.storage.WorldData; + import net.minecraft.world.level.storage.WorldPersistentData; ++import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper - protected NBTTagCompound(Map<String, NBTBase> map) { - this.map = map; -@@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { - this.map.put(s, NBTTagLong.a(i)); - } + public class ChunkProviderServer extends IChunkProvider { -+ public void setUUID(String prefix, UUID uuid) { a(prefix, uuid); } // Paper - OBFHELPER - public void a(String s, UUID uuid) { - this.map.put(s, GameProfileSerializer.a(uuid)); - } - -+ -+ @Nullable public UUID getUUID(String prefix) { return a(prefix); } // Paper - OBFHELPER -+ @Nullable - public UUID a(String s) { - return GameProfileSerializer.a(this.get(s)); - } -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { - - } - -+ private void dispatchPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericFutureListener) { this.b(packet, genericFutureListener); } // Paper - OBFHELPER - private void b(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) { - EnumProtocol enumprotocol = EnumProtocol.a(packet); - EnumProtocol enumprotocol1 = (EnumProtocol) this.channel.attr(NetworkManager.c).get(); -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { - - } - -+ private void sendPacketQueue() { this.p(); } // Paper - OBFHELPER - private void p() { - if (this.channel != null && this.channel.isOpen()) { - Queue queue = this.packetQueue; -@@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { - - static class QueuedPacket { - -- private final Packet<?> a; -+ private final Packet<?> a; private final Packet<?> getPacket() { return this.a; } // Paper - OBFHELPER - @Nullable -- private final GenericFutureListener<? extends Future<? super Void>> b; -+ private final GenericFutureListener<? extends Future<? super Void>> b; private final GenericFutureListener<? extends Future<? super Void>> getGenericFutureListener() { return this.b; } // Paper - OBFHELPER - - public QueuedPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) { - this.a = packet; -diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - this.a = bytebuf; - } - -+ public static int countBytes(int i) { return PacketDataSerializer.a(i); } // Paper - OBFHELPER - public static int a(int i) { - for (int j = 1; j < 5; ++j) { - if ((i & -1 << j * 7) == 0) { -diff --git a/src/main/java/net/minecraft/server/PacketEncoder.java b/src/main/java/net/minecraft/server/PacketEncoder.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketEncoder.java -+++ b/src/main/java/net/minecraft/server/PacketEncoder.java -@@ -0,0 +0,0 @@ public class PacketEncoder extends MessageToByteEncoder<Packet<?>> { - packet.b(packetdataserializer); - } catch (Throwable throwable) { - PacketEncoder.LOGGER.error(throwable); -+ throwable.printStackTrace(); // Paper - WHAT WAS IT? WHO DID THIS TO YOU? WHAT DID YOU SEE? - if (packet.a()) { - throw new SkipEncodeException(throwable); - } else { -diff --git a/src/main/java/net/minecraft/server/PacketPlayInBEdit.java b/src/main/java/net/minecraft/server/PacketPlayInBEdit.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInBEdit.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInBEdit.java -@@ -0,0 +0,0 @@ import java.io.IOException; - - public class PacketPlayInBEdit implements Packet<PacketListenerPlayIn> { - -- private ItemStack a; -+ private ItemStack a; public ItemStack getBook() { return a; } // Paper - OBFHELPER - private boolean b; - private int c; - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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<PacketListenerPlayOut> { - private NBTTagCompound d; +@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { + private final ChunkMapDistance chunkMapDistance; + public final ChunkGenerator chunkGenerator; + private final WorldServer world; +- private final Thread serverThread; ++ public final Thread serverThread; // Paper - private -> public + private final LightEngineThreaded lightEngine; + private final ChunkProviderServer.a serverThreadQueue; + public final PlayerChunkMap playerChunkMap; +@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { + private final IChunkAccess[] cacheChunk = new IChunkAccess[4]; @Nullable - private int[] e; -- private byte[] f; -+ private byte[] f; private byte[] getData() { return this.f; } // Paper - OBFHELPER - private List<NBTTagCompound> g; - private boolean h; + private SpawnerCreature.d p; ++ // Paper start ++ final com.destroystokyo.paper.util.concurrent.WeakSeqLock loadedChunkMapSeqLock = new com.destroystokyo.paper.util.concurrent.WeakSeqLock(); ++ final Long2ObjectOpenHashMap<Chunk> loadedChunkMap = new Long2ObjectOpenHashMap<>(8192, 0.5f); ++ ++ private final Chunk[] lastLoadedChunks = new Chunk[4 * 4]; ++ ++ private static int getChunkCacheKey(int x, int z) { ++ return x & 3 | ((z & 3) << 2); ++ } ++ ++ void addLoadedChunk(Chunk chunk) { ++ this.loadedChunkMapSeqLock.acquireWrite(); ++ try { ++ this.loadedChunkMap.put(chunk.coordinateKey, chunk); ++ } finally { ++ this.loadedChunkMapSeqLock.releaseWrite(); ++ } ++ ++ // rewrite cache if we have to ++ // we do this since we also cache null chunks ++ int cacheKey = getChunkCacheKey(chunk.locX, chunk.locZ); ++ ++ this.lastLoadedChunks[cacheKey] = chunk; ++ } ++ ++ void removeLoadedChunk(Chunk chunk) { ++ this.loadedChunkMapSeqLock.acquireWrite(); ++ try { ++ this.loadedChunkMap.remove(chunk.coordinateKey); ++ } finally { ++ this.loadedChunkMapSeqLock.releaseWrite(); ++ } ++ ++ // rewrite cache if we have to ++ // we do this since we also cache null chunks ++ int cacheKey = getChunkCacheKey(chunk.locX, chunk.locZ); ++ ++ Chunk cachedChunk = this.lastLoadedChunks[cacheKey]; ++ if (cachedChunk != null && cachedChunk.coordinateKey == chunk.coordinateKey) { ++ this.lastLoadedChunks[cacheKey] = null; ++ } ++ } ++ ++ public final Chunk getChunkAtIfLoadedMainThread(int x, int z) { ++ int cacheKey = getChunkCacheKey(x, z); ++ ++ Chunk cachedChunk = this.lastLoadedChunks[cacheKey]; ++ if (cachedChunk != null && cachedChunk.locX == x & cachedChunk.locZ == z) { ++ return this.lastLoadedChunks[cacheKey]; ++ } ++ ++ long chunkKey = ChunkCoordIntPair.pair(x, z); ++ ++ cachedChunk = this.loadedChunkMap.get(chunkKey); ++ // Skipping a null check to avoid extra instructions to improve inline capability ++ this.lastLoadedChunks[cacheKey] = cachedChunk; ++ return cachedChunk; ++ } ++ ++ public final Chunk getChunkAtIfLoadedMainThreadNoCache(int x, int z) { ++ return this.loadedChunkMap.get(ChunkCoordIntPair.pair(x, z)); ++ } ++ ++ public final Chunk getChunkAtMainThread(int x, int z) { ++ Chunk ret = this.getChunkAtIfLoadedMainThread(x, z); ++ if (ret != null) { ++ return ret; ++ } ++ return (Chunk)this.getChunkAt(x, z, ChunkStatus.FULL, true); ++ } ++ ++ private long chunkFutureAwaitCounter; ++ ++ public void getEntityTickingChunkAsync(int x, int z, java.util.function.Consumer<Chunk> onLoad) { ++ if (Thread.currentThread() != this.serverThread) { ++ this.serverThreadQueue.execute(() -> { ++ ChunkProviderServer.this.getEntityTickingChunkAsync(x, z, onLoad); ++ }); ++ return; ++ } ++ this.getChunkFutureAsynchronously(x, z, 31, PlayerChunk::getEntityTickingFuture, onLoad); ++ } ++ ++ public void getTickingChunkAsync(int x, int z, java.util.function.Consumer<Chunk> onLoad) { ++ if (Thread.currentThread() != this.serverThread) { ++ this.serverThreadQueue.execute(() -> { ++ ChunkProviderServer.this.getTickingChunkAsync(x, z, onLoad); ++ }); ++ return; ++ } ++ this.getChunkFutureAsynchronously(x, z, 32, PlayerChunk::getTickingFuture, onLoad); ++ } ++ ++ public void getFullChunkAsync(int x, int z, java.util.function.Consumer<Chunk> onLoad) { ++ if (Thread.currentThread() != this.serverThread) { ++ this.serverThreadQueue.execute(() -> { ++ ChunkProviderServer.this.getFullChunkAsync(x, z, onLoad); ++ }); ++ return; ++ } ++ this.getChunkFutureAsynchronously(x, z, 33, PlayerChunk::getFullChunkFuture, onLoad); ++ } ++ ++ private void getChunkFutureAsynchronously(int x, int z, int ticketLevel, Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>> futureGet, java.util.function.Consumer<Chunk> onLoad) { ++ if (Thread.currentThread() != this.serverThread) { ++ throw new IllegalStateException(); ++ } ++ ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(x, z); ++ Long identifier = this.chunkFutureAwaitCounter++; ++ this.chunkMapDistance.addTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier); ++ this.tickDistanceManager(); ++ ++ PlayerChunk chunk = this.playerChunkMap.getUpdatingChunk(chunkPos.pair()); ++ ++ if (chunk == null) { ++ throw new IllegalStateException("Expected playerchunk " + chunkPos + " in world '" + this.world.getWorld().getName() + "'"); ++ } ++ ++ CompletableFuture<Either<Chunk, PlayerChunk.Failure>> future = futureGet.apply(chunk); ++ ++ future.whenCompleteAsync((either, throwable) -> { ++ try { ++ if (throwable != null) { ++ if (throwable instanceof ThreadDeath) { ++ throw (ThreadDeath)throwable; ++ } ++ net.minecraft.server.MinecraftServer.LOGGER.fatal("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ChunkProviderServer.this.world.getWorld().getName() + "'", throwable); ++ } else if (either.right().isPresent()) { ++ net.minecraft.server.MinecraftServer.LOGGER.fatal("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ChunkProviderServer.this.world.getWorld().getName() + "': " + either.right().get().toString()); ++ } ++ ++ try { ++ if (onLoad != null) { ++ playerChunkMap.callbackExecutor.execute(() -> { ++ onLoad.accept(either == null ? null : either.left().orElse(null)); // indicate failure to the callback. ++ }); ++ } ++ } catch (Throwable thr) { ++ if (thr instanceof ThreadDeath) { ++ throw (ThreadDeath)thr; ++ } ++ net.minecraft.server.MinecraftServer.LOGGER.fatal("Load callback for future await failed " + chunkPos.toString() + " in world '" + ChunkProviderServer.this.world.getWorld().getName() + "'", thr); ++ return; ++ } ++ } finally { ++ // due to odd behaviour with CB unload implementation we need to have these AFTER the load callback. ++ ChunkProviderServer.this.chunkMapDistance.addTicketAtLevel(TicketType.UNKNOWN, chunkPos, ticketLevel, chunkPos); ++ ChunkProviderServer.this.chunkMapDistance.removeTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier); ++ } ++ }, this.serverThreadQueue); ++ } ++ // Paper end -@@ -0,0 +0,0 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> { - return bytebuf; + public ChunkProviderServer(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator chunkgenerator, int i, boolean flag, WorldLoadListener worldloadlistener, Supplier<WorldPersistentData> supplier) { + this.world = worldserver; +@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { + this.cacheChunk[0] = ichunkaccess; } -+ public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector) { return this.a(packetDataSerializer, chunk, chunkSectionSelector); } // Paper - OBFHELPER - public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i) { - int j = 0; - ChunkSection[] achunksection = chunk.getSections(); -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java ++ // Paper start - "real" get chunk if loaded ++ // Note: Partially copied from the getChunkAt method below ++ @Nullable ++ public Chunk getChunkAtIfCachedImmediately(int x, int z) { ++ long k = ChunkCoordIntPair.pair(x, z); ++ ++ // Note: Bypass cache since we need to check ticket level, and to make this MT-Safe ++ ++ PlayerChunk playerChunk = this.getChunk(k); ++ if (playerChunk == null) { ++ return null; ++ } ++ ++ return playerChunk.getFullChunkIfCached(); ++ } ++ ++ @Nullable ++ public Chunk getChunkAtIfLoadedImmediately(int x, int z) { ++ long k = ChunkCoordIntPair.pair(x, z); ++ ++ if (Thread.currentThread() == this.serverThread) { ++ return this.getChunkAtIfLoadedMainThread(x, z); ++ } ++ ++ Chunk ret = null; ++ long readlock; ++ do { ++ readlock = this.loadedChunkMapSeqLock.acquireRead(); ++ try { ++ ret = this.loadedChunkMap.get(k); ++ } catch (Throwable thr) { ++ if (thr instanceof ThreadDeath) { ++ throw (ThreadDeath)thr; ++ } ++ // re-try, this means a CME occurred... ++ continue; ++ } ++ } while (!this.loadedChunkMapSeqLock.tryReleaseRead(readlock)); ++ ++ return ret; ++ } ++ // Paper end ++ + @Nullable + @Override + public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) { +@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { + + this.p = spawnercreature_d; + this.world.getMethodProfiler().exit(); +- List<PlayerChunk> list = Lists.newArrayList(this.playerChunkMap.f()); +- +- Collections.shuffle(list); +- list.forEach((playerchunk) -> { ++ //List<PlayerChunk> list = Lists.newArrayList(this.playerChunkMap.f()); // Paper ++ //Collections.shuffle(list); // Paper ++ this.playerChunkMap.f().forEach((playerchunk) -> { // Paper - no... just no... + Optional<Chunk> optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); + + if (optional.isPresent()) { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + public Integer clientViewDistance; + // CraftBukkit end + ++ public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> cachedSingleHashSet; // Paper ++ + public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { + super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); + this.spawnDimension = World.OVERWORLD; +@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + this.c(worldserver); + this.co = minecraftserver.a(this); + ++ this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper ++ + // CraftBukkit start + this.displayName = this.getName(); + this.canPickUpLoot = true; +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { private static final List<ChunkStatus> CHUNK_STATUSES = ChunkStatus.a(); private static final PlayerChunk.State[] CHUNK_STATES = PlayerChunk.State.values(); @@ -4159,10 +3514,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.entityTickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE; } -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { }; // CraftBukkit end @@ -4230,87 +3585,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @Override -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/level/RegionLimitedWorldAccess.java b/src/main/java/net/minecraft/server/level/RegionLimitedWorldAccess.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - private final MinecraftServer minecraftServer; - public EntityPlayer player; - private int e; -- private long lastKeepAlive; -- private boolean awaitingKeepAlive; -- private long h; -+ private long lastKeepAlive; private void setLastPing(long lastPing) { this.lastKeepAlive = lastPing;}; private long getLastPing() { return this.lastKeepAlive;}; // Paper - OBFHELPER -+ private boolean awaitingKeepAlive; private void setPendingPing(boolean isPending) { this.awaitingKeepAlive = isPending;}; private boolean isPendingPing() { return this.awaitingKeepAlive;}; // Paper - OBFHELPER -+ private long h; private void setKeepAliveID(long keepAliveID) { this.h = keepAliveID;}; private long getKeepAliveID() {return this.h; }; // Paper - OBFHELPER - // CraftBukkit start - multithreaded fields - private volatile int chatThrottle; - private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); -diff --git a/src/main/java/net/minecraft/server/PlayerInventory.java b/src/main/java/net/minecraft/server/PlayerInventory.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerInventory.java -+++ b/src/main/java/net/minecraft/server/PlayerInventory.java -@@ -0,0 +0,0 @@ public class PlayerInventory implements IInventory, INamableTileEntity { - public final NonNullList<ItemStack> items; - public final NonNullList<ItemStack> armor; - public final NonNullList<ItemStack> extraSlots; -- private final List<NonNullList<ItemStack>> f; -+ private final List<NonNullList<ItemStack>> f;List<NonNullList<ItemStack>> getComponents() { return f; } // Paper - OBFHELPER - public int itemInHandIndex; - public final EntityHuman player; - private ItemStack carried; -diff --git a/src/main/java/net/minecraft/server/PotionUtil.java b/src/main/java/net/minecraft/server/PotionUtil.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PotionUtil.java -+++ b/src/main/java/net/minecraft/server/PotionUtil.java -@@ -0,0 +0,0 @@ public class PotionUtil { - return nbttagcompound == null ? Potions.EMPTY : PotionRegistry.a(nbttagcompound.getString("Potion")); - } - -+ public static ItemStack addPotionToItemStack(ItemStack itemstack, PotionRegistry potionregistry) { return a(itemstack, potionregistry); } // Paper - OBFHELPER - public static ItemStack a(ItemStack itemstack, PotionRegistry potionregistry) { - MinecraftKey minecraftkey = IRegistry.POTION.getKey(potionregistry); - -diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ProtoChunk.java -+++ b/src/main/java/net/minecraft/server/ProtoChunk.java -@@ -0,0 +0,0 @@ public class ProtoChunk implements IChunkAccess { - - } - -+ // Paper start - If loaded util -+ @Override -+ public Fluid getFluidIfLoaded(BlockPosition blockposition) { -+ return this.getFluid(blockposition); -+ } -+ -+ @Override -+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) { -+ return this.getType(blockposition); -+ } -+ // Paper end -+ - @Override - public IBlockData getType(BlockPosition blockposition) { - int i = blockposition.getY(); -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - return this.e.resolve(s); - } - -+ @Nullable public synchronized DataInputStream getReadStream(ChunkCoordIntPair chunkCoordIntPair) throws IOException { return a(chunkCoordIntPair);} // Paper - OBFHELPER - @Nullable - public synchronized DataInputStream a(ChunkCoordIntPair chunkcoordintpair) throws IOException { - int i = this.getOffset(chunkcoordintpair); -diff --git a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java -+++ b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java +--- a/src/main/java/net/minecraft/server/level/RegionLimitedWorldAccess.java ++++ b/src/main/java/net/minecraft/server/level/RegionLimitedWorldAccess.java @@ -0,0 +0,0 @@ public class RegionLimitedWorldAccess implements GeneratorAccessSeed { return i >= this.n.x && i <= this.o.x && j >= this.n.z && j <= this.o.z; } @@ -4338,35 +3616,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public IBlockData getType(BlockPosition blockposition) { return this.getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4).getType(blockposition); -diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java +diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegistryBlockID.java -+++ b/src/main/java/net/minecraft/server/RegistryBlockID.java -@@ -0,0 +0,0 @@ public class RegistryBlockID<T> implements Registry<T> { - return Iterators.filter(this.c.iterator(), Predicates.notNull()); - } - -+ public int size() { return this.a(); } // Paper - OBFHELPER - public int a() { - return this.b.size(); - } -diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SystemUtils.java -+++ b/src/main/java/net/minecraft/server/SystemUtils.java -@@ -0,0 +0,0 @@ public class SystemUtils { - } - - public static long getMonotonicNanos() { -- return SystemUtils.a.getAsLong(); -+ return System.nanoTime(); // Paper - } - - public static long getTimeMillis() { -diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TicketType.java -+++ b/src/main/java/net/minecraft/server/TicketType.java +--- a/src/main/java/net/minecraft/server/level/TicketType.java ++++ b/src/main/java/net/minecraft/server/level/TicketType.java @@ -0,0 +0,0 @@ public class TicketType<T> { public static final TicketType<ChunkCoordIntPair> UNKNOWN = a("unknown", Comparator.comparingLong(ChunkCoordIntPair::pair), 1); public static final TicketType<Unit> PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit @@ -4375,27 +3628,399 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static <T> TicketType<T> a(String s, Comparator<T> comparator) { return new TicketType<>(s, comparator, 0L); -diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - public static final VoxelShape a = create(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); - private static final VoxelShape c = new VoxelShapeArray(new VoxelShapeBitSet(0, 0, 0), new DoubleArrayList(new double[]{0.0D}), new DoubleArrayList(new double[]{0.0D}), new DoubleArrayList(new double[]{0.0D})); +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry; + import it.unimi.dsi.fastutil.longs.LongSet; + import it.unimi.dsi.fastutil.longs.LongSets; + import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; ++import it.unimi.dsi.fastutil.objects.Object2IntMap; + import it.unimi.dsi.fastutil.objects.ObjectIterator; + import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; + import java.io.BufferedWriter; +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + private final Map<UUID, Entity> entitiesByUUID = Maps.newHashMap(); + private final Queue<Entity> entitiesToAdd = Queues.newArrayDeque(); + private final List<EntityPlayer> players = Lists.newArrayList(); +- private final ChunkProviderServer chunkProvider; ++ public final ChunkProviderServer chunkProvider; // Paper - public + boolean tickingEntities; + private final MinecraftServer server; + public final WorldDataServer worldDataServer; // CraftBukkit - type +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + ObjectIterator objectiterator = spawnercreature_d.b().object2IntEntrySet().iterator(); -+ public static final VoxelShape empty() {return a();} // Paper - OBFHELPER - public static VoxelShape a() { - return VoxelShapes.c; + while (objectiterator.hasNext()) { +- it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<EnumCreatureType> it_unimi_dsi_fastutil_objects_object2intmap_entry = (it.unimi.dsi.fastutil.objects.Object2IntMap.Entry) objectiterator.next(); ++ Object2IntMap.Entry<EnumCreatureType> it_unimi_dsi_fastutil_objects_object2intmap_entry = (Object2IntMap.Entry) objectiterator.next(); // Paper - decompile fix + + bufferedwriter.write(String.format("spawn_count.%s: %d\n", ((EnumCreatureType) it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey()).b(), it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue())); + } +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { + private final MinecraftServer minecraftServer; + public EntityPlayer player; + private int e; +- private long lastKeepAlive; +- private boolean awaitingKeepAlive; +- private long h; ++ private long lastKeepAlive; private void setLastPing(long lastPing) { this.lastKeepAlive = lastPing;}; private long getLastPing() { return this.lastKeepAlive;}; // Paper - OBFHELPER ++ private boolean awaitingKeepAlive; private void setPendingPing(boolean isPending) { this.awaitingKeepAlive = isPending;}; private boolean isPendingPing() { return this.awaitingKeepAlive;}; // Paper - OBFHELPER ++ private long h; private void setKeepAliveID(long keepAliveID) { this.h = keepAliveID;}; private long getKeepAliveID() {return this.h; }; // Paper - OBFHELPER + // CraftBukkit start - multithreaded fields + private volatile int chatThrottle; + private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); +diff --git a/src/main/java/net/minecraft/util/DataBits.java b/src/main/java/net/minecraft/util/DataBits.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/util/DataBits.java ++++ b/src/main/java/net/minecraft/util/DataBits.java +@@ -0,0 +0,0 @@ public class DataBits { + return (int) (k >> l & this.d); } -+ public static final VoxelShape fullCube() {return b();} // Paper - OBFHELPER - public static VoxelShape b() { - return VoxelShapes.b; ++ public final long[] getDataBits() { return this.a(); } // Paper - OBFHELPER + public long[] a() { + return this.b; } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java b/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java ++++ b/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java +@@ -0,0 +0,0 @@ public abstract class IAsyncTaskHandler<R extends Runnable> implements Mailbox<R + + } + ++ // Paper start ++ public void scheduleOnMain(Runnable r0) { ++ // postToMainThread does not work the same as older versions of mc ++ // This method is actually used to create a TickTask, which can then be posted onto main ++ this.addTask(this.postToMainThread(r0)); ++ } ++ // Paper end ++ ++ public final void addTask(R r0) { a(r0); }; // Paper - OBFHELPER + public void a(R r0) { + this.d.add(r0); + LockSupport.unpark(this.getThread()); +diff --git a/src/main/java/net/minecraft/world/entity/EntityCreature.java b/src/main/java/net/minecraft/world/entity/EntityCreature.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityCreature.java ++++ b/src/main/java/net/minecraft/world/entity/EntityCreature.java +@@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityUnleashEvent; + + public abstract class EntityCreature extends EntityInsentient { + ++ public org.bukkit.craftbukkit.entity.CraftCreature getBukkitCreature() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper ++ + protected EntityCreature(EntityTypes<? extends EntityCreature> entitytypes, World world) { + super(entitytypes, world); + } +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { + return this.goalTarget; + } + ++ public org.bukkit.craftbukkit.entity.CraftMob getBukkitMob() { return (org.bukkit.craftbukkit.entity.CraftMob) super.getBukkitEntity(); } // Paper + public void setGoalTarget(@Nullable EntityLiving entityliving) { + // CraftBukkit start - fire event + setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true); +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + public boolean collides = true; + public Set<UUID> collidableExemptions = new HashSet<>(); + public boolean canPickUpLoot; ++ public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper + + @Override + public float getBukkitYaw() { +diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java ++++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java +@@ -0,0 +0,0 @@ package net.minecraft.world.entity; + import com.google.common.collect.ImmutableSet; + import java.util.Optional; + import java.util.Set; // Paper ++import java.util.Map; // Paper + import java.util.UUID; + import java.util.function.Function; + import java.util.stream.Stream; +@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { + return this.br.height; + } + +- @Nullable +- public T a(World world) { ++ public T create(World world) { return this.a(world); } // Paper - OBFHELPER ++ @Nullable public T a(World world) { // Paper - OBFHELPER + return this.bf.create(this, world); + } + +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityMonster.java b/src/main/java/net/minecraft/world/entity/monster/EntityMonster.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityMonster.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityMonster.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.WorldAccess; + + public abstract class EntityMonster extends EntityCreature implements IMonster { + ++ public org.bukkit.craftbukkit.entity.CraftMonster getBukkitMonster() { return (org.bukkit.craftbukkit.entity.CraftMonster) super.getBukkitEntity(); } // Paper + protected EntityMonster(EntityTypes<? extends EntityMonster> entitytypes, World world) { + super(entitytypes, world); + this.f = 5; +diff --git a/src/main/java/net/minecraft/world/entity/player/PlayerInventory.java b/src/main/java/net/minecraft/world/entity/player/PlayerInventory.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/player/PlayerInventory.java ++++ b/src/main/java/net/minecraft/world/entity/player/PlayerInventory.java +@@ -0,0 +0,0 @@ public class PlayerInventory implements IInventory, INamableTileEntity { + public final NonNullList<ItemStack> items; + public final NonNullList<ItemStack> armor; + public final NonNullList<ItemStack> extraSlots; +- private final List<NonNullList<ItemStack>> f; ++ private final List<NonNullList<ItemStack>> f;List<NonNullList<ItemStack>> getComponents() { return f; } // Paper - OBFHELPER + public int itemInHandIndex; + public final EntityHuman player; + private ItemStack carried; +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -0,0 +0,0 @@ public final class ItemStack { + })).apply(instance, ItemStack::new); + }); + private static final Logger LOGGER = LogManager.getLogger(); +- public static final ItemStack b = new ItemStack((Item) null); ++ public static final ItemStack b = new ItemStack((Item) null);public static final ItemStack NULL_ITEM = b; // Paper - OBFHELPER + public static final DecimalFormat c = (DecimalFormat) SystemUtils.a((new DecimalFormat("#.##")), (decimalformat) -> { // CraftBukkit - decompile error + decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); + }); +@@ -0,0 +0,0 @@ public final class ItemStack { + return this.tag != null ? this.tag.getList("Enchantments", 10) : new NBTTagList(); + } + ++ // Paper start - (this is just a good no conflict location) ++ public org.bukkit.inventory.ItemStack asBukkitMirror() { ++ return CraftItemStack.asCraftMirror(this); ++ } ++ public org.bukkit.inventory.ItemStack asBukkitCopy() { ++ return CraftItemStack.asCraftMirror(this.cloneItemStack()); ++ } ++ public static ItemStack fromBukkitCopy(org.bukkit.inventory.ItemStack itemstack) { ++ return CraftItemStack.asNMSCopy(itemstack); ++ } ++ private org.bukkit.craftbukkit.inventory.CraftItemStack bukkitStack; ++ public org.bukkit.inventory.ItemStack getBukkitStack() { ++ if (bukkitStack == null || bukkitStack.getHandle() != this) { ++ bukkitStack = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(this); ++ } ++ return bukkitStack; ++ } ++ // Paper end + public void setTag(@Nullable NBTTagCompound nbttagcompound) { + this.tag = nbttagcompound; + if (this.getItem().usesDurability()) { +@@ -0,0 +0,0 @@ public final class ItemStack { + return this.tag != null && this.tag.hasKeyOfType("Enchantments", 9) ? !this.tag.getList("Enchantments", 10).isEmpty() : false; + } + ++ public void getOrCreateTagAndSet(String s, NBTBase nbtbase) { a(s, nbtbase);} // Paper - OBFHELPER + public void a(String s, NBTBase nbtbase) { + this.getOrCreateTag().set(s, nbtbase); + } +@@ -0,0 +0,0 @@ public final class ItemStack { + // CraftBukkit start + @Deprecated + public void setItem(Item item) { ++ this.bukkitStack = null; // Paper + this.item = item; + } + // CraftBukkit end +diff --git a/src/main/java/net/minecraft/world/item/alchemy/PotionUtil.java b/src/main/java/net/minecraft/world/item/alchemy/PotionUtil.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/item/alchemy/PotionUtil.java ++++ b/src/main/java/net/minecraft/world/item/alchemy/PotionUtil.java +@@ -0,0 +0,0 @@ public class PotionUtil { + return nbttagcompound == null ? Potions.EMPTY : PotionRegistry.a(nbttagcompound.getString("Potion")); + } + ++ public static ItemStack addPotionToItemStack(ItemStack itemstack, PotionRegistry potionregistry) { return a(itemstack, potionregistry); } // Paper - OBFHELPER + public static ItemStack a(ItemStack itemstack, PotionRegistry potionregistry) { + MinecraftKey minecraftkey = IRegistry.POTION.getKey(potionregistry); + +diff --git a/src/main/java/net/minecraft/world/level/BlockAccessAir.java b/src/main/java/net/minecraft/world/level/BlockAccessAir.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/BlockAccessAir.java ++++ b/src/main/java/net/minecraft/world/level/BlockAccessAir.java +@@ -0,0 +0,0 @@ public enum BlockAccessAir implements IBlockAccess { + return null; + } + ++ // Paper start - If loaded util ++ @Override ++ public Fluid getFluidIfLoaded(BlockPosition blockposition) { ++ return this.getFluid(blockposition); ++ } ++ ++ @Override ++ public IBlockData getTypeIfLoaded(BlockPosition blockposition) { ++ return this.getType(blockposition); ++ } ++ // Paper end ++ + @Override + public IBlockData getType(BlockPosition blockposition) { + return Blocks.AIR.getBlockData(); +diff --git a/src/main/java/net/minecraft/world/level/ChunkCache.java b/src/main/java/net/minecraft/world/level/ChunkCache.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/ChunkCache.java ++++ b/src/main/java/net/minecraft/world/level/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 { + + for (k = this.a; k <= i; ++k) { + for (l = this.b; l <= j; ++l) { +- this.c[k - this.a][l - this.b] = ichunkprovider.a(k, l); ++ this.c[k - this.a][l - this.b] = ((WorldServer)world).getChunkProvider().getChunkAtIfLoadedMainThreadNoCache(k, l); // Paper + } + } + +@@ -0,0 +0,0 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { + int k = i - this.a; + int l = j - this.b; + +- if (k >= 0 && k < this.c.length && l >= 0 && l < this.c[k].length) { ++ if (k >= 0 && k < this.c.length && l >= 0 && l < this.c[k].length) { // Paper - if this changes, update getChunkIfLoaded below + IChunkAccess ichunkaccess = this.c[k][l]; + + return (IChunkAccess) (ichunkaccess != null ? ichunkaccess : new ChunkEmpty(this.e, new ChunkCoordIntPair(i, j))); +@@ -0,0 +0,0 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { + return this.a(i, j); + } + ++ // Paper start - if loaded util ++ private IChunkAccess getChunkIfLoaded(int x, int z) { ++ int k = x - this.a; ++ int l = z - this.b; ++ ++ if (k >= 0 && k < this.c.length && l >= 0 && l < this.c[k].length) { ++ return this.c[k][l]; ++ } ++ return null; ++ } ++ @Override ++ public Fluid getFluidIfLoaded(BlockPosition blockposition) { ++ IChunkAccess chunk = getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); ++ return chunk == null ? null : chunk.getFluid(blockposition); ++ } ++ ++ @Override ++ public IBlockData getTypeIfLoaded(BlockPosition blockposition) { ++ IChunkAccess chunk = getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); ++ return chunk == null ? null : chunk.getType(blockposition); ++ } ++ // Paper end ++ + @Nullable + @Override + public TileEntity getTileEntity(BlockPosition blockposition) { +diff --git a/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java b/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java ++++ b/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java +@@ -0,0 +0,0 @@ public class ChunkCoordIntPair { + public static final long a = pair(1875016, 1875016); + public final int x; + public final int z; ++ public final long longKey; // Paper + + public ChunkCoordIntPair(int i, int j) { + this.x = i; + this.z = j; ++ this.longKey = pair(this.x, this.z); // Paper + } + + public ChunkCoordIntPair(BlockPosition blockposition) { + this.x = blockposition.getX() >> 4; + this.z = blockposition.getZ() >> 4; ++ this.longKey = pair(this.x, this.z); // Paper + } + + public ChunkCoordIntPair(long i) { + this.x = (int) i; + this.z = (int) (i >> 32); ++ this.longKey = pair(this.x, this.z); // Paper + } + + public long pair() { +- return pair(this.x, this.z); ++ return longKey; // Paper + } + +- public static long pair(int i, int j) { ++ public static long pair(final BlockPosition pos) { return pair(pos.getX() >> 4, pos.getZ() >> 4); } // Paper - OBFHELPER ++ public static long pair(int i, int j) { + return (long) i & 4294967295L | ((long) j & 4294967295L) << 32; + } + +diff --git a/src/main/java/net/minecraft/world/level/IBlockAccess.java b/src/main/java/net/minecraft/world/level/IBlockAccess.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/IBlockAccess.java ++++ b/src/main/java/net/minecraft/world/level/IBlockAccess.java +@@ -0,0 +0,0 @@ public interface IBlockAccess { + TileEntity getTileEntity(BlockPosition blockposition); + + IBlockData getType(BlockPosition blockposition); ++ // Paper start - if loaded util ++ IBlockData getTypeIfLoaded(BlockPosition blockposition); ++ default Material getMaterialIfLoaded(BlockPosition blockposition) { ++ IBlockData type = this.getTypeIfLoaded(blockposition); ++ return type == null ? null : type.getMaterial(); ++ } ++ ++ default Block getBlockIfLoaded(BlockPosition blockposition) { ++ IBlockData type = this.getTypeIfLoaded(blockposition); ++ return type == null ? null : type.getBlock(); ++ } ++ Fluid getFluidIfLoaded(BlockPosition blockposition); ++ // Paper end + + Fluid getFluid(BlockPosition blockposition); + +diff --git a/src/main/java/net/minecraft/world/level/IWorldReader.java b/src/main/java/net/minecraft/world/level/IWorldReader.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/IWorldReader.java ++++ b/src/main/java/net/minecraft/world/level/IWorldReader.java +@@ -0,0 +0,0 @@ import net.minecraft.world.phys.AxisAlignedBB; + + public interface IWorldReader extends IBlockLightAccess, ICollisionAccess, BiomeManager.Provider { + ++ @Nullable IChunkAccess getChunkIfLoadedImmediately(int x, int z); // Paper - ifLoaded api (we need this since current impl blocks if the chunk is loading) + @Nullable + IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag); + +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; @@ -4489,10 +4114,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return chunk.getType(blockposition); } -diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java +diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldBorder.java -+++ b/src/main/java/net/minecraft/server/WorldBorder.java +--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java ++++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +@@ -0,0 +0,0 @@ public abstract class BlockBase { + return this.a != null ? this.a.d : Block.a(this.getCollisionShape(iblockaccess, blockposition)); + } + ++ public final IBlockData getBlockData() { return p(); } // Paper - OBFHELPER + protected abstract IBlockData p(); + + public boolean isRequiresSpecialTool() { +diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java ++++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java @@ -0,0 +0,0 @@ public class WorldBorder { return this.b(entity.locX(), entity.locZ()); } @@ -4501,36 +4138,402 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public VoxelShape c() { return this.j.m(); } -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry; - import it.unimi.dsi.fastutil.longs.LongSet; - import it.unimi.dsi.fastutil.longs.LongSets; - import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -+import it.unimi.dsi.fastutil.objects.Object2IntMap; - import it.unimi.dsi.fastutil.objects.ObjectIterator; - import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; - import java.io.BufferedWriter; -@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { - private final Map<UUID, Entity> entitiesByUUID = Maps.newHashMap(); - private final Queue<Entity> entitiesToAdd = Queues.newArrayDeque(); - private final List<EntityPlayer> players = Lists.newArrayList(); -- private final ChunkProviderServer chunkProvider; -+ public final ChunkProviderServer chunkProvider; // Paper - public - boolean tickingEntities; - private final MinecraftServer server; - public final WorldDataServer worldDataServer; // CraftBukkit - type -@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { - ObjectIterator objectiterator = spawnercreature_d.b().object2IntEntrySet().iterator(); +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - while (objectiterator.hasNext()) { -- it.unimi.dsi.fastutil.objects.Object2IntMap.Entry<EnumCreatureType> it_unimi_dsi_fastutil_objects_object2intmap_entry = (it.unimi.dsi.fastutil.objects.Object2IntMap.Entry) objectiterator.next(); -+ Object2IntMap.Entry<EnumCreatureType> it_unimi_dsi_fastutil_objects_object2intmap_entry = (Object2IntMap.Entry) objectiterator.next(); // Paper - decompile fix + private static final Logger LOGGER = LogManager.getLogger(); + @Nullable +- public static final ChunkSection a = null; ++ public static final ChunkSection a = null; public static final ChunkSection EMPTY_CHUNK_SECTION = a; // Paper - OBFHELPER + private final ChunkSection[] sections; + private BiomeStorage d; + private final Map<BlockPosition, NBTTagCompound> e; +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + private Supplier<PlayerChunk.State> u; + @Nullable + private Consumer<Chunk> v; +- private final ChunkCoordIntPair loc; ++ private final ChunkCoordIntPair loc; public final long coordinateKey; public final int locX; public final int locZ; // Paper - cache coordinate key + private volatile boolean x; - bufferedwriter.write(String.format("spawn_count.%s: %d\n", ((EnumCreatureType) it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey()).b(), it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue())); - } + public Chunk(World world, ChunkCoordIntPair chunkcoordintpair, BiomeStorage biomestorage) { +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + this.n = new ShortList[16]; + this.entitySlices = (List[]) (new List[16]); // Spigot + this.world = (WorldServer) world; // CraftBukkit - type +- this.loc = chunkcoordintpair; ++ this.locX = chunkcoordintpair.x; this.locZ = chunkcoordintpair.z; // Paper - reduce need for field look ups ++ this.loc = chunkcoordintpair; this.coordinateKey = ChunkCoordIntPair.pair(locX, locZ); // Paper - cache long key + this.i = chunkconverter; + HeightMap.Type[] aheightmap_type = HeightMap.Type.values(); + int j = aheightmap_type.length; +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(DATA_TYPE_REGISTRY); + // CraftBukkit end + ++ // Paper start ++ public final com.destroystokyo.paper.util.maplist.EntityList entities = new com.destroystokyo.paper.util.maplist.EntityList(); ++ public PlayerChunk playerChunk; ++ ++ static final int NEIGHBOUR_CACHE_RADIUS = 3; ++ public static int getNeighbourCacheRadius() { ++ return NEIGHBOUR_CACHE_RADIUS; ++ } ++ ++ boolean loadedTicketLevel; ++ private long neighbourChunksLoadedBitset; ++ private final Chunk[] loadedNeighbourChunks = new Chunk[(NEIGHBOUR_CACHE_RADIUS * 2 + 1) * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)]; ++ ++ private static int getNeighbourIndex(final int relativeX, final int relativeZ) { ++ // index = (relativeX + NEIGHBOUR_CACHE_RADIUS) + (relativeZ + NEIGHBOUR_CACHE_RADIUS) * (NEIGHBOUR_CACHE_RADIUS * 2 + 1) ++ // optimised variant of the above by moving some of the ops to compile time ++ return relativeX + (relativeZ * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)) + (NEIGHBOUR_CACHE_RADIUS + NEIGHBOUR_CACHE_RADIUS * ((NEIGHBOUR_CACHE_RADIUS * 2 + 1))); ++ } ++ ++ public final Chunk getRelativeNeighbourIfLoaded(final int relativeX, final int relativeZ) { ++ return this.loadedNeighbourChunks[getNeighbourIndex(relativeX, relativeZ)]; ++ } ++ ++ public final boolean isNeighbourLoaded(final int relativeX, final int relativeZ) { ++ return (this.neighbourChunksLoadedBitset & (1L << getNeighbourIndex(relativeX, relativeZ))) != 0; ++ } ++ ++ public final void setNeighbourLoaded(final int relativeX, final int relativeZ, final Chunk chunk) { ++ if (chunk == null) { ++ throw new IllegalArgumentException("Chunk must be non-null, neighbour: (" + relativeX + "," + relativeZ + "), chunk: " + this.loc); ++ } ++ final long before = this.neighbourChunksLoadedBitset; ++ final int index = getNeighbourIndex(relativeX, relativeZ); ++ this.loadedNeighbourChunks[index] = chunk; ++ this.neighbourChunksLoadedBitset |= (1L << index); ++ this.onNeighbourChange(before, this.neighbourChunksLoadedBitset); ++ } ++ ++ public final void setNeighbourUnloaded(final int relativeX, final int relativeZ) { ++ final long before = this.neighbourChunksLoadedBitset; ++ final int index = getNeighbourIndex(relativeX, relativeZ); ++ this.loadedNeighbourChunks[index] = null; ++ this.neighbourChunksLoadedBitset &= ~(1L << index); ++ this.onNeighbourChange(before, this.neighbourChunksLoadedBitset); ++ } ++ ++ public final void resetNeighbours() { ++ final long before = this.neighbourChunksLoadedBitset; ++ this.neighbourChunksLoadedBitset = 0L; ++ java.util.Arrays.fill(this.loadedNeighbourChunks, null); ++ this.onNeighbourChange(before, 0L); ++ } ++ ++ protected void onNeighbourChange(final long bitsetBefore, final long bitsetAfter) { ++ ++ } ++ ++ public final boolean isAnyNeighborsLoaded() { ++ return neighbourChunksLoadedBitset != 0; ++ } ++ public final boolean areNeighboursLoaded(final int radius) { ++ return Chunk.areNeighboursLoaded(this.neighbourChunksLoadedBitset, radius); ++ } ++ ++ public static boolean areNeighboursLoaded(final long bitset, final int radius) { ++ // index = relativeX + (relativeZ * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)) + (NEIGHBOUR_CACHE_RADIUS + NEIGHBOUR_CACHE_RADIUS * ((NEIGHBOUR_CACHE_RADIUS * 2 + 1))) ++ switch (radius) { ++ case 0: { ++ return (bitset & (1L << getNeighbourIndex(0, 0))) != 0; ++ } ++ case 1: { ++ long mask = 0L; ++ for (int dx = -1; dx <= 1; ++dx) { ++ for (int dz = -1; dz <= 1; ++dz) { ++ mask |= (1L << getNeighbourIndex(dx, dz)); ++ } ++ } ++ return (bitset & mask) == mask; ++ } ++ case 2: { ++ long mask = 0L; ++ for (int dx = -2; dx <= 2; ++dx) { ++ for (int dz = -2; dz <= 2; ++dz) { ++ mask |= (1L << getNeighbourIndex(dx, dz)); ++ } ++ } ++ return (bitset & mask) == mask; ++ } ++ case 3: { ++ long mask = 0L; ++ for (int dx = -3; dx <= 3; ++dx) { ++ for (int dz = -3; dz <= 3; ++dz) { ++ mask |= (1L << getNeighbourIndex(dx, dz)); ++ } ++ } ++ return (bitset & mask) == mask; ++ } ++ ++ default: ++ throw new IllegalArgumentException("Radius not recognized: " + radius); ++ } ++ } ++ // Paper end ++ + public Chunk(World world, ProtoChunk protochunk) { + this(world, protochunk.getPos(), protochunk.getBiomeIndex(), protochunk.p(), protochunk.n(), protochunk.o(), protochunk.getInhabitedTime(), protochunk.getSections(), (Consumer) null); + Iterator iterator = protochunk.y().iterator(); +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + } + } + ++ // Paper start - If loaded util ++ @Override ++ public Fluid getFluidIfLoaded(BlockPosition blockposition) { ++ return this.getFluid(blockposition); ++ } ++ ++ @Override ++ public IBlockData getTypeIfLoaded(BlockPosition blockposition) { ++ return this.getType(blockposition); ++ } ++ // Paper end ++ + @Override + public Fluid getFluid(BlockPosition blockposition) { + return this.a(blockposition.getX(), blockposition.getY(), blockposition.getZ()); +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + entity.chunkX = this.loc.x; + entity.chunkY = k; + entity.chunkZ = this.loc.z; ++ this.entities.add(entity); // Paper - per chunk entity list + this.entitySlices[k].add(entity); + } + +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + } + + this.entitySlices[i].remove(entity); ++ this.entities.remove(entity); // Paper + } + + @Override +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + return this.a(blockposition, Chunk.EnumTileEntityState.CHECK); + } + ++ @Nullable public final TileEntity getTileEntityImmediately(BlockPosition pos) { return this.a(pos, EnumTileEntityState.IMMEDIATE); } // Paper - OBFHELPER + @Nullable + public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) { + // CraftBukkit start +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + + // CraftBukkit start + public void loadCallback() { ++ // Paper start - neighbour cache ++ int chunkX = this.loc.x; ++ int chunkZ = this.loc.z; ++ ChunkProviderServer chunkProvider = ((WorldServer)this.world).getChunkProvider(); ++ for (int dx = -NEIGHBOUR_CACHE_RADIUS; dx <= NEIGHBOUR_CACHE_RADIUS; ++dx) { ++ for (int dz = -NEIGHBOUR_CACHE_RADIUS; dz <= NEIGHBOUR_CACHE_RADIUS; ++dz) { ++ Chunk neighbour = chunkProvider.getChunkAtIfLoadedMainThreadNoCache(chunkX + dx, chunkZ + dz); ++ if (neighbour != null) { ++ neighbour.setNeighbourLoaded(-dx, -dz, this); ++ // should be in cached already ++ this.setNeighbourLoaded(dx, dz, neighbour); ++ } ++ } ++ } ++ this.setNeighbourLoaded(0, 0, this); ++ this.loadedTicketLevel = true; ++ // Paper end - neighbour cache + org.bukkit.Server server = this.world.getServer(); ++ ((WorldServer)this.world).getChunkProvider().addLoadedChunk(this); // Paper + if (server != null) { + /* + * If it's a new world, the first few chunks are generated inside +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + server.getPluginManager().callEvent(unloadEvent); + // note: saving can be prevented, but not forced if no saving is actually required + this.mustNotSave = !unloadEvent.isSaveChunk(); ++ ((WorldServer)this.world).getChunkProvider().removeLoadedChunk(this); // Paper ++ // Paper start - neighbour cache ++ int chunkX = this.loc.x; ++ int chunkZ = this.loc.z; ++ ChunkProviderServer chunkProvider = ((WorldServer)this.world).getChunkProvider(); ++ for (int dx = -NEIGHBOUR_CACHE_RADIUS; dx <= NEIGHBOUR_CACHE_RADIUS; ++dx) { ++ for (int dz = -NEIGHBOUR_CACHE_RADIUS; dz <= NEIGHBOUR_CACHE_RADIUS; ++dz) { ++ Chunk neighbour = chunkProvider.getChunkAtIfLoadedMainThreadNoCache(chunkX + dx, chunkZ + dz); ++ if (neighbour != null) { ++ neighbour.setNeighbourUnloaded(-dx, -dz); ++ } ++ } ++ } ++ this.loadedTicketLevel = false; ++ this.resetNeighbours(); ++ // Paper end + } + // CraftBukkit end + +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +@@ -0,0 +0,0 @@ public class ChunkSection { + return this.blockIds; + } + ++ public void writeChunkSection(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER + public void b(PacketDataSerializer packetdataserializer) { + packetdataserializer.writeShort(this.nonEmptyBlockCount); + this.blockIds.b(packetdataserializer); +diff --git a/src/main/java/net/minecraft/world/level/chunk/DataPalette.java b/src/main/java/net/minecraft/world/level/chunk/DataPalette.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/DataPalette.java ++++ b/src/main/java/net/minecraft/world/level/chunk/DataPalette.java +@@ -0,0 +0,0 @@ import net.minecraft.network.PacketDataSerializer; + + public interface DataPalette<T> { + ++ default int getOrCreateIdFor(T object) { return this.a(object); } // Paper - OBFHELPER + int a(T t0); + + boolean a(Predicate<T> predicate); + ++ @Nullable default T getObject(int dataBits) { return this.a(dataBits); } // Paper - OBFHELPER + @Nullable + T a(int i); + +diff --git a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java ++++ b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java +@@ -0,0 +0,0 @@ import net.minecraft.util.MathHelper; + + public class DataPaletteBlock<T> implements DataPaletteExpandable<T> { + +- private final DataPalette<T> b; ++ private final DataPalette<T> b; private final DataPalette<T> getDataPaletteGlobal() { return this.b; } // Paper - OBFHELPER + private final DataPaletteExpandable<T> c = (i, object) -> { + return 0; + }; +@@ -0,0 +0,0 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> { + private final Function<NBTTagCompound, T> e; + private final Function<T, NBTTagCompound> f; + private final T g; +- protected DataBits a; +- private DataPalette<T> h; +- private int i; ++ protected DataBits a; public final DataBits getDataBits() { return this.a; } // Paper - OBFHELPER ++ private DataPalette<T> h; private DataPalette<T> getDataPalette() { return this.h; } // Paper - OBFHELPER ++ private int i; private int getBitsPerObject() { return this.i; } // Paper - OBFHELPER + private final ReentrantLock j = new ReentrantLock(); + + public void a() { +@@ -0,0 +0,0 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> { + return j << 8 | k << 4 | i; + } + ++ private void initialize(int bitsPerObject) { this.b(bitsPerObject); } // Paper - OBFHELPER + private void b(int i) { + if (i != this.i) { + this.i = i; +@@ -0,0 +0,0 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> { + return t0 == null ? this.g : t0; + } + ++ public void writeDataPaletteBlock(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER + public void b(PacketDataSerializer packetdataserializer) { + this.a(); + packetdataserializer.writeByte(this.i); +diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +@@ -0,0 +0,0 @@ public class ProtoChunk implements IChunkAccess { + + } + ++ // Paper start - If loaded util ++ @Override ++ public Fluid getFluidIfLoaded(BlockPosition blockposition) { ++ return this.getFluid(blockposition); ++ } ++ ++ @Override ++ public IBlockData getTypeIfLoaded(BlockPosition blockposition) { ++ return this.getType(blockposition); ++ } ++ // Paper end ++ + @Override + public IBlockData getType(BlockPosition blockposition) { + int i = blockposition.getY(); +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java b/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java +@@ -0,0 +0,0 @@ public class IOWorker implements AutoCloseable { + private static final Logger LOGGER = LogManager.getLogger(); + private final AtomicBoolean b = new AtomicBoolean(); + private final ThreadedMailbox<PairedQueue.b> c; +- private final RegionFileCache d; ++ private final RegionFileCache d;public RegionFileCache getRegionFileCache() { return d; } // Paper - OBFHELPER + private final Map<ChunkCoordIntPair, IOWorker.a> e = Maps.newLinkedHashMap(); + + protected IOWorker(File file, boolean flag, String s) { +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +@@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { + return this.e.resolve(s); + } + ++ @Nullable public synchronized DataInputStream getReadStream(ChunkCoordIntPair chunkCoordIntPair) throws IOException { return a(chunkCoordIntPair);} // Paper - OBFHELPER + @Nullable + public synchronized DataInputStream a(ChunkCoordIntPair chunkcoordintpair) throws IOException { + int i = this.getOffset(chunkcoordintpair); +diff --git a/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java b/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java ++++ b/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java +@@ -0,0 +0,0 @@ public class AxisAlignedBB { + return this.d(vec3d.x, vec3d.y, vec3d.z); + } + ++ public final boolean intersects(AxisAlignedBB axisalignedbb) { return this.c(axisalignedbb); } // Paper - OBFHELPER + public boolean c(AxisAlignedBB axisalignedbb) { + return this.a(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ); + } + ++ public final boolean intersects(double d0, double d1, double d2, double d3, double d4, double d5) { return a(d0, d1, d2, d3, d4, d5); } // Paper - OBFHELPER + public boolean a(double d0, double d1, double d2, double d3, double d4, double d5) { + return this.minX < d3 && this.maxX > d0 && this.minY < d4 && this.maxY > d1 && this.minZ < d5 && this.maxZ > d2; + } +@@ -0,0 +0,0 @@ public class AxisAlignedBB { + return d0 >= this.minX && d0 < this.maxX && d1 >= this.minY && d1 < this.maxY && d2 >= this.minZ && d2 < this.maxZ; + } + ++ public final double getAverageSideLength(){return a();} // Paper - OBFHELPER + public double a() { + double d0 = this.b(); + double d1 = this.c(); +diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java +@@ -0,0 +0,0 @@ public final class VoxelShapes { + public static final VoxelShape a = create(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); + private static final VoxelShape c = new VoxelShapeArray(new VoxelShapeBitSet(0, 0, 0), new DoubleArrayList(new double[]{0.0D}), new DoubleArrayList(new double[]{0.0D}), new DoubleArrayList(new double[]{0.0D})); + ++ public static final VoxelShape empty() {return a();} // Paper - OBFHELPER + public static VoxelShape a() { + return VoxelShapes.c; + } + ++ public static final VoxelShape fullCube() {return b();} // Paper - OBFHELPER + public static VoxelShape b() { + return VoxelShapes.b; + } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -4538,8 +4541,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public final class CraftItemStack extends ItemStack { } - net.minecraft.server.ItemStack handle; -+ public net.minecraft.server.ItemStack getHandle() { return handle; } // Paper + net.minecraft.world.item.ItemStack handle; ++ public net.minecraft.world.item.ItemStack getHandle() { return handle; } // Paper /** * Mirror diff --git a/Spigot-Server-Patches/Make-EnderDragon-implement-Mob.patch b/Spigot-Server-Patches/Make-EnderDragon-implement-Mob.patch index 86c9e21c86..e43453584d 100644 --- a/Spigot-Server-Patches/Make-EnderDragon-implement-Mob.patch +++ b/Spigot-Server-Patches/Make-EnderDragon-implement-Mob.patch @@ -11,8 +11,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ package org.bukkit.craftbukkit.entity; -+import net.minecraft.server.EntityInsentient; - import net.minecraft.server.EntityLiving; ++import net.minecraft.world.entity.EntityInsentient; // Paper + import net.minecraft.world.entity.EntityLiving; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.ComplexLivingEntity; diff --git a/Spigot-Server-Patches/Make-ProjectileHitEvent-Cancellable.patch b/Spigot-Server-Patches/Make-ProjectileHitEvent-Cancellable.patch index d421b6342c..f615b597f6 100644 --- a/Spigot-Server-Patches/Make-ProjectileHitEvent-Cancellable.patch +++ b/Spigot-Server-Patches/Make-ProjectileHitEvent-Cancellable.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Make ProjectileHitEvent Cancellable Allows cancelling things like detonating TNT from Fire Arrows -diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityFireball.java -+++ b/src/main/java/net/minecraft/server/EntityFireball.java +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java @@ -0,0 +0,0 @@ public abstract class EntityFireball extends IProjectile { // CraftBukkit start - Fire ProjectileHitEvent @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // CraftBukkit end } -diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IProjectile.java -+++ b/src/main/java/net/minecraft/server/IProjectile.java +--- a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java @@ -0,0 +0,0 @@ public abstract class IProjectile extends Entity { } diff --git a/Spigot-Server-Patches/Make-legacy-ping-handler-more-reliable.patch b/Spigot-Server-Patches/Make-legacy-ping-handler-more-reliable.patch index 0accf7483f..9d353cfeda 100644 --- a/Spigot-Server-Patches/Make-legacy-ping-handler-more-reliable.patch +++ b/Spigot-Server-Patches/Make-legacy-ping-handler-more-reliable.patch @@ -27,10 +27,10 @@ respond to the request. [1]: https://netty.io/wiki/user-guide-for-4.x.html#wiki-h3-11 [2]: https://netty.io/wiki/user-guide-for-4.x.html#wiki-h4-13 -diff --git a/src/main/java/net/minecraft/server/LegacyPingHandler.java b/src/main/java/net/minecraft/server/LegacyPingHandler.java +diff --git a/src/main/java/net/minecraft/server/network/LegacyPingHandler.java b/src/main/java/net/minecraft/server/network/LegacyPingHandler.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LegacyPingHandler.java -+++ b/src/main/java/net/minecraft/server/LegacyPingHandler.java +--- a/src/main/java/net/minecraft/server/network/LegacyPingHandler.java ++++ b/src/main/java/net/minecraft/server/network/LegacyPingHandler.java @@ -0,0 +0,0 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { private static final Logger LOGGER = LogManager.getLogger(); diff --git a/Spigot-Server-Patches/Make-max-squid-spawn-height-configurable.patch b/Spigot-Server-Patches/Make-max-squid-spawn-height-configurable.patch index 3b69fefa2b..cf7e17d1b0 100644 --- a/Spigot-Server-Patches/Make-max-squid-spawn-height-configurable.patch +++ b/Spigot-Server-Patches/Make-max-squid-spawn-height-configurable.patch @@ -20,10 +20,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 0.0D); + } } -diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java b/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntitySquid.java -+++ b/src/main/java/net/minecraft/server/EntitySquid.java +--- a/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java @@ -0,0 +0,0 @@ public class EntitySquid extends EntityWaterAnimal { } diff --git a/Spigot-Server-Patches/Make-schedule-command-per-world.patch b/Spigot-Server-Patches/Make-schedule-command-per-world.patch index 4584184946..d0a2c72a69 100644 --- a/Spigot-Server-Patches/Make-schedule-command-per-world.patch +++ b/Spigot-Server-Patches/Make-schedule-command-per-world.patch @@ -4,10 +4,10 @@ Date: Mon, 4 Jan 2021 19:52:44 -0800 Subject: [PATCH] Make schedule command per-world -diff --git a/src/main/java/net/minecraft/server/CommandSchedule.java b/src/main/java/net/minecraft/server/CommandSchedule.java +diff --git a/src/main/java/net/minecraft/server/commands/CommandSchedule.java b/src/main/java/net/minecraft/server/commands/CommandSchedule.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CommandSchedule.java -+++ b/src/main/java/net/minecraft/server/CommandSchedule.java +--- a/src/main/java/net/minecraft/server/commands/CommandSchedule.java ++++ b/src/main/java/net/minecraft/server/commands/CommandSchedule.java @@ -0,0 +0,0 @@ public class CommandSchedule { return new ChatMessage("commands.schedule.cleared.failure", new Object[]{object}); }); @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return ICompletionProvider.b((Iterable) ((CommandListenerWrapper) commandcontext.getSource()).getWorld().worldDataServer.H().u().a(), suggestionsbuilder); // Paper }; - public static void a(com.mojang.brigadier.CommandDispatcher<CommandListenerWrapper> com_mojang_brigadier_commanddispatcher) { + public static void a(CommandDispatcher<CommandListenerWrapper> commanddispatcher) { @@ -0,0 +0,0 @@ public class CommandSchedule { } else { long j = commandlistenerwrapper.getWorld().getTime() + (long) i; diff --git a/Spigot-Server-Patches/Make-shield-blocking-delay-configurable.patch b/Spigot-Server-Patches/Make-shield-blocking-delay-configurable.patch index 2bdf430dda..36a371579e 100644 --- a/Spigot-Server-Patches/Make-shield-blocking-delay-configurable.patch +++ b/Spigot-Server-Patches/Make-shield-blocking-delay-configurable.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + shieldBlockingDelay = getInt("game-mechanics.shield-blocking-delay", 5); + } } -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { if (this.isHandRaised() && !this.activeItem.isEmpty()) { Item item = this.activeItem.getItem(); diff --git a/Spigot-Server-Patches/Make-targetSize-more-aggressive-in-the-chunk-unload-.patch b/Spigot-Server-Patches/Make-targetSize-more-aggressive-in-the-chunk-unload-.patch index 33bb103e83..493461d49b 100644 --- a/Spigot-Server-Patches/Make-targetSize-more-aggressive-in-the-chunk-unload-.patch +++ b/Spigot-Server-Patches/Make-targetSize-more-aggressive-in-the-chunk-unload-.patch @@ -4,10 +4,10 @@ Date: Tue, 7 Feb 2017 16:55:35 -0600 Subject: [PATCH] Make targetSize more aggressive in the chunk unload queue -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private final PlayerMap playerMap; public final Int2ObjectMap<PlayerChunkMap.EntityTracker> trackedEntities; diff --git a/Spigot-Server-Patches/Make-the-GUI-graph-fancier.patch b/Spigot-Server-Patches/Make-the-GUI-graph-fancier.patch index 10da4ae409..0f8009717f 100644 --- a/Spigot-Server-Patches/Make-the-GUI-graph-fancier.patch +++ b/Spigot-Server-Patches/Make-the-GUI-graph-fancier.patch @@ -384,19 +384,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + timer.stop(); + } +} -diff --git a/src/main/java/net/minecraft/server/GuiStatsComponent.java b/src/main/java/net/minecraft/server/GuiStatsComponent.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/GuiStatsComponent.java -+++ b/src/main/java/net/minecraft/server/GuiStatsComponent.java -@@ -0,0 +0,0 @@ import javax.swing.Timer; - - public class GuiStatsComponent extends JComponent { - -- private static final DecimalFormat a = (DecimalFormat) SystemUtils.a((Object) (new DecimalFormat("########0.000")), (decimalformat) -> { -+ private static final DecimalFormat a = (DecimalFormat) SystemUtils.a(new DecimalFormat("########0.000"), (decimalformat) -> { // Paper - decompile error - decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); - }); - private final int[] b = new int[256]; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -410,10 +397,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Nullable private KeyPair H; @Nullable -diff --git a/src/main/java/net/minecraft/server/ServerGUI.java b/src/main/java/net/minecraft/server/ServerGUI.java +diff --git a/src/main/java/net/minecraft/server/gui/GuiStatsComponent.java b/src/main/java/net/minecraft/server/gui/GuiStatsComponent.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ServerGUI.java -+++ b/src/main/java/net/minecraft/server/ServerGUI.java +--- a/src/main/java/net/minecraft/server/gui/GuiStatsComponent.java ++++ b/src/main/java/net/minecraft/server/gui/GuiStatsComponent.java +@@ -0,0 +0,0 @@ import net.minecraft.server.MinecraftServer; + + public class GuiStatsComponent extends JComponent { + +- private static final DecimalFormat a = (DecimalFormat) SystemUtils.a((Object) (new DecimalFormat("########0.000")), (decimalformat) -> { ++ private static final DecimalFormat a = (DecimalFormat) SystemUtils.a(new DecimalFormat("########0.000"), (decimalformat) -> { // Paper - decompile error + decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); + }); + private final int[] b = new int[256]; +diff --git a/src/main/java/net/minecraft/server/gui/ServerGUI.java b/src/main/java/net/minecraft/server/gui/ServerGUI.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/gui/ServerGUI.java ++++ b/src/main/java/net/minecraft/server/gui/ServerGUI.java @@ -0,0 +0,0 @@ public class ServerGUI extends JComponent { private JComponent c() { diff --git a/Spigot-Server-Patches/Maps-shouldn-t-load-chunks.patch b/Spigot-Server-Patches/Maps-shouldn-t-load-chunks.patch index 86c8eb7ac4..59332304af 100644 --- a/Spigot-Server-Patches/Maps-shouldn-t-load-chunks.patch +++ b/Spigot-Server-Patches/Maps-shouldn-t-load-chunks.patch @@ -14,10 +14,10 @@ Previously maps would load all chunks in a certain radius depending on eventually anyways and that maps will get checked for update every five ticks that movement occur in anyways. -diff --git a/src/main/java/net/minecraft/server/ItemWorldMap.java b/src/main/java/net/minecraft/server/ItemWorldMap.java +diff --git a/src/main/java/net/minecraft/world/item/ItemWorldMap.java b/src/main/java/net/minecraft/world/item/ItemWorldMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemWorldMap.java -+++ b/src/main/java/net/minecraft/server/ItemWorldMap.java +--- a/src/main/java/net/minecraft/world/item/ItemWorldMap.java ++++ b/src/main/java/net/minecraft/world/item/ItemWorldMap.java @@ -0,0 +0,0 @@ public class ItemWorldMap extends ItemWorldMapBase { int k2 = (j / i + k1 - 64) * i; int l2 = (k / i + l1 - 64) * i; 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 da62ecd561..033ea7cc05 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 @@ -5,10 +5,10 @@ Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it saves -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { entity.chunkZ = this.loc.z; this.entities.add(entity); // Paper - per chunk entity list 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 815b59b7ea..5405baede5 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 @@ -4,10 +4,10 @@ Date: Sun, 28 Jul 2019 00:51:11 +0100 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 +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { VoxelShape voxelshape1 = iblockdata1.getCollisionShape(this, blockposition); diff --git a/Spigot-Server-Patches/Merchant-getRecipes-should-return-an-immutable-list.patch b/Spigot-Server-Patches/Merchant-getRecipes-should-return-an-immutable-list.patch index 583a1b0f59..82b49fd28e 100644 --- a/Spigot-Server-Patches/Merchant-getRecipes-should-return-an-immutable-list.patch +++ b/Spigot-Server-Patches/Merchant-getRecipes-should-return-an-immutable-list.patch @@ -12,8 +12,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public List<MerchantRecipe> getRecipes() { -- return Collections.unmodifiableList(Lists.transform(merchant.getOffers(), new Function<net.minecraft.server.MerchantRecipe, MerchantRecipe>() { -+ return com.google.common.collect.ImmutableList.copyOf(Lists.transform(merchant.getOffers(), new Function<net.minecraft.server.MerchantRecipe, MerchantRecipe>() { // Paper - javadoc says 'an immutable list of trades' - not 'an unmodifiable view of a list of trades'. fixes issue with setRecipes(getRecipes()) +- return Collections.unmodifiableList(Lists.transform(merchant.getOffers(), new Function<net.minecraft.world.item.trading.MerchantRecipe, MerchantRecipe>() { ++ return com.google.common.collect.ImmutableList.copyOf(Lists.transform(merchant.getOffers(), new Function<net.minecraft.world.item.trading.MerchantRecipe, MerchantRecipe>() { // Paper - javadoc says 'an immutable list of trades' - not 'an unmodifiable view of a list of trades'. fixes issue with setRecipes(getRecipes()) @Override - public MerchantRecipe apply(net.minecraft.server.MerchantRecipe recipe) { + public MerchantRecipe apply(net.minecraft.world.item.trading.MerchantRecipe recipe) { return recipe.asBukkit(); diff --git a/Spigot-Server-Patches/Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch b/Spigot-Server-Patches/Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch index 7912439450..8973ceee27 100644 --- a/Spigot-Server-Patches/Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch +++ b/Spigot-Server-Patches/Mid-Tick-Chunk-Tasks-Speed-up-processing-of-chunk-lo.patch @@ -55,10 +55,101 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + midTickChunkTasks = getInt("settings.chunk-tasks-per-tick", midTickChunkTasks); + } } -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +--- 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<TickTas + // Paper end + tickSection = curTime; + } ++ midTickChunksTasksRan = 0; // Paper + // Spigot end + + //MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas + + } + +- private boolean canSleepForTick() { ++ public boolean canSleepForTick() { // Paper + // CraftBukkit start + if (isOversleep) return canOversleep();// Paper - because of our changes, this logic is broken + return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < (this.X ? this.W : this.nextTick); +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas + }); + } + ++ // Paper start ++ public int midTickChunksTasksRan = 0; ++ private long midTickLastRan = 0; ++ public void midTickLoadChunks() { ++ if (!isMainThread() || System.nanoTime() - midTickLastRan < 1000000) { ++ // only check once per 0.25ms incase this code is called in a hot method ++ return; ++ } ++ try (co.aikar.timings.Timing ignored = co.aikar.timings.MinecraftTimings.midTickChunkTasks.startTiming()) { ++ for (WorldServer value : this.getWorlds()) { ++ value.getChunkProvider().serverThreadQueue.midTickLoadChunks(); ++ } ++ midTickLastRan = System.nanoTime(); ++ } ++ } ++ // Paper end ++ + @Override + public TickTask postToMainThread(Runnable runnable) { + return new TickTask(this.ticks, runnable); +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas + // Paper start - move oversleep into full server tick + isOversleep = true;MinecraftTimings.serverOversleep.startTiming(); + this.awaitTasks(() -> { ++ midTickLoadChunks(); // will only do loads since we are still considered !canSleepForTick + return !this.canOversleep(); + }); + isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas + } + + protected void b(BooleanSupplier booleansupplier) { ++ midTickLoadChunks(); // Paper + MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper + this.server.getScheduler().mainThreadHeartbeat(this.ticks); // CraftBukkit + MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper ++ midTickLoadChunks(); // Paper + this.methodProfiler.enter("commandFunctions"); + MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper + this.getFunctionData().tick(); + MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot // Paper ++ midTickLoadChunks(); // Paper + this.methodProfiler.exitEnter("levels"); + Iterator iterator = this.getWorlds().iterator(); + +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas + processQueue.remove().run(); + } + MinecraftTimings.processQueueTimer.stopTiming(); // Spigot +- ++ midTickLoadChunks(); // Paper + MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper + // Send time updates to everyone, it will get the right time from the world the player is in. + // Paper start - optimize time updates +@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas + this.methodProfiler.enter("tick"); + + try { ++ midTickLoadChunks(); // Paper + worldserver.timings.doTick.startTiming(); // Spigot + worldserver.doTick(booleansupplier); + worldserver.timings.doTick.stopTiming(); // Spigot ++ midTickLoadChunks(); // Paper + } catch (Throwable throwable) { + // Spigot Start + CrashReport crashreport; +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { this.world.getMethodProfiler().enter("purge"); this.world.timings.doChunkMap.startTiming(); // Spigot @@ -134,101 +225,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override protected boolean executeNext() { // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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<TickTas - // Paper end - tickSection = curTime; - } -+ midTickChunksTasksRan = 0; // Paper - // Spigot end - - //MinecraftServer.currentTick = (int) (System.currentTimeMillis() / 50); // CraftBukkit // Paper - don't overwrite current tick time -@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas - - } - -- private boolean canSleepForTick() { -+ public boolean canSleepForTick() { // Paper - // CraftBukkit start - if (isOversleep) return canOversleep();// Paper - because of our changes, this logic is broken - return this.forceTicks || this.isEntered() || SystemUtils.getMonotonicMillis() < (this.X ? this.W : this.nextTick); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas - }); - } - -+ // Paper start -+ public int midTickChunksTasksRan = 0; -+ private long midTickLastRan = 0; -+ public void midTickLoadChunks() { -+ if (!isMainThread() || System.nanoTime() - midTickLastRan < 1000000) { -+ // only check once per 0.25ms incase this code is called in a hot method -+ return; -+ } -+ try (co.aikar.timings.Timing ignored = co.aikar.timings.MinecraftTimings.midTickChunkTasks.startTiming()) { -+ for (WorldServer value : this.getWorlds()) { -+ value.getChunkProvider().serverThreadQueue.midTickLoadChunks(); -+ } -+ midTickLastRan = System.nanoTime(); -+ } -+ } -+ // Paper end -+ - @Override - protected TickTask postToMainThread(Runnable runnable) { - return new TickTask(this.ticks, runnable); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas - // Paper start - move oversleep into full server tick - isOversleep = true;MinecraftTimings.serverOversleep.startTiming(); - this.awaitTasks(() -> { -+ midTickLoadChunks(); // will only do loads since we are still considered !canSleepForTick - return !this.canOversleep(); - }); - isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); -@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas - } - - protected void b(BooleanSupplier booleansupplier) { -+ midTickLoadChunks(); // Paper - MinecraftTimings.bukkitSchedulerTimer.startTiming(); // Spigot // Paper - this.server.getScheduler().mainThreadHeartbeat(this.ticks); // CraftBukkit - MinecraftTimings.bukkitSchedulerTimer.stopTiming(); // Spigot // Paper -+ midTickLoadChunks(); // Paper - this.methodProfiler.enter("commandFunctions"); - MinecraftTimings.commandFunctionsTimer.startTiming(); // Spigot // Paper - this.getFunctionData().tick(); - MinecraftTimings.commandFunctionsTimer.stopTiming(); // Spigot // Paper -+ midTickLoadChunks(); // Paper - this.methodProfiler.exitEnter("levels"); - Iterator iterator = this.getWorlds().iterator(); - -@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas - processQueue.remove().run(); - } - MinecraftTimings.processQueueTimer.stopTiming(); // Spigot -- -+ midTickLoadChunks(); // Paper - MinecraftTimings.timeUpdateTimer.startTiming(); // Spigot // Paper - // Send time updates to everyone, it will get the right time from the world the player is in. - // Paper start - optimize time updates -@@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas - this.methodProfiler.enter("tick"); - - try { -+ midTickLoadChunks(); // Paper - worldserver.timings.doTick.startTiming(); // Spigot - worldserver.doTick(booleansupplier); - worldserver.timings.doTick.stopTiming(); // Spigot -+ midTickLoadChunks(); // Paper - } catch (Throwable throwable) { - // Spigot Start - CrashReport crashreport; -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { } timings.scheduledBlocks.stopTiming(); // Paper diff --git a/Spigot-Server-Patches/Mob-Pathfinding-API.patch b/Spigot-Server-Patches/Mob-Pathfinding-API.patch index 8343000c8a..e442d4ce03 100644 --- a/Spigot-Server-Patches/Mob-Pathfinding-API.patch +++ b/Spigot-Server-Patches/Mob-Pathfinding-API.patch @@ -152,10 +152,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return new Location(entity.world.getWorld(), point.getX(), point.getY(), point.getZ()); + } +} -diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NavigationAbstract.java -+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java @@ -0,0 +0,0 @@ public abstract class NavigationAbstract { } @@ -199,11 +199,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void o() { this.c = null; } -diff --git a/src/main/java/net/minecraft/server/PathEntity.java b/src/main/java/net/minecraft/server/PathEntity.java +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathEntity.java b/src/main/java/net/minecraft/world/level/pathfinder/PathEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathEntity.java -+++ b/src/main/java/net/minecraft/server/PathEntity.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/level/pathfinder/PathEntity.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/PathEntity.java +@@ -0,0 +0,0 @@ import net.minecraft.world.phys.Vec3D; public class PathEntity { @@ -238,11 +238,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return ((PathPoint) this.a.get(this.e)).a(); } -diff --git a/src/main/java/net/minecraft/server/PathPoint.java b/src/main/java/net/minecraft/server/PathPoint.java +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathPoint.java b/src/main/java/net/minecraft/world/level/pathfinder/PathPoint.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathPoint.java -+++ b/src/main/java/net/minecraft/server/PathPoint.java -@@ -0,0 +0,0 @@ package net.minecraft.server; +--- a/src/main/java/net/minecraft/world/level/pathfinder/PathPoint.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/PathPoint.java +@@ -0,0 +0,0 @@ import net.minecraft.util.MathHelper; public class PathPoint { @@ -255,10 +255,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private final int m; public int d = -1; public float e; -diff --git a/src/main/java/net/minecraft/server/PathfinderAbstract.java b/src/main/java/net/minecraft/server/PathfinderAbstract.java +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderAbstract.java b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderAbstract.java -+++ b/src/main/java/net/minecraft/server/PathfinderAbstract.java +--- a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderAbstract.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderAbstract.java @@ -0,0 +0,0 @@ public abstract class PathfinderAbstract { protected int d; protected int e; diff --git a/Spigot-Server-Patches/Mob-Spawner-API-Enhancements.patch b/Spigot-Server-Patches/Mob-Spawner-API-Enhancements.patch index e1473d9deb..71f47561b3 100644 --- a/Spigot-Server-Patches/Mob-Spawner-API-Enhancements.patch +++ b/Spigot-Server-Patches/Mob-Spawner-API-Enhancements.patch @@ -4,10 +4,10 @@ Date: Fri, 19 Apr 2019 12:41:13 -0500 Subject: [PATCH] Mob Spawner API Enhancements -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { this.mobs.clear(); // CraftBukkit - SPIGOT-3496, MC-92282 } diff --git a/Spigot-Server-Patches/More-lightning-API.patch b/Spigot-Server-Patches/More-lightning-API.patch index d2e24ea60e..ee3080c341 100644 --- a/Spigot-Server-Patches/More-lightning-API.patch +++ b/Spigot-Server-Patches/More-lightning-API.patch @@ -4,10 +4,10 @@ Date: Sun, 26 Jul 2020 14:44:09 +0200 Subject: [PATCH] More lightning API -diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLightning.java b/src/main/java/net/minecraft/world/entity/EntityLightning.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLightning.java -+++ b/src/main/java/net/minecraft/server/EntityLightning.java +--- a/src/main/java/net/minecraft/world/entity/EntityLightning.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLightning.java @@ -0,0 +0,0 @@ public class EntityLightning extends Entity { private int lifeTicks; diff --git a/Spigot-Server-Patches/Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/Spigot-Server-Patches/Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch index 4a30eabd34..d623a5eb77 100644 --- a/Spigot-Server-Patches/Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch +++ b/Spigot-Server-Patches/Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Move player to spawn point if spawn in unloaded world The code following this has better support for null worlds to move them back to the world spawn. -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne bworld = server.getWorld(worldName); } diff --git a/Spigot-Server-Patches/Move-range-check-for-block-placing-up.patch b/Spigot-Server-Patches/Move-range-check-for-block-placing-up.patch index 3fbf993cab..a33391fe6e 100644 --- a/Spigot-Server-Patches/Move-range-check-for-block-placing-up.patch +++ b/Spigot-Server-Patches/Move-range-check-for-block-placing-up.patch @@ -4,10 +4,10 @@ Date: Wed, 15 Jul 2020 19:34:11 -0700 Subject: [PATCH] Move range check for block placing up -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { BlockPosition blockposition = movingobjectpositionblock.getBlockPosition(); EnumDirection enumdirection = movingobjectpositionblock.getDirection(); diff --git a/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch b/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch index 8d12782efd..0220d701f5 100644 --- a/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch +++ b/Spigot-Server-Patches/No-Tick-view-distance-implementation.patch @@ -36,75 +36,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.noTickViewDistance = this.getInt("viewdistances.no-tick-view-distance", -1); + } } -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - } +--- a/src/main/java/net/minecraft/server/MCUtil.java ++++ b/src/main/java/net/minecraft/server/MCUtil.java +@@ -0,0 +0,0 @@ public final class MCUtil { + }); - protected void onNeighbourChange(final long bitsetBefore, final long bitsetAfter) { -+ // Paper start - no-tick view distance -+ ChunkProviderServer chunkProviderServer = ((WorldServer)this.world).getChunkProvider(); -+ PlayerChunkMap chunkMap = chunkProviderServer.playerChunkMap; -+ // this code handles the addition of ticking tickets - the distance map handles the removal -+ if (!areNeighboursLoaded(bitsetBefore, 2) && areNeighboursLoaded(bitsetAfter, 2)) { -+ if (chunkMap.playerViewDistanceTickMap.getObjectsInRange(this.coordinateKey) != null) { -+ // now we're ready for entity ticking -+ chunkProviderServer.serverThreadQueue.execute(() -> { -+ // double check that this condition still holds. -+ if (Chunk.this.areNeighboursLoaded(2) && chunkMap.playerViewDistanceTickMap.getObjectsInRange(Chunk.this.coordinateKey) != null) { -+ chunkProviderServer.addTicketAtLevel(TicketType.PLAYER, Chunk.this.loc, 31, Chunk.this.loc); // 31 -> entity ticking, TODO check on update -+ } -+ }); -+ } -+ } - -+ // this code handles the chunk sending -+ if (!areNeighboursLoaded(bitsetBefore, 1) && areNeighboursLoaded(bitsetAfter, 1)) { -+ if (chunkMap.playerViewDistanceBroadcastMap.getObjectsInRange(this.coordinateKey) != null) { -+ // now we're ready to send -+ chunkMap.mailboxMain.a(ChunkTaskQueueSorter.a(chunkMap.getUpdatingChunk(this.coordinateKey), (() -> { // Copied frm PlayerChunkMap -+ // double check that this condition still holds. -+ if (!Chunk.this.areNeighboursLoaded(1)) { -+ return; -+ } -+ com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> inRange = chunkMap.playerViewDistanceBroadcastMap.getObjectsInRange(Chunk.this.coordinateKey); -+ if (inRange == null) { -+ return; -+ } -+ -+ // broadcast -+ Object[] backingSet = inRange.getBackingSet(); -+ Packet[] chunkPackets = new Packet[2]; -+ for (int index = 0, len = backingSet.length; index < len; ++index) { -+ Object temp = backingSet[index]; -+ if (!(temp instanceof EntityPlayer)) { -+ continue; -+ } -+ EntityPlayer player = (EntityPlayer)temp; -+ chunkMap.sendChunk(player, chunkPackets, Chunk.this); -+ } -+ }))); -+ } -+ } -+ // Paper end - no-tick view distance - } - - public final boolean isAnyNeighborsLoaded() { -@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - IBlockData iblockdata = this.getType(blockposition); - IBlockData iblockdata1 = Block.b(iblockdata, (GeneratorAccess) this.world, blockposition); - -- this.world.setTypeAndData(blockposition, iblockdata1, 20); -+ this.world.setTypeAndData(blockposition, iblockdata1, 20 | 2); // Paper - We send chunks before they're ticking ready, so we need to notify here - } - - this.n[i].clear(); -diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java + worldData.addProperty("name", world.getWorld().getName()); +- worldData.addProperty("view-distance", world.spigotConfig.viewDistance); ++ worldData.addProperty("view-distance", world.getChunkProvider().playerChunkMap.getEffectiveViewDistance()); ++ worldData.addProperty("no-view-distance", world.getChunkProvider().playerChunkMap.getRawNoTickViewDistance()); + worldData.addProperty("keep-spawn-loaded", world.keepSpawnInMemory); + worldData.addProperty("keep-spawn-loaded-range", world.paperConfig.keepLoadedRange); + worldData.addProperty("visible-chunk-count", visibleChunks.size()); +diff --git a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkMapDistance.java -+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java +--- a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java @@ -0,0 +0,0 @@ public abstract class ChunkMapDistance { return s; } @@ -123,10 +72,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (flag1) { ChunkMapDistance.this.j.a(ChunkTaskQueueSorter.a(() -> { -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks @@ -136,24 +85,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); this.spawnDimension = World.OVERWORLD; -diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MCUtil.java -+++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -0,0 +0,0 @@ public final class MCUtil { - }); - - worldData.addProperty("name", world.getWorld().getName()); -- worldData.addProperty("view-distance", world.spigotConfig.viewDistance); -+ worldData.addProperty("view-distance", world.getChunkProvider().playerChunkMap.getEffectiveViewDistance()); -+ worldData.addProperty("no-view-distance", world.getChunkProvider().playerChunkMap.getRawNoTickViewDistance()); - worldData.addProperty("keep-spawn-loaded", world.keepSpawnInMemory); - worldData.addProperty("keep-spawn-loaded-range", world.paperConfig.keepLoadedRange); - worldData.addProperty("visible-chunk-count", visibleChunks.size()); -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { } // Paper end - optimise isOutsideOfRange @@ -243,10 +178,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> a(ChunkStatus chunkstatus, PlayerChunkMap playerchunkmap) { -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private boolean updatingChunksModified; private final ChunkTaskQueueSorter p; @@ -576,10 +511,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 flag1 = PlayerChunkMap.b(chunkcoordintpair, entityplayer, false) <= PlayerChunkMap.this.viewDistance; } } -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { boolean flag1 = gamerules.getBoolean(GameRules.REDUCED_DEBUG_INFO); @@ -607,10 +542,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Iterator iterator = this.server.getWorlds().iterator(); while (iterator.hasNext()) { -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.b(blockposition, iblockdata1, iblockdata2); } @@ -626,6 +561,71 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } if ((i & 1) != 0) { +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + } + + protected void onNeighbourChange(final long bitsetBefore, final long bitsetAfter) { ++ // Paper start - no-tick view distance ++ ChunkProviderServer chunkProviderServer = ((WorldServer)this.world).getChunkProvider(); ++ PlayerChunkMap chunkMap = chunkProviderServer.playerChunkMap; ++ // this code handles the addition of ticking tickets - the distance map handles the removal ++ if (!areNeighboursLoaded(bitsetBefore, 2) && areNeighboursLoaded(bitsetAfter, 2)) { ++ if (chunkMap.playerViewDistanceTickMap.getObjectsInRange(this.coordinateKey) != null) { ++ // now we're ready for entity ticking ++ chunkProviderServer.serverThreadQueue.execute(() -> { ++ // double check that this condition still holds. ++ if (Chunk.this.areNeighboursLoaded(2) && chunkMap.playerViewDistanceTickMap.getObjectsInRange(Chunk.this.coordinateKey) != null) { ++ chunkProviderServer.addTicketAtLevel(TicketType.PLAYER, Chunk.this.loc, 31, Chunk.this.loc); // 31 -> entity ticking, TODO check on update ++ } ++ }); ++ } ++ } + ++ // this code handles the chunk sending ++ if (!areNeighboursLoaded(bitsetBefore, 1) && areNeighboursLoaded(bitsetAfter, 1)) { ++ if (chunkMap.playerViewDistanceBroadcastMap.getObjectsInRange(this.coordinateKey) != null) { ++ // now we're ready to send ++ chunkMap.mailboxMain.a(ChunkTaskQueueSorter.a(chunkMap.getUpdatingChunk(this.coordinateKey), (() -> { // Copied frm PlayerChunkMap ++ // double check that this condition still holds. ++ if (!Chunk.this.areNeighboursLoaded(1)) { ++ return; ++ } ++ com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> inRange = chunkMap.playerViewDistanceBroadcastMap.getObjectsInRange(Chunk.this.coordinateKey); ++ if (inRange == null) { ++ return; ++ } ++ ++ // broadcast ++ Object[] backingSet = inRange.getBackingSet(); ++ Packet[] chunkPackets = new Packet[2]; ++ for (int index = 0, len = backingSet.length; index < len; ++index) { ++ Object temp = backingSet[index]; ++ if (!(temp instanceof EntityPlayer)) { ++ continue; ++ } ++ EntityPlayer player = (EntityPlayer)temp; ++ chunkMap.sendChunk(player, chunkPackets, Chunk.this); ++ } ++ }))); ++ } ++ } ++ // Paper end - no-tick view distance + } + + public final boolean isAnyNeighborsLoaded() { +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + IBlockData iblockdata = this.getType(blockposition); + IBlockData iblockdata1 = Block.b(iblockdata, (GeneratorAccess) this.world, blockposition); + +- this.world.setTypeAndData(blockposition, iblockdata1, 20); ++ this.world.setTypeAndData(blockposition, iblockdata1, 20 | 2); // Paper - We send chunks before they're ticking ready, so we need to notify here + } + + this.n[i].clear(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java diff --git a/Spigot-Server-Patches/Ocelot-despawns-should-honor-nametags-and-leash.patch b/Spigot-Server-Patches/Ocelot-despawns-should-honor-nametags-and-leash.patch index 2765d6bd28..d6c6fdbd13 100644 --- a/Spigot-Server-Patches/Ocelot-despawns-should-honor-nametags-and-leash.patch +++ b/Spigot-Server-Patches/Ocelot-despawns-should-honor-nametags-and-leash.patch @@ -4,10 +4,10 @@ Date: Mon, 31 Jul 2017 01:54:40 -0500 Subject: [PATCH] Ocelot despawns should honor nametags and leash -diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityOcelot.java b/src/main/java/net/minecraft/world/entity/animal/EntityOcelot.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityOcelot.java -+++ b/src/main/java/net/minecraft/server/EntityOcelot.java +--- a/src/main/java/net/minecraft/world/entity/animal/EntityOcelot.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityOcelot.java @@ -0,0 +0,0 @@ public class EntityOcelot extends EntityAnimal { @Override 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 96425ea22f..b8bc848766 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 @@ -37,10 +37,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean antiXray; public EngineMode engineMode; public int maxChunkSectionIndex; -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java +diff --git a/src/main/java/net/minecraft/world/level/SpawnerCreature.java b/src/main/java/net/minecraft/world/level/SpawnerCreature.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +--- a/src/main/java/net/minecraft/world/level/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/world/level/SpawnerCreature.java @@ -0,0 +0,0 @@ public final class SpawnerCreature { EnumCreatureType enumcreaturetype = entity.getEntityType().e(); 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 7dab1548f5..a83c001557 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 @@ -5,32 +5,6 @@ Subject: [PATCH] Only process BlockPhysicsEvent if a plugin has a listener Saves on some object allocation and processing when no plugin listens to this -diff --git a/src/main/java/net/minecraft/server/BlockPlant.java b/src/main/java/net/minecraft/server/BlockPlant.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockPlant.java -+++ b/src/main/java/net/minecraft/server/BlockPlant.java -@@ -0,0 +0,0 @@ public class BlockPlant extends Block { - public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) { - // CraftBukkit start - if (!iblockdata.canPlace(generatoraccess, blockposition)) { -- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(generatoraccess, blockposition).isCancelled()) { -+ if (!(generatoraccess instanceof WorldServer && ((WorldServer) generatoraccess).hasPhysicsEvent) || !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(generatoraccess, blockposition).isCancelled()) { // Paper - return Blocks.AIR.getBlockData(); - } - } -diff --git a/src/main/java/net/minecraft/server/BlockTallPlant.java b/src/main/java/net/minecraft/server/BlockTallPlant.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockTallPlant.java -+++ b/src/main/java/net/minecraft/server/BlockTallPlant.java -@@ -0,0 +0,0 @@ public class BlockTallPlant extends BlockPlant { - - protected static void b(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) { - // CraftBukkit start -- if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) { -+ if (((WorldServer)world).hasPhysicsEvent && org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) { // Paper - return; - } - // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -43,10 +17,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.methodProfiler.a(() -> { return worldserver + " " + worldserver.getDimensionKey().a(); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + private int tickPosition; + public final Convertable.ConversionSession convertable; + public final UUID uuid; ++ boolean hasPhysicsEvent = true; // Paper + + @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI + return this.chunkProvider.getChunkAt(x, z, false); +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // CraftBukkit start iblockdata1.b(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam @@ -65,15 +51,29 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata), world.getBlockAt(blockposition1.getX(), blockposition1.getY(), blockposition1.getZ())); 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 +diff --git a/src/main/java/net/minecraft/world/level/block/BlockPlant.java b/src/main/java/net/minecraft/world/level/block/BlockPlant.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - private int tickPosition; - public final Convertable.ConversionSession convertable; - public final UUID uuid; -+ boolean hasPhysicsEvent = true; // Paper +--- a/src/main/java/net/minecraft/world/level/block/BlockPlant.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockPlant.java +@@ -0,0 +0,0 @@ public class BlockPlant extends Block { + public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) { + // CraftBukkit start + if (!iblockdata.canPlace(generatoraccess, blockposition)) { +- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(generatoraccess, blockposition).isCancelled()) { ++ if (!(generatoraccess instanceof WorldServer && ((WorldServer) generatoraccess).hasPhysicsEvent) || !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(generatoraccess, blockposition).isCancelled()) { // Paper + return Blocks.AIR.getBlockData(); + } + } +diff --git a/src/main/java/net/minecraft/world/level/block/BlockTallPlant.java b/src/main/java/net/minecraft/world/level/block/BlockTallPlant.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockTallPlant.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockTallPlant.java +@@ -0,0 +0,0 @@ public class BlockTallPlant extends BlockPlant { - @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI - return this.chunkProvider.getChunkAt(x, z, false); + protected static void b(World world, BlockPosition blockposition, IBlockData iblockdata, EntityHuman entityhuman) { + // CraftBukkit start +- if (org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) { ++ if (((WorldServer)world).hasPhysicsEvent && org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(world, blockposition).isCancelled()) { // Paper + return; + } + // CraftBukkit end diff --git a/Spigot-Server-Patches/Only-send-Dragon-Wither-Death-sounds-to-same-world.patch b/Spigot-Server-Patches/Only-send-Dragon-Wither-Death-sounds-to-same-world.patch index dc54b9c389..e414bb728e 100644 --- a/Spigot-Server-Patches/Only-send-Dragon-Wither-Death-sounds-to-same-world.patch +++ b/Spigot-Server-Patches/Only-send-Dragon-Wither-Death-sounds-to-same-world.patch @@ -5,26 +5,26 @@ Subject: [PATCH] Only send Dragon/Wither Death sounds to same world Also fix view distance lookup -diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderDragon.java -+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java @@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { if (this.deathAnimationTicks == 1 && !this.isSilent()) { // CraftBukkit start - Use relative location for far away sounds // this.world.b(1028, this.getChunkCoordinates(), 0); - int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; -- for (EntityPlayer player : (List<EntityPlayer>) MinecraftServer.getServer().getPlayerList().players) { +- for (net.minecraft.server.level.EntityPlayer player : this.world.getMinecraftServer().getPlayerList().players) { + //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API -+ for (EntityPlayer player : (List<EntityPlayer>) ((WorldServer)world).getPlayers()) { ++ for (net.minecraft.server.level.EntityPlayer player : (List<net.minecraft.server.level.EntityPlayer>) ((WorldServer)world).getPlayers()) { + final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch double deltaX = this.locX() - player.locX(); double deltaZ = this.locZ() - player.locZ(); double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; -diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java +diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityWither.java -+++ b/src/main/java/net/minecraft/server/EntityWither.java +--- a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java ++++ b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java @@ -0,0 +0,0 @@ public class EntityWither extends EntityMonster implements IRangedEntity { if (!this.isSilent()) { // CraftBukkit start - Use relative location for far away sounds diff --git a/Spigot-Server-Patches/Optimise-ArraySetSorted-removeIf.patch b/Spigot-Server-Patches/Optimise-ArraySetSorted-removeIf.patch index bc8daf153d..127972a778 100644 --- a/Spigot-Server-Patches/Optimise-ArraySetSorted-removeIf.patch +++ b/Spigot-Server-Patches/Optimise-ArraySetSorted-removeIf.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimise ArraySetSorted#removeIf Remove iterator allocation and ensure the call is always O(n) -diff --git a/src/main/java/net/minecraft/server/ArraySetSorted.java b/src/main/java/net/minecraft/server/ArraySetSorted.java +diff --git a/src/main/java/net/minecraft/util/ArraySetSorted.java b/src/main/java/net/minecraft/util/ArraySetSorted.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ArraySetSorted.java -+++ b/src/main/java/net/minecraft/server/ArraySetSorted.java +--- a/src/main/java/net/minecraft/util/ArraySetSorted.java ++++ b/src/main/java/net/minecraft/util/ArraySetSorted.java @@ -0,0 +0,0 @@ import java.util.NoSuchElementException; public class ArraySetSorted<T> extends AbstractSet<T> { diff --git a/Spigot-Server-Patches/Optimise-BlockState-s-hashCode-equals.patch b/Spigot-Server-Patches/Optimise-BlockState-s-hashCode-equals.patch index d6ace15978..cc23459ed0 100644 --- a/Spigot-Server-Patches/Optimise-BlockState-s-hashCode-equals.patch +++ b/Spigot-Server-Patches/Optimise-BlockState-s-hashCode-equals.patch @@ -8,10 +8,10 @@ object identity checks safely. Use a simpler optimized hashcode -diff --git a/src/main/java/net/minecraft/server/BlockStateBoolean.java b/src/main/java/net/minecraft/server/BlockStateBoolean.java +diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateBoolean.java b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateBoolean.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockStateBoolean.java -+++ b/src/main/java/net/minecraft/server/BlockStateBoolean.java +--- a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateBoolean.java ++++ b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateBoolean.java @@ -0,0 +0,0 @@ public class BlockStateBoolean extends IBlockState<Boolean> { return obool.toString(); } @@ -22,10 +22,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this == object) { return true; } else if (object instanceof BlockStateBoolean && super.equals(object)) { -diff --git a/src/main/java/net/minecraft/server/BlockStateEnum.java b/src/main/java/net/minecraft/server/BlockStateEnum.java +diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockStateEnum.java -+++ b/src/main/java/net/minecraft/server/BlockStateEnum.java +--- a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java ++++ b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java @@ -0,0 +0,0 @@ public class BlockStateEnum<T extends Enum<T> & INamable> extends IBlockState<T> return ((INamable) t0).getName(); } @@ -36,10 +36,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this == object) { return true; } else if (object instanceof BlockStateEnum && super.equals(object)) { -diff --git a/src/main/java/net/minecraft/server/BlockStateInteger.java b/src/main/java/net/minecraft/server/BlockStateInteger.java +diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateInteger.java b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateInteger.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockStateInteger.java -+++ b/src/main/java/net/minecraft/server/BlockStateInteger.java +--- a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateInteger.java ++++ b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateInteger.java @@ -0,0 +0,0 @@ public class BlockStateInteger extends IBlockState<Integer> { return this.a; } @@ -50,10 +50,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this == object) { return true; } else if (object instanceof BlockStateInteger && super.equals(object)) { -diff --git a/src/main/java/net/minecraft/server/IBlockState.java b/src/main/java/net/minecraft/server/IBlockState.java +diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java b/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IBlockState.java -+++ b/src/main/java/net/minecraft/server/IBlockState.java +--- a/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java ++++ b/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java @@ -0,0 +0,0 @@ public abstract class IBlockState<T extends Comparable<T>> { } diff --git a/Spigot-Server-Patches/Optimise-Chunk-getFluid.patch b/Spigot-Server-Patches/Optimise-Chunk-getFluid.patch index d6bf67e0f1..4b00052462 100644 --- a/Spigot-Server-Patches/Optimise-Chunk-getFluid.patch +++ b/Spigot-Server-Patches/Optimise-Chunk-getFluid.patch @@ -7,10 +7,10 @@ Removing the try catch and generally reducing ops should make it faster on its own, however removing the try catch makes it easier to inline due to code size -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { } @@ -47,10 +47,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // CraftBukkit start -diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java @@ -0,0 +0,0 @@ public class ChunkSection { } diff --git a/Spigot-Server-Patches/Optimise-IEntityAccess-getPlayerByUUID.patch b/Spigot-Server-Patches/Optimise-IEntityAccess-getPlayerByUUID.patch index 2d69247479..f29518aeaa 100644 --- a/Spigot-Server-Patches/Optimise-IEntityAccess-getPlayerByUUID.patch +++ b/Spigot-Server-Patches/Optimise-IEntityAccess-getPlayerByUUID.patch @@ -5,27 +5,10 @@ Subject: [PATCH] Optimise IEntityAccess#getPlayerByUUID Use the world entity map instead of iterating over all players -diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IEntityAccess.java -+++ b/src/main/java/net/minecraft/server/IEntityAccess.java -@@ -0,0 +0,0 @@ public interface IEntityAccess { - - @Nullable - default EntityHuman b(UUID uuid) { -+ // Paper start - allow WorldServer to override -+ return this.getPlayerByUUID(uuid); -+ } -+ @Nullable -+ default EntityHuman getPlayerByUUID(UUID uuid) { -+ // Paper end - for (int i = 0; i < this.getPlayers().size(); ++i) { - EntityHuman entityhuman = (EntityHuman) this.getPlayers().get(i); - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { } // Paper end @@ -42,3 +25,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Add env and gen to constructor, WorldData -> WorldDataServer public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor +diff --git a/src/main/java/net/minecraft/world/level/IEntityAccess.java b/src/main/java/net/minecraft/world/level/IEntityAccess.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/IEntityAccess.java ++++ b/src/main/java/net/minecraft/world/level/IEntityAccess.java +@@ -0,0 +0,0 @@ public interface IEntityAccess { + + @Nullable + default EntityHuman b(UUID uuid) { ++ // Paper start - allow WorldServer to override ++ return this.getPlayerByUUID(uuid); ++ } ++ @Nullable ++ default EntityHuman getPlayerByUUID(UUID uuid) { ++ // Paper end + for (int i = 0; i < this.getPlayers().size(); ++i) { + EntityHuman entityhuman = (EntityHuman) this.getPlayers().get(i); + diff --git a/Spigot-Server-Patches/Optimise-TickListServer-by-rewriting-it.patch b/Spigot-Server-Patches/Optimise-TickListServer-by-rewriting-it.patch index 579f538686..2859d77721 100644 --- a/Spigot-Server-Patches/Optimise-TickListServer-by-rewriting-it.patch +++ b/Spigot-Server-Patches/Optimise-TickListServer-by-rewriting-it.patch @@ -888,10 +888,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } +} -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java +diff --git a/src/main/java/net/minecraft/core/BlockPosition.java b/src/main/java/net/minecraft/core/BlockPosition.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java +--- a/src/main/java/net/minecraft/core/BlockPosition.java ++++ b/src/main/java/net/minecraft/core/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { return i == 0 && j == 0 && k == 0 ? this : new BlockPosition(this.getX() + i, this.getY() + j, this.getZ() + k); } @@ -900,10 +900,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public BlockPosition a(BaseBlockPosition baseblockposition) { return this.b(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); } -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { } // Paper end @@ -918,11 +918,85 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public ChunkProviderServer(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator chunkgenerator, int i, boolean flag, WorldLoadListener worldloadlistener, Supplier<WorldPersistentData> supplier) { this.world = worldserver; this.serverThreadQueue = new ChunkProviderServer.a(worldserver); -diff --git a/src/main/java/net/minecraft/server/NextTickListEntry.java b/src/main/java/net/minecraft/server/NextTickListEntry.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NextTickListEntry.java -+++ b/src/main/java/net/minecraft/server/NextTickListEntry.java -@@ -0,0 +0,0 @@ import java.util.Comparator; +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java +@@ -0,0 +0,0 @@ public class PlayerChunk { + PlayerChunk.this.isTickingReady = true; + + +- ++ // Paper start - rewrite ticklistserver ++ PlayerChunk.this.chunkMap.world.onChunkSetTicking(PlayerChunk.this.location.x, PlayerChunk.this.location.z); ++ // Paper end - rewrite ticklistserver + + } + }); +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + } + // Paper end + ++ // Paper start - rewrite ticklistserver ++ void onChunkSetTicking(int chunkX, int chunkZ) { ++ if (com.destroystokyo.paper.PaperConfig.useOptimizedTickList) { ++ ((com.destroystokyo.paper.server.ticklist.PaperTickList) this.nextTickListBlock).onChunkSetTicking(chunkX, chunkZ); ++ ((com.destroystokyo.paper.server.ticklist.PaperTickList) this.nextTickListFluid).onChunkSetTicking(chunkX, chunkZ); ++ } ++ } ++ // Paper end - rewrite ticklistserver ++ + // Add env and gen to constructor, WorldData -> WorldDataServer + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { + super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + convertable = convertable_conversionsession; + uuid = WorldUUID.getUUID(convertable_conversionsession.folder.toFile()); + // CraftBukkit end +- this.nextTickListBlock = new TickListServer<>(this, (block) -> { +- return block == null || block.getBlockData().isAir(); +- }, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings +- this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> { +- return fluidtype == null || fluidtype == FluidTypes.EMPTY; +- }, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings ++ if (com.destroystokyo.paper.PaperConfig.useOptimizedTickList) { ++ this.nextTickListBlock = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (block) -> { ++ return block == null || block.getBlockData().isAir(); ++ }, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings ++ this.nextTickListFluid = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (fluidtype) -> { ++ return fluidtype == null || fluidtype == FluidTypes.EMPTY; ++ }, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings ++ } else { ++ this.nextTickListBlock = new TickListServer<>(this, (block) -> { ++ return block == null || block.getBlockData().isAir(); ++ }, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings ++ this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> { ++ return fluidtype == null || fluidtype == FluidTypes.EMPTY; ++ }, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings ++ } + this.navigators = Sets.newHashSet(); + this.L = new ObjectLinkedOpenHashSet(); + this.Q = flag1; +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + if (this.Q) { + long i = this.worldData.getTime() + 1L; + +- this.worldDataServer.setTime(i); ++ this.worldDataServer.setTime(i); // Paper - diff on change, we want the below to be ran right after this ++ this.nextTickListBlock.nextTick(); // Paper ++ this.nextTickListFluid.nextTick(); // Paper + this.worldDataServer.u().a(this.server, i); + if (this.worldData.q().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) { + this.setDayTime(this.worldData.getDayTime() + 1L); +diff --git a/src/main/java/net/minecraft/world/level/NextTickListEntry.java b/src/main/java/net/minecraft/world/level/NextTickListEntry.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/NextTickListEntry.java ++++ b/src/main/java/net/minecraft/world/level/NextTickListEntry.java +@@ -0,0 +0,0 @@ import net.minecraft.core.BlockPosition; public class NextTickListEntry<T> { private static final java.util.concurrent.atomic.AtomicLong COUNTER = new java.util.concurrent.atomic.AtomicLong(); // Paper - async chunk loading @@ -989,64 +1063,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public String toString() { return this.e + ": " + this.a + ", " + this.b + ", " + this.c + ", " + this.f; -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java +diff --git a/src/main/java/net/minecraft/world/level/TickListChunk.java b/src/main/java/net/minecraft/world/level/TickListChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -0,0 +0,0 @@ public class PlayerChunk { - PlayerChunk.this.isTickingReady = true; - - -- -+ // Paper start - rewrite ticklistserver -+ PlayerChunk.this.chunkMap.world.onChunkSetTicking(PlayerChunk.this.location.x, PlayerChunk.this.location.z); -+ // Paper end - rewrite ticklistserver - - } - }); -diff --git a/src/main/java/net/minecraft/server/StructureBoundingBox.java b/src/main/java/net/minecraft/server/StructureBoundingBox.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/StructureBoundingBox.java -+++ b/src/main/java/net/minecraft/server/StructureBoundingBox.java -@@ -0,0 +0,0 @@ import com.google.common.base.MoreObjects; - - public class StructureBoundingBox { - -- public int a; -- public int b; -- public int c; -- public int d; -- public int e; -- public int f; -+ public int a; public final int getMinX() { return this.a; } // Paper - OBFHELPER -+ public int b; public final int getMinY() { return this.b; } // Paper - OBFHELPER -+ public int c; public final int getMinZ() { return this.c; } // Paper - OBFHELPER -+ public int d; public final int getMaxX() { return this.d; } // Paper - OBFHELPER -+ public int e; public final int getMaxY() { return this.e; } // Paper - OBFHELPER -+ public int f; public final int getMaxZ() { return this.f; } // Paper - OBFHELPER - - public StructureBoundingBox() {} - -@@ -0,0 +0,0 @@ public class StructureBoundingBox { - this.e = 512; - } - -+ public final boolean intersects(StructureBoundingBox boundingBox) { return this.b(boundingBox); } // Paper - OBFHELPER - public boolean b(StructureBoundingBox structureboundingbox) { - return this.d >= structureboundingbox.a && this.a <= structureboundingbox.d && this.f >= structureboundingbox.c && this.c <= structureboundingbox.f && this.e >= structureboundingbox.b && this.b <= structureboundingbox.e; - } -@@ -0,0 +0,0 @@ public class StructureBoundingBox { - this.a(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); - } - -+ public final boolean hasPoint(BaseBlockPosition baseblockposition) { return this.b(baseblockposition); } // Paper - OBFHELPER - public boolean b(BaseBlockPosition baseblockposition) { - return baseblockposition.getX() >= this.a && baseblockposition.getX() <= this.d && baseblockposition.getZ() >= this.c && baseblockposition.getZ() <= this.f && baseblockposition.getY() >= this.b && baseblockposition.getY() <= this.e; - } -diff --git a/src/main/java/net/minecraft/server/TickListChunk.java b/src/main/java/net/minecraft/server/TickListChunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TickListChunk.java -+++ b/src/main/java/net/minecraft/server/TickListChunk.java +--- a/src/main/java/net/minecraft/world/level/TickListChunk.java ++++ b/src/main/java/net/minecraft/world/level/TickListChunk.java @@ -0,0 +0,0 @@ public class TickListChunk<T> implements TickList<T> { return nbttaglist; } @@ -1072,10 +1092,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -diff --git a/src/main/java/net/minecraft/server/TickListServer.java b/src/main/java/net/minecraft/server/TickListServer.java +diff --git a/src/main/java/net/minecraft/world/level/TickListServer.java b/src/main/java/net/minecraft/world/level/TickListServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TickListServer.java -+++ b/src/main/java/net/minecraft/server/TickListServer.java +--- a/src/main/java/net/minecraft/world/level/TickListServer.java ++++ b/src/main/java/net/minecraft/world/level/TickListServer.java @@ -0,0 +0,0 @@ public class TickListServer<T> implements TickList<T> { private final co.aikar.timings.Timing timingTicking; // Paper // Paper end @@ -1190,62 +1210,42 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.nextTickListHash.size(); } } -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureBoundingBox.java b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureBoundingBox.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { +--- a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureBoundingBox.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureBoundingBox.java +@@ -0,0 +0,0 @@ import net.minecraft.nbt.NBTTagIntArray; + + public class StructureBoundingBox { + +- public int a; +- public int b; +- public int c; +- public int d; +- public int e; +- public int f; ++ public int a; public final int getMinX() { return this.a; } // Paper - OBFHELPER ++ public int b; public final int getMinY() { return this.b; } // Paper - OBFHELPER ++ public int c; public final int getMinZ() { return this.c; } // Paper - OBFHELPER ++ public int d; public final int getMaxX() { return this.d; } // Paper - OBFHELPER ++ public int e; public final int getMaxY() { return this.e; } // Paper - OBFHELPER ++ public int f; public final int getMaxZ() { return this.f; } // Paper - OBFHELPER + + public StructureBoundingBox() {} + +@@ -0,0 +0,0 @@ public class StructureBoundingBox { + this.e = 512; } - // Paper end -+ // Paper start - rewrite ticklistserver -+ void onChunkSetTicking(int chunkX, int chunkZ) { -+ if (com.destroystokyo.paper.PaperConfig.useOptimizedTickList) { -+ ((com.destroystokyo.paper.server.ticklist.PaperTickList) this.nextTickListBlock).onChunkSetTicking(chunkX, chunkZ); -+ ((com.destroystokyo.paper.server.ticklist.PaperTickList) this.nextTickListFluid).onChunkSetTicking(chunkX, chunkZ); -+ } -+ } -+ // Paper end - rewrite ticklistserver -+ - // Add env and gen to constructor, WorldData -> WorldDataServer - public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { - super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor -@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { - convertable = convertable_conversionsession; - uuid = WorldUUID.getUUID(convertable_conversionsession.folder.toFile()); - // CraftBukkit end -- this.nextTickListBlock = new TickListServer<>(this, (block) -> { -- return block == null || block.getBlockData().isAir(); -- }, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings -- this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> { -- return fluidtype == null || fluidtype == FluidTypes.EMPTY; -- }, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings -+ if (com.destroystokyo.paper.PaperConfig.useOptimizedTickList) { -+ this.nextTickListBlock = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (block) -> { -+ return block == null || block.getBlockData().isAir(); -+ }, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings -+ this.nextTickListFluid = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (fluidtype) -> { -+ return fluidtype == null || fluidtype == FluidTypes.EMPTY; -+ }, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings -+ } else { -+ this.nextTickListBlock = new TickListServer<>(this, (block) -> { -+ return block == null || block.getBlockData().isAir(); -+ }, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings -+ this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> { -+ return fluidtype == null || fluidtype == FluidTypes.EMPTY; -+ }, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings -+ } - this.navigators = Sets.newHashSet(); - this.L = new ObjectLinkedOpenHashSet(); - this.Q = flag1; -@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { - if (this.Q) { - long i = this.worldData.getTime() + 1L; ++ public final boolean intersects(StructureBoundingBox boundingBox) { return this.b(boundingBox); } // Paper - OBFHELPER + public boolean b(StructureBoundingBox structureboundingbox) { + return this.d >= structureboundingbox.a && this.a <= structureboundingbox.d && this.f >= structureboundingbox.c && this.c <= structureboundingbox.f && this.e >= structureboundingbox.b && this.b <= structureboundingbox.e; + } +@@ -0,0 +0,0 @@ public class StructureBoundingBox { + this.a(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); + } -- this.worldDataServer.setTime(i); -+ this.worldDataServer.setTime(i); // Paper - diff on change, we want the below to be ran right after this -+ this.nextTickListBlock.nextTick(); // Paper -+ this.nextTickListFluid.nextTick(); // Paper - this.worldDataServer.u().a(this.server, i); - if (this.worldData.q().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) { - this.setDayTime(this.worldData.getDayTime() + 1L); ++ public final boolean hasPoint(BaseBlockPosition baseblockposition) { return this.b(baseblockposition); } // Paper - OBFHELPER + public boolean b(BaseBlockPosition baseblockposition) { + return baseblockposition.getX() >= this.a && baseblockposition.getX() <= this.d && baseblockposition.getZ() >= this.c && baseblockposition.getZ() <= this.f && baseblockposition.getY() >= this.b && baseblockposition.getY() <= this.e; + } diff --git a/Spigot-Server-Patches/Optimise-getChunkAt-calls-for-loaded-chunks.patch b/Spigot-Server-Patches/Optimise-getChunkAt-calls-for-loaded-chunks.patch index 1e7dce7ddc..fbfd592126 100644 --- a/Spigot-Server-Patches/Optimise-getChunkAt-calls-for-loaded-chunks.patch +++ b/Spigot-Server-Patches/Optimise-getChunkAt-calls-for-loaded-chunks.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimise getChunkAt calls for loaded chunks bypass the need to get a player chunk, then get the either, then unwrap it... -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { return this.getChunkAt(i, j, chunkstatus, flag); }, this.serverThreadQueue).join(); diff --git a/Spigot-Server-Patches/Optimise-getType-calls.patch b/Spigot-Server-Patches/Optimise-getType-calls.patch index 21c651753f..d9da966e5b 100644 --- a/Spigot-Server-Patches/Optimise-getType-calls.patch +++ b/Spigot-Server-Patches/Optimise-getType-calls.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimise getType calls Remove the map lookup for converting from Block->Bukkit Material -diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java +diff --git a/src/main/java/net/minecraft/world/level/block/state/IBlockData.java b/src/main/java/net/minecraft/world/level/block/state/IBlockData.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IBlockData.java -+++ b/src/main/java/net/minecraft/server/IBlockData.java +--- a/src/main/java/net/minecraft/world/level/block/state/IBlockData.java ++++ b/src/main/java/net/minecraft/world/level/block/state/IBlockData.java @@ -0,0 +0,0 @@ public class IBlockData extends BlockBase.BlockData { public static final Codec<IBlockData> b = a((Codec) IRegistry.BLOCK, Block::getBlockData).stable(); diff --git a/Spigot-Server-Patches/Optimise-random-block-ticking.patch b/Spigot-Server-Patches/Optimise-random-block-ticking.patch index 145c018cf3..2a4ba98fcc 100644 --- a/Spigot-Server-Patches/Optimise-random-block-ticking.patch +++ b/Spigot-Server-Patches/Optimise-random-block-ticking.patch @@ -70,10 +70,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return fastRandomBounded(this.next(32) & 0xFFFFFFFFL, bound); + } +} -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java +diff --git a/src/main/java/net/minecraft/core/BlockPosition.java b/src/main/java/net/minecraft/core/BlockPosition.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java +--- a/src/main/java/net/minecraft/core/BlockPosition.java ++++ b/src/main/java/net/minecraft/core/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { return this.d(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); } @@ -82,194 +82,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public BlockPosition.MutableBlockPosition g(BaseBlockPosition baseblockposition) { return this.d(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); } -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - this.entities.remove(entity); // Paper - } - -- @Override -- public int getHighestBlock(HeightMap.Type heightmap_type, int i, int j) { -+ public final int getHighestBlockY(HeightMap.Type heightmap_type, int i, int j) { return this.getHighestBlock(heightmap_type, i, j) + 1; } // Paper - sort of an obfhelper, but without -1 -+ @Override public int getHighestBlock(HeightMap.Type heightmap_type, int i, int j) { // Paper - return ((HeightMap) this.heightMap.get(heightmap_type)).a(i & 15, j & 15) - 1; - } - -diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; - public class ChunkSection { - - public static final DataPalette<IBlockData> GLOBAL_PALETTE = new DataPaletteGlobal<>(Block.REGISTRY_ID, Blocks.AIR.getBlockData()); -- private final int yPos; -+ final int yPos; // Paper - private -> package-private - short nonEmptyBlockCount; // Paper - package-private -- private short tickingBlockCount; -+ short tickingBlockCount; // Paper - private -> package-private - private short e; - final DataPaletteBlock<IBlockData> blockIds; // Paper - package-private - -+ final com.destroystokyo.paper.util.maplist.IBlockDataList tickingList = new com.destroystokyo.paper.util.maplist.IBlockDataList(); // Paper -+ - // Paper start - Anti-Xray - Add parameters - @Deprecated public ChunkSection(int i) { this(i, null, null, true); } // Notice for updates: Please make sure this constructor isn't used anywhere - public ChunkSection(int i, IChunkAccess chunk, World world, boolean initializeBlocks) { -@@ -0,0 +0,0 @@ public class ChunkSection { - --this.nonEmptyBlockCount; - if (iblockdata1.isTicking()) { - --this.tickingBlockCount; -+ // Paper start -+ this.tickingList.remove(i, j, k); -+ // Paper end - } - } - -@@ -0,0 +0,0 @@ public class ChunkSection { - ++this.nonEmptyBlockCount; - if (iblockdata.isTicking()) { - ++this.tickingBlockCount; -+ // Paper start -+ this.tickingList.add(i, j, k, iblockdata); -+ // Paper end - } - } - -@@ -0,0 +0,0 @@ public class ChunkSection { - } - - public void recalcBlockCounts() { -+ // Paper start -+ this.tickingList.clear(); -+ // Paper end - this.nonEmptyBlockCount = 0; - this.tickingBlockCount = 0; - this.e = 0; -- this.blockIds.a((iblockdata, i) -> { -+ this.blockIds.forEachLocation((iblockdata, location) -> { // Paper - Fluid fluid = iblockdata.getFluid(); - - if (!iblockdata.isAir()) { -- this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + i); -+ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); - if (iblockdata.isTicking()) { -- this.tickingBlockCount = (short) (this.tickingBlockCount + i); -+ this.tickingBlockCount = (short) (this.tickingBlockCount + 1); -+ // Paper start -+ this.tickingList.add(location, iblockdata); -+ // Paper end - } - } - - if (!fluid.isEmpty()) { -- this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + i); -+ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); - if (fluid.f()) { -- this.e = (short) (this.e + i); -+ this.e = (short) (this.e + 1); - } - } - -diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DataBits.java -+++ b/src/main/java/net/minecraft/server/DataBits.java -@@ -0,0 +0,0 @@ public class DataBits { - } - - } -+ -+ // Paper start -+ public final void forEach(DataBitConsumer consumer) { -+ int i = 0; -+ long[] along = this.b; -+ int j = along.length; -+ -+ for (int k = 0; k < j; ++k) { -+ long l = along[k]; -+ -+ for (int i1 = 0; i1 < this.f; ++i1) { -+ consumer.accept(i, (int) (l & this.d)); -+ l >>= this.c; -+ ++i; -+ if (i >= this.e) { -+ return; -+ } -+ } -+ } -+ } -+ -+ @FunctionalInterface -+ static interface DataBitConsumer { -+ -+ void accept(int location, int data); -+ -+ } -+ // Paper end - } -diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DataPaletteBlock.java -+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java -@@ -0,0 +0,0 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> { - }); - } - -+ // Paper start -+ public void forEachLocation(DataPaletteBlock.a<T> datapaletteblock_a) { -+ this.getDataBits().forEach((int location, int data) -> { -+ datapaletteblock_a.accept(this.getDataPalette().getObject(data), location); -+ }); -+ } -+ // Paper end -+ - @FunctionalInterface - public interface a<T> { - -diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTurtle.java -+++ b/src/main/java/net/minecraft/server/EntityTurtle.java -@@ -0,0 +0,0 @@ public class EntityTurtle extends EntityAnimal { - } - - public void setHomePos(BlockPosition blockposition) { -- this.datawatcher.set(EntityTurtle.bp, blockposition); -+ this.datawatcher.set(EntityTurtle.bp, blockposition.immutableCopy()); // Paper - called with mutablepos... - } - - public BlockPosition getHomePos() { // Paper - public -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - public abstract ITagRegistry p(); - - public BlockPosition a(int i, int j, int k, int l) { -+ // Paper start - allow use of mutable pos -+ BlockPosition.MutableBlockPosition ret = new BlockPosition.MutableBlockPosition(); -+ this.getRandomBlockPosition(i, j, k, l, ret); -+ return ret.immutableCopy(); -+ } -+ public final BlockPosition.MutableBlockPosition getRandomBlockPosition(int i, int j, int k, int l, BlockPosition.MutableBlockPosition out) { -+ // Paper end - this.n = this.n * 3 + 1013904223; - int i1 = this.n >> 2; - -- return new BlockPosition(i + (i1 & 15), j + (i1 >> 16 & l), k + (i1 >> 8 & 15)); -+ out.setValues(i + (i1 & 15), j + (i1 >> 16 & l), k + (i1 >> 8 & 15)); // Paper - change to setValues call -+ return out; // Paper - } - - public boolean isSavingDisabled() { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { }); } @@ -405,3 +221,187 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } protected BlockPosition a(BlockPosition blockposition) { +diff --git a/src/main/java/net/minecraft/util/DataBits.java b/src/main/java/net/minecraft/util/DataBits.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/util/DataBits.java ++++ b/src/main/java/net/minecraft/util/DataBits.java +@@ -0,0 +0,0 @@ public class DataBits { + } + + } ++ ++ // Paper start ++ public final void forEach(DataBitConsumer consumer) { ++ int i = 0; ++ long[] along = this.b; ++ int j = along.length; ++ ++ for (int k = 0; k < j; ++k) { ++ long l = along[k]; ++ ++ for (int i1 = 0; i1 < this.f; ++i1) { ++ consumer.accept(i, (int) (l & this.d)); ++ l >>= this.c; ++ ++i; ++ if (i >= this.e) { ++ return; ++ } ++ } ++ } ++ } ++ ++ @FunctionalInterface ++ static interface DataBitConsumer { ++ ++ void accept(int location, int data); ++ ++ } ++ // Paper end + } +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java b/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java +@@ -0,0 +0,0 @@ public class EntityTurtle extends EntityAnimal { + } + + public void setHomePos(BlockPosition blockposition) { +- this.datawatcher.set(EntityTurtle.bp, blockposition); ++ this.datawatcher.set(EntityTurtle.bp, blockposition.immutableCopy()); // Paper - called with mutablepos... + } + + public BlockPosition getHomePos() { // Paper - public +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public abstract ITagRegistry p(); + + public BlockPosition a(int i, int j, int k, int l) { ++ // Paper start - allow use of mutable pos ++ BlockPosition.MutableBlockPosition ret = new BlockPosition.MutableBlockPosition(); ++ this.getRandomBlockPosition(i, j, k, l, ret); ++ return ret.immutableCopy(); ++ } ++ public final BlockPosition.MutableBlockPosition getRandomBlockPosition(int i, int j, int k, int l, BlockPosition.MutableBlockPosition out) { ++ // Paper end + this.n = this.n * 3 + 1013904223; + int i1 = this.n >> 2; + +- return new BlockPosition(i + (i1 & 15), j + (i1 >> 16 & l), k + (i1 >> 8 & 15)); ++ out.setValues(i + (i1 & 15), j + (i1 >> 16 & l), k + (i1 >> 8 & 15)); // Paper - change to setValues call ++ return out; // Paper + } + + public boolean isSavingDisabled() { +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + this.entities.remove(entity); // Paper + } + +- @Override +- public int getHighestBlock(HeightMap.Type heightmap_type, int i, int j) { ++ public final int getHighestBlockY(HeightMap.Type heightmap_type, int i, int j) { return this.getHighestBlock(heightmap_type, i, j) + 1; } // Paper - sort of an obfhelper, but without -1 ++ @Override public int getHighestBlock(HeightMap.Type heightmap_type, int i, int j) { // Paper + return ((HeightMap) this.heightMap.get(heightmap_type)).a(i & 15, j & 15) - 1; + } + +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.material.Fluid; + public class ChunkSection { + + public static final DataPalette<IBlockData> GLOBAL_PALETTE = new DataPaletteGlobal<>(Block.REGISTRY_ID, Blocks.AIR.getBlockData()); +- private final int yPos; ++ final int yPos; // Paper - private -> package-private + short nonEmptyBlockCount; // Paper - package-private +- private short tickingBlockCount; ++ short tickingBlockCount; // Paper - private -> package-private + private short e; + final DataPaletteBlock<IBlockData> blockIds; // Paper - package-private + ++ final com.destroystokyo.paper.util.maplist.IBlockDataList tickingList = new com.destroystokyo.paper.util.maplist.IBlockDataList(); // Paper ++ + // Paper start - Anti-Xray - Add parameters + @Deprecated public ChunkSection(int i) { this(i, null, null, true); } // Notice for updates: Please make sure this constructor isn't used anywhere + public ChunkSection(int i, IChunkAccess chunk, World world, boolean initializeBlocks) { +@@ -0,0 +0,0 @@ public class ChunkSection { + --this.nonEmptyBlockCount; + if (iblockdata1.isTicking()) { + --this.tickingBlockCount; ++ // Paper start ++ this.tickingList.remove(i, j, k); ++ // Paper end + } + } + +@@ -0,0 +0,0 @@ public class ChunkSection { + ++this.nonEmptyBlockCount; + if (iblockdata.isTicking()) { + ++this.tickingBlockCount; ++ // Paper start ++ this.tickingList.add(i, j, k, iblockdata); ++ // Paper end + } + } + +@@ -0,0 +0,0 @@ public class ChunkSection { + } + + public void recalcBlockCounts() { ++ // Paper start ++ this.tickingList.clear(); ++ // Paper end + this.nonEmptyBlockCount = 0; + this.tickingBlockCount = 0; + this.e = 0; +- this.blockIds.a((iblockdata, i) -> { ++ this.blockIds.forEachLocation((iblockdata, location) -> { // Paper + Fluid fluid = iblockdata.getFluid(); + + if (!iblockdata.isAir()) { +- this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + i); ++ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); + if (iblockdata.isTicking()) { +- this.tickingBlockCount = (short) (this.tickingBlockCount + i); ++ this.tickingBlockCount = (short) (this.tickingBlockCount + 1); ++ // Paper start ++ this.tickingList.add(location, iblockdata); ++ // Paper end + } + } + + if (!fluid.isEmpty()) { +- this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + i); ++ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); + if (fluid.f()) { +- this.e = (short) (this.e + i); ++ this.e = (short) (this.e + 1); + } + } + +diff --git a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java ++++ b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java +@@ -0,0 +0,0 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> { + }); + } + ++ // Paper start ++ public void forEachLocation(DataPaletteBlock.a<T> datapaletteblock_a) { ++ this.getDataBits().forEach((int location, int data) -> { ++ datapaletteblock_a.accept(this.getDataPalette().getObject(data), location); ++ }); ++ } ++ // Paper end ++ + @FunctionalInterface + public interface a<T> { + diff --git a/Spigot-Server-Patches/Optimise-removeQueue.patch b/Spigot-Server-Patches/Optimise-removeQueue.patch index cae9b7ff12..9f7be558e9 100644 --- a/Spigot-Server-Patches/Optimise-removeQueue.patch +++ b/Spigot-Server-Patches/Optimise-removeQueue.patch @@ -4,10 +4,10 @@ Date: Fri, 25 Nov 2016 13:22:40 +0000 Subject: [PATCH] Optimise removeQueue -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { } diff --git a/Spigot-Server-Patches/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch b/Spigot-Server-Patches/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch index 390c19df1f..5a4e56f189 100644 --- a/Spigot-Server-Patches/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch +++ b/Spigot-Server-Patches/Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize Biome Mob Lookups for Mob Spawning Uses an EnumMap as well as a Set paired List for O(1) contains calls. -diff --git a/src/main/java/net/minecraft/server/BiomeSettingsMobs.java b/src/main/java/net/minecraft/server/BiomeSettingsMobs.java +diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeSettingsMobs.java b/src/main/java/net/minecraft/world/level/biome/BiomeSettingsMobs.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BiomeSettingsMobs.java -+++ b/src/main/java/net/minecraft/server/BiomeSettingsMobs.java +--- a/src/main/java/net/minecraft/world/level/biome/BiomeSettingsMobs.java ++++ b/src/main/java/net/minecraft/world/level/biome/BiomeSettingsMobs.java @@ -0,0 +0,0 @@ public class BiomeSettingsMobs { }, (enumcreaturetype) -> { return ImmutableList.of(); diff --git a/Spigot-Server-Patches/Optimize-Bit-Operations-by-inlining.patch b/Spigot-Server-Patches/Optimize-Bit-Operations-by-inlining.patch index 4f81573607..4dcff244df 100644 --- a/Spigot-Server-Patches/Optimize-Bit-Operations-by-inlining.patch +++ b/Spigot-Server-Patches/Optimize-Bit-Operations-by-inlining.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimize Bit Operations by inlining Inline bit operations and reduce instruction count to make these hot operations faster -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java +diff --git a/src/main/java/net/minecraft/core/BlockPosition.java b/src/main/java/net/minecraft/core/BlockPosition.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java +--- a/src/main/java/net/minecraft/core/BlockPosition.java ++++ b/src/main/java/net/minecraft/core/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { }).stable(); private static final Logger LOGGER = LogManager.getLogger(); @@ -84,10 +84,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public static long f(long i) { -diff --git a/src/main/java/net/minecraft/server/SectionPosition.java b/src/main/java/net/minecraft/server/SectionPosition.java +diff --git a/src/main/java/net/minecraft/core/SectionPosition.java b/src/main/java/net/minecraft/core/SectionPosition.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SectionPosition.java -+++ b/src/main/java/net/minecraft/server/SectionPosition.java +--- a/src/main/java/net/minecraft/core/SectionPosition.java ++++ b/src/main/java/net/minecraft/core/SectionPosition.java @@ -0,0 +0,0 @@ public class SectionPosition extends BaseBlockPosition { } diff --git a/Spigot-Server-Patches/Optimize-BlockPosition-helper-methods.patch b/Spigot-Server-Patches/Optimize-BlockPosition-helper-methods.patch index b6e61ccf58..06a96740b1 100644 --- a/Spigot-Server-Patches/Optimize-BlockPosition-helper-methods.patch +++ b/Spigot-Server-Patches/Optimize-BlockPosition-helper-methods.patch @@ -5,10 +5,10 @@ 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 +diff --git a/src/main/java/net/minecraft/core/BlockPosition.java b/src/main/java/net/minecraft/core/BlockPosition.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java +--- a/src/main/java/net/minecraft/core/BlockPosition.java ++++ b/src/main/java/net/minecraft/core/BlockPosition.java @@ -0,0 +0,0 @@ public class BlockPosition extends BaseBlockPosition { @Override diff --git a/Spigot-Server-Patches/Optimize-Captured-TileEntity-Lookup.patch b/Spigot-Server-Patches/Optimize-Captured-TileEntity-Lookup.patch index d5ab4ace82..9168f175d0 100644 --- a/Spigot-Server-Patches/Optimize-Captured-TileEntity-Lookup.patch +++ b/Spigot-Server-Patches/Optimize-Captured-TileEntity-Lookup.patch @@ -9,10 +9,10 @@ that scenario is only even valid if were in the middle of a block place. 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 +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return null; } else { diff --git a/Spigot-Server-Patches/Optimize-ChunkProviderServer-s-chunk-level-checking-.patch b/Spigot-Server-Patches/Optimize-ChunkProviderServer-s-chunk-level-checking-.patch index 0f3108799f..57a3e94cdf 100644 --- a/Spigot-Server-Patches/Optimize-ChunkProviderServer-s-chunk-level-checking-.patch +++ b/Spigot-Server-Patches/Optimize-ChunkProviderServer-s-chunk-level-checking-.patch @@ -8,10 +8,10 @@ These can be hot functions (i.e entity ticking and block ticking), so inline where possible, and avoid the abstraction of the Either class. -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { public final boolean isInEntityTickingChunk(Entity entity) { return this.a(entity); } // Paper - OBFHELPER diff --git a/Spigot-Server-Patches/Optimize-Collision-to-not-load-chunks.patch b/Spigot-Server-Patches/Optimize-Collision-to-not-load-chunks.patch index 9e8770129c..dedc80678d 100644 --- a/Spigot-Server-Patches/Optimize-Collision-to-not-load-chunks.patch +++ b/Spigot-Server-Patches/Optimize-Collision-to-not-load-chunks.patch @@ -13,11 +13,23 @@ If that serting is not enabled, collisions will be ignored for players, since movement will load only the chunk the player enters anyways and avoids loading massive amounts of surrounding chunks due to large AABB lookups. -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -0,0 +0,0 @@ public abstract class PlayerList { + entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + // CraftBukkit end + ++ worldserver1.getChunkProvider().addTicket(TicketType.POST_TELEPORT, new ChunkCoordIntPair(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper + while (avoidSuffocation && !worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) { + entityplayer1.setPosition(entityplayer1.locX(), entityplayer1.locY() + 1.0D, entityplayer1.locZ()); + } +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne private CraftEntity bukkitEntity; PlayerChunkMap.EntityTracker tracker; // Paper @@ -25,10 +37,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Throwable addedToWorldStack; // Paper - entity debug public CraftEntity getBukkitEntity() { if (bukkitEntity == null) { -diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java +diff --git a/src/main/java/net/minecraft/world/level/ICollisionAccess.java b/src/main/java/net/minecraft/world/level/ICollisionAccess.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ICollisionAccess.java -+++ b/src/main/java/net/minecraft/server/ICollisionAccess.java +--- a/src/main/java/net/minecraft/world/level/ICollisionAccess.java ++++ b/src/main/java/net/minecraft/world/level/ICollisionAccess.java @@ -0,0 +0,0 @@ public interface ICollisionAccess extends IBlockAccess { } @@ -39,23 +51,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } Stream<VoxelShape> c(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate<Entity> predicate); -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java b/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - // CraftBukkit end - -+ worldserver1.getChunkProvider().addTicket(TicketType.POST_TELEPORT, new ChunkCoordIntPair(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper - while (avoidSuffocation && !worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) { - entityplayer1.setPosition(entityplayer1.locX(), entityplayer1.locY() + 1.0D, entityplayer1.locZ()); - } -diff --git a/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java b/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java -+++ b/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java ++++ b/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java +@@ -0,0 +0,0 @@ import net.minecraft.world.phys.shapes.VoxelShapes; public class VoxelShapeSpliterator extends AbstractSpliterator<VoxelShape> { @Nullable @@ -119,10 +119,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!this.i.test(iblockdata, this.e) || l == 1 && !iblockdata.d() || l == 2 && !iblockdata.a(Blocks.MOVING_PISTON)) { continue; -diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java +diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapes.java -+++ b/src/main/java/net/minecraft/server/VoxelShapes.java +--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java @@ -0,0 +0,0 @@ public final class VoxelShapes { if (k2 < 3) { diff --git a/Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch b/Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch index 05d6212fdc..7c430a4990 100644 --- a/Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch +++ b/Spigot-Server-Patches/Optimize-CraftBlockData-Creation.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimize CraftBlockData Creation 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/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java +diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockBase.java -+++ b/src/main/java/net/minecraft/server/BlockBase.java +--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java ++++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java @@ -0,0 +0,0 @@ public abstract class BlockBase { this.o = blockbase_info.t; this.p = blockbase_info.u; diff --git a/Spigot-Server-Patches/Optimize-DataBits.patch b/Spigot-Server-Patches/Optimize-DataBits.patch index 0dc8872bd8..4fa643e8e0 100644 --- a/Spigot-Server-Patches/Optimize-DataBits.patch +++ b/Spigot-Server-Patches/Optimize-DataBits.patch @@ -10,10 +10,10 @@ After: http://i.imgur.com/nJ46crB.png Optimize redundant converting of static fields into an unsigned long each call by precomputing it in ctor -diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java +diff --git a/src/main/java/net/minecraft/util/DataBits.java b/src/main/java/net/minecraft/util/DataBits.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DataBits.java -+++ b/src/main/java/net/minecraft/server/DataBits.java +--- a/src/main/java/net/minecraft/util/DataBits.java ++++ b/src/main/java/net/minecraft/util/DataBits.java @@ -0,0 +0,0 @@ public class DataBits { private final long d; private final int e; diff --git a/Spigot-Server-Patches/Optimize-Hoppers.patch b/Spigot-Server-Patches/Optimize-Hoppers.patch index ac2e408966..7aa4a69ed9 100644 --- a/Spigot-Server-Patches/Optimize-Hoppers.patch +++ b/Spigot-Server-Patches/Optimize-Hoppers.patch @@ -30,10 +30,57 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled")); + } } -diff --git a/src/main/java/net/minecraft/server/IHopper.java b/src/main/java/net/minecraft/server/IHopper.java +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IHopper.java -+++ b/src/main/java/net/minecraft/server/IHopper.java +--- 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<TickTas + while (iterator.hasNext()) { + WorldServer worldserver = (WorldServer) iterator.next(); + worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper ++ TileEntityHopper.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper + + this.methodProfiler.a(() -> { + return worldserver + " " + worldserver.getDimensionKey().a(); +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -0,0 +0,0 @@ public final class ItemStack { + return this.getItem().a(this, entityhuman, entityliving, enumhand); + } + +- public ItemStack cloneItemStack() { +- if (this.isEmpty()) { ++ public ItemStack cloneItemStack() { return cloneItemStack(false); } // Paper ++ public ItemStack cloneItemStack(boolean origItem) { // Paper ++ if (!origItem && this.isEmpty()) { // Paper + return ItemStack.b; + } else { +- ItemStack itemstack = new ItemStack(this.getItem(), this.count); ++ ItemStack itemstack = new ItemStack(origItem ? this.item : this.getItem(), this.count); // Paper + + itemstack.d(this.D()); + if (this.tag != null) { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + return list; + } + +- @Override +- public <T extends Entity> List<T> a(Class<? extends T> oclass, AxisAlignedBB axisalignedbb, @Nullable Predicate<? super T> predicate) { ++ public <T extends Entity> List<T> getEntities(Class<? extends T> oclass, AxisAlignedBB axisalignedbb, @Nullable Predicate<? super T> predicate) { return a(oclass, axisalignedbb, predicate); } // Paper - OBFHELPER ++ @Override public <T extends Entity> List<T> a(Class<? extends T> oclass, AxisAlignedBB axisalignedbb, @Nullable Predicate<? super T> predicate) { + this.getMethodProfiler().c("getEntities"); + int i = MathHelper.floor((axisalignedbb.minX - 2.0D) / 16.0D); + int j = MathHelper.f((axisalignedbb.maxX + 2.0D) / 16.0D); +diff --git a/src/main/java/net/minecraft/world/level/block/entity/IHopper.java b/src/main/java/net/minecraft/world/level/block/entity/IHopper.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/IHopper.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/IHopper.java @@ -0,0 +0,0 @@ public interface IHopper extends IInventory { return IHopper.c; } @@ -52,43 +99,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - double A(); + double A(); default double getZ() { return this.A(); } // Paper - OBFHELPER } -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - return this.getItem().a(this, entityhuman, entityliving, enumhand); - } - -- public ItemStack cloneItemStack() { -- if (this.isEmpty()) { -+ public ItemStack cloneItemStack() { return cloneItemStack(false); } // Paper -+ public ItemStack cloneItemStack(boolean origItem) { // Paper -+ if (!origItem && this.isEmpty()) { // Paper - return ItemStack.b; - } else { -- ItemStack itemstack = new ItemStack(this.getItem(), this.count); -+ ItemStack itemstack = new ItemStack(origItem ? this.item : this.getItem(), this.count); // Paper - - itemstack.d(this.D()); - 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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<TickTas - while (iterator.hasNext()) { - WorldServer worldserver = (WorldServer) iterator.next(); - worldserver.hasPhysicsEvent = org.bukkit.event.block.BlockPhysicsEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper -+ TileEntityHopper.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - - this.methodProfiler.a(() -> { - return worldserver + " " + worldserver.getDimensionKey().a(); -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +@@ -0,0 +0,0 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / public void setCurrentChunk(Chunk chunk) { this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null; } @@ -96,7 +111,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end @Nullable -@@ -0,0 +0,0 @@ public abstract class TileEntity implements KeyedObject { // Paper +@@ -0,0 +0,0 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / public void update() { if (this.world != null) { @@ -104,10 +119,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.c = this.world.getType(this.position); 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 +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityHopper.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityHopper.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityHopper.java -+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityHopper.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityHopper.java @@ -0,0 +0,0 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi return false; } @@ -458,10 +473,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 List<Entity> list = world.getEntities((Entity) null, new AxisAlignedBB(d0 - 0.5D, d1 - 0.5D, d2 - 0.5D, d0 + 0.5D, d1 + 0.5D, d2 + 0.5D), IEntitySelector.d); if (!list.isEmpty()) { -diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityLootable.java -+++ b/src/main/java/net/minecraft/server/TileEntityLootable.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java @@ -0,0 +0,0 @@ public abstract class TileEntityLootable extends TileEntityContainer { @Override public boolean isEmpty() { @@ -484,18 +499,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return (ItemStack) this.f().get(i); } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 list; - } - -- @Override -- public <T extends Entity> List<T> a(Class<? extends T> oclass, AxisAlignedBB axisalignedbb, @Nullable Predicate<? super T> predicate) { -+ public <T extends Entity> List<T> getEntities(Class<? extends T> oclass, AxisAlignedBB axisalignedbb, @Nullable Predicate<? super T> predicate) { return a(oclass, axisalignedbb, predicate); } // Paper - OBFHELPER -+ @Override public <T extends Entity> List<T> a(Class<? extends T> oclass, AxisAlignedBB axisalignedbb, @Nullable Predicate<? super T> predicate) { - this.getMethodProfiler().c("getEntities"); - int i = MathHelper.floor((axisalignedbb.minX - 2.0D) / 16.0D); - int j = MathHelper.f((axisalignedbb.maxX + 2.0D) / 16.0D); diff --git a/Spigot-Server-Patches/Optimize-ItemStack.isEmpty.patch b/Spigot-Server-Patches/Optimize-ItemStack.isEmpty.patch index cb8176d566..68a8013e17 100644 --- a/Spigot-Server-Patches/Optimize-ItemStack.isEmpty.patch +++ b/Spigot-Server-Patches/Optimize-ItemStack.isEmpty.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize ItemStack.isEmpty() Remove hashMap lookup every check, simplify code to remove ternary -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -0,0 +0,0 @@ public final class ItemStack { } diff --git a/Spigot-Server-Patches/Optimize-Light-Engine.patch b/Spigot-Server-Patches/Optimize-Light-Engine.patch index 2c02669833..75ebfff942 100644 --- a/Spigot-Server-Patches/Optimize-Light-Engine.patch +++ b/Spigot-Server-Patches/Optimize-Light-Engine.patch @@ -24,10 +24,10 @@ Massive update to light to improve performance and chunk loading/generation. 7) Buffer non urgent tasks even if queueUpdate is called multiple times to improve efficiency. 8) Fix NPE risk that crashes server in getting nibble data -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { if (ChunkProviderServer.this.tickDistanceManager()) { return true; @@ -37,138 +37,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return super.executeNext() || execChunkTask; // Paper } } finally { -diff --git a/src/main/java/net/minecraft/server/LightEngineBlock.java b/src/main/java/net/minecraft/server/LightEngineBlock.java +diff --git a/src/main/java/net/minecraft/server/level/LightEngineGraphSection.java b/src/main/java/net/minecraft/server/level/LightEngineGraphSection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineBlock.java -+++ b/src/main/java/net/minecraft/server/LightEngineBlock.java -@@ -0,0 +0,0 @@ public final class LightEngineBlock extends LightEngineLayer<LightEngineStorageB - } - - private int d(long i) { -- int j = BlockPosition.b(i); -- int k = BlockPosition.c(i); -- int l = BlockPosition.d(i); -+ // Paper start - inline math -+ int j = (int) (i >> 38); -+ int k = (int) ((i << 52) >> 52); -+ int l = (int) ((i << 26) >> 38); -+ // Paper end - IBlockAccess iblockaccess = this.a.c(j >> 4, l >> 4); - - return iblockaccess != null ? iblockaccess.g(this.f.d(j, k, l)) : 0; -@@ -0,0 +0,0 @@ public final class LightEngineBlock extends LightEngineLayer<LightEngineStorageB - } else if (k >= 15) { - return k; - } else { -- int l = Integer.signum(BlockPosition.b(j) - BlockPosition.b(i)); -- int i1 = Integer.signum(BlockPosition.c(j) - BlockPosition.c(i)); -- int j1 = Integer.signum(BlockPosition.d(j) - BlockPosition.d(i)); -+ // Paper start - reuse math - credit to JellySquid for idea -+ int jx = (int) (j >> 38); -+ int jy = (int) ((j << 52) >> 52); -+ int jz = (int) ((j << 26) >> 38); -+ int ix = (int) (i >> 38); -+ int iy = (int) ((i << 52) >> 52); -+ int iz = (int) ((i << 26) >> 38); -+ int l = Integer.signum(jx - ix); -+ int i1 = Integer.signum(jy - iy); -+ int j1 = Integer.signum(jz - iz); -+ // Paper end - EnumDirection enumdirection = EnumDirection.a(l, i1, j1); - - if (enumdirection == null) { - return 15; - } else { - //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded -- IBlockData iblockdata = this.a(j, mutableint); -- -- if (mutableint.getValue() >= 15) { -+ IBlockData iblockdata = this.getBlockOptimized(jx, jy, jz, mutableint); // Paper -+ int blockedLight = mutableint.getValue(); // Paper -+ if (blockedLight >= 15) { // Paper - return 15; - } else { -- IBlockData iblockdata1 = this.a(i, (MutableInt) null); -+ IBlockData iblockdata1 = this.getBlockOptimized(ix, iy, iz); // Paper - VoxelShape voxelshape = this.a(iblockdata1, i, enumdirection); - VoxelShape voxelshape1 = this.a(iblockdata, j, enumdirection.opposite()); - -- return VoxelShapes.b(voxelshape, voxelshape1) ? 15 : k + Math.max(1, mutableint.getValue()); -+ return VoxelShapes.b(voxelshape, voxelshape1) ? 15 : k + Math.max(1, blockedLight); // Paper - } - } - } -@@ -0,0 +0,0 @@ public final class LightEngineBlock extends LightEngineLayer<LightEngineStorageB - - @Override - protected void a(long i, int j, boolean flag) { -- long k = SectionPosition.e(i); -+ // Paper start - reuse unpacking, credit to JellySquid (Didn't do full optimization though) -+ int x = (int) (i >> 38); -+ int y = (int) ((i << 52) >> 52); -+ int z = (int) ((i << 26) >> 38); -+ long k = SectionPosition.blockPosAsSectionLong(x, y, z); -+ // Paper end - EnumDirection[] aenumdirection = LightEngineBlock.e; - int l = aenumdirection.length; - - for (int i1 = 0; i1 < l; ++i1) { - EnumDirection enumdirection = aenumdirection[i1]; -- long j1 = BlockPosition.a(i, enumdirection); -- long k1 = SectionPosition.e(j1); -+ long j1 = BlockPosition.getAdjacent(x, y, z, enumdirection); // Paper -+ long k1 = SectionPosition.getAdjacentFromBlockPos(x, y, z, enumdirection); // Paper - - if (k == k1 || ((LightEngineStorageBlock) this.c).g(k1)) { - this.b(i, j1, j, flag); -@@ -0,0 +0,0 @@ public final class LightEngineBlock extends LightEngineLayer<LightEngineStorageB - } - } - -- long j1 = SectionPosition.e(i); -- NibbleArray nibblearray = ((LightEngineStorageBlock) this.c).a(j1, true); -+ // Paper start -+ int baseX = (int) (i >> 38); -+ int baseY = (int) ((i << 52) >> 52); -+ int baseZ = (int) ((i << 26) >> 38); -+ long j1 = SectionPosition.blockPosAsSectionLong(baseX, baseY, baseZ); -+ NibbleArray nibblearray = this.c.updating.getUpdatingOptimized(j1); -+ // Paper end - EnumDirection[] aenumdirection = LightEngineBlock.e; - int k1 = aenumdirection.length; - - for (int l1 = 0; l1 < k1; ++l1) { - EnumDirection enumdirection = aenumdirection[l1]; -- long i2 = BlockPosition.a(i, enumdirection); -+ // Paper start -+ int newX = baseX + enumdirection.getAdjacentX(); -+ int newY = baseY + enumdirection.getAdjacentY(); -+ int newZ = baseZ + enumdirection.getAdjacentZ(); -+ long i2 = BlockPosition.asLong(newX, newY, newZ); - - if (i2 != j) { -- long j2 = SectionPosition.e(i2); -+ long j2 = SectionPosition.blockPosAsSectionLong(newX, newY, newZ); -+ // Paper end - NibbleArray nibblearray1; - - if (j1 == j2) { - nibblearray1 = nibblearray; - } else { -- nibblearray1 = ((LightEngineStorageBlock) this.c).a(j2, true); -+ nibblearray1 = ((LightEngineStorageBlock) this.c).updating.getUpdatingOptimized(j2); // Paper - } - - if (nibblearray1 != null) { -- int k2 = this.b(i2, i, this.a(nibblearray1, i2)); -+ int k2 = this.b(i2, i, this.getNibbleLightInverse(nibblearray1, newX, newY, newZ)); // Paper - - if (l > k2) { - l = k2; -diff --git a/src/main/java/net/minecraft/server/LightEngineGraphSection.java b/src/main/java/net/minecraft/server/LightEngineGraphSection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineGraphSection.java -+++ b/src/main/java/net/minecraft/server/LightEngineGraphSection.java +--- a/src/main/java/net/minecraft/server/level/LightEngineGraphSection.java ++++ b/src/main/java/net/minecraft/server/level/LightEngineGraphSection.java @@ -0,0 +0,0 @@ public abstract class LightEngineGraphSection extends LightEngineGraph { @Override @@ -210,828 +82,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (l1 == i) { l1 = Long.MAX_VALUE; -diff --git a/src/main/java/net/minecraft/server/LightEngineLayer.java b/src/main/java/net/minecraft/server/LightEngineLayer.java +diff --git a/src/main/java/net/minecraft/server/level/LightEngineThreaded.java b/src/main/java/net/minecraft/server/level/LightEngineThreaded.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineLayer.java -+++ b/src/main/java/net/minecraft/server/LightEngineLayer.java -@@ -0,0 +0,0 @@ public abstract class LightEngineLayer<M extends LightEngineStorageArray<M>, S e - protected final EnumSkyBlock b; - protected final S c; - private boolean f; -- protected final BlockPosition.MutableBlockPosition d = new BlockPosition.MutableBlockPosition(); -+ protected final BlockPosition.MutableBlockPosition d = new BlockPosition.MutableBlockPosition(); protected final BlockPosition.MutableBlockPosition pos = d; // Paper - private final long[] g = new long[2]; -- private final IBlockAccess[] h = new IBlockAccess[2]; -+ private final IChunkAccess[] h = new IChunkAccess[2]; // Paper - -+ // Paper start - see fully commented out method below (look for Bedrock) -+ // optimized method with less branching for when scenarios arent needed. -+ // avoid using mutable version if can -+ protected final IBlockData getBlockOptimized(int x, int y, int z, MutableInt mutableint) { -+ IChunkAccess iblockaccess = this.a(x >> 4, z >> 4); -+ -+ if (iblockaccess == null) { -+ mutableint.setValue(16); -+ return Blocks.BEDROCK.getBlockData(); -+ } else { -+ this.pos.setValues(x, y, z); -+ IBlockData iblockdata = iblockaccess.getType(x, y, z); -+ mutableint.setValue(iblockdata.b(this.a.getWorld(), this.pos)); -+ return iblockdata.l() && iblockdata.e() ? iblockdata : Blocks.AIR.getBlockData(); -+ } -+ } -+ protected final IBlockData getBlockOptimized(int x, int y, int z) { -+ IChunkAccess iblockaccess = this.a(x >> 4, z >> 4); -+ -+ if (iblockaccess == null) { -+ return Blocks.BEDROCK.getBlockData(); -+ } else { -+ IBlockData iblockdata = iblockaccess.getType(x, y, z); -+ return iblockdata.l() && iblockdata.e() ? iblockdata : Blocks.AIR.getBlockData(); -+ } -+ } -+ // Paper end - public LightEngineLayer(ILightAccess ilightaccess, EnumSkyBlock enumskyblock, S s0) { - super(16, 256, 8192); - this.a = ilightaccess; -@@ -0,0 +0,0 @@ public abstract class LightEngineLayer<M extends LightEngineStorageArray<M>, S e - } - - @Nullable -- private IBlockAccess a(int i, int j) { -+ private IChunkAccess a(int i, int j) { // Paper - long k = ChunkCoordIntPair.pair(i, j); - - for (int l = 0; l < 2; ++l) { -@@ -0,0 +0,0 @@ public abstract class LightEngineLayer<M extends LightEngineStorageArray<M>, S e - } - } - -- IBlockAccess iblockaccess = this.a.c(i, j); -+ IChunkAccess iblockaccess = (IChunkAccess) this.a.c(i, j); // Paper - - for (int i1 = 1; i1 > 0; --i1) { - this.g[i1] = this.g[i1 - 1]; -@@ -0,0 +0,0 @@ public abstract class LightEngineLayer<M extends LightEngineStorageArray<M>, S e - Arrays.fill(this.h, (Object) null); - } - -- protected IBlockData a(long i, @Nullable MutableInt mutableint) { -- if (i == Long.MAX_VALUE) { -- if (mutableint != null) { -- mutableint.setValue(0); -- } -- -- return Blocks.AIR.getBlockData(); -- } else { -- int j = SectionPosition.a(BlockPosition.b(i)); -- int k = SectionPosition.a(BlockPosition.d(i)); -- IBlockAccess iblockaccess = this.a(j, k); -- -- if (iblockaccess == null) { -- if (mutableint != null) { -- mutableint.setValue(16); -- } -- -- return Blocks.BEDROCK.getBlockData(); -- } else { -- this.d.g(i); -- IBlockData iblockdata = iblockaccess.getType(this.d); -- boolean flag = iblockdata.l() && iblockdata.e(); -- -- if (mutableint != null) { -- mutableint.setValue(iblockdata.b(this.a.getWorld(), (BlockPosition) this.d)); -- } -- -- return flag ? iblockdata : Blocks.AIR.getBlockData(); -- } -- } -- } -+ // Paper start - comment out, see getBlockOptimized -+// protected IBlockData a(long i, @Nullable MutableInt mutableint) { -+// if (i == Long.MAX_VALUE) { -+// if (mutableint != null) { -+// mutableint.setValue(0); -+// } -+// -+// return Blocks.AIR.getBlockData(); -+// } else { -+// int j = SectionPosition.a(BlockPosition.b(i)); -+// int k = SectionPosition.a(BlockPosition.d(i)); -+// IBlockAccess iblockaccess = this.a(j, k); -+// -+// if (iblockaccess == null) { -+// if (mutableint != null) { -+// mutableint.setValue(16); -+// } -+// -+// return Blocks.BEDROCK.getBlockData(); -+// } else { -+// this.d.g(i); -+// IBlockData iblockdata = iblockaccess.getType(this.d); -+// boolean flag = iblockdata.l() && iblockdata.e(); -+// -+// if (mutableint != null) { -+// mutableint.setValue(iblockdata.b(this.a.getWorld(), (BlockPosition) this.d)); -+// } -+// -+// return flag ? iblockdata : Blocks.AIR.getBlockData(); -+// } -+// } -+// } -+ // Paper end - - protected VoxelShape a(IBlockData iblockdata, long i, EnumDirection enumdirection) { - return iblockdata.l() ? iblockdata.a(this.a.getWorld(), this.d.g(i), enumdirection) : VoxelShapes.a(); -@@ -0,0 +0,0 @@ public abstract class LightEngineLayer<M extends LightEngineStorageArray<M>, S e - return i == Long.MAX_VALUE ? 0 : 15 - this.c.i(i); - } - -+ protected int getNibbleLightInverse(NibbleArray nibblearray, int x, int y, int z) { return 15 - nibblearray.a(x & 15, y & 15, z & 15); } // Paper - x/y/z version of below - protected int a(NibbleArray nibblearray, long i) { -- return 15 - nibblearray.a(SectionPosition.b(BlockPosition.b(i)), SectionPosition.b(BlockPosition.c(i)), SectionPosition.b(BlockPosition.d(i))); -+ return 15 - nibblearray.a((int) (i >> 38) & 15, (int) ((i << 52) >> 52) & 15, (int) ((i << 26) >> 38) & 15); // Paper - } - - @Override -diff --git a/src/main/java/net/minecraft/server/LightEngineSky.java b/src/main/java/net/minecraft/server/LightEngineSky.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineSky.java -+++ b/src/main/java/net/minecraft/server/LightEngineSky.java -@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky - return k; - } else { - //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded -- IBlockData iblockdata = this.a(j, mutableint); -- -- if (mutableint.getValue() >= 15) { -+ // Paper start - use x/y/z and optimized block lookup -+ int jx = (int) (j >> 38); -+ int jy = (int) ((j << 52) >> 52); -+ int jz = (int) ((j << 26) >> 38); -+ IBlockData iblockdata = this.getBlockOptimized(jx, jy, jz, mutableint); -+ int blockedLight = mutableint.getValue(); -+ if (blockedLight >= 15) { -+ // Paper end - return 15; - } else { -- int l = BlockPosition.b(i); -- int i1 = BlockPosition.c(i); -- int j1 = BlockPosition.d(i); -- int k1 = BlockPosition.b(j); -- int l1 = BlockPosition.c(j); -- int i2 = BlockPosition.d(j); -- boolean flag = l == k1 && j1 == i2; -- int j2 = Integer.signum(k1 - l); -- int k2 = Integer.signum(l1 - i1); -- int l2 = Integer.signum(i2 - j1); -+ // Paper start - inline math -+ int ix = (int) (i >> 38); -+ int iy = (int) ((i << 52) >> 52); -+ int iz = (int) ((i << 26) >> 38); -+ boolean flag = ix == jx && iz == jz; -+ int j2 = Integer.signum(jx - ix); -+ int k2 = Integer.signum(jy - iy); -+ int l2 = Integer.signum(jz - iz); -+ // Paper end - EnumDirection enumdirection; - - if (i == Long.MAX_VALUE) { -@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky - enumdirection = EnumDirection.a(j2, k2, l2); - } - -- IBlockData iblockdata1 = this.a(i, (MutableInt) null); -+ IBlockData iblockdata1 = i == Long.MAX_VALUE ? Blocks.AIR.getBlockData() : this.getBlockOptimized(ix, iy, iz); // Paper - VoxelShape voxelshape; - - if (enumdirection != null) { -@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky - } - } - -- boolean flag1 = i == Long.MAX_VALUE || flag && i1 > l1; -+ boolean flag1 = i == Long.MAX_VALUE || flag && iy > jy; // Paper rename vars to iy > jy - -- return flag1 && k == 0 && mutableint.getValue() == 0 ? 0 : k + Math.max(1, mutableint.getValue()); -+ return flag1 && k == 0 && blockedLight == 0 ? 0 : k + Math.max(1, blockedLight); // Paper - } - } - } -@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky - - @Override - protected void a(long i, int j, boolean flag) { -- long k = SectionPosition.e(i); -- int l = BlockPosition.c(i); -- int i1 = SectionPosition.b(l); -- int j1 = SectionPosition.a(l); -+ // Paper start -+ int baseX = (int) (i >> 38); -+ int baseY = (int) ((i << 52) >> 52); -+ int baseZ = (int) ((i << 26) >> 38); -+ long k = SectionPosition.blockPosAsSectionLong(baseX, baseY, baseZ); -+ int i1 = baseY & 15; -+ int j1 = baseY >> 4; -+ // Paper end - int k1; - - if (i1 != 0) { -@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky - k1 = l1; - } - -- long i2 = BlockPosition.a(i, 0, -1 - k1 * 16, 0); -- long j2 = SectionPosition.e(i2); -+ int newBaseY = baseY + (-1 - k1 * 16); // Paper -+ long i2 = BlockPosition.asLong(baseX, newBaseY, baseZ); // Paper -+ long j2 = SectionPosition.blockPosAsSectionLong(baseX, newBaseY, baseZ); // Paper - - if (k == j2 || ((LightEngineStorageSky) this.c).g(j2)) { - this.b(i, i2, j, flag); - } - -- long k2 = BlockPosition.a(i, EnumDirection.UP); -- long l2 = SectionPosition.e(k2); -+ long k2 = BlockPosition.asLong(baseX, baseY + 1, baseZ); // Paper -+ long l2 = SectionPosition.blockPosAsSectionLong(baseX, baseY + 1, baseZ); // Paper - - if (k == l2 || ((LightEngineStorageSky) this.c).g(l2)) { - this.b(i, k2, j, flag); -@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky - int k3 = 0; - - while (true) { -- long l3 = BlockPosition.a(i, enumdirection.getAdjacentX(), -k3, enumdirection.getAdjacentZ()); -- long i4 = SectionPosition.e(l3); -+ long l3 = BlockPosition.asLong(baseX + enumdirection.getAdjacentX(), baseY - k3, baseZ + enumdirection.getAdjacentZ()); // Paper -+ long i4 = SectionPosition.blockPosAsSectionLong(baseX + enumdirection.getAdjacentX(), baseY - k3, baseZ + enumdirection.getAdjacentZ()); // Paper - - if (k == i4) { - this.b(i, l3, j, flag); -@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky - } - } - -- long j1 = SectionPosition.e(i); -- NibbleArray nibblearray = ((LightEngineStorageSky) this.c).a(j1, true); -+ // Paper start -+ int baseX = (int) (i >> 38); -+ int baseY = (int) ((i << 52) >> 52); -+ int baseZ = (int) ((i << 26) >> 38); -+ long j1 = SectionPosition.blockPosAsSectionLong(baseX, baseY, baseZ); -+ NibbleArray nibblearray = this.c.updating.getUpdatingOptimized(j1); -+ // Paper end - EnumDirection[] aenumdirection = LightEngineSky.e; - int k1 = aenumdirection.length; - - for (int l1 = 0; l1 < k1; ++l1) { - EnumDirection enumdirection = aenumdirection[l1]; -- long i2 = BlockPosition.a(i, enumdirection); -- long j2 = SectionPosition.e(i2); -+ // Paper start -+ int newX = baseX + enumdirection.getAdjacentX(); -+ int newY = baseY + enumdirection.getAdjacentY(); -+ int newZ = baseZ + enumdirection.getAdjacentZ(); -+ long i2 = BlockPosition.asLong(newX, newY, newZ); -+ long j2 = SectionPosition.blockPosAsSectionLong(newX, newY, newZ); -+ // Paper end - NibbleArray nibblearray1; - - if (j1 == j2) { - nibblearray1 = nibblearray; - } else { -- nibblearray1 = ((LightEngineStorageSky) this.c).a(j2, true); -+ nibblearray1 = ((LightEngineStorageSky) this.c).updating.getUpdatingOptimized(j2); // Paper - } - - if (nibblearray1 != null) { - if (i2 != j) { -- int k2 = this.b(i2, i, this.a(nibblearray1, i2)); -+ int k2 = this.b(i2, i, this.getNibbleLightInverse(nibblearray1, newX, newY, newZ)); // Paper - - if (l > k2) { - l = k2; -@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky - j2 = SectionPosition.a(j2, EnumDirection.UP); - } - -- NibbleArray nibblearray2 = ((LightEngineStorageSky) this.c).a(j2, true); -+ NibbleArray nibblearray2 = this.c.updating.getUpdatingOptimized(j2); // Paper - - if (i2 != j) { - int l2; -diff --git a/src/main/java/net/minecraft/server/LightEngineStorage.java b/src/main/java/net/minecraft/server/LightEngineStorage.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorage.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorage.java -@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e - protected final LongSet c = new LongOpenHashSet(); - protected final LongSet d = new LongOpenHashSet(); - protected volatile M e_visible; protected final Object visibleUpdateLock = new Object(); // Paper - diff on change, should be "visible" - force compile fail on usage change -- protected final M f; // Paper - diff on change, should be "updating" -+ protected final M f; protected final M updating; // Paper - diff on change, should be "updating" - protected final LongSet g = new LongOpenHashSet(); -- protected final LongSet h = new LongOpenHashSet(); -+ protected final LongSet h = new LongOpenHashSet(); LongSet dirty = h; // Paper - OBFHELPER - protected final Long2ObjectMap<NibbleArray> i = Long2ObjectMaps.synchronize(new Long2ObjectOpenHashMap()); - private final LongSet n = new LongOpenHashSet(); - private final LongSet o = new LongOpenHashSet(); -@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e - protected volatile boolean j; - - protected LightEngineStorage(EnumSkyBlock enumskyblock, ILightAccess ilightaccess, M m0) { -- super(3, 16, 256); -+ super(3, 256, 256); // Paper - bump expected size of level sets to improve collisions and reduce rehashing (seen a lot of it) - this.l = enumskyblock; - this.m = ilightaccess; -- this.f = m0; -+ this.f = m0; updating = m0; // Paper - this.e_visible = m0.b(); // Paper - avoid copying light data - this.e_visible.d(); // Paper - avoid copying light data - } - -- protected boolean g(long i) { -- return this.a(i, true) != null; -+ protected final boolean g(long i) { // Paper - final to help inlining -+ return this.updating.getUpdatingOptimized(i) != null; // Paper - inline to avoid branching - } - - @Nullable - protected NibbleArray a(long i, boolean flag) { - // Paper start - avoid copying light data - if (flag) { -- return this.a(this.f, i); -+ return this.updating.getUpdatingOptimized(i); - } else { - synchronized (this.visibleUpdateLock) { -- return this.a(this.e_visible, i); -+ return this.e_visible.lookup.apply(i); - } - } - // Paper end - avoid copying light data - } - - @Nullable -- protected NibbleArray a(M m0, long i) { -+ protected final NibbleArray a(M m0, long i) { // Paper - return m0.c(i); - } - -@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e - protected abstract int d(long i); - - protected int i(long i) { -- long j = SectionPosition.e(i); -- NibbleArray nibblearray = this.a(j, true); -+ // Paper start - reuse and inline math, use Optimized Updating path -+ final int x = (int) (i >> 38); -+ final int y = (int) ((i << 52) >> 52); -+ final int z = (int) ((i << 26) >> 38); -+ long j = SectionPosition.blockPosAsSectionLong(x, y, z); -+ NibbleArray nibblearray = this.updating.getUpdatingOptimized(j); -+ // BUG: Sometimes returns null and crashes, try to recover, but to prevent crash just return no light. -+ if (nibblearray == null) { -+ nibblearray = this.e_visible.lookup.apply(j); -+ } -+ if (nibblearray == null) { -+ System.err.println("Null nibble, preventing crash " + BlockPosition.fromLong(i)); -+ return 0; -+ } - -- return nibblearray.a(SectionPosition.b(BlockPosition.b(i)), SectionPosition.b(BlockPosition.c(i)), SectionPosition.b(BlockPosition.d(i))); -+ return nibblearray.a(x & 15, y & 15, z & 15); // Paper - inline operations -+ // Paper end - } - - protected void b(long i, int j) { -- long k = SectionPosition.e(i); -+ // Paper start - cache part of the math done in loop below -+ int x = (int) (i >> 38); -+ int y = (int) ((i << 52) >> 52); -+ int z = (int) ((i << 26) >> 38); -+ long k = SectionPosition.blockPosAsSectionLong(x, y, z); -+ // Paper end - - if (this.g.add(k)) { - this.f.a(k); - } - - NibbleArray nibblearray = this.a(k, true); -- -- nibblearray.a(SectionPosition.b(BlockPosition.b(i)), SectionPosition.b(BlockPosition.c(i)), SectionPosition.b(BlockPosition.d(i)), j); -- -- for (int l = -1; l <= 1; ++l) { -- for (int i1 = -1; i1 <= 1; ++i1) { -- for (int j1 = -1; j1 <= 1; ++j1) { -- this.h.add(SectionPosition.e(BlockPosition.a(i, i1, j1, l))); -+ nibblearray.a(x & 15, y & 15, z & 15, j); // Paper - use already calculated x/y/z -+ -+ // Paper start - credit to JellySquid for a major optimization here: -+ /* -+ * An extremely important optimization is made here in regards to adding items to the pending notification set. The -+ * original implementation attempts to add the coordinate of every chunk which contains a neighboring block position -+ * even though a huge number of loop iterations will simply map to block positions within the same updating chunk. -+ * -+ * Our implementation here avoids this by pre-calculating the min/max chunk coordinates so we can iterate over only -+ * the relevant chunk positions once. This reduces what would always be 27 iterations to just 1-8 iterations. -+ * -+ * @reason Use faster implementation -+ * @author JellySquid -+ */ -+ for (int z2 = (z - 1) >> 4; z2 <= (z + 1) >> 4; ++z2) { -+ for (int x2 = (x - 1) >> 4; x2 <= (x + 1) >> 4; ++x2) { -+ for (int y2 = (y - 1) >> 4; y2 <= (y + 1) >> 4; ++y2) { -+ this.dirty.add(SectionPosition.asLong(x2, y2, z2)); -+ // Paper end - } - } - } -@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e - } - - if (k >= 2 && j != 2) { -- if (this.p.contains(i)) { -- this.p.remove(i); -- } else { -+ if (!this.p.remove(i)) { // Paper - remove useless contains - credit to JellySquid -+ //this.p.remove(i); // Paper -+ //} else { // Paper - this.f.a(i, this.j(i)); - this.g.add(i); - this.k(i); - -- for (int l = -1; l <= 1; ++l) { -- for (int i1 = -1; i1 <= 1; ++i1) { -- for (int j1 = -1; j1 <= 1; ++j1) { -- this.h.add(SectionPosition.e(BlockPosition.a(i, i1, j1, l))); -+ // Paper start - reuse x/y/z and only notify valid chunks - Credit to JellySquid (See above method for notes) -+ int x = (int) (i >> 38); -+ int y = (int) ((i << 52) >> 52); -+ int z = (int) ((i << 26) >> 38); -+ -+ for (int z2 = (z - 1) >> 4; z2 <= (z + 1) >> 4; ++z2) { -+ for (int x2 = (x - 1) >> 4; x2 <= (x + 1) >> 4; ++x2) { -+ for (int y2 = (y - 1) >> 4; y2 <= (y + 1) >> 4; ++y2) { -+ this.dirty.add(SectionPosition.asLong(x2, y2, z2)); -+ // Paper end - } - } - } -@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e - return SectionPosition.e(j) == i; - }); - } else { -- int j = SectionPosition.c(SectionPosition.b(i)); -- int k = SectionPosition.c(SectionPosition.c(i)); -- int l = SectionPosition.c(SectionPosition.d(i)); -+ int j = (int) (i >> 42) << 4; // Paper - inline -+ int k = (int) (i << 44 >> 44) << 4; // Paper - inline -+ int l = (int) (i << 22 >> 42) << 4; // Paper - inline - - for (int i1 = 0; i1 < 16; ++i1) { - for (int j1 = 0; j1 < 16; ++j1) { -@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e - NibbleArray nibblearray; - - while (longiterator.hasNext()) { -- i = (Long) longiterator.next(); -+ i = longiterator.nextLong(); // Paper - this.a(lightenginelayer, i); - NibbleArray nibblearray1 = (NibbleArray) this.i.remove(i); - -@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e - longiterator = this.p.iterator(); - - while (longiterator.hasNext()) { -- i = (Long) longiterator.next(); -+ i = longiterator.nextLong(); // Paper - this.l(i); - } - -@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e - Entry entry; - long j; - -+ NibbleArray test = null; // Paper - while (objectiterator.hasNext()) { - entry = (Entry) objectiterator.next(); - j = entry.getLongKey(); -- if (this.g(j)) { -+ if ((test = this.updating.getUpdatingOptimized(j)) != null) { // Paper - dont look up nibble twice - nibblearray = (NibbleArray) entry.getValue(); -- if (this.f.c(j) != nibblearray) { -+ if (test != nibblearray) { // Paper - this.a(lightenginelayer, j); - this.f.a(j, nibblearray); - this.g.add(j); -@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e - longiterator = this.i.keySet().iterator(); - - while (longiterator.hasNext()) { -- i = (Long) longiterator.next(); -+ i = longiterator.nextLong(); // Paper - this.b(lightenginelayer, i); - } - } else { - longiterator = this.n.iterator(); - - while (longiterator.hasNext()) { -- i = (Long) longiterator.next(); -+ i = longiterator.nextLong(); // Paper - this.b(lightenginelayer, i); - } - } -@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e - - private void b(LightEngineLayer<M, ?> lightenginelayer, long i) { - if (this.g(i)) { -- int j = SectionPosition.c(SectionPosition.b(i)); -- int k = SectionPosition.c(SectionPosition.c(i)); -- int l = SectionPosition.c(SectionPosition.d(i)); -+ // Paper start -+ int secX = (int) (i >> 42); -+ int secY = (int) (i << 44 >> 44); -+ int secZ = (int) (i << 22 >> 42); -+ int j = secX << 4; // baseX -+ int k = secY << 4; // baseY -+ int l = secZ << 4; // baseZ -+ // Paper end - EnumDirection[] aenumdirection = LightEngineStorage.k; - int i1 = aenumdirection.length; - - for (int j1 = 0; j1 < i1; ++j1) { - EnumDirection enumdirection = aenumdirection[j1]; -- long k1 = SectionPosition.a(i, enumdirection); -+ long k1 = SectionPosition.getAdjacentFromSectionPos(secX, secY, secZ, enumdirection); // Paper - avoid extra unpacking - - if (!this.i.containsKey(k1) && this.g(k1)) { - for (int l1 = 0; l1 < 16; ++l1) { -diff --git a/src/main/java/net/minecraft/server/LightEngineStorageArray.java b/src/main/java/net/minecraft/server/LightEngineStorageArray.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorageArray.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorageArray.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; - - public abstract class LightEngineStorageArray<M extends LightEngineStorageArray<M>> { - -- private final long[] b = new long[2]; -- private final NibbleArray[] c = new NibbleArray[2]; -+ // private final long[] b = new long[2]; // Paper - unused -+ private final NibbleArray[] c = new NibbleArray[]{NibbleArray.EMPTY_NIBBLE_ARRAY, NibbleArray.EMPTY_NIBBLE_ARRAY}; private final NibbleArray[] cache = c; // Paper - OBFHELPER - private boolean d; - protected final com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object<NibbleArray> data; // Paper - avoid copying light data - protected final boolean isVisible; // Paper - avoid copying light data -- java.util.function.Function<Long, NibbleArray> lookup; // Paper - faster branchless lookup - -+ // Paper start - faster lookups with less branching, use interface to avoid boxing instead of Function -+ public final NibbleArrayAccess lookup; -+ public interface NibbleArrayAccess { -+ NibbleArray apply(long id); -+ } -+ // Paper end - // Paper start - avoid copying light data - protected LightEngineStorageArray(com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object<NibbleArray> data, boolean isVisible) { - if (isVisible) { -@@ -0,0 +0,0 @@ public abstract class LightEngineStorageArray<M extends LightEngineStorageArray< - } - this.data = data; - this.isVisible = isVisible; -+ // Paper end - avoid copying light data -+ // Paper start - faster lookups with less branching - if (isVisible) { - lookup = data::getVisibleAsync; - } else { -- lookup = data::getUpdating; -+ lookup = data.getUpdatingMap()::get; // jump straight the sub map - } -- // Paper end - avoid copying light data -+ // Paper end - this.c(); - this.d = true; - } -@@ -0,0 +0,0 @@ public abstract class LightEngineStorageArray<M extends LightEngineStorageArray< - public void a(long i) { - if (this.isVisible) { throw new IllegalStateException("writing to visible data"); } // Paper - avoid copying light data - NibbleArray updating = this.data.getUpdating(i); // Paper - pool nibbles -- this.data.queueUpdate(i, new NibbleArray().markPoolSafe(updating.getCloneIfSet())); // Paper - avoid copying light data - pool safe clone -+ NibbleArray nibblearray = new NibbleArray().markPoolSafe(updating.getCloneIfSet()); // Paper -+ nibblearray.lightCacheKey = i; // Paper -+ this.data.queueUpdate(i, nibblearray); // Paper - avoid copying light data - pool safe clone - if (updating.cleaner != null) MCUtil.scheduleTask(2, updating.cleaner, "Light Engine Release"); // Paper - delay clean incase anything holding ref was still using it - this.c(); - } -@@ -0,0 +0,0 @@ public abstract class LightEngineStorageArray<M extends LightEngineStorageArray< - return lookup.apply(i) != null; // Paper - avoid copying light data - } - -- @Nullable -- public final NibbleArray c(long i) { // Paper - final -- if (this.d) { -- for (int j = 0; j < 2; ++j) { -- if (i == this.b[j]) { -- return this.c[j]; -- } -- } -- } -- -- NibbleArray nibblearray = lookup.apply(i); // Paper - avoid copying light data -+ // Paper start - less branching as we know we are using cache and updating -+ public final NibbleArray getUpdatingOptimized(final long i) { // Paper - final -+ final NibbleArray[] cache = this.cache; -+ if (cache[0].lightCacheKey == i) return cache[0]; -+ if (cache[1].lightCacheKey == i) return cache[1]; - -+ final NibbleArray nibblearray = this.lookup.apply(i); // Paper - avoid copying light data - if (nibblearray == null) { - return null; - } else { -- if (this.d) { -- for (int k = 1; k > 0; --k) { -- this.b[k] = this.b[k - 1]; -- this.c[k] = this.c[k - 1]; -- } -- -- this.b[0] = i; -- this.c[0] = nibblearray; -- } -- -+ cache[1] = cache[0]; -+ cache[0] = nibblearray; - return nibblearray; - } - } -+ // Paper end -+ -+ @Nullable -+ public final NibbleArray c(final long i) { // Paper - final -+ // Paper start - optimize visible case or missed updating cases -+ if (this.d) { -+ // short circuit to optimized -+ return getUpdatingOptimized(i); -+ } -+ -+ return this.lookup.apply(i); -+ // Paper end -+ } - - @Nullable - public NibbleArray d(long i) { -@@ -0,0 +0,0 @@ public abstract class LightEngineStorageArray<M extends LightEngineStorageArray< - - public void a(long i, NibbleArray nibblearray) { - if (this.isVisible) { throw new IllegalStateException("writing to visible data"); } // Paper - avoid copying light data -+ nibblearray.lightCacheKey = i; // Paper - this.data.queueUpdate(i, nibblearray); // Paper - avoid copying light data - } - - public void c() { - for (int i = 0; i < 2; ++i) { -- this.b[i] = Long.MAX_VALUE; -- this.c[i] = null; -+ // this.b[i] = Long.MAX_VALUE; // Paper - Unused -+ this.c[i] = NibbleArray.EMPTY_NIBBLE_ARRAY; // Paper - } - } - -diff --git a/src/main/java/net/minecraft/server/LightEngineStorageBlock.java b/src/main/java/net/minecraft/server/LightEngineStorageBlock.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorageBlock.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorageBlock.java -@@ -0,0 +0,0 @@ public class LightEngineStorageBlock extends LightEngineStorage<LightEngineStora - - @Override - protected int d(long i) { -- long j = SectionPosition.e(i); -- NibbleArray nibblearray = this.a(j, false); -- -- return nibblearray == null ? 0 : nibblearray.a(SectionPosition.b(BlockPosition.b(i)), SectionPosition.b(BlockPosition.c(i)), SectionPosition.b(BlockPosition.d(i))); -+ // Paper start -+ int baseX = (int) (i >> 38); -+ int baseY = (int) ((i << 52) >> 52); -+ int baseZ = (int) ((i << 26) >> 38); -+ long j = (((long) (baseX >> 4) & 4194303L) << 42) | (((long) (baseY >> 4) & 1048575L)) | (((long) (baseZ >> 4) & 4194303L) << 20); -+ NibbleArray nibblearray = this.e_visible.lookup.apply(j); -+ return nibblearray == null ? 0 : nibblearray.a(baseX & 15, baseY & 15, baseZ & 15); -+ // Paper end - } - - public static final class a extends LightEngineStorageArray<LightEngineStorageBlock.a> { -diff --git a/src/main/java/net/minecraft/server/LightEngineStorageSky.java b/src/main/java/net/minecraft/server/LightEngineStorageSky.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorageSky.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorageSky.java -@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage - - @Override - protected int d(long i) { -- long j = SectionPosition.e(i); -+ // Paper start -+ int baseX = (int) (i >> 38); -+ int baseY = (int) ((i << 52) >> 52); -+ int baseZ = (int) ((i << 26) >> 38); -+ long j = SectionPosition.blockPosAsSectionLong(baseX, baseY, baseZ); -+ // Paper end - int k = SectionPosition.c(j); - synchronized (this.visibleUpdateLock) { // Paper - avoid copying light data - LightEngineStorageSky.a lightenginestoragesky_a = (LightEngineStorageSky.a) this.e_visible; // Paper - avoid copying light data - must be after lock acquire -@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage - } - } - -- return nibblearray.a(SectionPosition.b(BlockPosition.b(i)), SectionPosition.b(BlockPosition.c(i)), SectionPosition.b(BlockPosition.d(i))); -+ return nibblearray.a(baseX & 15, (int) ((i << 52) >> 52) & 15, (int) baseZ & 15); // Paper - y changed above - } else { - return 15; - } -@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage - if (k != ((LightEngineStorageSky.a) this.f).b && SectionPosition.c(j) < k) { - NibbleArray nibblearray1; - -- while ((nibblearray1 = this.a(j, true)) == null) { -+ while ((nibblearray1 = this.updating.getUpdatingOptimized(j)) == null) { // Paper - j = SectionPosition.a(j, EnumDirection.UP); - } - -@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage - longiterator = this.m.iterator(); - - while (longiterator.hasNext()) { -- i = (Long) longiterator.next(); -+ i = longiterator.nextLong(); // Paper -+ int baseX = (int) (i >> 42) << 4; // Paper -+ int baseY = (int) (i << 44 >> 44) << 4; // Paper -+ int baseZ = (int) (i << 22 >> 42) << 4; // Paper - j = this.c(i); - if (j != 2 && !this.n.contains(i) && this.l.add(i)) { - int l; -@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage - ((LightEngineStorageSky.a) this.f).a(i); - } - -- Arrays.fill(this.a(i, true).asBytesPoolSafe(), (byte) -1); // Paper -- k = SectionPosition.c(SectionPosition.b(i)); -- l = SectionPosition.c(SectionPosition.c(i)); -- int i1 = SectionPosition.c(SectionPosition.d(i)); -+ Arrays.fill(this.updating.getUpdatingOptimized(i).asBytesPoolSafe(), (byte) -1); // Paper - use optimized -+ k = baseX; // Paper -+ l = baseY; // Paper -+ int i1 = baseZ; // Paper - EnumDirection[] aenumdirection = LightEngineStorageSky.k; - int j1 = aenumdirection.length; - -@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage - for (int l1 = 0; l1 < j1; ++l1) { - EnumDirection enumdirection = aenumdirection[l1]; - -- k1 = SectionPosition.a(i, enumdirection); -+ k1 = SectionPosition.getAdjacentFromBlockPos(baseX, baseY, baseZ, enumdirection); // Paper - if ((this.n.contains(k1) || !this.l.contains(k1) && !this.m.contains(k1)) && this.g(k1)) { - for (int i2 = 0; i2 < 16; ++i2) { - for (int j2 = 0; j2 < 16; ++j2) { -@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage - - for (int i3 = 0; i3 < 16; ++i3) { - for (j1 = 0; j1 < 16; ++j1) { -- long j3 = BlockPosition.a(SectionPosition.c(SectionPosition.b(i)) + i3, SectionPosition.c(SectionPosition.c(i)), SectionPosition.c(SectionPosition.d(i)) + j1); -+ long j3 = BlockPosition.a(baseX + i3, baseY, baseZ + j1); // Paper - -- k1 = BlockPosition.a(SectionPosition.c(SectionPosition.b(i)) + i3, SectionPosition.c(SectionPosition.c(i)) - 1, SectionPosition.c(SectionPosition.d(i)) + j1); -+ k1 = BlockPosition.a(baseX + i3, baseY - 1, baseZ + j1); // Paper - lightenginelayer.a(j3, k1, lightenginelayer.b(j3, k1, 0), true); - } - } - } else { - for (k = 0; k < 16; ++k) { - for (l = 0; l < 16; ++l) { -- long k3 = BlockPosition.a(SectionPosition.c(SectionPosition.b(i)) + k, SectionPosition.c(SectionPosition.c(i)) + 16 - 1, SectionPosition.c(SectionPosition.d(i)) + l); -+ long k3 = BlockPosition.a(baseX + k, baseY + 16 - 1, baseZ + l); // Paper - - lightenginelayer.a(Long.MAX_VALUE, k3, 0, true); - } -@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage - longiterator = this.n.iterator(); - - while (longiterator.hasNext()) { -- i = (Long) longiterator.next(); -+ i = longiterator.nextLong(); // Paper -+ int baseX = (int) (i >> 42) << 4; // Paper -+ int baseY = (int) (i << 44 >> 44) << 4; // Paper -+ int baseZ = (int) (i << 22 >> 42) << 4; // Paper - if (this.l.remove(i) && this.g(i)) { - for (j = 0; j < 16; ++j) { - for (k = 0; k < 16; ++k) { -- long l3 = BlockPosition.a(SectionPosition.c(SectionPosition.b(i)) + j, SectionPosition.c(SectionPosition.c(i)) + 16 - 1, SectionPosition.c(SectionPosition.d(i)) + k); -+ long l3 = BlockPosition.a(baseX + j, baseY + 16 - 1, baseZ + k); // Paper - - lightenginelayer.a(Long.MAX_VALUE, l3, 15, false); - } -diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineThreaded.java -+++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java +--- a/src/main/java/net/minecraft/server/level/LightEngineThreaded.java ++++ b/src/main/java/net/minecraft/server/level/LightEngineThreaded.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.server.level; import com.mojang.datafixers.util.Pair; +import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; // Paper @@ -1310,28 +366,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public void a(int i) { -diff --git a/src/main/java/net/minecraft/server/NibbleArray.java b/src/main/java/net/minecraft/server/NibbleArray.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NibbleArray.java -+++ b/src/main/java/net/minecraft/server/NibbleArray.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; - public class NibbleArray { - - // Paper start -+ static final NibbleArray EMPTY_NIBBLE_ARRAY = new NibbleArray() { -+ @Override -+ public byte[] asBytes() { -+ throw new IllegalStateException(); -+ } -+ }; -+ long lightCacheKey = Long.MIN_VALUE; - public static byte[] EMPTY_NIBBLE = new byte[2048]; - private static final int nibbleBucketSizeMultiplier = Integer.getInteger("Paper.nibbleBucketSize", 3072); - private static final int maxPoolSize = Integer.getInteger("Paper.maxNibblePoolSize", (int) Math.min(6, Math.max(1, Runtime.getRuntime().maxMemory() / 1024 / 1024 / 1024)) * (nibbleBucketSizeMultiplier * 8)); -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { ioPriority = com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGH_PRIORITY; } @@ -1340,10 +378,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } if (getCurrentPriority() != priority) { this.u.a(this.location, this::getCurrentPriority, priority, this::setPriority); // use preferred priority -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } // Paper end @@ -1385,10 +423,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.p.close(); this.world.asyncChunkTaskManager.close(true); // Paper - Required since we're closing regionfiles in the next line this.m.close(); -diff --git a/src/main/java/net/minecraft/server/ThreadedMailbox.java b/src/main/java/net/minecraft/server/ThreadedMailbox.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ThreadedMailbox.java -+++ b/src/main/java/net/minecraft/server/ThreadedMailbox.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + } + gameprofilerfiller.exit(); + timings.chunkTicksBlocks.stopTiming(); // Paper ++ getChunkProvider().getLightEngine().queueUpdate(); // Paper + // Paper end + } + } +diff --git a/src/main/java/net/minecraft/util/thread/ThreadedMailbox.java b/src/main/java/net/minecraft/util/thread/ThreadedMailbox.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/util/thread/ThreadedMailbox.java ++++ b/src/main/java/net/minecraft/util/thread/ThreadedMailbox.java @@ -0,0 +0,0 @@ public class ThreadedMailbox<T> implements Mailbox<T>, AutoCloseable, Runnable { } @@ -1399,15 +449,965 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void a(T t0) { this.a.a(t0); this.f(); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java b/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { +--- a/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java ++++ b/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java +@@ -0,0 +0,0 @@ import net.minecraft.SystemUtils; + public class NibbleArray { + + // Paper start ++ static final NibbleArray EMPTY_NIBBLE_ARRAY = new NibbleArray() { ++ @Override ++ public byte[] asBytes() { ++ throw new IllegalStateException(); ++ } ++ }; ++ long lightCacheKey = Long.MIN_VALUE; + public static byte[] EMPTY_NIBBLE = new byte[2048]; + private static final int nibbleBucketSizeMultiplier = Integer.getInteger("Paper.nibbleBucketSize", 3072); + private static final int maxPoolSize = Integer.getInteger("Paper.maxNibblePoolSize", (int) Math.min(6, Math.max(1, Runtime.getRuntime().maxMemory() / 1024 / 1024 / 1024)) * (nibbleBucketSizeMultiplier * 8)); +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineBlock.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineBlock.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineBlock.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineBlock.java +@@ -0,0 +0,0 @@ public final class LightEngineBlock extends LightEngineLayer<LightEngineStorageB + } + + private int d(long i) { +- int j = BlockPosition.b(i); +- int k = BlockPosition.c(i); +- int l = BlockPosition.d(i); ++ // Paper start - inline math ++ int j = (int) (i >> 38); ++ int k = (int) ((i << 52) >> 52); ++ int l = (int) ((i << 26) >> 38); ++ // Paper end + IBlockAccess iblockaccess = this.a.c(j >> 4, l >> 4); + + return iblockaccess != null ? iblockaccess.g(this.f.d(j, k, l)) : 0; +@@ -0,0 +0,0 @@ public final class LightEngineBlock extends LightEngineLayer<LightEngineStorageB + } else if (k >= 15) { + return k; + } else { +- int l = Integer.signum(BlockPosition.b(j) - BlockPosition.b(i)); +- int i1 = Integer.signum(BlockPosition.c(j) - BlockPosition.c(i)); +- int j1 = Integer.signum(BlockPosition.d(j) - BlockPosition.d(i)); ++ // Paper start - reuse math - credit to JellySquid for idea ++ int jx = (int) (j >> 38); ++ int jy = (int) ((j << 52) >> 52); ++ int jz = (int) ((j << 26) >> 38); ++ int ix = (int) (i >> 38); ++ int iy = (int) ((i << 52) >> 52); ++ int iz = (int) ((i << 26) >> 38); ++ int l = Integer.signum(jx - ix); ++ int i1 = Integer.signum(jy - iy); ++ int j1 = Integer.signum(jz - iz); ++ // Paper end + EnumDirection enumdirection = EnumDirection.a(l, i1, j1); + + if (enumdirection == null) { + return 15; + } else { + //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded +- IBlockData iblockdata = this.a(j, mutableint); +- +- if (mutableint.getValue() >= 15) { ++ IBlockData iblockdata = this.getBlockOptimized(jx, jy, jz, mutableint); // Paper ++ int blockedLight = mutableint.getValue(); // Paper ++ if (blockedLight >= 15) { // Paper + return 15; + } else { +- IBlockData iblockdata1 = this.a(i, (MutableInt) null); ++ IBlockData iblockdata1 = this.getBlockOptimized(ix, iy, iz); // Paper + VoxelShape voxelshape = this.a(iblockdata1, i, enumdirection); + VoxelShape voxelshape1 = this.a(iblockdata, j, enumdirection.opposite()); + +- return VoxelShapes.b(voxelshape, voxelshape1) ? 15 : k + Math.max(1, mutableint.getValue()); ++ return VoxelShapes.b(voxelshape, voxelshape1) ? 15 : k + Math.max(1, blockedLight); // Paper + } } - gameprofilerfiller.exit(); - timings.chunkTicksBlocks.stopTiming(); // Paper -+ getChunkProvider().getLightEngine().queueUpdate(); // Paper - // Paper end + } +@@ -0,0 +0,0 @@ public final class LightEngineBlock extends LightEngineLayer<LightEngineStorageB + + @Override + protected void a(long i, int j, boolean flag) { +- long k = SectionPosition.e(i); ++ // Paper start - reuse unpacking, credit to JellySquid (Didn't do full optimization though) ++ int x = (int) (i >> 38); ++ int y = (int) ((i << 52) >> 52); ++ int z = (int) ((i << 26) >> 38); ++ long k = SectionPosition.blockPosAsSectionLong(x, y, z); ++ // Paper end + EnumDirection[] aenumdirection = LightEngineBlock.e; + int l = aenumdirection.length; + + for (int i1 = 0; i1 < l; ++i1) { + EnumDirection enumdirection = aenumdirection[i1]; +- long j1 = BlockPosition.a(i, enumdirection); +- long k1 = SectionPosition.e(j1); ++ long j1 = BlockPosition.getAdjacent(x, y, z, enumdirection); // Paper ++ long k1 = SectionPosition.getAdjacentFromBlockPos(x, y, z, enumdirection); // Paper + + if (k == k1 || ((LightEngineStorageBlock) this.c).g(k1)) { + this.b(i, j1, j, flag); +@@ -0,0 +0,0 @@ public final class LightEngineBlock extends LightEngineLayer<LightEngineStorageB + } + } + +- long j1 = SectionPosition.e(i); +- NibbleArray nibblearray = ((LightEngineStorageBlock) this.c).a(j1, true); ++ // Paper start ++ int baseX = (int) (i >> 38); ++ int baseY = (int) ((i << 52) >> 52); ++ int baseZ = (int) ((i << 26) >> 38); ++ long j1 = SectionPosition.blockPosAsSectionLong(baseX, baseY, baseZ); ++ NibbleArray nibblearray = this.c.updating.getUpdatingOptimized(j1); ++ // Paper end + EnumDirection[] aenumdirection = LightEngineBlock.e; + int k1 = aenumdirection.length; + + for (int l1 = 0; l1 < k1; ++l1) { + EnumDirection enumdirection = aenumdirection[l1]; +- long i2 = BlockPosition.a(i, enumdirection); ++ // Paper start ++ int newX = baseX + enumdirection.getAdjacentX(); ++ int newY = baseY + enumdirection.getAdjacentY(); ++ int newZ = baseZ + enumdirection.getAdjacentZ(); ++ long i2 = BlockPosition.asLong(newX, newY, newZ); + + if (i2 != j) { +- long j2 = SectionPosition.e(i2); ++ long j2 = SectionPosition.blockPosAsSectionLong(newX, newY, newZ); ++ // Paper end + NibbleArray nibblearray1; + + if (j1 == j2) { + nibblearray1 = nibblearray; + } else { +- nibblearray1 = ((LightEngineStorageBlock) this.c).a(j2, true); ++ nibblearray1 = ((LightEngineStorageBlock) this.c).updating.getUpdatingOptimized(j2); // Paper + } + + if (nibblearray1 != null) { +- int k2 = this.b(i2, i, this.a(nibblearray1, i2)); ++ int k2 = this.b(i2, i, this.getNibbleLightInverse(nibblearray1, newX, newY, newZ)); // Paper + + if (l > k2) { + l = k2; +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineLayer.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineLayer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineLayer.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineLayer.java +@@ -0,0 +0,0 @@ public abstract class LightEngineLayer<M extends LightEngineStorageArray<M>, S e + protected final EnumSkyBlock b; + protected final S c; + private boolean f; +- protected final BlockPosition.MutableBlockPosition d = new BlockPosition.MutableBlockPosition(); ++ protected final BlockPosition.MutableBlockPosition d = new BlockPosition.MutableBlockPosition(); protected final BlockPosition.MutableBlockPosition pos = d; // Paper + private final long[] g = new long[2]; +- private final IBlockAccess[] h = new IBlockAccess[2]; ++ private final IChunkAccess[] h = new IChunkAccess[2]; // Paper + ++ // Paper start - see fully commented out method below (look for Bedrock) ++ // optimized method with less branching for when scenarios arent needed. ++ // avoid using mutable version if can ++ protected final IBlockData getBlockOptimized(int x, int y, int z, MutableInt mutableint) { ++ IChunkAccess iblockaccess = this.a(x >> 4, z >> 4); ++ ++ if (iblockaccess == null) { ++ mutableint.setValue(16); ++ return Blocks.BEDROCK.getBlockData(); ++ } else { ++ this.pos.setValues(x, y, z); ++ IBlockData iblockdata = iblockaccess.getType(x, y, z); ++ mutableint.setValue(iblockdata.b(this.a.getWorld(), this.pos)); ++ return iblockdata.l() && iblockdata.e() ? iblockdata : Blocks.AIR.getBlockData(); ++ } ++ } ++ protected final IBlockData getBlockOptimized(int x, int y, int z) { ++ IChunkAccess iblockaccess = this.a(x >> 4, z >> 4); ++ ++ if (iblockaccess == null) { ++ return Blocks.BEDROCK.getBlockData(); ++ } else { ++ IBlockData iblockdata = iblockaccess.getType(x, y, z); ++ return iblockdata.l() && iblockdata.e() ? iblockdata : Blocks.AIR.getBlockData(); ++ } ++ } ++ // Paper end + public LightEngineLayer(ILightAccess ilightaccess, EnumSkyBlock enumskyblock, S s0) { + super(16, 256, 8192); + this.a = ilightaccess; +@@ -0,0 +0,0 @@ public abstract class LightEngineLayer<M extends LightEngineStorageArray<M>, S e + } + + @Nullable +- private IBlockAccess a(int i, int j) { ++ private IChunkAccess a(int i, int j) { // Paper + long k = ChunkCoordIntPair.pair(i, j); + + for (int l = 0; l < 2; ++l) { +@@ -0,0 +0,0 @@ public abstract class LightEngineLayer<M extends LightEngineStorageArray<M>, S e + } + } + +- IBlockAccess iblockaccess = this.a.c(i, j); ++ IChunkAccess iblockaccess = (IChunkAccess) this.a.c(i, j); // Paper + + for (int i1 = 1; i1 > 0; --i1) { + this.g[i1] = this.g[i1 - 1]; +@@ -0,0 +0,0 @@ public abstract class LightEngineLayer<M extends LightEngineStorageArray<M>, S e + Arrays.fill(this.h, (Object) null); + } + +- protected IBlockData a(long i, @Nullable MutableInt mutableint) { +- if (i == Long.MAX_VALUE) { +- if (mutableint != null) { +- mutableint.setValue(0); +- } +- +- return Blocks.AIR.getBlockData(); +- } else { +- int j = SectionPosition.a(BlockPosition.b(i)); +- int k = SectionPosition.a(BlockPosition.d(i)); +- IBlockAccess iblockaccess = this.a(j, k); +- +- if (iblockaccess == null) { +- if (mutableint != null) { +- mutableint.setValue(16); +- } +- +- return Blocks.BEDROCK.getBlockData(); +- } else { +- this.d.g(i); +- IBlockData iblockdata = iblockaccess.getType(this.d); +- boolean flag = iblockdata.l() && iblockdata.e(); +- +- if (mutableint != null) { +- mutableint.setValue(iblockdata.b(this.a.getWorld(), (BlockPosition) this.d)); +- } +- +- return flag ? iblockdata : Blocks.AIR.getBlockData(); +- } +- } +- } ++ // Paper start - comment out, see getBlockOptimized ++// protected IBlockData a(long i, @Nullable MutableInt mutableint) { ++// if (i == Long.MAX_VALUE) { ++// if (mutableint != null) { ++// mutableint.setValue(0); ++// } ++// ++// return Blocks.AIR.getBlockData(); ++// } else { ++// int j = SectionPosition.a(BlockPosition.b(i)); ++// int k = SectionPosition.a(BlockPosition.d(i)); ++// IBlockAccess iblockaccess = this.a(j, k); ++// ++// if (iblockaccess == null) { ++// if (mutableint != null) { ++// mutableint.setValue(16); ++// } ++// ++// return Blocks.BEDROCK.getBlockData(); ++// } else { ++// this.d.g(i); ++// IBlockData iblockdata = iblockaccess.getType(this.d); ++// boolean flag = iblockdata.l() && iblockdata.e(); ++// ++// if (mutableint != null) { ++// mutableint.setValue(iblockdata.b(this.a.getWorld(), (BlockPosition) this.d)); ++// } ++// ++// return flag ? iblockdata : Blocks.AIR.getBlockData(); ++// } ++// } ++// } ++ // Paper end + + protected VoxelShape a(IBlockData iblockdata, long i, EnumDirection enumdirection) { + return iblockdata.l() ? iblockdata.a(this.a.getWorld(), this.d.g(i), enumdirection) : VoxelShapes.a(); +@@ -0,0 +0,0 @@ public abstract class LightEngineLayer<M extends LightEngineStorageArray<M>, S e + return i == Long.MAX_VALUE ? 0 : 15 - this.c.i(i); + } + ++ protected int getNibbleLightInverse(NibbleArray nibblearray, int x, int y, int z) { return 15 - nibblearray.a(x & 15, y & 15, z & 15); } // Paper - x/y/z version of below + protected int a(NibbleArray nibblearray, long i) { +- return 15 - nibblearray.a(SectionPosition.b(BlockPosition.b(i)), SectionPosition.b(BlockPosition.c(i)), SectionPosition.b(BlockPosition.d(i))); ++ return 15 - nibblearray.a((int) (i >> 38) & 15, (int) ((i << 52) >> 52) & 15, (int) ((i << 26) >> 38) & 15); // Paper + } + + @Override +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java +@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky + return k; + } else { + //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded +- IBlockData iblockdata = this.a(j, mutableint); +- +- if (mutableint.getValue() >= 15) { ++ // Paper start - use x/y/z and optimized block lookup ++ int jx = (int) (j >> 38); ++ int jy = (int) ((j << 52) >> 52); ++ int jz = (int) ((j << 26) >> 38); ++ IBlockData iblockdata = this.getBlockOptimized(jx, jy, jz, mutableint); ++ int blockedLight = mutableint.getValue(); ++ if (blockedLight >= 15) { ++ // Paper end + return 15; + } else { +- int l = BlockPosition.b(i); +- int i1 = BlockPosition.c(i); +- int j1 = BlockPosition.d(i); +- int k1 = BlockPosition.b(j); +- int l1 = BlockPosition.c(j); +- int i2 = BlockPosition.d(j); +- boolean flag = l == k1 && j1 == i2; +- int j2 = Integer.signum(k1 - l); +- int k2 = Integer.signum(l1 - i1); +- int l2 = Integer.signum(i2 - j1); ++ // Paper start - inline math ++ int ix = (int) (i >> 38); ++ int iy = (int) ((i << 52) >> 52); ++ int iz = (int) ((i << 26) >> 38); ++ boolean flag = ix == jx && iz == jz; ++ int j2 = Integer.signum(jx - ix); ++ int k2 = Integer.signum(jy - iy); ++ int l2 = Integer.signum(jz - iz); ++ // Paper end + EnumDirection enumdirection; + + if (i == Long.MAX_VALUE) { +@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky + enumdirection = EnumDirection.a(j2, k2, l2); + } + +- IBlockData iblockdata1 = this.a(i, (MutableInt) null); ++ IBlockData iblockdata1 = i == Long.MAX_VALUE ? Blocks.AIR.getBlockData() : this.getBlockOptimized(ix, iy, iz); // Paper + VoxelShape voxelshape; + + if (enumdirection != null) { +@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky + } + } + +- boolean flag1 = i == Long.MAX_VALUE || flag && i1 > l1; ++ boolean flag1 = i == Long.MAX_VALUE || flag && iy > jy; // Paper rename vars to iy > jy + +- return flag1 && k == 0 && mutableint.getValue() == 0 ? 0 : k + Math.max(1, mutableint.getValue()); ++ return flag1 && k == 0 && blockedLight == 0 ? 0 : k + Math.max(1, blockedLight); // Paper + } + } + } +@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky + + @Override + protected void a(long i, int j, boolean flag) { +- long k = SectionPosition.e(i); +- int l = BlockPosition.c(i); +- int i1 = SectionPosition.b(l); +- int j1 = SectionPosition.a(l); ++ // Paper start ++ int baseX = (int) (i >> 38); ++ int baseY = (int) ((i << 52) >> 52); ++ int baseZ = (int) ((i << 26) >> 38); ++ long k = SectionPosition.blockPosAsSectionLong(baseX, baseY, baseZ); ++ int i1 = baseY & 15; ++ int j1 = baseY >> 4; ++ // Paper end + int k1; + + if (i1 != 0) { +@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky + k1 = l1; + } + +- long i2 = BlockPosition.a(i, 0, -1 - k1 * 16, 0); +- long j2 = SectionPosition.e(i2); ++ int newBaseY = baseY + (-1 - k1 * 16); // Paper ++ long i2 = BlockPosition.asLong(baseX, newBaseY, baseZ); // Paper ++ long j2 = SectionPosition.blockPosAsSectionLong(baseX, newBaseY, baseZ); // Paper + + if (k == j2 || ((LightEngineStorageSky) this.c).g(j2)) { + this.b(i, i2, j, flag); + } + +- long k2 = BlockPosition.a(i, EnumDirection.UP); +- long l2 = SectionPosition.e(k2); ++ long k2 = BlockPosition.asLong(baseX, baseY + 1, baseZ); // Paper ++ long l2 = SectionPosition.blockPosAsSectionLong(baseX, baseY + 1, baseZ); // Paper + + if (k == l2 || ((LightEngineStorageSky) this.c).g(l2)) { + this.b(i, k2, j, flag); +@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky + int k3 = 0; + + while (true) { +- long l3 = BlockPosition.a(i, enumdirection.getAdjacentX(), -k3, enumdirection.getAdjacentZ()); +- long i4 = SectionPosition.e(l3); ++ long l3 = BlockPosition.asLong(baseX + enumdirection.getAdjacentX(), baseY - k3, baseZ + enumdirection.getAdjacentZ()); // Paper ++ long i4 = SectionPosition.blockPosAsSectionLong(baseX + enumdirection.getAdjacentX(), baseY - k3, baseZ + enumdirection.getAdjacentZ()); // Paper + + if (k == i4) { + this.b(i, l3, j, flag); +@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky + } + } + +- long j1 = SectionPosition.e(i); +- NibbleArray nibblearray = ((LightEngineStorageSky) this.c).a(j1, true); ++ // Paper start ++ int baseX = (int) (i >> 38); ++ int baseY = (int) ((i << 52) >> 52); ++ int baseZ = (int) ((i << 26) >> 38); ++ long j1 = SectionPosition.blockPosAsSectionLong(baseX, baseY, baseZ); ++ NibbleArray nibblearray = this.c.updating.getUpdatingOptimized(j1); ++ // Paper end + EnumDirection[] aenumdirection = LightEngineSky.e; + int k1 = aenumdirection.length; + + for (int l1 = 0; l1 < k1; ++l1) { + EnumDirection enumdirection = aenumdirection[l1]; +- long i2 = BlockPosition.a(i, enumdirection); +- long j2 = SectionPosition.e(i2); ++ // Paper start ++ int newX = baseX + enumdirection.getAdjacentX(); ++ int newY = baseY + enumdirection.getAdjacentY(); ++ int newZ = baseZ + enumdirection.getAdjacentZ(); ++ long i2 = BlockPosition.asLong(newX, newY, newZ); ++ long j2 = SectionPosition.blockPosAsSectionLong(newX, newY, newZ); ++ // Paper end + NibbleArray nibblearray1; + + if (j1 == j2) { + nibblearray1 = nibblearray; + } else { +- nibblearray1 = ((LightEngineStorageSky) this.c).a(j2, true); ++ nibblearray1 = ((LightEngineStorageSky) this.c).updating.getUpdatingOptimized(j2); // Paper + } + + if (nibblearray1 != null) { + if (i2 != j) { +- int k2 = this.b(i2, i, this.a(nibblearray1, i2)); ++ int k2 = this.b(i2, i, this.getNibbleLightInverse(nibblearray1, newX, newY, newZ)); // Paper + + if (l > k2) { + l = k2; +@@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky + j2 = SectionPosition.a(j2, EnumDirection.UP); + } + +- NibbleArray nibblearray2 = ((LightEngineStorageSky) this.c).a(j2, true); ++ NibbleArray nibblearray2 = this.c.updating.getUpdatingOptimized(j2); // Paper + + if (i2 != j) { + int l2; +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java +@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e + protected final LongSet c = new LongOpenHashSet(); + protected final LongSet d = new LongOpenHashSet(); + protected volatile M e_visible; protected final Object visibleUpdateLock = new Object(); // Paper - diff on change, should be "visible" - force compile fail on usage change +- protected final M f; // Paper - diff on change, should be "updating" ++ protected final M f; protected final M updating; // Paper - diff on change, should be "updating" + protected final LongSet g = new LongOpenHashSet(); +- protected final LongSet h = new LongOpenHashSet(); ++ protected final LongSet h = new LongOpenHashSet(); LongSet dirty = h; // Paper - OBFHELPER + protected final Long2ObjectMap<NibbleArray> i = Long2ObjectMaps.synchronize(new Long2ObjectOpenHashMap()); + private final LongSet n = new LongOpenHashSet(); + private final LongSet o = new LongOpenHashSet(); +@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e + protected volatile boolean j; + + protected LightEngineStorage(EnumSkyBlock enumskyblock, ILightAccess ilightaccess, M m0) { +- super(3, 16, 256); ++ super(3, 256, 256); // Paper - bump expected size of level sets to improve collisions and reduce rehashing (seen a lot of it) + this.l = enumskyblock; + this.m = ilightaccess; +- this.f = m0; ++ this.f = m0; updating = m0; // Paper + this.e_visible = m0.b(); // Paper - avoid copying light data + this.e_visible.d(); // Paper - avoid copying light data + } + +- protected boolean g(long i) { +- return this.a(i, true) != null; ++ protected final boolean g(long i) { // Paper - final to help inlining ++ return this.updating.getUpdatingOptimized(i) != null; // Paper - inline to avoid branching + } + + @Nullable + protected NibbleArray a(long i, boolean flag) { + // Paper start - avoid copying light data + if (flag) { +- return this.a(this.f, i); ++ return this.updating.getUpdatingOptimized(i); + } else { + synchronized (this.visibleUpdateLock) { +- return this.a(this.e_visible, i); ++ return this.e_visible.lookup.apply(i); + } + } + // Paper end - avoid copying light data + } + + @Nullable +- protected NibbleArray a(M m0, long i) { ++ protected final NibbleArray a(M m0, long i) { // Paper + return m0.c(i); + } + +@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e + protected abstract int d(long i); + + protected int i(long i) { +- long j = SectionPosition.e(i); +- NibbleArray nibblearray = this.a(j, true); ++ // Paper start - reuse and inline math, use Optimized Updating path ++ final int x = (int) (i >> 38); ++ final int y = (int) ((i << 52) >> 52); ++ final int z = (int) ((i << 26) >> 38); ++ long j = SectionPosition.blockPosAsSectionLong(x, y, z); ++ NibbleArray nibblearray = this.updating.getUpdatingOptimized(j); ++ // BUG: Sometimes returns null and crashes, try to recover, but to prevent crash just return no light. ++ if (nibblearray == null) { ++ nibblearray = this.e_visible.lookup.apply(j); ++ } ++ if (nibblearray == null) { ++ System.err.println("Null nibble, preventing crash " + BlockPosition.fromLong(i)); ++ return 0; ++ } + +- return nibblearray.a(SectionPosition.b(BlockPosition.b(i)), SectionPosition.b(BlockPosition.c(i)), SectionPosition.b(BlockPosition.d(i))); ++ return nibblearray.a(x & 15, y & 15, z & 15); // Paper - inline operations ++ // Paper end + } + + protected void b(long i, int j) { +- long k = SectionPosition.e(i); ++ // Paper start - cache part of the math done in loop below ++ int x = (int) (i >> 38); ++ int y = (int) ((i << 52) >> 52); ++ int z = (int) ((i << 26) >> 38); ++ long k = SectionPosition.blockPosAsSectionLong(x, y, z); ++ // Paper end + + if (this.g.add(k)) { + this.f.a(k); + } + + NibbleArray nibblearray = this.a(k, true); +- +- nibblearray.a(SectionPosition.b(BlockPosition.b(i)), SectionPosition.b(BlockPosition.c(i)), SectionPosition.b(BlockPosition.d(i)), j); +- +- for (int l = -1; l <= 1; ++l) { +- for (int i1 = -1; i1 <= 1; ++i1) { +- for (int j1 = -1; j1 <= 1; ++j1) { +- this.h.add(SectionPosition.e(BlockPosition.a(i, i1, j1, l))); ++ nibblearray.a(x & 15, y & 15, z & 15, j); // Paper - use already calculated x/y/z ++ ++ // Paper start - credit to JellySquid for a major optimization here: ++ /* ++ * An extremely important optimization is made here in regards to adding items to the pending notification set. The ++ * original implementation attempts to add the coordinate of every chunk which contains a neighboring block position ++ * even though a huge number of loop iterations will simply map to block positions within the same updating chunk. ++ * ++ * Our implementation here avoids this by pre-calculating the min/max chunk coordinates so we can iterate over only ++ * the relevant chunk positions once. This reduces what would always be 27 iterations to just 1-8 iterations. ++ * ++ * @reason Use faster implementation ++ * @author JellySquid ++ */ ++ for (int z2 = (z - 1) >> 4; z2 <= (z + 1) >> 4; ++z2) { ++ for (int x2 = (x - 1) >> 4; x2 <= (x + 1) >> 4; ++x2) { ++ for (int y2 = (y - 1) >> 4; y2 <= (y + 1) >> 4; ++y2) { ++ this.dirty.add(SectionPosition.asLong(x2, y2, z2)); ++ // Paper end + } + } + } +@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e + } + + if (k >= 2 && j != 2) { +- if (this.p.contains(i)) { +- this.p.remove(i); +- } else { ++ if (!this.p.remove(i)) { // Paper - remove useless contains - credit to JellySquid ++ //this.p.remove(i); // Paper ++ //} else { // Paper + this.f.a(i, this.j(i)); + this.g.add(i); + this.k(i); + +- for (int l = -1; l <= 1; ++l) { +- for (int i1 = -1; i1 <= 1; ++i1) { +- for (int j1 = -1; j1 <= 1; ++j1) { +- this.h.add(SectionPosition.e(BlockPosition.a(i, i1, j1, l))); ++ // Paper start - reuse x/y/z and only notify valid chunks - Credit to JellySquid (See above method for notes) ++ int x = (int) (i >> 38); ++ int y = (int) ((i << 52) >> 52); ++ int z = (int) ((i << 26) >> 38); ++ ++ for (int z2 = (z - 1) >> 4; z2 <= (z + 1) >> 4; ++z2) { ++ for (int x2 = (x - 1) >> 4; x2 <= (x + 1) >> 4; ++x2) { ++ for (int y2 = (y - 1) >> 4; y2 <= (y + 1) >> 4; ++y2) { ++ this.dirty.add(SectionPosition.asLong(x2, y2, z2)); ++ // Paper end + } + } + } +@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e + return SectionPosition.e(j) == i; + }); + } else { +- int j = SectionPosition.c(SectionPosition.b(i)); +- int k = SectionPosition.c(SectionPosition.c(i)); +- int l = SectionPosition.c(SectionPosition.d(i)); ++ int j = (int) (i >> 42) << 4; // Paper - inline ++ int k = (int) (i << 44 >> 44) << 4; // Paper - inline ++ int l = (int) (i << 22 >> 42) << 4; // Paper - inline + + for (int i1 = 0; i1 < 16; ++i1) { + for (int j1 = 0; j1 < 16; ++j1) { +@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e + NibbleArray nibblearray; + + while (longiterator.hasNext()) { +- i = (Long) longiterator.next(); ++ i = longiterator.nextLong(); // Paper + this.a(lightenginelayer, i); + NibbleArray nibblearray1 = (NibbleArray) this.i.remove(i); + +@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e + longiterator = this.p.iterator(); + + while (longiterator.hasNext()) { +- i = (Long) longiterator.next(); ++ i = longiterator.nextLong(); // Paper + this.l(i); + } + +@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e + Entry entry; + long j; + ++ NibbleArray test = null; // Paper + while (objectiterator.hasNext()) { + entry = (Entry) objectiterator.next(); + j = entry.getLongKey(); +- if (this.g(j)) { ++ if ((test = this.updating.getUpdatingOptimized(j)) != null) { // Paper - dont look up nibble twice + nibblearray = (NibbleArray) entry.getValue(); +- if (this.f.c(j) != nibblearray) { ++ if (test != nibblearray) { // Paper + this.a(lightenginelayer, j); + this.f.a(j, nibblearray); + this.g.add(j); +@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e + longiterator = this.i.keySet().iterator(); + + while (longiterator.hasNext()) { +- i = (Long) longiterator.next(); ++ i = longiterator.nextLong(); // Paper + this.b(lightenginelayer, i); + } + } else { + longiterator = this.n.iterator(); + + while (longiterator.hasNext()) { +- i = (Long) longiterator.next(); ++ i = longiterator.nextLong(); // Paper + this.b(lightenginelayer, i); + } + } +@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e + + private void b(LightEngineLayer<M, ?> lightenginelayer, long i) { + if (this.g(i)) { +- int j = SectionPosition.c(SectionPosition.b(i)); +- int k = SectionPosition.c(SectionPosition.c(i)); +- int l = SectionPosition.c(SectionPosition.d(i)); ++ // Paper start ++ int secX = (int) (i >> 42); ++ int secY = (int) (i << 44 >> 44); ++ int secZ = (int) (i << 22 >> 42); ++ int j = secX << 4; // baseX ++ int k = secY << 4; // baseY ++ int l = secZ << 4; // baseZ ++ // Paper end + EnumDirection[] aenumdirection = LightEngineStorage.k; + int i1 = aenumdirection.length; + + for (int j1 = 0; j1 < i1; ++j1) { + EnumDirection enumdirection = aenumdirection[j1]; +- long k1 = SectionPosition.a(i, enumdirection); ++ long k1 = SectionPosition.getAdjacentFromSectionPos(secX, secY, secZ, enumdirection); // Paper - avoid extra unpacking + + if (!this.i.containsKey(k1) && this.g(k1)) { + for (int l1 = 0; l1 < 16; ++l1) { +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.chunk.NibbleArray; + + public abstract class LightEngineStorageArray<M extends LightEngineStorageArray<M>> { + +- private final long[] b = new long[2]; +- private final NibbleArray[] c = new NibbleArray[2]; ++ // private final long[] b = new long[2]; // Paper - unused ++ private final NibbleArray[] c = new NibbleArray[]{NibbleArray.EMPTY_NIBBLE_ARRAY, NibbleArray.EMPTY_NIBBLE_ARRAY}; private final NibbleArray[] cache = c; // Paper - OBFHELPER + private boolean d; + protected final com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object<NibbleArray> data; // Paper - avoid copying light data + protected final boolean isVisible; // Paper - avoid copying light data +- java.util.function.Function<Long, NibbleArray> lookup; // Paper - faster branchless lookup + ++ // Paper start - faster lookups with less branching, use interface to avoid boxing instead of Function ++ public final NibbleArrayAccess lookup; ++ public interface NibbleArrayAccess { ++ NibbleArray apply(long id); ++ } ++ // Paper end + // Paper start - avoid copying light data + protected LightEngineStorageArray(com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object<NibbleArray> data, boolean isVisible) { + if (isVisible) { +@@ -0,0 +0,0 @@ public abstract class LightEngineStorageArray<M extends LightEngineStorageArray< + } + this.data = data; + this.isVisible = isVisible; ++ // Paper end - avoid copying light data ++ // Paper start - faster lookups with less branching + if (isVisible) { + lookup = data::getVisibleAsync; + } else { +- lookup = data::getUpdating; ++ lookup = data.getUpdatingMap()::get; // jump straight the sub map + } +- // Paper end - avoid copying light data ++ // Paper end + this.c(); + this.d = true; + } +@@ -0,0 +0,0 @@ public abstract class LightEngineStorageArray<M extends LightEngineStorageArray< + public void a(long i) { + if (this.isVisible) { throw new IllegalStateException("writing to visible data"); } // Paper - avoid copying light data + NibbleArray updating = this.data.getUpdating(i); // Paper - pool nibbles +- this.data.queueUpdate(i, new NibbleArray().markPoolSafe(updating.getCloneIfSet())); // Paper - avoid copying light data - pool safe clone ++ NibbleArray nibblearray = new NibbleArray().markPoolSafe(updating.getCloneIfSet()); // Paper ++ nibblearray.lightCacheKey = i; // Paper ++ this.data.queueUpdate(i, nibblearray); // Paper - avoid copying light data - pool safe clone + if (updating.cleaner != null) MCUtil.scheduleTask(2, updating.cleaner, "Light Engine Release"); // Paper - delay clean incase anything holding ref was still using it + this.c(); + } +@@ -0,0 +0,0 @@ public abstract class LightEngineStorageArray<M extends LightEngineStorageArray< + return lookup.apply(i) != null; // Paper - avoid copying light data + } + +- @Nullable +- public final NibbleArray c(long i) { // Paper - final +- if (this.d) { +- for (int j = 0; j < 2; ++j) { +- if (i == this.b[j]) { +- return this.c[j]; +- } +- } +- } +- +- NibbleArray nibblearray = lookup.apply(i); // Paper - avoid copying light data ++ // Paper start - less branching as we know we are using cache and updating ++ public final NibbleArray getUpdatingOptimized(final long i) { // Paper - final ++ final NibbleArray[] cache = this.cache; ++ if (cache[0].lightCacheKey == i) return cache[0]; ++ if (cache[1].lightCacheKey == i) return cache[1]; + ++ final NibbleArray nibblearray = this.lookup.apply(i); // Paper - avoid copying light data + if (nibblearray == null) { + return null; + } else { +- if (this.d) { +- for (int k = 1; k > 0; --k) { +- this.b[k] = this.b[k - 1]; +- this.c[k] = this.c[k - 1]; +- } +- +- this.b[0] = i; +- this.c[0] = nibblearray; +- } +- ++ cache[1] = cache[0]; ++ cache[0] = nibblearray; + return nibblearray; } } ++ // Paper end ++ ++ @Nullable ++ public final NibbleArray c(final long i) { // Paper - final ++ // Paper start - optimize visible case or missed updating cases ++ if (this.d) { ++ // short circuit to optimized ++ return getUpdatingOptimized(i); ++ } ++ ++ return this.lookup.apply(i); ++ // Paper end ++ } + + @Nullable + public NibbleArray d(long i) { +@@ -0,0 +0,0 @@ public abstract class LightEngineStorageArray<M extends LightEngineStorageArray< + + public void a(long i, NibbleArray nibblearray) { + if (this.isVisible) { throw new IllegalStateException("writing to visible data"); } // Paper - avoid copying light data ++ nibblearray.lightCacheKey = i; // Paper + this.data.queueUpdate(i, nibblearray); // Paper - avoid copying light data + } + + public void c() { + for (int i = 0; i < 2; ++i) { +- this.b[i] = Long.MAX_VALUE; +- this.c[i] = null; ++ // this.b[i] = Long.MAX_VALUE; // Paper - Unused ++ this.c[i] = NibbleArray.EMPTY_NIBBLE_ARRAY; // Paper + } + } + +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageBlock.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageBlock.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageBlock.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageBlock.java +@@ -0,0 +0,0 @@ public class LightEngineStorageBlock extends LightEngineStorage<LightEngineStora + + @Override + protected int d(long i) { +- long j = SectionPosition.e(i); +- NibbleArray nibblearray = this.a(j, false); +- +- return nibblearray == null ? 0 : nibblearray.a(SectionPosition.b(BlockPosition.b(i)), SectionPosition.b(BlockPosition.c(i)), SectionPosition.b(BlockPosition.d(i))); ++ // Paper start ++ int baseX = (int) (i >> 38); ++ int baseY = (int) ((i << 52) >> 52); ++ int baseZ = (int) ((i << 26) >> 38); ++ long j = (((long) (baseX >> 4) & 4194303L) << 42) | (((long) (baseY >> 4) & 1048575L)) | (((long) (baseZ >> 4) & 4194303L) << 20); ++ NibbleArray nibblearray = this.e_visible.lookup.apply(j); ++ return nibblearray == null ? 0 : nibblearray.a(baseX & 15, baseY & 15, baseZ & 15); ++ // Paper end + } + + public static final class a extends LightEngineStorageArray<LightEngineStorageBlock.a> { +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java +@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage + + @Override + protected int d(long i) { +- long j = SectionPosition.e(i); ++ // Paper start ++ int baseX = (int) (i >> 38); ++ int baseY = (int) ((i << 52) >> 52); ++ int baseZ = (int) ((i << 26) >> 38); ++ long j = SectionPosition.blockPosAsSectionLong(baseX, baseY, baseZ); ++ // Paper end + int k = SectionPosition.c(j); + synchronized (this.visibleUpdateLock) { // Paper - avoid copying light data + LightEngineStorageSky.a lightenginestoragesky_a = (LightEngineStorageSky.a) this.e_visible; // Paper - avoid copying light data - must be after lock acquire +@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage + } + } + +- return nibblearray.a(SectionPosition.b(BlockPosition.b(i)), SectionPosition.b(BlockPosition.c(i)), SectionPosition.b(BlockPosition.d(i))); ++ return nibblearray.a(baseX & 15, (int) ((i << 52) >> 52) & 15, (int) baseZ & 15); // Paper - y changed above + } else { + return 15; + } +@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage + if (k != ((LightEngineStorageSky.a) this.f).b && SectionPosition.c(j) < k) { + NibbleArray nibblearray1; + +- while ((nibblearray1 = this.a(j, true)) == null) { ++ while ((nibblearray1 = this.updating.getUpdatingOptimized(j)) == null) { // Paper + j = SectionPosition.a(j, EnumDirection.UP); + } + +@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage + longiterator = this.m.iterator(); + + while (longiterator.hasNext()) { +- i = (Long) longiterator.next(); ++ i = longiterator.nextLong(); // Paper ++ int baseX = (int) (i >> 42) << 4; // Paper ++ int baseY = (int) (i << 44 >> 44) << 4; // Paper ++ int baseZ = (int) (i << 22 >> 42) << 4; // Paper + j = this.c(i); + if (j != 2 && !this.n.contains(i) && this.l.add(i)) { + int l; +@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage + ((LightEngineStorageSky.a) this.f).a(i); + } + +- Arrays.fill(this.a(i, true).asBytesPoolSafe(), (byte) -1); // Paper +- k = SectionPosition.c(SectionPosition.b(i)); +- l = SectionPosition.c(SectionPosition.c(i)); +- int i1 = SectionPosition.c(SectionPosition.d(i)); ++ Arrays.fill(this.updating.getUpdatingOptimized(i).asBytesPoolSafe(), (byte) -1); // Paper - use optimized ++ k = baseX; // Paper ++ l = baseY; // Paper ++ int i1 = baseZ; // Paper + EnumDirection[] aenumdirection = LightEngineStorageSky.k; + int j1 = aenumdirection.length; + +@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage + for (int l1 = 0; l1 < j1; ++l1) { + EnumDirection enumdirection = aenumdirection[l1]; + +- k1 = SectionPosition.a(i, enumdirection); ++ k1 = SectionPosition.getAdjacentFromBlockPos(baseX, baseY, baseZ, enumdirection); // Paper + if ((this.n.contains(k1) || !this.l.contains(k1) && !this.m.contains(k1)) && this.g(k1)) { + for (int i2 = 0; i2 < 16; ++i2) { + for (int j2 = 0; j2 < 16; ++j2) { +@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage + + for (int i3 = 0; i3 < 16; ++i3) { + for (j1 = 0; j1 < 16; ++j1) { +- long j3 = BlockPosition.a(SectionPosition.c(SectionPosition.b(i)) + i3, SectionPosition.c(SectionPosition.c(i)), SectionPosition.c(SectionPosition.d(i)) + j1); ++ long j3 = BlockPosition.a(baseX + i3, baseY, baseZ + j1); // Paper + +- k1 = BlockPosition.a(SectionPosition.c(SectionPosition.b(i)) + i3, SectionPosition.c(SectionPosition.c(i)) - 1, SectionPosition.c(SectionPosition.d(i)) + j1); ++ k1 = BlockPosition.a(baseX + i3, baseY - 1, baseZ + j1); // Paper + lightenginelayer.a(j3, k1, lightenginelayer.b(j3, k1, 0), true); + } + } + } else { + for (k = 0; k < 16; ++k) { + for (l = 0; l < 16; ++l) { +- long k3 = BlockPosition.a(SectionPosition.c(SectionPosition.b(i)) + k, SectionPosition.c(SectionPosition.c(i)) + 16 - 1, SectionPosition.c(SectionPosition.d(i)) + l); ++ long k3 = BlockPosition.a(baseX + k, baseY + 16 - 1, baseZ + l); // Paper + + lightenginelayer.a(Long.MAX_VALUE, k3, 0, true); + } +@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage + longiterator = this.n.iterator(); + + while (longiterator.hasNext()) { +- i = (Long) longiterator.next(); ++ i = longiterator.nextLong(); // Paper ++ int baseX = (int) (i >> 42) << 4; // Paper ++ int baseY = (int) (i << 44 >> 44) << 4; // Paper ++ int baseZ = (int) (i << 22 >> 42) << 4; // Paper + if (this.l.remove(i) && this.g(i)) { + for (j = 0; j < 16; ++j) { + for (k = 0; k < 16; ++k) { +- long l3 = BlockPosition.a(SectionPosition.c(SectionPosition.b(i)) + j, SectionPosition.c(SectionPosition.c(i)) + 16 - 1, SectionPosition.c(SectionPosition.d(i)) + k); ++ long l3 = BlockPosition.a(baseX + j, baseY + 16 - 1, baseZ + k); // Paper + + lightenginelayer.a(Long.MAX_VALUE, l3, 15, false); + } diff --git a/Spigot-Server-Patches/Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/Spigot-Server-Patches/Optimize-Network-Manager-and-add-advanced-packet-sup.patch index 5c9a47fd82..e430b90fbd 100644 --- a/Spigot-Server-Patches/Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/Spigot-Server-Patches/Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -27,10 +27,10 @@ and then catch exceptions and close if they fire. Part of this commit was authored by: Spottedleaf -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java +diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java +--- a/src/main/java/net/minecraft/network/NetworkManager.java ++++ b/src/main/java/net/minecraft/network/NetworkManager.java @@ -0,0 +0,0 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> { public int protocolVersion; public java.net.InetSocketAddress virtualHost; @@ -307,17 +307,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper start - Add PlayerConnectionCloseEvent final PacketListener packetListener = this.j(); if (packetListener instanceof PlayerConnection) { -diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java +diff --git a/src/main/java/net/minecraft/network/protocol/Packet.java b/src/main/java/net/minecraft/network/protocol/Packet.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Packet.java -+++ b/src/main/java/net/minecraft/server/Packet.java +--- a/src/main/java/net/minecraft/network/protocol/Packet.java ++++ b/src/main/java/net/minecraft/network/protocol/Packet.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.network.protocol; +import io.netty.channel.ChannelFuture; // Paper import java.io.IOException; - - public interface Packet<T extends PacketListener> { + import net.minecraft.network.PacketDataSerializer; + import net.minecraft.network.PacketListener; @@ -0,0 +0,0 @@ public interface Packet<T extends PacketListener> { void a(T t0); @@ -339,10 +339,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 default boolean packetTooLarge(NetworkManager manager) { return false; } -diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/ServerConnection.java b/src/main/java/net/minecraft/server/network/ServerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ServerConnection.java -+++ b/src/main/java/net/minecraft/server/ServerConnection.java +--- a/src/main/java/net/minecraft/server/network/ServerConnection.java ++++ b/src/main/java/net/minecraft/server/network/ServerConnection.java @@ -0,0 +0,0 @@ import io.netty.channel.epoll.EpollServerSocketChannel; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.ServerSocketChannel; diff --git a/Spigot-Server-Patches/Optimize-NetworkManager-Exception-Handling.patch b/Spigot-Server-Patches/Optimize-NetworkManager-Exception-Handling.patch index 1cc20d9041..ba89ac75cd 100644 --- a/Spigot-Server-Patches/Optimize-NetworkManager-Exception-Handling.patch +++ b/Spigot-Server-Patches/Optimize-NetworkManager-Exception-Handling.patch @@ -4,10 +4,10 @@ Date: Sun, 5 Jul 2020 22:38:18 -0400 Subject: [PATCH] Optimize NetworkManager Exception Handling -diff --git a/src/main/java/net/minecraft/server/EnumProtocol.java b/src/main/java/net/minecraft/server/EnumProtocol.java +diff --git a/src/main/java/net/minecraft/network/EnumProtocol.java b/src/main/java/net/minecraft/network/EnumProtocol.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EnumProtocol.java -+++ b/src/main/java/net/minecraft/server/EnumProtocol.java +--- a/src/main/java/net/minecraft/network/EnumProtocol.java ++++ b/src/main/java/net/minecraft/network/EnumProtocol.java @@ -0,0 +0,0 @@ public enum EnumProtocol { @Nullable @@ -16,10 +16,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Supplier<? extends Packet<T>> supplier = (Supplier) this.b.get(i); return supplier != null ? (Packet) supplier.get() : null; -diff --git a/src/main/java/net/minecraft/server/PacketSplitter.java b/src/main/java/net/minecraft/server/PacketSplitter.java +diff --git a/src/main/java/net/minecraft/network/PacketSplitter.java b/src/main/java/net/minecraft/network/PacketSplitter.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketSplitter.java -+++ b/src/main/java/net/minecraft/server/PacketSplitter.java +--- a/src/main/java/net/minecraft/network/PacketSplitter.java ++++ b/src/main/java/net/minecraft/network/PacketSplitter.java @@ -0,0 +0,0 @@ import java.util.List; public class PacketSplitter extends ByteToMessageDecoder { @@ -43,10 +43,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for (int i = 0; i < abyte.length; ++i) { if (!bytebuf.isReadable()) { -diff --git a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java +diff --git a/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java b/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java -+++ b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java +--- a/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java ++++ b/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java @@ -0,0 +0,0 @@ public class PlayerConnectionUtils { try (Timing ignored = timing.startTiming()) { // Paper - timings packet.a(t0); diff --git a/Spigot-Server-Patches/Optimize-NibbleArray-to-use-pooled-buffers.patch b/Spigot-Server-Patches/Optimize-NibbleArray-to-use-pooled-buffers.patch index 1a437c4744..78572026af 100644 --- a/Spigot-Server-Patches/Optimize-NibbleArray-to-use-pooled-buffers.patch +++ b/Spigot-Server-Patches/Optimize-NibbleArray-to-use-pooled-buffers.patch @@ -8,103 +8,124 @@ an object pool for these. Uses lots of advanced new capabilities of the Paper codebase :) -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutLightUpdate.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutLightUpdate.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - } - - if (nibblearray != null && !nibblearray.c()) { -- nbttagcompound2.setByteArray("BlockLight", nibblearray.asBytes()); -+ nbttagcompound2.setByteArray("BlockLight", nibblearray.asBytesPoolSafe().clone()); // Paper - } - - if (nibblearray1 != null && !nibblearray1.c()) { -- nbttagcompound2.setByteArray("SkyLight", nibblearray1.asBytes()); -+ nbttagcompound2.setByteArray("SkyLight", nibblearray1.asBytesPoolSafe().clone()); // Paper - } - - nbttaglist.add(nbttagcompound2); -diff --git a/src/main/java/net/minecraft/server/LightEngineStorage.java b/src/main/java/net/minecraft/server/LightEngineStorage.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorage.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorage.java -@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e - protected NibbleArray j(long i) { - NibbleArray nibblearray = (NibbleArray) this.i.get(i); - -- return nibblearray != null ? nibblearray : new NibbleArray(); -+ return nibblearray != null ? nibblearray : new NibbleArray().markPoolSafe(); // Paper - } - - protected void a(LightEngineLayer<?, ?> lightenginelayer, long i) { -@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e - - protected void a(long i, @Nullable NibbleArray nibblearray, boolean flag) { - if (nibblearray != null) { -- this.i.put(i, nibblearray); -+ NibbleArray remove = this.i.put(i, nibblearray); if (remove != null && remove.cleaner != null) remove.cleaner.run(); // Paper - clean up when removed - if (!flag) { - this.n.add(i); - } - } else { -- this.i.remove(i); -+ NibbleArray remove = this.i.remove(i); if (remove != null && remove.cleaner != null) remove.cleaner.run(); // Paper - clean up when removed - } - - } -diff --git a/src/main/java/net/minecraft/server/LightEngineStorageArray.java b/src/main/java/net/minecraft/server/LightEngineStorageArray.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorageArray.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorageArray.java -@@ -0,0 +0,0 @@ public abstract class LightEngineStorageArray<M extends LightEngineStorageArray< - - public void a(long i) { - if (this.isVisible) { throw new IllegalStateException("writing to visible data"); } // Paper - avoid copying light data -- this.data.queueUpdate(i, ((NibbleArray) this.data.getUpdating(i)).b()); // Paper - avoid copying light data -+ NibbleArray updating = this.data.getUpdating(i); // Paper - pool nibbles -+ this.data.queueUpdate(i, new NibbleArray().markPoolSafe(updating.getCloneIfSet())); // Paper - avoid copying light data - pool safe clone -+ if (updating.cleaner != null) MCUtil.scheduleTask(2, updating.cleaner, "Light Engine Release"); // Paper - delay clean incase anything holding ref was still using it - this.c(); - } - -diff --git a/src/main/java/net/minecraft/server/LightEngineStorageSky.java b/src/main/java/net/minecraft/server/LightEngineStorageSky.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorageSky.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorageSky.java -@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage - j = SectionPosition.a(j, EnumDirection.UP); - } - -- return new NibbleArray((new NibbleArrayFlat(nibblearray1, 0)).asBytes()); -+ return new NibbleArray().markPoolSafe(new NibbleArrayFlat(nibblearray1, 0).asBytes()); // Paper - mark pool use as safe (no auto cleaner) - } else { -- return new NibbleArray(); -+ return new NibbleArray().markPoolSafe(); // Paper - mark pool use as safe (no auto cleaner) - } - } - } -@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage - ((LightEngineStorageSky.a) this.f).a(i); - } - -- Arrays.fill(this.a(i, true).asBytes(), (byte) -1); -+ Arrays.fill(this.a(i, true).asBytesPoolSafe(), (byte) -1); // Paper - k = SectionPosition.c(SectionPosition.b(i)); - l = SectionPosition.c(SectionPosition.c(i)); - int i1 = SectionPosition.c(SectionPosition.d(i)); -diff --git a/src/main/java/net/minecraft/server/NibbleArray.java b/src/main/java/net/minecraft/server/NibbleArray.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NibbleArray.java -+++ b/src/main/java/net/minecraft/server/NibbleArray.java +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutLightUpdate.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutLightUpdate.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.network.protocol.game; + + import com.google.common.collect.Lists; ++import io.netty.channel.ChannelFuture; // Paper ++ + import java.io.IOException; + import java.util.Iterator; + import java.util.List; +@@ -0,0 +0,0 @@ public class PacketPlayOutLightUpdate implements Packet<PacketListenerPlayOut> { + private List<byte[]> h; + private boolean i; + ++ // Paper start ++ java.lang.Runnable cleaner1; ++ java.lang.Runnable cleaner2; ++ java.util.concurrent.atomic.AtomicInteger remainingSends = new java.util.concurrent.atomic.AtomicInteger(0); ++ ++ @Override ++ public void onPacketDispatch(EntityPlayer player) { ++ remainingSends.incrementAndGet(); ++ } ++ ++ @Override ++ public void onPacketDispatchFinish(EntityPlayer player, ChannelFuture future) { ++ if (remainingSends.decrementAndGet() <= 0) { ++ // incase of any race conditions, schedule this delayed ++ MCUtil.scheduleTask(5, () -> { ++ if (remainingSends.get() == 0) { ++ cleaner1.run(); ++ cleaner2.run(); ++ } ++ }, "Light Packet Release"); ++ } ++ } ++ ++ @Override ++ public boolean hasFinishListener() { ++ return true; ++ } ++ ++ // Paper end + public PacketPlayOutLightUpdate() {} + + public PacketPlayOutLightUpdate(ChunkCoordIntPair chunkcoordintpair, LightEngine lightengine, boolean flag) { + this.a = chunkcoordintpair.x; + this.b = chunkcoordintpair.z; + this.i = flag; +- this.g = Lists.newArrayList(); +- this.h = Lists.newArrayList(); ++ this.g = Lists.newArrayList();cleaner1 = MCUtil.registerListCleaner(this, this.g, NibbleArray::releaseBytes); // Paper ++ this.h = Lists.newArrayList();cleaner2 = MCUtil.registerListCleaner(this, this.h, NibbleArray::releaseBytes); // Paper + + for (int i = 0; i < 18; ++i) { + NibbleArray nibblearray = lightengine.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkcoordintpair, -1 + i)); +@@ -0,0 +0,0 @@ public class PacketPlayOutLightUpdate implements Packet<PacketListenerPlayOut> { + this.e |= 1 << i; + } else { + this.c |= 1 << i; +- this.g.add(nibblearray.asBytes().clone()); ++ this.g.add(nibblearray.getCloneIfSet()); // Paper + } + } + +@@ -0,0 +0,0 @@ public class PacketPlayOutLightUpdate implements Packet<PacketListenerPlayOut> { + this.f |= 1 << i; + } else { + this.d |= 1 << i; +- this.h.add(nibblearray1.asBytes().clone()); ++ this.h.add(nibblearray1.getCloneIfSet()); // Paper + } + } + } +@@ -0,0 +0,0 @@ public class PacketPlayOutLightUpdate implements Packet<PacketListenerPlayOut> { + this.i = flag; + this.c = i; + this.d = j; +- this.g = Lists.newArrayList(); +- this.h = Lists.newArrayList(); ++ this.g = Lists.newArrayList();cleaner1 = MCUtil.registerListCleaner(this, this.g, NibbleArray::releaseBytes); // Paper ++ this.h = Lists.newArrayList();cleaner2 = MCUtil.registerListCleaner(this, this.h, NibbleArray::releaseBytes); // Paper + + for (int k = 0; k < 18; ++k) { + NibbleArray nibblearray; +@@ -0,0 +0,0 @@ public class PacketPlayOutLightUpdate implements Packet<PacketListenerPlayOut> { + if ((this.c & 1 << k) != 0) { + nibblearray = lightengine.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkcoordintpair, -1 + k)); + if (nibblearray != null && !nibblearray.c()) { +- this.g.add(nibblearray.asBytes().clone()); ++ this.g.add(nibblearray.getCloneIfSet()); // Paper + } else { + this.c &= ~(1 << k); + if (nibblearray != null) { +@@ -0,0 +0,0 @@ public class PacketPlayOutLightUpdate implements Packet<PacketListenerPlayOut> { + if ((this.d & 1 << k) != 0) { + nibblearray = lightengine.a(EnumSkyBlock.BLOCK).a(SectionPosition.a(chunkcoordintpair, -1 + k)); + if (nibblearray != null && !nibblearray.c()) { +- this.h.add(nibblearray.asBytes().clone()); ++ this.h.add(nibblearray.getCloneIfSet()); // Paper + } else { + this.d &= ~(1 << k); + if (nibblearray != null) { +diff --git a/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java b/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java ++++ b/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java +@@ -0,0 +0,0 @@ + package net.minecraft.world.level.chunk; +import com.destroystokyo.paper.util.pooled.PooledObjects; // Paper + +import javax.annotation.Nonnull; import javax.annotation.Nullable; + import net.minecraft.SystemUtils; public class NibbleArray { @@ -224,10 +245,96 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public String toString() { -diff --git a/src/main/java/net/minecraft/server/NibbleArrayFlat.java b/src/main/java/net/minecraft/server/NibbleArrayFlat.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NibbleArrayFlat.java -+++ b/src/main/java/net/minecraft/server/NibbleArrayFlat.java +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +@@ -0,0 +0,0 @@ public class ChunkRegionLoader { + } + + if (nibblearray != null && !nibblearray.c()) { +- nbttagcompound2.setByteArray("BlockLight", nibblearray.asBytes()); ++ nbttagcompound2.setByteArray("BlockLight", nibblearray.asBytesPoolSafe().clone()); // Paper + } + + if (nibblearray1 != null && !nibblearray1.c()) { +- nbttagcompound2.setByteArray("SkyLight", nibblearray1.asBytes()); ++ nbttagcompound2.setByteArray("SkyLight", nibblearray1.asBytesPoolSafe().clone()); // Paper + } + + nbttaglist.add(nbttagcompound2); +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java +@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e + protected NibbleArray j(long i) { + NibbleArray nibblearray = (NibbleArray) this.i.get(i); + +- return nibblearray != null ? nibblearray : new NibbleArray(); ++ return nibblearray != null ? nibblearray : new NibbleArray().markPoolSafe(); // Paper + } + + protected void a(LightEngineLayer<?, ?> lightenginelayer, long i) { +@@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e + + protected void a(long i, @Nullable NibbleArray nibblearray, boolean flag) { + if (nibblearray != null) { +- this.i.put(i, nibblearray); ++ NibbleArray remove = this.i.put(i, nibblearray); if (remove != null && remove.cleaner != null) remove.cleaner.run(); // Paper - clean up when removed + if (!flag) { + this.n.add(i); + } + } else { +- this.i.remove(i); ++ NibbleArray remove = this.i.remove(i); if (remove != null && remove.cleaner != null) remove.cleaner.run(); // Paper - clean up when removed + } + + } +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java +@@ -0,0 +0,0 @@ public abstract class LightEngineStorageArray<M extends LightEngineStorageArray< + + public void a(long i) { + if (this.isVisible) { throw new IllegalStateException("writing to visible data"); } // Paper - avoid copying light data +- this.data.queueUpdate(i, ((NibbleArray) this.data.getUpdating(i)).b()); // Paper - avoid copying light data ++ NibbleArray updating = this.data.getUpdating(i); // Paper - pool nibbles ++ this.data.queueUpdate(i, new NibbleArray().markPoolSafe(updating.getCloneIfSet())); // Paper - avoid copying light data - pool safe clone ++ if (updating.cleaner != null) MCUtil.scheduleTask(2, updating.cleaner, "Light Engine Release"); // Paper - delay clean incase anything holding ref was still using it + this.c(); + } + +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java +@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage + j = SectionPosition.a(j, EnumDirection.UP); + } + +- return new NibbleArray((new NibbleArrayFlat(nibblearray1, 0)).asBytes()); ++ return new NibbleArray().markPoolSafe(new NibbleArrayFlat(nibblearray1, 0).asBytes()); // Paper - mark pool use as safe (no auto cleaner) + } else { +- return new NibbleArray(); ++ return new NibbleArray().markPoolSafe(); // Paper - mark pool use as safe (no auto cleaner) + } + } + } +@@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage + ((LightEngineStorageSky.a) this.f).a(i); + } + +- Arrays.fill(this.a(i, true).asBytes(), (byte) -1); ++ Arrays.fill(this.a(i, true).asBytesPoolSafe(), (byte) -1); // Paper + k = SectionPosition.c(SectionPosition.b(i)); + l = SectionPosition.c(SectionPosition.c(i)); + int i1 = SectionPosition.c(SectionPosition.d(i)); +diff --git a/src/main/java/net/minecraft/world/level/lighting/NibbleArrayFlat.java b/src/main/java/net/minecraft/world/level/lighting/NibbleArrayFlat.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/NibbleArrayFlat.java ++++ b/src/main/java/net/minecraft/world/level/lighting/NibbleArrayFlat.java @@ -0,0 +0,0 @@ public class NibbleArrayFlat extends NibbleArray { public NibbleArrayFlat(NibbleArray nibblearray, int i) { @@ -246,112 +353,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for (int i = 0; i < 16; ++i) { System.arraycopy(this.a, 0, abyte, i * 128, 128); -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutLightUpdate.java b/src/main/java/net/minecraft/server/PacketPlayOutLightUpdate.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutLightUpdate.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutLightUpdate.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - - import com.google.common.collect.Lists; -+import io.netty.channel.ChannelFuture; // Paper -+ - import java.io.IOException; - import java.util.Iterator; - import java.util.List; -@@ -0,0 +0,0 @@ public class PacketPlayOutLightUpdate implements Packet<PacketListenerPlayOut> { - private List<byte[]> h; - private boolean i; - -+ // Paper start -+ java.lang.Runnable cleaner1; -+ java.lang.Runnable cleaner2; -+ java.util.concurrent.atomic.AtomicInteger remainingSends = new java.util.concurrent.atomic.AtomicInteger(0); -+ -+ @Override -+ public void onPacketDispatch(EntityPlayer player) { -+ remainingSends.incrementAndGet(); -+ } -+ -+ @Override -+ public void onPacketDispatchFinish(EntityPlayer player, ChannelFuture future) { -+ if (remainingSends.decrementAndGet() <= 0) { -+ // incase of any race conditions, schedule this delayed -+ MCUtil.scheduleTask(5, () -> { -+ if (remainingSends.get() == 0) { -+ cleaner1.run(); -+ cleaner2.run(); -+ } -+ }, "Light Packet Release"); -+ } -+ } -+ -+ @Override -+ public boolean hasFinishListener() { -+ return true; -+ } -+ -+ // Paper end - public PacketPlayOutLightUpdate() {} - - public PacketPlayOutLightUpdate(ChunkCoordIntPair chunkcoordintpair, LightEngine lightengine, boolean flag) { - this.a = chunkcoordintpair.x; - this.b = chunkcoordintpair.z; - this.i = flag; -- this.g = Lists.newArrayList(); -- this.h = Lists.newArrayList(); -+ this.g = Lists.newArrayList();cleaner1 = MCUtil.registerListCleaner(this, this.g, NibbleArray::releaseBytes); // Paper -+ this.h = Lists.newArrayList();cleaner2 = MCUtil.registerListCleaner(this, this.h, NibbleArray::releaseBytes); // Paper - - for (int i = 0; i < 18; ++i) { - NibbleArray nibblearray = lightengine.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkcoordintpair, -1 + i)); -@@ -0,0 +0,0 @@ public class PacketPlayOutLightUpdate implements Packet<PacketListenerPlayOut> { - this.e |= 1 << i; - } else { - this.c |= 1 << i; -- this.g.add(nibblearray.asBytes().clone()); -+ this.g.add(nibblearray.getCloneIfSet()); // Paper - } - } - -@@ -0,0 +0,0 @@ public class PacketPlayOutLightUpdate implements Packet<PacketListenerPlayOut> { - this.f |= 1 << i; - } else { - this.d |= 1 << i; -- this.h.add(nibblearray1.asBytes().clone()); -+ this.h.add(nibblearray1.getCloneIfSet()); // Paper - } - } - } -@@ -0,0 +0,0 @@ public class PacketPlayOutLightUpdate implements Packet<PacketListenerPlayOut> { - this.i = flag; - this.c = i; - this.d = j; -- this.g = Lists.newArrayList(); -- this.h = Lists.newArrayList(); -+ this.g = Lists.newArrayList();cleaner1 = MCUtil.registerListCleaner(this, this.g, NibbleArray::releaseBytes); // Paper -+ this.h = Lists.newArrayList();cleaner2 = MCUtil.registerListCleaner(this, this.h, NibbleArray::releaseBytes); // Paper - - for (int k = 0; k < 18; ++k) { - NibbleArray nibblearray; -@@ -0,0 +0,0 @@ public class PacketPlayOutLightUpdate implements Packet<PacketListenerPlayOut> { - if ((this.c & 1 << k) != 0) { - nibblearray = lightengine.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkcoordintpair, -1 + k)); - if (nibblearray != null && !nibblearray.c()) { -- this.g.add(nibblearray.asBytes().clone()); -+ this.g.add(nibblearray.getCloneIfSet()); // Paper - } else { - this.c &= ~(1 << k); - if (nibblearray != null) { -@@ -0,0 +0,0 @@ public class PacketPlayOutLightUpdate implements Packet<PacketListenerPlayOut> { - if ((this.d & 1 << k) != 0) { - nibblearray = lightengine.a(EnumSkyBlock.BLOCK).a(SectionPosition.a(chunkcoordintpair, -1 + k)); - if (nibblearray != null && !nibblearray.c()) { -- this.h.add(nibblearray.asBytes().clone()); -+ this.h.add(nibblearray.getCloneIfSet()); // Paper - } else { - this.d &= ~(1 << k); - if (nibblearray != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java diff --git a/Spigot-Server-Patches/Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch b/Spigot-Server-Patches/Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch index 5fc5a3b16a..b5baa6e218 100644 --- a/Spigot-Server-Patches/Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch +++ b/Spigot-Server-Patches/Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch @@ -15,10 +15,10 @@ Optimize collection by creating a list instead of a set of the key and value. This lets us get faster foreach iteration, as well as avoids map lookups on the values when needed. -diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java b/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Pathfinder.java -+++ b/src/main/java/net/minecraft/server/Pathfinder.java +--- a/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java @@ -0,0 +0,0 @@ public class Pathfinder { this.d.a(); this.c.a(chunkcache, entityinsentient); diff --git a/Spigot-Server-Patches/Optimize-Pathfinding.patch b/Spigot-Server-Patches/Optimize-Pathfinding.patch index d35d9e3aad..d0210ee594 100644 --- a/Spigot-Server-Patches/Optimize-Pathfinding.patch +++ b/Spigot-Server-Patches/Optimize-Pathfinding.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimize Pathfinding Prevents pathfinding from spamming failures for things such as arrow attacks. -diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NavigationAbstract.java -+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java @@ -0,0 +0,0 @@ public abstract class NavigationAbstract { protected final EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER protected final World b; diff --git a/Spigot-Server-Patches/Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch b/Spigot-Server-Patches/Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch index 330ddf3527..9b3ca031ad 100644 --- a/Spigot-Server-Patches/Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch +++ b/Spigot-Server-Patches/Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch @@ -56,19 +56,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return clone; + } +} -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { - entityPlayer.playerNaturallySpawnedEvent.callEvent(); - }; - // Paper end -- this.playerChunkMap.f().forEach((playerchunk) -> { // Paper - no... just no... -+ this.playerChunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping - Optional<Chunk> optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); - - if (optional.isPresent()) { diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java @@ -82,10 +69,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ChunkMapDistance chunkMapDistance = chunkMap.chunkDistanceManager; List<PlayerChunk> allChunks = new ArrayList<>(visibleChunks.values()); List<EntityPlayer> players = world.players; -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { + entityPlayer.playerNaturallySpawnedEvent.callEvent(); + }; + // Paper end +- this.playerChunkMap.f().forEach((playerchunk) -> { // Paper - no... just no... ++ this.playerChunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping + Optional<Chunk> optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); + + if (optional.isPresent()) { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private static final Logger LOGGER = LogManager.getLogger(); @@ -246,19 +246,11 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -0,0 +0,0 @@ import net.minecraft.server.GroupDataEntity; - import net.minecraft.server.IBlockData; - import net.minecraft.server.IChunkAccess; - import net.minecraft.server.IRegistry; -+import net.minecraft.server.MCUtil; - import net.minecraft.server.MinecraftKey; - import net.minecraft.server.MinecraftServer; - import net.minecraft.server.MovingObjectPosition; @@ -0,0 +0,0 @@ public class CraftWorld implements World { return ret; } public int getTileEntityCount() { -+ return MCUtil.ensureMain(() -> { ++ return net.minecraft.server.MCUtil.ensureMain(() -> { // We don't use the full world tile entity list, so we must iterate chunks Long2ObjectLinkedOpenHashMap<PlayerChunk> chunks = world.getChunkProvider().playerChunkMap.visibleChunks; int size = 0; @@ -272,7 +264,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return world.tileEntityListTick.size(); } public int getChunkCount() { -+ return MCUtil.ensureMain(() -> { ++ return net.minecraft.server.MCUtil.ensureMain(() -> { int ret = 0; for (PlayerChunk chunkHolder : world.getChunkProvider().playerChunkMap.visibleChunks.values()) { @@ -298,5 +290,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end Long2ObjectLinkedOpenHashMap<PlayerChunk> chunks = world.getChunkProvider().playerChunkMap.visibleChunks; - return chunks.values().stream().map(PlayerChunk::getFullChunk).filter(Objects::nonNull).map(net.minecraft.server.Chunk::getBukkitChunk).toArray(Chunk[]::new); + return chunks.values().stream().map(PlayerChunk::getFullChunk).filter(Objects::nonNull).map(net.minecraft.world.level.chunk.Chunk::getBukkitChunk).toArray(Chunk[]::new); } diff --git a/Spigot-Server-Patches/Optimize-RegistryID.c.patch b/Spigot-Server-Patches/Optimize-RegistryID.c.patch index e60159a156..931e69e468 100644 --- a/Spigot-Server-Patches/Optimize-RegistryID.c.patch +++ b/Spigot-Server-Patches/Optimize-RegistryID.c.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize RegistryID.c() This is a frequent hotspot for world loading/saving. -diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java +diff --git a/src/main/java/net/minecraft/util/RegistryID.java b/src/main/java/net/minecraft/util/RegistryID.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegistryID.java -+++ b/src/main/java/net/minecraft/server/RegistryID.java +--- a/src/main/java/net/minecraft/util/RegistryID.java ++++ b/src/main/java/net/minecraft/util/RegistryID.java @@ -0,0 +0,0 @@ public class RegistryID<K> implements Registry<K> { private K[] d; private int e; diff --git a/Spigot-Server-Patches/Optimize-RegistryMaterials.patch b/Spigot-Server-Patches/Optimize-RegistryMaterials.patch index f800de2b87..c485b3f524 100644 --- a/Spigot-Server-Patches/Optimize-RegistryMaterials.patch +++ b/Spigot-Server-Patches/Optimize-RegistryMaterials.patch @@ -7,14 +7,14 @@ 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 +diff --git a/src/main/java/net/minecraft/core/RegistryMaterials.java b/src/main/java/net/minecraft/core/RegistryMaterials.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegistryMaterials.java -+++ b/src/main/java/net/minecraft/server/RegistryMaterials.java -@@ -0,0 +0,0 @@ import java.util.OptionalInt; - import java.util.Random; - import java.util.Set; - import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/core/RegistryMaterials.java ++++ b/src/main/java/net/minecraft/core/RegistryMaterials.java +@@ -0,0 +0,0 @@ import net.minecraft.SystemUtils; + import net.minecraft.resources.MinecraftKey; + import net.minecraft.resources.RegistryDataPackCodec; + import net.minecraft.resources.ResourceKey; +import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; // Paper import org.apache.commons.lang3.Validate; import org.apache.logging.log4j.LogManager; diff --git a/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch b/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch index ca196313df..5c06b25083 100644 --- a/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch +++ b/Spigot-Server-Patches/Optimize-TileEntity-Ticking.patch @@ -28,11 +28,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 pair("gamerules", toObjectMapper(world.getWorld().getGameRules(), rule -> { return pair(rule, world.getWorld().getGameRuleValue(rule)); })), -diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockChest.java b/src/main/java/net/minecraft/world/level/block/BlockChest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockChest.java -+++ b/src/main/java/net/minecraft/server/BlockChest.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/level/block/BlockChest.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockChest.java +@@ -0,0 +0,0 @@ import net.minecraft.world.phys.shapes.VoxelShapeCollision; public class BlockChest extends BlockChestAbstract<TileEntityChest> implements IBlockWaterlogged { public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING; @@ -43,22 +43,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 protected static final VoxelShape e = Block.a(1.0D, 0.0D, 0.0D, 15.0D, 14.0D, 15.0D); protected static final VoxelShape f = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 14.0D, 16.0D); protected static final VoxelShape g = Block.a(0.0D, 0.0D, 1.0D, 15.0D, 14.0D, 15.0D); -diff --git a/src/main/java/net/minecraft/server/IBlockDataHolder.java b/src/main/java/net/minecraft/server/IBlockDataHolder.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IBlockDataHolder.java -+++ b/src/main/java/net/minecraft/server/IBlockDataHolder.java -@@ -0,0 +0,0 @@ public abstract class IBlockDataHolder<O, S> { - return Collections.unmodifiableCollection(this.b.keySet()); - } - -+ public <T extends Comparable<T>> boolean contains(IBlockState<T> iblockstate) { return this.b(iblockstate); } // Paper - OBFHELPER - public <T extends Comparable<T>> boolean b(IBlockState<T> iblockstate) { - return this.b.containsKey(iblockstate); - } -diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityChest.java -+++ b/src/main/java/net/minecraft/server/TileEntityChest.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity; import org.bukkit.entity.HumanEntity; // CraftBukkit end @@ -141,12 +129,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.getBlock().getBlock() == Blocks.TRAPPED_CHEST) { int newPower = Math.max(0, Math.min(15, this.viewingCount)); -diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java -+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java +@@ -0,0 +0,0 @@ import net.minecraft.sounds.SoundEffects; + import net.minecraft.world.entity.player.EntityHuman; + import net.minecraft.world.level.block.Blocks; -public class TileEntityEnderChest extends TileEntity implements ITickable { +public class TileEntityEnderChest extends TileEntity { // Paper - Remove ITickable @@ -232,3 +221,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public boolean a(EntityHuman entityhuman) { +diff --git a/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java b/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java ++++ b/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java +@@ -0,0 +0,0 @@ public abstract class IBlockDataHolder<O, S> { + return Collections.unmodifiableCollection(this.b.keySet()); + } + ++ public <T extends Comparable<T>> boolean contains(IBlockState<T> iblockstate) { return this.b(iblockstate); } // Paper - OBFHELPER + public <T extends Comparable<T>> boolean b(IBlockState<T> iblockstate) { + return this.b.containsKey(iblockstate); + } diff --git a/Spigot-Server-Patches/Optimize-UserCache-Thread-Safe.patch b/Spigot-Server-Patches/Optimize-UserCache-Thread-Safe.patch index 8e17035494..cf5ef2e2a7 100644 --- a/Spigot-Server-Patches/Optimize-UserCache-Thread-Safe.patch +++ b/Spigot-Server-Patches/Optimize-UserCache-Thread-Safe.patch @@ -9,19 +9,6 @@ easier to do this than replace the entire thing. Additionally, move Saving of the User cache to be done async, incase the user never changed the default setting for Spigot's save on stop only. -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 - } - - if (this.convertNames()) { -- this.getUserCache().b(); -+ this.getUserCache().b(false); // Paper - } - - if (!NameReferencingFileConverter.e(this)) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -35,10 +22,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Spigot end -diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/UserCache.java -+++ b/src/main/java/net/minecraft/server/UserCache.java +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + } + + if (this.convertNames()) { +- this.getUserCache().b(); ++ this.getUserCache().b(false); // Paper + } + + if (!NameReferencingFileConverter.e(this)) { +diff --git a/src/main/java/net/minecraft/server/players/UserCache.java b/src/main/java/net/minecraft/server/players/UserCache.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/players/UserCache.java ++++ b/src/main/java/net/minecraft/server/players/UserCache.java @@ -0,0 +0,0 @@ public class UserCache { return UserCache.b; } diff --git a/Spigot-Server-Patches/Optimize-Voxel-Shape-Merging.patch b/Spigot-Server-Patches/Optimize-Voxel-Shape-Merging.patch index 5eae1b2715..b22050ab79 100644 --- a/Spigot-Server-Patches/Optimize-Voxel-Shape-Merging.patch +++ b/Spigot-Server-Patches/Optimize-Voxel-Shape-Merging.patch @@ -29,10 +29,10 @@ and compute a deterministic result for the MergerList values. Additionally, this lets us avoid even allocating new objects for this too, further reducing memory usage. -diff --git a/src/main/java/net/minecraft/server/VoxelShapeMergerList.java b/src/main/java/net/minecraft/server/VoxelShapeMergerList.java +diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMergerList.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMergerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapeMergerList.java -+++ b/src/main/java/net/minecraft/server/VoxelShapeMergerList.java +--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMergerList.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMergerList.java @@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.ints.IntArrayList; public final class VoxelShapeMergerList implements VoxelShapeMerger { @@ -74,10 +74,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.a = new DoubleArrayList(i1); this.b = new IntArrayList(i1); this.c = new IntArrayList(i1); -diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java +diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapes.java -+++ b/src/main/java/net/minecraft/server/VoxelShapes.java +--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java @@ -0,0 +0,0 @@ public final class VoxelShapes { } diff --git a/Spigot-Server-Patches/Optimize-World.isLoaded-BlockPosition-Z.patch b/Spigot-Server-Patches/Optimize-World.isLoaded-BlockPosition-Z.patch index 3e4ef873bb..3f21531959 100644 --- a/Spigot-Server-Patches/Optimize-World.isLoaded-BlockPosition-Z.patch +++ b/Spigot-Server-Patches/Optimize-World.isLoaded-BlockPosition-Z.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z Reduce method invocations for World.isLoaded(BlockPosition)Z -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return chunk == null ? null : chunk.getFluid(blockposition); } diff --git a/Spigot-Server-Patches/Optimize-WorldBorder-collision-checks-and-air.patch b/Spigot-Server-Patches/Optimize-WorldBorder-collision-checks-and-air.patch index 415bd8ddbc..a4da25f9ca 100644 --- a/Spigot-Server-Patches/Optimize-WorldBorder-collision-checks-and-air.patch +++ b/Spigot-Server-Patches/Optimize-WorldBorder-collision-checks-and-air.patch @@ -4,11 +4,11 @@ Date: Sun, 10 May 2020 22:49:05 -0400 Subject: [PATCH] Optimize WorldBorder collision checks and air -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne AxisAlignedBB axisalignedbb = this.getBoundingBox(); VoxelShapeCollision voxelshapecollision = VoxelShapeCollision.a(this); VoxelShape voxelshape = this.world.getWorldBorder().c(); @@ -17,10 +17,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Stream<VoxelShape> stream1 = this.world.c(this, axisalignedbb.b(vec3d), (entity) -> { return true; }); -diff --git a/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java b/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java +diff --git a/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java b/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java -+++ b/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java +--- a/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java ++++ b/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java @@ -0,0 +0,0 @@ public class VoxelShapeSpliterator extends AbstractSpliterator<VoxelShape> { AxisAlignedBB axisalignedbb = this.a.getBoundingBox(); @@ -36,10 +36,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return true; } } -diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java +diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapes.java -+++ b/src/main/java/net/minecraft/server/VoxelShapes.java +--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java ++++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java +@@ -0,0 +0,0 @@ public class WorldBorder { + return (double) chunkcoordintpair.f() > this.e() && (double) chunkcoordintpair.d() < this.g() && (double) chunkcoordintpair.g() > this.f() && (double) chunkcoordintpair.e() < this.h(); + } + ++ public final boolean isInBounds(AxisAlignedBB aabb) { return this.a(aabb); } // Paper - OBFHELPER + public boolean a(AxisAlignedBB axisalignedbb) { + return axisalignedbb.maxX > this.e() && axisalignedbb.minX < this.g() && axisalignedbb.maxZ > this.f() && axisalignedbb.minZ < this.h(); + } +diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java @@ -0,0 +0,0 @@ public final class VoxelShapes { IBlockData iblockdata = iworldreader.getTypeIfLoaded(blockposition_mutableblockposition); // Paper if (iblockdata == null) return 0.0D; // Paper @@ -49,15 +61,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 d0 = iblockdata.b((IBlockAccess) iworldreader, blockposition_mutableblockposition, voxelshapecollision).a(enumdirection_enumaxis2, axisalignedbb.d((double) (-blockposition_mutableblockposition.getX()), (double) (-blockposition_mutableblockposition.getY()), (double) (-blockposition_mutableblockposition.getZ())), d0); if (Math.abs(d0) < 1.0E-7D) { return 0.0D; -diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldBorder.java -+++ b/src/main/java/net/minecraft/server/WorldBorder.java -@@ -0,0 +0,0 @@ public class WorldBorder { - return (double) chunkcoordintpair.f() > this.e() && (double) chunkcoordintpair.d() < this.g() && (double) chunkcoordintpair.g() > this.f() && (double) chunkcoordintpair.e() < this.h(); - } - -+ public final boolean isInBounds(AxisAlignedBB aabb) { return this.a(aabb); } // Paper - OBFHELPER - public boolean a(AxisAlignedBB axisalignedbb) { - return axisalignedbb.maxX > this.e() && axisalignedbb.minX < this.g() && axisalignedbb.maxZ > this.f() && axisalignedbb.minZ < this.h(); - } diff --git a/Spigot-Server-Patches/Optimize-brigadier-child-sorting-performance.patch b/Spigot-Server-Patches/Optimize-brigadier-child-sorting-performance.patch index 887c68049a..dd9ac2d9e7 100644 --- a/Spigot-Server-Patches/Optimize-brigadier-child-sorting-performance.patch +++ b/Spigot-Server-Patches/Optimize-brigadier-child-sorting-performance.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java +++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java @@ -0,0 +0,0 @@ import java.util.stream.Collectors; - import net.minecraft.server.CommandListenerWrapper; // CraftBukkit + import net.minecraft.commands.CommandListenerWrapper; // CraftBukkit public abstract class CommandNode<S> implements Comparable<CommandNode<S>> { - private Map<String, CommandNode<S>> children = Maps.newLinkedHashMap(); diff --git a/Spigot-Server-Patches/Optimize-call-to-getFluid-for-explosions.patch b/Spigot-Server-Patches/Optimize-call-to-getFluid-for-explosions.patch index 1c92597884..367c44a186 100644 --- a/Spigot-Server-Patches/Optimize-call-to-getFluid-for-explosions.patch +++ b/Spigot-Server-Patches/Optimize-call-to-getFluid-for-explosions.patch @@ -4,10 +4,10 @@ Date: Tue, 14 Jan 2020 17:49:03 -0500 Subject: [PATCH] Optimize call to getFluid for explosions -diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java +diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Explosion.java -+++ b/src/main/java/net/minecraft/server/Explosion.java +--- a/src/main/java/net/minecraft/world/level/Explosion.java ++++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -0,0 +0,0 @@ public class Explosion { for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) { BlockPosition blockposition = new BlockPosition(d4, d5, d6); diff --git a/Spigot-Server-Patches/Optimize-explosions.patch b/Spigot-Server-Patches/Optimize-explosions.patch index 7d2822d932..bc2ddb1253 100644 --- a/Spigot-Server-Patches/Optimize-explosions.patch +++ b/Spigot-Server-Patches/Optimize-explosions.patch @@ -24,10 +24,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("Optimize explosions: " + optimizeExplosions); + } } -diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Explosion.java -+++ b/src/main/java/net/minecraft/server/Explosion.java +--- 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<TickTas + + this.methodProfiler.exit(); + this.methodProfiler.exit(); ++ worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions + } + + this.methodProfiler.exitEnter("connection"); +diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/Explosion.java ++++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -0,0 +0,0 @@ public class Explosion { d8 /= d11; d9 /= d11; @@ -122,22 +134,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end } -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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<TickTas - - this.methodProfiler.exit(); - this.methodProfiler.exit(); -+ worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions - } - - this.methodProfiler.exitEnter("connection"); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { private org.spigotmc.TickLimiter entityLimiter; private org.spigotmc.TickLimiter tileLimiter; diff --git a/Spigot-Server-Patches/Optimize-isOutsideRange-to-use-distance-maps.patch b/Spigot-Server-Patches/Optimize-isOutsideRange-to-use-distance-maps.patch index 4fe152038b..ca93ed2fb0 100644 --- a/Spigot-Server-Patches/Optimize-isOutsideRange-to-use-distance-maps.patch +++ b/Spigot-Server-Patches/Optimize-isOutsideRange-to-use-distance-maps.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize isOutsideRange to use distance maps Use a distance map to find the players in range quickly -diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkMapDistance.java -+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java +--- a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java @@ -0,0 +0,0 @@ public abstract class ChunkMapDistance { private final Long2ObjectMap<ObjectSet<EntityPlayer>> c = new Long2ObjectOpenHashMap(); public final Long2ObjectOpenHashMap<ArraySetSorted<Ticket<?>>> tickets = new Long2ObjectOpenHashMap(); @@ -76,10 +76,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public String c() { -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { boolean flag1 = this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING) && !world.getPlayers().isEmpty(); // CraftBukkit @@ -147,10 +147,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 SpawnerCreature.a(this.world, chunk, spawnercreature_d, this.allowAnimals, this.allowMonsters, flag2); } -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> cachedSingleHashSet; // Paper @@ -160,10 +160,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); this.spawnDimension = World.OVERWORLD; -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { long lastAutoSaveTime; // Paper - incremental autosave long inactiveTimeStart; // Paper - incremental autosave @@ -191,10 +191,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Paper start -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return MinecraftServer.getServer().applyTrackingRangeScale(vanilla); } diff --git a/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch index 634c4042d9..73c343c2a9 100644 --- a/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ b/Spigot-Server-Patches/Optimize-isValidLocation-getType-and-getBlockData-fo.patch @@ -12,10 +12,10 @@ Replace all calls to the new place to the unnecessary forward. Optimize getType and getBlockData to manually inline and optimize the calls -diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java +diff --git a/src/main/java/net/minecraft/core/BaseBlockPosition.java b/src/main/java/net/minecraft/core/BaseBlockPosition.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BaseBlockPosition.java -+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java +--- a/src/main/java/net/minecraft/core/BaseBlockPosition.java ++++ b/src/main/java/net/minecraft/core/BaseBlockPosition.java @@ -0,0 +0,0 @@ public class BaseBlockPosition implements Comparable<BaseBlockPosition> { private int b;public final void setY(final int y) { this.b = y; } // Paper - OBFHELPER private int e;public final void setZ(final int z) { this.e = z; } // Paper - OBFHELPER @@ -32,10 +32,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public BaseBlockPosition(int i, int j, int k) { this.a = i; this.b = j; -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + } + + public static boolean isValidLocation(BlockPosition blockposition) { +- return !isOutsideWorld(blockposition) && D(blockposition); ++ return blockposition.isValidLocation(); // Paper - use better/optimized check + } + + public static boolean l(BlockPosition blockposition) { +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { return this.sections; } @@ -68,11 +81,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.world.isDebugWorld()) { IBlockData iblockdata = null; -diff --git a/src/main/java/net/minecraft/server/ChunkEmpty.java b/src/main/java/net/minecraft/server/ChunkEmpty.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java b/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkEmpty.java -+++ b/src/main/java/net/minecraft/server/ChunkEmpty.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java +@@ -0,0 +0,0 @@ import net.minecraft.world.phys.AxisAlignedBB; public class ChunkEmpty extends Chunk { @@ -93,10 +106,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public IBlockData getType(BlockPosition blockposition) { return Blocks.VOID_AIR.getBlockData(); -diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java @@ -0,0 +0,0 @@ public class ChunkSection { public static final DataPalette<IBlockData> GLOBAL_PALETTE = new DataPaletteGlobal<>(Block.REGISTRY_ID, Blocks.AIR.getBlockData()); @@ -121,10 +134,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public Fluid b(int i, int j, int k) { -diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DataPaletteBlock.java -+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java +--- a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java ++++ b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java @@ -0,0 +0,0 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> { } @@ -134,10 +147,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } protected T a(int i) { -diff --git a/src/main/java/net/minecraft/server/IChunkAccess.java b/src/main/java/net/minecraft/server/IChunkAccess.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IChunkAccess.java -+++ b/src/main/java/net/minecraft/server/IChunkAccess.java +--- a/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java ++++ b/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.LogManager; public interface IChunkAccess extends IBlockAccess, IStructureAccess { @@ -146,10 +159,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Nullable IBlockData setType(BlockPosition blockposition, IBlockData iblockdata, boolean flag); -diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ProtoChunk.java -+++ b/src/main/java/net/minecraft/server/ProtoChunk.java +--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java @@ -0,0 +0,0 @@ public class ProtoChunk implements IChunkAccess { @Override @@ -175,10 +188,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public Fluid getFluid(BlockPosition blockposition) { -diff --git a/src/main/java/net/minecraft/server/ProtoChunkExtension.java b/src/main/java/net/minecraft/server/ProtoChunkExtension.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ProtoChunkExtension.java -+++ b/src/main/java/net/minecraft/server/ProtoChunkExtension.java +--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java @@ -0,0 +0,0 @@ public class ProtoChunkExtension extends ProtoChunk { public IBlockData getType(BlockPosition blockposition) { return this.a.getType(blockposition); @@ -191,16 +204,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public Fluid getFluid(BlockPosition blockposition) { -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - } - - public static boolean isValidLocation(BlockPosition blockposition) { -- return !isOutsideWorld(blockposition) && D(blockposition); -+ return blockposition.isValidLocation(); // Paper - use better/optimized check - } - - public static boolean l(BlockPosition blockposition) { diff --git a/Spigot-Server-Patches/Optimize-redstone-algorithm.patch b/Spigot-Server-Patches/Optimize-redstone-algorithm.patch index 8dca8f6f5b..d4af264dd5 100644 --- a/Spigot-Server-Patches/Optimize-redstone-algorithm.patch +++ b/Spigot-Server-Patches/Optimize-redstone-algorithm.patch @@ -958,12 +958,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return i > strength ? i : strength; + } +} -diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java -+++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + + } + ++ public void neighborChanged(BlockPosition pos, Block blockIn, BlockPosition fromPos) { a(pos, blockIn, fromPos); } // Paper - OBFHELPER + public void a(BlockPosition blockposition, Block block, BlockPosition blockposition1) { + if (!this.isClientSide) { + IBlockData iblockdata = this.getType(blockposition); +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + return this.getBlockFacePower(blockposition.down(), EnumDirection.DOWN) > 0 ? true : (this.getBlockFacePower(blockposition.up(), EnumDirection.UP) > 0 ? true : (this.getBlockFacePower(blockposition.north(), EnumDirection.NORTH) > 0 ? true : (this.getBlockFacePower(blockposition.south(), EnumDirection.SOUTH) > 0 ? true : (this.getBlockFacePower(blockposition.west(), EnumDirection.WEST) > 0 ? true : this.getBlockFacePower(blockposition.east(), EnumDirection.EAST) > 0)))); + } + ++ public int isBlockIndirectlyGettingPowered(BlockPosition pos) { return this.s(pos); } // Paper - OBFHELPER + public int s(BlockPosition blockposition) { + int i = 0; + EnumDirection[] aenumdirection = World.a; +diff --git a/src/main/java/net/minecraft/world/level/block/BlockRedstoneWire.java b/src/main/java/net/minecraft/world/level/block/BlockRedstoneWire.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockRedstoneWire.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockRedstoneWire.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.world.level.block; +import com.destroystokyo.paper.PaperConfig; +import com.destroystokyo.paper.util.RedstoneWireTurbo; @@ -1137,23 +1157,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - - } - -+ public void neighborChanged(BlockPosition pos, Block blockIn, BlockPosition fromPos) { a(pos, blockIn, fromPos); } // Paper - OBFHELPER - public void a(BlockPosition blockposition, Block block, BlockPosition blockposition1) { - if (!this.isClientSide) { - IBlockData iblockdata = this.getType(blockposition); -@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - return this.getBlockFacePower(blockposition.down(), EnumDirection.DOWN) > 0 ? true : (this.getBlockFacePower(blockposition.up(), EnumDirection.UP) > 0 ? true : (this.getBlockFacePower(blockposition.north(), EnumDirection.NORTH) > 0 ? true : (this.getBlockFacePower(blockposition.south(), EnumDirection.SOUTH) > 0 ? true : (this.getBlockFacePower(blockposition.west(), EnumDirection.WEST) > 0 ? true : this.getBlockFacePower(blockposition.east(), EnumDirection.EAST) > 0)))); - } - -+ public int isBlockIndirectlyGettingPowered(BlockPosition pos) { return this.s(pos); } // Paper - OBFHELPER - public int s(BlockPosition blockposition) { - int i = 0; - EnumDirection[] aenumdirection = World.a; diff --git a/Spigot-Server-Patches/Optimize-sending-packets-to-nearby-locations-sounds-.patch b/Spigot-Server-Patches/Optimize-sending-packets-to-nearby-locations-sounds-.patch index 25ee7890ef..2fef302423 100644 --- a/Spigot-Server-Patches/Optimize-sending-packets-to-nearby-locations-sounds-.patch +++ b/Spigot-Server-Patches/Optimize-sending-packets-to-nearby-locations-sounds-.patch @@ -10,10 +10,10 @@ is originating from. This will drastically cut down on packet sending cost for worlds with lots of players in them. -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { } diff --git a/Spigot-Server-Patches/Optimized-tick-ready-check.patch b/Spigot-Server-Patches/Optimized-tick-ready-check.patch index d820933708..0cf13a61de 100644 --- a/Spigot-Server-Patches/Optimized-tick-ready-check.patch +++ b/Spigot-Server-Patches/Optimized-tick-ready-check.patch @@ -4,10 +4,10 @@ Date: Sun, 27 Dec 2020 17:19:51 +0100 Subject: [PATCH] Optimized tick ready check -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { if (!tileentity.isRemoved() && tileentity.hasWorld()) { BlockPosition blockposition = tileentity.getPosition(); 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 3fd880d0a2..6d8b22caeb 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 @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); + } } -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java @@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving { @Override @@ -30,10 +30,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 List<Entity> list = this.world.getEntities(this, this.getBoundingBox(), EntityArmorStand.br); for (int i = 0; i < list.size(); ++i) { -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // Paper end } diff --git a/Spigot-Server-Patches/Option-to-remove-corrupt-tile-entities.patch b/Spigot-Server-Patches/Option-to-remove-corrupt-tile-entities.patch index 85b8f6a811..fcfdfda214 100644 --- a/Spigot-Server-Patches/Option-to-remove-corrupt-tile-entities.patch +++ b/Spigot-Server-Patches/Option-to-remove-corrupt-tile-entities.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + removeCorruptTEs = getBoolean("remove-corrupt-tile-entities", false); + } } -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { "Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16)); e.printStackTrace(); diff --git a/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch index 6f17c24836..a4398b4e27 100644 --- a/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch +++ b/Spigot-Server-Patches/Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -29,12 +29,12 @@ diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/m index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java +++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java -@@ -0,0 +0,0 @@ import net.kyori.adventure.text.event.ClickEvent; - import net.minecraft.server.EntityPlayer; - import net.minecraft.server.IChatBaseComponent; +@@ -0,0 +0,0 @@ import net.kyori.adventure.text.format.TextDecoration; + import net.minecraft.network.chat.IChatBaseComponent; import net.minecraft.server.MinecraftServer; -+import net.minecraft.server.ScoreboardTeam; -+import net.minecraft.server.ScoreboardTeamBase; + import net.minecraft.server.level.EntityPlayer; ++import net.minecraft.world.scores.ScoreboardTeam; ++import net.minecraft.world.scores.ScoreboardTeamBase; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.CraftWorld; diff --git a/Spigot-Server-Patches/Optional-TNT-doesn-t-move-in-water.patch b/Spigot-Server-Patches/Optional-TNT-doesn-t-move-in-water.patch index 9a7c8cac24..48221235e3 100644 --- a/Spigot-Server-Patches/Optional-TNT-doesn-t-move-in-water.patch +++ b/Spigot-Server-Patches/Optional-TNT-doesn-t-move-in-water.patch @@ -31,11 +31,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("Prevent TNT from moving in water: " + preventTntFromMovingInWater); + } } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java ++++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java +@@ -0,0 +0,0 @@ public class EntityTrackerEntry { + private boolean q; + private boolean r; + // CraftBukkit start +- private final Set<EntityPlayer> trackedPlayers; ++ final Set<EntityPlayer> trackedPlayers; // Paper - private -> package + // Paper start + private java.util.Map<EntityPlayer, Boolean> trackedPlayerMap = null; + +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public boolean bV() { @@ -47,10 +60,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return true; } -diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java +--- a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java @@ -0,0 +0,0 @@ public class EntityTNTPrimed extends Entity { this.world.addParticle(Particles.SMOKE, this.locX(), this.locY() + 0.5D, this.locZ(), 0.0D, 0.0D, 0.0D); } @@ -92,16 +105,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + // Paper end } -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -0,0 +0,0 @@ public class EntityTrackerEntry { - private boolean q; - private boolean r; - // CraftBukkit start -- private final Set<EntityPlayer> trackedPlayers; -+ final Set<EntityPlayer> trackedPlayers; // Paper - private -> package - // Paper start - private java.util.Map<EntityPlayer, Boolean> trackedPlayerMap = null; - diff --git a/Spigot-Server-Patches/Paper-config-files.patch b/Spigot-Server-Patches/Paper-config-files.patch index 093c4f4f39..80abac900e 100644 --- a/Spigot-Server-Patches/Paper-config-files.patch +++ b/Spigot-Server-Patches/Paper-config-files.patch @@ -19,13 +19,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; -+import net.minecraft.server.ChunkCoordIntPair; -+import net.minecraft.server.ChunkProviderServer; -+import net.minecraft.server.Entity; -+import net.minecraft.server.EntityTypes; -+import net.minecraft.server.MinecraftKey; ++import net.minecraft.resources.MinecraftKey; +import net.minecraft.server.MinecraftServer; -+import net.minecraft.server.WorldServer; ++import net.minecraft.server.level.ChunkProviderServer; ++import net.minecraft.server.level.WorldServer; ++import net.minecraft.world.entity.Entity; ++import net.minecraft.world.entity.EntityTypes; ++import net.minecraft.world.level.ChunkCoordIntPair; +import org.apache.commons.lang3.tuple.MutablePair; +import org.apache.commons.lang3.tuple.Pair; +import org.bukkit.Bukkit; @@ -562,73 +562,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path)); + } +} -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { - } - } - -- @Override -- public boolean a(Entity entity) { -+ public final boolean isInEntityTickingChunk(Entity entity) { return this.a(entity); } // Paper - OBFHELPER -+ @Override public boolean a(Entity entity) { - long i = ChunkCoordIntPair.pair(MathHelper.floor(entity.locX()) >> 4, MathHelper.floor(entity.locZ()) >> 4); - - return this.a(i, (Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>>) PlayerChunk::b); // CraftBukkit - decompile error - } - -- @Override -- public boolean a(ChunkCoordIntPair chunkcoordintpair) { -+ public final boolean isEntityTickingChunk(ChunkCoordIntPair chunkcoordintpair) { return this.a(chunkcoordintpair); } // Paper - OBFHELPER -+ @Override public boolean a(ChunkCoordIntPair chunkcoordintpair) { - return this.a(chunkcoordintpair.pair(), (Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>>) PlayerChunk::b); // CraftBukkit - decompile error - } - -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 - org.spigotmc.SpigotConfig.init((java.io.File) options.valueOf("spigot-settings")); - org.spigotmc.SpigotConfig.registerCommands(); - // Spigot end -+ // Paper start -+ try { -+ com.destroystokyo.paper.PaperConfig.init((java.io.File) options.valueOf("paper-settings")); -+ } catch (Exception e) { -+ DedicatedServer.LOGGER.error("Unable to load server configuration", e); -+ return false; -+ } -+ com.destroystokyo.paper.PaperConfig.registerCommands(); -+ // Paper end - - this.setPVP(dedicatedserverproperties.pvp); - this.setAllowFlight(dedicatedserverproperties.allowFlight); -diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTypes.java -+++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -0,0 +0,0 @@ package net.minecraft.server; - - import com.google.common.collect.ImmutableSet; - import java.util.Optional; -+import java.util.Set; // Paper - import java.util.UUID; - import java.util.function.Function; - import java.util.stream.Stream; -@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { - return new EntityTypes<>(this.a, this.b, this.d, this.e, this.f, this.g, this.c, this.j, this.h, this.i); - } - } -+ -+ // Paper start -+ public static Set<MinecraftKey> getEntityNameList() { -+ return IRegistry.ENTITY_TYPE.keySet(); -+ } -+ // Paper end - } diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/Main.java @@ -667,10 +600,77 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static void convertWorld(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, boolean flag, BooleanSupplier booleansupplier, ImmutableSet<ResourceKey<DimensionManager>> immutableset) { // CraftBukkit Main.LOGGER.info("Forcing world upgrade! {}", convertable_conversionsession.getLevelName()); // CraftBukkit WorldUpgrader worldupgrader = new WorldUpgrader(convertable_conversionsession, datafixer, immutableset, flag); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + org.spigotmc.SpigotConfig.init((java.io.File) options.valueOf("spigot-settings")); + org.spigotmc.SpigotConfig.registerCommands(); + // Spigot end ++ // Paper start ++ try { ++ com.destroystokyo.paper.PaperConfig.init((java.io.File) options.valueOf("paper-settings")); ++ } catch (Exception e) { ++ DedicatedServer.LOGGER.error("Unable to load server configuration", e); ++ return false; ++ } ++ com.destroystokyo.paper.PaperConfig.registerCommands(); ++ // Paper end + + this.setPVP(dedicatedserverproperties.pvp); + this.setAllowFlight(dedicatedserverproperties.allowFlight); +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { + } + } + +- @Override +- public boolean a(Entity entity) { ++ public final boolean isInEntityTickingChunk(Entity entity) { return this.a(entity); } // Paper - OBFHELPER ++ @Override public boolean a(Entity entity) { + long i = ChunkCoordIntPair.pair(MathHelper.floor(entity.locX()) >> 4, MathHelper.floor(entity.locZ()) >> 4); + + return this.a(i, (Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>>) PlayerChunk::b); // CraftBukkit - decompile error + } + +- @Override +- public boolean a(ChunkCoordIntPair chunkcoordintpair) { ++ public final boolean isEntityTickingChunk(ChunkCoordIntPair chunkcoordintpair) { return this.a(chunkcoordintpair); } // Paper - OBFHELPER ++ @Override public boolean a(ChunkCoordIntPair chunkcoordintpair) { + return this.a(chunkcoordintpair.pair(), (Function<PlayerChunk, CompletableFuture<Either<Chunk, PlayerChunk.Failure>>>) PlayerChunk::b); // CraftBukkit - decompile error + } + +diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java ++++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java +@@ -0,0 +0,0 @@ package net.minecraft.world.entity; + + import com.google.common.collect.ImmutableSet; + import java.util.Optional; ++import java.util.Set; // Paper + import java.util.UUID; + import java.util.function.Function; + import java.util.stream.Stream; +@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { + return new EntityTypes<>(this.a, this.b, this.d, this.e, this.f, this.g, this.c, this.j, this.h, this.i); + } + } ++ ++ // Paper start ++ public static Set<MinecraftKey> getEntityNameList() { ++ return IRegistry.ENTITY_TYPE.keySet(); ++ } ++ // Paper end + } +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public boolean populating; public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot @@ -683,8 +683,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { protected World(WorldDataMutable worlddatamutable, ResourceKey<World> resourcekey, final DimensionManager dimensionmanager, Supplier<GameProfilerFiller> supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { - this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot -+ this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((WorldDataServer) worlddatamutable).getName(), this.spigotConfig); // Paper + this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.WorldDataServer) worlddatamutable).getName()); // Spigot ++ this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.WorldDataServer) worlddatamutable).getName(), this.spigotConfig); // Paper this.generator = gen; this.world = new CraftWorld((WorldServer) this, gen, env); this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit diff --git a/Spigot-Server-Patches/Paper-dumpitem-command.patch b/Spigot-Server-Patches/Paper-dumpitem-command.patch index 95fa92841f..60e484616c 100644 --- a/Spigot-Server-Patches/Paper-dumpitem-command.patch +++ b/Spigot-Server-Patches/Paper-dumpitem-command.patch @@ -9,14 +9,14 @@ diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java -@@ -0,0 +0,0 @@ import net.minecraft.server.LightEngineThreaded; - import net.minecraft.server.MCUtil; - import net.minecraft.server.MinecraftKey; - import net.minecraft.server.MinecraftServer; -+import net.minecraft.server.NBTTagCompound; - import net.minecraft.server.PacketPlayOutLightUpdate; - import net.minecraft.server.PlayerChunk; - import net.minecraft.server.WorldServer; +@@ -0,0 +0,0 @@ import com.google.common.collect.Iterables; + import com.google.common.collect.Lists; + import com.google.common.collect.Maps; + import net.minecraft.core.BlockPosition; ++import net.minecraft.nbt.NBTTagCompound; + import net.minecraft.network.protocol.game.PacketPlayOutLightUpdate; + import net.minecraft.resources.MinecraftKey; + import com.google.gson.JsonObject; @@ -0,0 +0,0 @@ import org.bukkit.command.CommandSender; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; @@ -52,7 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + private void doDumpItem(CommandSender sender) { + ItemStack itemInHand = ((CraftPlayer) sender).getItemInHand(); -+ net.minecraft.server.ItemStack itemStack = CraftItemStack.asNMSCopy(itemInHand); ++ net.minecraft.world.item.ItemStack itemStack = CraftItemStack.asNMSCopy(itemInHand); + NBTTagCompound tag = itemStack.getTag(); + if (tag != null) { + String nbt = org.bukkit.craftbukkit.util.CraftChatMessage.fromComponent(tag.getNbtPrettyComponent()); @@ -66,10 +66,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private void doFixLight(CommandSender sender, String[] args) { if (!(sender instanceof Player)) { sender.sendMessage("Only players can use this command"); -diff --git a/src/main/java/net/minecraft/server/NBTBase.java b/src/main/java/net/minecraft/server/NBTBase.java +diff --git a/src/main/java/net/minecraft/nbt/NBTBase.java b/src/main/java/net/minecraft/nbt/NBTBase.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NBTBase.java -+++ b/src/main/java/net/minecraft/server/NBTBase.java +--- a/src/main/java/net/minecraft/nbt/NBTBase.java ++++ b/src/main/java/net/minecraft/nbt/NBTBase.java @@ -0,0 +0,0 @@ public interface NBTBase { return this.toString(); } diff --git a/Spigot-Server-Patches/Per-Player-View-Distance-API-placeholders.patch b/Spigot-Server-Patches/Per-Player-View-Distance-API-placeholders.patch index c045464602..361b134c93 100644 --- a/Spigot-Server-Patches/Per-Player-View-Distance-API-placeholders.patch +++ b/Spigot-Server-Patches/Per-Player-View-Distance-API-placeholders.patch @@ -6,27 +6,27 @@ Subject: [PATCH] Per-Player View Distance API placeholders I hope to look at this more in-depth soon. It appears doable. However this should not block the update. -diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderDragon.java -+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java @@ -0,0 +0,0 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { if (this.deathAnimationTicks == 1 && !this.isSilent()) { // CraftBukkit start - Use relative location for far away sounds // this.world.b(1028, this.getChunkCoordinates(), 0); - //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API + int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API - for (EntityPlayer player : (List<EntityPlayer>) ((WorldServer)world).getPlayers()) { + for (net.minecraft.server.level.EntityPlayer player : (List<net.minecraft.server.level.EntityPlayer>) ((WorldServer)world).getPlayers()) { - final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch + // final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch + // Paper end double deltaX = this.locX() - player.locX(); double deltaZ = this.locZ() - player.locZ(); double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; -diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java +diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityWither.java -+++ b/src/main/java/net/minecraft/server/EntityWither.java +--- a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java ++++ b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java @@ -0,0 +0,0 @@ public class EntityWither extends EntityMonster implements IRangedEntity { if (!this.isSilent()) { // CraftBukkit start - Use relative location for far away sounds diff --git a/Spigot-Server-Patches/Performance-improvement-for-Chunk.getEntities.patch b/Spigot-Server-Patches/Performance-improvement-for-Chunk.getEntities.patch index 9291f420b5..fd67b133dc 100644 --- a/Spigot-Server-Patches/Performance-improvement-for-Chunk.getEntities.patch +++ b/Spigot-Server-Patches/Performance-improvement-for-Chunk.getEntities.patch @@ -19,14 +19,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 for (int i = 0; i < 16; i++) { - - for (Object obj : chunk.entitySlices[i].toArray()) { -- if (!(obj instanceof net.minecraft.server.Entity)) { +- if (!(obj instanceof net.minecraft.world.entity.Entity)) { + // Paper start - speed up (was with chunk.entitySlices[i].toArray() and cast checks which costs a lot of performance if called often) -+ for (net.minecraft.server.Entity entity : chunk.entitySlices[i]) { ++ for (net.minecraft.world.entity.Entity entity : chunk.entitySlices[i]) { + if (entity == null) { continue; } - -- entities[index++] = ((net.minecraft.server.Entity) obj).getBukkitEntity(); +- entities[index++] = ((net.minecraft.world.entity.Entity) obj).getBukkitEntity(); + entities[index++] = entity.getBukkitEntity(); } + // Paper end diff --git a/Spigot-Server-Patches/Pillager-patrol-spawn-settings-and-per-player-option.patch b/Spigot-Server-Patches/Pillager-patrol-spawn-settings-and-per-player-option.patch index f62e681ba0..27171e38ab 100644 --- a/Spigot-Server-Patches/Pillager-patrol-spawn-settings-and-per-player-option.patch +++ b/Spigot-Server-Patches/Pillager-patrol-spawn-settings-and-per-player-option.patch @@ -35,10 +35,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean entitiesTargetWithFollowRange = false; private void entitiesTargetWithFollowRange() { entitiesTargetWithFollowRange = getBoolean("entities-target-with-follow-range", entitiesTargetWithFollowRange); -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public boolean viewingCredits; private int containerUpdateDelay; // Paper @@ -46,12 +46,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public int patrolSpawnDelay; // Paper - per player patrol spawns // Paper start - cancellable death event public boolean queueHealthUpdatePacket = false; - public net.minecraft.server.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; -diff --git a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java + public net.minecraft.network.protocol.game.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; +diff --git a/src/main/java/net/minecraft/stats/StatisticWrapper.java b/src/main/java/net/minecraft/stats/StatisticWrapper.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java -@@ -0,0 +0,0 @@ import java.util.Random; +--- a/src/main/java/net/minecraft/stats/StatisticWrapper.java ++++ b/src/main/java/net/minecraft/stats/StatisticWrapper.java +@@ -0,0 +0,0 @@ public class StatisticWrapper<T> implements Iterable<Statistic<T>> { + return this.b.values().iterator(); + } + ++ public final Statistic<T> get(T t) { return this.b(t); }; // Paper - OBFHELPER + public Statistic<T> b(T t0) { + return this.a(t0, Counter.DEFAULT); + } +diff --git a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.state.IBlockData; public class MobSpawnerPatrol implements MobSpawner { @@ -127,15 +139,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (entityhuman.isSpectator()) { return 0; -diff --git a/src/main/java/net/minecraft/server/StatisticWrapper.java b/src/main/java/net/minecraft/server/StatisticWrapper.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/StatisticWrapper.java -+++ b/src/main/java/net/minecraft/server/StatisticWrapper.java -@@ -0,0 +0,0 @@ public class StatisticWrapper<T> implements Iterable<Statistic<T>> { - return this.b.values().iterator(); - } - -+ public final Statistic<T> get(T t) { return this.b(t); }; // Paper - OBFHELPER - public Statistic<T> b(T t0) { - return this.a(t0, Counter.DEFAULT); - } diff --git a/Spigot-Server-Patches/Player-Chunk-Load-Unload-Events.patch b/Spigot-Server-Patches/Player-Chunk-Load-Unload-Events.patch index f459d9a1d7..6f8354cd9e 100644 --- a/Spigot-Server-Patches/Player-Chunk-Load-Unload-Events.patch +++ b/Spigot-Server-Patches/Player-Chunk-Load-Unload-Events.patch @@ -4,14 +4,14 @@ Date: Mon, 5 Oct 2020 21:25:16 +0200 Subject: [PATCH] Player Chunk Load/Unload Events -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -0,0 +0,0 @@ import java.util.OptionalInt; - import java.util.Random; - import java.util.UUID; - import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -0,0 +0,0 @@ import net.minecraft.world.scores.ScoreboardScore; + import net.minecraft.world.scores.ScoreboardTeam; + import net.minecraft.world.scores.ScoreboardTeamBase; + import net.minecraft.world.scores.criteria.IScoreboardCriteria; +import io.papermc.paper.event.packet.PlayerChunkLoadEvent; // Paper +import io.papermc.paper.event.packet.PlayerChunkUnloadEvent; // Paper import org.apache.logging.log4j.LogManager; diff --git a/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch b/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch index aca7ed3b94..57580bbcbd 100644 --- a/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch +++ b/Spigot-Server-Patches/Player-Tab-List-and-Title-APIs.patch @@ -4,22 +4,10 @@ Date: Thu, 3 Mar 2016 02:32:10 -0600 Subject: [PATCH] Player Tab List and Title APIs -diff --git a/src/main/java/net/minecraft/server/IChatBaseComponent.java b/src/main/java/net/minecraft/server/IChatBaseComponent.java +diff --git a/src/main/java/net/minecraft/network/PacketDataSerializer.java b/src/main/java/net/minecraft/network/PacketDataSerializer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IChatBaseComponent.java -+++ b/src/main/java/net/minecraft/server/IChatBaseComponent.java -@@ -0,0 +0,0 @@ public interface IChatBaseComponent extends Message, IChatFormatted, Iterable<IC - return IChatBaseComponent.ChatSerializer.a.toJsonTree(ichatbasecomponent); - } - -+ @Nullable public static IChatBaseComponent jsonToComponent(String json) { return a(json);} // Paper - OBFHELPER - @Nullable - public static IChatMutableComponent a(String s) { - return (IChatMutableComponent) ChatDeserializer.a(IChatBaseComponent.ChatSerializer.a, s, IChatMutableComponent.class, false); -diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketDataSerializer.java -+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java +--- a/src/main/java/net/minecraft/network/PacketDataSerializer.java ++++ b/src/main/java/net/minecraft/network/PacketDataSerializer.java @@ -0,0 +0,0 @@ public class PacketDataSerializer extends ByteBuf { public PacketDataSerializer writeComponent(final net.kyori.adventure.text.Component component) { return this.writeUtf(PaperAdventure.asJsonString(component, this.adventure$locale), 262144); @@ -32,10 +20,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Paper end public PacketDataSerializer a(IChatBaseComponent ichatbasecomponent) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java +diff --git a/src/main/java/net/minecraft/network/chat/IChatBaseComponent.java b/src/main/java/net/minecraft/network/chat/IChatBaseComponent.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutTitle.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutTitle.java +--- a/src/main/java/net/minecraft/network/chat/IChatBaseComponent.java ++++ b/src/main/java/net/minecraft/network/chat/IChatBaseComponent.java +@@ -0,0 +0,0 @@ public interface IChatBaseComponent extends Message, IChatFormatted, Iterable<IC + return IChatBaseComponent.ChatSerializer.a.toJsonTree(ichatbasecomponent); + } + ++ @Nullable public static IChatBaseComponent jsonToComponent(String json) { return a(json);} // Paper - OBFHELPER + @Nullable + public static IChatMutableComponent a(String s) { + return (IChatMutableComponent) ChatDeserializer.a(IChatBaseComponent.ChatSerializer.a, s, IChatMutableComponent.class, false); +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutTitle.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutTitle.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutTitle.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutTitle.java @@ -0,0 +0,0 @@ public class PacketPlayOutTitle implements Packet<PacketListenerPlayOut> { } diff --git a/Spigot-Server-Patches/Player-affects-spawning-API.patch b/Spigot-Server-Patches/Player-affects-spawning-API.patch index 4080986137..8efae3a5da 100644 --- a/Spigot-Server-Patches/Player-affects-spawning-API.patch +++ b/Spigot-Server-Patches/Player-affects-spawning-API.patch @@ -4,11 +4,11 @@ Date: Tue, 1 Mar 2016 14:47:52 -0600 Subject: [PATCH] Player affects spawning API -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return MathHelper.c(f * f + f1 * f1 + f2 * f2); } @@ -16,10 +16,53 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public double h(double d0, double d1, double d2) { double d3 = this.locX() - d0; double d4 = this.locY() - d1; -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { + if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL && this.L()) { + this.die(); + } else if (!this.isPersistent() && !this.isSpecialPersistence()) { +- EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D); ++ EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D, IEntitySelector.affectsSpawning); // Paper + + if (entityhuman != null) { + double d0 = entityhuman.h((Entity) this); // CraftBukkit - decompile error +diff --git a/src/main/java/net/minecraft/world/entity/IEntitySelector.java b/src/main/java/net/minecraft/world/entity/IEntitySelector.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/IEntitySelector.java ++++ b/src/main/java/net/minecraft/world/entity/IEntitySelector.java +@@ -0,0 +0,0 @@ public final class IEntitySelector { + return !entity.isSpectator(); + }; + ++ // Paper start ++ public static final Predicate<Entity> affectsSpawning = (entity) -> { ++ return !entity.isSpectator() && entity.isAlive() && (entity instanceof EntityPlayer) && ((EntityPlayer) entity).affectsSpawning; ++ }; ++ // Paper end ++ + public static Predicate<Entity> a(double d0, double d1, double d2, double d3) { + double d4 = d3 * d3; + +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntitySilverfish.java b/src/main/java/net/minecraft/world/entity/monster/EntitySilverfish.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntitySilverfish.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntitySilverfish.java +@@ -0,0 +0,0 @@ public class EntitySilverfish extends EntityMonster { + if (c(entitytypes, generatoraccess, enummobspawn, blockposition, random)) { + EntityHuman entityhuman = generatoraccess.a((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0D, true); + +- return entityhuman == null; ++ return !(entityhuman != null && !entityhuman.affectsSpawning) && entityhuman == null; // Paper - Affects Spawning API + } else { + return false; + } +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { private final ItemCooldown bM; @Nullable @@ -30,36 +73,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start public boolean fauxSleeping; -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +diff --git a/src/main/java/net/minecraft/world/level/IEntityAccess.java b/src/main/java/net/minecraft/world/level/IEntityAccess.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -0,0 +0,0 @@ public abstract class EntityInsentient extends EntityLiving { - if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL && this.L()) { - this.die(); - } else if (!this.isPersistent() && !this.isSpecialPersistence()) { -- EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D); -+ EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D, IEntitySelector.affectsSpawning); // Paper - - if (entityhuman != null) { - double d0 = entityhuman.h((Entity) this); // CraftBukkit - decompile error -diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntitySilverfish.java -+++ b/src/main/java/net/minecraft/server/EntitySilverfish.java -@@ -0,0 +0,0 @@ public class EntitySilverfish extends EntityMonster { - if (c(entitytypes, generatoraccess, enummobspawn, blockposition, random)) { - EntityHuman entityhuman = generatoraccess.a((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0D, true); - -- return entityhuman == null; -+ return !(entityhuman != null && !entityhuman.affectsSpawning) && entityhuman == null; // Paper - Affects Spawning API - } else { - return false; - } -diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IEntityAccess.java -+++ b/src/main/java/net/minecraft/server/IEntityAccess.java +--- a/src/main/java/net/minecraft/world/level/IEntityAccess.java ++++ b/src/main/java/net/minecraft/world/level/IEntityAccess.java @@ -0,0 +0,0 @@ public interface IEntityAccess { } } @@ -100,27 +117,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 default boolean isPlayerNearby(double d0, double d1, double d2, double d3) { Iterator iterator = this.getPlayers().iterator(); -diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java +diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IEntitySelector.java -+++ b/src/main/java/net/minecraft/server/IEntitySelector.java -@@ -0,0 +0,0 @@ public final class IEntitySelector { - return !entity.isSpectator(); - }; - -+ // Paper start -+ public static final Predicate<Entity> affectsSpawning = (entity) -> { -+ return !entity.isSpectator() && entity.isAlive() && (entity instanceof EntityPlayer) && ((EntityPlayer) entity).affectsSpawning; -+ }; -+ // Paper end -+ - public static Predicate<Entity> a(double d0, double d1, double d2, double d3) { - double d4 = d3 * d3; - -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { private boolean h() { BlockPosition blockposition = this.b(); diff --git a/Spigot-Server-Patches/Player.setPlayerProfile-API.patch b/Spigot-Server-Patches/Player.setPlayerProfile-API.patch index 272c06bff5..2334f176ea 100644 --- a/Spigot-Server-Patches/Player.setPlayerProfile-API.patch +++ b/Spigot-Server-Patches/Player.setPlayerProfile-API.patch @@ -5,23 +5,10 @@ Subject: [PATCH] Player.setPlayerProfile API This can be useful for changing name or skins after a player has logged in. -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - protected int bG; - protected final float bH = 0.02F; - private int g; -- private final GameProfile bJ; -+ private GameProfile bJ; public final void setProfile(final GameProfile profile) { this.bJ = profile; } // Paper - OBFHELPER - private ItemStack bL; - private final ItemCooldown bM; - @Nullable -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { public final NetworkManager networkManager; private LoginListener.EnumProtocolState g; @@ -47,6 +34,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 playerName = i.getName(); uniqueId = i.getId(); // Paper end +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { + protected int bG; + protected final float bH = 0.02F; + private int g; +- private final GameProfile bJ; ++ private GameProfile bJ; public final void setProfile(final GameProfile profile) { this.bJ = profile; } // Paper - OBFHELPER + private ItemStack bL; + private final ItemCooldown bM; + @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -118,9 +118,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + //Respawn the player then update their position and selected slot + WorldServer worldserver = handle.getWorldServer(); -+ connection.sendPacket(new net.minecraft.server.PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), net.minecraft.server.BiomeManager.a(worldserver.getSeed()), handle.playerInteractManager.getGameMode(), handle.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true)); ++ connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), net.minecraft.server.BiomeManager.a(worldserver.getSeed()), handle.playerInteractManager.getGameMode(), handle.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true)); + handle.updateAbilities(); -+ connection.sendPacket(new net.minecraft.server.PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet<>(), 0)); ++ connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet<>(), 0)); + net.minecraft.server.MinecraftServer.getServer().getPlayerList().updateClient(handle); + + if (this.isOp()) { diff --git a/Spigot-Server-Patches/PlayerAttemptPickupItemEvent.patch b/Spigot-Server-Patches/PlayerAttemptPickupItemEvent.patch index eb1b24d047..0ca1f099ec 100644 --- a/Spigot-Server-Patches/PlayerAttemptPickupItemEvent.patch +++ b/Spigot-Server-Patches/PlayerAttemptPickupItemEvent.patch @@ -4,11 +4,11 @@ Date: Sun, 11 Jun 2017 16:30:30 -0500 Subject: [PATCH] PlayerAttemptPickupItemEvent -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -0,0 +0,0 @@ import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +@@ -0,0 +0,0 @@ import net.minecraft.server.MinecraftServer; import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit end diff --git a/Spigot-Server-Patches/PlayerDeathEvent-getItemsToKeep.patch b/Spigot-Server-Patches/PlayerDeathEvent-getItemsToKeep.patch index 2273af6657..bd0e0794fc 100644 --- a/Spigot-Server-Patches/PlayerDeathEvent-getItemsToKeep.patch +++ b/Spigot-Server-Patches/PlayerDeathEvent-getItemsToKeep.patch @@ -7,10 +7,10 @@ Exposes a mutable array on items a player should keep on death Example Usage: https://gist.github.com/aikar/5bb202de6057a051a950ce1f29feb0b4 -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { }); } diff --git a/Spigot-Server-Patches/PlayerDeathEvent-shouldDropExperience.patch b/Spigot-Server-Patches/PlayerDeathEvent-shouldDropExperience.patch index dc279458f3..1b7c30e2a7 100644 --- a/Spigot-Server-Patches/PlayerDeathEvent-shouldDropExperience.patch +++ b/Spigot-Server-Patches/PlayerDeathEvent-shouldDropExperience.patch @@ -4,10 +4,10 @@ Date: Tue, 24 Dec 2019 00:35:42 +0000 Subject: [PATCH] PlayerDeathEvent#shouldDropExperience -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.eW(); } diff --git a/Spigot-Server-Patches/PlayerElytraBoostEvent.patch b/Spigot-Server-Patches/PlayerElytraBoostEvent.patch index a0401a6ec3..74483a7f8b 100644 --- a/Spigot-Server-Patches/PlayerElytraBoostEvent.patch +++ b/Spigot-Server-Patches/PlayerElytraBoostEvent.patch @@ -4,10 +4,10 @@ Date: Sat, 21 Jul 2018 01:59:59 -0500 Subject: [PATCH] PlayerElytraBoostEvent -diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java +diff --git a/src/main/java/net/minecraft/world/item/ItemFireworks.java b/src/main/java/net/minecraft/world/item/ItemFireworks.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemFireworks.java -+++ b/src/main/java/net/minecraft/server/ItemFireworks.java +--- a/src/main/java/net/minecraft/world/item/ItemFireworks.java ++++ b/src/main/java/net/minecraft/world/item/ItemFireworks.java @@ -0,0 +0,0 @@ public class ItemFireworks extends Item { // Paper start final EntityFireworks entityfireworks = new EntityFireworks(world, itemstack, entityhuman); diff --git a/Spigot-Server-Patches/PlayerLaunchProjectileEvent.patch b/Spigot-Server-Patches/PlayerLaunchProjectileEvent.patch index 93cec4f987..2e58919436 100644 --- a/Spigot-Server-Patches/PlayerLaunchProjectileEvent.patch +++ b/Spigot-Server-Patches/PlayerLaunchProjectileEvent.patch @@ -4,10 +4,10 @@ Date: Sat, 21 Jul 2018 03:11:03 -0500 Subject: [PATCH] PlayerLaunchProjectileEvent -diff --git a/src/main/java/net/minecraft/server/InteractionResultWrapper.java b/src/main/java/net/minecraft/server/InteractionResultWrapper.java +diff --git a/src/main/java/net/minecraft/world/InteractionResultWrapper.java b/src/main/java/net/minecraft/world/InteractionResultWrapper.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/InteractionResultWrapper.java -+++ b/src/main/java/net/minecraft/server/InteractionResultWrapper.java +--- a/src/main/java/net/minecraft/world/InteractionResultWrapper.java ++++ b/src/main/java/net/minecraft/world/InteractionResultWrapper.java @@ -0,0 +0,0 @@ public class InteractionResultWrapper<T> { this.b = t0; } @@ -16,10 +16,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public EnumInteractionResult a() { return this.a; } -diff --git a/src/main/java/net/minecraft/server/ItemEgg.java b/src/main/java/net/minecraft/server/ItemEgg.java +diff --git a/src/main/java/net/minecraft/world/item/ItemEgg.java b/src/main/java/net/minecraft/world/item/ItemEgg.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemEgg.java -+++ b/src/main/java/net/minecraft/server/ItemEgg.java +--- a/src/main/java/net/minecraft/world/item/ItemEgg.java ++++ b/src/main/java/net/minecraft/world/item/ItemEgg.java @@ -0,0 +0,0 @@ public class ItemEgg extends Item { entityegg.setItem(itemstack); @@ -31,18 +31,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (event.callEvent() && world.addEntity(entityegg)) { + if (event.shouldConsume() && !entityhuman.abilities.canInstantlyBuild) { + itemstack.subtract(1); -+ } else if (entityhuman instanceof EntityPlayer) { -+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); ++ } else if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) { ++ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); + } + -+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F)); ++ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (net.minecraft.world.entity.Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F)); + entityhuman.b(StatisticList.ITEM_USED.b(this)); + } else { - if (entityhuman instanceof EntityPlayer) { - ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); + if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) { + ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); } - return InteractionResultWrapper.fail(itemstack); -+ return new InteractionResultWrapper<ItemStack>(EnumInteractionResult.FAIL, itemstack); ++ return new InteractionResultWrapper<ItemStack>(net.minecraft.world.EnumInteractionResult.FAIL, itemstack); } - // CraftBukkit end + // Paper end @@ -60,10 +60,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return InteractionResultWrapper.a(itemstack, world.s_()); } -diff --git a/src/main/java/net/minecraft/server/ItemEnderPearl.java b/src/main/java/net/minecraft/server/ItemEnderPearl.java +diff --git a/src/main/java/net/minecraft/world/item/ItemEnderPearl.java b/src/main/java/net/minecraft/world/item/ItemEnderPearl.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemEnderPearl.java -+++ b/src/main/java/net/minecraft/server/ItemEnderPearl.java +--- a/src/main/java/net/minecraft/world/item/ItemEnderPearl.java ++++ b/src/main/java/net/minecraft/world/item/ItemEnderPearl.java @@ -0,0 +0,0 @@ public class ItemEnderPearl extends Item { entityenderpearl.setItem(itemstack); @@ -74,20 +74,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (event.callEvent() && world.addEntity(entityenderpearl)) { + if (event.shouldConsume() && !entityhuman.abilities.canInstantlyBuild) { + itemstack.subtract(1); -+ } else if (entityhuman instanceof EntityPlayer) { -+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); ++ } else if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) { ++ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); + } + -+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F)); ++ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (net.minecraft.world.entity.Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F)); + entityhuman.b(StatisticList.ITEM_USED.b(this)); + entityhuman.getCooldownTracker().setCooldown(this, 20); + } else { + // Paper end - if (entityhuman instanceof EntityPlayer) { - ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); + if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) { + ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); } -- return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack); -+ return new InteractionResultWrapper<ItemStack>(EnumInteractionResult.FAIL, itemstack); +- return InteractionResultWrapper.fail(itemstack); ++ return new InteractionResultWrapper<ItemStack>(net.minecraft.world.EnumInteractionResult.FAIL, itemstack); } } @@ -112,10 +112,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return InteractionResultWrapper.a(itemstack, world.s_()); } -diff --git a/src/main/java/net/minecraft/server/ItemExpBottle.java b/src/main/java/net/minecraft/server/ItemExpBottle.java +diff --git a/src/main/java/net/minecraft/world/item/ItemExpBottle.java b/src/main/java/net/minecraft/world/item/ItemExpBottle.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemExpBottle.java -+++ b/src/main/java/net/minecraft/server/ItemExpBottle.java +--- a/src/main/java/net/minecraft/world/item/ItemExpBottle.java ++++ b/src/main/java/net/minecraft/world/item/ItemExpBottle.java @@ -0,0 +0,0 @@ public class ItemExpBottle extends Item { public InteractionResultWrapper<ItemStack> a(World world, EntityHuman entityhuman, EnumHand enumhand) { ItemStack itemstack = entityhuman.b(enumhand); @@ -157,10 +157,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return InteractionResultWrapper.a(itemstack, world.s_()); } -diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java +diff --git a/src/main/java/net/minecraft/world/item/ItemFireworks.java b/src/main/java/net/minecraft/world/item/ItemFireworks.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemFireworks.java -+++ b/src/main/java/net/minecraft/server/ItemFireworks.java +--- a/src/main/java/net/minecraft/world/item/ItemFireworks.java ++++ b/src/main/java/net/minecraft/world/item/ItemFireworks.java @@ -0,0 +0,0 @@ public class ItemFireworks extends Item { EntityFireworks entityfireworks = new EntityFireworks(world, itemactioncontext.getEntity(), vec3d.x + (double) enumdirection.getAdjacentX() * 0.15D, vec3d.y + (double) enumdirection.getAdjacentY() * 0.15D, vec3d.z + (double) enumdirection.getAdjacentZ() * 0.15D, itemstack); entityfireworks.spawningEntity = itemactioncontext.getEntity().getUniqueID(); // Paper @@ -176,10 +176,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } return EnumInteractionResult.a(world.isClientSide); -diff --git a/src/main/java/net/minecraft/server/ItemLingeringPotion.java b/src/main/java/net/minecraft/server/ItemLingeringPotion.java +diff --git a/src/main/java/net/minecraft/world/item/ItemLingeringPotion.java b/src/main/java/net/minecraft/world/item/ItemLingeringPotion.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemLingeringPotion.java -+++ b/src/main/java/net/minecraft/server/ItemLingeringPotion.java +--- a/src/main/java/net/minecraft/world/item/ItemLingeringPotion.java ++++ b/src/main/java/net/minecraft/world/item/ItemLingeringPotion.java @@ -0,0 +0,0 @@ public class ItemLingeringPotion extends ItemPotionThrowable { @Override @@ -195,10 +195,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end } } -diff --git a/src/main/java/net/minecraft/server/ItemPotionThrowable.java b/src/main/java/net/minecraft/server/ItemPotionThrowable.java +diff --git a/src/main/java/net/minecraft/world/item/ItemPotionThrowable.java b/src/main/java/net/minecraft/world/item/ItemPotionThrowable.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemPotionThrowable.java -+++ b/src/main/java/net/minecraft/server/ItemPotionThrowable.java +--- a/src/main/java/net/minecraft/world/item/ItemPotionThrowable.java ++++ b/src/main/java/net/minecraft/world/item/ItemPotionThrowable.java @@ -0,0 +0,0 @@ public class ItemPotionThrowable extends ItemPotion { entitypotion.setItem(itemstack); @@ -232,10 +232,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return InteractionResultWrapper.a(itemstack, world.s_()); } -diff --git a/src/main/java/net/minecraft/server/ItemSnowball.java b/src/main/java/net/minecraft/server/ItemSnowball.java +diff --git a/src/main/java/net/minecraft/world/item/ItemSnowball.java b/src/main/java/net/minecraft/world/item/ItemSnowball.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemSnowball.java -+++ b/src/main/java/net/minecraft/server/ItemSnowball.java +--- a/src/main/java/net/minecraft/world/item/ItemSnowball.java ++++ b/src/main/java/net/minecraft/world/item/ItemSnowball.java @@ -0,0 +0,0 @@ public class ItemSnowball extends Item { entitysnowball.setItem(itemstack); @@ -248,23 +248,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + if (event.shouldConsume() && !entityhuman.abilities.canInstantlyBuild) { + // Paper end itemstack.subtract(1); -+ } else if (entityhuman instanceof EntityPlayer) { // Paper -+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // Paper ++ } else if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) { // Paper ++ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // Paper } world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.RANDOM.nextFloat() * 0.4F + 0.8F)); -- } else if (entityhuman instanceof EntityPlayer) { -- ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); +- } else if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) { +- ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); + } else { // Paper -+ if (entityhuman instanceof EntityPlayer) ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // Paper -+ return new InteractionResultWrapper<ItemStack>(EnumInteractionResult.FAIL, itemstack); // Paper ++ if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // Paper ++ return new InteractionResultWrapper<ItemStack>(net.minecraft.world.EnumInteractionResult.FAIL, itemstack); // Paper } } // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/ItemSplashPotion.java b/src/main/java/net/minecraft/server/ItemSplashPotion.java +diff --git a/src/main/java/net/minecraft/world/item/ItemSplashPotion.java b/src/main/java/net/minecraft/world/item/ItemSplashPotion.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemSplashPotion.java -+++ b/src/main/java/net/minecraft/server/ItemSplashPotion.java +--- a/src/main/java/net/minecraft/world/item/ItemSplashPotion.java ++++ b/src/main/java/net/minecraft/world/item/ItemSplashPotion.java @@ -0,0 +0,0 @@ public class ItemSplashPotion extends ItemPotionThrowable { @Override diff --git a/Spigot-Server-Patches/PlayerNaturallySpawnCreaturesEvent.patch b/Spigot-Server-Patches/PlayerNaturallySpawnCreaturesEvent.patch index c726713c3b..b9cb94235e 100644 --- a/Spigot-Server-Patches/PlayerNaturallySpawnCreaturesEvent.patch +++ b/Spigot-Server-Patches/PlayerNaturallySpawnCreaturesEvent.patch @@ -8,10 +8,10 @@ from triggering monster spawns on a server. Also a highly more effecient way to blanket block spawns in a world -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { this.world.getMethodProfiler().exit(); //List<PlayerChunk> list = Lists.newArrayList(this.playerChunkMap.f()); // Paper @@ -28,12 +28,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.playerChunkMap.f().forEach((playerchunk) -> { // Paper - no... just no... Optional<Chunk> optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.server.level; +import com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent; import com.google.common.collect.Lists; @@ -47,10 +47,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> cachedSingleHashSet; // Paper -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { chunkRange = (chunkRange > world.spigotConfig.viewDistance) ? (byte) world.spigotConfig.viewDistance : chunkRange; chunkRange = (chunkRange > 8) ? 8 : chunkRange; diff --git a/Spigot-Server-Patches/PlayerPickupExperienceEvent.patch b/Spigot-Server-Patches/PlayerPickupExperienceEvent.patch index 70063a890d..d5411bf47b 100644 --- a/Spigot-Server-Patches/PlayerPickupExperienceEvent.patch +++ b/Spigot-Server-Patches/PlayerPickupExperienceEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PlayerPickupExperienceEvent Allows plugins to cancel a player picking up an experience orb -diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java -+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java +--- a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java ++++ b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java @@ -0,0 +0,0 @@ public class EntityExperienceOrb extends Entity { @Override public void pickup(EntityHuman entityhuman) { diff --git a/Spigot-Server-Patches/PlayerPickupItemEvent-setFlyAtPlayer.patch b/Spigot-Server-Patches/PlayerPickupItemEvent-setFlyAtPlayer.patch index 6c59e67e5f..9a7db230fd 100644 --- a/Spigot-Server-Patches/PlayerPickupItemEvent-setFlyAtPlayer.patch +++ b/Spigot-Server-Patches/PlayerPickupItemEvent-setFlyAtPlayer.patch @@ -4,10 +4,10 @@ Date: Sun, 7 May 2017 06:26:09 -0500 Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java +--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java @@ -0,0 +0,0 @@ public class EntityItem extends Entity { // CraftBukkit start - fire PlayerPickupItemEvent int canHold = entityhuman.inventory.canHold(itemstack); diff --git a/Spigot-Server-Patches/PlayerReadyArrowEvent.patch b/Spigot-Server-Patches/PlayerReadyArrowEvent.patch index 4ad7b23b19..bf25e73e68 100644 --- a/Spigot-Server-Patches/PlayerReadyArrowEvent.patch +++ b/Spigot-Server-Patches/PlayerReadyArrowEvent.patch @@ -6,10 +6,10 @@ Subject: [PATCH] PlayerReadyArrowEvent Called when a player is firing a bow and the server is choosing an arrow to use. Plugins can skip selection of certain arrows and control which is used. -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { return ImmutableList.of(EntityPose.STANDING, EntityPose.CROUCHING, EntityPose.SWIMMING); } diff --git a/Spigot-Server-Patches/PlayerTeleportEndGatewayEvent.patch b/Spigot-Server-Patches/PlayerTeleportEndGatewayEvent.patch index 84244eeeb4..2a4a0e5aca 100644 --- a/Spigot-Server-Patches/PlayerTeleportEndGatewayEvent.patch +++ b/Spigot-Server-Patches/PlayerTeleportEndGatewayEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PlayerTeleportEndGatewayEvent Allows you to access the Gateway being used in a teleport event -diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java -+++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java @@ -0,0 +0,0 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick location.setPitch(player.getLocation().getPitch()); location.setYaw(player.getLocation().getYaw()); diff --git a/Spigot-Server-Patches/PortalCreateEvent-needs-to-know-its-entity.patch b/Spigot-Server-Patches/PortalCreateEvent-needs-to-know-its-entity.patch index bafc0a0fba..771b2a7459 100644 --- a/Spigot-Server-Patches/PortalCreateEvent-needs-to-know-its-entity.patch +++ b/Spigot-Server-Patches/PortalCreateEvent-needs-to-know-its-entity.patch @@ -4,27 +4,23 @@ Date: Fri, 21 Aug 2020 20:57:54 +0200 Subject: [PATCH] PortalCreateEvent needs to know its entity -diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockBase.java -+++ b/src/main/java/net/minecraft/server/BlockBase.java -@@ -0,0 +0,0 @@ public abstract class BlockBase { - PacketDebug.a(world, blockposition); - } +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -0,0 +0,0 @@ public final class ItemStack { + IBlockData block = world.getType(newblockposition); -+ // Paper start - add ItemActionContext param -+ @Deprecated -+ public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag, ItemActionContext itemActionContext) { -+ this.onPlace(iblockdata, world, blockposition, iblockdata1, flag); -+ } -+ // Paper end - @Deprecated - public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) { - org.spigotmc.AsyncCatcher.catchOp("block onPlace"); // Spigot -diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java + if (!(block.getBlock() instanceof BlockTileEntity)) { // Containers get placed automatically +- block.getBlock().onPlace(block, world, newblockposition, oldBlock, true); ++ block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, itemactioncontext); // Paper - pass itemactioncontext + } + + world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getType(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point +diff --git a/src/main/java/net/minecraft/world/level/block/BlockFire.java b/src/main/java/net/minecraft/world/level/block/BlockFire.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockFire.java -+++ b/src/main/java/net/minecraft/server/BlockFire.java +--- a/src/main/java/net/minecraft/world/level/block/BlockFire.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockFire.java @@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract { } @@ -38,10 +34,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 world.getBlockTickList().a(blockposition, this, a(world.random)); } -diff --git a/src/main/java/net/minecraft/server/BlockFireAbstract.java b/src/main/java/net/minecraft/server/BlockFireAbstract.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockFireAbstract.java b/src/main/java/net/minecraft/world/level/block/BlockFireAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockFireAbstract.java -+++ b/src/main/java/net/minecraft/server/BlockFireAbstract.java +--- a/src/main/java/net/minecraft/world/level/block/BlockFireAbstract.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockFireAbstract.java @@ -0,0 +0,0 @@ public abstract class BlockFireAbstract extends Block { super.a(iblockdata, world, blockposition, entity); } @@ -62,10 +58,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return; } } -diff --git a/src/main/java/net/minecraft/server/BlockPortalShape.java b/src/main/java/net/minecraft/server/BlockPortalShape.java +diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockPortalShape.java -+++ b/src/main/java/net/minecraft/server/BlockPortalShape.java +--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java ++++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +@@ -0,0 +0,0 @@ public abstract class BlockBase { + PacketDebug.a(world, blockposition); + } + ++ // Paper start - add ItemActionContext param ++ @Deprecated ++ public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag, ItemActionContext itemActionContext) { ++ this.onPlace(iblockdata, world, blockposition, iblockdata1, flag); ++ } ++ // Paper end + @Deprecated + public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) { + org.spigotmc.AsyncCatcher.catchOp("block onPlace"); // Spigot +diff --git a/src/main/java/net/minecraft/world/level/portal/BlockPortalShape.java b/src/main/java/net/minecraft/world/level/portal/BlockPortalShape.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/portal/BlockPortalShape.java ++++ b/src/main/java/net/minecraft/world/level/portal/BlockPortalShape.java @@ -0,0 +0,0 @@ public class BlockPortalShape { } @@ -87,16 +100,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.b.getMinecraftWorld().getMinecraftServer().server.getPluginManager().callEvent(event); if (event.isCancelled()) { -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - IBlockData block = world.getType(newblockposition); - - if (!(block.getBlock() instanceof BlockTileEntity)) { // Containers get placed automatically -- block.getBlock().onPlace(block, world, newblockposition, oldBlock, true); -+ block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, itemactioncontext); // Paper - pass itemactioncontext - } - - world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getType(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point diff --git a/Spigot-Server-Patches/PreCreatureSpawnEvent.patch b/Spigot-Server-Patches/PreCreatureSpawnEvent.patch index 552cd98968..a1ee0f2024 100644 --- a/Spigot-Server-Patches/PreCreatureSpawnEvent.patch +++ b/Spigot-Server-Patches/PreCreatureSpawnEvent.patch @@ -14,10 +14,10 @@ instead and save a lot of server resources. See: https://github.com/PaperMC/Paper/issues/917 -diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTypes.java -+++ b/src/main/java/net/minecraft/server/EntityTypes.java +--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java ++++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java @@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { @Nullable @@ -39,10 +39,31 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 T t0 = this.createCreature(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1); if (t0 != null) { -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/SensorGolemLastSeen.java b/src/main/java/net/minecraft/world/entity/ai/sensing/SensorGolemLastSeen.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVillager.java -+++ b/src/main/java/net/minecraft/server/EntityVillager.java +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/SensorGolemLastSeen.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/SensorGolemLastSeen.java +@@ -0,0 +0,0 @@ public class SensorGolemLastSeen extends Sensor<EntityLiving> { + Optional<List<EntityLiving>> optional = entityliving.getBehaviorController().getMemory(MemoryModuleType.MOBS); + + if (optional.isPresent()) { +- boolean flag = ((List) optional.get()).stream().anyMatch((entityliving1) -> { ++ boolean flag = optional.get().stream().anyMatch((entityliving1) -> { // Paper - decompile fixes + return entityliving1.getEntityType().equals(EntityTypes.IRON_GOLEM); + }); + +@@ -0,0 +0,0 @@ public class SensorGolemLastSeen extends Sensor<EntityLiving> { + } + } + ++ public static void setDetectedRecently(EntityLiving entityLiving) { b(entityLiving); } // Paper - OBFHELPER + public static void b(EntityLiving entityliving) { + entityliving.getBehaviorController().a(MemoryModuleType.GOLEM_DETECTED_RECENTLY, true, 600L); + } +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java @@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation BlockPosition blockposition1 = this.a(blockposition, d0, d1); @@ -65,10 +86,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 EntityIronGolem entityirongolem = (EntityIronGolem) EntityTypes.IRON_GOLEM.createCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition1, EnumMobSpawn.MOB_SUMMONED, false, false); if (entityirongolem != null) { -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { WorldServer worldserver = (WorldServer) world; @@ -97,31 +118,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Entity entity = EntityTypes.a(nbttagcompound, world, (entity1) -> { entity1.setPositionRotation(d3, d4, d5, entity1.yaw, entity1.pitch); return entity1; -diff --git a/src/main/java/net/minecraft/server/SensorGolemLastSeen.java b/src/main/java/net/minecraft/server/SensorGolemLastSeen.java +diff --git a/src/main/java/net/minecraft/world/level/SpawnerCreature.java b/src/main/java/net/minecraft/world/level/SpawnerCreature.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SensorGolemLastSeen.java -+++ b/src/main/java/net/minecraft/server/SensorGolemLastSeen.java -@@ -0,0 +0,0 @@ public class SensorGolemLastSeen extends Sensor<EntityLiving> { - Optional<List<EntityLiving>> optional = entityliving.getBehaviorController().getMemory(MemoryModuleType.MOBS); - - if (optional.isPresent()) { -- boolean flag = ((List) optional.get()).stream().anyMatch((entityliving1) -> { -+ boolean flag = optional.get().stream().anyMatch((entityliving1) -> { // Paper - decompile fixes - return entityliving1.getEntityType().equals(EntityTypes.IRON_GOLEM); - }); - -@@ -0,0 +0,0 @@ public class SensorGolemLastSeen extends Sensor<EntityLiving> { - } - } - -+ public static void setDetectedRecently(EntityLiving entityLiving) { b(entityLiving); } // Paper - OBFHELPER - public static void b(EntityLiving entityliving) { - entityliving.getBehaviorController().a(MemoryModuleType.GOLEM_DETECTED_RECENTLY, true, 600L); - } -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +--- a/src/main/java/net/minecraft/world/level/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/world/level/SpawnerCreature.java @@ -0,0 +0,0 @@ public final class SpawnerCreature { j1 = biomesettingsmobs_c.d + worldserver.random.nextInt(1 + biomesettingsmobs_c.e - biomesettingsmobs_c.d); } diff --git a/Spigot-Server-Patches/PreSpawnerSpawnEvent.patch b/Spigot-Server-Patches/PreSpawnerSpawnEvent.patch index 5414464a17..94237a3916 100644 --- a/Spigot-Server-Patches/PreSpawnerSpawnEvent.patch +++ b/Spigot-Server-Patches/PreSpawnerSpawnEvent.patch @@ -8,10 +8,10 @@ which contains the location of the spawner too similarly to how the SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for spawners. -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); diff --git a/Spigot-Server-Patches/Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/Spigot-Server-Patches/Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index 9b69cf36ed..02b5ece6c2 100644 --- a/Spigot-Server-Patches/Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/Spigot-Server-Patches/Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Prevent Double PlayerChunkMap adds crashing server Suspected case would be around the technique used in .stopRiding Stack will identify any causer of this and warn instead of crashing. -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { protected void addEntity(Entity entity) { @@ -25,10 +25,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!(entity instanceof EntityComplexPart)) { EntityTypes<?> entitytypes = entity.getEntityType(); int i = entitytypes.getChunkRange() * 16; -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { } } diff --git a/Spigot-Server-Patches/Prevent-Enderman-from-loading-chunks.patch b/Spigot-Server-Patches/Prevent-Enderman-from-loading-chunks.patch index ba4f7579a6..bab84959c8 100644 --- a/Spigot-Server-Patches/Prevent-Enderman-from-loading-chunks.patch +++ b/Spigot-Server-Patches/Prevent-Enderman-from-loading-chunks.patch @@ -4,10 +4,10 @@ Date: Tue, 18 Dec 2018 02:15:08 +0000 Subject: [PATCH] Prevent Enderman from loading chunks -diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderman.java -+++ b/src/main/java/net/minecraft/server/EntityEnderman.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java @@ -0,0 +0,0 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { int j = MathHelper.floor(this.enderman.locY() + random.nextDouble() * 3.0D); int k = MathHelper.floor(this.enderman.locZ() - 2.0D + random.nextDouble() * 4.0D); diff --git a/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks-wrongly-spread.patch b/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks-wrongly-spread.patch index 1f9fd7d560..1eb84b0a16 100644 --- a/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks-wrongly-spread.patch +++ b/Spigot-Server-Patches/Prevent-Fire-from-loading-chunks-wrongly-spread.patch @@ -8,10 +8,10 @@ bad behavior. This also stops fire from spreading to illegal locations. -diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockFire.java b/src/main/java/net/minecraft/world/level/block/BlockFire.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockFire.java -+++ b/src/main/java/net/minecraft/server/BlockFire.java +--- a/src/main/java/net/minecraft/world/level/block/BlockFire.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockFire.java @@ -0,0 +0,0 @@ public class BlockFire extends BlockFireAbstract { BlockStateBoolean blockstateboolean = (BlockStateBoolean) BlockFire.h.get(enumdirection); diff --git a/Spigot-Server-Patches/Prevent-Frosted-Ice-from-loading-holding-chunks.patch b/Spigot-Server-Patches/Prevent-Frosted-Ice-from-loading-holding-chunks.patch index b065e63281..5d0f3bba85 100644 --- a/Spigot-Server-Patches/Prevent-Frosted-Ice-from-loading-holding-chunks.patch +++ b/Spigot-Server-Patches/Prevent-Frosted-Ice-from-loading-holding-chunks.patch @@ -4,10 +4,10 @@ Date: Sat, 10 Mar 2018 16:33:15 -0500 Subject: [PATCH] Prevent Frosted Ice from loading/holding chunks -diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java b/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockIceFrost.java -+++ b/src/main/java/net/minecraft/server/BlockIceFrost.java +--- a/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java @@ -0,0 +0,0 @@ public class BlockIceFrost extends BlockIce { EnumDirection enumdirection = aenumdirection[j]; diff --git a/Spigot-Server-Patches/Prevent-Mob-AI-Rules-from-Loading-Chunks.patch b/Spigot-Server-Patches/Prevent-Mob-AI-Rules-from-Loading-Chunks.patch index aaff23aa35..1d5a25f9d3 100644 --- a/Spigot-Server-Patches/Prevent-Mob-AI-Rules-from-Loading-Chunks.patch +++ b/Spigot-Server-Patches/Prevent-Mob-AI-Rules-from-Loading-Chunks.patch @@ -4,10 +4,10 @@ Date: Mon, 10 Sep 2018 23:56:36 -0400 Subject: [PATCH] Prevent Mob AI Rules from Loading Chunks -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java b/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalRemoveBlock.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalRemoveBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalRemoveBlock.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalRemoveBlock.java @@ -0,0 +0,0 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget { private final Block g; private final EntityInsentient entity; @@ -51,10 +51,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return ichunkaccess == null ? false : ichunkaccess.getType(blockposition).a(this.g) && ichunkaccess.getType(blockposition.up()).isAir() && ichunkaccess.getType(blockposition.up(2)).isAir(); } -diff --git a/src/main/java/net/minecraft/server/RandomPositionGenerator.java b/src/main/java/net/minecraft/server/RandomPositionGenerator.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/util/RandomPositionGenerator.java b/src/main/java/net/minecraft/world/entity/ai/util/RandomPositionGenerator.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RandomPositionGenerator.java -+++ b/src/main/java/net/minecraft/server/RandomPositionGenerator.java +--- a/src/main/java/net/minecraft/world/entity/ai/util/RandomPositionGenerator.java ++++ b/src/main/java/net/minecraft/world/entity/ai/util/RandomPositionGenerator.java @@ -0,0 +0,0 @@ public class RandomPositionGenerator { } diff --git a/Spigot-Server-Patches/Prevent-Pathfinding-out-of-World-Border.patch b/Spigot-Server-Patches/Prevent-Pathfinding-out-of-World-Border.patch index efdf33ecfd..7bdbb9ac65 100644 --- a/Spigot-Server-Patches/Prevent-Pathfinding-out-of-World-Border.patch +++ b/Spigot-Server-Patches/Prevent-Pathfinding-out-of-World-Border.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent Pathfinding out of World Border This prevents Entities from trying to run outside of the World Border -diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NavigationAbstract.java -+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java @@ -0,0 +0,0 @@ public abstract class NavigationAbstract { // Paper start - Pathfind event boolean copiedSet = false; 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 f868d1ed02..d54f129f34 100644 --- a/Spigot-Server-Patches/Prevent-Saving-Bad-entities-to-chunks.patch +++ b/Spigot-Server-Patches/Prevent-Saving-Bad-entities-to-chunks.patch @@ -17,10 +17,48 @@ 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 +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + List[] aentityslice = chunk.getEntitySlices(); // Spigot + int i = aentityslice.length; + ++ java.util.List<Entity> toMoveChunks = new java.util.ArrayList<>(); // Paper + for (int j = 0; j < i; ++j) { + List<Entity> entityslice = aentityslice[j]; // Spigot + Iterator iterator = entityslice.iterator(); +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + throw (IllegalStateException) SystemUtils.c((Throwable) (new IllegalStateException("Removing entity while ticking!"))); + } + ++ // Paper start - move out entities that shouldn't be in this chunk before it unloads ++ if (!entity.dead && (int) Math.floor(entity.locX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.locZ()) >> 4 != chunk.getPos().z) { ++ toMoveChunks.add(entity); ++ continue; ++ } ++ // Paper end ++ + this.entitiesById.remove(entity.getId()); + this.unregisterEntity(entity); ++ ++ if (entity.dead) iterator.remove(); // Paper - don't save dead entities during unload + } + } + } ++ // Paper start - move out entities that shouldn't be in this chunk before it unloads ++ for (Entity entity : toMoveChunks) { ++ this.chunkCheck(entity); ++ } ++ // Paper end + + } + +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java @@ -0,0 +0,0 @@ public class ChunkRegionLoader { nbttagcompound1.set("TileEntities", nbttaglist1); NBTTagList nbttaglist2 = new NBTTagList(); @@ -79,41 +117,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static ChunkStatus.Type a(@Nullable NBTTagCompound nbttagcompound) { if (nbttagcompound != null) { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - List[] aentityslice = chunk.getEntitySlices(); // Spigot - int i = aentityslice.length; - -+ java.util.List<Entity> toMoveChunks = new java.util.ArrayList<>(); // Paper - for (int j = 0; j < i; ++j) { - List<Entity> entityslice = aentityslice[j]; // Spigot - Iterator iterator = entityslice.iterator(); -@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { - throw (IllegalStateException) SystemUtils.c((Throwable) (new IllegalStateException("Removing entity while ticking!"))); - } - -+ // Paper start - move out entities that shouldn't be in this chunk before it unloads -+ if (!entity.dead && (int) Math.floor(entity.locX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.locZ()) >> 4 != chunk.getPos().z) { -+ toMoveChunks.add(entity); -+ continue; -+ } -+ // Paper end -+ - this.entitiesById.remove(entity.getId()); - this.unregisterEntity(entity); -+ -+ if (entity.dead) iterator.remove(); // Paper - don't save dead entities during unload - } - } - } -+ // Paper start - move out entities that shouldn't be in this chunk before it unloads -+ for (Entity entity : toMoveChunks) { -+ this.chunkCheck(entity); -+ } -+ // Paper end - - } - diff --git a/Spigot-Server-Patches/Prevent-bees-loading-chunks-checking-hive-position.patch b/Spigot-Server-Patches/Prevent-bees-loading-chunks-checking-hive-position.patch index 98f76a5752..8a44e1a9a2 100644 --- a/Spigot-Server-Patches/Prevent-bees-loading-chunks-checking-hive-position.patch +++ b/Spigot-Server-Patches/Prevent-bees-loading-chunks-checking-hive-position.patch @@ -4,10 +4,10 @@ Date: Sun, 5 Jan 2020 17:24:34 -0600 Subject: [PATCH] Prevent bees loading chunks checking hive position -diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/net/minecraft/server/EntityBee.java +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityBee.java b/src/main/java/net/minecraft/world/entity/animal/EntityBee.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityBee.java -+++ b/src/main/java/net/minecraft/server/EntityBee.java +--- a/src/main/java/net/minecraft/world/entity/animal/EntityBee.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityBee.java @@ -0,0 +0,0 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB if (!this.hasHivePos()) { return false; diff --git a/Spigot-Server-Patches/Prevent-chunk-loading-from-Fluid-Flowing.patch b/Spigot-Server-Patches/Prevent-chunk-loading-from-Fluid-Flowing.patch index cee5d09414..cb1c5d32eb 100644 --- a/Spigot-Server-Patches/Prevent-chunk-loading-from-Fluid-Flowing.patch +++ b/Spigot-Server-Patches/Prevent-chunk-loading-from-Fluid-Flowing.patch @@ -4,10 +4,10 @@ Date: Mon, 10 Sep 2018 23:36:16 -0400 Subject: [PATCH] Prevent chunk loading from Fluid Flowing -diff --git a/src/main/java/net/minecraft/server/FluidTypeFlowing.java b/src/main/java/net/minecraft/server/FluidTypeFlowing.java +diff --git a/src/main/java/net/minecraft/world/level/material/FluidTypeFlowing.java b/src/main/java/net/minecraft/world/level/material/FluidTypeFlowing.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/FluidTypeFlowing.java -+++ b/src/main/java/net/minecraft/server/FluidTypeFlowing.java +--- a/src/main/java/net/minecraft/world/level/material/FluidTypeFlowing.java ++++ b/src/main/java/net/minecraft/world/level/material/FluidTypeFlowing.java @@ -0,0 +0,0 @@ public abstract class FluidTypeFlowing extends FluidType { EnumDirection enumdirection = (EnumDirection) entry.getKey(); Fluid fluid1 = (Fluid) entry.getValue(); diff --git a/Spigot-Server-Patches/Prevent-consuming-the-wrong-itemstack.patch b/Spigot-Server-Patches/Prevent-consuming-the-wrong-itemstack.patch index 9fd43d010a..30b5b05e1b 100644 --- a/Spigot-Server-Patches/Prevent-consuming-the-wrong-itemstack.patch +++ b/Spigot-Server-Patches/Prevent-consuming-the-wrong-itemstack.patch @@ -4,10 +4,10 @@ Date: Mon, 19 Aug 2019 19:42:35 +0500 Subject: [PATCH] Prevent consuming the wrong itemstack -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { this.datawatcher.set(EntityLiving.ag, (byte) j); } diff --git a/Spigot-Server-Patches/Prevent-grindstones-from-overstacking-items.patch b/Spigot-Server-Patches/Prevent-grindstones-from-overstacking-items.patch index 75fbd9a79d..c3b1391c76 100644 --- a/Spigot-Server-Patches/Prevent-grindstones-from-overstacking-items.patch +++ b/Spigot-Server-Patches/Prevent-grindstones-from-overstacking-items.patch @@ -4,10 +4,10 @@ Date: Tue, 16 Feb 2021 21:37:51 -0600 Subject: [PATCH] Prevent grindstones from overstacking items -diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/main/java/net/minecraft/server/ContainerGrindstone.java +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java b/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ContainerGrindstone.java -+++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java +--- a/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java @@ -0,0 +0,0 @@ public class ContainerGrindstone extends Container { i = Math.max(item.getMaxDurability() - l, 0); itemstack2 = this.b(itemstack, itemstack1); diff --git a/Spigot-Server-Patches/Prevent-headless-pistons-from-being-created.patch b/Spigot-Server-Patches/Prevent-headless-pistons-from-being-created.patch index 8c7e0dc7a6..9107c929b7 100644 --- a/Spigot-Server-Patches/Prevent-headless-pistons-from-being-created.patch +++ b/Spigot-Server-Patches/Prevent-headless-pistons-from-being-created.patch @@ -22,10 +22,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public static int playerAutoSaveRate = -1; public static int maxPlayerAutoSavePerTick = 10; private static void playerAutoSaveRate() { -diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java +diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Explosion.java -+++ b/src/main/java/net/minecraft/server/Explosion.java +--- a/src/main/java/net/minecraft/world/level/Explosion.java ++++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -0,0 +0,0 @@ public class Explosion { if (f > 0.0F && this.l.a(this, this.world, blockposition, iblockdata, f) && blockposition.getY() < 256 && blockposition.getY() >= 0) { // CraftBukkit - don't wrap explosions @@ -42,10 +42,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } d4 += d0 * 0.30000001192092896D; -diff --git a/src/main/java/net/minecraft/server/TileEntityPiston.java b/src/main/java/net/minecraft/server/TileEntityPiston.java +diff --git a/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java b/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntityPiston.java -+++ b/src/main/java/net/minecraft/server/TileEntityPiston.java +--- a/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java ++++ b/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java @@ -0,0 +0,0 @@ public class TileEntityPiston extends TileEntity implements ITickable { return this.b; } diff --git a/Spigot-Server-Patches/Prevent-logins-from-being-processed-when-the-player-.patch b/Spigot-Server-Patches/Prevent-logins-from-being-processed-when-the-player-.patch index f020fa950d..fb1add08b3 100644 --- a/Spigot-Server-Patches/Prevent-logins-from-being-processed-when-the-player-.patch +++ b/Spigot-Server-Patches/Prevent-logins-from-being-processed-when-the-player-.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent logins from being processed when the player has disconnected -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java @@ -0,0 +0,0 @@ public class LoginListener implements PacketLoginInListener { } // Paper end 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 4bf4c43577..44fda99a69 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 @@ -5,10 +5,10 @@ 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 +diff --git a/src/main/java/net/minecraft/world/level/SpawnerCreature.java b/src/main/java/net/minecraft/world/level/SpawnerCreature.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +--- a/src/main/java/net/minecraft/world/level/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/world/level/SpawnerCreature.java @@ -0,0 +0,0 @@ public final class SpawnerCreature { StructureManager structuremanager = worldserver.getStructureManager(); ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator(); diff --git a/Spigot-Server-Patches/Prevent-opening-inventories-when-frozen.patch b/Spigot-Server-Patches/Prevent-opening-inventories-when-frozen.patch index 8d865f8f1d..cfa0abdec3 100644 --- a/Spigot-Server-Patches/Prevent-opening-inventories-when-frozen.patch +++ b/Spigot-Server-Patches/Prevent-opening-inventories-when-frozen.patch @@ -4,10 +4,10 @@ Date: Mon, 13 Apr 2020 07:31:44 +0100 Subject: [PATCH] Prevent opening inventories when frozen -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { containerUpdateDelay = world.paperConfig.containerUpdateTickRate; } diff --git a/Spigot-Server-Patches/Prevent-position-desync-in-playerconnection-causing-.patch b/Spigot-Server-Patches/Prevent-position-desync-in-playerconnection-causing-.patch index 995af88640..52ab763df6 100644 --- a/Spigot-Server-Patches/Prevent-position-desync-in-playerconnection-causing-.patch +++ b/Spigot-Server-Patches/Prevent-position-desync-in-playerconnection-causing-.patch @@ -13,10 +13,10 @@ to fix all exploits derieved from this usually unexpected behaviour, we need to move all of this dangerous logic outside of the move call and into an appropriate place in the tick method. -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9)); diff --git a/Spigot-Server-Patches/Prevent-rayTrace-from-loading-chunks.patch b/Spigot-Server-Patches/Prevent-rayTrace-from-loading-chunks.patch index 74fc4d1c1d..62fe4453fe 100644 --- a/Spigot-Server-Patches/Prevent-rayTrace-from-loading-chunks.patch +++ b/Spigot-Server-Patches/Prevent-rayTrace-from-loading-chunks.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Prevent rayTrace from loading chunks ray tracing into an unloaded chunk should be treated as a miss this saves a ton of lag for when AI tries to raytrace near unloaded chunks. -diff --git a/src/main/java/net/minecraft/server/IBlockAccess.java b/src/main/java/net/minecraft/server/IBlockAccess.java +diff --git a/src/main/java/net/minecraft/world/level/IBlockAccess.java b/src/main/java/net/minecraft/world/level/IBlockAccess.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IBlockAccess.java -+++ b/src/main/java/net/minecraft/server/IBlockAccess.java +--- a/src/main/java/net/minecraft/world/level/IBlockAccess.java ++++ b/src/main/java/net/minecraft/world/level/IBlockAccess.java @@ -0,0 +0,0 @@ public interface IBlockAccess { // CraftBukkit start - moved block handling into separate method for use by Block#rayTrace diff --git a/Spigot-Server-Patches/Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch b/Spigot-Server-Patches/Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch index 78f68b2fd3..db4c238489 100644 --- a/Spigot-Server-Patches/Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch +++ b/Spigot-Server-Patches/Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch @@ -4,10 +4,10 @@ Date: Mon, 13 Jan 2020 23:47:28 -0600 Subject: [PATCH] Prevent sync chunk loads when villagers try to find beds -diff --git a/src/main/java/net/minecraft/server/BehaviorSleep.java b/src/main/java/net/minecraft/server/BehaviorSleep.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorSleep.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorSleep.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BehaviorSleep.java -+++ b/src/main/java/net/minecraft/server/BehaviorSleep.java +--- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorSleep.java ++++ b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorSleep.java @@ -0,0 +0,0 @@ public class BehaviorSleep extends Behavior<EntityLiving> { } } diff --git a/Spigot-Server-Patches/Prevent-teleporting-dead-entities.patch b/Spigot-Server-Patches/Prevent-teleporting-dead-entities.patch index 18f4f26aad..727d717e69 100644 --- a/Spigot-Server-Patches/Prevent-teleporting-dead-entities.patch +++ b/Spigot-Server-Patches/Prevent-teleporting-dead-entities.patch @@ -4,10 +4,10 @@ Date: Tue, 3 Mar 2020 05:26:40 +0000 Subject: [PATCH] Prevent teleporting dead entities -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { } diff --git a/Spigot-Server-Patches/Prevent-tile-entity-and-entity-crashes.patch b/Spigot-Server-Patches/Prevent-tile-entity-and-entity-crashes.patch index 5a70440870..f91eccc0a1 100644 --- a/Spigot-Server-Patches/Prevent-tile-entity-and-entity-crashes.patch +++ b/Spigot-Server-Patches/Prevent-tile-entity-and-entity-crashes.patch @@ -4,28 +4,10 @@ Date: Tue, 1 Mar 2016 23:52:34 -0600 Subject: [PATCH] Prevent tile entity and entity crashes -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 - return IRegistry.BLOCK_ENTITY_TYPE.getKey(this.getTileType()) + " // " + this.getClass().getCanonicalName(); - }); - if (this.world != null) { -- CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.getBlock()); -+ // Paper start - Prevent TileEntity and Entity crashes -+ IBlockData block = this.getBlock(); -+ if (block != null) { -+ CrashReportSystemDetails.a(crashreportsystemdetails, this.position, block); -+ } -+ // Paper end - CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.world.getType(this.position)); - } - } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { gameprofilerfiller.exit(); @@ -63,3 +45,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +@@ -0,0 +0,0 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / + return IRegistry.BLOCK_ENTITY_TYPE.getKey(this.getTileType()) + " // " + this.getClass().getCanonicalName(); + }); + if (this.world != null) { +- CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.getBlock()); ++ // Paper start - Prevent TileEntity and Entity crashes ++ IBlockData block = this.getBlock(); ++ if (block != null) { ++ CrashReportSystemDetails.a(crashreportsystemdetails, this.position, block); ++ } ++ // Paper end + CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.world.getType(this.position)); + } + } diff --git a/Spigot-Server-Patches/Print-Error-details-when-failing-to-save-player-data.patch b/Spigot-Server-Patches/Print-Error-details-when-failing-to-save-player-data.patch index 1196df6656..3bcf4ce32c 100644 --- a/Spigot-Server-Patches/Print-Error-details-when-failing-to-save-player-data.patch +++ b/Spigot-Server-Patches/Print-Error-details-when-failing-to-save-player-data.patch @@ -4,10 +4,10 @@ Date: Fri, 15 Jun 2018 20:37:03 -0400 Subject: [PATCH] Print Error details when failing to save player data -diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java +diff --git a/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java b/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldNBTStorage.java -+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java +--- a/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java ++++ b/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java @@ -0,0 +0,0 @@ public class WorldNBTStorage { SystemUtils.a(file1, file, file2); diff --git a/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch b/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch index c768e94454..5b6d8129f8 100644 --- a/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch +++ b/Spigot-Server-Patches/ProfileWhitelistVerifyEvent.patch @@ -4,10 +4,10 @@ Date: Mon, 3 Jul 2017 18:11:10 -0500 Subject: [PATCH] ProfileWhitelistVerifyEvent -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { // return chatmessage; diff --git a/Spigot-Server-Patches/Properly-fix-item-duplication-bug.patch b/Spigot-Server-Patches/Properly-fix-item-duplication-bug.patch index a97bb3c187..a2f83d975a 100644 --- a/Spigot-Server-Patches/Properly-fix-item-duplication-bug.patch +++ b/Spigot-Server-Patches/Properly-fix-item-duplication-bug.patch @@ -5,23 +5,25 @@ Subject: [PATCH] Properly fix item duplication bug Credit to prplz for figuring out the real issue -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + } @Override - protected boolean isFrozen() { +- public boolean isFrozen() { - return super.isFrozen() || !getBukkitEntity().isOnline(); ++ protected boolean isFrozen() { + return super.isFrozen() || (this.playerConnection != null && this.playerConnection.isDisconnected()); // Paper } @Override -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { } diff --git a/Spigot-Server-Patches/Properly-handle-async-calls-to-restart-the-server.patch b/Spigot-Server-Patches/Properly-handle-async-calls-to-restart-the-server.patch index 49f6aabff4..9cb66175fd 100644 --- a/Spigot-Server-Patches/Properly-handle-async-calls-to-restart-the-server.patch +++ b/Spigot-Server-Patches/Properly-handle-async-calls-to-restart-the-server.patch @@ -72,10 +72,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // Spigot Start private static double calcTps(double avg, double exp, double tps) -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { entityplayer.playerInteractManager.b(worldserver.worldDataServer.getGameType()); // CraftBukkit } diff --git a/Spigot-Server-Patches/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/Spigot-Server-Patches/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch index 0a763aba1d..db921d24e0 100644 --- a/Spigot-Server-Patches/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch +++ b/Spigot-Server-Patches/Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch @@ -34,10 +34,46 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java +diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Block.java -+++ b/src/main/java/net/minecraft/server/Block.java +--- a/src/main/java/net/minecraft/world/level/Explosion.java ++++ b/src/main/java/net/minecraft/world/level/Explosion.java +@@ -0,0 +0,0 @@ public class Explosion { + for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) { + BlockPosition blockposition = new BlockPosition(d4, d5, d6); + IBlockData iblockdata = this.world.getType(blockposition); ++ if (!iblockdata.isDestroyable()) continue; // Paper + Fluid fluid = iblockdata.getFluid(); // Paper + Optional<Float> optional = this.l.a(this, this.world, blockposition, iblockdata, fluid); + +@@ -0,0 +0,0 @@ public class Explosion { + IBlockData iblockdata = this.world.getType(blockposition); + Block block = iblockdata.getBlock(); + +- if (!iblockdata.isAir()) { ++ if (!iblockdata.isAir() && iblockdata.isDestroyable()) { // Paper + BlockPosition blockposition1 = blockposition.immutableCopy(); + + this.world.getMethodProfiler().enter("explosion_blocks"); +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) { + // CraftBukkit start - tree generation + if (this.captureTreeGeneration) { ++ // Paper start ++ IBlockData type = getType(blockposition); ++ if (!type.isDestroyable()) return false; ++ // Paper end + CraftBlockState blockstate = capturedBlockStates.get(blockposition); + if (blockstate == null) { + blockstate = CapturedBlockState.getTreeBlockState(this, blockposition, i); +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java @@ -0,0 +0,0 @@ public class Block extends BlockBase implements IMaterial { protected final BlockStateList<Block, IBlockData> blockStateList; private IBlockData blockData; @@ -58,45 +94,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public co.aikar.timings.Timing timing; public co.aikar.timings.Timing getTiming() { if (timing == null) { -diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java +diff --git a/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java b/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockBase.java -+++ b/src/main/java/net/minecraft/server/BlockBase.java -@@ -0,0 +0,0 @@ public abstract class BlockBase { - - @Deprecated - public boolean a(IBlockData iblockdata, BlockActionContext blockactioncontext) { -- return this.material.isReplaceable() && (blockactioncontext.getItemStack().isEmpty() || blockactioncontext.getItemStack().getItem() != this.getItem()); -+ return this.material.isReplaceable() && (blockactioncontext.getItemStack().isEmpty() || blockactioncontext.getItemStack().getItem() != this.getItem()) && (iblockdata.isDestroyable() || (blockactioncontext.getEntity() != null && blockactioncontext.getEntity().abilities.canInstantlyBuild)); // Paper - } - - @Deprecated -@@ -0,0 +0,0 @@ public abstract class BlockBase { - public Block getBlock() { - return (Block) this.c; - } -- -+ // Paper start -+ public final boolean isDestroyable() { -+ return getBlock().isDestroyable(); -+ } -+ // Paper end - public Material getMaterial() { - return this.g; - } -@@ -0,0 +0,0 @@ public abstract class BlockBase { - } - - public EnumPistonReaction getPushReaction() { -- return this.getBlock().getPushReaction(this.p()); -+ return !isDestroyable() ? EnumPistonReaction.BLOCK : this.getBlock().getPushReaction(this.p()); // Paper - } - - public boolean i(IBlockAccess iblockaccess, BlockPosition blockposition) { -diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockPiston.java -+++ b/src/main/java/net/minecraft/server/BlockPiston.java +--- a/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java ++++ b/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java @@ -0,0 +0,0 @@ public class BlockPiston extends BlockDirectional { @Override public boolean a(IBlockData iblockdata, World world, BlockPosition blockposition, int i, int j) { @@ -135,39 +136,38 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } world.playSound((EntityHuman) null, blockposition, SoundEffects.BLOCK_PISTON_CONTRACT, SoundCategory.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F); -diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java +diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Explosion.java -+++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -0,0 +0,0 @@ public class Explosion { - for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) { - BlockPosition blockposition = new BlockPosition(d4, d5, d6); - IBlockData iblockdata = this.world.getType(blockposition); -+ if (!iblockdata.isDestroyable()) continue; // Paper - Fluid fluid = iblockdata.getFluid(); // Paper - Optional<Float> optional = this.l.a(this, this.world, blockposition, iblockdata, fluid); +--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java ++++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +@@ -0,0 +0,0 @@ public abstract class BlockBase { -@@ -0,0 +0,0 @@ public class Explosion { - IBlockData iblockdata = this.world.getType(blockposition); - Block block = iblockdata.getBlock(); + @Deprecated + public boolean a(IBlockData iblockdata, BlockActionContext blockactioncontext) { +- return this.material.isReplaceable() && (blockactioncontext.getItemStack().isEmpty() || blockactioncontext.getItemStack().getItem() != this.getItem()); ++ return this.material.isReplaceable() && (blockactioncontext.getItemStack().isEmpty() || blockactioncontext.getItemStack().getItem() != this.getItem()) && (iblockdata.isDestroyable() || (blockactioncontext.getEntity() != null && blockactioncontext.getEntity().abilities.canInstantlyBuild)); // Paper + } -- if (!iblockdata.isAir()) { -+ if (!iblockdata.isAir() && iblockdata.isDestroyable()) { // Paper - BlockPosition blockposition1 = blockposition.immutableCopy(); + @Deprecated +@@ -0,0 +0,0 @@ public abstract class BlockBase { + public Block getBlock() { + return (Block) this.c; + } +- ++ // Paper start ++ public final boolean isDestroyable() { ++ return getBlock().isDestroyable(); ++ } ++ // Paper end + public Material getMaterial() { + return this.g; + } +@@ -0,0 +0,0 @@ public abstract class BlockBase { + } - this.world.getMethodProfiler().enter("explosion_blocks"); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) { - // CraftBukkit start - tree generation - if (this.captureTreeGeneration) { -+ // Paper start -+ IBlockData type = getType(blockposition); -+ if (!type.isDestroyable()) return false; -+ // Paper end - CraftBlockState blockstate = capturedBlockStates.get(blockposition); - if (blockstate == null) { - blockstate = CapturedBlockState.getTreeBlockState(this, blockposition, i); + public EnumPistonReaction getPushReaction() { +- return this.getBlock().getPushReaction(this.p()); ++ return !isDestroyable() ? EnumPistonReaction.BLOCK : this.getBlock().getPushReaction(this.p()); // Paper + } + + public boolean i(IBlockAccess iblockaccess, BlockPosition blockposition) { diff --git a/Spigot-Server-Patches/RangedEntity-API.patch b/Spigot-Server-Patches/RangedEntity-API.patch index 90b2a230a9..86d50dde4f 100644 --- a/Spigot-Server-Patches/RangedEntity-API.patch +++ b/Spigot-Server-Patches/RangedEntity-API.patch @@ -14,7 +14,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ +package com.destroystokyo.paper.entity; + -+import net.minecraft.server.IRangedEntity; ++import net.minecraft.world.entity.monster.IRangedEntity; +import org.bukkit.craftbukkit.entity.CraftLivingEntity; +import org.bukkit.entity.LivingEntity; + @@ -31,11 +31,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + getHandle().setChargingAttack(raiseHands); + } +} -diff --git a/src/main/java/net/minecraft/server/IRangedEntity.java b/src/main/java/net/minecraft/server/IRangedEntity.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/IRangedEntity.java b/src/main/java/net/minecraft/world/entity/monster/IRangedEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IRangedEntity.java -+++ b/src/main/java/net/minecraft/server/IRangedEntity.java -@@ -0,0 +0,0 @@ package net.minecraft.server; +--- a/src/main/java/net/minecraft/world/entity/monster/IRangedEntity.java ++++ b/src/main/java/net/minecraft/world/entity/monster/IRangedEntity.java +@@ -0,0 +0,0 @@ import net.minecraft.world.entity.EntityLiving; public interface IRangedEntity { @@ -49,17 +49,12 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java b/src index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.entity.CraftRangedEntity; - import net.minecraft.server.EntityDrowned; - import org.bukkit.craftbukkit.CraftServer; +@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Drowned; import org.bukkit.entity.EntityType; -public class CraftDrowned extends CraftZombie implements Drowned { -+public class CraftDrowned extends CraftZombie implements Drowned, CraftRangedEntity<EntityDrowned> { // Paper ++public class CraftDrowned extends CraftZombie implements Drowned, com.destroystokyo.paper.entity.CraftRangedEntity<EntityDrowned> { // Paper public CraftDrowned(CraftServer server, EntityDrowned entity) { super(server, entity); @@ -67,17 +62,12 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java b/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.entity.CraftRangedEntity; - import net.minecraft.server.EntityIllagerIllusioner; - import org.bukkit.craftbukkit.CraftServer; +@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Illusioner; -public class CraftIllusioner extends CraftSpellcaster implements Illusioner { -+public class CraftIllusioner extends CraftSpellcaster implements Illusioner, CraftRangedEntity<EntityIllagerIllusioner> { // Paper ++public class CraftIllusioner extends CraftSpellcaster implements Illusioner, com.destroystokyo.paper.entity.CraftRangedEntity<EntityIllagerIllusioner> { // Paper public CraftIllusioner(CraftServer server, EntityIllagerIllusioner entity) { super(server, entity); @@ -90,7 +80,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +import com.destroystokyo.paper.entity.CraftRangedEntity; import com.google.common.base.Preconditions; - import net.minecraft.server.EntityLlama; + import net.minecraft.world.entity.animal.horse.EntityLlama; import org.bukkit.craftbukkit.CraftServer; @@ -0,0 +0,0 @@ import org.bukkit.entity.Llama; import org.bukkit.entity.Llama.Color; @@ -105,18 +95,12 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java b/src/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.entity.CraftRangedEntity; // Paper -+ - import net.minecraft.server.EntityPiglin; - import org.bukkit.craftbukkit.CraftServer; +@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Piglin; -public class CraftPiglin extends CraftPiglinAbstract implements Piglin { -+public class CraftPiglin extends CraftPiglinAbstract implements Piglin, CraftRangedEntity<EntityPiglin> { // Paper ++public class CraftPiglin extends CraftPiglinAbstract implements Piglin, com.destroystokyo.paper.entity.CraftRangedEntity<EntityPiglin> { // Paper public CraftPiglin(CraftServer server, EntityPiglin entity) { super(server, entity); @@ -124,20 +108,12 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java b/sr index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.entity.CraftRangedEntity; // Paper -+ - import net.minecraft.server.EntityPillager; - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.inventory.CraftInventory; @@ -0,0 +0,0 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Pillager; import org.bukkit.inventory.Inventory; -public class CraftPillager extends CraftIllager implements Pillager { -+public class CraftPillager extends CraftIllager implements Pillager, CraftRangedEntity<EntityPillager> { // Paper ++public class CraftPillager extends CraftIllager implements Pillager, com.destroystokyo.paper.entity.CraftRangedEntity<EntityPillager> { // Paper public CraftPillager(CraftServer server, EntityPillager entity) { super(server, entity); @@ -145,18 +121,12 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/sr index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.entity.CraftRangedEntity; - import net.minecraft.server.EntitySkeletonAbstract; - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.entity.EntityType; +@@ -0,0 +0,0 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton.SkeletonType; -public class CraftSkeleton extends CraftMonster implements Skeleton { -+public class CraftSkeleton extends CraftMonster implements Skeleton, CraftRangedEntity<EntitySkeletonAbstract> { // Paper ++public class CraftSkeleton extends CraftMonster implements Skeleton, com.destroystokyo.paper.entity.CraftRangedEntity<EntitySkeletonAbstract> { // Paper public CraftSkeleton(CraftServer server, EntitySkeletonAbstract entity) { super(server, entity); @@ -164,17 +134,12 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java b/src index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.entity.CraftRangedEntity; - import net.minecraft.server.EntitySnowman; - import org.bukkit.craftbukkit.CraftServer; +@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Snowman; -public class CraftSnowman extends CraftGolem implements Snowman { -+public class CraftSnowman extends CraftGolem implements Snowman, CraftRangedEntity<EntitySnowman> { // Paper ++public class CraftSnowman extends CraftGolem implements Snowman, com.destroystokyo.paper.entity.CraftRangedEntity<EntitySnowman> { // Paper public CraftSnowman(CraftServer server, EntitySnowman entity) { super(server, entity); } @@ -182,17 +147,12 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/m index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.entity.CraftRangedEntity; // Paper - import net.minecraft.server.EntityWitch; - import org.bukkit.craftbukkit.CraftServer; +@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Witch; -public class CraftWitch extends CraftRaider implements Witch { -+public class CraftWitch extends CraftRaider implements Witch, CraftRangedEntity<EntityWitch> { // Paper ++public class CraftWitch extends CraftRaider implements Witch, com.destroystokyo.paper.entity.CraftRangedEntity<EntityWitch> { // Paper public CraftWitch(CraftServer server, EntityWitch entity) { super(server, entity); } @@ -200,19 +160,12 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.entity.CraftRangedEntity; - import net.minecraft.server.EntityWither; - import org.bukkit.boss.BossBar; - import org.bukkit.craftbukkit.CraftServer; @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.boss.CraftBossBar; import org.bukkit.entity.EntityType; import org.bukkit.entity.Wither; -public class CraftWither extends CraftMonster implements Wither { -+public class CraftWither extends CraftMonster implements Wither, CraftRangedEntity<EntityWither> { // Paper ++public class CraftWither extends CraftMonster implements Wither, com.destroystokyo.paper.entity.CraftRangedEntity<EntityWither> { // Paper private BossBar bossBar; diff --git a/Spigot-Server-Patches/Re-add-vanilla-entity-warnings-for-duplicates.patch b/Spigot-Server-Patches/Re-add-vanilla-entity-warnings-for-duplicates.patch index 353d687d30..44614565c8 100644 --- a/Spigot-Server-Patches/Re-add-vanilla-entity-warnings-for-duplicates.patch +++ b/Spigot-Server-Patches/Re-add-vanilla-entity-warnings-for-duplicates.patch @@ -7,10 +7,10 @@ These are a critical sign that somethin went wrong, and you've lost some data... We should kind of know about these things you know. -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { if (entity1 == null) { return false; diff --git a/Spigot-Server-Patches/Reduce-MutableInt-allocations-from-light-engine.patch b/Spigot-Server-Patches/Reduce-MutableInt-allocations-from-light-engine.patch index 4260a55e62..a45bc68306 100644 --- a/Spigot-Server-Patches/Reduce-MutableInt-allocations-from-light-engine.patch +++ b/Spigot-Server-Patches/Reduce-MutableInt-allocations-from-light-engine.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Reduce MutableInt allocations from light engine We can abuse the fact light is single threaded and share an instance per light engine instance -diff --git a/src/main/java/net/minecraft/server/LightEngineBlock.java b/src/main/java/net/minecraft/server/LightEngineBlock.java +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineBlock.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineBlock.java -+++ b/src/main/java/net/minecraft/server/LightEngineBlock.java +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineBlock.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineBlock.java @@ -0,0 +0,0 @@ public final class LightEngineBlock extends LightEngineLayer<LightEngineStorageB private static final EnumDirection[] e = EnumDirection.values(); @@ -27,10 +27,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 IBlockData iblockdata = this.a(j, mutableint); if (mutableint.getValue() >= 15) { -diff --git a/src/main/java/net/minecraft/server/LightEngineSky.java b/src/main/java/net/minecraft/server/LightEngineSky.java +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineSky.java -+++ b/src/main/java/net/minecraft/server/LightEngineSky.java +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java @@ -0,0 +0,0 @@ public final class LightEngineSky extends LightEngineLayer<LightEngineStorageSky private static final EnumDirection[] e = EnumDirection.values(); diff --git a/Spigot-Server-Patches/Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/Spigot-Server-Patches/Reduce-allocation-of-Vec3D-by-entity-tracker.patch index 7475f09739..1301da8801 100644 --- a/Spigot-Server-Patches/Reduce-allocation-of-Vec3D-by-entity-tracker.patch +++ b/Spigot-Server-Patches/Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -4,10 +4,10 @@ Date: Mon, 27 Apr 2020 00:04:16 -0700 Subject: [PATCH] Reduce allocation of Vec3D by entity tracker -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java +diff --git a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java +--- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java ++++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java @@ -0,0 +0,0 @@ public class EntityTrackerEntry { ++this.o; i = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F); @@ -38,10 +38,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L; if (!flag4 && this.o <= 400 && !this.q && this.r == this.tracker.isOnGround()) { -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public void updatePlayer(EntityPlayer entityplayer) { org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot diff --git a/Spigot-Server-Patches/Reduce-blockpos-allocation-from-pathfinding.patch b/Spigot-Server-Patches/Reduce-blockpos-allocation-from-pathfinding.patch index 4f421fb511..30acc1faca 100644 --- a/Spigot-Server-Patches/Reduce-blockpos-allocation-from-pathfinding.patch +++ b/Spigot-Server-Patches/Reduce-blockpos-allocation-from-pathfinding.patch @@ -4,10 +4,10 @@ Date: Sat, 25 Apr 2020 17:10:55 -0700 Subject: [PATCH] Reduce blockpos allocation from pathfinding -diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderNormal.java -+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java +--- a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java @@ -0,0 +0,0 @@ public class PathfinderNormal extends PathfinderAbstract { return PathType.DANGER_FIRE; } diff --git a/Spigot-Server-Patches/Reduce-memory-footprint-of-NBTTagCompound.patch b/Spigot-Server-Patches/Reduce-memory-footprint-of-NBTTagCompound.patch index c4d67de9b6..ec23e9c459 100644 --- a/Spigot-Server-Patches/Reduce-memory-footprint-of-NBTTagCompound.patch +++ b/Spigot-Server-Patches/Reduce-memory-footprint-of-NBTTagCompound.patch @@ -7,14 +7,14 @@ Fastutil maps are going to have a lower memory footprint - which is important because we clone chunk data after reading it for safety. So, reduce the impact of the clone on GC. -diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java +diff --git a/src/main/java/net/minecraft/nbt/NBTTagCompound.java b/src/main/java/net/minecraft/nbt/NBTTagCompound.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NBTTagCompound.java -+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java -@@ -0,0 +0,0 @@ import java.util.Set; - import java.util.UUID; - import java.util.regex.Pattern; - import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/nbt/NBTTagCompound.java ++++ b/src/main/java/net/minecraft/nbt/NBTTagCompound.java +@@ -0,0 +0,0 @@ import net.minecraft.ReportedException; + import net.minecraft.network.chat.ChatComponentText; + import net.minecraft.network.chat.IChatBaseComponent; + import net.minecraft.network.chat.IChatMutableComponent; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; // Paper import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; diff --git a/Spigot-Server-Patches/Reduce-sync-loads.patch b/Spigot-Server-Patches/Reduce-sync-loads.patch index ba271af0f1..dd4b79545e 100644 --- a/Spigot-Server-Patches/Reduce-sync-loads.patch +++ b/Spigot-Server-Patches/Reduce-sync-loads.patch @@ -22,15 +22,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import com.google.common.base.Functions; import com.google.common.base.Joiner; import com.google.common.collect.ImmutableSet; - import com.google.common.collect.Iterables; +@@ -0,0 +0,0 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Maps; + import net.minecraft.resources.MinecraftKey; +import com.google.gson.JsonObject; +import com.google.gson.internal.Streams; +import com.google.gson.stream.JsonWriter; - import net.minecraft.server.ChunkCoordIntPair; - import net.minecraft.server.ChunkProviderServer; - import net.minecraft.server.Entity; ++import net.minecraft.server.MCUtil; + import net.minecraft.server.MinecraftServer; + import net.minecraft.server.level.ChunkProviderServer; + import net.minecraft.server.level.PlayerChunk; @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.entity.Player; @@ -279,10 +281,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } +} -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { this.world.asyncChunkTaskManager.raisePriority(x, z, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY); com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.world, x, z); @@ -291,10 +293,27 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.world.timings.syncChunkLoad.startTiming(); // Paper this.serverThreadQueue.awaitTasks(completablefuture::isDone); com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + }; + public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager; + // Paper end ++ // Paper start ++ @Override ++ public boolean isChunkLoaded(int x, int z) { ++ return this.getChunkProvider().getChunkAtIfLoadedImmediately(x, z) != null; ++ } ++ // Paper end + + // Add env and gen to constructor, WorldData -> WorldDataServer + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { for (int i1 = i; i1 <= j; ++i1) { @@ -322,20 +341,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (chunk != null) { chunk.a(oclass, axisalignedbb, list, predicate); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - }; - public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager; - // Paper end -+ // Paper start -+ @Override -+ public boolean isChunkLoaded(int x, int z) { -+ return this.getChunkProvider().getChunkAtIfLoadedImmediately(x, z) != null; -+ } -+ // Paper end - - // Add env and gen to constructor, WorldData -> WorldDataServer - public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey<World> resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List<MobSpawner> list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { diff --git a/Spigot-Server-Patches/Refresh-player-inventory-when-cancelling-PlayerInter.patch b/Spigot-Server-Patches/Refresh-player-inventory-when-cancelling-PlayerInter.patch index b12740beb4..f9ac5c62ed 100644 --- a/Spigot-Server-Patches/Refresh-player-inventory-when-cancelling-PlayerInter.patch +++ b/Spigot-Server-Patches/Refresh-player-inventory-when-cancelling-PlayerInter.patch @@ -15,10 +15,10 @@ The bucket is replaced with milk and the dye removed from inventory. Refresh the player inventory when PlayerInteractEntityEvent is cancelled to avoid this problem. -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { } diff --git a/Spigot-Server-Patches/Remote-Connections-shouldn-t-hold-up-shutdown.patch b/Spigot-Server-Patches/Remote-Connections-shouldn-t-hold-up-shutdown.patch index d8d46447af..2c7491c56c 100644 --- a/Spigot-Server-Patches/Remote-Connections-shouldn-t-hold-up-shutdown.patch +++ b/Spigot-Server-Patches/Remote-Connections-shouldn-t-hold-up-shutdown.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remote Connections shouldn't hold up shutdown Bugs in the connection logic appears to leave stale connections even, preventing shutdown -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } diff --git a/Spigot-Server-Patches/Remove-armour-stand-double-add-to-world.patch b/Spigot-Server-Patches/Remove-armour-stand-double-add-to-world.patch index c220d33fb5..ec61f26065 100644 --- a/Spigot-Server-Patches/Remove-armour-stand-double-add-to-world.patch +++ b/Spigot-Server-Patches/Remove-armour-stand-double-add-to-world.patch @@ -4,10 +4,10 @@ Date: Fri, 14 Aug 2020 23:59:26 +0200 Subject: [PATCH] Remove armour stand double add to world -diff --git a/src/main/java/net/minecraft/server/ItemArmorStand.java b/src/main/java/net/minecraft/server/ItemArmorStand.java +diff --git a/src/main/java/net/minecraft/world/item/ItemArmorStand.java b/src/main/java/net/minecraft/world/item/ItemArmorStand.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemArmorStand.java -+++ b/src/main/java/net/minecraft/server/ItemArmorStand.java +--- a/src/main/java/net/minecraft/world/item/ItemArmorStand.java ++++ b/src/main/java/net/minecraft/world/item/ItemArmorStand.java @@ -0,0 +0,0 @@ public class ItemArmorStand extends Item { return EnumInteractionResult.FAIL; } diff --git a/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch b/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch index 1796860a41..b5c68d59eb 100644 --- a/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch +++ b/Spigot-Server-Patches/Remove-invalid-mob-spawner-tile-entities.patch @@ -4,10 +4,10 @@ Date: Tue, 1 Mar 2016 15:08:03 -0600 Subject: [PATCH] Remove invalid mob spawner tile entities -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { } @@ -17,5 +17,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + this.tileEntities.remove(blockposition); + // Paper end } else { - System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() + System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.getPosition().getX() + "," + tileentity.getPosition().getY() + "," + tileentity.getPosition().getZ() + " (" + getType(blockposition) + ") where there was no entity tile!"); diff --git a/Spigot-Server-Patches/Remove-some-streams-from-structures.patch b/Spigot-Server-Patches/Remove-some-streams-from-structures.patch index ba9ef82a40..e8e0ee621a 100644 --- a/Spigot-Server-Patches/Remove-some-streams-from-structures.patch +++ b/Spigot-Server-Patches/Remove-some-streams-from-structures.patch @@ -5,58 +5,19 @@ Subject: [PATCH] Remove some streams from structures This showed up a lot in the spark profiler, should have a low-medium performance improvement. -diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java +diff --git a/src/main/java/net/minecraft/world/level/StructureManager.java b/src/main/java/net/minecraft/world/level/StructureManager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BiomeBase.java -+++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -0,0 +0,0 @@ public final class BiomeBase { - int l1 = j1 << 4; - - try { -- structuremanager.a(SectionPosition.a(blockposition), structuregenerator).forEach((structurestart) -> { -- structurestart.a(regionlimitedworldaccess, structuremanager, chunkgenerator, seededrandom, new StructureBoundingBox(k1, l1, k1 + 15, l1 + 15), new ChunkCoordIntPair(i1, j1)); -- }); -+ // Paper start - remove structure streams -+ for (StructureStart<?> structureStart : structuremanager.getFeatureStarts(SectionPosition.a(blockposition), structuregenerator)) { -+ structureStart.a(regionlimitedworldaccess, structuremanager, chunkgenerator, seededrandom, new StructureBoundingBox(k1, l1, k1 + 15, l1 + 15), new ChunkCoordIntPair(i1, j1)); -+ } -+ // Paper end - } catch (Exception exception) { - CrashReport crashreport = CrashReport.a(exception, "Feature placement"); - -diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -+++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -@@ -0,0 +0,0 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { - while (iterator.hasNext()) { - StructureGenerator<?> structuregenerator = (StructureGenerator) iterator.next(); - -- structuremanager.a(SectionPosition.a(chunkcoordintpair, 0), structuregenerator).forEach((structurestart) -> { -+ for (StructureStart<?> structurestart : structuremanager.getFeatureStarts(SectionPosition.a(chunkcoordintpair, 0), structuregenerator)) { // Paper - remove structure streams - Iterator iterator1 = structurestart.d().iterator(); - - while (iterator1.hasNext()) { -@@ -0,0 +0,0 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { - } - } - -- }); -+ } // Paper - remove structure streams - } - - double[][][] adouble = new double[2][this.p + 1][this.o + 1]; -diff --git a/src/main/java/net/minecraft/server/StructureManager.java b/src/main/java/net/minecraft/server/StructureManager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/StructureManager.java -+++ b/src/main/java/net/minecraft/server/StructureManager.java +--- a/src/main/java/net/minecraft/world/level/StructureManager.java ++++ b/src/main/java/net/minecraft/world/level/StructureManager.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.world.level; import com.mojang.datafixers.DataFixUtils; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; // Paper import java.util.stream.Stream; import javax.annotation.Nullable; + import net.minecraft.core.BaseBlockPosition; +@@ -0,0 +0,0 @@ import net.minecraft.world.level.levelgen.structure.StructureStart; public class StructureManager { @@ -115,3 +76,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Spigot start +diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeBase.java b/src/main/java/net/minecraft/world/level/biome/BiomeBase.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/biome/BiomeBase.java ++++ b/src/main/java/net/minecraft/world/level/biome/BiomeBase.java +@@ -0,0 +0,0 @@ public final class BiomeBase { + int l1 = j1 << 4; + + try { +- structuremanager.a(SectionPosition.a(blockposition), structuregenerator).forEach((structurestart) -> { +- structurestart.a(regionlimitedworldaccess, structuremanager, chunkgenerator, seededrandom, new StructureBoundingBox(k1, l1, k1 + 15, l1 + 15), new ChunkCoordIntPair(i1, j1)); +- }); ++ // Paper start - remove structure streams ++ for (StructureStart<?> structureStart : structuremanager.getFeatureStarts(SectionPosition.a(blockposition), structuregenerator)) { ++ structureStart.a(regionlimitedworldaccess, structuremanager, chunkgenerator, seededrandom, new StructureBoundingBox(k1, l1, k1 + 15, l1 + 15), new ChunkCoordIntPair(i1, j1)); ++ } ++ // Paper end + } catch (Exception exception) { + CrashReport crashreport = CrashReport.a(exception, "Feature placement"); + +diff --git a/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java +@@ -0,0 +0,0 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { + while (iterator.hasNext()) { + StructureGenerator<?> structuregenerator = (StructureGenerator) iterator.next(); + +- structuremanager.a(SectionPosition.a(chunkcoordintpair, 0), structuregenerator).forEach((structurestart) -> { ++ for (StructureStart<?> structurestart : structuremanager.getFeatureStarts(SectionPosition.a(chunkcoordintpair, 0), structuregenerator)) { // Paper - remove structure streams + Iterator iterator1 = structurestart.d().iterator(); + + while (iterator1.hasNext()) { +@@ -0,0 +0,0 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { + } + } + +- }); ++ } // Paper - remove structure streams + } + + double[][][] adouble = new double[2][this.p + 1][this.o + 1]; diff --git a/Spigot-Server-Patches/Remove-stale-POIs.patch b/Spigot-Server-Patches/Remove-stale-POIs.patch index 6e4bb70ae1..12cbc67c7e 100644 --- a/Spigot-Server-Patches/Remove-stale-POIs.patch +++ b/Spigot-Server-Patches/Remove-stale-POIs.patch @@ -4,30 +4,10 @@ Date: Sat, 9 Jan 2021 14:17:07 +0100 Subject: [PATCH] Remove stale POIs -diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/VillagePlace.java -+++ b/src/main/java/net/minecraft/server/VillagePlace.java -@@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { - ((VillagePlaceSection) this.e(SectionPosition.a(blockposition).s())).a(blockposition, villageplacetype); - } - -+ public void remove(BlockPosition blockposition) { this.a(blockposition); } // Paper - OBFHELPER - public void a(BlockPosition blockposition) { - ((VillagePlaceSection) this.e(SectionPosition.a(blockposition).s())).a(blockposition); - } -@@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { - return ((VillagePlaceSection) this.e(SectionPosition.a(blockposition).s())).c(blockposition); - } - -+ public final boolean test(BlockPosition blockposition, Predicate<VillagePlaceType> predicate) { return this.a(blockposition, predicate); } // Paper - OBFHELPER - public boolean a(BlockPosition blockposition, Predicate<VillagePlaceType> predicate) { - return (Boolean) this.d(SectionPosition.a(blockposition).s()).map((villageplacesection) -> { - return villageplacesection.a(blockposition, predicate); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { Optional<VillagePlaceType> optional = VillagePlaceType.b(iblockdata); Optional<VillagePlaceType> optional1 = VillagePlaceType.b(iblockdata1); @@ -54,3 +34,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public VillagePlace y() { return this.getChunkProvider().j(); } +diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java ++++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java +@@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { + ((VillagePlaceSection) this.e(SectionPosition.a(blockposition).s())).a(blockposition, villageplacetype); + } + ++ public void remove(BlockPosition blockposition) { this.a(blockposition); } // Paper - OBFHELPER + public void a(BlockPosition blockposition) { + ((VillagePlaceSection) this.e(SectionPosition.a(blockposition).s())).a(blockposition); + } +@@ -0,0 +0,0 @@ public class VillagePlace extends RegionFileSection<VillagePlaceSection> { + return ((VillagePlaceSection) this.e(SectionPosition.a(blockposition).s())).c(blockposition); + } + ++ public final boolean test(BlockPosition blockposition, Predicate<VillagePlaceType> predicate) { return this.a(blockposition, predicate); } // Paper - OBFHELPER + public boolean a(BlockPosition blockposition, Predicate<VillagePlaceType> predicate) { + return (Boolean) this.d(SectionPosition.a(blockposition).s()).map((villageplacesection) -> { + return villageplacesection.a(blockposition, predicate); diff --git a/Spigot-Server-Patches/Remove-streams-from-Mob-AI-System.patch b/Spigot-Server-Patches/Remove-streams-from-Mob-AI-System.patch index 00a42bae81..b18af6809f 100644 --- a/Spigot-Server-Patches/Remove-streams-from-Mob-AI-System.patch +++ b/Spigot-Server-Patches/Remove-streams-from-Mob-AI-System.patch @@ -9,12 +9,12 @@ replace them with the standard iterator. Also optimise the stream.anyMatch statement to move to a bitset where we can replace the call with a single bitwise operation. -diff --git a/src/main/java/net/minecraft/server/PathfinderGoal.java b/src/main/java/net/minecraft/server/PathfinderGoal.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoal.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoal.java +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.world.entity.ai.goal; +import com.destroystokyo.paper.util.set.OptimizedSmallEnumSet; // Paper - remove streams from pathfindergoalselector import java.util.EnumSet; @@ -52,12 +52,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public static enum Type { -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.world.entity.ai.goal; +import com.destroystokyo.paper.util.set.OptimizedSmallEnumSet; // Paper - remove streams from pathfindergoalselector import com.google.common.collect.Sets; @@ -233,10 +233,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public void a(PathfinderGoal.Type pathfindergoal_type, boolean flag) { -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java @@ -0,0 +0,0 @@ public class PathfinderGoalWrapped extends PathfinderGoal { this.a.a(enumset); } diff --git a/Spigot-Server-Patches/Remove-streams-from-PairedQueue.patch b/Spigot-Server-Patches/Remove-streams-from-PairedQueue.patch index 13edbf62f6..65457f4171 100644 --- a/Spigot-Server-Patches/Remove-streams-from-PairedQueue.patch +++ b/Spigot-Server-Patches/Remove-streams-from-PairedQueue.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Remove streams from PairedQueue We shouldn't be doing stream calls just to see if the queue is empty. This creates loads of garbage thanks to how often it's called. -diff --git a/src/main/java/net/minecraft/server/PairedQueue.java b/src/main/java/net/minecraft/server/PairedQueue.java +diff --git a/src/main/java/net/minecraft/util/thread/PairedQueue.java b/src/main/java/net/minecraft/util/thread/PairedQueue.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PairedQueue.java -+++ b/src/main/java/net/minecraft/server/PairedQueue.java +--- a/src/main/java/net/minecraft/util/thread/PairedQueue.java ++++ b/src/main/java/net/minecraft/util/thread/PairedQueue.java @@ -0,0 +0,0 @@ public interface PairedQueue<T, F> { public static final class a implements PairedQueue<PairedQueue.b, Runnable> { diff --git a/Spigot-Server-Patches/Remove-streams-from-SensorNearest.patch b/Spigot-Server-Patches/Remove-streams-from-SensorNearest.patch index 1c489bef27..ec1f8657c8 100644 --- a/Spigot-Server-Patches/Remove-streams-from-SensorNearest.patch +++ b/Spigot-Server-Patches/Remove-streams-from-SensorNearest.patch @@ -18,10 +18,10 @@ compared to the previous stream-based implementation. See: https://nipafx.dev/java-stream-performance/ -diff --git a/src/main/java/net/minecraft/server/SensorNearestItems.java b/src/main/java/net/minecraft/server/SensorNearestItems.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestItems.java b/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestItems.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SensorNearestItems.java -+++ b/src/main/java/net/minecraft/server/SensorNearestItems.java +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestItems.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestItems.java @@ -0,0 +0,0 @@ public class SensorNearestItems extends Sensor<EntityInsentient> { List<EntityItem> list = worldserver.a(EntityItem.class, entityinsentient.getBoundingBox().grow(8.0D, 4.0D, 8.0D), (entityitem) -> { return true; @@ -51,10 +51,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper end } } -diff --git a/src/main/java/net/minecraft/server/SensorNearestLivingEntities.java b/src/main/java/net/minecraft/server/SensorNearestLivingEntities.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestLivingEntities.java b/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestLivingEntities.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SensorNearestLivingEntities.java -+++ b/src/main/java/net/minecraft/server/SensorNearestLivingEntities.java +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestLivingEntities.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestLivingEntities.java @@ -0,0 +0,0 @@ public class SensorNearestLivingEntities extends Sensor<EntityLiving> { list.sort(Comparator.comparingDouble(entityliving::h)); BehaviorController<?> behaviorcontroller = entityliving.getBehaviorController(); @@ -72,10 +72,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @Override -diff --git a/src/main/java/net/minecraft/server/SensorNearestPlayers.java b/src/main/java/net/minecraft/server/SensorNearestPlayers.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestPlayers.java b/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestPlayers.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SensorNearestPlayers.java -+++ b/src/main/java/net/minecraft/server/SensorNearestPlayers.java +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestPlayers.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestPlayers.java @@ -0,0 +0,0 @@ public class SensorNearestPlayers extends Sensor<EntityLiving> { @Override diff --git a/Spigot-Server-Patches/Remove-streams-from-classes-related-villager-gossip.patch b/Spigot-Server-Patches/Remove-streams-from-classes-related-villager-gossip.patch index 9c691f3d8a..abd808838d 100644 --- a/Spigot-Server-Patches/Remove-streams-from-classes-related-villager-gossip.patch +++ b/Spigot-Server-Patches/Remove-streams-from-classes-related-villager-gossip.patch @@ -4,10 +4,10 @@ Date: Wed, 1 Jul 2020 18:01:49 -0400 Subject: [PATCH] Remove streams from classes related villager gossip -diff --git a/src/main/java/net/minecraft/server/Reputation.java b/src/main/java/net/minecraft/server/Reputation.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java b/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Reputation.java -+++ b/src/main/java/net/minecraft/server/Reputation.java +--- a/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java ++++ b/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java @@ -0,0 +0,0 @@ import com.mojang.serialization.DynamicOps; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; @@ -85,10 +85,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public Stream<Reputation.b> a(UUID uuid) { -diff --git a/src/main/java/net/minecraft/server/ReputationType.java b/src/main/java/net/minecraft/server/ReputationType.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/ReputationType.java b/src/main/java/net/minecraft/world/entity/ai/gossip/ReputationType.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ReputationType.java -+++ b/src/main/java/net/minecraft/server/ReputationType.java +--- a/src/main/java/net/minecraft/world/entity/ai/gossip/ReputationType.java ++++ b/src/main/java/net/minecraft/world/entity/ai/gossip/ReputationType.java @@ -0,0 +0,0 @@ public enum ReputationType { MAJOR_NEGATIVE("major_negative", -5, 100, 10, 10), MINOR_NEGATIVE("minor_negative", -1, 200, 20, 20), MINOR_POSITIVE("minor_positive", 1, 200, 1, 5), MAJOR_POSITIVE("major_positive", 5, 100, 0, 100), TRADING("trading", 1, 25, 2, 20); 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 591935f648..551a515e97 100644 --- a/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch +++ b/Spigot-Server-Patches/Remove-unused-World-Tile-Entity-List.patch @@ -5,10 +5,32 @@ 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 +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + } + + bufferedwriter.write(String.format("entities: %d\n", this.entitiesById.size())); +- bufferedwriter.write(String.format("block_entities: %d\n", this.tileEntityList.size())); ++ bufferedwriter.write(String.format("block_entities: %d\n", this.tileEntityListTick.size())); // Paper - remove unused list + bufferedwriter.write(String.format("block_ticks: %d\n", this.getBlockTickList().a())); + bufferedwriter.write(String.format("fluid_ticks: %d\n", this.getFluidTickList().a())); + bufferedwriter.write("distance_manager: " + playerchunkmap.e().c() + "\n"); +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + + private void a(Writer writer) throws IOException { + CSVWriter csvwriter = CSVWriter.a().a("x").a("y").a("z").a("type").a(writer); +- Iterator iterator = this.tileEntityList.iterator(); ++ Iterator iterator = this.tileEntityListTick.iterator(); // Paper - remove unused list + + while (iterator.hasNext()) { + TileEntity tileentity = (TileEntity) iterator.next(); +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public static final ResourceKey<World> THE_NETHER = ResourceKey.a(IRegistry.L, new MinecraftKey("the_nether")); public static final ResourceKey<World> THE_END = ResourceKey.a(IRegistry.L, new MinecraftKey("the_end")); @@ -66,25 +88,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.tileEntityListTick.remove(tileentity); } -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - } - - bufferedwriter.write(String.format("entities: %d\n", this.entitiesById.size())); -- bufferedwriter.write(String.format("block_entities: %d\n", this.tileEntityList.size())); -+ bufferedwriter.write(String.format("block_entities: %d\n", this.tileEntityListTick.size())); // Paper - remove unused list - bufferedwriter.write(String.format("block_ticks: %d\n", this.getBlockTickList().a())); - bufferedwriter.write(String.format("fluid_ticks: %d\n", this.getFluidTickList().a())); - bufferedwriter.write("distance_manager: " + playerchunkmap.e().c() + "\n"); -@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { - - private void a(Writer writer) throws IOException { - CSVWriter csvwriter = CSVWriter.a().a("x").a("y").a("z").a("type").a(writer); -- Iterator iterator = this.tileEntityList.iterator(); -+ Iterator iterator = this.tileEntityListTick.iterator(); // Paper - remove unused list - - while (iterator.hasNext()) { - TileEntity tileentity = (TileEntity) iterator.next(); diff --git a/Spigot-Server-Patches/Reset-Ender-Crystals-on-Dragon-Spawn.patch b/Spigot-Server-Patches/Reset-Ender-Crystals-on-Dragon-Spawn.patch index 1b4d4b4dc7..b79c43de71 100644 --- a/Spigot-Server-Patches/Reset-Ender-Crystals-on-Dragon-Spawn.patch +++ b/Spigot-Server-Patches/Reset-Ender-Crystals-on-Dragon-Spawn.patch @@ -10,10 +10,10 @@ This ensures the crystals/pillars are in expected state when the dragon spawns. See #3522 -diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java +diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EnderDragonBattle.java -+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java +--- a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java ++++ b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java @@ -0,0 +0,0 @@ public class EnderDragonBattle { entityenderdragon.setPositionRotation(0.0D, 128.0D, 0.0D, this.world.random.nextFloat() * 360.0F, 0.0F); this.world.addEntity(entityenderdragon); diff --git a/Spigot-Server-Patches/Reset-players-airTicks-on-respawn.patch b/Spigot-Server-Patches/Reset-players-airTicks-on-respawn.patch index c182b61a68..a92929f0d8 100644 --- a/Spigot-Server-Patches/Reset-players-airTicks-on-respawn.patch +++ b/Spigot-Server-Patches/Reset-players-airTicks-on-respawn.patch @@ -4,22 +4,10 @@ Date: Sat, 20 Oct 2018 22:34:02 -0400 Subject: [PATCH] Reset players airTicks on respawn -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 final int getMaxAirTicks() { return bH(); } // Paper - OBFHELPER - public int bH() { - return 300; - } -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } @@ -28,3 +16,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.fireTicks = 0; this.fallDistance = 0; this.foodData = new FoodMetaData(this); +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + + } + ++ public final int getMaxAirTicks() { return bH(); } // Paper - OBFHELPER + public int bH() { + return 300; + } diff --git a/Spigot-Server-Patches/Reset-shield-blocking-on-dimension-change.patch b/Spigot-Server-Patches/Reset-shield-blocking-on-dimension-change.patch index 13b6e4ad43..8ef85b78e3 100644 --- a/Spigot-Server-Patches/Reset-shield-blocking-on-dimension-change.patch +++ b/Spigot-Server-Patches/Reset-shield-blocking-on-dimension-change.patch @@ -4,10 +4,10 @@ Date: Sun, 24 Jan 2021 08:55:19 -0800 Subject: [PATCH] Reset shield blocking on dimension change -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.world.getServer().getPluginManager().callEvent(changeEvent); // CraftBukkit end diff --git a/Spigot-Server-Patches/Reset-spawner-timer-when-spawner-event-is-cancelled.patch b/Spigot-Server-Patches/Reset-spawner-timer-when-spawner-event-is-cancelled.patch index 40a3ba28e4..943f1a2f06 100644 --- a/Spigot-Server-Patches/Reset-spawner-timer-when-spawner-event-is-cancelled.patch +++ b/Spigot-Server-Patches/Reset-spawner-timer-when-spawner-event-is-cancelled.patch @@ -4,10 +4,10 @@ Date: Mon, 31 Jul 2017 01:45:19 -0500 Subject: [PATCH] Reset spawner timer when spawner event is cancelled -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java +--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java @@ -0,0 +0,0 @@ public abstract class MobSpawnerAbstract { // Spigot End } diff --git a/Spigot-Server-Patches/Restrict-vanilla-teleport-command-to-valid-locations.patch b/Spigot-Server-Patches/Restrict-vanilla-teleport-command-to-valid-locations.patch index ee550107db..601d05da00 100644 --- a/Spigot-Server-Patches/Restrict-vanilla-teleport-command-to-valid-locations.patch +++ b/Spigot-Server-Patches/Restrict-vanilla-teleport-command-to-valid-locations.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Restrict vanilla teleport command to valid locations Fixes GH-3165, GH-3575 -diff --git a/src/main/java/net/minecraft/server/CommandTeleport.java b/src/main/java/net/minecraft/server/CommandTeleport.java +diff --git a/src/main/java/net/minecraft/server/commands/CommandTeleport.java b/src/main/java/net/minecraft/server/commands/CommandTeleport.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CommandTeleport.java -+++ b/src/main/java/net/minecraft/server/CommandTeleport.java +--- a/src/main/java/net/minecraft/server/commands/CommandTeleport.java ++++ b/src/main/java/net/minecraft/server/commands/CommandTeleport.java @@ -0,0 +0,0 @@ public class CommandTeleport { private static void a(CommandListenerWrapper commandlistenerwrapper, Entity entity, WorldServer worldserver, double d0, double d1, double d2, Set<PacketPlayOutPosition.EnumPlayerTeleportFlags> set, float f, float f1, @Nullable CommandTeleport.a commandteleport_a) throws CommandSyntaxException { diff --git a/Spigot-Server-Patches/Retain-block-place-order-when-capturing-blockstates.patch b/Spigot-Server-Patches/Retain-block-place-order-when-capturing-blockstates.patch index e84a1c0fa0..6f630fcbf8 100644 --- a/Spigot-Server-Patches/Retain-block-place-order-when-capturing-blockstates.patch +++ b/Spigot-Server-Patches/Retain-block-place-order-when-capturing-blockstates.patch @@ -9,10 +9,10 @@ bonemeal by a player. In general, look at making this logic more robust (i.e properly handling cases where a captured entry is overriden) - but for now this will do. -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public boolean captureBlockStates = false; public boolean captureTreeGeneration = false; diff --git a/Spigot-Server-Patches/Return-chat-component-with-empty-text-instead-of-thr.patch b/Spigot-Server-Patches/Return-chat-component-with-empty-text-instead-of-thr.patch index 33e8634904..6d1ca064bb 100644 --- a/Spigot-Server-Patches/Return-chat-component-with-empty-text-instead-of-thr.patch +++ b/Spigot-Server-Patches/Return-chat-component-with-empty-text-instead-of-thr.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Return chat component with empty text instead of throwing exception -diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java +diff --git a/src/main/java/net/minecraft/world/inventory/Container.java b/src/main/java/net/minecraft/world/inventory/Container.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Container.java -+++ b/src/main/java/net/minecraft/server/Container.java +--- a/src/main/java/net/minecraft/world/inventory/Container.java ++++ b/src/main/java/net/minecraft/world/inventory/Container.java @@ -0,0 +0,0 @@ public abstract class Container { } private IChatBaseComponent title; diff --git a/Spigot-Server-Patches/Sanitise-RegionFileCache-and-make-configurable.patch b/Spigot-Server-Patches/Sanitise-RegionFileCache-and-make-configurable.patch index 7fadc2bfe7..1b718e4453 100644 --- a/Spigot-Server-Patches/Sanitise-RegionFileCache-and-make-configurable.patch +++ b/Spigot-Server-Patches/Sanitise-RegionFileCache-and-make-configurable.patch @@ -24,10 +24,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + regionFileCacheSize = Math.max(getInt("settings.region-file-cache-size", 256), 4); + } } -diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/RegionFileCache.java -+++ b/src/main/java/net/minecraft/server/RegionFileCache.java +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java @@ -0,0 +0,0 @@ public final class RegionFileCache implements AutoCloseable { if (regionfile != null) { return regionfile; diff --git a/Spigot-Server-Patches/Seed-based-feature-search.patch b/Spigot-Server-Patches/Seed-based-feature-search.patch index 31c0acbed0..21cbdbc3b0 100644 --- a/Spigot-Server-Patches/Seed-based-feature-search.patch +++ b/Spigot-Server-Patches/Seed-based-feature-search.patch @@ -32,22 +32,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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/BiomeManager.java b/src/main/java/net/minecraft/server/BiomeManager.java +diff --git a/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java b/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BiomeManager.java -+++ b/src/main/java/net/minecraft/server/BiomeManager.java -@@ -0,0 +0,0 @@ public class BiomeManager { - return new BiomeManager(worldchunkmanager, this.b, this.c); - } - -+ public BiomeBase getBiome(BlockPosition blockposition) { return a(blockposition); } // Paper - OBFHELPER - public BiomeBase a(BlockPosition blockposition) { - return this.c.a(this.b, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.a); - } -diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -+++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java +--- a/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java ++++ b/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java @@ -0,0 +0,0 @@ public class ChunkCoordIntPair { } } @@ -61,10 +49,37 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public int e() { return this.z << 4; } -diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/StructureGenerator.java -+++ b/src/main/java/net/minecraft/server/StructureGenerator.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + return this.methodProfiler; + } + +- @Override +- public BiomeManager d() { ++ public BiomeManager getBiomeManager() { return d(); } // Paper - OBFHELPER ++ @Override public BiomeManager d() { + return this.biomeManager; + } + +diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java ++++ b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java +@@ -0,0 +0,0 @@ public class BiomeManager { + return new BiomeManager(worldchunkmanager, this.b, this.c); + } + ++ public BiomeBase getBiome(BlockPosition blockposition) { return a(blockposition); } // Paper - OBFHELPER + public BiomeBase a(BlockPosition blockposition) { + return this.c.a(this.b, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.a); + } +diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java @@ -0,0 +0,0 @@ public abstract class StructureGenerator<C extends WorldGenFeatureConfiguration> int j2 = i1 + k * l1; ChunkCoordIntPair chunkcoordintpair = this.a(structuresettingsfeature, j, seededrandom, i2, j2); @@ -80,18 +95,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 IChunkAccess ichunkaccess = iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS); StructureStart<?> structurestart = structuremanager.a(SectionPosition.a(ichunkaccess.getPos(), 0), this, ichunkaccess); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 this.methodProfiler; - } - -- @Override -- public BiomeManager d() { -+ public BiomeManager getBiomeManager() { return d(); } // Paper - OBFHELPER -+ @Override public BiomeManager d() { - return this.biomeManager; - } - diff --git a/Spigot-Server-Patches/Send-absolute-position-the-first-time-an-entity-is-s.patch b/Spigot-Server-Patches/Send-absolute-position-the-first-time-an-entity-is-s.patch index 90447ce06f..232fae6f72 100644 --- a/Spigot-Server-Patches/Send-absolute-position-the-first-time-an-entity-is-s.patch +++ b/Spigot-Server-Patches/Send-absolute-position-the-first-time-an-entity-is-s.patch @@ -4,10 +4,10 @@ Date: Wed, 2 Mar 2016 23:13:07 -0600 Subject: [PATCH] Send absolute position the first time an entity is seen -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java +diff --git a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java +--- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java ++++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java @@ -0,0 +0,0 @@ import com.google.common.collect.Lists; import com.mojang.datafixers.util.Pair; import java.util.Collection; @@ -76,10 +76,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } this.c(); -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private final Entity tracker; private final int trackingDistance; 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 5e1a7609d6..2b02167dab 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 @@ -5,10 +5,10 @@ Subject: [PATCH] Send attack SoundEffects only to players who can see the attacker -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { int i = b0 + EnchantmentManager.b((EntityLiving) this); diff --git a/Spigot-Server-Patches/Set-Zombie-last-tick-at-start-of-drowning-process.patch b/Spigot-Server-Patches/Set-Zombie-last-tick-at-start-of-drowning-process.patch index 691ee3b044..a0d60c683a 100644 --- a/Spigot-Server-Patches/Set-Zombie-last-tick-at-start-of-drowning-process.patch +++ b/Spigot-Server-Patches/Set-Zombie-last-tick-at-start-of-drowning-process.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Set Zombie last tick at start of drowning process Fixes GH-1887 -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { ++this.bt; if (this.bt >= 600) { diff --git a/Spigot-Server-Patches/Shoulder-Entities-Release-API.patch b/Spigot-Server-Patches/Shoulder-Entities-Release-API.patch index 553c1a5ce6..4b864860b3 100644 --- a/Spigot-Server-Patches/Shoulder-Entities-Release-API.patch +++ b/Spigot-Server-Patches/Shoulder-Entities-Release-API.patch @@ -4,10 +4,10 @@ Date: Sat, 17 Jun 2017 15:18:30 -0400 Subject: [PATCH] Shoulder Entities Release API -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { } diff --git a/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index e31c8e980d..fd7ae88eac 100644 --- a/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/Spigot-Server-Patches/Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -104,7 +104,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - log.log( Level.SEVERE, "Spigot version: " + Bukkit.getServer().getVersion() ); + log.log( Level.SEVERE, "Paper version: " + Bukkit.getServer().getVersion() ); // - if ( net.minecraft.server.World.lastPhysicsProblem != null ) + if ( net.minecraft.world.level.World.lastPhysicsProblem != null ) { @@ -0,0 +0,0 @@ public class WatchdogThread extends Thread } diff --git a/Spigot-Server-Patches/Significantly-improve-performance-of-the-end-generat.patch b/Spigot-Server-Patches/Significantly-improve-performance-of-the-end-generat.patch index 3d74464c56..7785a84e7d 100644 --- a/Spigot-Server-Patches/Significantly-improve-performance-of-the-end-generat.patch +++ b/Spigot-Server-Patches/Significantly-improve-performance-of-the-end-generat.patch @@ -11,18 +11,18 @@ Co-authored-by: Gegy <gegy1000@gmail.com> Co-authored-by: Dylan Xaldin <Puremin0rez515@gmail.com> Co-authored-by: pop4959 <pop4959@gmail.com> -diff --git a/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java b/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java +diff --git a/src/main/java/net/minecraft/world/level/biome/WorldChunkManagerTheEnd.java b/src/main/java/net/minecraft/world/level/biome/WorldChunkManagerTheEnd.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java -+++ b/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java -@@ -0,0 +0,0 @@ package net.minecraft.server; +--- a/src/main/java/net/minecraft/world/level/biome/WorldChunkManagerTheEnd.java ++++ b/src/main/java/net/minecraft/world/level/biome/WorldChunkManagerTheEnd.java +@@ -0,0 +0,0 @@ package net.minecraft.world.level.biome; import com.google.common.collect.ImmutableList; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; +import it.unimi.dsi.fastutil.HashCommon; // Paper import java.util.List; - - public class WorldChunkManagerTheEnd extends WorldChunkManager { + import net.minecraft.core.IRegistry; + import net.minecraft.resources.RegistryLookupCodec; @@ -0,0 +0,0 @@ public class WorldChunkManagerTheEnd extends WorldChunkManager { private final BiomeBase k; private final BiomeBase l; diff --git a/Spigot-Server-Patches/SkeletonHorse-Additions.patch b/Spigot-Server-Patches/SkeletonHorse-Additions.patch index c9257331ca..bccabc357b 100644 --- a/Spigot-Server-Patches/SkeletonHorse-Additions.patch +++ b/Spigot-Server-Patches/SkeletonHorse-Additions.patch @@ -4,10 +4,22 @@ Date: Fri, 27 Jul 2018 22:36:31 -0500 Subject: [PATCH] SkeletonHorse Additions -diff --git a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java +diff --git a/src/main/java/net/minecraft/world/entity/IEntitySelector.java b/src/main/java/net/minecraft/world/entity/IEntitySelector.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java -+++ b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java +--- a/src/main/java/net/minecraft/world/entity/IEntitySelector.java ++++ b/src/main/java/net/minecraft/world/entity/IEntitySelector.java +@@ -0,0 +0,0 @@ public final class IEntitySelector { + public static final Predicate<Entity> f = (entity) -> { + return !(entity instanceof EntityHuman) || !entity.isSpectator() && !((EntityHuman) entity).isCreative() && entity.world.getDifficulty() != EnumDifficulty.PEACEFUL; + }; ++ public static Predicate<Entity> notSpectator() { return g; } // Paper - OBFHELPER + public static final Predicate<Entity> g = (entity) -> { + return !entity.isSpectator(); + }; +diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseSkeleton.java b/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseSkeleton.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseSkeleton.java ++++ b/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseSkeleton.java @@ -0,0 +0,0 @@ public class EntityHorseSkeleton extends EntityHorseAbstract { private final PathfinderGoalHorseTrap bw = new PathfinderGoalHorseTrap(this); @@ -30,12 +42,46 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void t(boolean flag) { if (flag != this.bx) { this.bx = flag; -diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java +diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java b/src/main/java/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IEntityAccess.java -+++ b/src/main/java/net/minecraft/server/IEntityAccess.java +--- a/src/main/java/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java ++++ b/src/main/java/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java +@@ -0,0 +0,0 @@ import net.minecraft.world.item.Items; + import net.minecraft.world.item.enchantment.EnchantmentManager; + import net.minecraft.world.level.World; + ++import org.bukkit.entity.HumanEntity; ++ ++import java.util.List; ++ + public class PathfinderGoalHorseTrap extends PathfinderGoal { + + private final EntityHorseSkeleton a; ++ private List<HumanEntity> eligiblePlayers; // Paper + + public PathfinderGoalHorseTrap(EntityHorseSkeleton entityhorseskeleton) { + this.a = entityhorseskeleton; +@@ -0,0 +0,0 @@ public class PathfinderGoalHorseTrap extends PathfinderGoal { + + @Override + public boolean a() { +- return this.a.world.isPlayerNearby(this.a.locX(), this.a.locY(), this.a.locZ(), 10.0D); ++ return !(eligiblePlayers = this.a.world.findNearbyBukkitPlayers(this.a.locX(), this.a.locY(), this.a.locZ(), 10.0D, false)).isEmpty(); // Paper + } + + @Override + public void e() { + WorldServer worldserver = (WorldServer) this.a.world; ++ if (!new com.destroystokyo.paper.event.entity.SkeletonHorseTrapEvent((org.bukkit.entity.SkeletonHorse) this.a.getBukkitEntity(), eligiblePlayers).callEvent()) return; // Paper + DifficultyDamageScaler difficultydamagescaler = worldserver.getDamageScaler(this.a.getChunkCoordinates()); + + this.a.t(false); +diff --git a/src/main/java/net/minecraft/world/level/IEntityAccess.java b/src/main/java/net/minecraft/world/level/IEntityAccess.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/IEntityAccess.java ++++ b/src/main/java/net/minecraft/world/level/IEntityAccess.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.world.level; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; @@ -73,51 +119,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Nullable default EntityHuman findNearbyPlayer(Entity entity, double d0) { return this.a(entity.locX(), entity.locY(), entity.locZ(), d0, false); -diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IEntitySelector.java -+++ b/src/main/java/net/minecraft/server/IEntitySelector.java -@@ -0,0 +0,0 @@ public final class IEntitySelector { - public static final Predicate<Entity> f = (entity) -> { - return !(entity instanceof EntityHuman) || !entity.isSpectator() && !((EntityHuman) entity).isCreative() && entity.world.getDifficulty() != EnumDifficulty.PEACEFUL; - }; -+ public static Predicate<Entity> notSpectator() { return g; } // Paper - OBFHELPER - public static final Predicate<Entity> g = (entity) -> { - return !entity.isSpectator(); - }; -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - -+import org.bukkit.entity.HumanEntity; -+ -+import java.util.List; -+ - public class PathfinderGoalHorseTrap extends PathfinderGoal { - - private final EntityHorseSkeleton a; -+ private List<HumanEntity> eligiblePlayers; // Paper - - public PathfinderGoalHorseTrap(EntityHorseSkeleton entityhorseskeleton) { - this.a = entityhorseskeleton; -@@ -0,0 +0,0 @@ public class PathfinderGoalHorseTrap extends PathfinderGoal { - - @Override - public boolean a() { -- return this.a.world.isPlayerNearby(this.a.locX(), this.a.locY(), this.a.locZ(), 10.0D); -+ return !(eligiblePlayers = this.a.world.findNearbyBukkitPlayers(this.a.locX(), this.a.locY(), this.a.locZ(), 10.0D, false)).isEmpty(); // Paper - } - - @Override - public void e() { - WorldServer worldserver = (WorldServer) this.a.world; -+ if (!new com.destroystokyo.paper.event.entity.SkeletonHorseTrapEvent((org.bukkit.entity.SkeletonHorse) this.a.getBukkitEntity(), eligiblePlayers).callEvent()) return; // Paper - DifficultyDamageScaler difficultydamagescaler = worldserver.getDamageScaler(this.a.getChunkCoordinates()); - - this.a.t(false); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java diff --git a/Spigot-Server-Patches/Skip-distance-map-update-when-spawning-disabled.patch b/Spigot-Server-Patches/Skip-distance-map-update-when-spawning-disabled.patch index 94b0a1bfa1..65512c9a1e 100644 --- a/Spigot-Server-Patches/Skip-distance-map-update-when-spawning-disabled.patch +++ b/Spigot-Server-Patches/Skip-distance-map-update-when-spawning-disabled.patch @@ -4,10 +4,10 @@ Date: Fri, 14 Feb 2020 19:39:59 +0000 Subject: [PATCH] Skip distance map update when spawning disabled. -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { int l = this.chunkMapDistance.b(); // Paper start - per player mob spawning diff --git a/Spigot-Server-Patches/Slime-Pathfinder-Events.patch b/Spigot-Server-Patches/Slime-Pathfinder-Events.patch index ef36fd9e7f..bc814678df 100644 --- a/Spigot-Server-Patches/Slime-Pathfinder-Events.patch +++ b/Spigot-Server-Patches/Slime-Pathfinder-Events.patch @@ -4,13 +4,13 @@ Date: Fri, 24 Aug 2018 08:18:42 -0500 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 +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java b/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntitySlime.java -+++ b/src/main/java/net/minecraft/server/EntitySlime.java -@@ -0,0 +0,0 @@ import java.util.Optional; - import java.util.Random; - import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.levelgen.SeededRandom; + import net.minecraft.world.level.storage.loot.LootTables; + import net.minecraft.world.phys.Vec3D; +// Paper start +import com.destroystokyo.paper.event.entity.SlimeChangeDirectionEvent; diff --git a/Spigot-Server-Patches/Spawn-player-in-correct-world-on-login.patch b/Spigot-Server-Patches/Spawn-player-in-correct-world-on-login.patch index ef6c1bba8e..1bf01a8259 100644 --- a/Spigot-Server-Patches/Spawn-player-in-correct-world-on-login.patch +++ b/Spigot-Server-Patches/Spawn-player-in-correct-world-on-login.patch @@ -4,10 +4,10 @@ Date: Fri, 3 Jul 2020 14:57:05 -0400 Subject: [PATCH] Spawn player in correct world on login -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { }String lastKnownName = s; // Paper // CraftBukkit end diff --git a/Spigot-Server-Patches/Stop-copy-on-write-operations-for-updating-light-dat.patch b/Spigot-Server-Patches/Stop-copy-on-write-operations-for-updating-light-dat.patch index bfe46d3ee4..1339474e1b 100644 --- a/Spigot-Server-Patches/Stop-copy-on-write-operations-for-updating-light-dat.patch +++ b/Spigot-Server-Patches/Stop-copy-on-write-operations-for-updating-light-dat.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Stop copy-on-write operations for updating light data Causes huge memory allocations + gc issues -diff --git a/src/main/java/net/minecraft/server/LightEngineStorage.java b/src/main/java/net/minecraft/server/LightEngineStorage.java +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorage.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorage.java +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java @@ -0,0 +0,0 @@ public abstract class LightEngineStorage<M extends LightEngineStorageArray<M>> e protected final LongSet b = new LongOpenHashSet(); protected final LongSet c = new LongOpenHashSet(); @@ -62,10 +62,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.g.clear(); } -diff --git a/src/main/java/net/minecraft/server/LightEngineStorageArray.java b/src/main/java/net/minecraft/server/LightEngineStorageArray.java +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorageArray.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorageArray.java +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java @@ -0,0 +0,0 @@ public abstract class LightEngineStorageArray<M extends LightEngineStorageArray< private final long[] b = new long[2]; private final NibbleArray[] c = new NibbleArray[2]; @@ -148,11 +148,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public void d() { -diff --git a/src/main/java/net/minecraft/server/LightEngineStorageBlock.java b/src/main/java/net/minecraft/server/LightEngineStorageBlock.java +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageBlock.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorageBlock.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorageBlock.java -@@ -0,0 +0,0 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageBlock.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageBlock.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.chunk.NibbleArray; public class LightEngineStorageBlock extends LightEngineStorage<LightEngineStorageBlock.a> { protected LightEngineStorageBlock(ILightAccess ilightaccess) { @@ -178,10 +178,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } } -diff --git a/src/main/java/net/minecraft/server/LightEngineStorageSky.java b/src/main/java/net/minecraft/server/LightEngineStorageSky.java +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorageSky.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorageSky.java +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java @@ -0,0 +0,0 @@ public class LightEngineStorageSky extends LightEngineStorage<LightEngineStorage private volatile boolean p; diff --git a/Spigot-Server-Patches/Store-counts-for-each-Entity-Block-Entity-Type.patch b/Spigot-Server-Patches/Store-counts-for-each-Entity-Block-Entity-Type.patch index 11069e39e0..8b01ce0da7 100644 --- a/Spigot-Server-Patches/Store-counts-for-each-Entity-Block-Entity-Type.patch +++ b/Spigot-Server-Patches/Store-counts-for-each-Entity-Block-Entity-Type.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Store counts for each Entity/Block Entity Type Opens door for future patches to optimize performance -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { } diff --git a/Spigot-Server-Patches/Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch b/Spigot-Server-Patches/Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch index 3356231462..9f114c71ca 100644 --- a/Spigot-Server-Patches/Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch +++ b/Spigot-Server-Patches/Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch @@ -7,10 +7,67 @@ Subject: [PATCH] Store reference to current Chunk for Entity and Block This enables us a fast reference to the entities current chunk instead of having to look it up by hashmap lookups. -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + } + + public boolean isChunkLoaded() { +- return world.isChunkLoaded((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); ++ return getCurrentChunk() != null; + } + // CraftBukkit end + +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + } + + // Paper start ++ java.lang.ref.WeakReference<net.minecraft.world.level.chunk.Chunk> currentChunk = null; ++ ++ public void setCurrentChunk(net.minecraft.world.level.chunk.Chunk chunk) { ++ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null; ++ } ++ /** ++ * Returns the entities current registered chunk. If the entity is not added to a chunk yet, it will return null ++ */ ++ public net.minecraft.world.level.chunk.Chunk getCurrentChunk() { ++ final net.minecraft.world.level.chunk.Chunk chunk = currentChunk != null ? currentChunk.get() : null; ++ if (chunk != null && chunk.loaded) { ++ return chunk; ++ } ++ ++ return !inChunk ? null : ((WorldServer)world).getChunkProvider().getChunkAtIfLoadedMainThreadNoCache(chunkX, chunkZ); ++ } ++ + private MinecraftKey entityKey; + private String entityKeyString; + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +@@ -0,0 +0,0 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / + getMinecraftKey(); // Try to load if it doesn't exists. + return tileEntityKeyString; + } ++ ++ private java.lang.ref.WeakReference<Chunk> currentChunk = null; ++ public Chunk getCurrentChunk() { ++ final Chunk chunk = currentChunk != null ? currentChunk.get() : null; ++ return chunk != null && chunk.loaded ? chunk : null; ++ } ++ public void setCurrentChunk(Chunk chunk) { ++ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null; ++ } + // Paper end + + @Nullable +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java @@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { this(world, chunkcoordintpair, biomestorage, ChunkConverter.a, TickListEmpty.b(), TickListEmpty.b(), 0L, (ChunkSection[]) null, (Consumer) null); } @@ -79,71 +136,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.entities.remove(entity); // Paper } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 boolean isChunkLoaded() { -- return world.isChunkLoaded((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); -+ return getCurrentChunk() != null; - } - // CraftBukkit end - -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } - - // Paper start -+ java.lang.ref.WeakReference<Chunk> currentChunk = null; -+ -+ public void setCurrentChunk(Chunk chunk) { -+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null; -+ } -+ /** -+ * Returns the entities current registered chunk. If the entity is not added to a chunk yet, it will return null -+ */ -+ public Chunk getCurrentChunk() { -+ final Chunk chunk = currentChunk != null ? currentChunk.get() : null; -+ if (chunk != null && chunk.loaded) { -+ return chunk; -+ } -+ -+ return !inChunk ? null : ((WorldServer)world).getChunkProvider().getChunkAtIfLoadedMainThreadNoCache(chunkX, chunkZ); -+ } -+ - private MinecraftKey entityKey; - private String entityKeyString; - -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 - getMinecraftKey(); // Try to load if it doesn't exists. - return tileEntityKeyString; - } -+ -+ private java.lang.ref.WeakReference<Chunk> currentChunk = null; -+ public Chunk getCurrentChunk() { -+ final Chunk chunk = currentChunk != null ? currentChunk.get() : null; -+ return chunk != null && chunk.loaded ? chunk : null; -+ } -+ public void setCurrentChunk(Chunk chunk) { -+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null; -+ } - // Paper end - - @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -0,0 +0,0 @@ import net.minecraft.server.EntityZombieVillager; - import net.minecraft.server.IChatBaseComponent; - import net.minecraft.server.NBTBase; - import net.minecraft.server.NBTTagCompound; +@@ -0,0 +0,0 @@ import net.minecraft.world.entity.vehicle.EntityMinecartMobSpawner; + import net.minecraft.world.entity.vehicle.EntityMinecartRideable; + import net.minecraft.world.entity.vehicle.EntityMinecartTNT; + import net.minecraft.world.phys.AxisAlignedBB; +import org.bukkit.Chunk; // Paper import org.bukkit.EntityEffect; import org.bukkit.Location; @@ -154,7 +154,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public Chunk getChunk() { -+ net.minecraft.server.Chunk currentChunk = entity.getCurrentChunk(); ++ net.minecraft.world.level.chunk.Chunk currentChunk = entity.getCurrentChunk(); + return currentChunk != null ? currentChunk.bukkitChunk : getLocation().getChunk(); + } + diff --git a/Spigot-Server-Patches/String-based-Action-Bar-API.patch b/Spigot-Server-Patches/String-based-Action-Bar-API.patch index 3f64b24f7b..65ab193fc5 100644 --- a/Spigot-Server-Patches/String-based-Action-Bar-API.patch +++ b/Spigot-Server-Patches/String-based-Action-Bar-API.patch @@ -4,10 +4,10 @@ Date: Tue, 27 Dec 2016 15:02:42 -0500 Subject: [PATCH] String based Action Bar API -diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java +diff --git a/src/main/java/net/minecraft/SystemUtils.java b/src/main/java/net/minecraft/SystemUtils.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SystemUtils.java -+++ b/src/main/java/net/minecraft/server/SystemUtils.java +--- a/src/main/java/net/minecraft/SystemUtils.java ++++ b/src/main/java/net/minecraft/SystemUtils.java @@ -0,0 +0,0 @@ public class SystemUtils { private static final ExecutorService e = a("Main"); private static final ExecutorService f = n(); diff --git a/Spigot-Server-Patches/Support-old-UUID-format-for-NBT.patch b/Spigot-Server-Patches/Support-old-UUID-format-for-NBT.patch index 4cdc4dd1ae..3a734ee0c5 100644 --- a/Spigot-Server-Patches/Support-old-UUID-format-for-NBT.patch +++ b/Spigot-Server-Patches/Support-old-UUID-format-for-NBT.patch @@ -7,10 +7,10 @@ We have stored UUID in plenty of places that did not get DFU'd So just look for old format and load it if it exists. -diff --git a/src/main/java/net/minecraft/server/GameProfileSerializer.java b/src/main/java/net/minecraft/server/GameProfileSerializer.java +diff --git a/src/main/java/net/minecraft/nbt/GameProfileSerializer.java b/src/main/java/net/minecraft/nbt/GameProfileSerializer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/GameProfileSerializer.java -+++ b/src/main/java/net/minecraft/server/GameProfileSerializer.java +--- a/src/main/java/net/minecraft/nbt/GameProfileSerializer.java ++++ b/src/main/java/net/minecraft/nbt/GameProfileSerializer.java @@ -0,0 +0,0 @@ public final class GameProfileSerializer { s = nbttagcompound.getString("Name"); } @@ -23,10 +23,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (nbttagcompound.b("Id")) { uuid = nbttagcompound.a("Id"); } -diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java +diff --git a/src/main/java/net/minecraft/nbt/NBTTagCompound.java b/src/main/java/net/minecraft/nbt/NBTTagCompound.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/NBTTagCompound.java -+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java +--- a/src/main/java/net/minecraft/nbt/NBTTagCompound.java ++++ b/src/main/java/net/minecraft/nbt/NBTTagCompound.java @@ -0,0 +0,0 @@ public class NBTTagCompound implements NBTBase { public void setUUID(String prefix, UUID uuid) { a(prefix, uuid); } // Paper - OBFHELPER diff --git a/Spigot-Server-Patches/Synchronize-DataPaletteBlock-instead-of-ReentrantLoc.patch b/Spigot-Server-Patches/Synchronize-DataPaletteBlock-instead-of-ReentrantLoc.patch index 6599ac8f3e..74c23e24d8 100644 --- a/Spigot-Server-Patches/Synchronize-DataPaletteBlock-instead-of-ReentrantLoc.patch +++ b/Spigot-Server-Patches/Synchronize-DataPaletteBlock-instead-of-ReentrantLoc.patch @@ -12,10 +12,10 @@ contention situations. And this is extremely a low contention situation. -diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DataPaletteBlock.java -+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java +--- a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java ++++ b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java @@ -0,0 +0,0 @@ public class DataPaletteBlock<T> implements DataPaletteExpandable<T> { private int i; private int getBitsPerObject() { return this.i; } // Paper - OBFHELPER private final ReentrantLock j = new ReentrantLock(); diff --git a/Spigot-Server-Patches/Thread-Safe-Vanilla-Command-permission-checking.patch b/Spigot-Server-Patches/Thread-Safe-Vanilla-Command-permission-checking.patch index 354d62cffa..dba1a7ff45 100644 --- a/Spigot-Server-Patches/Thread-Safe-Vanilla-Command-permission-checking.patch +++ b/Spigot-Server-Patches/Thread-Safe-Vanilla-Command-permission-checking.patch @@ -25,10 +25,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/CommandListenerWrapper.java b/src/main/java/net/minecraft/server/CommandListenerWrapper.java +diff --git a/src/main/java/net/minecraft/commands/CommandListenerWrapper.java b/src/main/java/net/minecraft/commands/CommandListenerWrapper.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CommandListenerWrapper.java -+++ b/src/main/java/net/minecraft/server/CommandListenerWrapper.java +--- a/src/main/java/net/minecraft/commands/CommandListenerWrapper.java ++++ b/src/main/java/net/minecraft/commands/CommandListenerWrapper.java @@ -0,0 +0,0 @@ public class CommandListenerWrapper implements ICompletionProvider, com.destroys private final ResultConsumer<CommandListenerWrapper> l; private final ArgumentAnchor.Anchor m; diff --git a/Spigot-Server-Patches/Throw-proper-exception-on-empty-JsonList-file.patch b/Spigot-Server-Patches/Throw-proper-exception-on-empty-JsonList-file.patch index 22d867f17f..71fc1d2adb 100644 --- a/Spigot-Server-Patches/Throw-proper-exception-on-empty-JsonList-file.patch +++ b/Spigot-Server-Patches/Throw-proper-exception-on-empty-JsonList-file.patch @@ -4,10 +4,10 @@ Date: Sun, 1 Nov 2020 16:43:11 +0100 Subject: [PATCH] Throw proper exception on empty JsonList file -diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java +diff --git a/src/main/java/net/minecraft/server/players/JsonList.java b/src/main/java/net/minecraft/server/players/JsonList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/JsonList.java -+++ b/src/main/java/net/minecraft/server/JsonList.java +--- a/src/main/java/net/minecraft/server/players/JsonList.java ++++ b/src/main/java/net/minecraft/server/players/JsonList.java @@ -0,0 +0,0 @@ public abstract class JsonList<K, V extends JsonListEntry<K>> { try { diff --git a/Spigot-Server-Patches/Timings-v2.patch b/Spigot-Server-Patches/Timings-v2.patch index e328620d08..2d1c5518a2 100644 --- a/Spigot-Server-Patches/Timings-v2.patch +++ b/Spigot-Server-Patches/Timings-v2.patch @@ -13,7 +13,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +package co.aikar.timings; + +import com.google.common.collect.MapMaker; -+import net.minecraft.server.*; ++import net.minecraft.commands.CustomFunction; ++import net.minecraft.network.protocol.Packet; ++import net.minecraft.world.level.block.Block; ++import net.minecraft.world.level.block.entity.TileEntity; +import org.bukkit.plugin.Plugin; +import org.bukkit.scheduler.BukkitTask; + @@ -115,7 +118,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + /** + * Get a named timer for the specified entity type to track type specific timings. -+ * @param entity ++ * @param entityType + * @return + */ + public static Timing getEntityTimings(String entityType, String type) { @@ -717,178 +720,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + " - Server Name: " + timingsServerName); + } } -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java +diff --git a/src/main/java/net/minecraft/commands/CustomFunction.java b/src/main/java/net/minecraft/commands/CustomFunction.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 extends BlockBase implements IMaterial { - }); - protected final BlockStateList<Block, IBlockData> blockStateList; - private IBlockData blockData; -+ // Paper start -+ public co.aikar.timings.Timing timing; -+ public co.aikar.timings.Timing getTiming() { -+ if (timing == null) { -+ timing = co.aikar.timings.MinecraftTimings.getBlockTiming(this); -+ } -+ return timing; -+ } -+ // Paper end - @Nullable - private String name; - @Nullable -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(this.bukkitChunk, this.needsDecoration)); - - if (this.needsDecoration) { -+ try (co.aikar.timings.Timing ignored = this.world.timings.chunkLoadPopulate.startTiming()) { // Paper - this.needsDecoration = false; - java.util.Random random = new java.util.Random(); - random.setSeed(world.getSeed()); -@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { - } - } - server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk)); -+ } // Paper - } - } - } -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { - } - - gameprofilerfiller.c("getChunkCacheMiss"); -- world.timings.syncChunkLoadTimer.startTiming(); // Spigot - CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = this.getChunkFutureMainThread(i, j, chunkstatus, flag); - -+ if (!completablefuture.isDone()) { // Paper -+ this.world.timings.syncChunkLoad.startTiming(); // Paper - this.serverThreadQueue.awaitTasks(completablefuture::isDone); -- world.timings.syncChunkLoadTimer.stopTiming(); // Spigot -+ this.world.timings.syncChunkLoad.stopTiming(); // Paper -+ } // Paper - ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { - return ichunkaccess1; - }, (playerchunk_failure) -> { -@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { - - public void save(boolean flag) { - this.tickDistanceManager(); -+ try (co.aikar.timings.Timing timed = world.timings.chunkSaveData.startTiming()) { // Paper - Timings - this.playerChunkMap.save(flag); -+ } // Paper - Timings - } - - @Override -@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { - this.tickDistanceManager(); - this.world.timings.doChunkMap.stopTiming(); // Spigot - this.world.getMethodProfiler().exitEnter("chunks"); -+ this.world.timings.chunks.startTiming(); // Paper - timings - this.tickChunks(); -+ this.world.timings.chunks.stopTiming(); // Paper - timings - this.world.timings.doChunkUnload.startTiming(); // Spigot - this.world.getMethodProfiler().exitEnter("unload"); - this.playerChunkMap.unloadChunks(booleansupplier); -@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { - boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit - - this.world.getMethodProfiler().enter("naturalSpawnCount"); -+ this.world.timings.countNaturalMobs.startTiming(); // Paper - timings - int l = this.chunkMapDistance.b(); - SpawnerCreature.d spawnercreature_d = SpawnerCreature.a(l, this.world.A(), this::a); -+ this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings - - this.p = spawnercreature_d; - this.world.getMethodProfiler().exit(); -@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { - - if (optional.isPresent()) { - this.world.getMethodProfiler().enter("broadcast"); -+ this.world.timings.broadcastChunkUpdates.startTiming(); // Paper - timings - playerchunk.a((Chunk) optional.get()); -+ this.world.timings.broadcastChunkUpdates.stopTiming(); // Paper - timings - this.world.getMethodProfiler().exit(); - Optional<Chunk> optional1 = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); - -@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { - SpawnerCreature.a(this.world, chunk, spawnercreature_d, this.allowAnimals, this.allowMonsters, flag2); - } - -- this.world.timings.doTickTiles.startTiming(); // Spigot -+ this.world.timings.chunkTicks.startTiming(); // Spigot // Paper - this.world.a(chunk, k); -- this.world.timings.doTickTiles.stopTiming(); // Spigot -+ this.world.timings.chunkTicks.stopTiming(); // Spigot // Paper - } - } - } - }); - this.world.getMethodProfiler().enter("customSpawners"); - if (flag1) { -+ try (co.aikar.timings.Timing ignored = this.world.timings.miscMobSpawning.startTiming()) { // Paper - timings - this.world.doMobSpawning(this.allowMonsters, this.allowAnimals); -+ } // Paper - timings - } - - this.world.getMethodProfiler().exit(); - this.world.getMethodProfiler().exit(); - } - -- this.world.timings.tracker.startTiming(); // Spigot - this.playerChunkMap.g(); -- this.world.timings.tracker.stopTiming(); // Spigot - } - - private void a(long i, Consumer<Chunk> consumer) { -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - -+import co.aikar.timings.Timings; - import com.google.common.collect.Maps; - import it.unimi.dsi.fastutil.longs.LongOpenHashSet; - import it.unimi.dsi.fastutil.longs.LongSet; -@@ -0,0 +0,0 @@ public class ChunkRegionLoader { - private static void loadEntities(NBTTagCompound nbttagcompound, Chunk chunk) { - NBTTagList nbttaglist = nbttagcompound.getList("Entities", 10); - World world = chunk.getWorld(); -- world.timings.syncChunkLoadEntitiesTimer.startTiming(); // Spigot - - for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound1 = nbttaglist.getCompound(i); -@@ -0,0 +0,0 @@ public class ChunkRegionLoader { - chunk.d(true); - } - -- world.timings.syncChunkLoadEntitiesTimer.stopTiming(); // Spigot -- world.timings.syncChunkLoadTileEntitiesTimer.startTiming(); // Spigot - NBTTagList nbttaglist1 = nbttagcompound.getList("TileEntities", 10); - - for (int j = 0; j < nbttaglist1.size(); ++j) { -@@ -0,0 +0,0 @@ public class ChunkRegionLoader { - } - } - } -- world.timings.syncChunkLoadTileEntitiesTimer.stopTiming(); // Spigot -- - } - - private static NBTTagCompound a(ChunkCoordIntPair chunkcoordintpair, Map<StructureGenerator<?>, StructureStart<?>> map, Map<StructureGenerator<?>, LongSet> map1) { -diff --git a/src/main/java/net/minecraft/server/CustomFunction.java b/src/main/java/net/minecraft/server/CustomFunction.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/CustomFunction.java -+++ b/src/main/java/net/minecraft/server/CustomFunction.java +--- a/src/main/java/net/minecraft/commands/CustomFunction.java ++++ b/src/main/java/net/minecraft/commands/CustomFunction.java @@ -0,0 +0,0 @@ public class CustomFunction { private final CustomFunction.c[] a; @@ -912,6 +747,33 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public MinecraftKey a() { return this.b; } +diff --git a/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java b/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java ++++ b/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java +@@ -0,0 +0,0 @@ import net.minecraft.server.level.WorldServer; + import net.minecraft.util.thread.IAsyncTaskHandler; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; ++import co.aikar.timings.MinecraftTimings; // Paper ++import co.aikar.timings.Timing; // Paper + + // CraftBukkit start + import net.minecraft.server.MinecraftServer; +@@ -0,0 +0,0 @@ public class PlayerConnectionUtils { + + public static <T extends PacketListener> void ensureMainThread(Packet<T> packet, T t0, IAsyncTaskHandler<?> iasynctaskhandler) throws CancelledPacketHandleException { + if (!iasynctaskhandler.isMainThread()) { ++ Timing timing = MinecraftTimings.getPacketTiming(packet); // Paper - timings + iasynctaskhandler.execute(() -> { + if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) return; // CraftBukkit, MC-142590 + if (t0.a().isConnected()) { ++ try (Timing ignored = timing.startTiming()) { // Paper - timings + packet.a(t0); ++ } // Paper - timings + } else { + PlayerConnectionUtils.LOGGER.debug("Ignoring packet due to disconnection: " + packet); + } diff --git a/src/main/java/net/minecraft/server/CustomFunctionData.java b/src/main/java/net/minecraft/server/CustomFunctionData.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/CustomFunctionData.java @@ -925,253 +787,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.d = true; int k = 0; CustomFunction.c[] acustomfunction_c = customfunction.b(); -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - import org.apache.logging.log4j.Level; - import org.apache.logging.log4j.io.IoBuilder; - import org.bukkit.command.CommandSender; --import org.bukkit.craftbukkit.SpigotTimings; // Spigot -+import co.aikar.timings.MinecraftTimings; // Paper - import org.bukkit.event.server.ServerCommandEvent; -+import org.bukkit.craftbukkit.util.Waitable; - import org.bukkit.event.server.RemoteServerCommandEvent; - // CraftBukkit end - -@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - } - - public void handleCommandQueue() { -- SpigotTimings.serverCommandTimer.startTiming(); // Spigot -+ MinecraftTimings.serverCommandTimer.startTiming(); // Spigot - while (!this.serverCommandQueue.isEmpty()) { - ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0); - -@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - // CraftBukkit end - } - -- SpigotTimings.serverCommandTimer.stopTiming(); // Spigot -+ MinecraftTimings.serverCommandTimer.stopTiming(); // Spigot - } - - @Override -@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - - @Override - public String executeRemoteCommand(String s) { -+ Waitable[] waitableArray = new Waitable[1]; - this.remoteControlCommandListener.clearMessages(); - this.executeSync(() -> { - // CraftBukkit start - fire RemoteServerCommandEvent -@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - if (event.isCancelled()) { - return; - } -+ // Paper start -+ if (s.toLowerCase().startsWith("timings") && s.toLowerCase().matches("timings (report|paste|get|merged|seperate)")) { -+ org.bukkit.command.BufferedCommandSender sender = new org.bukkit.command.BufferedCommandSender(); -+ Waitable<String> waitable = new Waitable<String>() { -+ @Override -+ protected String evaluate() { -+ return sender.getBuffer(); -+ } -+ }; -+ waitableArray[0] = waitable; -+ co.aikar.timings.Timings.generateReport(new co.aikar.timings.TimingsReportListener(sender, waitable)); -+ } else { -+ // Paper end - ServerCommand serverCommand = new ServerCommand(event.getCommand(), remoteControlCommandListener.getWrapper()); - server.dispatchServerCommand(remoteConsole, serverCommand); -+ } // Paper - // CraftBukkit end - }); -+ // Paper start -+ if (waitableArray[0] != null) { -+ //noinspection unchecked -+ Waitable<String> waitable = waitableArray[0]; -+ try { -+ return waitable.get(); -+ } catch (java.util.concurrent.ExecutionException e) { -+ throw new RuntimeException("Exception processing rcon command " + s, e.getCause()); -+ } catch (InterruptedException e) { -+ Thread.currentThread().interrupt(); // Maintain interrupted state -+ throw new RuntimeException("Interrupted processing rcon command " + s, e); -+ } -+ -+ } -+ // Paper end - return this.remoteControlCommandListener.getMessages(); - } - -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent; - import org.bukkit.entity.Hanging; - import org.bukkit.entity.LivingEntity; - import org.bukkit.entity.Vehicle; --import org.spigotmc.CustomTimingsHandler; // Spigot - import org.bukkit.event.entity.EntityCombustByEntityEvent; - import org.bukkit.event.hanging.HangingBreakByEntityEvent; - import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only - public boolean forceExplosionKnockback; // SPIGOT-949 - public boolean persistentInvisibility = false; -- public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot - // Spigot start - public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); - public final boolean defaultActivationState; -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } - - public void move(EnumMoveType enummovetype, Vec3D vec3d) { -- org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot - if (this.noclip) { - this.a(this.getBoundingBox().c(vec3d)); - this.recalcPosition(); -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - - this.world.getMethodProfiler().exit(); - } -- org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot - } - - protected BlockPosition ap() { -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityTeleportEvent; - import org.bukkit.event.player.PlayerItemConsumeEvent; - // CraftBukkit end - --import org.bukkit.craftbukkit.SpigotTimings; // Spigot -+import co.aikar.timings.MinecraftTimings; // Paper - - public abstract class EntityLiving extends Entity { - -@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - - @Override - public void tick() { -- SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot - super.tick(); - this.t(); - this.v(); -@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - } - } - -- SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot - this.movementTick(); -- SpigotTimings.timerEntityTickRest.startTiming(); // Spigot - double d0 = this.locX() - this.lastX; - double d1 = this.locZ() - this.lastZ; - float f = (float) (d0 * d0 + d1 * d1); -@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - if (this.isSleeping()) { - this.pitch = 0.0F; - } -- -- SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot - } - - public void updateEquipment() { // PAIL private->public; updateEquipment -@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - - this.setMot(d4, d5, d6); - this.world.getMethodProfiler().enter("ai"); -- SpigotTimings.timerEntityAI.startTiming(); // Spigot - if (this.isFrozen()) { - this.jumping = false; - this.aR = 0.0F; -@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - this.doTick(); - this.world.getMethodProfiler().exit(); - } -- SpigotTimings.timerEntityAI.stopTiming(); // Spigot - - this.world.getMethodProfiler().exit(); - this.world.getMethodProfiler().enter("jump"); -@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - this.r(); - AxisAlignedBB axisalignedbb = this.getBoundingBox(); - -- SpigotTimings.timerEntityAIMove.startTiming(); // Spigot -+ // SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper - this.g(new Vec3D((double) this.aR, (double) this.aS, (double) this.aT)); -- SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot -+ // SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper - this.world.getMethodProfiler().exit(); - this.world.getMethodProfiler().enter("push"); - if (this.bf > 0) { -@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { - this.a(axisalignedbb, this.getBoundingBox()); - } - -- SpigotTimings.timerEntityAICollision.startTiming(); // Spigot - this.collideNearby(); -- SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot - this.world.getMethodProfiler().exit(); - if (!this.world.isClientSide && this.dO() && this.aG()) { - this.damageEntity(DamageSource.DROWN, 1.0F); -diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTypes.java -+++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { - return IRegistry.ENTITY_TYPE.getOptional(MinecraftKey.a(s)); - } - -- public EntityTypes(EntityTypes.b<T> entitytypes_b, EnumCreatureType enumcreaturetype, boolean flag, boolean flag1, boolean flag2, boolean flag3, ImmutableSet<Block> immutableset, EntitySize entitysize, int i, int j) { -+ public final String id; -+ public EntityTypes(EntityTypes.b<T> entitytypes_b, EnumCreatureType enumcreaturetype, boolean flag, boolean flag1, boolean flag2, boolean flag3, ImmutableSet<Block> immutableset, EntitySize entitysize, int i, int j) { this(entitytypes_b, enumcreaturetype, flag, flag1, flag2, flag3, immutableset, entitysize, i, j, "custom"); } // Paper - old signature -+ public EntityTypes(EntityTypes.b<T> entitytypes_b, EnumCreatureType enumcreaturetype, boolean flag, boolean flag1, boolean flag2, boolean flag3, ImmutableSet<Block> immutableset, EntitySize entitysize, int i, int j, String id) { // Paper - add id - this.bf = entitytypes_b; - this.bg = enumcreaturetype; - this.bl = flag3; -@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { - this.br = entitysize; - this.bm = i; - this.bn = j; -+ -+ // Paper start - timings -+ this.id = id; -+ this.tickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "tick"); -+ this.inactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "inactiveTick"); -+ this.passengerTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerTick"); -+ this.passengerInactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerInactiveTick"); -+ // Paper end - } - - @Nullable -@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { - return this.bn; - } - -+ // Paper start - timings -+ public final co.aikar.timings.Timing tickTimer; -+ public final co.aikar.timings.Timing inactiveTickTimer; -+ public final co.aikar.timings.Timing passengerTickTimer; -+ public final co.aikar.timings.Timing passengerInactiveTickTimer; -+ // Paper end - public boolean isDeltaTracking() { - return this != EntityTypes.PLAYER && this != EntityTypes.LLAMA_SPIT && this != EntityTypes.WITHER && this != EntityTypes.BAT && this != EntityTypes.ITEM_FRAME && this != EntityTypes.LEASH_KNOT && this != EntityTypes.PAINTING && this != EntityTypes.END_CRYSTAL && this != EntityTypes.EVOKER_FANGS; - } -@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { - SystemUtils.a(DataConverterTypes.ENTITY_TREE, s); - } - -- return new EntityTypes<>(this.a, this.b, this.d, this.e, this.f, this.g, this.c, this.j, this.h, this.i); -+ return new EntityTypes<>(this.a, this.b, this.d, this.e, this.f, this.g, this.c, this.j, this.h, this.i, s); // Paper - add id - } - } - diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -1366,12 +981,184 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.methodProfiler.exit(); } -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.DataPackConfiguration; + import org.apache.logging.log4j.Level; + import org.apache.logging.log4j.io.IoBuilder; + import org.bukkit.command.CommandSender; +-import org.bukkit.craftbukkit.SpigotTimings; // Spigot ++import co.aikar.timings.MinecraftTimings; // Paper + import org.bukkit.event.server.ServerCommandEvent; ++import org.bukkit.craftbukkit.util.Waitable; + import org.bukkit.event.server.RemoteServerCommandEvent; + // CraftBukkit end + +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + } + + public void handleCommandQueue() { +- SpigotTimings.serverCommandTimer.startTiming(); // Spigot ++ MinecraftTimings.serverCommandTimer.startTiming(); // Spigot + while (!this.serverCommandQueue.isEmpty()) { + ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0); + +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + // CraftBukkit end + } + +- SpigotTimings.serverCommandTimer.stopTiming(); // Spigot ++ MinecraftTimings.serverCommandTimer.stopTiming(); // Spigot + } + + @Override +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + + @Override + public String executeRemoteCommand(String s) { ++ Waitable[] waitableArray = new Waitable[1]; + this.remoteControlCommandListener.clearMessages(); + this.executeSync(() -> { + // CraftBukkit start - fire RemoteServerCommandEvent +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + if (event.isCancelled()) { + return; + } ++ // Paper start ++ if (s.toLowerCase().startsWith("timings") && s.toLowerCase().matches("timings (report|paste|get|merged|seperate)")) { ++ org.bukkit.command.BufferedCommandSender sender = new org.bukkit.command.BufferedCommandSender(); ++ Waitable<String> waitable = new Waitable<String>() { ++ @Override ++ protected String evaluate() { ++ return sender.getBuffer(); ++ } ++ }; ++ waitableArray[0] = waitable; ++ co.aikar.timings.Timings.generateReport(new co.aikar.timings.TimingsReportListener(sender, waitable)); ++ } else { ++ // Paper end + ServerCommand serverCommand = new ServerCommand(event.getCommand(), remoteControlCommandListener.getWrapper()); + server.dispatchServerCommand(remoteConsole, serverCommand); ++ } // Paper + // CraftBukkit end + }); ++ // Paper start ++ if (waitableArray[0] != null) { ++ //noinspection unchecked ++ Waitable<String> waitable = waitableArray[0]; ++ try { ++ return waitable.get(); ++ } catch (java.util.concurrent.ExecutionException e) { ++ throw new RuntimeException("Exception processing rcon command " + s, e.getCause()); ++ } catch (InterruptedException e) { ++ Thread.currentThread().interrupt(); // Maintain interrupted state ++ throw new RuntimeException("Interrupted processing rcon command " + s, e); ++ } ++ ++ } ++ // Paper end + return this.remoteControlCommandListener.getMessages(); + } + +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { + } + + gameprofilerfiller.c("getChunkCacheMiss"); +- world.timings.syncChunkLoadTimer.startTiming(); // Spigot + CompletableFuture<Either<IChunkAccess, PlayerChunk.Failure>> completablefuture = this.getChunkFutureMainThread(i, j, chunkstatus, flag); + ++ if (!completablefuture.isDone()) { // Paper ++ this.world.timings.syncChunkLoad.startTiming(); // Paper + this.serverThreadQueue.awaitTasks(completablefuture::isDone); +- world.timings.syncChunkLoadTimer.stopTiming(); // Spigot ++ this.world.timings.syncChunkLoad.stopTiming(); // Paper ++ } // Paper + ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { + return ichunkaccess1; + }, (playerchunk_failure) -> { +@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { + + public void save(boolean flag) { + this.tickDistanceManager(); ++ try (co.aikar.timings.Timing timed = world.timings.chunkSaveData.startTiming()) { // Paper - Timings + this.playerChunkMap.save(flag); ++ } // Paper - Timings + } + + @Override +@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { + this.tickDistanceManager(); + this.world.timings.doChunkMap.stopTiming(); // Spigot + this.world.getMethodProfiler().exitEnter("chunks"); ++ this.world.timings.chunks.startTiming(); // Paper - timings + this.tickChunks(); ++ this.world.timings.chunks.stopTiming(); // Paper - timings + this.world.timings.doChunkUnload.startTiming(); // Spigot + this.world.getMethodProfiler().exitEnter("unload"); + this.playerChunkMap.unloadChunks(booleansupplier); +@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { + boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit + + this.world.getMethodProfiler().enter("naturalSpawnCount"); ++ this.world.timings.countNaturalMobs.startTiming(); // Paper - timings + int l = this.chunkMapDistance.b(); + SpawnerCreature.d spawnercreature_d = SpawnerCreature.a(l, this.world.A(), this::a); ++ this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings + + this.p = spawnercreature_d; + this.world.getMethodProfiler().exit(); +@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { + + if (optional.isPresent()) { + this.world.getMethodProfiler().enter("broadcast"); ++ this.world.timings.broadcastChunkUpdates.startTiming(); // Paper - timings + playerchunk.a((Chunk) optional.get()); ++ this.world.timings.broadcastChunkUpdates.stopTiming(); // Paper - timings + this.world.getMethodProfiler().exit(); + Optional<Chunk> optional1 = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); + +@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { + SpawnerCreature.a(this.world, chunk, spawnercreature_d, this.allowAnimals, this.allowMonsters, flag2); + } + +- this.world.timings.doTickTiles.startTiming(); // Spigot ++ this.world.timings.chunkTicks.startTiming(); // Spigot // Paper + this.world.a(chunk, k); +- this.world.timings.doTickTiles.stopTiming(); // Spigot ++ this.world.timings.chunkTicks.stopTiming(); // Spigot // Paper + } + } + } + }); + this.world.getMethodProfiler().enter("customSpawners"); + if (flag1) { ++ try (co.aikar.timings.Timing ignored = this.world.timings.miscMobSpawning.startTiming()) { // Paper - timings + this.world.doMobSpawning(this.allowMonsters, this.allowAnimals); ++ } // Paper - timings + } + + this.world.getMethodProfiler().exit(); + this.world.getMethodProfiler().exit(); + } + +- this.world.timings.tracker.startTiming(); // Spigot + this.playerChunkMap.g(); +- this.world.timings.tracker.stopTiming(); // Spigot + } + + private void a(long i, Consumer<Chunk> consumer) { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ - package net.minecraft.server; + package net.minecraft.server.level; +import co.aikar.timings.Timing; // Paper import com.google.common.collect.ImmutableList; @@ -1461,231 +1248,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } protected void broadcast(Entity entity, Packet<?> packet) { -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -0,0 +0,0 @@ import org.bukkit.inventory.CraftingInventory; - import org.bukkit.inventory.EquipmentSlot; - import org.bukkit.inventory.InventoryView; - import org.bukkit.util.NumberConversions; -+import co.aikar.timings.MinecraftTimings; // Paper - // CraftBukkit end - - public class PlayerConnection implements PacketListenerPlayIn { -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { - // CraftBukkit end - - public void tick() { -- org.bukkit.craftbukkit.SpigotTimings.playerConnectionTimer.startTiming(); // Spigot - this.syncPosition(); - this.player.lastX = this.player.locX(); - this.player.lastY = this.player.locY(); -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { - this.player.resetIdleTimer(); // CraftBukkit - SPIGOT-854 - this.disconnect(new ChatMessage("multiplayer.disconnect.idling")); - } -- org.bukkit.craftbukkit.SpigotTimings.playerConnectionTimer.stopTiming(); // Spigot - - } - -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { - // CraftBukkit end - - private void handleCommand(String s) { -- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot -+ MinecraftTimings.playerCommandTimer.startTiming(); // Paper - // CraftBukkit start - whole method - if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot - this.LOGGER.info(this.player.getName() + " issued server command: " + s); -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { - this.server.getPluginManager().callEvent(event); - - if (event.isCancelled()) { -- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot -+ MinecraftTimings.playerCommandTimer.stopTiming(); // Paper - return; - } - -@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { - java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - return; - } finally { -- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot -+ MinecraftTimings.playerCommandTimer.stopTiming(); // Paper - } - // this.minecraftServer.getCommandDispatcher().a(this.player.getCommandListener(), s); - // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java -+++ b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java -@@ -0,0 +0,0 @@ package net.minecraft.server; - - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -+import co.aikar.timings.MinecraftTimings; // Paper -+import co.aikar.timings.Timing; // Paper - - public class PlayerConnectionUtils { - -@@ -0,0 +0,0 @@ public class PlayerConnectionUtils { - - public static <T extends PacketListener> void ensureMainThread(Packet<T> packet, T t0, IAsyncTaskHandler<?> iasynctaskhandler) throws CancelledPacketHandleException { - if (!iasynctaskhandler.isMainThread()) { -+ Timing timing = MinecraftTimings.getPacketTiming(packet); // Paper - timings - iasynctaskhandler.execute(() -> { - if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) return; // CraftBukkit, MC-142590 - if (t0.a().isConnected()) { -+ try (Timing ignored = timing.startTiming()) { // Paper - timings - packet.a(t0); -+ } // Paper - timings - } else { - PlayerConnectionUtils.LOGGER.debug("Ignoring packet due to disconnection: " + packet); - } -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; - -+import co.aikar.timings.MinecraftTimings; - import com.google.common.collect.Lists; - import com.google.common.collect.Maps; - import com.google.common.collect.Sets; -@@ -0,0 +0,0 @@ public abstract class PlayerList { - } - - public void savePlayers() { -+ MinecraftTimings.savePlayers.startTiming(); // Paper - for (int i = 0; i < this.players.size(); ++i) { - this.savePlayerFile((EntityPlayer) this.players.get(i)); - } -- -+ MinecraftTimings.savePlayers.stopTiming(); // Paper - } - - public WhiteList getWhitelist() { -diff --git a/src/main/java/net/minecraft/server/TickListServer.java b/src/main/java/net/minecraft/server/TickListServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TickListServer.java -+++ b/src/main/java/net/minecraft/server/TickListServer.java -@@ -0,0 +0,0 @@ public class TickListServer<T> implements TickList<T> { - private final List<NextTickListEntry<T>> g = Lists.newArrayList(); - private final Consumer<NextTickListEntry<T>> h; - -- public TickListServer(WorldServer worldserver, Predicate<T> predicate, Function<T, MinecraftKey> function, Consumer<NextTickListEntry<T>> consumer) { -+ public TickListServer(WorldServer worldserver, Predicate<T> predicate, Function<T, MinecraftKey> function, Consumer<NextTickListEntry<T>> consumer, String timingsType) { // Paper - this.a = predicate; - this.b = function; - this.e = worldserver; - this.h = consumer; -+ this.timingCleanup = co.aikar.timings.WorldTimingsHandler.getTickList(worldserver, timingsType + " - Cleanup"); -+ this.timingTicking = co.aikar.timings.WorldTimingsHandler.getTickList(worldserver, timingsType + " - Ticking"); - } -+ private final co.aikar.timings.Timing timingCleanup; // Paper -+ private final co.aikar.timings.Timing timingTicking; // Paper -+ // Paper end - - public void b() { - int i = this.nextTickList.size(); -@@ -0,0 +0,0 @@ public class TickListServer<T> implements TickList<T> { - - this.e.getMethodProfiler().enter("cleaning"); - -+ this.timingCleanup.startTiming(); // Paper - NextTickListEntry nextticklistentry; - - while (i > 0 && iterator.hasNext()) { -@@ -0,0 +0,0 @@ public class TickListServer<T> implements TickList<T> { - --i; - } - } -+ this.timingCleanup.stopTiming(); // Paper - -+ this.timingTicking.startTiming(); // Paper - this.e.getMethodProfiler().exitEnter("ticking"); - - while ((nextticklistentry = (NextTickListEntry) this.f.poll()) != null) { -@@ -0,0 +0,0 @@ public class TickListServer<T> implements TickList<T> { - } - } - -+ this.timingTicking.stopTiming(); // Paper - this.e.getMethodProfiler().exit(); - this.g.clear(); - this.f.clear(); -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/TileEntity.java -+++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -0,0 +0,0 @@ import org.bukkit.inventory.InventoryHolder; - // CraftBukkit end - - import org.spigotmc.CustomTimingsHandler; // Spigot -+import co.aikar.timings.MinecraftTimings; // Paper -+import co.aikar.timings.Timing; // Paper - - public abstract class TileEntity implements KeyedObject { // Paper - -- public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot -+ public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper - // CraftBukkit start - data containers - private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); - public CraftPersistentDataContainer persistentDataContainer; -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - import java.util.HashMap; - import java.util.Map; - import org.bukkit.Bukkit; --import org.bukkit.craftbukkit.SpigotTimings; // Spigot - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.CraftWorld; - import org.bukkit.craftbukkit.block.CapturedBlockState; -@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - - public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper - -- public final SpigotTimings.WorldTimingsHandler timings; // Spigot -+ public final co.aikar.timings.WorldTimingsHandler timings; // Paper - public static BlockPosition lastPhysicsProblem; // Spigot - private org.spigotmc.TickLimiter entityLimiter; - private org.spigotmc.TickLimiter tileLimiter; -@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - public void c(WorldBorder worldborder, double d0) {} - }); - // CraftBukkit end -- timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings -+ timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings - this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); - this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); - } -@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - } - - timings.tileEntityPending.stopTiming(); // Spigot -+ co.aikar.timings.TimingHistory.tileEntityTicks += this.tileEntityListTick.size(); // Paper - gameprofilerfiller.exit(); - spigotConfig.currentPrimedTnt = 0; // Spigot - } - - public void a(Consumer<Entity> consumer, Entity entity) { - try { -- SpigotTimings.tickEntityTimer.startTiming(); // Spigot - consumer.accept(entity); -- SpigotTimings.tickEntityTimer.stopTiming(); // Spigot - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.a(throwable, "Ticking entity"); - CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being ticked"); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -0,0 +0,0 @@ package net.minecraft.server; +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ package net.minecraft.server.level; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Iterables; @@ -1694,8 +1261,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Queues; -@@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; - import java.util.logging.Level; +@@ -0,0 +0,0 @@ import net.minecraft.world.level.block.ITileEntity; + import net.minecraft.world.level.storage.WorldDataServer; import org.bukkit.Bukkit; import org.bukkit.WeatherType; -import org.bukkit.craftbukkit.SpigotTimings; // Spigot @@ -1808,6 +1375,442 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // CraftBukkit start - moved from MinecraftServer.saveChunks +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -0,0 +0,0 @@ import org.bukkit.inventory.CraftingInventory; + import org.bukkit.inventory.EquipmentSlot; + import org.bukkit.inventory.InventoryView; + import org.bukkit.util.NumberConversions; ++import co.aikar.timings.MinecraftTimings; // Paper + // CraftBukkit end + + public class PlayerConnection implements PacketListenerPlayIn { +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { + // CraftBukkit end + + public void tick() { +- org.bukkit.craftbukkit.SpigotTimings.playerConnectionTimer.startTiming(); // Spigot + this.syncPosition(); + this.player.lastX = this.player.locX(); + this.player.lastY = this.player.locY(); +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { + this.player.resetIdleTimer(); // CraftBukkit - SPIGOT-854 + this.disconnect(new ChatMessage("multiplayer.disconnect.idling")); + } +- org.bukkit.craftbukkit.SpigotTimings.playerConnectionTimer.stopTiming(); // Spigot + + } + +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { + // CraftBukkit end + + private void handleCommand(String s) { +- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot ++ MinecraftTimings.playerCommandTimer.startTiming(); // Paper + // CraftBukkit start - whole method + if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot + this.LOGGER.info(this.player.getName() + " issued server command: " + s); +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { + this.server.getPluginManager().callEvent(event); + + if (event.isCancelled()) { +- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot ++ MinecraftTimings.playerCommandTimer.stopTiming(); // Paper + return; + } + +@@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { + java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + return; + } finally { +- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot ++ MinecraftTimings.playerCommandTimer.stopTiming(); // Paper + } + // this.minecraftServer.getCommandDispatcher().a(this.player.getCommandListener(), s); + // CraftBukkit end +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -0,0 +0,0 @@ + package net.minecraft.server.players; + ++import co.aikar.timings.MinecraftTimings; + import com.google.common.collect.Lists; + import com.google.common.collect.Maps; + import com.google.common.collect.Sets; +@@ -0,0 +0,0 @@ public abstract class PlayerList { + } + + public void savePlayers() { ++ MinecraftTimings.savePlayers.startTiming(); // Paper + for (int i = 0; i < this.players.size(); ++i) { + this.savePlayerFile((EntityPlayer) this.players.get(i)); + } +- ++ MinecraftTimings.savePlayers.stopTiming(); // Paper + } + + public WhiteList getWhitelist() { +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent; + import org.bukkit.entity.Hanging; + import org.bukkit.entity.LivingEntity; + import org.bukkit.entity.Vehicle; +-import org.spigotmc.CustomTimingsHandler; // Spigot + import org.bukkit.event.entity.EntityCombustByEntityEvent; + import org.bukkit.event.hanging.HangingBreakByEntityEvent; + import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only + public boolean forceExplosionKnockback; // SPIGOT-949 + public boolean persistentInvisibility = false; +- public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot + // Spigot start + public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); + public final boolean defaultActivationState; +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + } + + public void move(EnumMoveType enummovetype, Vec3D vec3d) { +- org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot + if (this.noclip) { + this.a(this.getBoundingBox().c(vec3d)); + this.recalcPosition(); +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + + this.world.getMethodProfiler().exit(); + } +- org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot + } + + protected BlockPosition ap() { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityTeleportEvent; + import org.bukkit.event.player.PlayerItemConsumeEvent; + // CraftBukkit end + +-import org.bukkit.craftbukkit.SpigotTimings; // Spigot ++import co.aikar.timings.MinecraftTimings; // Paper + + public abstract class EntityLiving extends Entity { + +@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + + @Override + public void tick() { +- SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot + super.tick(); + this.t(); + this.v(); +@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + } + } + +- SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot + this.movementTick(); +- SpigotTimings.timerEntityTickRest.startTiming(); // Spigot + double d0 = this.locX() - this.lastX; + double d1 = this.locZ() - this.lastZ; + float f = (float) (d0 * d0 + d1 * d1); +@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + if (this.isSleeping()) { + this.pitch = 0.0F; + } +- +- SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot + } + + public void updateEquipment() { // PAIL private->public; updateEquipment +@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + + this.setMot(d4, d5, d6); + this.world.getMethodProfiler().enter("ai"); +- SpigotTimings.timerEntityAI.startTiming(); // Spigot + if (this.isFrozen()) { + this.jumping = false; + this.aR = 0.0F; +@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + this.doTick(); + this.world.getMethodProfiler().exit(); + } +- SpigotTimings.timerEntityAI.stopTiming(); // Spigot + + this.world.getMethodProfiler().exit(); + this.world.getMethodProfiler().enter("jump"); +@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + this.r(); + AxisAlignedBB axisalignedbb = this.getBoundingBox(); + +- SpigotTimings.timerEntityAIMove.startTiming(); // Spigot ++ // SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper + this.g(new Vec3D((double) this.aR, (double) this.aS, (double) this.aT)); +- SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot ++ // SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper + this.world.getMethodProfiler().exit(); + this.world.getMethodProfiler().enter("push"); + if (this.bf > 0) { +@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + this.a(axisalignedbb, this.getBoundingBox()); + } + +- SpigotTimings.timerEntityAICollision.startTiming(); // Spigot + this.collideNearby(); +- SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot + this.world.getMethodProfiler().exit(); + if (!this.world.isClientSide && this.dO() && this.aG()) { + this.damageEntity(DamageSource.DROWN, 1.0F); +diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java ++++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java +@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { + return IRegistry.ENTITY_TYPE.getOptional(MinecraftKey.a(s)); + } + +- public EntityTypes(EntityTypes.b<T> entitytypes_b, EnumCreatureType enumcreaturetype, boolean flag, boolean flag1, boolean flag2, boolean flag3, ImmutableSet<Block> immutableset, EntitySize entitysize, int i, int j) { ++ public final String id; ++ public EntityTypes(EntityTypes.b<T> entitytypes_b, EnumCreatureType enumcreaturetype, boolean flag, boolean flag1, boolean flag2, boolean flag3, ImmutableSet<Block> immutableset, EntitySize entitysize, int i, int j) { this(entitytypes_b, enumcreaturetype, flag, flag1, flag2, flag3, immutableset, entitysize, i, j, "custom"); } // Paper - old signature ++ public EntityTypes(EntityTypes.b<T> entitytypes_b, EnumCreatureType enumcreaturetype, boolean flag, boolean flag1, boolean flag2, boolean flag3, ImmutableSet<Block> immutableset, EntitySize entitysize, int i, int j, String id) { // Paper - add id + this.bf = entitytypes_b; + this.bg = enumcreaturetype; + this.bl = flag3; +@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { + this.br = entitysize; + this.bm = i; + this.bn = j; ++ ++ // Paper start - timings ++ this.id = id; ++ this.tickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "tick"); ++ this.inactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "inactiveTick"); ++ this.passengerTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerTick"); ++ this.passengerInactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerInactiveTick"); ++ // Paper end + } + + @Nullable +@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { + return this.bn; + } + ++ // Paper start - timings ++ public final co.aikar.timings.Timing tickTimer; ++ public final co.aikar.timings.Timing inactiveTickTimer; ++ public final co.aikar.timings.Timing passengerTickTimer; ++ public final co.aikar.timings.Timing passengerInactiveTickTimer; ++ // Paper end + public boolean isDeltaTracking() { + return this != EntityTypes.PLAYER && this != EntityTypes.LLAMA_SPIT && this != EntityTypes.WITHER && this != EntityTypes.BAT && this != EntityTypes.ITEM_FRAME && this != EntityTypes.LEASH_KNOT && this != EntityTypes.PAINTING && this != EntityTypes.END_CRYSTAL && this != EntityTypes.EVOKER_FANGS; + } +@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { + SystemUtils.a(DataConverterTypes.ENTITY_TREE, s); + } + +- return new EntityTypes<>(this.a, this.b, this.d, this.e, this.f, this.g, this.c, this.j, this.h, this.i); ++ return new EntityTypes<>(this.a, this.b, this.d, this.e, this.f, this.g, this.c, this.j, this.h, this.i, s); // Paper - add id + } + } + +diff --git a/src/main/java/net/minecraft/world/level/TickListServer.java b/src/main/java/net/minecraft/world/level/TickListServer.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/TickListServer.java ++++ b/src/main/java/net/minecraft/world/level/TickListServer.java +@@ -0,0 +0,0 @@ public class TickListServer<T> implements TickList<T> { + private final List<NextTickListEntry<T>> g = Lists.newArrayList(); + private final Consumer<NextTickListEntry<T>> h; + +- public TickListServer(WorldServer worldserver, Predicate<T> predicate, Function<T, MinecraftKey> function, Consumer<NextTickListEntry<T>> consumer) { ++ public TickListServer(WorldServer worldserver, Predicate<T> predicate, Function<T, MinecraftKey> function, Consumer<NextTickListEntry<T>> consumer, String timingsType) { // Paper + this.a = predicate; + this.b = function; + this.e = worldserver; + this.h = consumer; ++ this.timingCleanup = co.aikar.timings.WorldTimingsHandler.getTickList(worldserver, timingsType + " - Cleanup"); ++ this.timingTicking = co.aikar.timings.WorldTimingsHandler.getTickList(worldserver, timingsType + " - Ticking"); + } ++ private final co.aikar.timings.Timing timingCleanup; // Paper ++ private final co.aikar.timings.Timing timingTicking; // Paper ++ // Paper end + + public void b() { + int i = this.nextTickList.size(); +@@ -0,0 +0,0 @@ public class TickListServer<T> implements TickList<T> { + + this.e.getMethodProfiler().enter("cleaning"); + ++ this.timingCleanup.startTiming(); // Paper + NextTickListEntry nextticklistentry; + + while (i > 0 && iterator.hasNext()) { +@@ -0,0 +0,0 @@ public class TickListServer<T> implements TickList<T> { + --i; + } + } ++ this.timingCleanup.stopTiming(); // Paper + ++ this.timingTicking.startTiming(); // Paper + this.e.getMethodProfiler().exitEnter("ticking"); + + while ((nextticklistentry = (NextTickListEntry) this.f.poll()) != null) { +@@ -0,0 +0,0 @@ public class TickListServer<T> implements TickList<T> { + } + } + ++ this.timingTicking.stopTiming(); // Paper + this.e.getMethodProfiler().exit(); + this.g.clear(); + this.f.clear(); +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -0,0 +0,0 @@ import net.minecraft.server.level.WorldServer; + import net.minecraft.world.entity.item.EntityItem; + import net.minecraft.world.level.border.IWorldBorderListener; + import org.bukkit.Bukkit; +-import org.bukkit.craftbukkit.SpigotTimings; // Spigot + import org.bukkit.craftbukkit.CraftServer; + import org.bukkit.craftbukkit.CraftWorld; + import org.bukkit.craftbukkit.block.CapturedBlockState; +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + + public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper + +- public final SpigotTimings.WorldTimingsHandler timings; // Spigot ++ public final co.aikar.timings.WorldTimingsHandler timings; // Paper + public static BlockPosition lastPhysicsProblem; // Spigot + private org.spigotmc.TickLimiter entityLimiter; + private org.spigotmc.TickLimiter tileLimiter; +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public void c(WorldBorder worldborder, double d0) {} + }); + // CraftBukkit end +- timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings ++ timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings + this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); + this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); + } +@@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + } + + timings.tileEntityPending.stopTiming(); // Spigot ++ co.aikar.timings.TimingHistory.tileEntityTicks += this.tileEntityListTick.size(); // Paper + gameprofilerfiller.exit(); + spigotConfig.currentPrimedTnt = 0; // Spigot + } + + public void a(Consumer<Entity> consumer, Entity entity) { + try { +- SpigotTimings.tickEntityTimer.startTiming(); // Spigot + consumer.accept(entity); +- SpigotTimings.tickEntityTimer.stopTiming(); // Spigot + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.a(throwable, "Ticking entity"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being ticked"); +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java +@@ -0,0 +0,0 @@ public class Block extends BlockBase implements IMaterial { + }); + protected final BlockStateList<Block, IBlockData> blockStateList; + private IBlockData blockData; ++ // Paper start ++ public co.aikar.timings.Timing timing; ++ public co.aikar.timings.Timing getTiming() { ++ if (timing == null) { ++ timing = co.aikar.timings.MinecraftTimings.getBlockTiming(this); ++ } ++ return timing; ++ } ++ // Paper end + @Nullable + private String name; + @Nullable +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +@@ -0,0 +0,0 @@ import org.bukkit.inventory.InventoryHolder; + // CraftBukkit end + + import org.spigotmc.CustomTimingsHandler; // Spigot ++import co.aikar.timings.MinecraftTimings; // Paper ++import co.aikar.timings.Timing; // Paper + + public abstract class TileEntity implements net.minecraft.server.KeyedObject { // Paper + +- public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot ++ public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper + // CraftBukkit start - data containers + private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); + public CraftPersistentDataContainer persistentDataContainer; +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(this.bukkitChunk, this.needsDecoration)); + + if (this.needsDecoration) { ++ try (co.aikar.timings.Timing ignored = this.world.timings.chunkLoadPopulate.startTiming()) { // Paper + this.needsDecoration = false; + java.util.Random random = new java.util.Random(); + random.setSeed(world.getSeed()); +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + } + } + server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk)); ++ } // Paper + } + } + } +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +@@ -0,0 +0,0 @@ + package net.minecraft.world.level.chunk.storage; + ++import co.aikar.timings.Timings; + import com.google.common.collect.Maps; + import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + import it.unimi.dsi.fastutil.longs.LongSet; +@@ -0,0 +0,0 @@ public class ChunkRegionLoader { + private static void loadEntities(NBTTagCompound nbttagcompound, Chunk chunk) { + NBTTagList nbttaglist = nbttagcompound.getList("Entities", 10); + World world = chunk.getWorld(); +- world.timings.syncChunkLoadEntitiesTimer.startTiming(); // Spigot + + for (int i = 0; i < nbttaglist.size(); ++i) { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompound(i); +@@ -0,0 +0,0 @@ public class ChunkRegionLoader { + chunk.d(true); + } + +- world.timings.syncChunkLoadEntitiesTimer.stopTiming(); // Spigot +- world.timings.syncChunkLoadTileEntitiesTimer.startTiming(); // Spigot + NBTTagList nbttaglist1 = nbttagcompound.getList("TileEntities", 10); + + for (int j = 0; j < nbttaglist1.size(); ++j) { +@@ -0,0 +0,0 @@ public class ChunkRegionLoader { + } + } + } +- world.timings.syncChunkLoadTileEntitiesTimer.stopTiming(); // Spigot +- + } + + private static NBTTagCompound a(ChunkCoordIntPair chunkcoordintpair, Map<StructureGenerator<?>, StructureStart<?>> map, Map<StructureGenerator<?>, LongSet> map1) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1852,10 +1855,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 -package org.bukkit.craftbukkit; - -import java.util.HashMap; --import net.minecraft.server.Entity; --import net.minecraft.server.TileEntity; --import net.minecraft.server.World; --import net.minecraft.server.WorldDataServer; +-import net.minecraft.world.entity.Entity; +-import net.minecraft.world.level.World; +-import net.minecraft.world.level.block.entity.TileEntity; +-import net.minecraft.world.level.storage.WorldDataServer; -import org.bukkit.craftbukkit.scheduler.CraftTask; -import org.bukkit.plugin.java.JavaPluginLoader; -import org.bukkit.scheduler.BukkitTask; @@ -2242,10 +2245,10 @@ diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -0,0 +0,0 @@ import net.minecraft.server.EntityWither; - import net.minecraft.server.MathHelper; - import net.minecraft.server.MinecraftServer; - import net.minecraft.server.World; +@@ -0,0 +0,0 @@ import net.minecraft.world.entity.raid.EntityRaider; + import net.minecraft.world.level.World; + import net.minecraft.world.level.chunk.Chunk; + import net.minecraft.world.phys.AxisAlignedBB; -import org.bukkit.craftbukkit.SpigotTimings; +import co.aikar.timings.MinecraftTimings; diff --git a/Spigot-Server-Patches/Toggle-for-removing-existing-dragon.patch b/Spigot-Server-Patches/Toggle-for-removing-existing-dragon.patch index 63669d312f..36919d8300 100644 --- a/Spigot-Server-Patches/Toggle-for-removing-existing-dragon.patch +++ b/Spigot-Server-Patches/Toggle-for-removing-existing-dragon.patch @@ -21,10 +21,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } } -diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java +diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EnderDragonBattle.java -+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java +--- a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java ++++ b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java @@ -0,0 +0,0 @@ public class EnderDragonBattle { this.dragonUUID = entityenderdragon.getUniqueID(); EnderDragonBattle.LOGGER.info("Found that there's a dragon still alive ({})", entityenderdragon); diff --git a/Spigot-Server-Patches/Toggleable-player-crits-helps-mitigate-hacked-client.patch b/Spigot-Server-Patches/Toggleable-player-crits-helps-mitigate-hacked-client.patch index 2daa28c557..16884a84bc 100644 --- a/Spigot-Server-Patches/Toggleable-player-crits-helps-mitigate-hacked-client.patch +++ b/Spigot-Server-Patches/Toggleable-player-crits-helps-mitigate-hacked-client.patch @@ -20,10 +20,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public boolean allChunksAreSlimeChunks; private void allChunksAreSlimeChunks() { allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false); -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java @@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.isClimbing() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && entity instanceof EntityLiving; diff --git a/Spigot-Server-Patches/Tracking-Range-Improvements.patch b/Spigot-Server-Patches/Tracking-Range-Improvements.patch index 035839bf0f..280370212c 100644 --- a/Spigot-Server-Patches/Tracking-Range-Improvements.patch +++ b/Spigot-Server-Patches/Tracking-Range-Improvements.patch @@ -7,10 +7,10 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code Also ignores Enderdragon, defaulting it to Mojang's setting -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); @@ -23,15 +23,6 @@ diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/s index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/TrackingRange.java +++ b/src/main/java/org/spigotmc/TrackingRange.java -@@ -0,0 +0,0 @@ - package org.spigotmc; - - import net.minecraft.server.Entity; -+import net.minecraft.server.EntityEnderDragon; // Paper -+import net.minecraft.server.WorldServer; // Paper - import net.minecraft.server.EntityExperienceOrb; - import net.minecraft.server.EntityGhast; - import net.minecraft.server.EntityItem; @@ -0,0 +0,0 @@ public class TrackingRange if ( entity instanceof EntityPlayer ) { @@ -70,7 +61,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return config.miscTrackingRange; } else { -+ if (entity instanceof EntityEnderDragon) return ((WorldServer)(entity.getWorld())).getChunkProvider().playerChunkMap.getLoadViewDistance(); // Paper - enderdragon is exempt ++ if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon) return ((net.minecraft.server.level.WorldServer)(entity.getWorld())).getChunkProvider().playerChunkMap.getLoadViewDistance(); // Paper - enderdragon is exempt return config.otherTrackingRange; } } diff --git a/Spigot-Server-Patches/Turtle-API.patch b/Spigot-Server-Patches/Turtle-API.patch index 633b3c8570..fd53acc390 100644 --- a/Spigot-Server-Patches/Turtle-API.patch +++ b/Spigot-Server-Patches/Turtle-API.patch @@ -4,10 +4,23 @@ Date: Sat, 29 Sep 2018 16:08:23 -0500 Subject: [PATCH] Turtle API -diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalGotoTarget.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalGotoTarget.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTurtle.java -+++ b/src/main/java/net/minecraft/server/EntityTurtle.java +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalGotoTarget.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalGotoTarget.java +@@ -0,0 +0,0 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { + protected int c; + protected int d; + private int g; +- protected BlockPosition e; ++ protected BlockPosition e;public final BlockPosition getTargetPosition() { return this.e; } // Paper - OBFHELPER + private boolean h; + private final int i; + private final int j; +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java b/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java @@ -0,0 +0,0 @@ public class EntityTurtle extends EntityAnimal { this.datawatcher.set(EntityTurtle.bp, blockposition); } @@ -86,32 +99,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @Override -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java -@@ -0,0 +0,0 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { - protected int c; - protected int d; - private int g; -- protected BlockPosition e; -+ protected BlockPosition e;public final BlockPosition getTargetPosition() { return this.e; } // Paper - OBFHELPER - private boolean h; - private final int i; - private final int j; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.entity; - - import net.minecraft.server.EntityTurtle; -+import net.minecraft.server.MCUtil; -+import org.bukkit.Location; - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.entity.EntityType; - import org.bukkit.entity.Turtle; @@ -0,0 +0,0 @@ public class CraftTurtle extends CraftAnimals implements Turtle { public EntityType getType() { return EntityType.TURTLE; @@ -119,13 +110,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + // Paper start + @Override -+ public Location getHome() { -+ return MCUtil.toLocation(getHandle().world, getHandle().getHomePos()); ++ public org.bukkit.Location getHome() { ++ return net.minecraft.server.MCUtil.toLocation(getHandle().world, getHandle().getHomePos()); + } + + @Override -+ public void setHome(Location location) { -+ getHandle().setHomePos(MCUtil.toBlockPosition(location)); ++ public void setHome(org.bukkit.Location location) { ++ getHandle().setHomePos(net.minecraft.server.MCUtil.toBlockPosition(location)); + } + + @Override diff --git a/Spigot-Server-Patches/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch b/Spigot-Server-Patches/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch index 2bf0ba7f75..9722349730 100644 --- a/Spigot-Server-Patches/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch +++ b/Spigot-Server-Patches/Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Unset Ignited flag on cancel of Explosion Event Otherwise the creeper infinite explodes -diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java b/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityCreeper.java -+++ b/src/main/java/net/minecraft/server/EntityCreeper.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java @@ -0,0 +0,0 @@ public class EntityCreeper extends EntityMonster { private static final DataWatcherObject<Integer> b = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.b); diff --git a/Spigot-Server-Patches/Update-entity-Metadata-for-all-tracked-players.patch b/Spigot-Server-Patches/Update-entity-Metadata-for-all-tracked-players.patch index 480dd4a3d5..0cb7e92f17 100644 --- a/Spigot-Server-Patches/Update-entity-Metadata-for-all-tracked-players.patch +++ b/Spigot-Server-Patches/Update-entity-Metadata-for-all-tracked-players.patch @@ -4,10 +4,10 @@ Date: Fri, 22 Mar 2019 22:24:03 -0700 Subject: [PATCH] Update entity Metadata for all tracked players -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java +diff --git a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java +--- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java ++++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java @@ -0,0 +0,0 @@ public class EntityTrackerEntry { return PacketPlayOutEntity.a(this.xLoc, this.yLoc, this.zLoc); } @@ -21,15 +21,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private void broadcastIncludingSelf(Packet<?> packet) { this.f.accept(packet); if (this.tracker instanceof EntityPlayer) { -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { if (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem) { // Refresh the current entity metadata -- this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true)); +- this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.getDataWatcher(), true)); + // Paper start - update entity for all players + PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true); + if (entity.tracker != null) { diff --git a/Spigot-Server-Patches/Update-itemstack-legacy-name-and-lore.patch b/Spigot-Server-Patches/Update-itemstack-legacy-name-and-lore.patch index d592999de6..2e881b444e 100644 --- a/Spigot-Server-Patches/Update-itemstack-legacy-name-and-lore.patch +++ b/Spigot-Server-Patches/Update-itemstack-legacy-name-and-lore.patch @@ -4,10 +4,10 @@ Date: Wed, 1 Jul 2020 11:57:40 -0500 Subject: [PATCH] Update itemstack legacy name and lore -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -0,0 +0,0 @@ public final class ItemStack { list.sort((Comparator<? super NBTBase>) enchantSorter); // Paper } catch (Exception ignored) {} diff --git a/Spigot-Server-Patches/Use-ConcurrentHashMap-in-JsonList.patch b/Spigot-Server-Patches/Use-ConcurrentHashMap-in-JsonList.patch index 7d2076d980..675c2f0006 100644 --- a/Spigot-Server-Patches/Use-ConcurrentHashMap-in-JsonList.patch +++ b/Spigot-Server-Patches/Use-ConcurrentHashMap-in-JsonList.patch @@ -24,10 +24,10 @@ 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 +diff --git a/src/main/java/net/minecraft/server/players/JsonList.java b/src/main/java/net/minecraft/server/players/JsonList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/JsonList.java -+++ b/src/main/java/net/minecraft/server/JsonList.java +--- a/src/main/java/net/minecraft/server/players/JsonList.java ++++ b/src/main/java/net/minecraft/server/players/JsonList.java @@ -0,0 +0,0 @@ import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; @@ -121,10 +121,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 JsonArray jsonarray = new JsonArray(); this.d.values().stream().map((jsonlistentry) -> { -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { } else if (!this.isWhitelisted(gameprofile, event)) { // Paper //chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); // Paper diff --git a/Spigot-Server-Patches/Use-TerminalConsoleAppender-for-console-improvements.patch b/Spigot-Server-Patches/Use-TerminalConsoleAppender-for-console-improvements.patch index af2f84d337..9b1d9a1a37 100644 --- a/Spigot-Server-Patches/Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/Spigot-Server-Patches/Use-TerminalConsoleAppender-for-console-improvements.patch @@ -143,48 +143,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + +} -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 - if (!org.bukkit.craftbukkit.Main.useConsole) { - return; - } -+ // Paper start - Use TerminalConsoleAppender -+ new com.destroystokyo.paper.console.PaperConsole(DedicatedServer.this).start(); -+ /* - jline.console.ConsoleReader bufferedreader = reader; - - // MC-33041, SPIGOT-5538: if System.in is not valid due to javaw, then return -@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - DedicatedServer.LOGGER.error("Exception handling console input", ioexception); - } - -+ */ -+ // Paper end - } - }; - -@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - } - global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler()); - -+ // Paper start - Not needed with TerminalConsoleAppender -+ final org.apache.logging.log4j.Logger logger = LogManager.getRootLogger(); -+ /* - final org.apache.logging.log4j.core.Logger logger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()); - for (org.apache.logging.log4j.core.Appender appender : logger.getAppenders().values()) { - if (appender instanceof org.apache.logging.log4j.core.appender.ConsoleAppender) { -@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - } - - new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader).start(); -+ */ -+ // Paper end - - System.setOut(IoBuilder.forLogger(logger).setLevel(Level.INFO).buildPrintStream()); - System.setErr(IoBuilder.forLogger(logger).setLevel(Level.WARN).buildPrintStream()); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -196,8 +154,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 -import jline.console.ConsoleReader; +// import jline.console.ConsoleReader; // Paper import joptsimple.OptionSet; - import org.bukkit.Bukkit; - import org.bukkit.craftbukkit.CraftServer; + import net.minecraft.nbt.DynamicOpsNBT; + import net.minecraft.nbt.NBTBase; @@ -0,0 +0,0 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant<TickTas public OptionSet options; public org.bukkit.command.ConsoleCommandSender console; @@ -244,10 +202,52 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public KeyPair getKeyPair() { -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + if (!org.bukkit.craftbukkit.Main.useConsole) { + return; + } ++ // Paper start - Use TerminalConsoleAppender ++ new com.destroystokyo.paper.console.PaperConsole(DedicatedServer.this).start(); ++ /* + jline.console.ConsoleReader bufferedreader = reader; + + // MC-33041, SPIGOT-5538: if System.in is not valid due to javaw, then return +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + DedicatedServer.LOGGER.error("Exception handling console input", ioexception); + } + ++ */ ++ // Paper end + } + }; + +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + } + global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler()); + ++ // Paper start - Not needed with TerminalConsoleAppender ++ final org.apache.logging.log4j.Logger logger = LogManager.getRootLogger(); ++ /* + final org.apache.logging.log4j.core.Logger logger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()); + for (org.apache.logging.log4j.core.Appender appender : logger.getAppenders().values()) { + if (appender instanceof org.apache.logging.log4j.core.appender.ConsoleAppender) { +@@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + } + + new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader).start(); ++ */ ++ // Paper end + + System.setOut(IoBuilder.forLogger(logger).setLevel(Level.INFO).buildPrintStream()); + System.setErr(IoBuilder.forLogger(logger).setLevel(Level.WARN).buildPrintStream()); +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { public PlayerList(MinecraftServer minecraftserver, IRegistryCustom.Dimension iregistrycustom_dimension, WorldNBTStorage worldnbtstorage, int i) { @@ -267,10 +267,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 import java.util.logging.Logger; import javax.imageio.ImageIO; -import jline.console.ConsoleReader; + import net.minecraft.advancements.Advancement; + import net.minecraft.commands.CommandDispatcher; + import net.minecraft.commands.CommandListenerWrapper; +@@ -0,0 +0,0 @@ import net.minecraft.nbt.NBTBase; + import net.minecraft.resources.MinecraftKey; + import net.minecraft.resources.RegistryReadOps; + import net.minecraft.resources.ResourceKey; +//import jline.console.ConsoleReader; // Paper - import net.minecraft.server.Advancement; - import net.minecraft.server.ArgumentEntity; - import net.minecraft.server.BiomeManager; + import net.minecraft.server.MinecraftServer; + import net.minecraft.server.ServerCommand; + import net.minecraft.server.bossevents.BossBattleCustom; @@ -0,0 +0,0 @@ public final class CraftServer implements Server { return logger; } diff --git a/Spigot-Server-Patches/Use-Vanilla-Minecart-Speeds.patch b/Spigot-Server-Patches/Use-Vanilla-Minecart-Speeds.patch index 892a3769e5..303baa58c3 100644 --- a/Spigot-Server-Patches/Use-Vanilla-Minecart-Speeds.patch +++ b/Spigot-Server-Patches/Use-Vanilla-Minecart-Speeds.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Use Vanilla Minecart Speeds CraftBukkit changed the values on flying speed, restore back to vanilla -diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java @@ -0,0 +0,0 @@ public abstract class EntityMinecartAbstract extends Entity { private double derailedX = 0.5; private double derailedY = 0.5; 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 b9c66d5f56..21283b666f 100644 --- a/Spigot-Server-Patches/Use-a-Queue-for-Queueing-Commands.patch +++ b/Spigot-Server-Patches/Use-a-Queue-for-Queueing-Commands.patch @@ -5,10 +5,10 @@ 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 +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer private static final Logger LOGGER = LogManager.getLogger(); diff --git a/Spigot-Server-Patches/Use-a-Shared-Random-for-Entities.patch b/Spigot-Server-Patches/Use-a-Shared-Random-for-Entities.patch index 8add76f630..34cb1acd06 100644 --- a/Spigot-Server-Patches/Use-a-Shared-Random-for-Entities.patch +++ b/Spigot-Server-Patches/Use-a-Shared-Random-for-Entities.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Use a Shared Random for Entities Reduces memory usage and provides ensures more randomness, Especially since a lot of garbage entity objects get created. -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; } @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private CraftEntity bukkitEntity; public CraftEntity getBukkitEntity() { -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne this.x = Vec3D.ORIGIN; this.am = 1.0F; this.an = 1.0F; diff --git a/Spigot-Server-Patches/Use-distance-map-to-optimise-entity-tracker.patch b/Spigot-Server-Patches/Use-distance-map-to-optimise-entity-tracker.patch index b32e590025..5f3baa4b8a 100644 --- a/Spigot-Server-Patches/Use-distance-map-to-optimise-entity-tracker.patch +++ b/Spigot-Server-Patches/Use-distance-map-to-optimise-entity-tracker.patch @@ -5,44 +5,6 @@ Subject: [PATCH] Use distance map to optimise entity tracker Use the distance map to find candidate players for tracking. -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 - } - // CraftBukkit end - -+ // Paper start - optimise entity tracking -+ final org.spigotmc.TrackingRange.TrackingRangeType trackingRangeType = org.spigotmc.TrackingRange.getTrackingRangeType(this); -+ -+ boolean isLegacyTrackingEntity = false; -+ -+ public final void setLegacyTrackingEntity(final boolean isLegacyTrackingEntity) { -+ this.isLegacyTrackingEntity = isLegacyTrackingEntity; -+ } -+ -+ final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> getPlayersInTrackRange() { -+ return ((WorldServer)this.world).getChunkProvider().playerChunkMap.playerEntityTrackerTrackMaps[this.trackingRangeType.ordinal()] -+ .getObjectsInRange(MCUtil.getCoordinateKey(this)); -+ } -+ // Paper end - optimise entity tracking -+ - public Entity(EntityTypes<?> entitytypes, World world) { - this.id = Entity.entityCount.incrementAndGet(); - this.passengers = Lists.newArrayList(); -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -0,0 +0,0 @@ public class EntityTrackerEntry { - this.r = entity.isOnGround(); - } - -+ public final void tick() { this.a(); } // Paper - OBFHELPER - public void a() { - List<Entity> list = this.tracker.getPassengers(); - diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -55,10 +17,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public int b(int i) { return i; } -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java ++++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java +@@ -0,0 +0,0 @@ public class EntityTrackerEntry { + this.r = entity.isOnGround(); + } + ++ public final void tick() { this.a(); } // Paper - OBFHELPER + public void a() { + List<Entity> list = this.tracker.getPassengers(); + +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // Paper start - distance maps @@ -333,6 +307,32 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 i = j; } } +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + } + // CraftBukkit end + ++ // Paper start - optimise entity tracking ++ final org.spigotmc.TrackingRange.TrackingRangeType trackingRangeType = org.spigotmc.TrackingRange.getTrackingRangeType(this); ++ ++ boolean isLegacyTrackingEntity = false; ++ ++ public final void setLegacyTrackingEntity(final boolean isLegacyTrackingEntity) { ++ this.isLegacyTrackingEntity = isLegacyTrackingEntity; ++ } ++ ++ final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<EntityPlayer> getPlayersInTrackRange() { ++ return ((WorldServer)this.world).getChunkProvider().playerChunkMap.playerEntityTrackerTrackMaps[this.trackingRangeType.ordinal()] ++ .getObjectsInRange(MCUtil.getCoordinateKey(this)); ++ } ++ // Paper end - optimise entity tracking ++ + public Entity(EntityTypes<?> entitytypes, World world) { + this.id = Entity.entityCount.incrementAndGet(); + this.passengers = Lists.newArrayList(); diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/spigotmc/TrackingRange.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/TrackingRange.java @@ -341,7 +341,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 */ public static int getEntityTrackingRange(Entity entity, int defaultRange) { -+ if (entity instanceof EntityEnderDragon) return defaultRange; // Paper - enderdragon is exempt ++ if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon) return defaultRange; // Paper - enderdragon is exempt SpigotWorldConfig config = entity.world.spigotConfig; if ( entity instanceof EntityPlayer ) { @@ -349,7 +349,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return config.miscTrackingRange; } else { -- if (entity instanceof EntityEnderDragon) return ((WorldServer)(entity.getWorld())).getChunkProvider().playerChunkMap.getLoadViewDistance(); // Paper - enderdragon is exempt +- if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon) return ((net.minecraft.server.level.WorldServer)(entity.getWorld())).getChunkProvider().playerChunkMap.getLoadViewDistance(); // Paper - enderdragon is exempt return config.otherTrackingRange; } } @@ -358,7 +358,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // copied from above, TODO check on update + public static TrackingRangeType getTrackingRangeType(Entity entity) + { -+ if (entity instanceof EntityEnderDragon) return TrackingRangeType.ENDERDRAGON; // Paper - enderdragon is exempt ++ if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon) return TrackingRangeType.ENDERDRAGON; // Paper - enderdragon is exempt + if ( entity instanceof EntityPlayer ) + { + return TrackingRangeType.PLAYER; diff --git a/Spigot-Server-Patches/Use-getChunkIfLoadedImmediately-in-places.patch b/Spigot-Server-Patches/Use-getChunkIfLoadedImmediately-in-places.patch index a65f228a9b..f866293450 100644 --- a/Spigot-Server-Patches/Use-getChunkIfLoadedImmediately-in-places.patch +++ b/Spigot-Server-Patches/Use-getChunkIfLoadedImmediately-in-places.patch @@ -7,10 +7,23 @@ This prevents us from hitting chunk loads for chunks at or less-than ticket level 33 (yes getChunkIfLoaded will actually perform a chunk load in that case). -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { + } + + @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI +- return this.chunkProvider.getChunkAt(x, z, false); ++ return this.chunkProvider.getChunkAtIfLoadedImmediately(x, z); // Paper + } + + // Paper start - Asynchronous IO +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { speed = player.abilities.walkSpeed * 10f; } @@ -20,10 +33,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.internalTeleport(this.player.locX(), this.player.locY(), this.player.locZ(), this.player.yaw, this.player.pitch, Collections.emptySet()); return; } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return (CraftServer) Bukkit.getServer(); } @@ -64,19 +77,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (chunk != null) { chunk.a(oclass, axisalignedbb, list, predicate); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 implements GeneratorAccessSeed { - } - - @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI -- return this.chunkProvider.getChunkAt(x, z, false); -+ return this.chunkProvider.getChunkAtIfLoadedImmediately(x, z); // Paper - } - - // Paper start - Asynchronous IO diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java diff --git a/Spigot-Server-Patches/Use-proper-max-length-when-serialising-BungeeCord-te.patch b/Spigot-Server-Patches/Use-proper-max-length-when-serialising-BungeeCord-te.patch index bef5706a12..6f67cca092 100644 --- a/Spigot-Server-Patches/Use-proper-max-length-when-serialising-BungeeCord-te.patch +++ b/Spigot-Server-Patches/Use-proper-max-length-when-serialising-BungeeCord-te.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Use proper max length when serialising BungeeCord text component -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -0,0 +0,0 @@ import java.io.IOException; - import java.util.UUID; +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java +@@ -0,0 +0,0 @@ import net.minecraft.network.chat.IChatBaseComponent; + import net.minecraft.network.protocol.Packet; public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> { - diff --git a/Spigot-Server-Patches/Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch b/Spigot-Server-Patches/Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch index da8315f553..6e9a979007 100644 --- a/Spigot-Server-Patches/Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch +++ b/Spigot-Server-Patches/Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch @@ -5,23 +5,10 @@ Subject: [PATCH] Use seed based lookup for Treasure Maps - Fixes lag from carto/sunken maps -diff --git a/src/main/java/net/minecraft/server/ItemWorldMap.java b/src/main/java/net/minecraft/server/ItemWorldMap.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemWorldMap.java -+++ b/src/main/java/net/minecraft/server/ItemWorldMap.java -@@ -0,0 +0,0 @@ public class ItemWorldMap extends ItemWorldMapBase { - - for (l = 0; l < 128 * i; ++l) { - for (i1 = 0; i1 < 128 * i; ++i1) { -- abiomebase[l * 128 * i + i1] = worldserver.getBiome(new BlockPosition((j / i - 64) * i + i1, 0, (k / i - 64) * i + l)); -+ abiomebase[l * 128 * i + i1] = worldserver.getBiomeBySeed((j / i - 64) * i + i1, 0, (k / i - 64) * i + l); // Paper - } - } - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.worldDataServer.setThundering(flag1); } @@ -33,3 +20,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return this.getChunkProvider().getChunkGenerator().getWorldChunkManager().getBiome(i, j, k); } +diff --git a/src/main/java/net/minecraft/world/item/ItemWorldMap.java b/src/main/java/net/minecraft/world/item/ItemWorldMap.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/item/ItemWorldMap.java ++++ b/src/main/java/net/minecraft/world/item/ItemWorldMap.java +@@ -0,0 +0,0 @@ public class ItemWorldMap extends ItemWorldMapBase { + + for (l = 0; l < 128 * i; ++l) { + for (i1 = 0; i1 < 128 * i; ++i1) { +- abiomebase[l * 128 * i + i1] = worldserver.getBiome(new BlockPosition((j / i - 64) * i + i1, 0, (k / i - 64) * i + l)); ++ abiomebase[l * 128 * i + i1] = worldserver.getBiomeBySeed((j / i - 64) * i + i1, 0, (k / i - 64) * i + l); // Paper + } + } + diff --git a/Spigot-Server-Patches/Validate-PickItem-Packet-and-kick-for-invalid.patch b/Spigot-Server-Patches/Validate-PickItem-Packet-and-kick-for-invalid.patch index c477012943..25b736c299 100644 --- a/Spigot-Server-Patches/Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/Spigot-Server-Patches/Validate-PickItem-Packet-and-kick-for-invalid.patch @@ -4,10 +4,10 @@ Date: Sat, 2 May 2020 03:09:46 -0400 Subject: [PATCH] Validate PickItem Packet and kick for invalid -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override public void a(PacketPlayInPickItem packetplayinpickitem) { diff --git a/Spigot-Server-Patches/Validate-tripwire-hook-placement-before-update.patch b/Spigot-Server-Patches/Validate-tripwire-hook-placement-before-update.patch index 6f33317ffe..fe65c99477 100644 --- a/Spigot-Server-Patches/Validate-tripwire-hook-placement-before-update.patch +++ b/Spigot-Server-Patches/Validate-tripwire-hook-placement-before-update.patch @@ -4,10 +4,10 @@ Date: Sat, 7 Mar 2020 00:07:51 +0000 Subject: [PATCH] Validate tripwire hook placement before update -diff --git a/src/main/java/net/minecraft/server/BlockTripwireHook.java b/src/main/java/net/minecraft/server/BlockTripwireHook.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockTripwireHook.java b/src/main/java/net/minecraft/world/level/block/BlockTripwireHook.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockTripwireHook.java -+++ b/src/main/java/net/minecraft/server/BlockTripwireHook.java +--- a/src/main/java/net/minecraft/world/level/block/BlockTripwireHook.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockTripwireHook.java @@ -0,0 +0,0 @@ public class BlockTripwireHook extends Block { this.a(world, blockposition, flag4, flag5, flag2, flag3); 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 720cfbb5cf..d492a8258a 100644 --- a/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch +++ b/Spigot-Server-Patches/Vanished-players-don-t-have-rights.patch @@ -4,23 +4,11 @@ Date: Mon, 23 Jul 2018 14:22:26 +0200 Subject: [PATCH] Vanished players don't have rights -diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockBase.java -+++ b/src/main/java/net/minecraft/server/BlockBase.java -@@ -0,0 +0,0 @@ public abstract class BlockBase { - return this.a != null ? this.a.b : this.b(iblockaccess, blockposition, VoxelShapeCollision.a()); - } - -+ public final VoxelShape getCollisionShape(IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { return this.b(iblockaccess, blockposition, voxelshapecollision); } // Paper - OBFHELPER - public VoxelShape b(IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { - return this.getBlock().c(this.p(), iblockaccess, blockposition, voxelshapecollision); - } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne private static double e = 1.0D; private final EntityTypes<?> f; private int id; @@ -29,10 +17,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public final List<Entity> passengers; protected int j; @Nullable -diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java +diff --git a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/IProjectile.java -+++ b/src/main/java/net/minecraft/server/IProjectile.java +--- a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java @@ -0,0 +0,0 @@ public abstract class IProjectile extends Entity { protected boolean a(Entity entity) { if (!entity.isSpectator() && entity.isAlive() && entity.isInteractable()) { @@ -49,10 +37,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { return false; } -diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java +diff --git a/src/main/java/net/minecraft/world/item/ItemBlock.java b/src/main/java/net/minecraft/world/item/ItemBlock.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemBlock.java -+++ b/src/main/java/net/minecraft/server/ItemBlock.java +--- a/src/main/java/net/minecraft/world/item/ItemBlock.java ++++ b/src/main/java/net/minecraft/world/item/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); @@ -63,42 +51,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 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 +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - return this.a.a(); - } - -+ public final VoxelShape offset(double x, double y, double z) { return this.a(x, y, z); } // Paper - OBFHELPER - public VoxelShape a(double d0, double d1, double d2) { - 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - return a(new AxisAlignedBB(d0, d1, d2, d3, d4, d5)); - } - -+ public static final VoxelShape of(AxisAlignedBB axisAlignedbb) { return VoxelShapes.a(axisAlignedbb); } // Paper - OBFHELPER - public static VoxelShape a(AxisAlignedBB axisalignedbb) { - int i = a(axisalignedbb.minX, axisalignedbb.maxX); - int j = a(axisalignedbb.minY, axisalignedbb.maxY); -@@ -0,0 +0,0 @@ public final class VoxelShapes { - } - } - -+ 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 (IllegalArgumentException) SystemUtils.c((Throwable) (new IllegalArgumentException())); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); } @@ -146,6 +102,50 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public boolean s_() { return this.isClientSide; +diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java ++++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +@@ -0,0 +0,0 @@ public abstract class BlockBase { + return this.a != null ? this.a.b : this.b(iblockaccess, blockposition, VoxelShapeCollision.a()); + } + ++ public final VoxelShape getCollisionShape(IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { return this.b(iblockaccess, blockposition, voxelshapecollision); } // Paper - OBFHELPER + public VoxelShape b(IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { + return this.getBlock().c(this.p(), iblockaccess, blockposition, voxelshapecollision); + } +diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java +@@ -0,0 +0,0 @@ public abstract class VoxelShape { + return this.a.a(); + } + ++ public final VoxelShape offset(double x, double y, double z) { return this.a(x, y, z); } // Paper - OBFHELPER + public VoxelShape a(double d0, double d1, double d2) { + 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/world/phys/shapes/VoxelShapes.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java +@@ -0,0 +0,0 @@ public final class VoxelShapes { + return a(new AxisAlignedBB(d0, d1, d2, d3, d4, d5)); + } + ++ public static final VoxelShape of(AxisAlignedBB axisAlignedbb) { return VoxelShapes.a(axisAlignedbb); } // Paper - OBFHELPER + public static VoxelShape a(AxisAlignedBB axisalignedbb) { + int i = a(axisalignedbb.minX, axisalignedbb.maxX); + int j = a(axisalignedbb.minY, axisalignedbb.maxY); +@@ -0,0 +0,0 @@ public final class VoxelShapes { + } + } + ++ 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 (IllegalArgumentException) SystemUtils.c((Throwable) (new IllegalArgumentException())); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/Spigot-Server-Patches/Vex-getSummoner-API.patch b/Spigot-Server-Patches/Vex-getSummoner-API.patch index 044288fc97..8e6eba25ae 100644 --- a/Spigot-Server-Patches/Vex-getSummoner-API.patch +++ b/Spigot-Server-Patches/Vex-getSummoner-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Vex#getSummoner API Get's the NPC that summoned this Vex -diff --git a/src/main/java/net/minecraft/server/EntityVex.java b/src/main/java/net/minecraft/server/EntityVex.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityVex.java b/src/main/java/net/minecraft/world/entity/monster/EntityVex.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVex.java -+++ b/src/main/java/net/minecraft/server/EntityVex.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityVex.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityVex.java @@ -0,0 +0,0 @@ public class EntityVex extends EntityMonster { } @@ -21,25 +21,14 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java b/src/mai index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java -@@ -0,0 +0,0 @@ - package org.bukkit.craftbukkit.entity; - -+import net.minecraft.server.EntityInsentient; - import net.minecraft.server.EntityVex; - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.entity.EntityType; -+import org.bukkit.entity.Mob; - import org.bukkit.entity.Vex; - - public class CraftVex extends CraftMonster implements Vex { @@ -0,0 +0,0 @@ public class CraftVex extends CraftMonster implements Vex { return (EntityVex) super.getHandle(); } + // Paper start -+ public Mob getSummoner() { -+ EntityInsentient owner = getHandle().getOwner(); -+ return owner != null ? (Mob) owner.getBukkitEntity() : null; ++ public org.bukkit.entity.Mob getSummoner() { ++ net.minecraft.world.entity.EntityInsentient owner = getHandle().getOwner(); ++ return owner != null ? (org.bukkit.entity.Mob) owner.getBukkitEntity() : null; + } + // Paper end + diff --git a/Spigot-Server-Patches/Villager-Restocks-API.patch b/Spigot-Server-Patches/Villager-Restocks-API.patch index cd61da6c01..fd1bf493cd 100644 --- a/Spigot-Server-Patches/Villager-Restocks-API.patch +++ b/Spigot-Server-Patches/Villager-Restocks-API.patch @@ -4,10 +4,10 @@ Date: Sun, 26 Apr 2020 23:49:01 -0400 Subject: [PATCH] Villager Restocks API -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVillager.java -+++ b/src/main/java/net/minecraft/server/EntityVillager.java +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java @@ -0,0 +0,0 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation private long bA; private int bB; diff --git a/Spigot-Server-Patches/Villager-resetOffers.patch b/Spigot-Server-Patches/Villager-resetOffers.patch index 3fbcc612a1..e9f74fb34f 100644 --- a/Spigot-Server-Patches/Villager-resetOffers.patch +++ b/Spigot-Server-Patches/Villager-resetOffers.patch @@ -4,10 +4,10 @@ Date: Mon, 7 Oct 2019 00:15:37 -0500 Subject: [PATCH] Villager#resetOffers -diff --git a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java @@ -0,0 +0,0 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP return this.tradingPlayer != null; } diff --git a/Spigot-Server-Patches/WitchConsumePotionEvent.patch b/Spigot-Server-Patches/WitchConsumePotionEvent.patch index 6ab972a40f..42c57e080b 100644 --- a/Spigot-Server-Patches/WitchConsumePotionEvent.patch +++ b/Spigot-Server-Patches/WitchConsumePotionEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] WitchConsumePotionEvent Fires when a witch consumes the potion in their hand -diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java b/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityWitch.java -+++ b/src/main/java/net/minecraft/server/EntityWitch.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java @@ -0,0 +0,0 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { this.setSlot(EnumItemSlot.MAINHAND, ItemStack.b); diff --git a/Spigot-Server-Patches/WitchReadyPotionEvent.patch b/Spigot-Server-Patches/WitchReadyPotionEvent.patch index 3500939c1b..91078d117b 100644 --- a/Spigot-Server-Patches/WitchReadyPotionEvent.patch +++ b/Spigot-Server-Patches/WitchReadyPotionEvent.patch @@ -4,10 +4,10 @@ Date: Tue, 5 Jun 2018 22:47:26 -0400 Subject: [PATCH] WitchReadyPotionEvent -diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java b/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityWitch.java -+++ b/src/main/java/net/minecraft/server/EntityWitch.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java @@ -0,0 +0,0 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { } diff --git a/Spigot-Server-Patches/WitchThrowPotionEvent.patch b/Spigot-Server-Patches/WitchThrowPotionEvent.patch index 10e52e8e91..8b56223c86 100644 --- a/Spigot-Server-Patches/WitchThrowPotionEvent.patch +++ b/Spigot-Server-Patches/WitchThrowPotionEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] WitchThrowPotionEvent Fired when a witch throws a potion at a player -diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java b/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityWitch.java -+++ b/src/main/java/net/minecraft/server/EntityWitch.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java @@ -0,0 +0,0 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { potionregistry = Potions.WEAKNESS; } diff --git a/Spigot-Server-Patches/Workaround-for-Client-Lag-Spikes-MC-162253.patch b/Spigot-Server-Patches/Workaround-for-Client-Lag-Spikes-MC-162253.patch index d10c7a6690..04b96a82b3 100644 --- a/Spigot-Server-Patches/Workaround-for-Client-Lag-Spikes-MC-162253.patch +++ b/Spigot-Server-Patches/Workaround-for-Client-Lag-Spikes-MC-162253.patch @@ -11,35 +11,10 @@ This patch basically serves as a workaround by sending light maps to the client, so that it doesn't attempt to calculate them. This mitigates the frametime impact to a minimum (but it's still there). -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - - // broadcast - Object[] backingSet = inRange.getBackingSet(); -- Packet[] chunkPackets = new Packet[2]; -+ Packet[] chunkPackets = new Packet[10]; - for (int index = 0, len = backingSet.length; index < len; ++index) { - Object temp = backingSet[index]; - if (!(temp instanceof EntityPlayer)) { -diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -0,0 +0,0 @@ public class ChunkSection { - return this.nonEmptyBlockCount == 0; - } - -+ public static boolean isEmpty(@Nullable ChunkSection chunksection) { return a(chunksection) ; } // Paper - OBFHELPER - public static boolean a(@Nullable ChunkSection chunksection) { - return chunksection == Chunk.a || chunksection.c(); - } -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } @@ -153,3 +128,28 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entityplayer.a(chunk.getPos(), apacket[0], apacket[1]); PacketDebug.a(this.world, chunk.getPos()); +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + + // broadcast + Object[] backingSet = inRange.getBackingSet(); +- Packet[] chunkPackets = new Packet[2]; ++ Packet[] chunkPackets = new Packet[10]; + for (int index = 0, len = backingSet.length; index < len; ++index) { + Object temp = backingSet[index]; + if (!(temp instanceof EntityPlayer)) { +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +@@ -0,0 +0,0 @@ public class ChunkSection { + return this.nonEmptyBlockCount == 0; + } + ++ public static boolean isEmpty(@Nullable ChunkSection chunksection) { return a(chunksection) ; } // Paper - OBFHELPER + public static boolean a(@Nullable ChunkSection chunksection) { + return chunksection == Chunk.a || chunksection.c(); + } diff --git a/Spigot-Server-Patches/Workaround-for-setting-passengers-on-players.patch b/Spigot-Server-Patches/Workaround-for-setting-passengers-on-players.patch index 83306ad01a..1ff477848c 100644 --- a/Spigot-Server-Patches/Workaround-for-setting-passengers-on-players.patch +++ b/Spigot-Server-Patches/Workaround-for-setting-passengers-on-players.patch @@ -18,7 +18,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + public boolean setPassenger(org.bukkit.entity.Entity passenger) { + boolean wasSet = super.setPassenger(passenger); + if (wasSet) { -+ this.getHandle().playerConnection.sendPacket(new net.minecraft.server.PacketPlayOutMount(this.getHandle())); ++ this.getHandle().playerConnection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutMount(this.getHandle())); + } + return wasSet; + } diff --git a/Spigot-Server-Patches/Workaround-for-vehicle-tracking-issue-on-disconnect.patch b/Spigot-Server-Patches/Workaround-for-vehicle-tracking-issue-on-disconnect.patch index eedf2d6596..ecbdab0838 100644 --- a/Spigot-Server-Patches/Workaround-for-vehicle-tracking-issue-on-disconnect.patch +++ b/Spigot-Server-Patches/Workaround-for-vehicle-tracking-issue-on-disconnect.patch @@ -4,10 +4,10 @@ Date: Mon, 7 Jan 2019 14:43:48 -0600 Subject: [PATCH] Workaround for vehicle tracking issue on disconnect -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void p() { this.ch = true; diff --git a/Spigot-Server-Patches/Zombie-API-breaking-doors.patch b/Spigot-Server-Patches/Zombie-API-breaking-doors.patch index 41a91105fb..ac8e982fca 100644 --- a/Spigot-Server-Patches/Zombie-API-breaking-doors.patch +++ b/Spigot-Server-Patches/Zombie-API-breaking-doors.patch @@ -4,10 +4,10 @@ Date: Wed, 18 Nov 2020 11:32:46 -0800 Subject: [PATCH] Zombie API - breaking doors -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java @@ -0,0 +0,0 @@ public class EntityZombie extends EntityMonster { return (Boolean) this.getDataWatcher().get(EntityZombie.DROWN_CONVERTING); } diff --git a/Spigot-Server-Patches/add-DragonEggFormEvent.patch b/Spigot-Server-Patches/add-DragonEggFormEvent.patch index 6f396406c5..ddca427665 100644 --- a/Spigot-Server-Patches/add-DragonEggFormEvent.patch +++ b/Spigot-Server-Patches/add-DragonEggFormEvent.patch @@ -4,12 +4,12 @@ Date: Mon, 25 Jan 2021 14:53:57 +0100 Subject: [PATCH] add DragonEggFormEvent -diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java +diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EnderDragonBattle.java -+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java -@@ -0,0 +0,0 @@ import java.util.function.Predicate; - import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java ++++ b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.levelgen.feature.configurations.WorldGenFeature + import net.minecraft.world.phys.AxisAlignedBB; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import io.papermc.paper.event.block.DragonEggFormEvent; // Paper - DragonEggFormEvent @@ -42,11 +42,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.previouslyKilled = true; this.dragonKilled = true; -diff --git a/src/main/java/net/minecraft/server/WorldGenEndTrophy.java b/src/main/java/net/minecraft/server/WorldGenEndTrophy.java +diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEndTrophy.java b/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEndTrophy.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldGenEndTrophy.java -+++ b/src/main/java/net/minecraft/server/WorldGenEndTrophy.java -@@ -0,0 +0,0 @@ import java.util.Random; +--- a/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEndTrophy.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEndTrophy.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.levelgen.feature.configurations.WorldGenFeature public class WorldGenEndTrophy extends WorldGenerator<WorldGenFeatureEmptyConfiguration> { diff --git a/Spigot-Server-Patches/add-more-information-to-Entity.toString.patch b/Spigot-Server-Patches/add-more-information-to-Entity.toString.patch index fc1289d69c..47eff4262d 100644 --- a/Spigot-Server-Patches/add-more-information-to-Entity.toString.patch +++ b/Spigot-Server-Patches/add-more-information-to-Entity.toString.patch @@ -5,11 +5,11 @@ Subject: [PATCH] add more information to Entity.toString() UUID, ticks lived, valid, dead -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public String toString() { diff --git a/Spigot-Server-Patches/added-PlayerNameEntityEvent.patch b/Spigot-Server-Patches/added-PlayerNameEntityEvent.patch index 8c239a572c..660601b079 100644 --- a/Spigot-Server-Patches/added-PlayerNameEntityEvent.patch +++ b/Spigot-Server-Patches/added-PlayerNameEntityEvent.patch @@ -4,12 +4,13 @@ Date: Sun, 5 Jul 2020 00:33:54 -0700 Subject: [PATCH] added PlayerNameEntityEvent -diff --git a/src/main/java/net/minecraft/server/ItemNameTag.java b/src/main/java/net/minecraft/server/ItemNameTag.java +diff --git a/src/main/java/net/minecraft/world/item/ItemNameTag.java b/src/main/java/net/minecraft/world/item/ItemNameTag.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ItemNameTag.java -+++ b/src/main/java/net/minecraft/server/ItemNameTag.java -@@ -0,0 +0,0 @@ - package net.minecraft.server; +--- a/src/main/java/net/minecraft/world/item/ItemNameTag.java ++++ b/src/main/java/net/minecraft/world/item/ItemNameTag.java +@@ -0,0 +0,0 @@ import net.minecraft.world.entity.EntityInsentient; + import net.minecraft.world.entity.EntityLiving; + import net.minecraft.world.entity.player.EntityHuman; +// Paper start +import io.papermc.paper.adventure.PaperAdventure; diff --git a/Spigot-Server-Patches/added-PlayerTradeEvent.patch b/Spigot-Server-Patches/added-PlayerTradeEvent.patch index e7bbacb03b..a78595915d 100644 --- a/Spigot-Server-Patches/added-PlayerTradeEvent.patch +++ b/Spigot-Server-Patches/added-PlayerTradeEvent.patch @@ -4,10 +4,10 @@ Date: Thu, 2 Jul 2020 16:12:10 -0700 Subject: [PATCH] added PlayerTradeEvent -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java @@ -0,0 +0,0 @@ import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason; public abstract class EntityInsentient extends EntityLiving { @@ -25,10 +25,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public int D() { return 80; } -diff --git a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java @@ -0,0 +0,0 @@ import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe; import org.bukkit.entity.AbstractVillager; import org.bukkit.event.entity.VillagerAcquireTradeEvent; diff --git a/Spigot-Server-Patches/added-Wither-API.patch b/Spigot-Server-Patches/added-Wither-API.patch index 1b1fb5dcbf..130b4d777d 100644 --- a/Spigot-Server-Patches/added-Wither-API.patch +++ b/Spigot-Server-Patches/added-Wither-API.patch @@ -4,10 +4,10 @@ Date: Sun, 5 Jul 2020 15:39:19 -0700 Subject: [PATCH] added Wither API -diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java +diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityWither.java -+++ b/src/main/java/net/minecraft/server/EntityWither.java +--- a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java ++++ b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java @@ -0,0 +0,0 @@ public class EntityWither extends EntityMonster implements IRangedEntity { return entityliving.getMonsterType() != EnumMonsterType.UNDEAD && entityliving.ei(); }; @@ -41,7 +41,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/ index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java -@@ -0,0 +0,0 @@ public class CraftWither extends CraftMonster implements Wither, CraftRangedEnti +@@ -0,0 +0,0 @@ public class CraftWither extends CraftMonster implements Wither, com.destroystok public BossBar getBossBar() { return bossBar; } diff --git a/Spigot-Server-Patches/added-option-to-disable-pathfinding-updates-on-block.patch b/Spigot-Server-Patches/added-option-to-disable-pathfinding-updates-on-block.patch index 1c222bda61..389d10bd76 100644 --- a/Spigot-Server-Patches/added-option-to-disable-pathfinding-updates-on-block.patch +++ b/Spigot-Server-Patches/added-option-to-disable-pathfinding-updates-on-block.patch @@ -18,10 +18,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + updatePathfindingOnBlockUpdate = getBoolean("update-pathfinding-on-block-update", this.updatePathfindingOnBlockUpdate); + } } -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { @Override public void notify(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, int i) { diff --git a/Spigot-Server-Patches/do-not-create-unnecessary-copies-of-passenger-list.patch b/Spigot-Server-Patches/do-not-create-unnecessary-copies-of-passenger-list.patch index 25a4354ddb..36905563ca 100644 --- a/Spigot-Server-Patches/do-not-create-unnecessary-copies-of-passenger-list.patch +++ b/Spigot-Server-Patches/do-not-create-unnecessary-copies-of-passenger-list.patch @@ -4,11 +4,63 @@ Date: Sun, 13 Dec 2020 13:42:55 +0100 Subject: [PATCH] do not create unnecessary copies of passenger list -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMount.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMount.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMount.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMount.java +@@ -0,0 +0,0 @@ public class PacketPlayOutMount implements Packet<PacketListenerPlayOut> { + + public PacketPlayOutMount(Entity entity) { + this.a = entity.getId(); +- List<Entity> list = entity.getPassengers(); ++ List<Entity> list = entity.passengers; // Paper - do not create a copy of the list + + this.b = new int[list.size()]; + +diff --git a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java ++++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java +@@ -0,0 +0,0 @@ public class EntityTrackerEntry { + + public final void tick() { this.a(); } // Paper - OBFHELPER + public void a() { +- List<Entity> list = this.tracker.getPassengers(); ++ List<Entity> list = this.tracker.passengers; // Paper - do not copy list + + if (!list.equals(this.p)) { +- this.p = list; ++ this.p = com.google.common.collect.ImmutableList.copyOf(list); // Paper - only copy list if something has changed + this.broadcastIncludingSelf(new PacketPlayOutMount(this.tracker)); // CraftBukkit + } + +@@ -0,0 +0,0 @@ public class EntityTrackerEntry { + } + } + +- if (!this.tracker.getPassengers().isEmpty()) { ++ if (!this.tracker.passengers.isEmpty()) { // Paper - do not create copy of list + consumer.accept(new PacketPlayOutMount(this.tracker)); + } + +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -0,0 +0,0 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially + list.add(entity); + } + +- if (!entity.getPassengers().isEmpty()) { ++ if (!entity.passengers.isEmpty()) { // Paper - do not copy list + list1.add(entity); + } + } +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } protected boolean q(Entity entity) { @@ -17,7 +69,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public final float getCollisionBorderSize() { return bg(); } // Paper - OBFHELPER -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public boolean isVehicle() { @@ -26,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } public boolean bt() { -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public boolean w(Entity entity) { @@ -35,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Entity entity1; -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public boolean a(Class<? extends Entity> oclass) { @@ -44,7 +96,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Entity entity; -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public Collection<Entity> getAllPassengers() { Set<Entity> set = Sets.newHashSet(); @@ -53,7 +105,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne private void a(boolean flag, Set<Entity> set) { Entity entity; @@ -62,10 +114,62 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entity = (Entity) iterator.next(); if (!flag || EntityPlayer.class.isAssignableFrom(entity.getClass())) { set.add(entity); -diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityBoat.java -+++ b/src/main/java/net/minecraft/server/EntityBoat.java +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java +@@ -0,0 +0,0 @@ public class PathfinderGoalTame extends PathfinderGoal { + @Override + public void e() { + if (!this.entity.isTamed() && this.entity.getRandom().nextInt(50) == 0) { +- Entity entity = (Entity) this.entity.getPassengers().get(0); ++ Entity entity = this.entity.passengers.isEmpty() ? null : this.entity.passengers.get(0); // Paper - do not copy list, fixed array out of bounds exception as well + + if (entity == null) { + return; +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityPig.java b/src/main/java/net/minecraft/world/entity/animal/EntityPig.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityPig.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityPig.java +@@ -0,0 +0,0 @@ public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable { + @Nullable + @Override + public Entity getRidingPassenger() { +- return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); ++ return this.passengers.isEmpty() ? null : (Entity) this.passengers.get(0); // Paper - do not copy list + } + + @Override +diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java b/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java +@@ -0,0 +0,0 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven + @Nullable + @Override + public Entity getRidingPassenger() { +- return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); ++ return this.passengers.isEmpty() ? null : (Entity) this.passengers.get(0); // Paper - do not copy list + } + + @Nullable +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityRavager.java b/src/main/java/net/minecraft/world/entity/monster/EntityRavager.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityRavager.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityRavager.java +@@ -0,0 +0,0 @@ public class EntityRavager extends EntityRaider { + @Nullable + @Override + public Entity getRidingPassenger() { +- return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); ++ return this.passengers.isEmpty() ? null : (Entity) this.passengers.get(0); // Paper - do not copy list + } + + @Override +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java @@ -0,0 +0,0 @@ public class EntityBoat extends Entity { super.tick(); this.r(); @@ -120,23 +224,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return list.isEmpty() ? null : (Entity) list.get(0); } -diff --git a/src/main/java/net/minecraft/server/EntityHorseAbstract.java b/src/main/java/net/minecraft/server/EntityHorseAbstract.java +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHorseAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityHorseAbstract.java -@@ -0,0 +0,0 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven - @Nullable - @Override - public Entity getRidingPassenger() { -- return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); -+ return this.passengers.isEmpty() ? null : (Entity) this.passengers.get(0); // Paper - do not copy list - } - - @Nullable -diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java @@ -0,0 +0,0 @@ public abstract class EntityMinecartAbstract extends Entity { vec3d1 = new Vec3D(d8 * d4 / d6, vec3d1.y, d8 * d5 / d6); @@ -146,94 +237,3 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (entity instanceof EntityHuman) { Vec3D vec3d2 = entity.getMot(); -diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPig.java -+++ b/src/main/java/net/minecraft/server/EntityPig.java -@@ -0,0 +0,0 @@ public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable { - @Nullable - @Override - public Entity getRidingPassenger() { -- return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); -+ return this.passengers.isEmpty() ? null : (Entity) this.passengers.get(0); // Paper - do not copy list - } - - @Override -diff --git a/src/main/java/net/minecraft/server/EntityRavager.java b/src/main/java/net/minecraft/server/EntityRavager.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityRavager.java -+++ b/src/main/java/net/minecraft/server/EntityRavager.java -@@ -0,0 +0,0 @@ public class EntityRavager extends EntityRaider { - @Nullable - @Override - public Entity getRidingPassenger() { -- return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); -+ return this.passengers.isEmpty() ? null : (Entity) this.passengers.get(0); // Paper - do not copy list - } - - @Override -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -0,0 +0,0 @@ public class EntityTrackerEntry { - - public final void tick() { this.a(); } // Paper - OBFHELPER - public void a() { -- List<Entity> list = this.tracker.getPassengers(); -+ List<Entity> list = this.tracker.passengers; // Paper - do not copy list - - if (!list.equals(this.p)) { -- this.p = list; -+ this.p = com.google.common.collect.ImmutableList.copyOf(list); // Paper - only copy list if something has changed - this.broadcastIncludingSelf(new PacketPlayOutMount(this.tracker)); // CraftBukkit - } - -@@ -0,0 +0,0 @@ public class EntityTrackerEntry { - } - } - -- if (!this.tracker.getPassengers().isEmpty()) { -+ if (!this.tracker.passengers.isEmpty()) { // Paper - do not create copy of list - consumer.accept(new PacketPlayOutMount(this.tracker)); - } - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMount.java b/src/main/java/net/minecraft/server/PacketPlayOutMount.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMount.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMount.java -@@ -0,0 +0,0 @@ public class PacketPlayOutMount implements Packet<PacketListenerPlayOut> { - - public PacketPlayOutMount(Entity entity) { - this.a = entity.getId(); -- List<Entity> list = entity.getPassengers(); -+ List<Entity> list = entity.passengers; // Paper - do not create a copy of the list - - this.b = new int[list.size()]; - -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTame.java b/src/main/java/net/minecraft/server/PathfinderGoalTame.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalTame.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalTame.java -@@ -0,0 +0,0 @@ public class PathfinderGoalTame extends PathfinderGoal { - @Override - public void e() { - if (!this.entity.isTamed() && this.entity.getRandom().nextInt(50) == 0) { -- Entity entity = (Entity) this.entity.getPassengers().get(0); -+ Entity entity = this.entity.passengers.isEmpty() ? null : this.entity.passengers.get(0); // Paper - do not copy list, fixed array out of bounds exception as well - - if (entity == null) { - return; -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -0,0 +0,0 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially - list.add(entity); - } - -- if (!entity.getPassengers().isEmpty()) { -+ if (!entity.passengers.isEmpty()) { // Paper - do not copy list - list1.add(entity); - } - } diff --git a/Spigot-Server-Patches/don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch b/Spigot-Server-Patches/don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch index 20064b48ad..3a8d4ae75f 100644 --- a/Spigot-Server-Patches/don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch +++ b/Spigot-Server-Patches/don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch @@ -5,10 +5,10 @@ Subject: [PATCH] don't go below 0 for pickupDelay, breaks picking up items vanilla checks for == 0 -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java +--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java @@ -0,0 +0,0 @@ public class EntityItem extends Entity { // CraftBukkit start - Use wall time for pickup and despawn timers int elapsedTicks = MinecraftServer.currentTick - this.lastTick; diff --git a/Spigot-Server-Patches/fix-converting-txt-to-json-file.patch b/Spigot-Server-Patches/fix-converting-txt-to-json-file.patch index a1b657aae2..af2d3905a7 100644 --- a/Spigot-Server-Patches/fix-converting-txt-to-json-file.patch +++ b/Spigot-Server-Patches/fix-converting-txt-to-json-file.patch @@ -4,10 +4,10 @@ Date: Mon, 4 Jan 2021 19:49:15 -0800 Subject: [PATCH] fix converting txt to json file -diff --git a/src/main/java/net/minecraft/server/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/DedicatedPlayerList.java +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DedicatedPlayerList.java -+++ b/src/main/java/net/minecraft/server/DedicatedPlayerList.java +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java @@ -0,0 +0,0 @@ public class DedicatedPlayerList extends PlayerList { this.a(dedicatedserverproperties.viewDistance); @@ -20,10 +20,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.y(); this.w(); this.x(); -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -0,0 +0,0 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer org.spigotmc.SpigotConfig.init((java.io.File) options.valueOf("spigot-settings")); org.spigotmc.SpigotConfig.registerCommands(); @@ -48,10 +48,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!NameReferencingFileConverter.e(this)) { return false; } else { -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -0,0 +0,0 @@ public abstract class PlayerList { this.maxPlayers = i; this.playerFileData = worldnbtstorage; @@ -60,10 +60,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void a(NetworkManager networkmanager, EntityPlayer entityplayer) { EntityPlayer prev = pendingPlayers.put(entityplayer.getUniqueID(), entityplayer);// Paper -diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java +diff --git a/src/main/java/net/minecraft/server/players/UserCache.java b/src/main/java/net/minecraft/server/players/UserCache.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/UserCache.java -+++ b/src/main/java/net/minecraft/server/UserCache.java +--- a/src/main/java/net/minecraft/server/players/UserCache.java ++++ b/src/main/java/net/minecraft/server/players/UserCache.java @@ -0,0 +0,0 @@ public class UserCache { return arraylist; } diff --git a/Spigot-Server-Patches/force-entity-dismount-during-teleportation.patch b/Spigot-Server-Patches/force-entity-dismount-during-teleportation.patch index 253681782f..9c49c2044b 100644 --- a/Spigot-Server-Patches/force-entity-dismount-during-teleportation.patch +++ b/Spigot-Server-Patches/force-entity-dismount-during-teleportation.patch @@ -19,102 +19,10 @@ this is going to be the best soultion all around. Improvements/suggestions welcome! -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 void bf() { -+ // Paper start -+ public void bf() { stopRiding(false); } -+ public void stopRiding(boolean suppressCancellation) { -+ // Paper end - if (this.vehicle != null) { - Entity entity = this.vehicle; - - this.vehicle = null; -- if (!entity.removePassenger(this)) this.vehicle = entity; // CraftBukkit -+ if (!entity.removePassenger(this, suppressCancellation)) this.vehicle = entity; // CraftBukkit // Paper - } - - } -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - return true; // CraftBukkit - } - -- protected boolean removePassenger(Entity entity) { // CraftBukkit -+ // Paper start -+ protected boolean removePassenger(Entity entity) { return removePassenger(entity, false);} -+ protected boolean removePassenger(Entity entity, boolean suppressCancellation) { // CraftBukkit -+ // Paper end - if (entity.getVehicle() == this) { - throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); - } else { -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { - VehicleExitEvent event = new VehicleExitEvent( - (Vehicle) getBukkitEntity(), -- (LivingEntity) entity.getBukkitEntity() -+ (LivingEntity) entity.getBukkitEntity(), !suppressCancellation // Paper - ); - // Suppress during worldgen - if (this.valid) { -@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } - // CraftBukkit end - // Spigot start -- org.spigotmc.event.entity.EntityDismountEvent event = new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity()); -+ org.spigotmc.event.entity.EntityDismountEvent event = new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity(), !suppressCancellation); // Paper - // Suppress during worldgen - if (this.valid) { - Bukkit.getPluginManager().callEvent(event); -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - return -0.35D; - } - -- @Override -- public void bf() { -- super.bf(); -+ // Paper start -+ @Override public void bf() { stopRiding(false); } -+ @Override public void stopRiding(boolean suppressCancellation) { -+ // Paper end -+ super.stopRiding(suppressCancellation); // Paper - suppress - this.j = 0; - } - -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - return ((Byte) this.datawatcher.get(EntityLiving.ag) & 4) != 0; - } - -- @Override -- public void stopRiding() { -+ // Paper start -+ @Override public void stopRiding() { stopRiding(false); } -+ @Override public void stopRiding(boolean suppressCancellation) { -+ // Paper end - Entity entity = this.getVehicle(); - -- super.stopRiding(); -+ super.stopRiding(suppressCancellation); // Paper - suppress - if (entity != null && entity != this.getVehicle() && !this.world.isClientSide) { - this.a(entity); - } -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } } @@ -132,3 +40,95 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Entity entity1 = this.getVehicle(); if (entity1 != entity && this.playerConnection != null) { +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + + } + +- public void bf() { ++ // Paper start ++ public void bf() { stopRiding(false); } ++ public void stopRiding(boolean suppressCancellation) { ++ // Paper end + if (this.vehicle != null) { + Entity entity = this.vehicle; + + this.vehicle = null; +- if (!entity.removePassenger(this)) this.vehicle = entity; // CraftBukkit ++ if (!entity.removePassenger(this, suppressCancellation)) this.vehicle = entity; // CraftBukkit // Paper + } + + } +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + return true; // CraftBukkit + } + +- protected boolean removePassenger(Entity entity) { // CraftBukkit ++ // Paper start ++ protected boolean removePassenger(Entity entity) { return removePassenger(entity, false);} ++ protected boolean removePassenger(Entity entity, boolean suppressCancellation) { // CraftBukkit ++ // Paper end + if (entity.getVehicle() == this) { + throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); + } else { +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { + VehicleExitEvent event = new VehicleExitEvent( + (Vehicle) getBukkitEntity(), +- (LivingEntity) entity.getBukkitEntity() ++ (LivingEntity) entity.getBukkitEntity(), !suppressCancellation // Paper + ); + // Suppress during worldgen + if (this.valid) { +@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + } + // CraftBukkit end + // Spigot start +- org.spigotmc.event.entity.EntityDismountEvent event = new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity()); ++ org.spigotmc.event.entity.EntityDismountEvent event = new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity(), !suppressCancellation); // Paper + // Suppress during worldgen + if (this.valid) { + Bukkit.getPluginManager().callEvent(event); +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { + return ((Byte) this.datawatcher.get(EntityLiving.ag) & 4) != 0; + } + +- @Override +- public void stopRiding() { ++ // Paper start ++ @Override public void stopRiding() { stopRiding(false); } ++ @Override public void stopRiding(boolean suppressCancellation) { ++ // Paper end + Entity entity = this.getVehicle(); + +- super.stopRiding(); ++ super.stopRiding(suppressCancellation); // Paper - suppress + if (entity != null && entity != this.getVehicle() && !this.world.isClientSide) { + this.a(entity); + } +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -0,0 +0,0 @@ public abstract class EntityHuman extends EntityLiving { + return -0.35D; + } + +- @Override +- public void bf() { +- super.bf(); ++ // Paper start ++ @Override public void bf() { stopRiding(false); } ++ @Override public void stopRiding(boolean suppressCancellation) { ++ // Paper end ++ super.stopRiding(suppressCancellation); // Paper - suppress + this.j = 0; + } + diff --git a/Spigot-Server-Patches/handle-NaN-health-absorb-values-and-repair-bad-data.patch b/Spigot-Server-Patches/handle-NaN-health-absorb-values-and-repair-bad-data.patch index b666f22291..9437809c91 100644 --- a/Spigot-Server-Patches/handle-NaN-health-absorb-values-and-repair-bad-data.patch +++ b/Spigot-Server-Patches/handle-NaN-health-absorb-values-and-repair-bad-data.patch @@ -4,10 +4,10 @@ Date: Sun, 27 Sep 2015 01:18:02 -0400 Subject: [PATCH] handle NaN health/absorb values and repair bad data -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity { @Override diff --git a/Spigot-Server-Patches/handle-PacketPlayInKeepAlive-async.patch b/Spigot-Server-Patches/handle-PacketPlayInKeepAlive-async.patch index c164e8caf7..b85929f2db 100644 --- a/Spigot-Server-Patches/handle-PacketPlayInKeepAlive-async.patch +++ b/Spigot-Server-Patches/handle-PacketPlayInKeepAlive-async.patch @@ -14,10 +14,10 @@ off the main thread. also adding some additional logging in order to help work out what is causing random disconnections for clients. -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override 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 8e2a20a8c7..097059cb1f 100644 --- a/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch +++ b/Spigot-Server-Patches/implement-optional-per-player-mob-spawns.patch @@ -544,10 +544,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } +} -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java @@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { this.world.getMethodProfiler().enter("naturalSpawnCount"); this.world.timings.countNaturalMobs.startTiming(); // Paper - timings @@ -572,13 +572,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings this.p = spawnercreature_d; -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public boolean queueHealthUpdatePacket = false; - public net.minecraft.server.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; + public net.minecraft.network.protocol.game.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; // Paper end + // Paper start - mob spawning rework + public static final int ENUMCREATURETYPE_TOTAL_ENUMS = EnumCreatureType.values().length; @@ -604,22 +604,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public SectionPosition O() { return this.cj; } -diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityTypes.java -+++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { - return this.bl; - } - -+ public final EnumCreatureType getEnumCreatureType() { return this.e(); } // Paper - OBFHELPER - public EnumCreatureType e() { - return this.bg; - } -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -0,0 +0,0 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public final Int2ObjectMap<PlayerChunkMap.EntityTracker> trackedEntities; private final Long2ByteMap z; @@ -655,10 +643,22 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } private static double a(ChunkCoordIntPair chunkcoordintpair, Entity entity) { -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java +--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java ++++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java +@@ -0,0 +0,0 @@ public class EntityTypes<T extends Entity> { + return this.bl; + } + ++ public final EnumCreatureType getEnumCreatureType() { return this.e(); } // Paper - OBFHELPER + public EnumCreatureType e() { + return this.bg; + } +diff --git a/src/main/java/net/minecraft/world/level/SpawnerCreature.java b/src/main/java/net/minecraft/world/level/SpawnerCreature.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/world/level/SpawnerCreature.java @@ -0,0 +0,0 @@ public final class SpawnerCreature { }); diff --git a/Spigot-Server-Patches/incremental-chunk-saving.patch b/Spigot-Server-Patches/incremental-chunk-saving.patch index e2656801e4..dc4db56be0 100644 --- a/Spigot-Server-Patches/incremental-chunk-saving.patch +++ b/Spigot-Server-Patches/incremental-chunk-saving.patch @@ -28,39 +28,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24); + } } -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 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 { - private TickList<Block> o; - private TickList<FluidType> p; - private boolean q; -- private long lastSaved; -+ public long lastSaved; // Paper - private volatile boolean s; - private long inhabitedTime; - @Nullable -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { - } // Paper - Timings - } - -+ // Paper start - duplicate save, but call incremental -+ public void saveIncrementally() { -+ this.tickDistanceManager(); -+ try (co.aikar.timings.Timing timed = world.timings.chunkSaveData.startTiming()) { // Paper - Timings -+ this.playerChunkMap.saveIncrementally(); -+ } // Paper - Timings -+ } -+ // Paper end -+ - @Override - public void close() throws IOException { - // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java @@ -103,10 +70,30 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.methodProfiler.enter("snooper"); if (((DedicatedServer) this).getDedicatedServerProperties().snooperEnabled && !this.snooper.d() && this.ticks > 100) { // Spigot -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -0,0 +0,0 @@ public class ChunkProviderServer extends IChunkProvider { + } // Paper - Timings + } + ++ // Paper start - duplicate save, but call incremental ++ public void saveIncrementally() { ++ this.tickDistanceManager(); ++ try (co.aikar.timings.Timing timed = world.timings.chunkSaveData.startTiming()) { // Paper - Timings ++ this.playerChunkMap.saveIncrementally(); ++ } // Paper - Timings ++ } ++ // Paper end ++ + @Override + public void close() throws IOException { + // CraftBukkit start +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java @@ -0,0 +0,0 @@ public class PlayerChunk { private final PlayerChunkMap chunkMap; // Paper @@ -170,14 +157,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void a(ProtoChunkExtension protochunkextension) { for (int i = 0; i < this.statusFutures.length(); ++i) { -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -0,0 +0,0 @@ import java.util.function.Supplier; - import java.util.stream.Collectors; - import java.util.stream.Stream; - import javax.annotation.Nullable; +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -0,0 +0,0 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.DefinedStruct + import net.minecraft.world.level.storage.Convertable; + import net.minecraft.world.level.storage.WorldPersistentData; + import net.minecraft.world.phys.Vec3D; +import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; // Paper import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.logging.log4j.LogManager; @@ -264,10 +251,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 chunk.a(() -> { return PlayerChunk.getChunkState(playerchunk.getTicketLevel()); }); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -0,0 +0,0 @@ public class WorldServer extends World implements GeneratorAccessSeed { return !this.server.a(this, blockposition, entityhuman) && this.getWorldBorder().a(blockposition); } @@ -321,3 +308,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 private void aj() { if (this.dragonBattle != null) { this.worldDataServer.a(this.dragonBattle.a()); // CraftBukkit +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -0,0 +0,0 @@ public class Chunk implements IChunkAccess { + private TickList<Block> o; + private TickList<FluidType> p; + private boolean q; +- private long lastSaved; ++ public long lastSaved; // Paper + private volatile boolean s; + private long inhabitedTime; + @Nullable diff --git a/Spigot-Server-Patches/living-entity-allow-attribute-registration.patch b/Spigot-Server-Patches/living-entity-allow-attribute-registration.patch index dc8be0ee38..d95db8dce1 100644 --- a/Spigot-Server-Patches/living-entity-allow-attribute-registration.patch +++ b/Spigot-Server-Patches/living-entity-allow-attribute-registration.patch @@ -4,10 +4,10 @@ Date: Sat, 24 Oct 2020 16:37:44 +0200 Subject: [PATCH] living entity allow attribute registration -diff --git a/src/main/java/net/minecraft/server/AttributeMapBase.java b/src/main/java/net/minecraft/server/AttributeMapBase.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMapBase.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMapBase.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/AttributeMapBase.java -+++ b/src/main/java/net/minecraft/server/AttributeMapBase.java +--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMapBase.java ++++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMapBase.java @@ -0,0 +0,0 @@ import org.apache.logging.log4j.Logger; public class AttributeMapBase { diff --git a/Spigot-Server-Patches/offset-item-frame-ticking.patch b/Spigot-Server-Patches/offset-item-frame-ticking.patch index cf574c9d02..1c2f30dfd6 100644 --- a/Spigot-Server-Patches/offset-item-frame-ticking.patch +++ b/Spigot-Server-Patches/offset-item-frame-ticking.patch @@ -4,10 +4,10 @@ Date: Tue, 30 Jul 2019 03:17:16 +0500 Subject: [PATCH] offset item frame ticking -diff --git a/src/main/java/net/minecraft/server/EntityHanging.java b/src/main/java/net/minecraft/server/EntityHanging.java +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityHanging.java b/src/main/java/net/minecraft/world/entity/decoration/EntityHanging.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityHanging.java -+++ b/src/main/java/net/minecraft/server/EntityHanging.java +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityHanging.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityHanging.java @@ -0,0 +0,0 @@ public abstract class EntityHanging extends Entity { protected static final Predicate<Entity> b = (entity) -> { return entity instanceof EntityHanging; diff --git a/Spigot-Server-Patches/provide-a-configurable-option-to-disable-creeper-lin.patch b/Spigot-Server-Patches/provide-a-configurable-option-to-disable-creeper-lin.patch index 307ff31466..f62a4790e7 100644 --- a/Spigot-Server-Patches/provide-a-configurable-option-to-disable-creeper-lin.patch +++ b/Spigot-Server-Patches/provide-a-configurable-option-to-disable-creeper-lin.patch @@ -20,10 +20,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + log("Creeper lingering effect: " + disableCreeperLingeringEffect); + } } -diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java b/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/EntityCreeper.java -+++ b/src/main/java/net/minecraft/server/EntityCreeper.java +--- a/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java @@ -0,0 +0,0 @@ public class EntityCreeper extends EntityMonster { private void createEffectCloud() { Collection<MobEffect> collection = this.getEffects(); diff --git a/Spigot-Server-Patches/revert-serverside-behavior-of-keepalives.patch b/Spigot-Server-Patches/revert-serverside-behavior-of-keepalives.patch index ac4a543121..45534f5160 100644 --- a/Spigot-Server-Patches/revert-serverside-behavior-of-keepalives.patch +++ b/Spigot-Server-Patches/revert-serverside-behavior-of-keepalives.patch @@ -16,10 +16,10 @@ whereas higher values will make this less sensitive to issues such as spikes from networking or during connections flood of chunk packets on slower clients, at the cost of dead connections being kept open for longer. -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -0,0 +0,0 @@ public class PlayerConnection implements PacketListenerPlayIn { private final MinecraftServer minecraftServer; public EntityPlayer player; diff --git a/Spigot-Server-Patches/stop-firing-pressure-plate-EntityInteractEvent-for-i.patch b/Spigot-Server-Patches/stop-firing-pressure-plate-EntityInteractEvent-for-i.patch index 854a04c844..3871d37ce9 100644 --- a/Spigot-Server-Patches/stop-firing-pressure-plate-EntityInteractEvent-for-i.patch +++ b/Spigot-Server-Patches/stop-firing-pressure-plate-EntityInteractEvent-for-i.patch @@ -5,10 +5,10 @@ Subject: [PATCH] stop firing pressure plate EntityInteractEvent for ignored entities -diff --git a/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java b/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockPressurePlateBinary.java b/src/main/java/net/minecraft/world/level/block/BlockPressurePlateBinary.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java -+++ b/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java +--- a/src/main/java/net/minecraft/world/level/block/BlockPressurePlateBinary.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockPressurePlateBinary.java @@ -0,0 +0,0 @@ public class BlockPressurePlateBinary extends BlockPressurePlateAbstract { while (iterator.hasNext()) { 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 b3b8959884..344f9c5df0 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 @@ -17,10 +17,10 @@ By using CBs CraftBlock#getState(), we will maintain a proper copy of 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 +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java @@ -0,0 +0,0 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public boolean captureBlockStates = false; diff --git a/work/BuildData b/work/BuildData index 656df5e622..80d35549ec 160000 --- a/work/BuildData +++ b/work/BuildData @@ -1 +1 @@ -Subproject commit 656df5e622bba97efb4e858e8cd3ec428a0b2d71 +Subproject commit 80d35549ec67b87a0cdf0d897abbe826ba34ac27 diff --git a/work/CraftBukkit b/work/CraftBukkit index 2ffdb31ec0..90d6905b15 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 2ffdb31ec0d6827d7cd5e832b5393514f46c0c19 +Subproject commit 90d6905b1587ac1c5c075e2da471f77d00e0f50d diff --git a/work/Spigot b/work/Spigot index bff526193e..79d53c285f 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit bff526193eec525c624bf7e65f8a5239866bfcbf +Subproject commit 79d53c285f44559efad1f2aba24fb785f0cf0cfe