Skip to content

Commit

Permalink
prevent crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
LifeIsAParadox committed Apr 24, 2022
1 parent c85024b commit 4881ede
Showing 1 changed file with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import org.eclipse.jgit.api.Git;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.nio.file.Files;
Expand Down Expand Up @@ -109,6 +111,7 @@ public static List<Recipe> getRecipes(String internalName) {
}

class Recipe {
private static final Logger LOGGER = LoggerFactory.getLogger(Recipe.class);
String text = "";
List<ItemStack> grid = new ArrayList<>(9);
ItemStack result;
Expand All @@ -130,12 +133,17 @@ public static Recipe fromJsonObject(JsonObject jsonObj) {
}

private static ItemStack getItemStack(String internalName) {
if (internalName.length() > 0) {
int count = Integer.parseInt(internalName.split(":")[1]);
internalName = internalName.split(":")[0];
ItemStack itemStack = ItemRegistry.itemsMap.get(internalName).copy();
itemStack.setCount(count);
return itemStack;
try {
if (internalName.length() > 0) {
int count = Integer.parseInt(internalName.split(":")[1]);
internalName = internalName.split(":")[0];
ItemStack itemStack = ItemRegistry.itemsMap.get(internalName).copy();
itemStack.setCount(count);
return itemStack;
}
}
catch(Exception e) {
LOGGER.error("[Skyblocker-Recipe] "+internalName,e);
}
return Items.AIR.getDefaultStack();
}
Expand Down

0 comments on commit 4881ede

Please sign in to comment.