Provide more helpful error message iterating recipe
This commit is contained in:
parent
9c46952a18
commit
f16728bb5f
@ -1,6 +1,8 @@
|
||||
package io.izzel.arclight.common.mixin.bukkit;
|
||||
|
||||
import io.izzel.arclight.common.bridge.core.item.crafting.IRecipeBridge;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import org.bukkit.craftbukkit.v.inventory.RecipeIterator;
|
||||
import org.bukkit.inventory.Recipe;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
@ -10,8 +12,6 @@ import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
|
||||
@Mixin(value = RecipeIterator.class, remap = false)
|
||||
public class RecipeIteratorMixin {
|
||||
@ -45,7 +45,13 @@ public class RecipeIteratorMixin {
|
||||
public Recipe next() {
|
||||
if (current == null || !current.hasNext()) {
|
||||
current = recipes.next().getValue().values().iterator();
|
||||
return next();
|
||||
}
|
||||
net.minecraft.world.item.crafting.Recipe<?> recipe = current.next();
|
||||
try {
|
||||
return ((IRecipeBridge) recipe).bridge$toBukkitRecipe();
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException("Error converting recipe " + recipe.getId(), e);
|
||||
}
|
||||
return ((IRecipeBridge) current.next()).bridge$toBukkitRecipe();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user