aboutsummaryrefslogtreecommitdiffhomepage
path: root/patch-remap/mache-spigotflower/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patch-remap/mache-spigotflower/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch')
-rw-r--r--patch-remap/mache-spigotflower/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch178
1 files changed, 178 insertions, 0 deletions
diff --git a/patch-remap/mache-spigotflower/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch b/patch-remap/mache-spigotflower/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch
new file mode 100644
index 0000000000..8e6da53406
--- /dev/null
+++ b/patch-remap/mache-spigotflower/net/minecraft/world/item/crafting/SmithingTrimRecipe.java.patch
@@ -0,0 +1,178 @@
+--- a/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
++++ b/net/minecraft/world/item/crafting/SmithingTrimRecipe.java
+@@ -17,6 +17,12 @@
+ import net.minecraft.world.item.armortrim.TrimPattern;
+ import net.minecraft.world.item.armortrim.TrimPatterns;
+ import net.minecraft.world.level.Level;
++// CraftBukkit start
++import org.bukkit.NamespacedKey;
++import org.bukkit.craftbukkit.inventory.CraftRecipe;
++import org.bukkit.craftbukkit.inventory.CraftSmithingTrimRecipe;
++import org.bukkit.inventory.Recipe;
++// CraftBukkit end
+
+ public class SmithingTrimRecipe implements SmithingRecipe {
+
+@@ -24,29 +30,27 @@
+ final Ingredient base;
+ final Ingredient addition;
+
+- public SmithingTrimRecipe(Ingredient ingredient, Ingredient ingredient1, Ingredient ingredient2) {
+- this.template = ingredient;
+- this.base = ingredient1;
+- this.addition = ingredient2;
++ public SmithingTrimRecipe(Ingredient recipeitemstack, Ingredient recipeitemstack1, Ingredient recipeitemstack2) {
++ this.template = recipeitemstack;
++ this.base = recipeitemstack1;
++ this.addition = recipeitemstack2;
+ }
+
+ @Override
+- @Override
+ public boolean matches(Container container, Level level) {
+ return this.template.test(container.getItem(0)) && this.base.test(container.getItem(1)) && this.addition.test(container.getItem(2));
+ }
+
+ @Override
+- @Override
+- public ItemStack assemble(Container container, RegistryAccess registryaccess) {
++ public ItemStack assemble(Container container, RegistryAccess registryAccess) {
+ ItemStack itemstack = container.getItem(1);
+
+ if (this.base.test(itemstack)) {
+- Optional<Holder.Reference<TrimMaterial>> optional = TrimMaterials.getFromIngredient(registryaccess, container.getItem(2));
+- Optional<Holder.Reference<TrimPattern>> optional1 = TrimPatterns.getFromTemplate(registryaccess, container.getItem(0));
++ Optional<Holder.Reference<TrimMaterial>> optional = TrimMaterials.getFromIngredient(registryAccess, container.getItem(2));
++ Optional<Holder.Reference<TrimPattern>> optional1 = TrimPatterns.getFromTemplate(registryAccess, container.getItem(0));
+
+ if (optional.isPresent() && optional1.isPresent()) {
+- Optional<ArmorTrim> optional2 = ArmorTrim.getTrim(registryaccess, itemstack, false);
++ Optional<ArmorTrim> optional2 = ArmorTrim.getTrim(registryAccess, itemstack, false);
+
+ if (optional2.isPresent() && ((ArmorTrim) optional2.get()).hasPatternAndMaterial((Holder) optional1.get(), (Holder) optional.get())) {
+ return ItemStack.EMPTY;
+@@ -57,7 +61,7 @@
+ itemstack1.setCount(1);
+ ArmorTrim armortrim = new ArmorTrim((Holder) optional.get(), (Holder) optional1.get());
+
+- if (ArmorTrim.setTrim(registryaccess, itemstack1, armortrim)) {
++ if (ArmorTrim.setTrim(registryAccess, itemstack1, armortrim)) {
+ return itemstack1;
+ }
+ }
+@@ -67,18 +71,17 @@
+ }
+
+ @Override
+- @Override
+- public ItemStack getResultItem(RegistryAccess registryaccess) {
++ public ItemStack getResultItem(RegistryAccess registryAccess) {
+ ItemStack itemstack = new ItemStack(Items.IRON_CHESTPLATE);
+- Optional<Holder.Reference<TrimPattern>> optional = registryaccess.registryOrThrow(Registries.TRIM_PATTERN).holders().findFirst();
++ Optional<Holder.Reference<TrimPattern>> optional = registryAccess.registryOrThrow(Registries.TRIM_PATTERN).holders().findFirst();
+
+ if (optional.isPresent()) {
+- Optional<Holder.Reference<TrimMaterial>> optional1 = registryaccess.registryOrThrow(Registries.TRIM_MATERIAL).getHolder(TrimMaterials.REDSTONE);
++ Optional<Holder.Reference<TrimMaterial>> optional1 = registryAccess.registryOrThrow(Registries.TRIM_MATERIAL).getHolder(TrimMaterials.REDSTONE);
+
+ if (optional1.isPresent()) {
+ ArmorTrim armortrim = new ArmorTrim((Holder) optional1.get(), (Holder) optional.get());
+
+- ArmorTrim.setTrim(registryaccess, itemstack, armortrim);
++ ArmorTrim.setTrim(registryAccess, itemstack, armortrim);
+ }
+ }
+
+@@ -86,37 +89,39 @@
+ }
+
+ @Override
+- @Override
+- public boolean isTemplateIngredient(ItemStack itemstack) {
+- return this.template.test(itemstack);
++ public boolean isTemplateIngredient(ItemStack stack) {
++ return this.template.test(stack);
+ }
+
+ @Override
+- @Override
+- public boolean isBaseIngredient(ItemStack itemstack) {
+- return this.base.test(itemstack);
++ public boolean isBaseIngredient(ItemStack stack) {
++ return this.base.test(stack);
+ }
+
+ @Override
+- @Override
+- public boolean isAdditionIngredient(ItemStack itemstack) {
+- return this.addition.test(itemstack);
++ public boolean isAdditionIngredient(ItemStack stack) {
++ return this.addition.test(stack);
+ }
+
+ @Override
+- @Override
+ public RecipeSerializer<?> getSerializer() {
+ return RecipeSerializer.SMITHING_TRIM;
+ }
+
+ @Override
+- @Override
+ public boolean isIncomplete() {
+ return Stream.of(this.template, this.base, this.addition).anyMatch(Ingredient::isEmpty);
+ }
+
+- public static class Serializer implements RecipeSerializer<SmithingTrimRecipe> {
++ // CraftBukkit start
++ @Override
++ public Recipe toBukkitRecipe(NamespacedKey id) {
++ return new CraftSmithingTrimRecipe(id, CraftRecipe.toBukkit(this.template), CraftRecipe.toBukkit(this.base), CraftRecipe.toBukkit(this.addition));
++ }
++ // CraftBukkit end
+
++ public static class a implements RecipeSerializer<SmithingTrimRecipe> {
++
+ private static final Codec<SmithingTrimRecipe> CODEC = RecordCodecBuilder.create((instance) -> {
+ return instance.group(Ingredient.CODEC.fieldOf("template").forGetter((smithingtrimrecipe) -> {
+ return smithingtrimrecipe.template;
+@@ -127,29 +132,26 @@
+ })).apply(instance, SmithingTrimRecipe::new);
+ });
+
+- public Serializer() {}
++ public a() {}
+
+ @Override
+- @Override
+ public Codec<SmithingTrimRecipe> codec() {
+- return SmithingTrimRecipe.Serializer.CODEC;
++ return SmithingTrimRecipe.a.CODEC;
+ }
+
+ @Override
+- @Override
+- public SmithingTrimRecipe fromNetwork(FriendlyByteBuf friendlybytebuf) {
+- Ingredient ingredient = Ingredient.fromNetwork(friendlybytebuf);
+- Ingredient ingredient1 = Ingredient.fromNetwork(friendlybytebuf);
+- Ingredient ingredient2 = Ingredient.fromNetwork(friendlybytebuf);
++ public SmithingTrimRecipe fromNetwork(FriendlyByteBuf packetdataserializer) {
++ Ingredient recipeitemstack = Ingredient.fromNetwork(packetdataserializer);
++ Ingredient recipeitemstack1 = Ingredient.fromNetwork(packetdataserializer);
++ Ingredient recipeitemstack2 = Ingredient.fromNetwork(packetdataserializer);
+
+- return new SmithingTrimRecipe(ingredient, ingredient1, ingredient2);
++ return new SmithingTrimRecipe(recipeitemstack, recipeitemstack1, recipeitemstack2);
+ }
+
+- @Override
+- public void toNetwork(FriendlyByteBuf friendlybytebuf, SmithingTrimRecipe smithingtrimrecipe) {
+- smithingtrimrecipe.template.toNetwork(friendlybytebuf);
+- smithingtrimrecipe.base.toNetwork(friendlybytebuf);
+- smithingtrimrecipe.addition.toNetwork(friendlybytebuf);
++ public void toNetwork(FriendlyByteBuf packetdataserializer, SmithingTrimRecipe smithingtrimrecipe) {
++ smithingtrimrecipe.template.toNetwork(packetdataserializer);
++ smithingtrimrecipe.base.toNetwork(packetdataserializer);
++ smithingtrimrecipe.addition.toNetwork(packetdataserializer);
+ }
+ }
+ }