From fdf4e8726b11a5139e4392c73b4a4dc25d660fda Mon Sep 17 00:00:00 2001 From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Date: Fri, 22 Sep 2023 18:59:52 +0200 Subject: [PATCH] more work all server patches done (almost) --- .../API-for-an-entity-s-scoreboard-name.patch | 0 .../API-for-updating-recipes-on-clients.patch | 0 .../server/Add-Listing-API-for-Player.patch | 6 ++-- .../server/Add-PlayerPickItemEvent.patch | 2 +- ...sing-InventoryHolders-to-inventories.patch | 4 +-- ...ot-sanity-checks-in-container-clicks.patch | 0 ...-titleOverride-to-InventoryOpenEvent.patch | 0 .../server/Add-whitelist-events.patch | 0 ...proper-checking-of-empty-item-stacks.patch | 0 .../server/Allow-trident-custom-damage.patch | 0 .../server/Bandaid-fix-for-Effect.patch | 0 .../server/Cache-map-ids-on-item-frames.patch | 0 ...all-BlockRedstoneEvents-for-lecterns.patch | 0 ...ntity-tracking-range-by-Y-coordinate.patch | 4 +-- .../Configure-sniffer-egg-hatch-time.patch | 0 .../Deep-clone-unhandled-nbt-tags.patch | 0 ...place-methods-with-old-StructureType.patch | 0 ...nd-water-fluid-explosion-resistance-.patch | 0 ...l-proximity-check-before-entity-look.patch | 0 ...te-namespaced-commands-if-send-names.patch | 2 +- .../server/Don-t-tick-signs.patch | 0 .../server/Expand-Pose-API.patch | 0 ...enceOrb-should-call-EntitySpawnEvent.patch | 0 ...ed-BlockFace-during-BlockDamageEvent.patch | 0 ...xpose-hand-during-BlockCanBuildEvent.patch | 0 ...-entity-death-event-for-ender-dragon.patch | 0 .../server/Fix-BanList-API.patch | 0 .../server/Fix-NPE-on-Boat-getStatus.patch | 0 ...x-custom-statistic-criteria-creation.patch | 0 .../server/Fix-inventory-desync.patch | 0 ...ix-possible-NPE-on-painting-creation.patch | 0 ...ation-when-spawning-display-entities.patch | 0 ...Fix-silent-equipment-change-for-mobs.patch | 0 .../server/Fix-spigot-s-Forced-Stats.patch | 0 .../Implement-OfflinePlayer-isConnected.patch | 0 .../Implement-PlayerFailMoveEvent.patch | 12 ++++---- ...ng-PreCreatureSpawnEvent-with-per-pl.patch | 0 .../Improve-performance-of-mass-crafts.patch | 28 +++++++++---------- ...st-throw-both-Spread-and-Grow-Events.patch | 0 .../server/More-DragonBattle-API.patch | 0 .../Only-capture-actual-tree-growth.patch | 0 ...ase-allay-memory-on-non-item-targets.patch | 0 ...Timer-for-Wandering-Traders-spawned-.patch | 0 ...e-nearest-structure-border-iteration.patch | 0 ...y-handle-BlockBreakEvent-isDropItems.patch | 0 ...ata-neighbour-ticks-outside-of-range.patch | 0 ...eData-on-more-entities-when-spawning.patch | 0 .../server/SculkCatalyst-bloom-API.patch | 0 ...Skip-POI-finding-if-stuck-in-vehicle.patch | 0 ...Suppress-Item-Meta-Validation-Checks.patch | 2 +- .../Use-correct-seed-on-api-world-load.patch | 0 ...urce-for-mushroom-block-spread-event.patch | 0 ...nfigurable-Region-Compression-Format.patch | 0 53 files changed, 30 insertions(+), 30 deletions(-) rename patches/{unapplied => }/server/API-for-an-entity-s-scoreboard-name.patch (100%) rename patches/{unapplied => }/server/API-for-updating-recipes-on-clients.patch (100%) rename patches/{unapplied => }/server/Add-Listing-API-for-Player.patch (95%) rename patches/{unapplied => }/server/Add-PlayerPickItemEvent.patch (96%) rename patches/{unapplied => }/server/Add-missing-InventoryHolders-to-inventories.patch (99%) rename patches/{unapplied => }/server/Add-slot-sanity-checks-in-container-clicks.patch (100%) rename patches/{unapplied => }/server/Add-titleOverride-to-InventoryOpenEvent.patch (100%) rename patches/{unapplied => }/server/Add-whitelist-events.patch (100%) rename patches/{unapplied => }/server/Allow-proper-checking-of-empty-item-stacks.patch (100%) rename patches/{unapplied => }/server/Allow-trident-custom-damage.patch (100%) rename patches/{unapplied => }/server/Bandaid-fix-for-Effect.patch (100%) rename patches/{unapplied => }/server/Cache-map-ids-on-item-frames.patch (100%) rename patches/{unapplied => }/server/Call-BlockRedstoneEvents-for-lecterns.patch (100%) rename patches/{unapplied => }/server/Configurable-entity-tracking-range-by-Y-coordinate.patch (88%) rename patches/{unapplied => }/server/Configure-sniffer-egg-hatch-time.patch (100%) rename patches/{unapplied => }/server/Deep-clone-unhandled-nbt-tags.patch (100%) rename patches/{unapplied => }/server/Deprecate-and-replace-methods-with-old-StructureType.patch (100%) rename patches/{unapplied => }/server/Determine-lava-and-water-fluid-explosion-resistance-.patch (100%) rename patches/{unapplied => }/server/Do-crystal-portal-proximity-check-before-entity-look.patch (100%) rename patches/{unapplied => }/server/Don-t-tab-complete-namespaced-commands-if-send-names.patch (95%) rename patches/{unapplied => }/server/Don-t-tick-signs.patch (100%) rename patches/{unapplied => }/server/Expand-Pose-API.patch (100%) rename patches/{unapplied => }/server/ExperienceOrb-should-call-EntitySpawnEvent.patch (100%) rename patches/{unapplied => }/server/Expose-clicked-BlockFace-during-BlockDamageEvent.patch (100%) rename patches/{unapplied => }/server/Expose-hand-during-BlockCanBuildEvent.patch (100%) rename patches/{unapplied => }/server/Fire-entity-death-event-for-ender-dragon.patch (100%) rename patches/{unapplied => }/server/Fix-BanList-API.patch (100%) rename patches/{unapplied => }/server/Fix-NPE-on-Boat-getStatus.patch (100%) rename patches/{unapplied => }/server/Fix-custom-statistic-criteria-creation.patch (100%) rename patches/{unapplied => }/server/Fix-inventory-desync.patch (100%) rename patches/{unapplied => }/server/Fix-possible-NPE-on-painting-creation.patch (100%) rename patches/{unapplied => }/server/Fix-rotation-when-spawning-display-entities.patch (100%) rename patches/{unapplied => }/server/Fix-silent-equipment-change-for-mobs.patch (100%) rename patches/{unapplied => }/server/Fix-spigot-s-Forced-Stats.patch (100%) rename patches/{unapplied => }/server/Implement-OfflinePlayer-isConnected.patch (100%) rename patches/{unapplied => }/server/Implement-PlayerFailMoveEvent.patch (92%) rename patches/{unapplied => }/server/Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch (100%) rename patches/{unapplied => }/server/Improve-performance-of-mass-crafts.patch (72%) rename patches/{unapplied => }/server/Make-Amethyst-throw-both-Spread-and-Grow-Events.patch (100%) rename patches/{unapplied => }/server/More-DragonBattle-API.patch (100%) rename patches/{unapplied => }/server/Only-capture-actual-tree-growth.patch (100%) rename patches/{unapplied => }/server/Only-erase-allay-memory-on-non-item-targets.patch (100%) rename patches/{unapplied => }/server/Only-set-despawnTimer-for-Wandering-Traders-spawned-.patch (100%) rename patches/{unapplied => }/server/Optimize-nearest-structure-border-iteration.patch (100%) rename patches/{unapplied => }/server/Properly-handle-BlockBreakEvent-isDropItems.patch (100%) rename patches/{unapplied => }/server/Remove-UpgradeData-neighbour-ticks-outside-of-range.patch (100%) rename patches/{unapplied => }/server/Respect-randomizeData-on-more-entities-when-spawning.patch (100%) rename patches/{unapplied => }/server/SculkCatalyst-bloom-API.patch (100%) rename patches/{unapplied => }/server/Skip-POI-finding-if-stuck-in-vehicle.patch (100%) rename patches/{unapplied => }/server/Suppress-Item-Meta-Validation-Checks.patch (98%) rename patches/{unapplied => }/server/Use-correct-seed-on-api-world-load.patch (100%) rename patches/{unapplied => }/server/Use-correct-source-for-mushroom-block-spread-event.patch (100%) rename patches/unapplied/{server => skipped}/Configurable-Region-Compression-Format.patch (100%) 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 100% rename from patches/unapplied/server/API-for-updating-recipes-on-clients.patch rename to patches/server/API-for-updating-recipes-on-clients.patch diff --git a/patches/unapplied/server/Add-Listing-API-for-Player.patch b/patches/server/Add-Listing-API-for-Player.patch similarity index 95% rename from patches/unapplied/server/Add-Listing-API-for-Player.patch rename to patches/server/Add-Listing-API-for-Player.patch index 718bfd0b4c..6ca22cbff7 100644 --- a/patches/unapplied/server/Add-Listing-API-for-Player.patch +++ b/patches/server/Add-Listing-API-for-Player.patch @@ -57,14 +57,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.entries = buf.readList((buf2) -> { @@ -0,0 +0,0 @@ public class ClientboundPlayerInfoUpdatePacket implements Packet parseresults = this.server.getCommands().getDispatcher().parse(stringreader, this.player.createCommandSourceStack()); this.server.getCommands().getDispatcher().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { diff --git a/patches/unapplied/server/Don-t-tick-signs.patch b/patches/server/Don-t-tick-signs.patch similarity index 100% rename from patches/unapplied/server/Don-t-tick-signs.patch rename to patches/server/Don-t-tick-signs.patch diff --git a/patches/unapplied/server/Expand-Pose-API.patch b/patches/server/Expand-Pose-API.patch similarity index 100% rename from patches/unapplied/server/Expand-Pose-API.patch rename to patches/server/Expand-Pose-API.patch 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-clicked-BlockFace-during-BlockDamageEvent.patch b/patches/server/Expose-clicked-BlockFace-during-BlockDamageEvent.patch similarity index 100% rename from patches/unapplied/server/Expose-clicked-BlockFace-during-BlockDamageEvent.patch rename to patches/server/Expose-clicked-BlockFace-during-BlockDamageEvent.patch diff --git a/patches/unapplied/server/Expose-hand-during-BlockCanBuildEvent.patch b/patches/server/Expose-hand-during-BlockCanBuildEvent.patch similarity index 100% rename from patches/unapplied/server/Expose-hand-during-BlockCanBuildEvent.patch rename to patches/server/Expose-hand-during-BlockCanBuildEvent.patch 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-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-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-inventory-desync.patch b/patches/server/Fix-inventory-desync.patch similarity index 100% rename from patches/unapplied/server/Fix-inventory-desync.patch rename to patches/server/Fix-inventory-desync.patch 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-rotation-when-spawning-display-entities.patch b/patches/server/Fix-rotation-when-spawning-display-entities.patch similarity index 100% rename from patches/unapplied/server/Fix-rotation-when-spawning-display-entities.patch rename to patches/server/Fix-rotation-when-spawning-display-entities.patch 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 100% rename from patches/unapplied/server/Fix-silent-equipment-change-for-mobs.patch rename to patches/server/Fix-silent-equipment-change-for-mobs.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/Implement-OfflinePlayer-isConnected.patch b/patches/server/Implement-OfflinePlayer-isConnected.patch similarity index 100% rename from patches/unapplied/server/Implement-OfflinePlayer-isConnected.patch rename to patches/server/Implement-OfflinePlayer-isConnected.patch diff --git a/patches/unapplied/server/Implement-PlayerFailMoveEvent.patch b/patches/server/Implement-PlayerFailMoveEvent.patch similarity index 92% rename from patches/unapplied/server/Implement-PlayerFailMoveEvent.patch rename to patches/server/Implement-PlayerFailMoveEvent.patch index 8b1bdd601e..c8537b4dae 100644 --- a/patches/unapplied/server/Implement-PlayerFailMoveEvent.patch +++ b/patches/server/Implement-PlayerFailMoveEvent.patch @@ -8,7 +8,7 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListener index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl double d0 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX(this.player.getX())); final double toX = d0; // Paper - OBFHELPER double d1 = ServerGamePacketListenerImpl.clampVertical(packet.getY(this.player.getY())); final double toY = d1; double d2 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ(this.player.getZ())); final double toZ = d2; // Paper - OBFHELPER @@ -19,7 +19,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (this.player.isPassenger()) { this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1); -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } // Paper start - Prevent moving into unloaded chunks if (this.player.level().paperConfig().chunks.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position())))) { @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Paper end -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (d10 - d9 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { // CraftBukkit end @@ -51,7 +51,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } } -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl boolean flag2 = false; if (!this.player.isChangingDimension() && d10 > org.spigotmc.SpigotConfig.movedWronglyThreshold && !this.player.isSleeping() && !this.player.gameMode.isCreative() && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR) { // Spigot @@ -67,7 +67,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // Paper start - optimise out extra getCubes -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (didCollide || !axisalignedbb.equals(newBox)) { // note: only call after setLocation, or else getBoundingBox is wrong teleportBack = this.hasNewCollision(worldserver, this.player, axisalignedbb, newBox); @@ -83,7 +83,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } // else: no collision at all detected, why do we care? } if (!this.player.noPhysics && !this.player.isSleeping() && teleportBack) { // Paper end - optimise out extra getCubes -@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl implements ServerPlayerConnection, Tic +@@ -0,0 +0,0 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } } diff --git a/patches/unapplied/server/Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch b/patches/server/Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch similarity index 100% rename from patches/unapplied/server/Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch rename to patches/server/Improve-cancelling-PreCreatureSpawnEvent-with-per-pl.patch diff --git a/patches/unapplied/server/Improve-performance-of-mass-crafts.patch b/patches/server/Improve-performance-of-mass-crafts.patch similarity index 72% rename from patches/unapplied/server/Improve-performance-of-mass-crafts.patch rename to patches/server/Improve-performance-of-mass-crafts.patch index 851d88bcf1..6c5a43d00f 100644 --- a/patches/unapplied/server/Improve-performance-of-mass-crafts.patch +++ b/patches/server/Improve-performance-of-mass-crafts.patch @@ -27,12 +27,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (!world.isClientSide) { ServerPlayer entityplayer = (ServerPlayer) player; ItemStack itemstack = ItemStack.EMPTY; -- Optional optional = world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world); -+ final Recipe currentRecipe = craftingInventory.getCurrentRecipe(); // Paper - check last recipe used first -+ Optional optional = currentRecipe == null ? world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world) : world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world, currentRecipe.getId()).map(com.mojang.datafixers.util.Pair::getSecond); // Paper - check last recipe used first +- Optional> optional = world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world); ++ final RecipeHolder currentRecipe = craftingInventory.getCurrentRecipe(); // Paper - check last recipe used first ++ Optional> optional = currentRecipe == null ? world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world) : world.getServer().getRecipeManager().getRecipeFor(RecipeType.CRAFTING, craftingInventory, world, currentRecipe.id()).map(com.mojang.datafixers.util.Pair::getSecond); // Paper - check last recipe used first if (optional.isPresent()) { - CraftingRecipe recipecrafting = (CraftingRecipe) optional.get(); + RecipeHolder recipeholder = (RecipeHolder) optional.get(); diff --git a/src/main/java/net/minecraft/world/inventory/ResultSlot.java b/src/main/java/net/minecraft/world/inventory/ResultSlot.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/world/inventory/ResultSlot.java @@ -42,7 +42,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 public void onTake(Player player, ItemStack stack) { this.checkTakeAchievements(stack); - NonNullList nonNullList = player.level().getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, this.craftSlots, player.level()); -+ NonNullList nonNullList = player.level().getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, this.craftSlots, player.level(), this.craftSlots.getCurrentRecipe() != null ? this.craftSlots.getCurrentRecipe().getId() : null); // Paper - check last recipe used first ++ NonNullList nonNullList = player.level().getRecipeManager().getRemainingItemsFor(RecipeType.CRAFTING, this.craftSlots, player.level(), this.craftSlots.getCurrentRecipe() != null ? this.craftSlots.getCurrentRecipe().id() : null); // Paper - check last recipe used first for(int i = 0; i < nonNullList.size(); ++i) { ItemStack itemStack = this.craftSlots.getItem(i); @@ -51,33 +51,33 @@ 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 { - T t0 = map.get(id); // CraftBukkit - decompile error + RecipeHolder recipeholder = (RecipeHolder) map.get(id); - if (t0 != null && t0.matches(inventory, world)) { -+ inventory.setCurrentRecipe(t0); // Paper - return Optional.of(Pair.of(id, t0)); + if (recipeholder != null && recipeholder.value().matches(inventory, world)) { ++ inventory.setCurrentRecipe(recipeholder); // Paper + return Optional.of(Pair.of(id, recipeholder)); } } + inventory.setCurrentRecipe(null); // Paper - clear before it might be set again return map.entrySet().stream().filter((entry) -> { - return ((Recipe) entry.getValue()).matches(inventory, world); + return ((RecipeHolder) entry.getValue()).value().matches(inventory, world); }).findFirst().map((entry) -> { + inventory.setCurrentRecipe(entry.getValue()); // Paper - return Pair.of((ResourceLocation) entry.getKey(), entry.getValue()); // CraftBukkit - decompile error + return Pair.of((ResourceLocation) entry.getKey(), (RecipeHolder) entry.getValue()); }); } @@ -0,0 +0,0 @@ public class RecipeManager extends SimpleJsonResourceReloadListener { } public > NonNullList getRemainingItemsFor(RecipeType type, C inventory, Level world) { -- Optional optional = this.getRecipeFor(type, inventory, world); +- Optional> optional = this.getRecipeFor(type, inventory, world); + // Paper start - check last recipe used first + return this.getRemainingItemsFor(type, inventory, world, null); + } + public > NonNullList getRemainingItemsFor(RecipeType type, C inventory, Level world, @Nullable ResourceLocation firstToCheck) { -+ Optional optional = firstToCheck == null ? this.getRecipeFor(type, inventory, world) : this.getRecipeFor(type, inventory, world, firstToCheck).map(Pair::getSecond); ++ Optional> optional = firstToCheck == null ? this.getRecipeFor(type, inventory, world) : this.getRecipeFor(type, inventory, world, firstToCheck).map(Pair::getSecond); + // Paper end if (optional.isPresent()) { - return ((Recipe) optional.get()).getRemainingItems(inventory); + return ((RecipeHolder) optional.get()).value().getRemainingItems(inventory); 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/Only-capture-actual-tree-growth.patch b/patches/server/Only-capture-actual-tree-growth.patch similarity index 100% rename from patches/unapplied/server/Only-capture-actual-tree-growth.patch rename to patches/server/Only-capture-actual-tree-growth.patch 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/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/Properly-handle-BlockBreakEvent-isDropItems.patch b/patches/server/Properly-handle-BlockBreakEvent-isDropItems.patch similarity index 100% rename from patches/unapplied/server/Properly-handle-BlockBreakEvent-isDropItems.patch rename to patches/server/Properly-handle-BlockBreakEvent-isDropItems.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 100% 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 diff --git a/patches/unapplied/server/SculkCatalyst-bloom-API.patch b/patches/server/SculkCatalyst-bloom-API.patch similarity index 100% rename from patches/unapplied/server/SculkCatalyst-bloom-API.patch rename to patches/server/SculkCatalyst-bloom-API.patch diff --git a/patches/unapplied/server/Skip-POI-finding-if-stuck-in-vehicle.patch b/patches/server/Skip-POI-finding-if-stuck-in-vehicle.patch similarity index 100% rename from patches/unapplied/server/Skip-POI-finding-if-stuck-in-vehicle.patch rename to patches/server/Skip-POI-finding-if-stuck-in-vehicle.patch diff --git a/patches/unapplied/server/Suppress-Item-Meta-Validation-Checks.patch b/patches/server/Suppress-Item-Meta-Validation-Checks.patch similarity index 98% rename from patches/unapplied/server/Suppress-Item-Meta-Validation-Checks.patch rename to patches/server/Suppress-Item-Meta-Validation-Checks.patch index 945fd5c81f..38eed3aec0 100644 --- a/patches/unapplied/server/Suppress-Item-Meta-Validation-Checks.patch +++ b/patches/server/Suppress-Item-Meta-Validation-Checks.patch @@ -78,7 +78,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_COMPOUND)) { this.setProfile(NbtUtils.readGameProfile(tag.getCompound(SKULL_OWNER.NBT))); } else if (tag.contains(SKULL_OWNER.NBT, CraftMagicNumbers.NBT.TAG_STRING) && !tag.getString(SKULL_OWNER.NBT).isEmpty()) { - this.setProfile(new GameProfile(null, tag.getString(SKULL_OWNER.NBT))); + this.setProfile(new CraftGameProfile(null, tag.getString(SKULL_OWNER.NBT))); } + } catch (Exception ignored) {} // Paper 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 100% 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 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/Configurable-Region-Compression-Format.patch b/patches/unapplied/skipped/Configurable-Region-Compression-Format.patch similarity index 100% rename from patches/unapplied/server/Configurable-Region-Compression-Format.patch rename to patches/unapplied/skipped/Configurable-Region-Compression-Format.patch