diff --git a/resources/assets/tinker/textures/items/parts/_chunk.png b/resources/assets/tinker/textures/items/parts/_chunk.png index 127fd678..ffea177d 100644 Binary files a/resources/assets/tinker/textures/items/parts/_chunk.png and b/resources/assets/tinker/textures/items/parts/_chunk.png differ diff --git a/src/main/java/tconstruct/library/TConstructRegistry.java b/src/main/java/tconstruct/library/TConstructRegistry.java index 4aaeb24f..7f63baaa 100644 --- a/src/main/java/tconstruct/library/TConstructRegistry.java +++ b/src/main/java/tconstruct/library/TConstructRegistry.java @@ -220,6 +220,7 @@ public class TConstructRegistry public static HashMap toolMaterials = new HashMap(40); public static HashMap toolMaterialStrings = new HashMap(40); public static List defaultToolPartMaterials = new LinkedList(); + public static List defaultShardMaterials = new LinkedList(); public static void addDefaultToolPartMaterial(int materialID) { @@ -229,6 +230,14 @@ public class TConstructRegistry defaultToolPartMaterials.add(materialID); } + public static void addDefaultShardMaterial(int materialID) + { + if(!toolMaterials.containsKey(materialID)) + logger.error("[TCon API] Can't add default shard: Material ID " + materialID + " is unknown."); + else + defaultShardMaterials.add(materialID); + } + /** * Adds a tool material to the registry * diff --git a/src/main/java/tconstruct/tools/TinkerTools.java b/src/main/java/tconstruct/tools/TinkerTools.java index 69191943..2e9e6a62 100644 --- a/src/main/java/tconstruct/tools/TinkerTools.java +++ b/src/main/java/tconstruct/tools/TinkerTools.java @@ -171,7 +171,7 @@ public class TinkerTools TinkerTools.materials = new MaterialItem().setUnlocalizedName("tconstruct.Materials"); TinkerTools.toolRod = new DynamicToolPart("_rod", "ToolRod"); - TinkerTools.toolShard = new ToolShard("_chunk").setUnlocalizedName("tconstruct.ToolShard"); + TinkerTools.toolShard = new ToolShard("_chunk", "ToolShard"); TinkerTools.woodPattern = new Pattern("pattern_", "materials/").setUnlocalizedName("tconstruct.Pattern"); GameRegistry.registerItem(TinkerTools.materials, "materials"); GameRegistry.registerItem(TinkerTools.woodPattern, "woodPattern"); @@ -698,6 +698,9 @@ public class TinkerTools TConstructRegistry.addBowstringMaterial(1, 2, new ItemStack((Item) obj, 1, 7), new ItemStack(TinkerTools.bowstring, 1, 1), 1F, 1F, 0.9f, 0x63bcd9); TConstructRegistry.addBowMaterial(31, 576, 40, 1.2f); TConstructRegistry.addArrowMaterial(31, 1.8F, 0.5F, 100F); + + TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Thaumium); + TConstructRegistry.addDefaultShardMaterial(MaterialID.Thaumium); } else { @@ -809,6 +812,31 @@ public class TinkerTools TConstructRegistry.addDefaultToolPartMaterial(MaterialID.BlueSlime ); TConstructRegistry.addDefaultToolPartMaterial(MaterialID.PigIron); + // Register all the materials for default toolparts + //TConstructRegistry.addDefaultShardMaterial(MaterialID.Wood); + TConstructRegistry.addDefaultShardMaterial(MaterialID.Stone); + TConstructRegistry.addDefaultShardMaterial(MaterialID.Flint); + TConstructRegistry.addDefaultShardMaterial(MaterialID.Cactus); + //TConstructRegistry.addDefaultShardMaterial(MaterialID.Bone); + TConstructRegistry.addDefaultShardMaterial(MaterialID.Obsidian); + TConstructRegistry.addDefaultShardMaterial(MaterialID.Netherrack); + TConstructRegistry.addDefaultShardMaterial(MaterialID.Slime); + //TConstructRegistry.addDefaultShardMaterial(MaterialID.Paper); + TConstructRegistry.addDefaultShardMaterial(MaterialID.BlueSlime ); + + if(PHConstruct.craftMetalTools) + { + TConstructRegistry.addDefaultShardMaterial(MaterialID.Iron); + TConstructRegistry.addDefaultShardMaterial(MaterialID.Cobalt); + TConstructRegistry.addDefaultShardMaterial(MaterialID.Ardite); + TConstructRegistry.addDefaultShardMaterial(MaterialID.Manyullyn); + TConstructRegistry.addDefaultShardMaterial(MaterialID.Copper); + TConstructRegistry.addDefaultShardMaterial(MaterialID.Bronze); + TConstructRegistry.addDefaultShardMaterial(MaterialID.Alumite); + TConstructRegistry.addDefaultShardMaterial(MaterialID.Steel); + TConstructRegistry.addDefaultShardMaterial(MaterialID.PigIron); + } + PatternBuilder pb = PatternBuilder.instance; if (PHConstruct.enableTWood) pb.registerFullMaterial(Blocks.planks, 2, "Wood", new ItemStack(Items.stick), new ItemStack(Items.stick), 0); diff --git a/src/main/java/tconstruct/tools/items/ToolShard.java b/src/main/java/tconstruct/tools/items/ToolShard.java index 02af9f94..e8265af6 100644 --- a/src/main/java/tconstruct/tools/items/ToolShard.java +++ b/src/main/java/tconstruct/tools/items/ToolShard.java @@ -1,68 +1,29 @@ package tconstruct.tools.items; -import cpw.mods.fml.relauncher.*; -import java.util.List; -import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.item.*; -import net.minecraft.util.IIcon; -import tconstruct.tools.TinkerTools; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import tconstruct.library.TConstructRegistry; +import tconstruct.library.tools.DynamicToolPart; -public class ToolShard extends ToolPart +import java.util.List; + +public class ToolShard extends DynamicToolPart { - public ToolShard(String tex) + public ToolShard(String tex, String name) { - super(tex, "ToolShard"); - this.setHasSubtypes(true); - this.setMaxDamage(0); - } - - private static String[] buildTextureNames (String textureType) - { - String[] names = new String[toolMaterialNames.length]; - for (int i = 0; i < toolMaterialNames.length; i++) - { - if (!toolTextureNames[i].equals("")) - names[i] = toolTextureNames[i] + textureType; - } - return names; + super(tex, name); } @Override - @SideOnly(Side.CLIENT) - public void registerIcons (IIconRegister iconRegister) + public void getSubItems (Item item, CreativeTabs tab, List list) { - this.icons = new IIcon[textureNames.length]; - - for (int i = 0; i < 5; ++i) - { - this.icons[i] = iconRegister.registerIcon("tinker:" + folder + textureNames[i]); + // material id == metadata + for(Integer matID : TConstructRegistry.defaultShardMaterials) { + ItemStack stack = new ItemStack(item, 1, matID); + if (this.getMaterialID(stack) != -1) + list.add(stack); } - icons[5] = icons[4]; - for (int i = 6; i < 9; ++i) - { - this.icons[i] = iconRegister.registerIcon("tinker:" + folder + textureNames[i]); - } - icons[9] = icons[8]; - for (int i = 10; i < icons.length; ++i) - { - if (!toolTextureNames[i].equals("")) - this.icons[i] = iconRegister.registerIcon("tinker:" + folder + textureNames[i]); - } - } - - @Override - public void getSubItems (Item b, CreativeTabs tab, List list) - { - for (int i = 1; i < 5; i++) - list.add(new ItemStack(b, 1, i)); - for (int i = 6; i < 9; i++) - list.add(new ItemStack(b, 1, i)); - for (int i = 10; i < 19; i++) - list.add(new ItemStack(b, 1, i)); - - if (TinkerTools.thaumcraftAvailable) - list.add(new ItemStack(b, 1, 31)); } }