Skip to content

Commit ea4f50c

Browse files
committed
4.18.1-petu
Fixed an error that caused on 1.21.1 to throw `Duplicate recipe ignored with ID` error
1 parent 22cbf58 commit ea4f50c

6 files changed

Lines changed: 14 additions & 1 deletion

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121
#
2222

2323
group = com.wolfyscript.customcrafting
24-
version = 4.18-petu
24+
version = 4.18.1-petu

spigot/src/main/java/me/wolfyscript/customcrafting/recipes/CraftingRecipeShaped.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ public org.bukkit.inventory.ShapedRecipe getVanillaRecipe() {
8787
placeholderRecipe.shape(getShape());
8888
mappedIngredients.forEach((character, items) -> placeholderRecipe.setIngredient(character, getMaterialRecipeChoiceFor(items)));
8989
placeholderRecipe.setGroup(getGroup());
90+
91+
if(Bukkit.getRecipe(placeholderRecipe.getKey())!=null) {
92+
Bukkit.removeRecipe(placeholderRecipe.getKey());
93+
}
9094
Bukkit.addRecipe(placeholderRecipe);
9195

9296
// Return display recipe

spigot/src/main/java/me/wolfyscript/customcrafting/recipes/CraftingRecipeShapeless.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ public org.bukkit.inventory.ShapelessRecipe getVanillaRecipe() {
8282
placeholderShapelessRecipe.addIngredient(getMaterialRecipeChoiceFor(value));
8383
}
8484
placeholderShapelessRecipe.setGroup(getGroup());
85+
if(Bukkit.getRecipe(placeholderShapelessRecipe.getKey())!=null)
86+
Bukkit.removeRecipe(placeholderShapelessRecipe.getKey());
87+
8588
Bukkit.addRecipe(placeholderShapelessRecipe);
8689

8790
// Return display recipe

spigot/src/main/java/me/wolfyscript/customcrafting/recipes/CustomRecipeBlasting.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ private CustomRecipeBlasting(CustomRecipeBlasting customRecipeBlasting) {
6565
public BlastingRecipe getVanillaRecipe() {
6666
if (!getSource().isEmpty()) {
6767
BlastingRecipe placeholderRecipe = new BlastingRecipe(ICustomVanillaRecipe.toPlaceholder(getNamespacedKey()).bukkit(), getResult().getItemStack(), getMaterialSourceChoice(), getExp(), getCookingTime());
68+
if(Bukkit.getRecipe(placeholderRecipe.getKey())!=null)
69+
Bukkit.removeRecipe(placeholderRecipe.getKey());
6870
Bukkit.addRecipe(placeholderRecipe);
6971
return new BlastingRecipe(ICustomVanillaRecipe.toDisplayKey(getNamespacedKey()).bukkit(), getResult().getItemStack(), getSourceChoice(), getExp(), getCookingTime());
7072
}

spigot/src/main/java/me/wolfyscript/customcrafting/recipes/CustomRecipeFurnace.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ public CustomRecipeFurnace(CustomRecipeFurnace customRecipeFurnace) {
6565
public FurnaceRecipe getVanillaRecipe() {
6666
if (!getSource().isEmpty()) {
6767
FurnaceRecipe placeholderRecipe = new FurnaceRecipe(ICustomVanillaRecipe.toPlaceholder(getNamespacedKey()).bukkit(), getResult().getItemStack(), getMaterialSourceChoice(), getExp(), getCookingTime());
68+
if(Bukkit.getRecipe(placeholderRecipe.getKey())!=null)
69+
Bukkit.removeRecipe(placeholderRecipe.getKey());
6870
Bukkit.addRecipe(placeholderRecipe);
6971
//registerRecipeIntoMinecraft(new FunctionalRecipeBuilderSmelting(getNamespacedKey(), getResult().getItemStack(), getRecipeChoice()));
7072
return new FurnaceRecipe(ICustomVanillaRecipe.toDisplayKey(getNamespacedKey()).bukkit(), getResult().getItemStack(), getSourceChoice(), getExp(), getCookingTime());

spigot/src/main/java/me/wolfyscript/customcrafting/recipes/CustomRecipeSmoking.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ public boolean validType(Material material) {
7575
public SmokingRecipe getVanillaRecipe() {
7676
if (!getSource().isEmpty()) {
7777
SmokingRecipe placeholderRecipe = new SmokingRecipe(ICustomVanillaRecipe.toPlaceholder(getNamespacedKey()).bukkit(), getResult().getItemStack(), getMaterialSourceChoice(), getExp(), getCookingTime());
78+
if(Bukkit.getRecipe(placeholderRecipe.getKey())!=null)
79+
Bukkit.removeRecipe(placeholderRecipe.getKey());
7880
Bukkit.addRecipe(placeholderRecipe);
7981
return new SmokingRecipe(ICustomVanillaRecipe.toDisplayKey(getNamespacedKey()).bukkit(), getResult().getItemStack(), getSourceChoice(), getExp(), getCookingTime());
8082
}

0 commit comments

Comments
 (0)