Permalink
Browse files

Require a recipe key

  • Loading branch information...
PseudoKnight committed Aug 25, 2018
1 parent 3283090 commit cb9885a49f4972037613a216636128a21d5de509
@@ -671,31 +671,14 @@ public void run() {
@Override
public MCRecipe GetNewRecipe(String key, MCRecipeType type, MCItemStack result) {
ItemStack is = ((BukkitMCItemStack) result).asItemStack();
NamespacedKey nskey = new NamespacedKey(CommandHelperPlugin.self, key);
switch(type) {
case FURNACE:
if(key != null) {
NamespacedKey nskey = new NamespacedKey(CommandHelperPlugin.self, key);
return new BukkitMCFurnaceRecipe(new FurnaceRecipe(nskey, is, Material.AIR, 0.0F, 200));
} else {
// deprecated in 1.13
return new BukkitMCFurnaceRecipe(new FurnaceRecipe(is, Material.AIR));
}
return new BukkitMCFurnaceRecipe(new FurnaceRecipe(nskey, is, Material.AIR, 0.0F, 200));
case SHAPED:
if(key != null) {
NamespacedKey nskey = new NamespacedKey(CommandHelperPlugin.self, key);
return new BukkitMCShapedRecipe(new ShapedRecipe(nskey, is));
} else {
// deprecated in 1.12
return new BukkitMCShapedRecipe(new ShapedRecipe(is));
}
return new BukkitMCShapedRecipe(new ShapedRecipe(nskey, is));
case SHAPELESS:
if(key != null) {
NamespacedKey nskey = new NamespacedKey(CommandHelperPlugin.self, key);
return new BukkitMCShapelessRecipe(new ShapelessRecipe(nskey, is));
} else {
// deprecated in 1.12
return new BukkitMCShapelessRecipe(new ShapelessRecipe(is));
}
return new BukkitMCShapelessRecipe(new ShapelessRecipe(nskey, is));
}
return null;
}
@@ -1441,10 +1441,7 @@ public MCRecipe recipe(Construct c, Target t) {
}
CArray recipe = (CArray) c;
String recipeKey = null;
if(recipe.containsKey("key")) {
recipeKey = recipe.get("key", t).val();
}
String recipeKey = recipe.get("key", t).val();
MCRecipeType recipeType;
try {

0 comments on commit cb9885a

Please sign in to comment.