An exception is now thrown when referenced blocks and items are null and fixed an invalid reference to coral in BOPCrafting. Closes #258

This commit is contained in:
Adubbz 2014-05-19 10:34:35 +10:00
parent cc133672ef
commit ed7836c193
3 changed files with 12 additions and 3 deletions

View file

@ -9,7 +9,11 @@ public class BOPBlockHelper
{
public static Block get(String name)
{
return GameRegistry.findBlock(BOPModInfo.modID, name);
Block block = GameRegistry.findBlock(BOPModInfo.modID, name);
if (block == null) throw new RuntimeException("The referenced block is null!");
return GameRegistry.findBlock(BOPModInfo.modID, name);
}
public static String getUniqueName(Block block)

View file

@ -1,5 +1,6 @@
package biomesoplenty.api;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.item.ItemArmor.ArmorMaterial;
@ -19,7 +20,11 @@ public class BOPItemHelper
public static Item get(String name)
{
return GameRegistry.findItem(BOPModInfo.modID, name);
Item item = GameRegistry.findItem(BOPModInfo.modID, name);
if (item == null) throw new RuntimeException("The referenced item is null!");
return GameRegistry.findItem(BOPModInfo.modID, name);
}
public static String getUniqueName(Item item)

View file

@ -259,7 +259,7 @@ public class BOPCrafting
GameRegistry.addRecipe(new ItemStack(BOPBlockHelper.get("planks"), 1, 10), new Object[] {"##", "##", '#', BOPBlockHelper.get("bamboo")});
GameRegistry.addRecipe(new ItemStack(BOPItemHelper.get("jarEmpty"), 3, 0), new Object[] {"# #", "# #", "###", '#', Blocks.glass});
GameRegistry.addShapelessRecipe(new ItemStack(BOPItemHelper.get("food"), 1, 10), new Object[] {new ItemStack(BOPItemHelper.get("misc"), 1, 11), new ItemStack(Items.potionitem, 1, 0), new ItemStack(BOPBlockHelper.get("flowers2"), 1, 6), new ItemStack(BOPBlockHelper.get("coral"), 1, 3), new ItemStack(BOPBlockHelper.get("plants"), 1, 15), new ItemStack(BOPItemHelper.get("misc"), 1, 4), new ItemStack(BOPItemHelper.get("jarFilled"), 1, 0), new ItemStack(BOPItemHelper.get("food"), 1, 0), Items.sugar});
GameRegistry.addShapelessRecipe(new ItemStack(BOPItemHelper.get("food"), 1, 10), new Object[] {new ItemStack(BOPItemHelper.get("misc"), 1, 11), new ItemStack(Items.potionitem, 1, 0), new ItemStack(BOPBlockHelper.get("flowers2"), 1, 6), new ItemStack(BOPBlockHelper.get("coral1"), 1, 11), new ItemStack(BOPBlockHelper.get("plants"), 1, 15), new ItemStack(BOPItemHelper.get("misc"), 1, 4), new ItemStack(BOPItemHelper.get("jarFilled"), 1, 0), new ItemStack(BOPItemHelper.get("food"), 1, 0), Items.sugar});
GameRegistry.addRecipe(new ItemStack(BOPBlockHelper.get("flesh"), 1, 0), new Object[] {"##", "##", '#', new ItemStack(BOPItemHelper.get("misc"), 1, 3)});
GameRegistry.addRecipe(new ItemStack(Items.rotten_flesh, 1, 0), new Object[] {"FFF", "FPF", "FFF", 'F', new ItemStack(BOPItemHelper.get("misc"), 1, 3), 'P', new ItemStack(BOPItemHelper.get("jarFilled"), 1, 1)});