Skip to content

Commit

Permalink
Constructor bypass
Browse files Browse the repository at this point in the history
  • Loading branch information
lynxplay committed Jul 19, 2024
1 parent 6232383 commit d90a343
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Bjarne Koll <lynxplay101@gmail.com>
Date: Fri, 19 Jul 2024 19:09:21 +0200
Subject: [PATCH] Move CraftComplexRecipe to extend CraftingRecipe

A craft complex recipe wraps a CustomRecipe, which itself is a
CraftingRecipe.
As such, this complex recipe should also be a crafting recipe.

diff --git a/src/main/java/org/bukkit/inventory/CraftingRecipe.java b/src/main/java/org/bukkit/inventory/CraftingRecipe.java
index 37024b4736dd3897490ca51d08cf07901b01d59f..afa3de9ab78d01c448d450d8afbc7b1e7e62754c 100644
--- a/src/main/java/org/bukkit/inventory/CraftingRecipe.java
+++ b/src/main/java/org/bukkit/inventory/CraftingRecipe.java
@@ -11,8 +11,11 @@ import org.jetbrains.annotations.NotNull;
* Represents a shaped or shapeless crafting recipe.
*/
public abstract class CraftingRecipe implements Recipe, Keyed {
- private final NamespacedKey key;
- private final ItemStack output;
+ // Paper - make CraftComplexRecipe extend CraftingRecipe - start
+ protected NamespacedKey key;
+ protected ItemStack output;
+ protected CraftingRecipe() {}
+ // Paper - make CraftComplexRecipe extend CraftingRecipe - end
private String group = "";
private CraftingBookCategory category = CraftingBookCategory.MISC;

Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ index b57a2ba09f160409b5df9a2ae7ec159af3e4bf93..50aefbaf4da7f9c6b158c67a6eecfa7b
// CraftBukkit end
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftComplexRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftComplexRecipe.java
index dcaeaa3367351eb54e2cf8e62be19ecc125a4bb4..81669c389e0eaaae9187fd02c9d151598cdf2c61 100644
index dcaeaa3367351eb54e2cf8e62be19ecc125a4bb4..05f42ec6177218960b22dc2c224f63cbf37d696f 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftComplexRecipe.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftComplexRecipe.java
@@ -9,12 +9,13 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey;
@@ -9,12 +9,17 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey;
import org.bukkit.inventory.ComplexRecipe;
import org.bukkit.inventory.ItemStack;

Expand All @@ -40,7 +40,11 @@ index dcaeaa3367351eb54e2cf8e62be19ecc125a4bb4..81669c389e0eaaae9187fd02c9d15159
private final CustomRecipe recipe;

public CraftComplexRecipe(NamespacedKey key, CustomRecipe recipe) {
+ super(key, ItemStack.empty()); // Paper - make CraftComplexRecipe extend CraftingRecipe - super
+ // Paper - make CraftComplexRecipe extend CraftingRecipe - start
+ super();
+ super.key = key;
+ super.output = ItemStack.empty();
+ // Paper - make CraftComplexRecipe extend CraftingRecipe - end
this.key = key;
this.recipe = recipe;
}

0 comments on commit d90a343

Please sign in to comment.