Update to Minecraft 1.21.2

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-10-23 02:15:00 +11:00
parent 2c4beb962b
commit d3a23f42c3
522 changed files with 8501 additions and 6477 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/inventory/ContainerSmithing.java
+++ b/net/minecraft/world/inventory/ContainerSmithing.java
@@ -14,6 +14,8 @@
@@ -18,6 +18,8 @@
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.IBlockData;
@@ -9,39 +9,39 @@
public class ContainerSmithing extends ContainerAnvilAbstract {
public static final int TEMPLATE_SLOT = 0;
@@ -29,6 +31,9 @@
@Nullable
private RecipeHolder<SmithingRecipe> selectedRecipe;
private final List<RecipeHolder<SmithingRecipe>> recipes;
@@ -34,6 +36,9 @@
private final RecipePropertySet templateItemTest;
private final RecipePropertySet additionItemTest;
private final ContainerProperty hasRecipeError;
+ // CraftBukkit start
+ private CraftInventoryView bukkitEntity;
+ // CraftBukkit end
public ContainerSmithing(int i, PlayerInventory playerinventory) {
this(i, playerinventory, ContainerAccess.NULL);
@@ -103,7 +108,7 @@
List<RecipeHolder<SmithingRecipe>> list = this.level.getRecipeManager().getRecipesFor(Recipes.SMITHING, smithingrecipeinput, this.level);
@@ -117,7 +122,7 @@
public void createResult() {
SmithingRecipeInput smithingrecipeinput = this.createRecipeInput();
World world = this.level;
- Optional optional;
+ Optional<RecipeHolder<SmithingRecipe>> optional; // CraftBukkit - decompile error
if (list.isEmpty()) {
- this.resultSlots.setItem(0, ItemStack.EMPTY);
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), ItemStack.EMPTY); // CraftBukkit
} else {
RecipeHolder<SmithingRecipe> recipeholder = (RecipeHolder) list.get(0);
if (world instanceof WorldServer worldserver) {
optional = worldserver.recipeAccess().getRecipeFor(Recipes.SMITHING, smithingrecipeinput, worldserver);
@@ -129,7 +134,9 @@
ItemStack itemstack = ((SmithingRecipe) recipeholder.value()).assemble(smithingrecipeinput, this.level.registryAccess());
@@ -111,7 +116,9 @@
if (itemstack.isItemEnabled(this.level.enabledFeatures())) {
this.selectedRecipe = recipeholder;
this.resultSlots.setRecipeUsed(recipeholder);
- this.resultSlots.setItem(0, itemstack);
+ // CraftBukkit start
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), itemstack);
+ // CraftBukkit end
}
}
@@ -143,4 +150,18 @@
return !this.getSlot(i).hasItem();
}).findFirst();
this.resultSlots.setRecipeUsed(recipeholder);
- this.resultSlots.setItem(0, itemstack);
+ // CraftBukkit start
+ org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), itemstack);
+ // CraftBukkit end
}, () -> {
this.resultSlots.setRecipeUsed((RecipeHolder) null);
this.resultSlots.setItem(0, ItemStack.EMPTY);
@@ -149,4 +156,18 @@
public boolean hasRecipeError() {
return this.hasRecipeError.get() > 0;
}
+
+ // CraftBukkit start