diff --git a/patches/unapplied/server/API-for-an-entity-s-scoreboard-name.patch b/patches/server/API-for-an-entity-s-scoreboard-name.patch similarity index 100% rename from patches/unapplied/server/API-for-an-entity-s-scoreboard-name.patch rename to patches/server/API-for-an-entity-s-scoreboard-name.patch diff --git a/patches/unapplied/server/API-for-updating-recipes-on-clients.patch b/patches/server/API-for-updating-recipes-on-clients.patch similarity index 99% rename from patches/unapplied/server/API-for-updating-recipes-on-clients.patch rename to patches/server/API-for-updating-recipes-on-clients.patch index 0a7b99632e0..6556a6fdf37 100644 --- a/patches/unapplied/server/API-for-updating-recipes-on-clients.patch +++ b/patches/server/API-for-updating-recipes-on-clients.patch @@ -35,7 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + public void reloadRecipeData() { + // Paper end - API for updating recipes on clients - ClientboundUpdateRecipesPacket packetplayoutrecipeupdate = new ClientboundUpdateRecipesPacket(this.server.getRecipeManager().getRecipes()); + ClientboundUpdateRecipesPacket packetplayoutrecipeupdate = new ClientboundUpdateRecipesPacket(this.server.getRecipeManager().getOrderedRecipes()); Iterator iterator1 = this.players.iterator(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/patches/unapplied/server/Add-API-to-get-the-collision-shape-of-a-block-before.patch b/patches/server/Add-API-to-get-the-collision-shape-of-a-block-before.patch similarity index 100% rename from patches/unapplied/server/Add-API-to-get-the-collision-shape-of-a-block-before.patch rename to patches/server/Add-API-to-get-the-collision-shape-of-a-block-before.patch diff --git a/patches/unapplied/server/Add-BlockFace-to-BlockDamageEvent.patch b/patches/server/Add-BlockFace-to-BlockDamageEvent.patch similarity index 100% rename from patches/unapplied/server/Add-BlockFace-to-BlockDamageEvent.patch rename to patches/server/Add-BlockFace-to-BlockDamageEvent.patch diff --git a/patches/unapplied/server/Add-BlockLockCheckEvent.patch b/patches/server/Add-BlockLockCheckEvent.patch similarity index 98% rename from patches/unapplied/server/Add-BlockLockCheckEvent.patch rename to patches/server/Add-BlockLockCheckEvent.patch index 3f6570434ac..5bf9837d9c2 100644 --- a/patches/unapplied/server/Add-BlockLockCheckEvent.patch +++ b/patches/server/Add-BlockLockCheckEvent.patch @@ -54,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } // Paper - Add BlockLockCheckEvent } - @Nullable + protected abstract NonNullList getItems(); 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BeaconBlockEntity.java diff --git a/patches/unapplied/server/Add-CompostItemEvent-and-EntityCompostItemEvent.patch b/patches/server/Add-CompostItemEvent-and-EntityCompostItemEvent.patch similarity index 100% rename from patches/unapplied/server/Add-CompostItemEvent-and-EntityCompostItemEvent.patch rename to patches/server/Add-CompostItemEvent-and-EntityCompostItemEvent.patch diff --git a/patches/unapplied/server/Add-Entity-Body-Yaw-API.patch b/patches/server/Add-Entity-Body-Yaw-API.patch similarity index 100% rename from patches/unapplied/server/Add-Entity-Body-Yaw-API.patch rename to patches/server/Add-Entity-Body-Yaw-API.patch diff --git a/patches/unapplied/server/Add-EntityFertilizeEggEvent.patch b/patches/server/Add-EntityFertilizeEggEvent.patch similarity index 99% rename from patches/unapplied/server/Add-EntityFertilizeEggEvent.patch rename to patches/server/Add-EntityFertilizeEggEvent.patch index 37919b87549..4a981b15dd5 100644 --- a/patches/unapplied/server/Add-EntityFertilizeEggEvent.patch +++ b/patches/server/Add-EntityFertilizeEggEvent.patch @@ -32,7 +32,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/sr index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -@@ -0,0 +0,0 @@ public class Frog extends Animal implements VariantHolder { +@@ -0,0 +0,0 @@ public class Frog extends Animal implements VariantHolder> { @Override public void spawnChildFromBreeding(ServerLevel world, Animal other) { diff --git a/patches/unapplied/server/Add-Listing-API-for-Player.patch b/patches/server/Add-Listing-API-for-Player.patch similarity index 99% rename from patches/unapplied/server/Add-Listing-API-for-Player.patch rename to patches/server/Add-Listing-API-for-Player.patch index 112790ba010..59ef0cade3b 100644 --- a/patches/unapplied/server/Add-Listing-API-for-Player.patch +++ b/patches/server/Add-Listing-API-for-Player.patch @@ -52,8 +52,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + return new ClientboundPlayerInfoUpdatePacket(enumSet, new ClientboundPlayerInfoUpdatePacket.Entry(playerInfoId, listed)); + } + // Paper end - Add Listing API for Player -+ - public ClientboundPlayerInfoUpdatePacket(FriendlyByteBuf buf) { + private ClientboundPlayerInfoUpdatePacket(RegistryFriendlyByteBuf buf) { this.actions = buf.readEnumSet(ClientboundPlayerInfoUpdatePacket.Action.class); this.entries = buf.readList(buf2 -> { @@ -0,0 +0,0 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet type, Level world) { - super(type, world, ThrownTrident.DEFAULT_ARROW_STACK); + super(type, world); + this.setBaseDamage(net.minecraft.world.item.TridentItem.BASE_DAMAGE); // Paper - Allow trident custom damage } @@ -28,5 +28,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - float f = 8.0F; + float f = (float) this.getBaseDamage(); // Paper - Allow trident custom damage - if (entity instanceof LivingEntity) { - LivingEntity entityliving = (LivingEntity) entity; + if (entity instanceof LivingEntity entityliving) { + f += EnchantmentHelper.getDamageBonus(this.getPickupItemStackOrigin(), entityliving.getType()); diff --git a/patches/unapplied/server/Avoid-Lazy-Initialization-for-Enum-Fields.patch b/patches/server/Avoid-Lazy-Initialization-for-Enum-Fields.patch similarity index 100% rename from patches/unapplied/server/Avoid-Lazy-Initialization-for-Enum-Fields.patch rename to patches/server/Avoid-Lazy-Initialization-for-Enum-Fields.patch diff --git a/patches/unapplied/server/Bandaid-fix-for-Effect.patch b/patches/server/Bandaid-fix-for-Effect.patch similarity index 95% rename from patches/unapplied/server/Bandaid-fix-for-Effect.patch rename to patches/server/Bandaid-fix-for-Effect.patch index 848008729aa..644376ea2d8 100644 --- a/patches/unapplied/server/Bandaid-fix-for-Effect.patch +++ b/patches/server/Bandaid-fix-for-Effect.patch @@ -21,14 +21,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 case VILLAGER_PLANT_GROW: datavalue = (Integer) data; break; - case POTION_BREAK: -+ if (data instanceof Potion) { // Paper - use Color for POTION_BREAK - datavalue = ((Potion) data).toDamageValue() & 0x3F; - break; -+ } // Paper - Color will fall through to cast below - case INSTANT_POTION_BREAK: - datavalue = ((Color) data).asRGB(); - break; @@ -0,0 +0,0 @@ public class CraftEffect { Preconditions.checkArgument(data == Material.AIR || ((Material) data).isRecord(), "Invalid record type for Material %s!", data); datavalue = Item.getId(CraftItemType.bukkitToMinecraft((Material) data)); diff --git a/patches/unapplied/server/Break-redstone-on-top-of-trap-doors-early.patch b/patches/server/Break-redstone-on-top-of-trap-doors-early.patch similarity index 100% rename from patches/unapplied/server/Break-redstone-on-top-of-trap-doors-early.patch rename to patches/server/Break-redstone-on-top-of-trap-doors-early.patch diff --git a/patches/unapplied/server/Broadcast-take-item-packets-with-collector-as-source.patch b/patches/server/Broadcast-take-item-packets-with-collector-as-source.patch similarity index 100% rename from patches/unapplied/server/Broadcast-take-item-packets-with-collector-as-source.patch rename to patches/server/Broadcast-take-item-packets-with-collector-as-source.patch diff --git a/patches/unapplied/server/Cache-map-ids-on-item-frames.patch b/patches/server/Cache-map-ids-on-item-frames.patch similarity index 95% rename from patches/unapplied/server/Cache-map-ids-on-item-frames.patch rename to patches/server/Cache-map-ids-on-item-frames.patch index 1e510b2fcef..1abe765e442 100644 --- a/patches/unapplied/server/Cache-map-ids-on-item-frames.patch +++ b/patches/server/Cache-map-ids-on-item-frames.patch @@ -12,9 +12,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ItemStack itemstack = entityitemframe.getItem(); if (this.level.paperConfig().maps.itemFrameCursorUpdateInterval > 0 && this.tickCount % this.level.paperConfig().maps.itemFrameCursorUpdateInterval == 0 && itemstack.getItem() instanceof MapItem) { // CraftBukkit - Moved this.tickCounter % 10 logic here so item frames do not enter the other blocks // Paper - Make item frame map cursor update interval configurable -- Integer integer = MapItem.getMapId(itemstack); +- MapId mapid = (MapId) itemstack.get(DataComponents.MAP_ID); + Integer integer = entityitemframe.cachedMapId; // Paper - Perf: Cache map ids on item frames - MapItemSavedData worldmap = MapItem.getSavedData(integer, this.level); + MapItemSavedData worldmap = MapItem.getSavedData(mapid, this.level); if (worldmap != null) { diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java diff --git a/patches/unapplied/server/Call-BlockGrowEvent-for-missing-blocks.patch b/patches/server/Call-BlockGrowEvent-for-missing-blocks.patch similarity index 100% rename from patches/unapplied/server/Call-BlockGrowEvent-for-missing-blocks.patch rename to patches/server/Call-BlockGrowEvent-for-missing-blocks.patch diff --git a/patches/unapplied/server/Call-BlockRedstoneEvents-for-lecterns.patch b/patches/server/Call-BlockRedstoneEvents-for-lecterns.patch similarity index 100% rename from patches/unapplied/server/Call-BlockRedstoneEvents-for-lecterns.patch rename to patches/server/Call-BlockRedstoneEvents-for-lecterns.patch diff --git a/patches/unapplied/server/Call-missing-BlockDispenseEvent.patch b/patches/server/Call-missing-BlockDispenseEvent.patch similarity index 100% rename from patches/unapplied/server/Call-missing-BlockDispenseEvent.patch rename to patches/server/Call-missing-BlockDispenseEvent.patch diff --git a/patches/unapplied/server/Configurable-Region-Compression-Format.patch b/patches/server/Configurable-Region-Compression-Format.patch similarity index 80% rename from patches/unapplied/server/Configurable-Region-Compression-Format.patch rename to patches/server/Configurable-Region-Compression-Format.patch index 6af3bd6bfb2..97d8d019005 100644 --- a/patches/unapplied/server/Configurable-Region-Compression-Format.patch +++ b/patches/server/Configurable-Region-Compression-Format.patch @@ -11,21 +11,20 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class RegionFile implements AutoCloseable { protected final RegionBitmap usedSectors; - public RegionFile(Path file, Path directory, boolean dsync) throws IOException { -- this(file, directory, RegionFileVersion.VERSION_DEFLATE, dsync); + public RegionFile(RegionStorageInfo storageKey, Path directory, Path path, boolean dsync) throws IOException { +- this(storageKey, directory, path, RegionFileVersion.getSelected(), dsync); + this(file, directory, RegionFileVersion.getCompressionFormat(), dsync); // Paper - Configurable region compression format } - public RegionFile(Path file, Path directory, RegionFileVersion outputChunkStreamVersion, boolean dsync) throws IOException { + public RegionFile(RegionStorageInfo storageKey, Path path, Path directory, RegionFileVersion compressionFormat, boolean dsync) throws IOException { diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileVersion.java @@ -0,0 +0,0 @@ public class RegionFileVersion { - ) - ); - public static final RegionFileVersion VERSION_NONE = register(new RegionFileVersion(3, stream -> stream, stream -> stream)); -+ + private final RegionFileVersion.StreamWrapper inputWrapper; + private final RegionFileVersion.StreamWrapper outputWrapper; + + // Paper start - Configurable region compression format + public static RegionFileVersion getCompressionFormat() { + return switch (io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.compressionFormat) { @@ -35,7 +34,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + }; + } + // Paper end - Configurable region compression format -+ - private final int id; - private final RegionFileVersion.StreamWrapper inputWrapper; - private final RegionFileVersion.StreamWrapper outputWrapper; + private RegionFileVersion( + int id, + @Nullable String name, diff --git a/patches/unapplied/server/Configurable-entity-tracking-range-by-Y-coordinate.patch b/patches/server/Configurable-entity-tracking-range-by-Y-coordinate.patch similarity index 100% rename from patches/unapplied/server/Configurable-entity-tracking-range-by-Y-coordinate.patch rename to patches/server/Configurable-entity-tracking-range-by-Y-coordinate.patch diff --git a/patches/unapplied/server/Configure-sniffer-egg-hatch-time.patch b/patches/server/Configure-sniffer-egg-hatch-time.patch similarity index 100% rename from patches/unapplied/server/Configure-sniffer-egg-hatch-time.patch rename to patches/server/Configure-sniffer-egg-hatch-time.patch diff --git a/patches/unapplied/server/Correctly-handle-ArmorStand-invisibility.patch b/patches/server/Correctly-handle-ArmorStand-invisibility.patch similarity index 100% rename from patches/unapplied/server/Correctly-handle-ArmorStand-invisibility.patch rename to patches/server/Correctly-handle-ArmorStand-invisibility.patch diff --git a/patches/unapplied/server/Correctly-shrink-items-during-EntityResurrectEvent.patch b/patches/server/Correctly-shrink-items-during-EntityResurrectEvent.patch similarity index 100% rename from patches/unapplied/server/Correctly-shrink-items-during-EntityResurrectEvent.patch rename to patches/server/Correctly-shrink-items-during-EntityResurrectEvent.patch diff --git a/patches/unapplied/server/Deprecate-and-replace-methods-with-old-StructureType.patch b/patches/server/Deprecate-and-replace-methods-with-old-StructureType.patch similarity index 100% rename from patches/unapplied/server/Deprecate-and-replace-methods-with-old-StructureType.patch rename to patches/server/Deprecate-and-replace-methods-with-old-StructureType.patch diff --git a/patches/unapplied/server/Determine-lava-and-water-fluid-explosion-resistance-.patch b/patches/server/Determine-lava-and-water-fluid-explosion-resistance-.patch similarity index 100% rename from patches/unapplied/server/Determine-lava-and-water-fluid-explosion-resistance-.patch rename to patches/server/Determine-lava-and-water-fluid-explosion-resistance-.patch diff --git a/patches/unapplied/server/Do-crystal-portal-proximity-check-before-entity-look.patch b/patches/server/Do-crystal-portal-proximity-check-before-entity-look.patch similarity index 100% rename from patches/unapplied/server/Do-crystal-portal-proximity-check-before-entity-look.patch rename to patches/server/Do-crystal-portal-proximity-check-before-entity-look.patch diff --git a/patches/unapplied/server/Do-not-read-tile-entities-in-chunks-that-are-positio.patch b/patches/server/Do-not-read-tile-entities-in-chunks-that-are-positio.patch similarity index 98% rename from patches/unapplied/server/Do-not-read-tile-entities-in-chunks-that-are-positio.patch rename to patches/server/Do-not-read-tile-entities-in-chunks-that-are-positio.patch index d9a86209b06..8b1a5b998cc 100644 --- a/patches/unapplied/server/Do-not-read-tile-entities-in-chunks-that-are-positio.patch +++ b/patches/server/Do-not-read-tile-entities-in-chunks-that-are-positio.patch @@ -45,6 +45,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } else { - BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound1); + // Paper - do not read tile entities positioned outside the chunk; move up - BlockEntity tileentity = BlockEntity.loadStatic(blockposition, chunk.getBlockState(blockposition), nbttagcompound1); + BlockEntity tileentity = BlockEntity.loadStatic(blockposition, chunk.getBlockState(blockposition), nbttagcompound1, world.registryAccess()); if (tileentity != null) { diff --git a/patches/unapplied/server/Don-t-check-if-we-can-see-non-visible-entities.patch b/patches/server/Don-t-check-if-we-can-see-non-visible-entities.patch similarity index 100% rename from patches/unapplied/server/Don-t-check-if-we-can-see-non-visible-entities.patch rename to patches/server/Don-t-check-if-we-can-see-non-visible-entities.patch diff --git a/patches/unapplied/server/Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch b/patches/server/Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch similarity index 100% rename from patches/unapplied/server/Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch rename to patches/server/Don-t-enforce-icanhasbukkit-default-if-alias-block-e.patch diff --git a/patches/unapplied/server/Don-t-load-chunks-for-supporting-block-checks.patch b/patches/server/Don-t-load-chunks-for-supporting-block-checks.patch similarity index 90% rename from patches/unapplied/server/Don-t-load-chunks-for-supporting-block-checks.patch rename to patches/server/Don-t-load-chunks-for-supporting-block-checks.patch index 27da5ec9fb5..936bbbd8dc4 100644 --- a/patches/unapplied/server/Don-t-load-chunks-for-supporting-block-checks.patch +++ b/patches/server/Don-t-load-chunks-for-supporting-block-checks.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } protected BlockPos getOnPos(float offset) { diff --git a/patches/unapplied/server/Don-t-tab-complete-namespaced-commands-if-send-names.patch b/patches/server/Don-t-tab-complete-namespaced-commands-if-send-names.patch similarity index 100% rename from patches/unapplied/server/Don-t-tab-complete-namespaced-commands-if-send-names.patch rename to patches/server/Don-t-tab-complete-namespaced-commands-if-send-names.patch diff --git a/patches/unapplied/server/Expand-LingeringPotion-API.patch b/patches/server/Expand-LingeringPotion-API.patch similarity index 70% rename from patches/unapplied/server/Expand-LingeringPotion-API.patch rename to patches/server/Expand-LingeringPotion-API.patch index 60895d9965e..f0b81414fdd 100644 --- a/patches/unapplied/server/Expand-LingeringPotion-API.patch +++ b/patches/server/Expand-LingeringPotion-API.patch @@ -9,11 +9,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java @@ -0,0 +0,0 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie - + boolean noEffects = potioncontents.hasEffects(); // Paper - Fix potions splash events // CraftBukkit start org.bukkit.event.entity.LingeringPotionSplashEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callLingeringPotionSplashEvent(this, position, entityareaeffectcloud); -- if (!(event.isCancelled() || entityareaeffectcloud.isRemoved() || (noEffects && entityareaeffectcloud.effects.isEmpty() && entityareaeffectcloud.getPotion().getEffects().isEmpty()))) { // Paper - don't spawn area effect cloud if the effects were empty and not changed during the event handling -+ if (!(event.isCancelled() || entityareaeffectcloud.isRemoved() || (!event.allowsEmptyCreation() && (noEffects && entityareaeffectcloud.effects.isEmpty() && entityareaeffectcloud.getPotion().getEffects().isEmpty())))) { // Paper - don't spawn area effect cloud if the effects were empty and not changed during the event handling +- if (!(event.isCancelled() || entityareaeffectcloud.isRemoved() || (noEffects && !entityareaeffectcloud.potionContents.hasEffects()))) { // Paper - don't spawn area effect cloud if the effects were empty and not changed during the event handling ++ if (!(event.isCancelled() || entityareaeffectcloud.isRemoved() || (!event.allowsEmptyCreation() && (noEffects && !entityareaeffectcloud.potionContents.hasEffects())))) { // Paper - don't spawn area effect cloud if the effects were empty and not changed during the event handling this.level().addFreshEntity(entityareaeffectcloud); } else { entityareaeffectcloud.discard(null); // CraftBukkit - add Bukkit remove cause diff --git a/patches/unapplied/server/Expand-PlayerItemMendEvent.patch b/patches/server/Expand-PlayerItemMendEvent.patch similarity index 100% rename from patches/unapplied/server/Expand-PlayerItemMendEvent.patch rename to patches/server/Expand-PlayerItemMendEvent.patch diff --git a/patches/unapplied/server/Expand-Pose-API.patch b/patches/server/Expand-Pose-API.patch similarity index 91% rename from patches/unapplied/server/Expand-Pose-API.patch rename to patches/server/Expand-Pose-API.patch index 813da891b58..c6854463e55 100644 --- a/patches/unapplied/server/Expand-Pose-API.patch +++ b/patches/server/Expand-Pose-API.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @javax.annotation.Nullable private UUID originWorld; public boolean freezeLocked = false; // Paper - Freeze Tick Lock API @@ -16,7 +16,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void setOrigin(@javax.annotation.Nonnull Location location) { this.origin = location.toVector(); -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public void onClientRemoval() {} public void setPose(net.minecraft.world.entity.Pose pose) { diff --git a/patches/unapplied/server/ExperienceOrb-should-call-EntitySpawnEvent.patch b/patches/server/ExperienceOrb-should-call-EntitySpawnEvent.patch similarity index 100% rename from patches/unapplied/server/ExperienceOrb-should-call-EntitySpawnEvent.patch rename to patches/server/ExperienceOrb-should-call-EntitySpawnEvent.patch diff --git a/patches/unapplied/server/Expose-hand-in-BlockCanBuildEvent.patch b/patches/server/Expose-hand-in-BlockCanBuildEvent.patch similarity index 100% rename from patches/unapplied/server/Expose-hand-in-BlockCanBuildEvent.patch rename to patches/server/Expose-hand-in-BlockCanBuildEvent.patch diff --git a/patches/unapplied/server/Expose-pre-collision-moving-velocity-to-VehicleBlock.patch b/patches/server/Expose-pre-collision-moving-velocity-to-VehicleBlock.patch similarity index 87% rename from patches/unapplied/server/Expose-pre-collision-moving-velocity-to-VehicleBlock.patch rename to patches/server/Expose-pre-collision-moving-velocity-to-VehicleBlock.patch index bf7d3353ca2..905cf965aa8 100644 --- a/patches/unapplied/server/Expose-pre-collision-moving-velocity-to-VehicleBlock.patch +++ b/patches/server/Expose-pre-collision-moving-velocity-to-VehicleBlock.patch @@ -9,7 +9,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public void move(MoverType movementType, Vec3 movement) { @@ -17,7 +17,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.noPhysics) { this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); } else { -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } if (!bl.getType().isAir()) { diff --git a/patches/unapplied/server/Fire-entity-death-event-for-ender-dragon.patch b/patches/server/Fire-entity-death-event-for-ender-dragon.patch similarity index 100% rename from patches/unapplied/server/Fire-entity-death-event-for-ender-dragon.patch rename to patches/server/Fire-entity-death-event-for-ender-dragon.patch diff --git a/patches/unapplied/server/Fix-BanList-API.patch b/patches/server/Fix-BanList-API.patch similarity index 100% rename from patches/unapplied/server/Fix-BanList-API.patch rename to patches/server/Fix-BanList-API.patch diff --git a/patches/unapplied/server/Fix-HumanEntity-drop-not-updating-the-client-inv.patch b/patches/server/Fix-HumanEntity-drop-not-updating-the-client-inv.patch similarity index 100% rename from patches/unapplied/server/Fix-HumanEntity-drop-not-updating-the-client-inv.patch rename to patches/server/Fix-HumanEntity-drop-not-updating-the-client-inv.patch diff --git a/patches/unapplied/server/Fix-MC-157464-Prevent-sleeping-villagers-moving-towa.patch b/patches/server/Fix-MC-157464-Prevent-sleeping-villagers-moving-towa.patch similarity index 100% rename from patches/unapplied/server/Fix-MC-157464-Prevent-sleeping-villagers-moving-towa.patch rename to patches/server/Fix-MC-157464-Prevent-sleeping-villagers-moving-towa.patch diff --git a/patches/unapplied/server/Fix-NPE-in-AdvancementProgress-getDateAwarded.patch b/patches/server/Fix-NPE-in-AdvancementProgress-getDateAwarded.patch similarity index 100% rename from patches/unapplied/server/Fix-NPE-in-AdvancementProgress-getDateAwarded.patch rename to patches/server/Fix-NPE-in-AdvancementProgress-getDateAwarded.patch diff --git a/patches/unapplied/server/Fix-NPE-in-SculkBloomEvent-world-access.patch b/patches/server/Fix-NPE-in-SculkBloomEvent-world-access.patch similarity index 100% rename from patches/unapplied/server/Fix-NPE-in-SculkBloomEvent-world-access.patch rename to patches/server/Fix-NPE-in-SculkBloomEvent-world-access.patch diff --git a/patches/unapplied/server/Fix-NPE-on-Allay-stopDancing-while-not-dancing.patch b/patches/server/Fix-NPE-on-Allay-stopDancing-while-not-dancing.patch similarity index 100% rename from patches/unapplied/server/Fix-NPE-on-Allay-stopDancing-while-not-dancing.patch rename to patches/server/Fix-NPE-on-Allay-stopDancing-while-not-dancing.patch diff --git a/patches/unapplied/server/Fix-NPE-on-Boat-getStatus.patch b/patches/server/Fix-NPE-on-Boat-getStatus.patch similarity index 100% rename from patches/unapplied/server/Fix-NPE-on-Boat-getStatus.patch rename to patches/server/Fix-NPE-on-Boat-getStatus.patch diff --git a/patches/unapplied/server/Fix-SpawnEggMeta-get-setSpawnedType.patch b/patches/server/Fix-SpawnEggMeta-get-setSpawnedType.patch similarity index 100% rename from patches/unapplied/server/Fix-SpawnEggMeta-get-setSpawnedType.patch rename to patches/server/Fix-SpawnEggMeta-get-setSpawnedType.patch diff --git a/patches/unapplied/server/Fix-UnsafeValues-loadAdvancement.patch b/patches/server/Fix-UnsafeValues-loadAdvancement.patch similarity index 93% rename from patches/unapplied/server/Fix-UnsafeValues-loadAdvancement.patch rename to patches/server/Fix-UnsafeValues-loadAdvancement.patch index 08c7ad7767a..33f1c9429d2 100644 --- a/patches/unapplied/server/Fix-UnsafeValues-loadAdvancement.patch +++ b/patches/server/Fix-UnsafeValues-loadAdvancement.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -0,0 +0,0 @@ public final class CraftMagicNumbers implements UnsafeValues { JsonElement jsonelement = ServerAdvancementManager.GSON.fromJson(advancement, JsonElement.class); - net.minecraft.advancements.Advancement nms = Util.getOrThrow(net.minecraft.advancements.Advancement.CODEC.parse(JsonOps.INSTANCE, jsonelement), JsonParseException::new); + net.minecraft.advancements.Advancement nms = net.minecraft.advancements.Advancement.CODEC.parse(JsonOps.INSTANCE, jsonelement).getOrThrow(JsonParseException::new); if (nms != null) { - MinecraftServer.getServer().getAdvancements().advancements.put(minecraftkey, new AdvancementHolder(minecraftkey, nms)); + // Paper start - Fix throw UnsupportedOperationException diff --git a/patches/unapplied/server/Fix-a-couple-of-upstream-bed-issues.patch b/patches/server/Fix-a-couple-of-upstream-bed-issues.patch similarity index 100% rename from patches/unapplied/server/Fix-a-couple-of-upstream-bed-issues.patch rename to patches/server/Fix-a-couple-of-upstream-bed-issues.patch diff --git a/patches/unapplied/server/Fix-advancement-triggers-for-entity-damage.patch b/patches/server/Fix-advancement-triggers-for-entity-damage.patch similarity index 93% rename from patches/unapplied/server/Fix-advancement-triggers-for-entity-damage.patch rename to patches/server/Fix-advancement-triggers-for-entity-damage.patch index 53a8bba9e90..95d8f38f6de 100644 --- a/patches/unapplied/server/Fix-advancement-triggers-for-entity-damage.patch +++ b/patches/server/Fix-advancement-triggers-for-entity-damage.patch @@ -14,9 +14,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/Interaction.java +++ b/src/main/java/net/minecraft/world/entity/Interaction.java @@ -0,0 +0,0 @@ public class Interaction extends Entity implements Attackable, Targeting { - if (entityhuman instanceof ServerPlayer) { - ServerPlayer entityplayer = (ServerPlayer) entityhuman; - + // CraftBukkit end + this.attack = new Interaction.PlayerAction(entityhuman.getUUID(), this.level().getGameTime()); + if (entityhuman instanceof ServerPlayer entityplayer) { - CriteriaTriggers.PLAYER_HURT_ENTITY.trigger(entityplayer, this, source, (float) event.getFinalDamage(), 1.0F, false); // CraftBukkit + CriteriaTriggers.PLAYER_HURT_ENTITY.trigger(entityplayer, this, entityhuman.damageSources().generic(), 1.0F, (float) event.getFinalDamage(), false); // CraftBukkit // Paper - use correct source and fix taken/dealt param order } diff --git a/patches/unapplied/server/Fix-block-place-logic.patch b/patches/server/Fix-block-place-logic.patch similarity index 92% rename from patches/unapplied/server/Fix-block-place-logic.patch rename to patches/server/Fix-block-place-logic.patch index 2438b0ad799..bf0fa067287 100644 --- a/patches/unapplied/server/Fix-block-place-logic.patch +++ b/patches/server/Fix-block-place-logic.patch @@ -18,14 +18,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - // world.playSound(entityhuman, blockposition, this.getPlaceSound(iblockdata1), SoundCategory.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F); + if (entityhuman == null) world.playSound(entityhuman, blockposition, this.getPlaceSound(iblockdata1), net.minecraft.sounds.SoundSource.BLOCKS, (soundeffecttype.getVolume() + 1.0F) / 2.0F, soundeffecttype.getPitch() * 0.8F); // Paper - Fix block place logic; reintroduce this for the dispenser (i.e the shulker) - world.gameEvent(GameEvent.BLOCK_PLACE, blockposition, GameEvent.Context.of(entityhuman, iblockdata1)); - if ((entityhuman == null || !entityhuman.getAbilities().instabuild) && itemstack != ItemStack.EMPTY) { // CraftBukkit - itemstack.shrink(1); + world.gameEvent((Holder) GameEvent.BLOCK_PLACE, blockposition, GameEvent.Context.of(entityhuman, iblockdata1)); + itemstack.consume(1, entityhuman); + return InteractionResult.sidedSuccess(world.isClientSide); diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -0,0 +0,0 @@ public final class ItemStack { +@@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder { if (tileentity instanceof JukeboxBlockEntity) { JukeboxBlockEntity tileentityjukebox = (JukeboxBlockEntity) tileentity; diff --git a/patches/unapplied/server/Fix-cmd-permission-levels-for-command-blocks.patch b/patches/server/Fix-cmd-permission-levels-for-command-blocks.patch similarity index 100% rename from patches/unapplied/server/Fix-cmd-permission-levels-for-command-blocks.patch rename to patches/server/Fix-cmd-permission-levels-for-command-blocks.patch diff --git a/patches/unapplied/server/Fix-crash-relating-to-bad-recipes-in-furnace-like-ti.patch b/patches/server/Fix-crash-relating-to-bad-recipes-in-furnace-like-ti.patch similarity index 100% rename from patches/unapplied/server/Fix-crash-relating-to-bad-recipes-in-furnace-like-ti.patch rename to patches/server/Fix-crash-relating-to-bad-recipes-in-furnace-like-ti.patch diff --git a/patches/unapplied/server/Fix-custom-statistic-criteria-creation.patch b/patches/server/Fix-custom-statistic-criteria-creation.patch similarity index 100% rename from patches/unapplied/server/Fix-custom-statistic-criteria-creation.patch rename to patches/server/Fix-custom-statistic-criteria-creation.patch diff --git a/patches/unapplied/server/Fix-demo-flag-not-enabling-demo-mode.patch b/patches/server/Fix-demo-flag-not-enabling-demo-mode.patch similarity index 87% rename from patches/unapplied/server/Fix-demo-flag-not-enabling-demo-mode.patch rename to patches/server/Fix-demo-flag-not-enabling-demo-mode.patch index 91ae016ea7e..42304321a96 100644 --- a/patches/unapplied/server/Fix-demo-flag-not-enabling-demo-mode.patch +++ b/patches/server/Fix-demo-flag-not-enabling-demo-mode.patch @@ -12,11 +12,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class Main { /* - dedicatedserver1.setPort((Integer) optionset.valueOf(optionspec10)); + dedicatedserver1.setPort((Integer) optionset.valueOf(optionspec11)); - dedicatedserver1.setDemo(optionset.has(optionspec2)); + */ -+ dedicatedserver1.setDemo(optionset.has("demo")); // Paper - Restore setting the demo mode ++ dedicatedserver1.setDemo(optionset.has("demo")); // Paper + /* - dedicatedserver1.setId((String) optionset.valueOf(optionspec11)); + dedicatedserver1.setId((String) optionset.valueOf(optionspec12)); */ - boolean flag1 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui"); + boolean flag2 = !optionset.has("nogui") && !optionset.nonOptionArguments().contains("nogui"); diff --git a/patches/unapplied/server/Fix-force-opening-enchantment-tables.patch b/patches/server/Fix-force-opening-enchantment-tables.patch similarity index 84% rename from patches/unapplied/server/Fix-force-opening-enchantment-tables.patch rename to patches/server/Fix-force-opening-enchantment-tables.patch index 2b9c898fc20..5b2a0099f78 100644 --- a/patches/unapplied/server/Fix-force-opening-enchantment-tables.patch +++ b/patches/server/Fix-force-opening-enchantment-tables.patch @@ -12,9 +12,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // If there isn't an enchant table we can force create one, won't be very useful though. BlockPos pos = CraftLocation.toBlockPosition(location); -- this.getHandle().openMenu(((EnchantmentTableBlock) Blocks.ENCHANTING_TABLE).getMenuProvider(null, this.getHandle().level(), pos)); +- this.getHandle().openMenu(Blocks.ENCHANTING_TABLE.defaultBlockState().getMenuProvider(this.getHandle().level(), pos)); + // Paper start -+ MenuProvider menuProvider = ((EnchantmentTableBlock) Blocks.ENCHANTING_TABLE).getMenuProvider(null, this.getHandle().level(), pos); ++ MenuProvider menuProvider = Blocks.ENCHANTING_TABLE.defaultBlockState().getMenuProvider(this.getHandle().level(), pos); + if (menuProvider == null) { + if (!force) { + return null; diff --git a/patches/unapplied/server/Fix-inconsistencies-in-dispense-events-regarding-sta.patch b/patches/server/Fix-inconsistencies-in-dispense-events-regarding-sta.patch similarity index 83% rename from patches/unapplied/server/Fix-inconsistencies-in-dispense-events-regarding-sta.patch rename to patches/server/Fix-inconsistencies-in-dispense-events-regarding-sta.patch index be658bd9f93..fdf8cfe6c0e 100644 --- a/patches/unapplied/server/Fix-inconsistencies-in-dispense-events-regarding-sta.patch +++ b/patches/server/Fix-inconsistencies-in-dispense-events-regarding-sta.patch @@ -8,44 +8,6 @@ item which is being dispensed. Before this fix, sometimes it was the whole stack before a single item had been taken. This fixes that so the stack size is always 1. -diff --git a/src/main/java/net/minecraft/core/dispenser/AbstractProjectileDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/AbstractProjectileDispenseBehavior.java -index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 ---- a/src/main/java/net/minecraft/core/dispenser/AbstractProjectileDispenseBehavior.java -+++ b/src/main/java/net/minecraft/core/dispenser/AbstractProjectileDispenseBehavior.java -@@ -0,0 +0,0 @@ public abstract class AbstractProjectileDispenseBehavior extends DefaultDispense - - // CraftBukkit start - // iprojectile.shoot((double) enumdirection.getStepX(), (double) ((float) enumdirection.getStepY() + 0.1F), (double) enumdirection.getStepZ(), this.getPower(), this.getUncertainty()); -- ItemStack itemstack1 = stack.split(1); -+ ItemStack itemstack1 = stack.copyWithCount(1); // Paper - shrink below and single item in event - org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos()); - CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); - -@@ -0,0 +0,0 @@ public abstract class AbstractProjectileDispenseBehavior extends DefaultDispense - } - - if (event.isCancelled()) { -- stack.grow(1); -+ // stack.grow(1); // Paper - shrink below - return stack; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { -- stack.grow(1); -+ shrink = false; // Paper - shrink below - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -@@ -0,0 +0,0 @@ public abstract class AbstractProjectileDispenseBehavior extends DefaultDispense - ((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity()); - // CraftBukkit end - worldserver.addFreshEntity(iprojectile); -- // itemstack.shrink(1); // CraftBukkit - Handled during event processing -+ if (shrink) stack.shrink(1); // Paper - actually handle here - return stack; - } - diff --git a/src/main/java/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/core/dispenser/BoatDispenseItemBehavior.java @@ -121,7 +83,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - // itemstack.shrink(1); // Handled during event processing + if (shrink) stack.shrink(1); // Paper - actually handle here // CraftBukkit end - pointer.level().gameEvent((Entity) null, GameEvent.ENTITY_PLACE, pointer.pos()); + pointer.level().gameEvent((Entity) null, (Holder) GameEvent.ENTITY_PLACE, pointer.pos()); return stack; @@ -0,0 +0,0 @@ public interface DispenseItemBehavior { ServerLevel worldserver = pointer.level(); @@ -149,7 +111,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); @@ -0,0 +0,0 @@ public interface DispenseItemBehavior { - ArmorStand entityarmorstand = (ArmorStand) EntityType.ARMOR_STAND.spawn(worldserver, stack.getTag(), consumer, blockposition, MobSpawnType.DISPENSER, false, false); + ArmorStand entityarmorstand = (ArmorStand) EntityType.ARMOR_STAND.spawn(worldserver, consumer, blockposition, MobSpawnType.DISPENSER, false, false); if (entityarmorstand != null) { - // itemstack.shrink(1); // CraftBukkit - Handled during event processing @@ -163,7 +125,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 // CraftBukkit start - ItemStack itemstack1 = stack.split(1); + ItemStack itemstack1 = stack.copyWithCount(1); // Paper - shrink below and single item in event - Level world = pointer.level(); + ServerLevel world = pointer.level(); org.bukkit.block.Block block = CraftBlock.at(world, pointer.pos()); CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); @@ -0,0 +0,0 @@ public interface DispenseItemBehavior { @@ -192,12 +154,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return stack; } else { @@ -0,0 +0,0 @@ public interface DispenseItemBehavior { - } while (!entityhorseabstract.isArmor(stack) || entityhorseabstract.isWearingArmor() || !entityhorseabstract.isTamed()); + } while (!entityhorseabstract.isBodyArmorItem(stack) || entityhorseabstract.isWearingBodyArmor() || !entityhorseabstract.isTamed()); // CraftBukkit start - ItemStack itemstack1 = stack.split(1); + ItemStack itemstack1 = stack.copyWithCount(1); // Paper - shrink below and single item in event - Level world = pointer.level(); + ServerLevel world = pointer.level(); org.bukkit.block.Block block = CraftBlock.at(world, pointer.pos()); CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); @@ -0,0 +0,0 @@ public interface DispenseItemBehavior { @@ -221,7 +183,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } + if (shrink) stack.shrink(1); // Paper - shrink here - entityhorseabstract.getSlot(401).set(CraftItemStack.asNMSCopy(event.getItem())); + entityhorseabstract.setBodyArmorItem(CraftItemStack.asNMSCopy(event.getItem())); // CraftBukkit end this.setSuccess(true); @@ -0,0 +0,0 @@ public interface DispenseItemBehavior { @@ -230,7 +192,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } while (!entityhorsechestedabstract.isTamed()); - ItemStack itemstack1 = stack.split(1); + ItemStack itemstack1 = stack.copyWithCount(1); // Paper - shrink below - Level world = pointer.level(); + ServerLevel world = pointer.level(); org.bukkit.block.Block block = CraftBlock.at(world, pointer.pos()); CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); @@ -0,0 +0,0 @@ public interface DispenseItemBehavior { @@ -256,74 +218,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.setSuccess(true); return stack; } -@@ -0,0 +0,0 @@ public interface DispenseItemBehavior { - Direction enumdirection = (Direction) pointer.state().getValue(DispenserBlock.FACING); - // CraftBukkit start - ServerLevel worldserver = pointer.level(); -- ItemStack itemstack1 = stack.split(1); -+ ItemStack itemstack1 = stack.copyWithCount(1); // Paper - shrink below and single item in event - org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos()); - CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); - -@@ -0,0 +0,0 @@ public interface DispenseItemBehavior { - } - - if (event.isCancelled()) { -- stack.grow(1); -+ // stack.grow(1); // Paper - shrink below - return stack; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { -- stack.grow(1); -+ shrink = false; // Paper - shrink below - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -@@ -0,0 +0,0 @@ public interface DispenseItemBehavior { - - entityfireworks.shoot((double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ(), 0.5F, 1.0F); - pointer.level().addFreshEntity(entityfireworks); -- // itemstack.shrink(1); // Handled during event processing -+ if (shrink) stack.shrink(1); // Paper - actually handle here - // CraftBukkit end - return stack; - } -@@ -0,0 +0,0 @@ public interface DispenseItemBehavior { - double d5 = randomsource.triangle((double) enumdirection.getStepZ(), 0.11485000000000001D); - - // CraftBukkit start -- ItemStack itemstack1 = stack.split(1); -+ ItemStack itemstack1 = stack.copyWithCount(1); // Paper - shrink below and single item in event - org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos()); - CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); - -@@ -0,0 +0,0 @@ public interface DispenseItemBehavior { - } - - if (event.isCancelled()) { -- stack.grow(1); -+ // stack.grow(1); // Paper - shrink at end - return stack; - } - -+ boolean shrink = true; // Paper - if (!event.getItem().equals(craftItem)) { -- stack.grow(1); -+ shrink = false; // Paper - shrink at end - // Chain to handler for new item - ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); - DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); -@@ -0,0 +0,0 @@ public interface DispenseItemBehavior { - entitysmallfireball.projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity()); - - worldserver.addFreshEntity(entitysmallfireball); -- // itemstack.shrink(1); // Handled during event processing -+ if (shrink) stack.shrink(1); // Paper - actually handle here - // CraftBukkit end - return stack; - } @@ -0,0 +0,0 @@ public interface DispenseItemBehavior { if (willEmptyContentsSolidBucketItem || willEmptyBucketItem) { // Paper end - correctly check if the bucket place will succeed @@ -388,7 +282,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public interface DispenseItemBehavior { worldserver.addFreshEntity(entitytntprimed); worldserver.playSound((Player) null, entitytntprimed.getX(), entitytntprimed.getY(), entitytntprimed.getZ(), SoundEvents.TNT_PRIMED, SoundSource.BLOCKS, 1.0F, 1.0F); - worldserver.gameEvent((Entity) null, GameEvent.ENTITY_PLACE, blockposition); + worldserver.gameEvent((Entity) null, (Holder) GameEvent.ENTITY_PLACE, blockposition); - // itemstack.shrink(1); // CraftBukkit - handled above + if (shrink) stack.shrink(1); // Paper - actually handle here return stack; @@ -421,6 +315,44 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 BlockDispenseEvent event = new BlockDispenseEvent(bukkitBlock, craftItem.clone(), new org.bukkit.util.Vector(blockposition.getX(), blockposition.getY(), blockposition.getZ())); if (!DispenserBlock.eventFired) { +diff --git a/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java ++++ b/src/main/java/net/minecraft/core/dispenser/ProjectileDispenseBehavior.java +@@ -0,0 +0,0 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior { + + // CraftBukkit start + // this.projectileItem.shoot(iprojectile, (double) enumdirection.getStepX(), (double) enumdirection.getStepY(), (double) enumdirection.getStepZ(), this.dispenseConfig.power(), this.dispenseConfig.uncertainty()); +- ItemStack itemstack1 = stack.split(1); ++ ItemStack itemstack1 = stack.copyWithCount(1); // Paper + org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos()); + CraftItemStack craftItem = CraftItemStack.asCraftMirror(itemstack1); + +@@ -0,0 +0,0 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior { + } + + if (event.isCancelled()) { +- stack.grow(1); ++ // stack.grow(1); // Paper - shrink below + return stack; + } + ++ boolean shrink = true; // Paper + if (!event.getItem().equals(craftItem)) { +- stack.grow(1); ++ shrink = false; // Paper - shrink below + // Chain to handler for new item + ItemStack eventStack = CraftItemStack.asNMSCopy(event.getItem()); + DispenseItemBehavior idispensebehavior = (DispenseItemBehavior) DispenserBlock.DISPENSER_REGISTRY.get(eventStack.getItem()); +@@ -0,0 +0,0 @@ public class ProjectileDispenseBehavior extends DefaultDispenseItemBehavior { + ((Entity) iprojectile).projectileSource = new org.bukkit.craftbukkit.projectiles.CraftBlockProjectileSource(pointer.blockEntity()); + // CraftBukkit end + worldserver.addFreshEntity(iprojectile); +- // itemstack.shrink(1); // CraftBukkit - Handled during event processing ++ if (shrink) stack.shrink(1); // Paper - actually handle here + return stack; + } + diff --git a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/core/dispenser/ShearsDispenseItemBehavior.java diff --git a/patches/unapplied/server/Fix-incorrect-crafting-result-amount-for-fireworks.patch b/patches/server/Fix-incorrect-crafting-result-amount-for-fireworks.patch similarity index 93% rename from patches/unapplied/server/Fix-incorrect-crafting-result-amount-for-fireworks.patch rename to patches/server/Fix-incorrect-crafting-result-amount-for-fireworks.patch index 12d47a0483c..fe680dee839 100644 --- a/patches/unapplied/server/Fix-incorrect-crafting-result-amount-for-fireworks.patch +++ b/patches/server/Fix-incorrect-crafting-result-amount-for-fireworks.patch @@ -12,7 +12,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class FireworkRocketRecipe extends CustomRecipe { @Override - public ItemStack getResultItem(RegistryAccess registryManager) { + public ItemStack getResultItem(HolderLookup.Provider registriesLookup) { - return new ItemStack(Items.FIREWORK_ROCKET); + return new ItemStack(Items.FIREWORK_ROCKET, 3); // Paper - Fix incorrect crafting result amount } diff --git a/patches/unapplied/server/Fix-inventories-returning-null-Locations.patch b/patches/server/Fix-inventories-returning-null-Locations.patch similarity index 100% rename from patches/unapplied/server/Fix-inventories-returning-null-Locations.patch rename to patches/server/Fix-inventories-returning-null-Locations.patch diff --git a/patches/unapplied/server/Fix-inventory-desync.patch b/patches/server/Fix-inventory-desync.patch similarity index 98% rename from patches/unapplied/server/Fix-inventory-desync.patch rename to patches/server/Fix-inventory-desync.patch index 14c9bd73630..70e8f50b9f2 100644 --- a/patches/unapplied/server/Fix-inventory-desync.patch +++ b/patches/server/Fix-inventory-desync.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti // CraftBukkit start - fire PlayerLeashEntityEvent if (CraftEventFactory.callPlayerLeashEntityEvent(this, player, player, hand).isCancelled()) { ((ServerPlayer) player).connection.send(new ClientboundSetEntityLinkPacket(this, this.getLeashHolder())); diff --git a/patches/unapplied/server/Fix-missing-map-initialize-event-call.patch b/patches/server/Fix-missing-map-initialize-event-call.patch similarity index 87% rename from patches/unapplied/server/Fix-missing-map-initialize-event-call.patch rename to patches/server/Fix-missing-map-initialize-event-call.patch index ea439a41b07..76b21fc7987 100644 --- a/patches/unapplied/server/Fix-missing-map-initialize-event-call.patch +++ b/patches/server/Fix-missing-map-initialize-event-call.patch @@ -13,9 +13,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { @Nullable @Override - public MapItemSavedData getMapData(String id) { + public MapItemSavedData getMapData(MapId id) { - // CraftBukkit start -- MapItemSavedData worldmap = (MapItemSavedData) this.getServer().overworld().getDataStorage().get(MapItemSavedData.factory(), id); +- MapItemSavedData worldmap = (MapItemSavedData) this.getServer().overworld().getDataStorage().get(MapItemSavedData.factory(), id.key()); - if (worldmap != null) { - worldmap.id = id; + // Paper start - Call missing map initialize event and set id @@ -23,8 +23,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + + final net.minecraft.world.level.saveddata.SavedData existing = storage.cache.get(id); + if (existing == null && !storage.cache.containsKey(id)) { -+ final net.minecraft.world.level.saveddata.SavedData.Factory factory = MapItemSavedData.factory(); -+ final MapItemSavedData map = storage.readSavedData(factory.deserializer(), factory.type(), id); ++ final MapItemSavedData worldmap = (MapItemSavedData) this.getServer().overworld().getDataStorage().get(MapItemSavedData.factory(), id.key()); + storage.cache.put(id, map); + if (map != null) { + map.id = id; diff --git a/patches/unapplied/server/Fix-possible-NPE-on-painting-creation.patch b/patches/server/Fix-possible-NPE-on-painting-creation.patch similarity index 100% rename from patches/unapplied/server/Fix-possible-NPE-on-painting-creation.patch rename to patches/server/Fix-possible-NPE-on-painting-creation.patch diff --git a/patches/unapplied/server/Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch b/patches/server/Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch similarity index 100% rename from patches/unapplied/server/Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch rename to patches/server/Fix-race-condition-on-UpgradeData.BlockFixers-class-.patch diff --git a/patches/unapplied/server/Fix-rotation-when-spawning-display-entities.patch b/patches/server/Fix-rotation-when-spawning-display-entities.patch similarity index 93% rename from patches/unapplied/server/Fix-rotation-when-spawning-display-entities.patch rename to patches/server/Fix-rotation-when-spawning-display-entities.patch index 089eeadd653..4ce3268c964 100644 --- a/patches/unapplied/server/Fix-rotation-when-spawning-display-entities.patch +++ b/patches/server/Fix-rotation-when-spawning-display-entities.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java @@ -0,0 +0,0 @@ public final class CraftEntityTypes { Vector direction = spawnData.location().getDirection().multiply(10); - entity.setDirection(direction.getX(), direction.getY(), direction.getZ()); + entity.assignPower(direction.getX(), direction.getY(), direction.getZ()); }; + private static final BiConsumer ROT = (spawnData, entity) -> entity.setRot(spawnData.yaw(), spawnData.pitch()); // Paper private static final Map, EntityTypeData> CLASS_TYPE_DATA = new HashMap<>(); @@ -29,4 +29,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + register(new EntityTypeData<>(EntityType.TEXT_DISPLAY, TextDisplay.class, CraftTextDisplay::new, combine(createAndSetPos(net.minecraft.world.entity.EntityType.TEXT_DISPLAY), ROT))); // Paper // MISC - register(new EntityTypeData<>(EntityType.DROPPED_ITEM, Item.class, CraftItem::new, spawnData -> { + register(new EntityTypeData<>(EntityType.ITEM, Item.class, CraftItem::new, spawnData -> { diff --git a/patches/unapplied/server/Fix-silent-equipment-change-for-mobs.patch b/patches/server/Fix-silent-equipment-change-for-mobs.patch similarity index 93% rename from patches/unapplied/server/Fix-silent-equipment-change-for-mobs.patch rename to patches/server/Fix-silent-equipment-change-for-mobs.patch index ec53232009c..2d33b32dc65 100644 --- a/patches/unapplied/server/Fix-silent-equipment-change-for-mobs.patch +++ b/patches/server/Fix-silent-equipment-change-for-mobs.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/n index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements Targeting { +@@ -0,0 +0,0 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti @Override public void setItemSlot(EquipmentSlot slot, ItemStack stack) { @@ -28,6 +28,13 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 case ARMOR: - this.onEquipItem(slot, (ItemStack) this.armorItems.set(slot.getIndex(), stack), stack); + this.onEquipItem(slot, (ItemStack) this.armorItems.set(slot.getIndex(), stack), stack, silent); // Paper - Fix silent equipment change + break; + case BODY: + ItemStack itemstack1 = this.bodyArmorItem; + + this.bodyArmorItem = stack; +- this.onEquipItem(slot, itemstack1, stack); ++ this.onEquipItem(slot, itemstack1, stack, silent); // Paper - Fix silent equipment change } } diff --git a/patches/unapplied/server/Fix-sniffer-removeExploredLocation.patch b/patches/server/Fix-sniffer-removeExploredLocation.patch similarity index 100% rename from patches/unapplied/server/Fix-sniffer-removeExploredLocation.patch rename to patches/server/Fix-sniffer-removeExploredLocation.patch diff --git a/patches/unapplied/server/Fix-spigot-s-Forced-Stats.patch b/patches/server/Fix-spigot-s-Forced-Stats.patch similarity index 100% rename from patches/unapplied/server/Fix-spigot-s-Forced-Stats.patch rename to patches/server/Fix-spigot-s-Forced-Stats.patch diff --git a/patches/unapplied/server/Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch b/patches/server/Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch similarity index 95% rename from patches/unapplied/server/Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch rename to patches/server/Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch index b11e629eb77..aeb2e546f38 100644 --- a/patches/unapplied/server/Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch +++ b/patches/server/Fix-spigot-sound-playing-for-BlockItem-ItemStacks.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -0,0 +0,0 @@ public final class ItemStack { +@@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder { // SPIGOT-1288 - play sound stripped from ItemBlock if (this.item instanceof BlockItem) { diff --git a/patches/unapplied/server/Fix-strikeLightningEffect-powers-lightning-rods-and-.patch b/patches/server/Fix-strikeLightningEffect-powers-lightning-rods-and-.patch similarity index 100% rename from patches/unapplied/server/Fix-strikeLightningEffect-powers-lightning-rods-and-.patch rename to patches/server/Fix-strikeLightningEffect-powers-lightning-rods-and-.patch diff --git a/patches/unapplied/server/Fix-team-sidebar-objectives-not-being-cleared.patch b/patches/server/Fix-team-sidebar-objectives-not-being-cleared.patch similarity index 100% rename from patches/unapplied/server/Fix-team-sidebar-objectives-not-being-cleared.patch rename to patches/server/Fix-team-sidebar-objectives-not-being-cleared.patch diff --git a/patches/unapplied/server/Fix-text-display-error-on-spawn.patch b/patches/server/Fix-text-display-error-on-spawn.patch similarity index 100% rename from patches/unapplied/server/Fix-text-display-error-on-spawn.patch rename to patches/server/Fix-text-display-error-on-spawn.patch diff --git a/patches/unapplied/server/Flying-Fall-Damage.patch b/patches/server/Flying-Fall-Damage.patch similarity index 96% rename from patches/unapplied/server/Flying-Fall-Damage.patch rename to patches/server/Flying-Fall-Damage.patch index 356229620c4..6c8b2884d3d 100644 --- a/patches/unapplied/server/Flying-Fall-Damage.patch +++ b/patches/server/Flying-Fall-Damage.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -0,0 +0,0 @@ public abstract class Player extends LivingEntity { - public FishingHook fishing; - public float hurtDir; // Paper - protected -> public + public Entity currentExplosionCause; + public boolean ignoreFallDamageFromCurrentImpulse; public boolean affectsSpawning = true; // Paper - Affects Spawning API + public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage diff --git a/patches/unapplied/server/Folia-scheduler-and-owned-region-API.patch b/patches/server/Folia-scheduler-and-owned-region-API.patch similarity index 99% rename from patches/unapplied/server/Folia-scheduler-and-owned-region-API.patch rename to patches/server/Folia-scheduler-and-owned-region-API.patch index 82c9c81d6de..37082a840a2 100644 --- a/patches/unapplied/server/Folia-scheduler-and-owned-region-API.patch +++ b/patches/server/Folia-scheduler-and-owned-region-API.patch @@ -1188,7 +1188,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public @org.jetbrains.annotations.Nullable net.minecraft.server.level.ChunkMap.TrackedEntity tracker; // Paper public CraftEntity getBukkitEntity() { if (this.bukkitEntity == null) { @@ -1213,7 +1213,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public CommandSender getBukkitSender(CommandSourceStack wrapper) { return this.getBukkitEntity(); -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public final void setRemoved(Entity.RemovalReason entity_removalreason, EntityRemoveEvent.Cause cause) { CraftEventFactory.callEntityRemoveEvent(this, cause); // CraftBukkit end @@ -1221,7 +1221,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.removalReason == null) { this.removalReason = entity_removalreason; } -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.getPassengers().forEach(Entity::stopRiding); this.levelCallback.onRemove(entity_removalreason); diff --git a/patches/unapplied/server/Implement-OfflinePlayer-isConnected.patch b/patches/server/Implement-OfflinePlayer-isConnected.patch similarity index 95% rename from patches/unapplied/server/Implement-OfflinePlayer-isConnected.patch rename to patches/server/Implement-OfflinePlayer-isConnected.patch index 3718c5f0169..eed854cceb3 100644 --- a/patches/unapplied/server/Implement-OfflinePlayer-isConnected.patch +++ b/patches/server/Implement-OfflinePlayer-isConnected.patch @@ -39,4 +39,4 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override public InetSocketAddress getAddress() { - if (this.getHandle().connection == null) return null; + if (this.getHandle().connection.protocol() == null) return null; diff --git a/patches/unapplied/server/Implement-PlayerFailMoveEvent.patch b/patches/server/Implement-PlayerFailMoveEvent.patch similarity index 95% rename from patches/unapplied/server/Implement-PlayerFailMoveEvent.patch rename to patches/server/Implement-PlayerFailMoveEvent.patch index 03a71c4b253..502f67d71db 100644 --- a/patches/unapplied/server/Implement-PlayerFailMoveEvent.patch +++ b/patches/server/Implement-PlayerFailMoveEvent.patch @@ -60,22 +60,24 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 d8 = d2 - this.player.getZ(); d10 = d6 * d6 + d7 * d7 + d8 * d8; -- boolean flag2 = false; +- boolean flag3 = false; + boolean movedWrongly = false; // Paper - Add fail move event; rename if (!this.player.isChangingDimension() && d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot -- flag2 = true; +- flag3 = true; + // Paper start - Add fail move event + io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_WRONGLY, + toX, toY, toZ, toYaw, toPitch, true); + if (!event.isAllowed()) { + movedWrongly = true; + if (event.getLogWarning()) ++ // Paper end ServerGamePacketListenerImpl.LOGGER.warn("{} moved wrongly!", this.player.getName().getString()); -+ } ++ } // Paper } -- if (!this.player.noPhysics && !this.player.isSleeping() && (flag2 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb, d0, d1, d2))) { +- if (!this.player.noPhysics && !this.player.isSleeping() && (flag3 && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb, d0, d1, d2))) { ++ // Paper start - Add fail move event + boolean teleportBack = !this.player.noPhysics && !this.player.isSleeping() && (movedWrongly && worldserver.noCollision(this.player, axisalignedbb) || this.isPlayerCollidingWithAnythingNew(worldserver, axisalignedbb, d0, d1, d2)); + if (teleportBack) { + io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.CLIPPED_INTO_BLOCK, @@ -85,7 +87,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } + } + if (teleportBack) { -+ // Paper end - Add fail move event ++ // Paper end - Add fail move event this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet()); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet. this.player.doCheckFallDamage(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5, packet.isOnGround()); } else { diff --git a/patches/unapplied/server/Improve-PortalEvents.patch b/patches/server/Improve-PortalEvents.patch similarity index 93% rename from patches/unapplied/server/Improve-PortalEvents.patch rename to patches/server/Improve-PortalEvents.patch index b65d1c71227..af29395d342 100644 --- a/patches/unapplied/server/Improve-PortalEvents.patch +++ b/patches/server/Improve-PortalEvents.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess Location enter = bukkitEntity.getLocation(); Location exit = CraftLocation.toBukkit(exitPosition, exitWorldServer.getWorld()); diff --git a/patches/unapplied/server/Improve-logging-and-errors.patch b/patches/server/Improve-logging-and-errors.patch similarity index 96% rename from patches/unapplied/server/Improve-logging-and-errors.patch rename to patches/server/Improve-logging-and-errors.patch index 395917aabaf..07e823030ea 100644 --- a/patches/unapplied/server/Improve-logging-and-errors.patch +++ b/patches/server/Improve-logging-and-errors.patch @@ -86,10 +86,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java +++ b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java @@ -0,0 +0,0 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { - return entry1.getValue(); // CraftBukkit // Paper - decompile fix - *shrugs internally* // todo: is this needed anymore? - })); - this.byName = Maps.newHashMap(builder.build()); // CraftBukkit -- RecipeManager.LOGGER.info("Loaded {} recipes", map1.size()); + this.byType = LinkedHashMultimap.create(builder.build()); + this.byName = Maps.newHashMap(com_google_common_collect_immutablemap_builder.build()); + // CraftBukkit end +- RecipeManager.LOGGER.info("Loaded {} recipes", this.byType.size()); + RecipeManager.LOGGER.info("Loaded {} recipes", this.byName.size()); // Paper - Improve logging and errors; log correct number of recipes } diff --git a/patches/unapplied/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch b/patches/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch similarity index 100% rename from patches/unapplied/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch rename to patches/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch diff --git a/patches/unapplied/server/More-DragonBattle-API.patch b/patches/server/More-DragonBattle-API.patch similarity index 100% rename from patches/unapplied/server/More-DragonBattle-API.patch rename to patches/server/More-DragonBattle-API.patch diff --git a/patches/unapplied/server/More-accurate-isInOpenWater-impl.patch b/patches/server/More-accurate-isInOpenWater-impl.patch similarity index 100% rename from patches/unapplied/server/More-accurate-isInOpenWater-impl.patch rename to patches/server/More-accurate-isInOpenWater-impl.patch diff --git a/patches/unapplied/server/Only-capture-actual-tree-growth.patch b/patches/server/Only-capture-actual-tree-growth.patch similarity index 98% rename from patches/unapplied/server/Only-capture-actual-tree-growth.patch rename to patches/server/Only-capture-actual-tree-growth.patch index 667bfd159b1..e1e9ac18cc2 100644 --- a/patches/unapplied/server/Only-capture-actual-tree-growth.patch +++ b/patches/server/Only-capture-actual-tree-growth.patch @@ -20,7 +20,7 @@ diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java -@@ -0,0 +0,0 @@ public final class ItemStack { +@@ -0,0 +0,0 @@ public final class ItemStack implements DataComponentHolder { for (CraftBlockState blockstate : blocks) { // SPIGOT-7572 - Move fix for SPIGOT-7248 to CapturedBlockState, to allow bees in bee nest CapturedBlockState.setBlockState(blockstate); diff --git a/patches/unapplied/server/Only-erase-allay-memory-on-non-item-targets.patch b/patches/server/Only-erase-allay-memory-on-non-item-targets.patch similarity index 100% rename from patches/unapplied/server/Only-erase-allay-memory-on-non-item-targets.patch rename to patches/server/Only-erase-allay-memory-on-non-item-targets.patch diff --git a/patches/unapplied/server/Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch b/patches/server/Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch similarity index 100% rename from patches/unapplied/server/Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch rename to patches/server/Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch diff --git a/patches/unapplied/server/Only-tick-item-frames-if-players-can-see-it.patch b/patches/server/Only-tick-item-frames-if-players-can-see-it.patch similarity index 90% rename from patches/unapplied/server/Only-tick-item-frames-if-players-can-see-it.patch rename to patches/server/Only-tick-item-frames-if-players-can-see-it.patch index 29acf8973bc..4d5169d57a1 100644 --- a/patches/unapplied/server/Only-tick-item-frames-if-players-can-see-it.patch +++ b/patches/server/Only-tick-item-frames-if-players-can-see-it.patch @@ -13,8 +13,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Entity entity = this.entity; -- if (entity instanceof ItemFrame) { +- if (entity instanceof ItemFrame entityitemframe) { + if (!this.trackedPlayers.isEmpty() && entity instanceof ItemFrame) { // Paper - Perf: Only tick item frames if players can see it - ItemFrame entityitemframe = (ItemFrame) entity; - if (true || this.tickCount % 10 == 0) { // CraftBukkit - Moved below, should always enter this block + ItemStack itemstack = entityitemframe.getItem(); + diff --git a/patches/unapplied/server/Optimize-VarInts.patch b/patches/server/Optimize-VarInts.patch similarity index 100% rename from patches/unapplied/server/Optimize-VarInts.patch rename to patches/server/Optimize-VarInts.patch diff --git a/patches/unapplied/server/Optimize-nearest-structure-border-iteration.patch b/patches/server/Optimize-nearest-structure-border-iteration.patch similarity index 100% rename from patches/unapplied/server/Optimize-nearest-structure-border-iteration.patch rename to patches/server/Optimize-nearest-structure-border-iteration.patch diff --git a/patches/unapplied/server/Optimize-player-lookups-for-beacons.patch b/patches/server/Optimize-player-lookups-for-beacons.patch similarity index 100% rename from patches/unapplied/server/Optimize-player-lookups-for-beacons.patch rename to patches/server/Optimize-player-lookups-for-beacons.patch diff --git a/patches/unapplied/server/Prevent-GameEvents-being-fired-from-unloaded-chunks.patch b/patches/server/Prevent-GameEvents-being-fired-from-unloaded-chunks.patch similarity index 91% rename from patches/unapplied/server/Prevent-GameEvents-being-fired-from-unloaded-chunks.patch rename to patches/server/Prevent-GameEvents-being-fired-from-unloaded-chunks.patch index 58e30ef1d1b..57db0faac4c 100644 --- a/patches/unapplied/server/Prevent-GameEvents-being-fired-from-unloaded-chunks.patch +++ b/patches/server/Prevent-GameEvents-being-fired-from-unloaded-chunks.patch @@ -11,7 +11,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public class ServerLevel extends Level implements WorldGenLevel { @Override - public void gameEvent(GameEvent event, Vec3 emitterPos, GameEvent.Context emitter) { + public void gameEvent(Holder event, Vec3 emitterPos, GameEvent.Context emitter) { + // Paper start - Prevent GameEvents being fired from unloaded chunks + if (this.getChunkIfLoadedImmediately((Mth.floor(emitterPos.x) >> 4), (Mth.floor(emitterPos.z) >> 4)) == null) { + return; diff --git a/patches/unapplied/server/Prevent-causing-expired-keys-from-impacting-new-join.patch b/patches/server/Prevent-causing-expired-keys-from-impacting-new-join.patch similarity index 98% rename from patches/unapplied/server/Prevent-causing-expired-keys-from-impacting-new-join.patch rename to patches/server/Prevent-causing-expired-keys-from-impacting-new-join.patch index c534ced4d90..46af8940cc6 100644 --- a/patches/unapplied/server/Prevent-causing-expired-keys-from-impacting-new-join.patch +++ b/patches/server/Prevent-causing-expired-keys-from-impacting-new-join.patch @@ -50,7 +50,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + } - public void resetPosition() { + private int getMaximumFlyingTicks(Entity vehicle) { @@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private void resetPlayerChatState(RemoteChatSession session) { diff --git a/patches/unapplied/server/Properly-handle-BlockBreakEvent-isDropItems.patch b/patches/server/Properly-handle-BlockBreakEvent-isDropItems.patch similarity index 97% rename from patches/unapplied/server/Properly-handle-BlockBreakEvent-isDropItems.patch rename to patches/server/Properly-handle-BlockBreakEvent-isDropItems.patch index c2cb1a3f479..e9e6cb86b3b 100644 --- a/patches/unapplied/server/Properly-handle-BlockBreakEvent-isDropItems.patch +++ b/patches/server/Properly-handle-BlockBreakEvent-isDropItems.patch @@ -35,9 +35,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 - super.playerDestroy(world, player, pos, state, blockEntity, tool); + public void playerDestroy(Level world, Player player, BlockPos pos, BlockState state, @Nullable BlockEntity blockEntity, ItemStack tool, boolean includeDrops, boolean dropExp) { // Paper - fix drops not preventing stats/food exhaustion + super.playerDestroy(world, player, pos, state, blockEntity, tool, includeDrops, dropExp); // Paper - fix drops not preventing stats/food exhaustion - if (!world.isClientSide && blockEntity instanceof BeehiveBlockEntity) { - BeehiveBlockEntity tileentitybeehive = (BeehiveBlockEntity) blockEntity; - + if (!world.isClientSide && blockEntity instanceof BeehiveBlockEntity tileentitybeehive) { + if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) == 0) { + tileentitybeehive.emptyAllLivingFromHive(player, state, BeehiveBlockEntity.BeeReleaseStatus.EMERGENCY); diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java diff --git a/patches/unapplied/server/Refresh-ProjectileSource-for-projectiles.patch b/patches/server/Refresh-ProjectileSource-for-projectiles.patch similarity index 97% rename from patches/unapplied/server/Refresh-ProjectileSource-for-projectiles.patch rename to patches/server/Refresh-ProjectileSource-for-projectiles.patch index cbd47de4835..1366e580a0d 100644 --- a/patches/unapplied/server/Refresh-ProjectileSource-for-projectiles.patch +++ b/patches/server/Refresh-ProjectileSource-for-projectiles.patch @@ -17,7 +17,7 @@ diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/jav index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -0,0 +0,0 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S +@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess public boolean inWorld = false; public boolean generation; public int maxAirTicks = this.getDefaultMaxAirSupply(); // CraftBukkit - SPIGOT-6907: re-implement LivingEntity#setMaximumAir() diff --git a/patches/unapplied/server/Remove-CraftItemStack-setAmount-null-assignment.patch b/patches/server/Remove-CraftItemStack-setAmount-null-assignment.patch similarity index 100% rename from patches/unapplied/server/Remove-CraftItemStack-setAmount-null-assignment.patch rename to patches/server/Remove-CraftItemStack-setAmount-null-assignment.patch diff --git a/patches/unapplied/server/Remove-UpgradeData-neighbour-ticks-outside-of-range.patch b/patches/server/Remove-UpgradeData-neighbour-ticks-outside-of-range.patch similarity index 100% rename from patches/unapplied/server/Remove-UpgradeData-neighbour-ticks-outside-of-range.patch rename to patches/server/Remove-UpgradeData-neighbour-ticks-outside-of-range.patch diff --git a/patches/unapplied/server/Respect-randomizeData-on-more-entities-when-spawning.patch b/patches/server/Respect-randomizeData-on-more-entities-when-spawning.patch similarity index 80% rename from patches/unapplied/server/Respect-randomizeData-on-more-entities-when-spawning.patch rename to patches/server/Respect-randomizeData-on-more-entities-when-spawning.patch index 8ebce149153..60668d43aa4 100644 --- a/patches/unapplied/server/Respect-randomizeData-on-more-entities-when-spawning.patch +++ b/patches/server/Respect-randomizeData-on-more-entities-when-spawning.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntityTypes.java @@ -0,0 +0,0 @@ public final class CraftEntityTypes { - entity.setDirection(direction.getX(), direction.getY(), direction.getZ()); + entity.assignPower(direction.getX(), direction.getY(), direction.getZ()); }; private static final BiConsumer ROT = (spawnData, entity) -> entity.setRot(spawnData.yaw(), spawnData.pitch()); // Paper + // Paper start - respect randomizeData @@ -44,15 +44,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 entity.setItem(CraftItemStack.asNMSCopy(new ItemStack(Material.SPLASH_POTION, 1))); return entity; })); -- register(new EntityTypeData<>(EntityType.PRIMED_TNT, TNTPrimed.class, CraftTNTPrimed::new, spawnData -> new PrimedTnt(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), null))); -+ register(new EntityTypeData<>(EntityType.PRIMED_TNT, TNTPrimed.class, CraftTNTPrimed::new, combine(spawnData -> new PrimedTnt(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), null), CLEAR_MOVE_IF_NOT_RANDOMIZED))); // Paper - respect randomizeData +- register(new EntityTypeData<>(EntityType.TNT, TNTPrimed.class, CraftTNTPrimed::new, spawnData -> new PrimedTnt(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), null))); ++ register(new EntityTypeData<>(EntityType.TNT, TNTPrimed.class, CraftTNTPrimed::new, combine(spawnData -> new PrimedTnt(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), null), CLEAR_MOVE_IF_NOT_RANDOMIZED))); // Paper - respect randomizeData register(new EntityTypeData<>(EntityType.FALLING_BLOCK, FallingBlock.class, CraftFallingBlock::new, spawnData -> { BlockPos pos = BlockPos.containing(spawnData.x(), spawnData.y(), spawnData.z()); return new FallingBlockEntity(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), spawnData.world().getBlockState(pos)); // Paper - create falling block entities correctly })); -- register(new EntityTypeData<>(EntityType.FIREWORK, Firework.class, CraftFirework::new, spawnData -> new FireworkRocketEntity(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), net.minecraft.world.item.ItemStack.EMPTY))); +- register(new EntityTypeData<>(EntityType.FIREWORK_ROCKET, Firework.class, CraftFirework::new, spawnData -> new FireworkRocketEntity(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), net.minecraft.world.item.ItemStack.EMPTY))); + // Paper start - respect randomizeData -+ register(new EntityTypeData<>(EntityType.FIREWORK, Firework.class, CraftFirework::new, spawnData -> { ++ register(new EntityTypeData<>(EntityType.FIREWORK_ROCKET, Firework.class, CraftFirework::new, spawnData -> { + FireworkRocketEntity entity = new FireworkRocketEntity(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), net.minecraft.world.item.ItemStack.EMPTY); + if (!spawnData.randomizeData()) { + // logic below was taken from FireworkRocketEntity constructor @@ -64,5 +64,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + })); + // Paper end - respect randomizeData register(new EntityTypeData<>(EntityType.EVOKER_FANGS, EvokerFangs.class, CraftEvokerFangs::new, spawnData -> new net.minecraft.world.entity.projectile.EvokerFangs(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z(), (float) Math.toRadians(spawnData.yaw()), 0, null))); - register(new EntityTypeData<>(EntityType.MINECART_COMMAND, CommandMinecart.class, CraftMinecartCommand::new, spawnData -> new MinecartCommandBlock(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z()))); + register(new EntityTypeData<>(EntityType.COMMAND_BLOCK_MINECART, CommandMinecart.class, CraftMinecartCommand::new, spawnData -> new MinecartCommandBlock(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z()))); register(new EntityTypeData<>(EntityType.MINECART, RideableMinecart.class, CraftMinecartRideable::new, spawnData -> new Minecart(spawnData.minecraftWorld(), spawnData.x(), spawnData.y(), spawnData.z()))); diff --git a/patches/unapplied/server/SculkCatalyst-bloom-API.patch b/patches/server/SculkCatalyst-bloom-API.patch similarity index 93% rename from patches/unapplied/server/SculkCatalyst-bloom-API.patch rename to patches/server/SculkCatalyst-bloom-API.patch index 985698cb35d..4e58b912f03 100644 --- a/patches/unapplied/server/SculkCatalyst-bloom-API.patch +++ b/patches/server/SculkCatalyst-bloom-API.patch @@ -11,8 +11,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSculkCatalyst.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSculkCatalyst.java @@ -0,0 +0,0 @@ public class CraftSculkCatalyst extends CraftBlockEntityState RULE_DO_VINES_SPREAD = GameRules.register("doVinesSpread", GameRules.Category.UPDATES, GameRules.BooleanValue.create(true)); - public static final GameRules.Key RULE_ENDER_PEARLS_VANISH_ON_DEATH = GameRules.register("enderPearlsVanishOnDeath", GameRules.Category.PLAYER, GameRules.BooleanValue.create(true)); + worldserver.setDefaultSpawnPos(worldserver.getSharedSpawnPos(), worldserver.getSharedSpawnAngle()); + })); private final Map, GameRules.Value> rules; + private final GameRules.Value[] gameruleArray; // Paper - Perf: Use array for gamerule storage diff --git a/patches/unapplied/server/Use-correct-seed-on-api-world-load.patch b/patches/server/Use-correct-seed-on-api-world-load.patch similarity index 92% rename from patches/unapplied/server/Use-correct-seed-on-api-world-load.patch rename to patches/server/Use-correct-seed-on-api-world-load.patch index 2fb8319cd05..7d025e98a59 100644 --- a/patches/unapplied/server/Use-correct-seed-on-api-world-load.patch +++ b/patches/server/Use-correct-seed-on-api-world-load.patch @@ -9,7 +9,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -0,0 +0,0 @@ public final class CraftServer implements Server { - net.minecraft.server.Main.forceUpgrade(worldSession, DataFixers.getDataFixer(), this.console.options.has("eraseCache"), () -> true, iregistry); + net.minecraft.server.Main.forceUpgrade(worldSession, DataFixers.getDataFixer(), this.console.options.has("eraseCache"), () -> true, iregistrycustom_dimension, this.console.options.has("recreateRegionFiles")); } - long j = BiomeManager.obfuscateSeed(creator.seed()); diff --git a/patches/unapplied/server/Use-correct-source-for-mushroom-block-spread-event.patch b/patches/server/Use-correct-source-for-mushroom-block-spread-event.patch similarity index 100% rename from patches/unapplied/server/Use-correct-source-for-mushroom-block-spread-event.patch rename to patches/server/Use-correct-source-for-mushroom-block-spread-event.patch diff --git a/patches/unapplied/server/Use-single-player-info-update-packet-on-join.patch b/patches/server/Use-single-player-info-update-packet-on-join.patch similarity index 100% rename from patches/unapplied/server/Use-single-player-info-update-packet-on-join.patch rename to patches/server/Use-single-player-info-update-packet-on-join.patch diff --git a/patches/unapplied/server/Win-Screen-API.patch b/patches/server/Win-Screen-API.patch similarity index 100% rename from patches/unapplied/server/Win-Screen-API.patch rename to patches/server/Win-Screen-API.patch diff --git a/patches/unapplied/server/config-for-disabling-entity-tag-tags.patch b/patches/server/config-for-disabling-entity-tag-tags.patch similarity index 57% rename from patches/unapplied/server/config-for-disabling-entity-tag-tags.patch rename to patches/server/config-for-disabling-entity-tag-tags.patch index 12d0270053e..fcf49489275 100644 --- a/patches/unapplied/server/config-for-disabling-entity-tag-tags.patch +++ b/patches/server/config-for-disabling-entity-tag-tags.patch @@ -9,16 +9,19 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/net/minecraft/world/entity/EntityType.java +++ b/src/main/java/net/minecraft/world/entity/EntityType.java @@ -0,0 +0,0 @@ public class EntityType implements FeatureElement, EntityTypeT - if (world.isClientSide || !entity.onlyOpCanSetNbt() || player != null && minecraftserver.getPlayerList().isOp(player.getGameProfile())) { - CompoundTag nbttagcompound1 = entity.saveWithoutId(new CompoundTag()); - UUID uuid = entity.getUUID(); + + if (minecraftserver != null && entity != null) { + if (world.isClientSide || !entity.onlyOpCanSetNbt() || player != null && minecraftserver.getPlayerList().isOp(player.getGameProfile())) { + // Paper start - filter out protected tags + if (player == null || !player.getBukkitEntity().hasPermission("minecraft.nbt.place")) { -+ for (net.minecraft.commands.arguments.NbtPathArgument.NbtPath tag : world.paperConfig().entities.spawning.filteredEntityTagNbtPaths) { -+ tag.remove(itemNbt.getCompound("EntityTag")); -+ } ++ nbt = nbt.update((compound) -> { ++ for (net.minecraft.commands.arguments.NbtPathArgument.NbtPath tag : world.paperConfig().entities.spawning.filteredEntityTagNbtPaths) { ++ tag.remove(compound); ++ } ++ }); + } + // Paper end - filter out protected tags - - nbttagcompound1.merge(itemNbt.getCompound("EntityTag")); - entity.setUUID(uuid); ++ + nbt.loadInto(entity); + } + } diff --git a/patches/unapplied/server/fix-MapLike-spam-for-missing-key-selector.patch b/patches/server/fix-MapLike-spam-for-missing-key-selector.patch similarity index 93% rename from patches/unapplied/server/fix-MapLike-spam-for-missing-key-selector.patch rename to patches/server/fix-MapLike-spam-for-missing-key-selector.patch index 34b6b8addca..fa101421d0f 100644 --- a/patches/unapplied/server/fix-MapLike-spam-for-missing-key-selector.patch +++ b/patches/server/fix-MapLike-spam-for-missing-key-selector.patch @@ -10,7 +10,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 +++ b/src/main/java/net/minecraft/world/level/gameevent/vibrations/VibrationSystem.java @@ -0,0 +0,0 @@ public interface VibrationSystem { public static Codec CODEC = RecordCodecBuilder.create((instance) -> { - return instance.group(VibrationInfo.CODEC.optionalFieldOf("event").forGetter((vibrationsystem_a) -> { + return instance.group(VibrationInfo.CODEC.lenientOptionalFieldOf("event").forGetter((vibrationsystem_a) -> { return Optional.ofNullable(vibrationsystem_a.currentVibration); - }), VibrationSelector.CODEC.fieldOf("selector").forGetter(VibrationSystem.Data::getSelectionStrategy), ExtraCodecs.NON_NEGATIVE_INT.fieldOf("event_delay").orElse(0).forGetter(VibrationSystem.Data::getTravelTimeInTicks)).apply(instance, (optional, vibrationselector, integer) -> { + }), Codec.optionalField("selector", VibrationSelector.CODEC).xmap(o -> o.orElseGet(VibrationSelector::new), Optional::of).forGetter(VibrationSystem.Data::getSelectionStrategy), ExtraCodecs.NON_NEGATIVE_INT.fieldOf("event_delay").orElse(0).forGetter(VibrationSystem.Data::getTravelTimeInTicks)).apply(instance, (optional, vibrationselector, integer) -> { // Paper - fix MapLike spam for missing "selector" in 1.19.2 diff --git a/patches/unapplied/server/fix-item-meta-for-tadpole-buckets.patch b/patches/server/fix-item-meta-for-tadpole-buckets.patch similarity index 100% rename from patches/unapplied/server/fix-item-meta-for-tadpole-buckets.patch rename to patches/server/fix-item-meta-for-tadpole-buckets.patch diff --git a/patches/unapplied/server/remove-duplicate-animate-packet-for-records.patch b/patches/server/remove-duplicate-animate-packet-for-records.patch similarity index 100% rename from patches/unapplied/server/remove-duplicate-animate-packet-for-records.patch rename to patches/server/remove-duplicate-animate-packet-for-records.patch diff --git a/patches/unapplied/server/Fix-concurrenct-access-to-lookups-field-in-RegistryO.patch b/removed-patches-1-20-5/0876-Fix-concurrenct-access-to-lookups-field-in-RegistryO.patch similarity index 100% rename from patches/unapplied/server/Fix-concurrenct-access-to-lookups-field-in-RegistryO.patch rename to removed-patches-1-20-5/0876-Fix-concurrenct-access-to-lookups-field-in-RegistryO.patch diff --git a/patches/unapplied/server/Array-backed-synched-entity-data.patch b/removed-patches-1-20-5/0896-Array-backed-synched-entity-data.patch similarity index 100% rename from patches/unapplied/server/Array-backed-synched-entity-data.patch rename to removed-patches-1-20-5/0896-Array-backed-synched-entity-data.patch diff --git a/patches/unapplied/server/Deep-clone-unhandled-nbt-tags.patch b/removed-patches-1-20-5/0931-Deep-clone-unhandled-nbt-tags.patch similarity index 100% rename from patches/unapplied/server/Deep-clone-unhandled-nbt-tags.patch rename to removed-patches-1-20-5/0931-Deep-clone-unhandled-nbt-tags.patch diff --git a/patches/unapplied/server/Use-correct-variable-for-initializing-CraftLootTable.patch b/removed-patches-1-20-5/0955-Use-correct-variable-for-initializing-CraftLootTable.patch similarity index 100% rename from patches/unapplied/server/Use-correct-variable-for-initializing-CraftLootTable.patch rename to removed-patches-1-20-5/0955-Use-correct-variable-for-initializing-CraftLootTable.patch