From a24ee95c4df4e6e0ca07f19a7e464664ef35b4a1 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 22 May 2016 21:20:39 +0100 Subject: [PATCH] Fix crash when reloading texture --- src/main/java/techreborn/init/ModItems.java | 2 ++ src/main/java/techreborn/init/ModRecipes.java | 4 ++-- src/main/java/techreborn/items/ItemDusts.java | 8 ++++---- src/main/java/techreborn/items/ItemDustsSmall.java | 10 +++++----- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/src/main/java/techreborn/init/ModItems.java b/src/main/java/techreborn/init/ModItems.java index 3df498ca5..53a2ee6bd 100644 --- a/src/main/java/techreborn/init/ModItems.java +++ b/src/main/java/techreborn/init/ModItems.java @@ -118,6 +118,8 @@ public class ModItems public static Item emptyCell; public static DynamicCell dynamicCell; + public static final String META_PLACEHOLDER = "PLACEHOLDER_ITEM"; + public static void init() throws InstantiationException, IllegalAccessException { gems = new ItemGems(); diff --git a/src/main/java/techreborn/init/ModRecipes.java b/src/main/java/techreborn/init/ModRecipes.java index b42e9bcf7..7494ec1fc 100644 --- a/src/main/java/techreborn/init/ModRecipes.java +++ b/src/main/java/techreborn/init/ModRecipes.java @@ -234,7 +234,7 @@ public class ModRecipes ScrapboxList.addItemStackToList(new ItemStack(ModBlocks.rubberSapling)); for (String i : ItemDusts.types){ - if(i.equals("%NULL%")){ + if(i.equals(ModItems.META_PLACEHOLDER)){ continue; } ScrapboxList.addItemStackToList(ItemDusts.getDustByName(i)); @@ -918,7 +918,7 @@ public class ModRecipes for (String name : ItemDustsSmall.types) { - if(name.equals("%NULL%")){ + if(name.equals(ModItems.META_PLACEHOLDER)){ continue; } GameRegistry.addShapelessRecipe(ItemDustsSmall.getSmallDustByName(name, 4), ItemDusts.getDustByName(name)); diff --git a/src/main/java/techreborn/items/ItemDusts.java b/src/main/java/techreborn/items/ItemDusts.java index fbbb4256e..535021a93 100644 --- a/src/main/java/techreborn/items/ItemDusts.java +++ b/src/main/java/techreborn/items/ItemDusts.java @@ -17,9 +17,9 @@ public class ItemDusts extends ItemTextureBase "bauxite", "brass", "bronze", "calcite", "charcoal", "chrome", "cinnabar", "clay", "coal", "copper", "darkAshes", "diamond", "electrum", "emerald", "enderEye", "enderPearl", "endstone", "flint", "galena", "gold", "grossular", "invar", "iron", "lazurite", "lead", "magnesium", "manganese", "marble", "netherrack", - "nickel", "obsidian", "peridot", "phosphorous", "platinum", "pyrite", "pyrope", "redGarnet", "%NULL%", + "nickel", "obsidian", "peridot", "phosphorous", "platinum", "pyrite", "pyrope", "redGarnet", ModItems.META_PLACEHOLDER, "ruby", "saltpeter", "sapphire", "sawDust", "silver", "sodalite", "spessartine", "sphalerite", "steel", - "sulfur", "tin", "titanium", "tungsten", "uvarovite", "%NULL%", "yellowGarnet", "zinc", + "sulfur", "tin", "titanium", "tungsten", "uvarovite", ModItems.META_PLACEHOLDER, "yellowGarnet", "zinc", "olivine", "andesite", "diorite", "granite" }; public ItemDusts() @@ -35,7 +35,7 @@ public class ItemDusts extends ItemTextureBase { if (types[i].equalsIgnoreCase(name)) { - if(types[i].equals("%NULL%")){ + if(types[i].equals(ModItems.META_PLACEHOLDER)){ throw new InvalidParameterException("The dust " + name + " could not be found."); } return new ItemStack(ModItems.dusts, count, i); @@ -80,7 +80,7 @@ public class ItemDusts extends ItemTextureBase { for (int meta = 0; meta < types.length; ++meta) { - if(!types[meta].equals("%NULL%")){ + if(!types[meta].equals(ModItems.META_PLACEHOLDER)){ list.add(new ItemStack(item, 1, meta)); } } diff --git a/src/main/java/techreborn/items/ItemDustsSmall.java b/src/main/java/techreborn/items/ItemDustsSmall.java index 4f68d0adb..203c8899b 100644 --- a/src/main/java/techreborn/items/ItemDustsSmall.java +++ b/src/main/java/techreborn/items/ItemDustsSmall.java @@ -18,9 +18,9 @@ public class ItemDustsSmall extends ItemTextureBase "bauxite", "brass", "bronze", "calcite", "charcoal", "chrome", "cinnabar", "clay", "coal", "copper", "darkAshes", "diamond", "electrum", "emerald", "enderEye", "enderPearl", "endstone", "flint", "galena", "gold", "grossular", "invar", "iron", "lazurite", "lead", "magnesium", "manganese", "marble", "netherrack", - "nickel", "obsidian", "peridot", "phosphorous", "platinum", "pyrite", "pyrope", "redGarnet", "%NULL%", + "nickel", "obsidian", "peridot", "phosphorous", "platinum", "pyrite", "pyrope", "redGarnet", ModItems.META_PLACEHOLDER, "ruby", "saltpeter", "sapphire", "sawDust", "silver", "sodalite", "spessartine", "sphalerite", "steel", - "sulfur", "tin", "titanium", "tungsten", "uvarovite", "%NULL%", "yellowGarnet", "zinc", + "sulfur", "tin", "titanium", "tungsten", "uvarovite", ModItems.META_PLACEHOLDER, "yellowGarnet", "zinc", "olivine", "redstone", "glowstone", "andesite", "diorite", "granite" }; public ItemDustsSmall() @@ -36,7 +36,7 @@ public class ItemDustsSmall extends ItemTextureBase { if (types[i].equalsIgnoreCase(name)) { - if(types[i].equals("%NULL%")){ + if(types[i].equals(ModItems.META_PLACEHOLDER)){ throw new InvalidParameterException("The small dust " + name + " could not be found."); } return new ItemStack(ModItems.smallDusts, count, i); @@ -68,7 +68,7 @@ public class ItemDustsSmall extends ItemTextureBase { for (int meta = 0; meta < types.length; ++meta) { - if(!types[meta].equals("%NULL%")){ + if(!types[meta].equals(ModItems.META_PLACEHOLDER)){ list.add(new ItemStack(item, 1, meta)); } } @@ -77,7 +77,7 @@ public class ItemDustsSmall extends ItemTextureBase @Override public String getTextureName(int damage) { - if(types[damage].equals("%NULL%")){ + if(types[damage].equals(ModItems.META_PLACEHOLDER)){ damage = 0; } return ModInfo.MOD_ID + ":items/smallDust/small" + StringUtils.toFirstCapital(types[damage]) + "Dust";