This commit is contained in:
Jake Potrebic 2024-06-13 13:57:13 -07:00
parent 0bc9aeef26
commit 27e29ccaf2
No known key found for this signature in database
GPG key ID: ECE0B3C133C016C5
106 changed files with 308 additions and 292 deletions

View file

@ -85,16 +85,17 @@ index 0000000000000000000000000000000000000000..2512dba27edfdccbc4430815b6cba048
+}
diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java
new file mode 100644
index 0000000000000000000000000000000000000000..7b79bf33074355020e0b3b5ef40c7f2e6ba644b4
index 0000000000000000000000000000000000000000..adf24eb062460e2fd08d3e91337eba379d76a27d
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java
@@ -0,0 +1,141 @@
@@ -0,0 +1,146 @@
+package io.papermc.paper.registry;
+
+import net.kyori.adventure.key.Keyed;
+import org.bukkit.Art;
+import org.bukkit.Fluid;
+import org.bukkit.GameEvent;
+import org.bukkit.JukeboxSong;
+import org.bukkit.MusicInstrument;
+import org.bukkit.Particle;
+import org.bukkit.Sound;
@ -206,10 +207,14 @@ index 0000000000000000000000000000000000000000..7b79bf33074355020e0b3b5ef40c7f2e
+ */
+ RegistryKey<DamageType> DAMAGE_TYPE = create("damage_type");
+ /**
+ * Data-driven registry for wolf variants
+ * Data-driven registry for wolf variants.
+ * @see io.papermc.paper.registry.keys.WolfVariantKeys
+ */
+ RegistryKey<Wolf.Variant> WOLF_VARIANT = create("wolf_variant");
+ /**
+ * Data-driven registry for jukebox songs.
+ */
+ RegistryKey<JukeboxSong> JUKEBOX_SONG = create("jukebox_song");
+
+
+ /* ******************* *

View file

@ -206,7 +206,7 @@ index 188280a8fdf35a70a5a358f8cfe7cf44f05855b1..ceaa901fa830e904d6ac7a1727d1e7d1
return server.getRegistry(tClass);
}
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 3effaea369d9c7a6a22979fbfc270f55f9f25cf2..9daa96d4e87a6b11eef7abd6e0f9fbf05a57bb97 100644
index 3effaea369d9c7a6a22979fbfc270f55f9f25cf2..d40c2b492a2be6ce87105ce910a05c7c344ddf84 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -102,7 +102,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@ -273,7 +273,7 @@ index 3effaea369d9c7a6a22979fbfc270f55f9f25cf2..9daa96d4e87a6b11eef7abd6e0f9fbf0
/**
* Sound keys.
*
@@ -219,21 +221,26 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
@@ -219,28 +221,33 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* Trim materials.
*
* @see TrimMaterial
@ -304,6 +304,14 @@ index 3effaea369d9c7a6a22979fbfc270f55f9f25cf2..9daa96d4e87a6b11eef7abd6e0f9fbf0
/**
* Jukebox songs.
*
* @see JukeboxSong
*/
@ApiStatus.Experimental
- Registry<JukeboxSong> JUKEBOX_SONG = Objects.requireNonNull(Bukkit.getRegistry(JukeboxSong.class), "No registry present for JukeboxSong. This is a bug.");
+ Registry<JukeboxSong> JUKEBOX_SONG = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.JUKEBOX_SONG); // Paper
/**
* Villager profession.
*
@@ -294,8 +301,10 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* Wolf variants.
*

View file

@ -513,7 +513,7 @@ index 0000000000000000000000000000000000000000..1e7b53f9bc13dcd5a0a4a40004591e4f
+ }
+}
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 9daa96d4e87a6b11eef7abd6e0f9fbf05a57bb97..acfc52e692c9361a6bf407ce046435fd5d364d29 100644
index d40c2b492a2be6ce87105ce910a05c7c344ddf84..c5001f4d54ec05a416b357538b94ea5ec4a17849 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -318,6 +318,15 @@ public interface Registry<T extends Keyed> extends Iterable<T> {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] More PotionEffectType API
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index acfc52e692c9361a6bf407ce046435fd5d364d29..1d0e734b3200214f97ccd5b65c0fd3192e0b0dc1 100644
index c5001f4d54ec05a416b357538b94ea5ec4a17849..afd132dab5eb2826b600592429b9e4a8d1fe0b73 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -326,6 +326,31 @@ public interface Registry<T extends Keyed> extends Iterable<T> {

View file

@ -31,7 +31,7 @@ index 62d2b3f950860dee0898d77b0a29635c3f9a7e23..704dba92f9246ef398ed8d162ebee3cf
@Override
public @NotNull String translationKey() {
diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java
index 1d0e734b3200214f97ccd5b65c0fd3192e0b0dc1..eada6d6c4340a345750f63bf49f14711596f706e 100644
index afd132dab5eb2826b600592429b9e4a8d1fe0b73..b159863568c56202968ac0f9024d3e1f5f118dac 100644
--- a/src/main/java/org/bukkit/Registry.java
+++ b/src/main/java/org/bukkit/Registry.java
@@ -361,6 +361,49 @@ public interface Registry<T extends Keyed> extends Iterable<T> {

View file

@ -1401,10 +1401,10 @@ index 0000000000000000000000000000000000000000..990d1bb46e0f9719f4e9af928d80ac6f
+}
diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
new file mode 100644
index 0000000000000000000000000000000000000000..efc91ff91827872c62b8bd060282549ccdcf67dd
index 0000000000000000000000000000000000000000..7509b17414f836e8b53fc62b02b386ba4e8c5ca9
--- /dev/null
+++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java
@@ -0,0 +1,550 @@
@@ -0,0 +1,551 @@
+package io.papermc.paper.configuration;
+
+import com.google.common.collect.HashBasedTable;
@ -1444,6 +1444,7 @@ index 0000000000000000000000000000000000000000..efc91ff91827872c62b8bd060282549c
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.EntityType;
+import net.minecraft.world.entity.ExperienceOrb;
+import net.minecraft.world.entity.Leashable;
+import net.minecraft.world.entity.MobCategory;
+import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
+import net.minecraft.world.entity.decoration.HangingEntity;
@ -1945,7 +1946,7 @@ index 0000000000000000000000000000000000000000..efc91ff91827872c62b8bd060282549c
+ public boolean showSignClickCommandFailureMsgsToPlayer = false;
+ public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA;
+ public boolean disableEndCredits = false;
+ public float maxLeashDistance = 10f;
+ public double maxLeashDistance = Leashable.LEASH_TOO_FAR_DIST;
+ public boolean disableSprintInterruptionOnAttack = false;
+ public int shieldBlockingDelay = 5;
+ public boolean disableRelativeProjectileVelocity = false;

View file

@ -8,7 +8,7 @@ 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/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
index 4c766b879f935298ffa4249e9ce4045601cedb20..2bd91b48eaa06f85a5b9b1ae052c70e966ae8e4c 100644
index c6ec9fc6ccde2a5c086a2bfe32686954c074c31d..7198dc9ffc9a37dab3654e12aa497c442a9993c5 100644
--- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java
@@ -327,6 +327,7 @@ public class AnvilMenu extends ItemCombinerMenu {
@ -32,10 +32,10 @@ index 11d7bf4f90083991cfc8c6c5f9a1e8ad6a162843..c52c4c4210bc6ae082443318d9795c48
private void setupResultSlot(ItemStack map, ItemStack item, ItemStack oldResult) {
diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
index d41197db6bbf9e17b67bb1faa5d370eea0212bd3..ecf3cdc16d1ea830c4d45b57f69204118af3218a 100644
index 637d77d6b07ff9ee5ac1cb0470cbefcba5c7495e..15ec798e149d80aace186f84b9236ddeaba690c3 100644
--- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java
@@ -159,6 +159,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
@@ -160,6 +160,7 @@ public class GrindstoneMenu extends AbstractContainerMenu {
super.slotsChanged(inventory);
if (inventory == this.repairSlots) {
this.createResult();
@ -70,10 +70,10 @@ index fb7027985c6442fc50573e96031a05a3c64f4426..4bd720a97da27c4fd97788d4c504c017
this.resultSlot.set(ItemStack.EMPTY);
this.selectablePatterns = List.of();
diff --git a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
index 59d9f990a87ab5214fa51e3a6e933bf5ae71b613..1e9e70263996afa294458364aa70e738b5aabea1 100644
index 0735705def4f9505b7f16df2497cc78bbf5a8373..86e51fcce767d265ee0d3beb611be2119085830b 100644
--- a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java
@@ -115,6 +115,7 @@ public class SmithingMenu extends ItemCombinerMenu {
@@ -121,6 +121,7 @@ public class SmithingMenu extends ItemCombinerMenu {
}
}
@ -82,22 +82,22 @@ index 59d9f990a87ab5214fa51e3a6e933bf5ae71b613..1e9e70263996afa294458364aa70e738
@Override
diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
index 9c2fe69ced7a46bbd8b0fbe10fa67d0a39b0f375..e40d9dbdbe5359c38af6d764d01c9be422654aaa 100644
index 04d9793a83c724350f74616558f650082f9805d9..bb29107cb15e2ec644a14cabb3cf91f4bde5471d 100644
--- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java
@@ -181,6 +181,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
@@ -182,6 +182,7 @@ public class StonecutterMenu extends AbstractContainerMenu {
this.setupRecipeList(inventory, itemstack);
}
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper - Add PrepareResultEvent
}
private void setupRecipeList(Container input, ItemStack stack) {
private static SingleRecipeInput createRecipeInput(Container inventory) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 943c452e1d3d1273a2ef304aa2a52f328dfb5d37..2006573ca4bed3c3ed02bf2f38cdd248e6b123c9 100644
index 805aec84b57f0a426c1337445dfdd084cb0a0507..5cd934897dde1fc54bfe93e8d585ff05bb9293c3 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -1650,6 +1650,12 @@ public class CraftEventFactory {
@@ -1651,6 +1651,12 @@ public class CraftEventFactory {
}
public static PrepareAnvilEvent callPrepareAnvilEvent(InventoryView view, ItemStack item) {
@ -110,7 +110,7 @@ index 943c452e1d3d1273a2ef304aa2a52f328dfb5d37..2006573ca4bed3c3ed02bf2f38cdd248
PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item).clone());
event.getView().getPlayer().getServer().getPluginManager().callEvent(event);
event.getInventory().setItem(2, event.getResult());
@@ -1657,6 +1663,12 @@ public class CraftEventFactory {
@@ -1658,6 +1664,12 @@ public class CraftEventFactory {
}
public static PrepareGrindstoneEvent callPrepareGrindstoneEvent(InventoryView view, ItemStack item) {
@ -123,7 +123,7 @@ index 943c452e1d3d1273a2ef304aa2a52f328dfb5d37..2006573ca4bed3c3ed02bf2f38cdd248
PrepareGrindstoneEvent event = new PrepareGrindstoneEvent(view, CraftItemStack.asCraftMirror(item).clone());
event.getView().getPlayer().getServer().getPluginManager().callEvent(event);
event.getInventory().setItem(2, event.getResult());
@@ -1664,12 +1676,39 @@ public class CraftEventFactory {
@@ -1665,12 +1677,39 @@ public class CraftEventFactory {
}
public static PrepareSmithingEvent callPrepareSmithingEvent(InventoryView view, ItemStack item) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index a4d5e0ffbdade4e1b15d30de6e60feddda697c24..dd5a32360f4b49e9544009d3874da3f4af7b386a 100644
index 94c0de0a50e2a076e5aed86a673fe03d9698ba36..a85321f1dc8b0bc4338bf5f23c5686c0ca733cec 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3608,7 +3608,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3630,7 +3630,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
Entity entity = this.getVehicle();
super.stopRiding(suppressCancellation); // Paper - Force entity dismount during teleportation

View file

@ -9,10 +9,10 @@ instead of getting stuck in a never despawn state (bubble columns,
etc).
diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
index ccb5de967a83c01b69161af0c1c922fc31c7a0d9..49dc01532f9b60b3f594abca56b7d807fe6716d5 100644
index a2617881999ea61bf132ff75fb36e783261e5835..1f881f71d5698bc7b36bc029287ac8e873a46107 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java
@@ -214,6 +214,7 @@ public abstract class AbstractArrow extends Projectile {
@@ -231,6 +231,7 @@ public abstract class AbstractArrow extends Projectile {
++this.inGroundTime;
} else {

View file

@ -52,7 +52,7 @@ index 9a387d5dc0925304d4163e3caa22206aaa68e3b7..f43053ba082f9772b6ec02828fa2d6f3
LootContext lootContext = EntityPredicate.createContext(player, player);
List<CriterionTrigger.Listener<T>> list = null;
diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java
index 6e8ccafe8966970d1665be21266f2ffe95e1d3ed..f46fa0fbfec19904d21729847788c6c624a3e97f 100644
index 4c85abf29441645039b6a554a50e1d3274229de6..d85fb1e2ea0eaef81e9039b47d18f83507e05a59 100644
--- a/src/main/java/net/minecraft/server/PlayerAdvancements.java
+++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java
@@ -63,6 +63,7 @@ public class PlayerAdvancements {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Brand support
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index e6a24484ef11a1d815a85126aec221547479f7d3..ffd9ff7db5180cb351839a3ce331353d16b662d2 100644
index b808d9c710d6cd59ac34ea537f603fd4002073d0..45d36070735cd7a8baee585165a95a169d7059b4 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -290,6 +290,7 @@ public class ServerPlayer extends Player {
@@ -294,6 +294,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
public boolean isRealPlayer; // Paper
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
@ -17,10 +17,10 @@ index e6a24484ef11a1d815a85126aec221547479f7d3..ffd9ff7db5180cb351839a3ce331353d
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 289a74e35836717bd20c777e9fc8c17722e90411..a5dce1e83e63292054b21ec693ec3006e08d3ff2 100644
index adf953994d2c7e8f1e15075722ee2b9213e4bf94..4761a8d8f342c649bc2e5f530819fa88f43542ec 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -77,6 +77,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -78,6 +78,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
private volatile boolean suspendFlushingOnServerThread = false;
public final java.util.Map<java.util.UUID, net.kyori.adventure.resource.ResourcePackCallback> packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
@ -28,7 +28,7 @@ index 289a74e35836717bd20c777e9fc8c17722e90411..a5dce1e83e63292054b21ec693ec3006
public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit
this.server = minecraftserver;
@@ -142,6 +143,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -143,6 +144,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
@ -40,7 +40,7 @@ index 289a74e35836717bd20c777e9fc8c17722e90411..a5dce1e83e63292054b21ec693ec3006
if (!(packet.payload() instanceof DiscardedPayload)) {
return;
}
@@ -173,6 +179,15 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@@ -174,6 +180,15 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
try {
byte[] data = new byte[payload.readableBytes()];
payload.readBytes(data);
@ -57,10 +57,10 @@ index 289a74e35836717bd20c777e9fc8c17722e90411..a5dce1e83e63292054b21ec693ec3006
} catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 61b9dabaa74ee9e2b357316382ecbdf6c822b916..b623d3242c5166ee16cf5e334f7c04f801ac5e9d 100644
index e837939d35ee168f5640b28fae07675817492cb9..8b89959fa688f17ea9f16597cc0cc49f1d94a0ff 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3121,6 +3121,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -3134,6 +3134,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper end
};

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add playPickupItemAnimation to LivingEntity
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index a5026d470b8651ddf4b79fc29cbc598ac55217ff..aff940a7bacf53571f8e7bcd520419994596ebb3 100644
index 1544242abfbd0f9accf5fe515a95d9ac0db50d4f..7c5f873ed2962244d8a17583b26c29b7caffe5d4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -977,4 +977,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -979,4 +979,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
}
}
// Paper end - entity jump API

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Don't require FACING data
diff --git a/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java
index f25e28098df0a21fd1ae55f5527cddcef9a36b0d..f28705547a62da790f5df071400986aacba39367 100644
index c90bce6777d24821758d1830e6c6c6c72e19703f..39c96f5db6e90a470404c6387fa0c1d5531822e5 100644
--- a/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java
+++ b/src/main/java/net/minecraft/core/dispenser/DefaultDispenseItemBehavior.java
@@ -14,6 +14,7 @@ import org.bukkit.event.block.BlockDispenseEvent;
@ -14,9 +14,9 @@ index f25e28098df0a21fd1ae55f5527cddcef9a36b0d..f28705547a62da790f5df071400986aa
public class DefaultDispenseItemBehavior implements DispenseItemBehavior {
+ private Direction enumdirection; // Paper - cache facing direction
// CraftBukkit start
private boolean dropper;
@@ -27,15 +28,16 @@ public class DefaultDispenseItemBehavior implements DispenseItemBehavior {
private static final int DEFAULT_ACCURACY = 6;
@@ -29,15 +30,16 @@ public class DefaultDispenseItemBehavior implements DispenseItemBehavior {
@Override
public final ItemStack dispense(BlockSource pointer, ItemStack stack) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index df623f10def1ecf071971119f449a773063b3ce1..f079192644e3b366dc58c4a77c10cbbe65c25eca 100644
index a87782c3cb0a751f532feda0b827d7c7eac163e1..2c70df4d6ba8188ef7e1ab30b70bcfaa1a660eca 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1668,7 +1668,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1666,7 +1666,9 @@ public class ServerLevel extends Level implements WorldGenLevel {
float f1 = this.levelData.getSpawnAngle();
if (!blockposition1.equals(pos) || f1 != angle) {
@ -19,7 +19,7 @@ index df623f10def1ecf071971119f449a773063b3ce1..f079192644e3b366dc58c4a77c10cbbe
}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index 8db6209b22c838d01b0b8032ad0608713cc8a54c..a493c8d12935336bb3049aa6d00eb1a4f2194c25 100644
index 78b3e22cd720f204d11d56be3ec272d75f042e31..97ab6b50288b0d9303cbe20c5aa2af26ff3e72fb 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -269,12 +269,14 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add moon phase API
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
index 3cae8eba83fdf7f99d0c0d9dc96f4b3ebc29a4ca..f129fa38d079dc57ca2cf3b6738dd9dc0fa95991 100644
index 454f3a08c4d319f3d3fe2b1209c4d8b9fa9d4d08..1963e826548c5a8859c50f57654784c3aef50e44 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java
@@ -508,4 +508,11 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
@@ -509,4 +509,11 @@ public abstract class CraftRegionAccessor implements RegionAccessor {
throw new IllegalArgumentException("Cannot spawn an entity for " + clazz.getName());
}

View file

@ -9,7 +9,7 @@ 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/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
index b3f8df13e97cbde7dd914b42004d186f90b78646..2ca1f01ab59000949cbde1766c9811a72dbfb4ff 100644
index 0dd6f1bce4913cb84ba21a20df5573bab3a64645..5e1a68e3a920aab10a459b9b54f6abd59e7855e0 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java
@@ -86,6 +86,10 @@ public class ChunkSerializer {
@ -23,10 +23,10 @@ index b3f8df13e97cbde7dd914b42004d186f90b78646..2ca1f01ab59000949cbde1766c9811a7
public ChunkSerializer() {}
// Paper start - guard against serializing mismatching coordinates
@@ -101,6 +105,15 @@ public class ChunkSerializer {
}
@@ -102,6 +106,15 @@ public class ChunkSerializer {
// Paper end - guard against serializing mismatching coordinates
public static ProtoChunk read(ServerLevel world, PoiManager poiStorage, ChunkPos chunkPos, CompoundTag nbt) {
public static ProtoChunk read(ServerLevel world, PoiManager poiStorage, RegionStorageInfo key, ChunkPos chunkPos, CompoundTag nbt) {
+ // Paper start - Do not let the server load chunks from newer versions
+ if (nbt.contains("DataVersion", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) {
+ final int dataVersion = nbt.getInt("DataVersion");

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Prevent headless pistons from being created
Prevent headless pistons from being created by explosions or tree/mushroom growth.
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 03c25fec51562f652a8060cde4aabfe9e8bbcfe0..4107756fb31e4ad99f643184118d877aef09e9f4 100644
index 1350c8df69b4ffcf9daa73549e496627db8bc6f7..69914a048987c21ee2ed2c489aab269862fda8f2 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -206,6 +206,15 @@ public class Explosion {
@@ -207,6 +207,15 @@ public class Explosion {
if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, iblockdata, f)) {
set.add(blockposition);

View file

@ -7,10 +7,10 @@ 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/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 2006573ca4bed3c3ed02bf2f38cdd248e6b123c9..50f0ea8f6892b8a3323fb5ebf5731b8245d7788a 100644
index 5cd934897dde1fc54bfe93e8d585ff05bb9293c3..b0497ecb6d0963104ef178ede62dbc630059ad8d 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -367,10 +367,11 @@ public class CraftEventFactory {
@@ -368,10 +368,11 @@ public class CraftEventFactory {
return tradeSelectEvent;
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add zombie targets turtle egg config
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 66fa70762ba3387aa200caa4d8a4e557498cfff1..bb3c46c9faaf300f7c755c3b8316434e51d0c408 100644
index e2a3978899497b6622829d6577cfaa723092da9d..78254df3e5fbcb0a90c2f9eb9c9343792238f685 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -106,7 +106,7 @@ public class Zombie extends Monster {
@@ -110,7 +110,7 @@ public class Zombie extends Monster {
@Override
protected void registerGoals() {

View file

@ -8,10 +8,10 @@ the world per tick, this attempts to reduce the impact that join floods
has on the server
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 9885dec92cd26dec61c303dda687b0f910d49749..68d5be903a0d13e59c9e4bd6d85baaf0773547a0 100644
index 38947f40864f3661df2eb4baa0aef5740b82f9d9..134810ac91d828d67759cd1ed56f11b71e292917 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -437,12 +437,26 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -445,12 +445,26 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
}
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Fix hex colors not working in some kick messages
diff --git a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
index f9314bee1ed9b0e4c4591c0acf8a305721765850..ffe3048d16809b177d2fb495a25a16ed78b50e6b 100644
index 946b423d2184f903dc29c923d7dbe05aaa469c09..0c1bdf2329936ce479a2cc53e8a46bd2ad685ec1 100644
--- a/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerHandshakePacketListenerImpl.java
@@ -112,14 +112,16 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
@@ -113,14 +113,16 @@ public class ServerHandshakePacketListenerImpl implements ServerHandshakePacketL
}
// CraftBukkit end
if (packet.protocolVersion() != SharedConstants.getCurrentVersion().getProtocolVersion()) {
@ -26,13 +26,13 @@ index f9314bee1ed9b0e4c4591c0acf8a305721765850..ffe3048d16809b177d2fb495a25a16ed
+ Component ichatmutablecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(adventureComponent); // Paper - Fix hex colors not working in some kick messages
+
this.connection.send(new ClientboundLoginDisconnectPacket(ichatmutablecomponent));
this.connection.disconnect(ichatmutablecomponent);
this.connection.disconnect((Component) ichatmutablecomponent);
} else {
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 5bb7b0ab8a1e566f07f7f39bf072abcbe44e73d2..b968026728b8b4e549eed9fa9b43919c6c19eb7a 100644
index 53b1fd2d1328bde3fe195964ce39ff5c0f5a7c05..baedae23865ea80c6546d1f6f439e1d7712258b9 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -126,7 +126,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
@@ -128,7 +128,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
// CraftBukkit start
@Deprecated
public void disconnect(String s) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] PortalCreateEvent needs to know its entity
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index b5f1d223a3955e1b478712c581080904f86a2a2a..e5fbb6dac3b1869797f2141e82993374a9f18e94 100644
index cc8825acea0d84b36194313656a6f70d8c049072..7f7445a2b68fd2e6e5fcd509d950a0f8d680c1fe 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -501,7 +501,7 @@ public final class ItemStack implements DataComponentHolder {
@@ -522,7 +522,7 @@ public final class ItemStack implements DataComponentHolder {
net.minecraft.world.level.block.state.BlockState block = world.getBlockState(newblockposition);
if (!(block.getBlock() instanceof BaseEntityBlock)) { // Containers get placed automatically
@ -18,7 +18,7 @@ index b5f1d223a3955e1b478712c581080904f86a2a2a..e5fbb6dac3b1869797f2141e82993374
world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getBlockState(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/BaseFireBlock.java b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
index 233236733537e036d3a37a3102f3ca6b887d076f..83f48d543eac94276ee4d7f7a4c21abdfa8eb8e6 100644
index e499a5eb843af3e2417bcb31add3c63443c0deff..993538f613e52ecd009f01e7b68fddba76b6a3e8 100644
--- a/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BaseFireBlock.java
@@ -144,12 +144,19 @@ public abstract class BaseFireBlock extends Block {
@ -60,10 +60,10 @@ index ceaa2a7048afc4955d3695af5291e83a79d83c5d..5dad1aa26a8908cba6a08398a4bad27f
}
diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
index 3e76f1baa321f1c2551a027a705bbeed48936e2b..24c2ec8e637373876a00bf292ac9318f79da7aef 100644
index d02f7a547dbe8943f82c07103b1fff203e4533c2..335f43e49d31acecfec8b6da9be9afe88cd95ca9 100644
--- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -155,6 +155,12 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -154,6 +154,12 @@ public abstract class BlockBehaviour implements FeatureElement {
DebugPackets.sendNeighborsUpdatePacket(world, pos);
}
@ -76,7 +76,7 @@ index 3e76f1baa321f1c2551a027a705bbeed48936e2b..24c2ec8e637373876a00bf292ac9318f
protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
org.spigotmc.AsyncCatcher.catchOp("block onPlace"); // Spigot
}
@@ -1080,6 +1086,12 @@ public abstract class BlockBehaviour implements FeatureElement {
@@ -1086,6 +1092,12 @@ public abstract class BlockBehaviour implements FeatureElement {
this.getBlock().updateIndirectNeighbourShapes(this.asState(), world, pos, flags, maxUpdateDepth);
}
@ -90,10 +90,10 @@ index 3e76f1baa321f1c2551a027a705bbeed48936e2b..24c2ec8e637373876a00bf292ac9318f
this.getBlock().onPlace(this.asState(), world, pos, state, notify);
}
diff --git a/src/main/java/net/minecraft/world/level/portal/PortalShape.java b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
index 766884046e2c22da4cb99712ff09d1f439394523..af24467ee37cfc06f692b3b02e68f6cfbaaa8d59 100644
index bb22b12b05de29bed00e433630c91f233fa9a366..57139a0b8adcd1ea25cd100be78402681856ee75 100644
--- a/src/main/java/net/minecraft/world/level/portal/PortalShape.java
+++ b/src/main/java/net/minecraft/world/level/portal/PortalShape.java
@@ -190,7 +190,14 @@ public class PortalShape {
@@ -189,7 +189,14 @@ public class PortalShape {
}
// CraftBukkit start - return boolean
@ -108,7 +108,7 @@ index 766884046e2c22da4cb99712ff09d1f439394523..af24467ee37cfc06f692b3b02e68f6cf
org.bukkit.World bworld = this.level.getMinecraftWorld().getWorld();
// Copy below for loop
@@ -200,7 +207,7 @@ public class PortalShape {
@@ -199,7 +206,7 @@ public class PortalShape {
this.blocks.setBlock(blockposition, iblockdata, 18);
});

View file

@ -42,10 +42,10 @@ index f6ffb81b68e0cf3afebe901a5ba8e305bb94b77a..f2f62667ddf082796011ad7dd025e885
+ // Paper end - add Translatable
}
diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
index 5ed90ed0461165da02c7a1acae805c12466e38d6..faf0f726453aa957d17b75dfd8de5b40d984e69c 100644
index 97a7dc31fe7a2defed2202ccc518c66b7ff4b0da..3ea6e6678432957c5caaff15ba20f8a8ddb393c9 100644
--- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
+++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java
@@ -168,6 +168,11 @@ public class CraftEnchantment extends Enchantment implements Handleable<net.mine
@@ -171,6 +171,11 @@ public class CraftEnchantment extends Enchantment implements Handleable<net.mine
public net.kyori.adventure.text.Component displayName(int level) {
return io.papermc.paper.adventure.PaperAdventure.asAdventure(getHandle().getFullname(level));
}
@ -58,10 +58,10 @@ index 5ed90ed0461165da02c7a1acae805c12466e38d6..faf0f726453aa957d17b75dfd8de5b40
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
index 8d484ba6ed0f7917cf281ff67b1f2b0c2c5c81d8..1218163a4d803288aeb1c9254f8cd03013a9fbcc 100644
index fc522ae106d1172172c496da543b8ca403e73456..761d943658de9c7faadf24584baf63057e99d04a 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java
@@ -238,4 +238,11 @@ public class CraftItemType<M extends ItemMeta> implements ItemType.Typed<M>, Han
@@ -237,4 +237,11 @@ public class CraftItemType<M extends ItemMeta> implements ItemType.Typed<M>, Han
public Material asMaterial() {
return Registry.MATERIAL.get(this.key);
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Create HoverEvent from ItemStack Entity
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
index fa4de12ba4fdce7a632923af8007e888141904c8..7c32802947fd5318009a02724c85206b250e7143 100644
index d1a214e8d8fd7fd774a9629d5ca2d9f7a14de0e7..a96a09bb39fc35f3c4dfcd0da0ce1fe283b8377e 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java
@@ -539,4 +539,44 @@ public final class CraftItemFactory implements ItemFactory {
@@ -550,4 +550,44 @@ public final class CraftItemFactory implements ItemFactory {
return nms != null ? net.minecraft.locale.Language.getInstance().getOrDefault(nms.getItem().getDescriptionId(nms)) : null;
}
// Paper end - add getI18NDisplayName

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Cache block data strings
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index f5a2645afc64f3ba9ee21e6442697d6eb2fabb13..8e88345ad3514380cd88e38e81d6359324afd569 100644
index 1d141c9ee7b8193d46ba47a8586fc334cabb62a1..eddb8792be0581d8f1c87d18b5ab7a02571addc7 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2125,6 +2125,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2153,6 +2153,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.getPlayerList().reloadResources();
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager);

View file

@ -9,10 +9,10 @@ as this is how Vanilla teleports entities.
Cancel any pending motion when teleported.
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index bc9c68c4df11ece9a9cba9b8cff1182c1d21551f..5d8b1fb9ee96ca397b8f3a0629bc4273ee21f41c 100644
index 3387622f107a46efa7fda14d5994f192c6854dc2..25b82b15d67f1c37d6897aaeefa00ee2852d0865 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -676,7 +676,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -679,7 +679,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
return;
}
@ -21,20 +21,20 @@ index bc9c68c4df11ece9a9cba9b8cff1182c1d21551f..5d8b1fb9ee96ca397b8f3a0629bc4273
this.lastGoodX = this.awaitingPositionFromClient.x;
this.lastGoodY = this.awaitingPositionFromClient.y;
this.lastGoodZ = this.awaitingPositionFromClient.z;
@@ -1583,7 +1583,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1595,7 +1595,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// CraftBukkit end
this.awaitingTeleportTime = this.tickCount;
this.player.resetCurrentImpulseContext();
- this.player.absMoveTo(d0, d1, d2, f, f1);
+ this.player.moveTo(d0, d1, d2, f, f1); // Paper - Fix Entity Teleportation and cancel velocity if teleported
this.player.connection.send(new ClientboundPlayerPositionPacket(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport));
}
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 084824335dc4c83d331cac2da8fdd5604d650b5d..f66c382a1365f559c833cbfd70f8b6db34e8133a 100644
index f2855de7320dc9532d0b568b84b0b7e5a2064045..1e65bfa3d2f3a178803c530e1610c94065ed6110 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -165,6 +165,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -171,6 +171,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
// CraftBukkit start
private static final int CURRENT_LEVEL = 2;
@ -42,7 +42,7 @@ index 084824335dc4c83d331cac2da8fdd5604d650b5d..f66c382a1365f559c833cbfd70f8b6db
static boolean isLevelAtLeast(CompoundTag tag, int level) {
return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level;
}
@@ -1808,6 +1809,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -1874,6 +1875,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public void moveTo(double x, double y, double z, float yaw, float pitch) {
@ -69,10 +69,10 @@ index b90127f9f805fdb5bb43a4b8ad2b10499b0b6b78..8efc06d29c62fa2be8515ed3359d52a6
if (entity instanceof Mob) {
Mob entityinsentient = (Mob) entity;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 40e4b8233e27b8ebd94a89bb43b5c14808edaa68..3da47cf8968c1917e2f216a410eece51a693dfb2 100644
index 34321f095e12ea0cca34ff1ec00819c6350205a8..5f5788a502642463091fb76e98703aaec7a86836 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -238,7 +238,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -240,7 +240,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
}
// entity.setLocation() throws no event, and so cannot be cancelled

View file

@ -30,12 +30,12 @@ This patch will significantly reduce CPU use on startup, reduce memory usage,
and improve server startup time.
diff --git a/src/main/java/com/mojang/datafixers/DataFixerBuilder.java b/src/main/java/com/mojang/datafixers/DataFixerBuilder.java
index cd812f3fe362de5ddc414862dedab2e9727ca776..2bc69e84b4e2ba8f816322d649e42570ab9242e5 100644
index 4232ce05ad7dd122a78a04ccef3b59d4caf542df..2cce259c738de2680e219d30dc3020458f4442d6 100644
--- a/src/main/java/com/mojang/datafixers/DataFixerBuilder.java
+++ b/src/main/java/com/mojang/datafixers/DataFixerBuilder.java
@@ -30,8 +30,10 @@ public class DataFixerBuilder {
@@ -29,8 +29,10 @@ public class DataFixerBuilder {
private final Int2ObjectSortedMap<Schema> schemas = new Int2ObjectAVLTreeMap<>();
private final List<DataFix> globalList = Lists.newArrayList();
private final List<DataFix> globalList = new ArrayList<>();
private final IntSortedSet fixerVersions = new IntAVLTreeSet();
+ private final int minDataFixPrecacheVersion; // Paper - Perf: Cache DataFixerUpper Rewrite Rules on demand
@ -44,8 +44,8 @@ index cd812f3fe362de5ddc414862dedab2e9727ca776..2bc69e84b4e2ba8f816322d649e42570
this.dataVersion = dataVersion;
}
@@ -78,6 +80,7 @@ public class DataFixerBuilder {
final IntBidirectionalIterator iterator = fixerUpper.fixerVersions().iterator();
@@ -88,6 +90,7 @@ public class DataFixerBuilder {
final IntIterator iterator = fixerUpper.fixerVersions().iterator();
while (iterator.hasNext()) {
final int versionKey = iterator.nextInt();
+ if (versionKey < minDataFixPrecacheVersion) continue; // Paper - Perf: Cache DataFixerUpper Rewrite Rules on demand

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Extend block drop capture to capture all items added to the
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index f079192644e3b366dc58c4a77c10cbbe65c25eca..17985c75deaa8d317ea4019f73eafe118d347f41 100644
index 2c70df4d6ba8188ef7e1ab30b70bcfaa1a660eca..c9dad47ef14e0a021685fab710c920419611d151 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1230,6 +1230,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1228,6 +1228,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
// WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getKey(entity.getType())); // CraftBukkit
return false;
} else {
@ -23,10 +23,10 @@ index f079192644e3b366dc58c4a77c10cbbe65c25eca..17985c75deaa8d317ea4019f73eafe11
if (spawnReason != null && !CraftEventFactory.doEntityAddEventCalling(this, entity, spawnReason)) {
return false;
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
index 84c31fe944fc39109d48b6dc68d0c2b15bef6cf2..de3ec353ea32d5d71e2f1b4b369b79b85d7ce5e8 100644
index d4bd44210d58b30696feeea48e1909472a546702..5de472df78940d1b8320f73d18b2edf3a796227e 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayerGameMode.java
@@ -432,10 +432,12 @@ public class ServerPlayerGameMode {
@@ -437,10 +437,12 @@ public class ServerPlayerGameMode {
// return true; // CraftBukkit
}
// CraftBukkit start

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f66c382a1365f559c833cbfd70f8b6db34e8133a..90a4eaeccedc588ac7131757421e5230e1c43e4a 100644
index 1e65bfa3d2f3a178803c530e1610c94065ed6110..70952ec99d049c3b133629e41eeb1d725ffb5917 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4444,4 +4444,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4510,4 +4510,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
void accept(Entity entity, double x, double y, double z);
}
@ -21,7 +21,7 @@ index f66c382a1365f559c833cbfd70f8b6db34e8133a..90a4eaeccedc588ac7131757421e5230
+ // Paper end - Expose entity id counter
}
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index 3fc189cd1e54f91c1713315214da9b6af2923074..b4df6f9b25da2b772b099e8cb46a50c3d006734f 100644
index 890beb473c240c084c4dd12c5dd792895117358e..5eeb2a46cb093d21ce7276373a838041be7a47b3 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -530,6 +530,11 @@ public final class CraftMagicNumbers implements UnsafeValues {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Entity#isTicking
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 90a4eaeccedc588ac7131757421e5230e1c43e4a..4187fc3722b7e27ccf4fcb2617c00c3af8241f9f 100644
index 70952ec99d049c3b133629e41eeb1d725ffb5917..fef25470049fb0ac6f741920c057814ea437cd07 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4449,5 +4449,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4515,5 +4515,9 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public static int nextEntityId() {
return ENTITY_COUNTER.incrementAndGet();
}
@ -19,10 +19,10 @@ index 90a4eaeccedc588ac7131757421e5230e1c43e4a..4187fc3722b7e27ccf4fcb2617c00c3a
// Paper end - Expose entity id counter
}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 3da47cf8968c1917e2f216a410eece51a693dfb2..2080733ebae1af51b7b4d3cd2fbd1a4a2703a920 100644
index 5f5788a502642463091fb76e98703aaec7a86836..98e8ad81b8c9c0636abe59f70ce891fe926a37fe 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1045,4 +1045,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -1062,4 +1062,11 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return getHandle().isInLava();
}
// Paper end - entity liquid API

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Fix deop kicking non-whitelisted player when white list is
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8e88345ad3514380cd88e38e81d6359324afd569..595ce35e5a51811c12a02c3c845de44ba03d1a38 100644
index eddb8792be0581d8f1c87d18b5ab7a02571addc7..b47110e9b5d8effdc9e768488f99a614c1070814 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2250,13 +2250,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2278,13 +2278,14 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
if (this.isEnforceWhitelist()) {
PlayerList playerlist = source.getServer().getPlayerList();
UserWhiteList whitelist = playerlist.getWhiteList();
@ -22,6 +22,6 @@ index 8e88345ad3514380cd88e38e81d6359324afd569..595ce35e5a51811c12a02c3c845de44b
- if (!whitelist.isWhiteListed(entityplayer.getGameProfile())) {
+ if (!whitelist.isWhiteListed(entityplayer.getGameProfile()) && !this.getPlayerList().isOp(entityplayer.getGameProfile())) { // Paper - Fix kicking ops when whitelist is reloaded (MC-171420)
entityplayer.connection.disconnect(Component.translatable("multiplayer.disconnect.not_whitelisted"));
entityplayer.connection.disconnect((Component) Component.translatable("multiplayer.disconnect.not_whitelisted"));
}
}

View file

@ -6,7 +6,7 @@ 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/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 5d8b1fb9ee96ca397b8f3a0629bc4273ee21f41c..a1f17d1044d6ecb05c98af45e77f92229e377114 100644
index 25b82b15d67f1c37d6897aaeefa00ee2852d0865..2e71e9fa378d6ffe641aa691a1e65f8a9063a875 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -492,9 +492,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -53,7 +53,7 @@ index 5d8b1fb9ee96ca397b8f3a0629bc4273ee21f41c..a1f17d1044d6ecb05c98af45e77f9222
boolean flag1 = entity.verticalCollisionBelow;
if (entity instanceof LivingEntity) {
@@ -1259,7 +1268,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1254,7 +1263,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
double d7 = d1 - this.firstGoodY;
double d8 = d2 - this.firstGoodZ;
double d9 = this.player.getDeltaMovement().lengthSqr();
@ -71,7 +71,7 @@ index 5d8b1fb9ee96ca397b8f3a0629bc4273ee21f41c..a1f17d1044d6ecb05c98af45e77f9222
if (this.player.isSleeping()) {
if (d10 > 1.0D) {
@@ -1315,9 +1333,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1310,9 +1328,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
AABB axisalignedbb = this.player.getBoundingBox();

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Villager#resetOffers
diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
index 521c9602db7c532470adcd5f024d3dd0f1e88780..79e81fd5490a493b595dc1034641e13451e5a61a 100644
index 5ee34073e4bd5a4765d7954b6620c0d05d8c7bc9..80fe2e3e5b97e9b6af98b73f19f8c2f5fca279fe 100644
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
@@ -116,6 +116,13 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
@ -21,7 +21,7 @@ index 521c9602db7c532470adcd5f024d3dd0f1e88780..79e81fd5490a493b595dc1034641e134
+
@Override
public MerchantOffers getOffers() {
if (this.offers == null) {
if (this.level().isClientSide) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java
index 19833c1fc6ee85e031e3c6aac3b00f44730c5e02..34e4c763c7ec971885147ab2509281fad56e1ca6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java

View file

@ -10,10 +10,10 @@ 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/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 895c263570acf0f8ac2e8d680a6187bc189a205e..88b09635590958b4edf992490dd30616c35d4d6d 100644
index 5a3a89c568d42a2adbc2b6e2631fd4b70e54f0bf..cfd5d3e50197b38d0ffef6debbb7f5b4b208382a 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -151,7 +151,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -152,7 +152,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public boolean captureBlockStates = false;
public boolean captureTreeGeneration = false;
public Map<BlockPos, org.bukkit.craftbukkit.block.CraftBlockState> capturedBlockStates = new java.util.LinkedHashMap<>(); // Paper

View file

@ -7,10 +7,10 @@ Fixes #4259 by not flooring the blockposition among other weirdness
Vanilla Issue: MC-267622
diff --git a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
index 0de294a2aec50a39d6dbc56b6a61b01b1e538828..66fbad74c2ec2f853ec6c74482c6cae1c1746007 100644
index 391acc9dadc653e9e1285a71b4f1e7c063e8ca49..80f911692c97585a696a19ebbe616d6aa312b2d9 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/CampfireBlockEntity.java
@@ -87,7 +87,14 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
@@ -86,7 +86,14 @@ public class CampfireBlockEntity extends BlockEntity implements Clearable {
result = blockCookEvent.getResult();
itemstack1 = CraftItemStack.asNMSCopy(result);
// CraftBukkit end

View file

@ -8,10 +8,10 @@ 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/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
index c3a035742271611f2d26cf4af0d5877369dd6558..7d557c7ec6fb1763395f4920a170bd4e4ba6747f 100644
index 0b4c67b9de6893601f032a8fae103e8a98f2c767..5b7734020b496ade3740d92908ad2d399bfd55e6 100644
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
@@ -505,9 +505,15 @@ public class FishingHook extends Projectile {
@@ -506,9 +506,15 @@ public class FishingHook extends Projectile {
while (iterator.hasNext()) {
ItemStack itemstack1 = (ItemStack) iterator.next();
@ -29,7 +29,7 @@ index c3a035742271611f2d26cf4af0d5877369dd6558..7d557c7ec6fb1763395f4920a170bd4e
playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1);
this.level().getCraftServer().getPluginManager().callEvent(playerFishEvent);
@@ -520,8 +526,12 @@ public class FishingHook extends Projectile {
@@ -521,8 +527,12 @@ public class FishingHook extends Projectile {
double d2 = entityhuman.getZ() - this.getZ();
double d3 = 0.1D;

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add getOfflinePlayerIfCached(String)
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index f5079f1bb3f66392e663cac495f555edb6a08a09..aee62eef2a67be2ca0d1c19143cc7f42e5e32390 100644
index 010ab9cdf3dbe9b89b58744f37b33a232167f445..92e0f1a948962d4c71f1288dfb8b482d3207cf4c 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1952,6 +1952,28 @@ public final class CraftServer implements Server {
@@ -1955,6 +1955,28 @@ public final class CraftServer implements Server {
return result;
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add ignore discounts API
diff --git a/src/main/java/net/minecraft/world/entity/npc/Villager.java b/src/main/java/net/minecraft/world/entity/npc/Villager.java
index 4d7f95d2bd415bacccee145bfc47f2b480530c11..4d3a04e1d7910c4e71ac9a1cebb58e482958671a 100644
index e23674dd5db3c429efd3b7c71fe36b420494c03a..9d5a5a7fff7f75871e167f83edb0e9d5348748d7 100644
--- a/src/main/java/net/minecraft/world/entity/npc/Villager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/Villager.java
@@ -491,6 +491,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -493,6 +493,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
while (iterator.hasNext()) {
MerchantOffer merchantrecipe = (MerchantOffer) iterator.next();
@ -16,7 +16,7 @@ index 4d7f95d2bd415bacccee145bfc47f2b480530c11..4d3a04e1d7910c4e71ac9a1cebb58e48
merchantrecipe.addToSpecialPriceDiff(-Mth.floor((float) i * merchantrecipe.getPriceMultiplier()));
}
@@ -503,6 +504,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
@@ -505,6 +506,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler
while (iterator1.hasNext()) {
MerchantOffer merchantrecipe1 = (MerchantOffer) iterator1.next();

View file

@ -15,7 +15,7 @@ manually reload the advancement data for all players, which
normally takes place as a part of the datapack reloading.
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
index b4df6f9b25da2b772b099e8cb46a50c3d006734f..176557c1910eff297cfedc11ae95f0f03c73812d 100644
index 5eeb2a46cb093d21ce7276373a838041be7a47b3..50322927460ec9464363617e3f7fe5ff8faa1f6f 100644
--- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java
@@ -337,7 +337,13 @@ public final class CraftMagicNumbers implements UnsafeValues {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Beacon API - custom effect ranges
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
index cf48d4531821c2b1b031a63c8f007aa7d3fbef1d..dc39e7e3d166b0f7fb09e04b222b8db00d42b11b 100644
index fc915797d2a085447747d9ce23a5a354fb3eb6b6..52776ce9b7b4edd1eb474f14705d7fd83f5a66ca 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java
@@ -86,6 +86,26 @@ public class BeaconBlockEntity extends BlockEntity implements MenuProvider, Name

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add API for quit reason
diff --git a/src/main/java/net/minecraft/network/Connection.java b/src/main/java/net/minecraft/network/Connection.java
index 68d5be903a0d13e59c9e4bd6d85baaf0773547a0..fe89e8f509f3972ceb71c9aa6277524baa39985b 100644
index 134810ac91d828d67759cd1ed56f11b71e292917..ba41646a5edb57c4d9766df08bbc57016e2de189 100644
--- a/src/main/java/net/minecraft/network/Connection.java
+++ b/src/main/java/net/minecraft/network/Connection.java
@@ -167,12 +167,15 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
@@ -167,8 +167,10 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
this.handlingFault = true;
if (this.channel.isOpen()) {
@ -16,19 +16,22 @@ index 68d5be903a0d13e59c9e4bd6d85baaf0773547a0..fe89e8f509f3972ceb71c9aa6277524b
if (throwable instanceof TimeoutException) {
Connection.LOGGER.debug("Timeout", throwable);
+ if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.TIMED_OUT; // Paper - Add API for quit reason
this.disconnect(Component.translatable("disconnect.timeout"));
this.disconnect((Component) Component.translatable("disconnect.timeout"));
} else {
MutableComponent ichatmutablecomponent = Component.translatable("disconnect.genericReason", "Internal Exception: " + String.valueOf(throwable));
@@ -181,6 +183,7 @@ public class Connection extends SimpleChannelInboundHandler<Packet<?>> {
disconnectiondetails = new DisconnectionDetails(ichatmutablecomponent);
}
+ if (player != null) player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.ERRONEOUS_STATE; // Paper - Add API for quit reason
if (flag) {
Connection.LOGGER.debug("Failed to sent packet", throwable);
if (this.getSending() == PacketFlow.CLIENTBOUND) {
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index ffd9ff7db5180cb351839a3ce331353d16b662d2..d262946f729a5621f311e266b6b316d445b9e02a 100644
index 45d36070735cd7a8baee585165a95a169d7059b4..2c24de44e48a1c55b81e2ecfb92c57e42546cc41 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -291,6 +291,7 @@ public class ServerPlayer extends Player {
@@ -295,6 +295,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player {
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
public @Nullable String clientBrandName = null; // Paper - Brand support
@ -37,22 +40,22 @@ index ffd9ff7db5180cb351839a3ce331353d16b662d2..d262946f729a5621f311e266b6b316d4
public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) {
super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile);
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index a5dce1e83e63292054b21ec693ec3006e08d3ff2..661765a9fe1c2e49299262190501ee3b3294a2f1 100644
index 4761a8d8f342c649bc2e5f530819fa88f43542ec..125a80951f6e4d19c6aa61e104339242de7a4b00 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -371,6 +371,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
// CraftBukkit end
private void disconnect0(DisconnectionDetails disconnectiondetails) {
// CraftBukkit end
+ this.player.quitReason = org.bukkit.event.player.PlayerQuitEvent.QuitReason.KICKED; // Paper - Add API for quit reason
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> {
this.connection.disconnect(ichatbasecomponent);
this.connection.send(new ClientboundDisconnectPacket(disconnectiondetails.reason()), PacketSendListener.thenRun(() -> {
this.connection.disconnect(disconnectiondetails);
}));
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 97a3f29414cd9f11e6a790cb30f7ef25a836b06c..8b0b9ef372c595340c43c5882ad71587833d86bc 100644
index fa35bc76575a3ffe6435ff24db0c7ad78b53e309..858bbd4add280f0cd04aa94fb0b2f8f9423299cf 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -576,7 +576,7 @@ public abstract class PlayerList {
@@ -570,7 +570,7 @@ public abstract class PlayerList {
entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper - Inventory close reason
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Fix Player spawnParticle x/y/z precision loss
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b623d3242c5166ee16cf5e334f7c04f801ac5e9d..37d6be0ae176569971659b4a83895f386eeef863 100644
index 8b89959fa688f17ea9f16597cc0cc49f1d94a0ff..721f4fb6bc18fc3ca6a22e8a42f564220042fa42 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2689,7 +2689,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -2702,7 +2702,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double extra, T data, boolean force) {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add LivingEntity#clearActiveItem
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index aff940a7bacf53571f8e7bcd520419994596ebb3..7158f88e90c624b7ed3345ad7fb47745d4491d88 100644
index 7c5f873ed2962244d8a17583b26c29b7caffe5d4..671fb1d1bffd7cdffcb56193e0b4f08a0eda0682 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -934,6 +934,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -936,6 +936,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return this.getHandle().getUseItem().asBukkitMirror();
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Climbing should not bypass cramming gamerule
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 4187fc3722b7e27ccf4fcb2617c00c3af8241f9f..f7964a9ef04d35b5bf46ff18071ef22f53b9a3b5 100644
index fef25470049fb0ac6f741920c057814ea437cd07..7e4fe51b276df05f41c5603140ed198b7aef9585 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2010,6 +2010,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -2081,6 +2081,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
public boolean isPushable() {
@ -44,10 +44,10 @@ index ee4495b67c46cf1282cdd6ad15b224b0b7b10bfb..e382a29b441b656f35bc24cb90f95cb4
} else if (entity.level().isClientSide && (!(entity1 instanceof Player) || !((Player) entity1).isLocalPlayer())) {
return false;
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index dd5a32360f4b49e9544009d3874da3f4af7b386a..e2cd1097756832a2bb60cdd73fdd05d1c64e38d0 100644
index a85321f1dc8b0bc4338bf5f23c5686c0ca733cec..f26f7760a2452af9b59c1b64d27700f56b32af97 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3524,7 +3524,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3544,7 +3544,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
return;
}
// Paper end - don't run getEntities if we're not going to use its result
@ -56,7 +56,7 @@ index dd5a32360f4b49e9544009d3874da3f4af7b386a..e2cd1097756832a2bb60cdd73fdd05d1
if (!list.isEmpty()) {
// Paper - don't run getEntities if we're not going to use its result; moved up
@@ -3714,9 +3714,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3736,9 +3736,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
return !this.isRemoved() && this.collides; // CraftBukkit
}
@ -88,10 +88,10 @@ index 934fa26b8f347b8b2d90f79370b62165c0cdc312..dc27ddf5131e7398a5390a5187261d4c
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Parrot.java b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
index 1a129f43dc737218746b21ae5d03e3749bfee092..5ca96541abbb754f4d9fbe01f37ebaf19c532bbb 100644
index 12b2267cba476547d510d9161b25a28f4f5c798e..97931bfd360725945ab9606ff698b518ae101076 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Parrot.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Parrot.java
@@ -367,8 +367,8 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot
@@ -362,8 +362,8 @@ public class Parrot extends ShoulderRidingEntity implements VariantHolder<Parrot
}
@Override
@ -103,10 +103,10 @@ index 1a129f43dc737218746b21ae5d03e3749bfee092..5ca96541abbb754f4d9fbe01f37ebaf1
@Override
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
index bff2627aa0c2cc48020e65c71a5862ab6e995f99..d53ef42e64d87790ea86d806153f047005accb9f 100644
index 45ba002e23258ef734012ae81b2c4c9e92d863fb..affa2e133611b7a045a99bac801398263d114ba7 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -353,7 +353,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
@@ -356,7 +356,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
}
@Override
@ -116,10 +116,10 @@ index bff2627aa0c2cc48020e65c71a5862ab6e995f99..d53ef42e64d87790ea86d806153f0470
}
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index e1f6853c450a2e6a0d7607f1faec7bc5c82d9621..767f076c6fad7a1146bc409bf47f1d2fc3caf3ce 100644
index cc1189c2d7dc57ba8f29aad4ba5d2a07362bcd5b..5bcb9a53ebebeef4bd6ec2458df4b63002ebd804 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -350,7 +350,7 @@ public class ArmorStand extends LivingEntity {
@@ -349,7 +349,7 @@ public class ArmorStand extends LivingEntity {
}
@Override
@ -129,7 +129,7 @@ index e1f6853c450a2e6a0d7607f1faec7bc5c82d9621..767f076c6fad7a1146bc409bf47f1d2f
}
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
index 2c97c8ee6dccb7f517e5edcd0c5d9620a3433f1e..1aecb6cc62b4b411ab0ff3b7fb11a5d9d050b959 100644
index 41590a758ae29e35e2d1fd410662888d4cd3fe36..119d6f4ec8ca6867f75f9fd2f1dc46962f16afee 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractMinecart.java
@@ -169,7 +169,7 @@ public abstract class AbstractMinecart extends VehicleEntity {
@ -142,10 +142,10 @@ index 2c97c8ee6dccb7f517e5edcd0c5d9620a3433f1e..1aecb6cc62b4b411ab0ff3b7fb11a5d9
}
diff --git a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
index 164468371e9a52ef96a183fdbcfe097d2fc24b56..d1eaadba8ce1f472a174afcfe8e0d059a121612c 100644
index 26dd7c9f48f15f66a326901259ee89f4ab911526..2cb535639bff0e867c1b1e845fee6e34bb237044 100644
--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
+++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java
@@ -150,7 +150,7 @@ public class Boat extends VehicleEntity implements VariantHolder<Boat.Type> {
@@ -154,7 +154,7 @@ public class Boat extends VehicleEntity implements Leashable, VariantHolder<Boat
}
@Override

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerShearBlockEvent
diff --git a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
index ce108f1cea8027aa7aab444689f7a29f2e54cc20..ef804067ee05870e9331237b44ca1ffeb8df99c7 100644
index c4b9c574bfb034fc78a596367f0f41dbde5eb93d..8d6736003934c5958f600660bdee58b386c39da4 100644
--- a/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BeehiveBlock.java
@@ -127,7 +127,7 @@ public class BeehiveBlock extends BaseEntityBlock {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Limit recipe packets
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index a1f17d1044d6ecb05c98af45e77f92229e377114..35c8aa3971de05be66acd49b6a0b76cba59f93ac 100644
index 2e71e9fa378d6ffe641aa691a1e65f8a9063a875..9029bc0df227a1dbfab0ab337efa4087d57e7f08 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -266,6 +266,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@ -24,7 +24,7 @@ index a1f17d1044d6ecb05c98af45e77f92229e377114..35c8aa3971de05be66acd49b6a0b76cb
/* Use thread-safe field access instead
if (this.chatSpamTickCount > 0) {
--this.chatSpamTickCount;
@@ -3053,6 +3055,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3070,6 +3072,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Player Chunk Load/Unload Events
diff --git a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
index 3548be0bfacc7ff2cf0ed5fac4d8de09bd2a415f..c502d9b85eb68b277ae17dfea34e0475f0156647 100644
index 7c4b795b8a0f58dd07bc5acb1e309476bf4cbe90..cdd66e6ce96e2613afe7f06ca8da3cfaa6704b2d 100644
--- a/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
+++ b/src/main/java/net/minecraft/server/network/PlayerChunkSender.java
@@ -44,6 +44,11 @@ public class PlayerChunkSender {

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Expose LivingEntity hurt direction
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
index 37190eb2d7a8f81989908f58aa13de1ba964e43a..389da4ed8d166f840e881579db51058f44e9ee24 100644
index 1d8aa3b3c3deba7d04dd115d1f0b70b078111f1e..5abd72b1a80967bd2502537978d8f5456075f357 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -187,7 +187,7 @@ public abstract class Player extends LivingEntity {
@ -36,10 +36,10 @@ index 9393e9d21fcc41cb0f20b98d9f28c95b0e523f62..796945fb1a8b43987ed9f01375113b2c
public int getSleepTicks() {
return this.getHandle().sleepCounter;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index 7158f88e90c624b7ed3345ad7fb47745d4491d88..b88077ac1ed99057b8a9361ea550cd2b00040f88 100644
index 671fb1d1bffd7cdffcb56193e0b4f08a0eda0682..aad17b34fedd7030939f3b834b313b7f79b69ce1 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -991,4 +991,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@@ -993,4 +993,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
this.getHandle().take(((CraftItem) item).getHandle(), quantity);
}
// Paper end - pickup animation API

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add OBSTRUCTED reason to BedEnterResult
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 50f0ea8f6892b8a3323fb5ebf5731b8245d7788a..962f4d7453433392331cd68d207cb1c6c1c8fd67 100644
index b0497ecb6d0963104ef178ede62dbc630059ad8d..7d99c696bec2ea338612d1376e2d24a952b74791 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -302,6 +302,10 @@ public class CraftEventFactory {
@@ -303,6 +303,10 @@ public class CraftEventFactory {
return BedEnterResult.TOO_FAR_AWAY;
case NOT_SAFE:
return BedEnterResult.NOT_SAFE;

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Fix crash from invalid ingredient lists in
diff --git a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
index 79e81fd5490a493b595dc1034641e13451e5a61a..6e29b5729b8184d13065c9c4e18f6e450c9d88a6 100644
index 80fe2e3e5b97e9b6af98b73f19f8c2f5fca279fe..6139361c0e733f981506abdd7101e5ca20eeb88f 100644
--- a/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
+++ b/src/main/java/net/minecraft/world/entity/npc/AbstractVillager.java
@@ -269,7 +269,11 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
@@ -275,7 +275,11 @@ public abstract class AbstractVillager extends AgeableMob implements InventoryCa
Bukkit.getPluginManager().callEvent(event);
}
if (!event.isCancelled()) {

View file

@ -9,7 +9,7 @@ loss, which forces the server to lose the same precision as the client
keeping them in sync.
diff --git a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java
index ffec3deb9bcd31d51974c1deda2e76bc8374e5c5..a3d247c93ac1a2d872ff0e3841efc3d7b84fcbc1 100644
index 488ebd443903af812913437f1ade3002093f2470..a043ac10834562d357ef0b5aded2e916e2a0d056 100644
--- a/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java
+++ b/src/main/java/net/minecraft/network/protocol/game/VecDeltaCodec.java
@@ -9,12 +9,12 @@ public class VecDeltaCodec {
@ -28,10 +28,10 @@ index ffec3deb9bcd31d51974c1deda2e76bc8374e5c5..a3d247c93ac1a2d872ff0e3841efc3d7
public Vec3 decode(long x, long y, long z) {
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index f7964a9ef04d35b5bf46ff18071ef22f53b9a3b5..cac4c1bd5d4ee89e4366b7e11fbf01903e953ed9 100644
index 7e4fe51b276df05f41c5603140ed198b7aef9585..b5f45ce710ea9bf1e37c4fd71b75d0e2d537cf45 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -4217,6 +4217,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@@ -4262,6 +4262,16 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return;
}
// Paper end - Block invalid positions and bounding box

View file

@ -8,7 +8,7 @@ Before this patch, instant effects would be applied before the potion ItemStack
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/world/item/PotionItem.java b/src/main/java/net/minecraft/world/item/PotionItem.java
index de0b68b128e6ffbd31aebb4361e4859d495f89b5..042a9cf9c15fd30bc30e03d0e0311c70e40e6950 100644
index 017b0745753ea1907bad7022405db9a5a487d069..92fa6523f2bba105a74fff228e36e58666ed56ae 100644
--- a/src/main/java/net/minecraft/world/item/PotionItem.java
+++ b/src/main/java/net/minecraft/world/item/PotionItem.java
@@ -55,12 +55,13 @@ public class PotionItem extends Item {

View file

@ -12,7 +12,7 @@ requesting the world.
Track spigot issue to see when fixed: https://hub.spigotmc.org/jira/browse/SPIGOT-6181
diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
index d42d39dff5aeb91c5b1e6a7fb967ce70f1a88b7e..38c0855a6f9398f8d075f304288cf9e9f695770a 100644
index 5e469bd4d9ca428abdd9d758993164635dc86f27..d6a0a882331226c3ae4ced09e449eb7931740f8f 100644
--- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
+++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java
@@ -21,6 +21,8 @@ import net.minecraft.core.component.DataComponents;
@ -24,7 +24,7 @@ index d42d39dff5aeb91c5b1e6a7fb967ce70f1a88b7e..38c0855a6f9398f8d075f304288cf9e9
import net.minecraft.nbt.Tag;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.Component;
@@ -120,7 +122,26 @@ public class MapItemSavedData extends SavedData {
@@ -121,7 +123,26 @@ public class MapItemSavedData extends SavedData {
}
public static MapItemSavedData load(CompoundTag nbt, HolderLookup.Provider registryLookup) {

View file

@ -11,10 +11,10 @@ Subject: [PATCH] Fix interact event not being called sometimes
Co-authored-by: Moulberry <james.jenour@protonmail.com>
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 35c8aa3971de05be66acd49b6a0b76cba59f93ac..362bd15dc359762095bdc5120a25460227a0175e 100644
index 9029bc0df227a1dbfab0ab337efa4087d57e7f08..1725451dcd7c62319b282ee7543202e56ca49b26 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -1759,7 +1759,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -1771,7 +1771,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
MutableComponent ichatmutablecomponent = Component.translatable("build.tooHigh", i - 1).withStyle(ChatFormatting.RED);
this.player.sendSystemMessage(ichatmutablecomponent, true);
@ -23,7 +23,7 @@ index 35c8aa3971de05be66acd49b6a0b76cba59f93ac..362bd15dc359762095bdc5120a254602
this.player.swing(enumhand, true);
}
}
@@ -2375,13 +2375,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -2392,13 +2392,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
double d3 = this.player.gameMode.getGameModeForPlayer() == GameType.CREATIVE ? 5.0D : 4.5D;
// SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time
// SPIGOT-7429: Make sure to call PlayerInteractEvent for spectators and non-pickable entities

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Fix nerfed slime when splitting
diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java
index 7062ef1cfd7d6279a4c6693cbdb80da49f23c542..b32213c5a3a1ecaf602cf34bed44c537521c2846 100644
index ef27b0af849f071f79271689783b7a557e6d660a..b54c30ba73b6ab069c0c7c1cd2b193090da79667 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Slime.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java
@@ -252,6 +252,7 @@ public class Slime extends Mob implements Enemy {
@@ -254,6 +254,7 @@ public class Slime extends Mob implements Enemy {
entityslime.setPersistenceRequired();
}

View file

@ -5,15 +5,15 @@ Subject: [PATCH] Add EntityLoadCrossbowEvent
diff --git a/src/main/java/net/minecraft/world/item/CrossbowItem.java b/src/main/java/net/minecraft/world/item/CrossbowItem.java
index 65f23bfb2de91be7560800ff87eab7ad88cb1849..1f52feb5684ee1bab710e1557cf69b43b4d4dfd4 100644
index f64cdfac1fc1333845ea4ea5efb7922f0ae39619..c39fa953accd6cf35672f452052cca42fe6f29d0 100644
--- a/src/main/java/net/minecraft/world/item/CrossbowItem.java
+++ b/src/main/java/net/minecraft/world/item/CrossbowItem.java
@@ -80,7 +80,14 @@ public class CrossbowItem extends ProjectileWeaponItem {
@@ -89,7 +89,14 @@ public class CrossbowItem extends ProjectileWeaponItem {
public void releaseUsing(ItemStack stack, Level world, LivingEntity user, int remainingUseTicks) {
int i = this.getUseDuration(stack) - remainingUseTicks;
float f = getPowerForTime(i, stack);
int i = this.getUseDuration(stack, user) - remainingUseTicks;
float f = getPowerForTime(i, stack, user);
- if (f >= 1.0F && !isCharged(stack) && tryLoadProjectiles(user, stack)) {
+ // Paper start
+ // Paper start - Add EntityLoadCrossbowEvent
+ if (f >= 1.0F && !isCharged(stack)) {
+ final io.papermc.paper.event.entity.EntityLoadCrossbowEvent event = new io.papermc.paper.event.entity.EntityLoadCrossbowEvent(user.getBukkitLivingEntity(), stack.asBukkitMirror(), org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(user.getUsedItemHand()));
+ if (!event.callEvent() || !tryLoadProjectiles(user, stack, event.shouldConsumeItem()) || !event.shouldConsumeItem()) {
@ -21,10 +21,10 @@ index 65f23bfb2de91be7560800ff87eab7ad88cb1849..1f52feb5684ee1bab710e1557cf69b43
+ return;
+ }
+ // Paper end - Add EntityLoadCrossbowEvent
world.playSound(
null,
user.getX(),
@@ -94,8 +101,14 @@ public class CrossbowItem extends ProjectileWeaponItem {
CrossbowItem.ChargingSounds chargingSounds = this.getChargingSounds(stack);
chargingSounds.end()
.ifPresent(
@@ -107,8 +114,14 @@ public class CrossbowItem extends ProjectileWeaponItem {
}
}
@ -42,27 +42,27 @@ index 65f23bfb2de91be7560800ff87eab7ad88cb1849..1f52feb5684ee1bab710e1557cf69b43
crossbow.set(DataComponents.CHARGED_PROJECTILES, ChargedProjectiles.of(list));
return true;
diff --git a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
index 416bdff5cda842143038180592ad231a1d19d926..d27e83c08c45b8514207f26e48ceb1a91ded94be 100644
index 56595dd3a0b7df4b5f9819ade797212278c8fd40..32dd0b13a0819f597d8a93c6bc3a155781067544 100644
--- a/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
+++ b/src/main/java/net/minecraft/world/item/ProjectileWeaponItem.java
@@ -139,6 +139,11 @@ public abstract class ProjectileWeaponItem extends Item {
@@ -114,6 +114,11 @@ public abstract class ProjectileWeaponItem extends Item {
}
protected static List<ItemStack> draw(ItemStack weaponStack, ItemStack projectileStack, LivingEntity shooter) {
protected static List<ItemStack> draw(ItemStack stack, ItemStack projectileStack, LivingEntity shooter) {
+ // Paper start
+ return draw(weaponStack, projectileStack, shooter, true);
+ return draw(stack, projectileStack, shooter, true);
+ }
+ protected static List<ItemStack> draw(ItemStack weaponStack, ItemStack projectileStack, LivingEntity shooter, boolean consume) {
+ protected static List<ItemStack> draw(ItemStack stack, ItemStack projectileStack, LivingEntity shooter, boolean consume) {
+ // Paper end
if (projectileStack.isEmpty()) {
return List.of();
} else {
@@ -148,7 +153,7 @@ public abstract class ProjectileWeaponItem extends Item {
@@ -133,7 +138,7 @@ public abstract class ProjectileWeaponItem extends Item {
ItemStack itemstack2 = projectileStack.copy();
for (int k = 0; k < j; ++k) {
- list.add(ProjectileWeaponItem.useAmmo(weaponStack, k == 0 ? projectileStack : itemstack2, shooter, k > 0));
+ list.add(ProjectileWeaponItem.useAmmo(weaponStack, k == 0 ? projectileStack : itemstack2, shooter, k > 0 || !consume)); // Paper
}
- ItemStack itemstack3 = ProjectileWeaponItem.useAmmo(stack, k == 0 ? projectileStack : itemstack2, shooter, k > 0);
+ ItemStack itemstack3 = ProjectileWeaponItem.useAmmo(stack, k == 0 ? projectileStack : itemstack2, shooter, k > 0 || !consume); // Paper
return list;
if (!itemstack3.isEmpty()) {
list.add(itemstack3);

View file

@ -64,7 +64,7 @@ index 0b46ad360be919e4aeb0ffc0eebae9fe712fb861..51e560d7856f230c5aa2dc32706c3a49
public int get() {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
index a493c8d12935336bb3049aa6d00eb1a4f2194c25..a78922dc4a1f0719753d7349fc6abd473fd96eed 100644
index 97ab6b50288b0d9303cbe20c5aa2af26ff3e72fb..ab5b7ed7ebc1205cb9e4aa017f5d69ccb4fc8ac2 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -1908,8 +1908,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add ServerResourcesReloadedEvent
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 595ce35e5a51811c12a02c3c845de44ba03d1a38..9284466fb576b3320f17fc946da03d362cb67dde 100644
index b47110e9b5d8effdc9e768488f99a614c1070814..691d9d18e72a07b85bf13c6990b44e5cf56dffb5 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2094,7 +2094,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2122,7 +2122,13 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
return this.functionManager;
}
@ -22,7 +22,7 @@ index 595ce35e5a51811c12a02c3c845de44ba03d1a38..9284466fb576b3320f17fc946da03d36
CompletableFuture<Void> completablefuture = CompletableFuture.supplyAsync(() -> {
Stream<String> stream = dataPacks.stream(); // CraftBukkit - decompile error
PackRepository resourcepackrepository = this.packRepository;
@@ -2126,6 +2132,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -2154,6 +2160,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.functionManager.replaceLibrary(this.resources.managers.getFunctionLibrary());
this.structureTemplateManager.onResourceManagerReload(this.resources.resourceManager);
org.bukkit.craftbukkit.block.data.CraftBlockData.reloadCache(); // Paper - cache block data strings; they can be defined by datapacks so refresh it here

View file

@ -5,12 +5,12 @@ Subject: [PATCH] Add world settings for mobs picking up loot
diff --git a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
index a19a51a40d69ad71b85b2e7e8b4cfab6d8343196..7013f1b76311a11fb7e2543ab1e792479ecad610 100644
index aec440d32eb97fa8ce738b98dae1cdc346e8a59b..a5593ac33878efc970c1bdd6f636438d160e9d50 100644
--- a/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
+++ b/src/main/java/net/minecraft/world/entity/monster/AbstractSkeleton.java
@@ -145,7 +145,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
@@ -148,7 +148,7 @@ public abstract class AbstractSkeleton extends Monster implements RangedAttackMo
this.populateDefaultEquipmentSlots(randomsource, difficulty);
this.populateDefaultEquipmentEnchantments(randomsource, difficulty);
this.populateDefaultEquipmentEnchantments(world, randomsource, difficulty);
this.reassessWeaponGoal();
- this.setCanPickUpLoot(randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier());
+ this.setCanPickUpLoot(this.level().paperConfig().entities.behavior.mobsCanAlwaysPickUpLoot.skeletons || randomsource.nextFloat() < 0.55F * difficulty.getSpecialMultiplier()); // Paper - Add world settings for mobs picking up loot
@ -18,10 +18,10 @@ index a19a51a40d69ad71b85b2e7e8b4cfab6d8343196..7013f1b76311a11fb7e2543ab1e79247
LocalDate localdate = LocalDate.now();
int i = localdate.get(ChronoField.DAY_OF_MONTH);
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index bb3c46c9faaf300f7c755c3b8316434e51d0c408..18b147c9488e8dffd25da139ff4c9d2197d72616 100644
index 78254df3e5fbcb0a90c2f9eb9c9343792238f685..5908f1646b542d61b5a2b23b284b1532e4b276c1 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -498,7 +498,7 @@ public class Zombie extends Monster {
@@ -509,7 +509,7 @@ public class Zombie extends Monster {
Object object = super.finalizeSpawn(world, difficulty, spawnReason, entityData);
float f = difficulty.getSpecialMultiplier();

View file

@ -20,7 +20,7 @@ index c7256ffbe57c594556ee85134c9ab166f8c0e0c7..94bcbaf7daf7dfe566f508d1170a4339
ItemStack itemstack = tileentitydispenser.getItem(i);
DispenseItemBehavior idispensebehavior = this.getDispenseMethod(world, itemstack);
diff --git a/src/main/java/net/minecraft/world/level/block/DropperBlock.java b/src/main/java/net/minecraft/world/level/block/DropperBlock.java
index e772b6f8f78ad1292b8fa268e8bb4001a38706c6..efa7cf50b5577f87a2dfa61b59bf81052794fbf1 100644
index a1599eae0d8e9f0298fc6996ad03b0d6ba78f04f..083ddfb8fffa04dad6eeca2274f290a08e62b5eb 100644
--- a/src/main/java/net/minecraft/world/level/block/DropperBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/DropperBlock.java
@@ -60,6 +60,7 @@ public class DropperBlock extends DispenserBlock {
@ -32,10 +32,10 @@ index e772b6f8f78ad1292b8fa268e8bb4001a38706c6..efa7cf50b5577f87a2dfa61b59bf8105
} else {
ItemStack itemstack = tileentitydispenser.getItem(i);
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index 962f4d7453433392331cd68d207cb1c6c1c8fd67..fbdb2e595d8fa2fdd35c2ccea2bb48b520df6ea7 100644
index 7d99c696bec2ea338612d1376e2d24a952b74791..6d335dd7f3642fa3313d5bcfe6b59cae561e656f 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -2050,4 +2050,12 @@ public class CraftEventFactory {
@@ -2056,4 +2056,12 @@ public class CraftEventFactory {
return org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion());
}
// Paper end - WitchReadyPotionEvent

View file

@ -10,10 +10,10 @@ public net.minecraft.world.entity.monster.Zombie DOOR_BREAKING_PREDICATE
Co-authored-by: Doc <nachito94@msn.com>
diff --git a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
index d4ed75afc61620cbc79da07b6511c247b829e41f..b3da310d6fd1d533da805c38c2f449cf06d01492 100644
index 7c3aff97ba777af131d7efad0b08b844bf6e8946..0615bb305d70f660a6baa7f78078990d6db227d3 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Vindicator.java
@@ -176,7 +176,7 @@ public class Vindicator extends AbstractIllager {
@@ -179,7 +179,7 @@ public class Vindicator extends AbstractIllager {
static class VindicatorBreakDoorGoal extends BreakDoorGoal {
public VindicatorBreakDoorGoal(Mob mob) {
@ -23,10 +23,10 @@ index d4ed75afc61620cbc79da07b6511c247b829e41f..b3da310d6fd1d533da805c38c2f449cf
}
diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
index 18b147c9488e8dffd25da139ff4c9d2197d72616..8f8bba0e6690443823c8e2301db82cae3eb66551 100644
index 5908f1646b542d61b5a2b23b284b1532e4b276c1..fd304e7d8305877d56de7a38b8664e5a70bf0c33 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java
@@ -97,7 +97,7 @@ public class Zombie extends Monster {
@@ -101,7 +101,7 @@ public class Zombie extends Monster {
public Zombie(EntityType<? extends Zombie> type, Level world) {
super(type, world);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Empty commands shall not be dispatched
diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java
index 5044a7dc120c8b040ee23365d2bf97e6180e3ee4..43695b31cf23555d3d8a28b031ae6245f96ad1f7 100644
index 52818e877c797ed82f7eecc8e1e1716168422b29..937b5fe4be3573bc47754d627b60a112122a8d83 100644
--- a/src/main/java/net/minecraft/commands/Commands.java
+++ b/src/main/java/net/minecraft/commands/Commands.java
@@ -288,6 +288,7 @@ public class Commands {
@@ -286,6 +286,7 @@ public class Commands {
command = event.getCommand();
String[] args = command.split(" ");

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Remove stale POIs
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 17985c75deaa8d317ea4019f73eafe118d347f41..a9a39c99874001f1024f71bfc97130e8c9a507e7 100644
index c9dad47ef14e0a021685fab710c920419611d151..deabbf30a550ff1835530257177b8f47e4710414 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1743,6 +1743,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1741,6 +1741,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
});
optional1.ifPresent((holder) -> {
this.getServer().execute(() -> {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Fix villager boat exploit
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index c020f18f356f537a1557a3367dd801f9bbabacdc..505af87eaf8209437978848be1dde86f879f82f2 100644
index 858bbd4add280f0cd04aa94fb0b2f8f9423299cf..f565dd3ae7cce3de0aa230155fb955efbab681af 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -601,6 +601,14 @@ public abstract class PlayerList {
@@ -595,6 +595,14 @@ public abstract class PlayerList {
PlayerList.LOGGER.debug("Removing player mount");
entityplayer.stopRiding();
entity.getPassengersAndSelf().forEach((entity1) -> {

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add sendOpLevel API
diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java
index 505af87eaf8209437978848be1dde86f879f82f2..d5071f9f2d433706fc378f77906bb5f04fca0540 100644
index f565dd3ae7cce3de0aa230155fb955efbab681af..05365355fe54d2ed37724d17b174b32fbe6f417f 100644
--- a/src/main/java/net/minecraft/server/players/PlayerList.java
+++ b/src/main/java/net/minecraft/server/players/PlayerList.java
@@ -1100,6 +1100,11 @@ public abstract class PlayerList {
@@ -1062,6 +1062,11 @@ public abstract class PlayerList {
}
private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) {
@ -20,7 +20,7 @@ index 505af87eaf8209437978848be1dde86f879f82f2..d5071f9f2d433706fc378f77906bb5f0
if (player.connection != null) {
byte b0;
@@ -1114,8 +1119,10 @@ public abstract class PlayerList {
@@ -1076,8 +1081,10 @@ public abstract class PlayerList {
player.connection.send(new ClientboundEntityEventPacket(player, b0));
}
@ -32,10 +32,10 @@ index 505af87eaf8209437978848be1dde86f879f82f2..d5071f9f2d433706fc378f77906bb5f0
public boolean isWhiteListed(GameProfile profile) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 37d6be0ae176569971659b4a83895f386eeef863..2d6de1734cb715554ca732d850b8df9591a3efb7 100644
index 721f4fb6bc18fc3ca6a22e8a42f564220042fa42..0c224de84b797856814f5378c87e6d048205e8d9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -675,6 +675,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -677,6 +677,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
// Paper end

View file

@ -12,10 +12,10 @@ public net.minecraft.server.RegistryLayer STATIC_ACCESS
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
new file mode 100644
index 0000000000000000000000000000000000000000..5b6d0c5c788bfd158494a88665a2b9b8c45a9ffe
index 0000000000000000000000000000000000000000..55feffc03d2924e5ec0f55fc65e8aa148cb0cc62
--- /dev/null
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
@@ -0,0 +1,119 @@
@@ -0,0 +1,122 @@
+package io.papermc.paper.registry;
+
+import io.papermc.paper.registry.entry.RegistryEntry;
@ -30,10 +30,12 @@ index 0000000000000000000000000000000000000000..5b6d0c5c788bfd158494a88665a2b9b8
+import net.minecraft.world.item.enchantment.Enchantment;
+import net.minecraft.world.level.levelgen.structure.Structure;
+import org.bukkit.GameEvent;
+import org.bukkit.JukeboxSong;
+import org.bukkit.Keyed;
+import org.bukkit.MusicInstrument;
+import org.bukkit.block.BlockType;
+import org.bukkit.craftbukkit.CraftGameEvent;
+import org.bukkit.craftbukkit.CraftJukeboxSong;
+import org.bukkit.craftbukkit.CraftMusicInstrument;
+import org.bukkit.craftbukkit.block.CraftBlockType;
+import org.bukkit.craftbukkit.damage.CraftDamageType;
@ -84,6 +86,7 @@ index 0000000000000000000000000000000000000000..5b6d0c5c788bfd158494a88665a2b9b8
+ entry(Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, TrimPattern.class, CraftTrimPattern::new).delayed(),
+ entry(Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE, DamageType.class, CraftDamageType::new).delayed(),
+ entry(Registries.WOLF_VARIANT, RegistryKey.WOLF_VARIANT, Wolf.Variant.class, CraftWolf.CraftVariant::new).delayed(),
+ entry(Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, JukeboxSong.class, CraftJukeboxSong::new).delayed(),
+
+ // api-only
+ apiOnly(Registries.BIOME, RegistryKey.BIOME, () -> org.bukkit.Registry.BIOME),
@ -670,10 +673,10 @@ index 0000000000000000000000000000000000000000..4396982af55872fafbfeaf8161ad6f39
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.framework.qual.DefaultQualifier;
diff --git a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
index b43af53960978ac04bccde08544a562841492791..8daee5a7935e3253834c4cbe81d5e8886f776dad 100644
index cbc1658e0df4070605a6b2fbe99167b3bc001223..44b7927081b476813505cab6b3a2da2ec2942c54 100644
--- a/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
+++ b/src/main/java/net/minecraft/core/registries/BuiltInRegistries.java
@@ -297,6 +297,7 @@ public class BuiltInRegistries {
@@ -315,6 +315,7 @@ public class BuiltInRegistries {
ResourceKey<? extends Registry<T>> key, R registry, BuiltInRegistries.RegistryBootstrap<T> initializer
) {
Bootstrap.checkBootstrapCalled(() -> "registry " + key);
@ -682,11 +685,11 @@ index b43af53960978ac04bccde08544a562841492791..8daee5a7935e3253834c4cbe81d5e888
LOADERS.put(resourceLocation, () -> initializer.run(registry));
WRITABLE_REGISTRY.register((ResourceKey)key, registry, RegistrationInfo.BUILT_IN); // Paper - decompile fix
diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
index 1a40a600b8a9716ef26f3143f361a47b76ec2510..d59356df2d98de873fc5accc749f87fa3d685267 100644
index deaf62913850a0e0fdffd3d52fd383bcdda979af..abadf4abe08dc3bb6612b42cbb3f7df3ffa28ce9 100644
--- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java
+++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
@@ -284,6 +284,7 @@ public class RegistryDataLoader {
public static record RegistryData<T>(ResourceKey<? extends Registry<T>> key, Codec<T> elementCodec) {
@@ -299,6 +299,7 @@ public class RegistryDataLoader {
RegistryDataLoader.Loader<T> create(Lifecycle lifecycle, Map<ResourceKey<?>, Exception> errors) {
WritableRegistry<T> writableRegistry = new MappedRegistry<>(this.key, lifecycle);
+ io.papermc.paper.registry.PaperRegistryAccess.instance().registerRegistry(this.key, writableRegistry); // Paper - initialize API registry
@ -694,7 +697,7 @@ index 1a40a600b8a9716ef26f3143f361a47b76ec2510..d59356df2d98de873fc5accc749f87fa
}
diff --git a/src/main/java/net/minecraft/server/ReloadableServerRegistries.java b/src/main/java/net/minecraft/server/ReloadableServerRegistries.java
index cf08819dd7ef6db807053a52aaf66a7fdea18ab6..69682d7be64a2163d574de939f5146f5a7a642ef 100644
index 1dd22f11b7e2983a3069dea94c0f02b43ff1f736..397bdacab9517354875ebc0bc68d35059b3c318b 100644
--- a/src/main/java/net/minecraft/server/ReloadableServerRegistries.java
+++ b/src/main/java/net/minecraft/server/ReloadableServerRegistries.java
@@ -60,6 +60,7 @@ public class ReloadableServerRegistries {
@ -703,13 +706,13 @@ index cf08819dd7ef6db807053a52aaf66a7fdea18ab6..69682d7be64a2163d574de939f5146f5
WritableRegistry<T> writableRegistry = new MappedRegistry<>(type.registryKey(), Lifecycle.experimental());
+ io.papermc.paper.registry.PaperRegistryAccess.instance().registerReloadableRegistry(type.registryKey(), writableRegistry); // Paper - register reloadable registry
Map<ResourceLocation, JsonElement> map = new HashMap<>();
SimpleJsonResourceReloadListener.scanDirectory(resourceManager, type.directory(), GSON, map);
map.forEach(
String string = Registries.elementsDirPath(type.registryKey());
SimpleJsonResourceReloadListener.scanDirectory(resourceManager, string, GSON, map);
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
index 107734d32d8bb6384b96e11d99d36cb9a203750f..a644309edb612d97da290f86a1ef6fe597c7d85d 100644
index d129f7c15c143843429cf8a56fd1e52684531257..f8cf246913040ea4064f8addee0ec6927eb06237 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftRegistry.java
@@ -110,57 +110,12 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
@@ -111,60 +111,12 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
+ ", this can happen if a plugin creates its own registry entry with out properly registering it.");
}
@ -748,6 +751,9 @@ index 107734d32d8bb6384b96e11d99d36cb9a203750f..a644309edb612d97da290f86a1ef6fe5
- if (bukkitClass == DamageType.class) {
- return new CraftRegistry<>(DamageType.class, registryHolder.registryOrThrow(Registries.DAMAGE_TYPE), CraftDamageType::new, FieldRename.NONE);
- }
- if (bukkitClass == JukeboxSong.class) {
- return new CraftRegistry<>(JukeboxSong.class, registryHolder.registryOrThrow(Registries.JUKEBOX_SONG), CraftJukeboxSong::new, FieldRename.NONE);
- }
- if (bukkitClass == Wolf.Variant.class) {
- return new CraftRegistry<>(Wolf.Variant.class, registryHolder.registryOrThrow(Registries.WOLF_VARIANT), CraftWolf.CraftVariant::new, FieldRename.NONE);
- }
@ -770,7 +776,7 @@ index 107734d32d8bb6384b96e11d99d36cb9a203750f..a644309edb612d97da290f86a1ef6fe5
}
if (bukkit instanceof Registry.SimpleRegistry<?> simple) {
@@ -186,23 +141,21 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
@@ -190,23 +142,21 @@ public class CraftRegistry<B extends Keyed, M> implements Registry<B> {
return bukkit.get(namespacedKey);
}
@ -800,10 +806,10 @@ index 107734d32d8bb6384b96e11d99d36cb9a203750f..a644309edb612d97da290f86a1ef6fe5
@Override
public B get(NamespacedKey namespacedKey) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index aee62eef2a67be2ca0d1c19143cc7f42e5e32390..740b34322aeb566248abfe0e34b8919078982217 100644
index 92e0f1a948962d4c71f1288dfb8b482d3207cf4c..24c8e9a43affa8ca99c03562aefc3d6402c23281 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -280,7 +280,7 @@ public final class CraftServer implements Server {
@@ -281,7 +281,7 @@ public final class CraftServer implements Server {
protected final DedicatedServer console;
protected final DedicatedPlayerList playerList;
private final Map<String, World> worlds = new LinkedHashMap<String, World>();
@ -812,7 +818,7 @@ index aee62eef2a67be2ca0d1c19143cc7f42e5e32390..740b34322aeb566248abfe0e34b89190
private YamlConfiguration configuration;
private YamlConfiguration commandsConfiguration;
private final Yaml yaml = new Yaml(new SafeConstructor(new LoaderOptions()));
@@ -2713,7 +2713,7 @@ public final class CraftServer implements Server {
@@ -2721,7 +2721,7 @@ public final class CraftServer implements Server {
@Override
public <T extends Keyed> Registry<T> getRegistry(Class<T> aClass) {
@ -1067,7 +1073,7 @@ index c94dae13e8edfdb0adf73a5b3fda4eb1bc97f4bc..f8e363e9c10e30598185a91cbb5cafc0
// Paper start - testing additions
final Thread currentThread = Thread.currentThread();
diff --git a/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java b/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java
index d57713c3f995e6b381f2a31ab7e93b073d42222d..24f01242513d6c815f60599d7118fe12bc577804 100644
index 23819f05563a1d8c9f13335bc9a77964e3f8b7c6..a480944e1fc1b79b91be7e8d3e3799b9168cf5a0 100644
--- a/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java
+++ b/src/test/java/org/bukkit/support/provider/RegistriesArgumentProvider.java
@@ -1,6 +1,7 @@
@ -1078,7 +1084,7 @@ index d57713c3f995e6b381f2a31ab7e93b073d42222d..24f01242513d6c815f60599d7118fe12
import java.util.List;
import java.util.stream.Stream;
import net.minecraft.core.registries.Registries;
@@ -41,28 +42,28 @@ public class RegistriesArgumentProvider implements ArgumentsProvider {
@@ -43,29 +44,29 @@ public class RegistriesArgumentProvider implements ArgumentsProvider {
private static final List<Arguments> DATA = Lists.newArrayList();
static {
@ -1092,6 +1098,7 @@ index d57713c3f995e6b381f2a31ab7e93b073d42222d..24f01242513d6c815f60599d7118fe12
- register(TrimMaterial.class, Registries.TRIM_MATERIAL, CraftTrimMaterial.class, net.minecraft.world.item.armortrim.TrimMaterial.class);
- register(TrimPattern.class, Registries.TRIM_PATTERN, CraftTrimPattern.class, net.minecraft.world.item.armortrim.TrimPattern.class);
- register(DamageType.class, Registries.DAMAGE_TYPE, CraftDamageType.class, net.minecraft.world.damagesource.DamageType.class);
- register(JukeboxSong.class, Registries.JUKEBOX_SONG, CraftJukeboxSong.class, net.minecraft.world.item.JukeboxSong.class);
- register(Wolf.Variant.class, Registries.WOLF_VARIANT, CraftWolf.CraftVariant.class, WolfVariant.class);
- register(ItemType.class, Registries.ITEM, CraftItemType.class, net.minecraft.world.item.Item.class, true);
- register(BlockType.class, Registries.BLOCK, CraftBlockType.class, net.minecraft.world.level.block.Block.class, true);
@ -1105,6 +1112,7 @@ index d57713c3f995e6b381f2a31ab7e93b073d42222d..24f01242513d6c815f60599d7118fe12
+ register(RegistryKey.TRIM_MATERIAL, TrimMaterial.class, Registries.TRIM_MATERIAL, CraftTrimMaterial.class, net.minecraft.world.item.armortrim.TrimMaterial.class);
+ register(RegistryKey.TRIM_PATTERN, TrimPattern.class, Registries.TRIM_PATTERN, CraftTrimPattern.class, net.minecraft.world.item.armortrim.TrimPattern.class);
+ register(RegistryKey.DAMAGE_TYPE, DamageType.class, Registries.DAMAGE_TYPE, CraftDamageType.class, net.minecraft.world.damagesource.DamageType.class);
+ register(RegistryKey.JUKEBOX_SONG, JukeboxSong.class, Registries.JUKEBOX_SONG, CraftJukeboxSong.class, net.minecraft.world.item.JukeboxSong.class);
+ register(RegistryKey.WOLF_VARIANT, Wolf.Variant.class, Registries.WOLF_VARIANT, CraftWolf.CraftVariant.class, WolfVariant.class);
+ register(RegistryKey.ITEM, ItemType.class, Registries.ITEM, CraftItemType.class, net.minecraft.world.item.Item.class, true);
+ register(RegistryKey.BLOCK, BlockType.class, Registries.BLOCK, CraftBlockType.class, net.minecraft.world.level.block.Block.class, true);

View file

@ -6,10 +6,10 @@ Subject: [PATCH] Add StructuresLocateEvent
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
index 5b6d0c5c788bfd158494a88665a2b9b8c45a9ffe..51979b3c3f1f3a3c63e0559c70bed9193fd35dbb 100644
index 55feffc03d2924e5ec0f55fc65e8aa148cb0cc62..1b5a791e4cca089774cb3519012a538f3f88eac4 100644
--- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
@@ -46,6 +46,12 @@ import static io.papermc.paper.registry.entry.RegistryEntry.entry;
@@ -48,6 +48,12 @@ import static io.papermc.paper.registry.entry.RegistryEntry.entry;
@DefaultQualifier(NonNull.class)
public final class PaperRegistries {
@ -76,10 +76,10 @@ index 0000000000000000000000000000000000000000..013d614a1cf1ab2b5a6ec190c2b4ba77
+ }
+}
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 7cdb59cd2f2ffe1195d21519ef97dae0e430285b..a8768f1925d5824ca985be1b53694ee233273758 100644
index 0a779632c9d11496fcfc147870fba2699d9cc274..5adc1952504b26772116b55a5144b7704136edfa 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -127,6 +127,24 @@ public abstract class ChunkGenerator {
@@ -126,6 +126,24 @@ public abstract class ChunkGenerator {
@Nullable
public Pair<BlockPos, Holder<Structure>> findNearestMapStructure(ServerLevel world, HolderSet<Structure> structures, BlockPos center, int radius, boolean skipReferencedStructures) {

Some files were not shown because too many files have changed in this diff Show more