1.21.5
Co-authored-by: Bjarne Koll <git@lynxplay.dev> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> Co-authored-by: MiniDigger | Martin <admin@minidigger.dev> Co-authored-by: Nassim Jahnke <nassim@njahnke.dev> Co-authored-by: Noah van der Aa <ndvdaa@gmail.com> Co-authored-by: Owen1212055 <23108066+Owen1212055@users.noreply.github.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Spottedleaf <Spottedleaf@users.noreply.github.com> Co-authored-by: Tamion <70228790+notTamion@users.noreply.github.com> Co-authored-by: Warrior <50800980+Warriorrrr@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
--- a/net/minecraft/world/item/crafting/Recipe.java
|
||||
+++ b/net/minecraft/world/item/crafting/Recipe.java
|
||||
@@ -44,4 +_,6 @@
|
||||
@@ -46,4 +_,6 @@
|
||||
}
|
||||
|
||||
RecipeBookCategory recipeBookCategory();
|
||||
|
||||
@@ -1,32 +1,31 @@
|
||||
--- a/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
|
||||
+++ b/net/minecraft/world/item/crafting/SmithingTransformRecipe.java
|
||||
@@ -21,8 +_,15 @@
|
||||
final ItemStack result;
|
||||
final TransmuteResult result;
|
||||
@Nullable
|
||||
private PlacementInfo placementInfo;
|
||||
+ final boolean copyDataComponents; // Paper - Option to prevent data components copy
|
||||
|
||||
public SmithingTransformRecipe(Optional<Ingredient> template, Optional<Ingredient> base, Optional<Ingredient> addition, ItemStack result) {
|
||||
+ // Paper start - Option to prevent data components copy
|
||||
public SmithingTransformRecipe(Optional<Ingredient> template, Ingredient base, Optional<Ingredient> addition, TransmuteResult result) {
|
||||
+ // Paper start - Option to prevent data components copy
|
||||
+ this(template, base, addition, result, true);
|
||||
+ }
|
||||
+ public SmithingTransformRecipe(Optional<Ingredient> template, Optional<Ingredient> base, Optional<Ingredient> addition, ItemStack result, boolean copyDataComponents) {
|
||||
+ public SmithingTransformRecipe(Optional<Ingredient> template, Ingredient base, Optional<Ingredient> addition, TransmuteResult result, boolean copyDataComponents) {
|
||||
+ this.copyDataComponents = copyDataComponents;
|
||||
+ // Paper end - Option to prevent data components copy
|
||||
+ // Paper end - Option to prevent data components copy
|
||||
this.template = template;
|
||||
this.base = base;
|
||||
this.addition = addition;
|
||||
@@ -32,7 +_,9 @@
|
||||
@@ -31,7 +_,7 @@
|
||||
|
||||
@Override
|
||||
public ItemStack assemble(SmithingRecipeInput input, HolderLookup.Provider registries) {
|
||||
ItemStack itemStack = input.base().transmuteCopy(this.result.getItem(), this.result.getCount());
|
||||
+ if (this.copyDataComponents) { // Paper - Option to prevent data components copy
|
||||
itemStack.applyComponents(this.result.getComponentsPatch());
|
||||
+ } // Paper - Option to prevent data components copy
|
||||
return itemStack;
|
||||
- return this.result.apply(input.base());
|
||||
+ return this.result.apply(input.base(), this.copyDataComponents); // Paper - Option to prevent data components copy
|
||||
}
|
||||
|
||||
@@ -77,6 +_,17 @@
|
||||
@Override
|
||||
@@ -75,6 +_,17 @@
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -34,7 +33,7 @@
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public org.bukkit.inventory.Recipe toBukkitRecipe(org.bukkit.NamespacedKey id) {
|
||||
+ org.bukkit.craftbukkit.inventory.CraftItemStack result = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(this.result);
|
||||
+ org.bukkit.craftbukkit.inventory.CraftItemStack result = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(new ItemStack(this.result.item(), this.result.count(), this.result.components()));
|
||||
+
|
||||
+ org.bukkit.craftbukkit.inventory.CraftSmithingTransformRecipe recipe = new org.bukkit.craftbukkit.inventory.CraftSmithingTransformRecipe(id, result, org.bukkit.craftbukkit.inventory.CraftRecipe.toBukkit(this.template), org.bukkit.craftbukkit.inventory.CraftRecipe.toBukkit(this.base), org.bukkit.craftbukkit.inventory.CraftRecipe.toBukkit(this.addition), this.copyDataComponents); // Paper - Option to prevent data components copy
|
||||
+
|
||||
|
||||
@@ -1,48 +1,48 @@
|
||||
--- a/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
|
||||
+++ b/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
|
||||
@@ -27,8 +_,15 @@
|
||||
final Optional<Ingredient> addition;
|
||||
@@ -28,8 +_,15 @@
|
||||
final Holder<TrimPattern> pattern;
|
||||
@Nullable
|
||||
private PlacementInfo placementInfo;
|
||||
+ final boolean copyDataComponents; // Paper - Option to prevent data components copy
|
||||
|
||||
public SmithingTrimRecipe(Optional<Ingredient> template, Optional<Ingredient> base, Optional<Ingredient> addition) {
|
||||
public SmithingTrimRecipe(Ingredient template, Ingredient base, Ingredient addition, Holder<TrimPattern> pattern) {
|
||||
+ // Paper start - Option to prevent data components copy
|
||||
+ this(template, base, addition, true);
|
||||
+ this(template, base, addition, pattern, true);
|
||||
+ }
|
||||
+ public SmithingTrimRecipe(Optional<Ingredient> template, Optional<Ingredient> base, Optional<Ingredient> addition, boolean copyDataComponents) {
|
||||
+ public SmithingTrimRecipe(Ingredient template, Ingredient base, Ingredient addition, Holder<TrimPattern> pattern, final boolean copyDataComponents) {
|
||||
+ this.copyDataComponents = copyDataComponents;
|
||||
+ // Paper end - Option to prevent data components copy
|
||||
this.template = template;
|
||||
this.base = base;
|
||||
this.addition = addition;
|
||||
@@ -36,10 +_,15 @@
|
||||
@@ -38,10 +_,15 @@
|
||||
|
||||
@Override
|
||||
public ItemStack assemble(SmithingRecipeInput input, HolderLookup.Provider registries) {
|
||||
- return applyTrim(registries, input.base(), input.addition(), input.template());
|
||||
+ return applyTrim(registries, input.base(), input.addition(), input.template(), this.copyDataComponents); // Paper - Option to prevent data components copy
|
||||
- return applyTrim(registries, input.base(), input.addition(), this.pattern);
|
||||
+ return applyTrim(registries, input.base(), input.addition(), this.pattern, this.copyDataComponents); // Paper start - Option to prevent data components copy
|
||||
}
|
||||
|
||||
public static ItemStack applyTrim(HolderLookup.Provider registries, ItemStack base, ItemStack addition, ItemStack template) {
|
||||
+ // Paper start - Option to prevent data components copy
|
||||
+ return applyTrim(registries, base, addition, template, true);
|
||||
public static ItemStack applyTrim(HolderLookup.Provider registries, ItemStack base, ItemStack addition, Holder<TrimPattern> pattern) {
|
||||
+ // Paper start - Option to prevent data components copy
|
||||
+ return applyTrim(registries, base, addition, pattern, true);
|
||||
+ }
|
||||
+ public static ItemStack applyTrim(HolderLookup.Provider registries, ItemStack base, ItemStack addition, ItemStack template, boolean copyDataComponents) {
|
||||
+ // Paper end - Option to prevent data components copy
|
||||
Optional<Holder.Reference<TrimMaterial>> fromIngredient = TrimMaterials.getFromIngredient(registries, addition);
|
||||
Optional<Holder.Reference<TrimPattern>> fromTemplate = TrimPatterns.getFromTemplate(registries, template);
|
||||
if (fromIngredient.isPresent() && fromTemplate.isPresent()) {
|
||||
@@ -47,7 +_,7 @@
|
||||
if (armorTrim != null && armorTrim.hasPatternAndMaterial(fromTemplate.get(), fromIngredient.get())) {
|
||||
+ public static ItemStack applyTrim(HolderLookup.Provider registries, ItemStack base, ItemStack addition, Holder<TrimPattern> pattern, final boolean copyDataComponents) {
|
||||
+ // Paper end - Option to prevent data components copy
|
||||
Optional<Holder<TrimMaterial>> fromIngredient = TrimMaterials.getFromIngredient(registries, addition);
|
||||
if (fromIngredient.isPresent()) {
|
||||
ArmorTrim armorTrim = base.get(DataComponents.TRIM);
|
||||
@@ -49,7 +_,7 @@
|
||||
if (Objects.equals(armorTrim, armorTrim1)) {
|
||||
return ItemStack.EMPTY;
|
||||
} else {
|
||||
- ItemStack itemStack = base.copyWithCount(1);
|
||||
+ ItemStack itemStack = copyDataComponents ? base.copyWithCount(1) : new ItemStack(base.getItem(), 1); // Paper - Option to prevent data components copy
|
||||
itemStack.set(DataComponents.TRIM, new ArmorTrim(fromIngredient.get(), fromTemplate.get()));
|
||||
itemStack.set(DataComponents.TRIM, armorTrim1);
|
||||
return itemStack;
|
||||
}
|
||||
@@ -100,6 +_,13 @@
|
||||
@@ -102,6 +_,13 @@
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -50,7 +50,7 @@
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public org.bukkit.inventory.Recipe toBukkitRecipe(org.bukkit.NamespacedKey id) {
|
||||
+ return new org.bukkit.craftbukkit.inventory.CraftSmithingTrimRecipe(id, org.bukkit.craftbukkit.inventory.CraftRecipe.toBukkit(this.template), org.bukkit.craftbukkit.inventory.CraftRecipe.toBukkit(this.base), org.bukkit.craftbukkit.inventory.CraftRecipe.toBukkit(this.addition), this.copyDataComponents); // Paper - Option to prevent data components copy
|
||||
+ return new org.bukkit.craftbukkit.inventory.CraftSmithingTrimRecipe(id, org.bukkit.craftbukkit.inventory.CraftRecipe.toBukkit(this.template), org.bukkit.craftbukkit.inventory.CraftRecipe.toBukkit(this.base), org.bukkit.craftbukkit.inventory.CraftRecipe.toBukkit(this.addition), org.bukkit.craftbukkit.inventory.trim.CraftTrimPattern.minecraftHolderToBukkit(this.pattern), this.copyDataComponents); // Paper - Option to prevent data components copy
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
--- a/net/minecraft/world/item/crafting/TransmuteRecipe.java
|
||||
+++ b/net/minecraft/world/item/crafting/TransmuteRecipe.java
|
||||
@@ -88,6 +_,13 @@
|
||||
@@ -85,6 +_,13 @@
|
||||
);
|
||||
}
|
||||
|
||||
+ // CraftBukkit start
|
||||
+ @Override
|
||||
+ public org.bukkit.inventory.Recipe toBukkitRecipe(org.bukkit.NamespacedKey id) {
|
||||
+ return new org.bukkit.craftbukkit.inventory.CraftTransmuteRecipe(id, org.bukkit.craftbukkit.inventory.CraftItemType.minecraftToBukkit(this.result.value()), org.bukkit.craftbukkit.inventory.CraftRecipe.toBukkit(this.input), org.bukkit.craftbukkit.inventory.CraftRecipe.toBukkit(this.material));
|
||||
+ return new org.bukkit.craftbukkit.inventory.CraftTransmuteRecipe(id, org.bukkit.craftbukkit.inventory.CraftItemType.minecraftToBukkit(this.result.item().value()), org.bukkit.craftbukkit.inventory.CraftRecipe.toBukkit(this.input), org.bukkit.craftbukkit.inventory.CraftRecipe.toBukkit(this.material));
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
--- a/net/minecraft/world/item/crafting/TransmuteResult.java
|
||||
+++ b/net/minecraft/world/item/crafting/TransmuteResult.java
|
||||
@@ -45,8 +_,13 @@
|
||||
}
|
||||
|
||||
public ItemStack apply(ItemStack stack) {
|
||||
+ // Paper start - Option to prevent data components copy
|
||||
+ return apply(stack, true);
|
||||
+ }
|
||||
+ public ItemStack apply(ItemStack stack, boolean applyComponents) {
|
||||
+ // Paper end - Option to prevent data components copy
|
||||
ItemStack itemStack = stack.transmuteCopy(this.item.value(), this.count);
|
||||
- itemStack.applyComponents(this.components);
|
||||
+ if (applyComponents) itemStack.applyComponents(this.components); // Paper - Option to prevent data components copy
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user