package tinker.tconstruct; import java.util.ArrayList; import java.util.HashMap; import tinker.tconstruct.client.gui.*; import tinker.tconstruct.crafting.*; import tinker.tconstruct.tools.*; /** A registry to store any relevant API work * * @author mDiyo */ public class TConstructRegistry { public static TConstructRegistry instance = new TConstructRegistry(); public static ArrayList tools = new ArrayList(20); public static ArrayList toolButtons = new ArrayList(20); public static HashMap toolMaterials = new HashMap(60); //Tools public static void addToolMapping(ToolCore tool) { tools.add(tool); } public static ArrayList getToolMapping() { return tools; } //Rendering public static void addMaterialRenderMapping(int materialID, String textureLocation) { for (ToolCore tool : TConstructRegistry.getToolMapping()) { tool.partTextures.put(materialID, textureLocation); } } public static void addEffectRenderMapping(int materialID, String textureLocation) { for (ToolCore tool : TConstructRegistry.getToolMapping()) { tool.effectTextures.put(materialID, textureLocation); } } //Materials public static void addToolMaterial(int materialID, String materialName, int craftingTier, int harvestLevel, int durability, int miningspeed, int attack, float handleModifier, int reinforced, float shoddy) { ToolMaterial mat = toolMaterials.get(materialID); if (mat == null) { toolMaterials.put(materialID, new ToolMaterial(materialName, craftingTier, harvestLevel, durability, miningspeed, attack, handleModifier, reinforced, shoddy)); } else throw new RuntimeException("TConstruct material ID "+materialID+" is already occupied by "+mat.materialName); } public static ToolMaterial getMaterial(int key) { return (toolMaterials.get(key)); } //Gui public static void addToolButton(ToolGuiElement element) { toolButtons.add(element); } public static void addToolButton(int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body, String texture) { toolButtons.add(new ToolGuiElement(slotType, xButton, yButton, xIcons, yIcons, title, body, texture)); } public static ArrayList getToolButtons() { return toolButtons; } }