|
|
|
@@ -14,16 +14,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|
|
|
|
final ItemStack result;
|
|
|
|
|
+ final boolean copyNBT; // Paper
|
|
|
|
|
|
|
|
|
|
public SmithingTransformRecipe(ResourceLocation id, Ingredient template, Ingredient base, Ingredient addition, ItemStack result) {
|
|
|
|
|
public SmithingTransformRecipe(Ingredient template, Ingredient base, Ingredient addition, ItemStack result) {
|
|
|
|
|
+ // Paper start
|
|
|
|
|
+ this(id, template, base, addition, result, true);
|
|
|
|
|
+ this(template, base, addition, result, true);
|
|
|
|
|
+ }
|
|
|
|
|
+ public SmithingTransformRecipe(ResourceLocation id, Ingredient template, Ingredient base, Ingredient addition, ItemStack result, boolean copyNBT) {
|
|
|
|
|
+ public SmithingTransformRecipe(Ingredient template, Ingredient base, Ingredient addition, ItemStack result, boolean copyNBT) {
|
|
|
|
|
+ this.copyNBT = copyNBT;
|
|
|
|
|
+ // Paper end
|
|
|
|
|
this.id = id;
|
|
|
|
|
this.template = template;
|
|
|
|
|
this.base = base;
|
|
|
|
|
this.addition = addition;
|
|
|
|
|
@@ -0,0 +0,0 @@ public class SmithingTransformRecipe implements SmithingRecipe {
|
|
|
|
|
@Override
|
|
|
|
|
public ItemStack assemble(Container inventory, RegistryAccess registryManager) {
|
|
|
|
@@ -39,11 +39,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|
|
|
|
return itemstack;
|
|
|
|
|
}
|
|
|
|
|
@@ -0,0 +0,0 @@ public class SmithingTransformRecipe implements SmithingRecipe {
|
|
|
|
|
public Recipe toBukkitRecipe() {
|
|
|
|
|
public Recipe toBukkitRecipe(NamespacedKey id) {
|
|
|
|
|
CraftItemStack result = CraftItemStack.asCraftMirror(this.result);
|
|
|
|
|
|
|
|
|
|
- CraftSmithingTransformRecipe recipe = new CraftSmithingTransformRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
|
|
|
|
|
+ CraftSmithingTransformRecipe recipe = new CraftSmithingTransformRecipe(CraftNamespacedKey.fromMinecraft(this.id), result, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNBT); // Paper
|
|
|
|
|
- CraftSmithingTransformRecipe recipe = new CraftSmithingTransformRecipe(id, result, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
|
|
|
|
|
+ CraftSmithingTransformRecipe recipe = new CraftSmithingTransformRecipe(id, result, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNBT); // Paper
|
|
|
|
|
|
|
|
|
|
return recipe;
|
|
|
|
|
}
|
|
|
|
@@ -57,16 +57,16 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|
|
|
|
final Ingredient addition;
|
|
|
|
|
+ final boolean copyNbt; // Paper
|
|
|
|
|
|
|
|
|
|
public SmithingTrimRecipe(ResourceLocation id, Ingredient template, Ingredient base, Ingredient addition) {
|
|
|
|
|
public SmithingTrimRecipe(Ingredient template, Ingredient base, Ingredient addition) {
|
|
|
|
|
+ // Paper start
|
|
|
|
|
+ this(id, template, base, addition, true);
|
|
|
|
|
+ this(template, base, addition, true);
|
|
|
|
|
+ }
|
|
|
|
|
+ public SmithingTrimRecipe(ResourceLocation id, Ingredient template, Ingredient base, Ingredient addition, boolean copyNbt) {
|
|
|
|
|
+ this.copyNbt = copyNbt;
|
|
|
|
|
+ // Paper end
|
|
|
|
|
this.id = id;
|
|
|
|
|
this.template = template;
|
|
|
|
|
this.base = base;
|
|
|
|
|
this.addition = addition;
|
|
|
|
|
@@ -0,0 +0,0 @@ public class SmithingTrimRecipe implements SmithingRecipe {
|
|
|
|
|
return ItemStack.EMPTY;
|
|
|
|
|
}
|
|
|
|
@@ -79,9 +79,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|
|
|
|
@@ -0,0 +0,0 @@ public class SmithingTrimRecipe implements SmithingRecipe {
|
|
|
|
|
// CraftBukkit start
|
|
|
|
|
@Override
|
|
|
|
|
public Recipe toBukkitRecipe() {
|
|
|
|
|
- return new CraftSmithingTrimRecipe(CraftNamespacedKey.fromMinecraft(this.id), CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
|
|
|
|
|
+ return new CraftSmithingTrimRecipe(CraftNamespacedKey.fromMinecraft(this.id), CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNbt); // Paper
|
|
|
|
|
public Recipe toBukkitRecipe(NamespacedKey id) {
|
|
|
|
|
- return new CraftSmithingTrimRecipe(id, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
|
|
|
|
|
+ return new CraftSmithingTrimRecipe(id, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition), this.copyNbt); // Paper
|
|
|
|
|
}
|
|
|
|
|
// CraftBukkit end
|
|
|
|
|
|
|
|
|
@@ -112,8 +112,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|
|
|
|
public void addToCraftingManager() {
|
|
|
|
|
ItemStack result = this.getResult();
|
|
|
|
|
|
|
|
|
|
- MinecraftServer.getServer().getRecipeManager().addRecipe(new net.minecraft.world.item.crafting.SmithingTransformRecipe(CraftNamespacedKey.toMinecraft(this.getKey()), toNMS(this.getTemplate(), true), toNMS(this.getBase(), true), toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result)));
|
|
|
|
|
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new net.minecraft.world.item.crafting.SmithingTransformRecipe(CraftNamespacedKey.toMinecraft(this.getKey()), toNMS(this.getTemplate(), true), toNMS(this.getBase(), true), toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result), this.willCopyNbt())); // Paper
|
|
|
|
|
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(toNMS(this.getTemplate(), true), toNMS(this.getBase(), true), toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result))));
|
|
|
|
|
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTransformRecipe(toNMS(this.getTemplate(), true), toNMS(this.getBase(), true), toNMS(this.getAddition(), true), CraftItemStack.asNMSCopy(result), this.willCopyNbt()))); // Paper
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftSmithingTrimRecipe.java
|
|
|
|
@@ -141,7 +141,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void addToCraftingManager() {
|
|
|
|
|
- MinecraftServer.getServer().getRecipeManager().addRecipe(new net.minecraft.world.item.crafting.SmithingTrimRecipe(CraftNamespacedKey.toMinecraft(this.getKey()), toNMS(this.getTemplate(), true), toNMS(this.getBase(), true), toNMS(this.getAddition(), true)));
|
|
|
|
|
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new net.minecraft.world.item.crafting.SmithingTrimRecipe(CraftNamespacedKey.toMinecraft(this.getKey()), toNMS(this.getTemplate(), true), toNMS(this.getBase(), true), toNMS(this.getAddition(), true), this.willCopyNbt())); // Paper
|
|
|
|
|
- MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(toNMS(this.getTemplate(), true), toNMS(this.getBase(), true), toNMS(this.getAddition(), true))));
|
|
|
|
|
+ MinecraftServer.getServer().getRecipeManager().addRecipe(new RecipeHolder<>(CraftNamespacedKey.toMinecraft(this.getKey()), new net.minecraft.world.item.crafting.SmithingTrimRecipe(toNMS(this.getTemplate(), true), toNMS(this.getBase(), true), toNMS(this.getAddition(), true), this.willCopyNbt()))); // Paper
|
|
|
|
|
}
|
|
|
|
|
}
|