Materials that shall have toolparts created for them have to be registered specifically now. Registering a material via IMC does so automatically. Should also fix the double-toolparts with extratic and other mod relying on the 1.6 API.

This commit is contained in:
Bernhard Bonigl committed 2014-10-15 23:17:41 +02:00
1 parent c824f68b79
commit c0e46f151b
4 files changed
+36 -2

No files matched your search

@@ -219,6 +219,15 @@ public class TConstructRegistry
// Materials
public static HashMap<Integer, ToolMaterial> toolMaterials = new HashMap<Integer, ToolMaterial>(40);
public static HashMap<String, ToolMaterial> toolMaterialStrings = new HashMap<String, ToolMaterial>(40);
public static List<Integer> defaultToolPartMaterials = new LinkedList<Integer>();
public static void addDefaultToolPartMaterial(int materialID)
{
if(!toolMaterials.containsKey(materialID))
logger.error("[TCon API] Can't add default toolpart: Material ID " + materialID + " is unknown.");
else
defaultToolPartMaterials.add(materialID);
}
/**
* Adds a tool material to the registry
@@ -98,8 +98,11 @@ public class DynamicToolPart extends CraftingItem implements IToolPart
return;
// material id == metadata
for(Integer matID : TConstructRegistry.toolMaterials.keySet())
list.add(new ItemStack(item, 1, matID));
for(Integer matID : TConstructRegistry.defaultToolPartMaterials) {
ItemStack stack = new ItemStack(item, 1, matID);
if (this.getMaterialID(stack) != -1)
list.add(stack);
}
}
@Override
@@ -788,6 +788,27 @@ public class TinkerTools
TConstructRegistry.addFletchingMaterial(2, 2, new ItemStack(TinkerTools.materials, 1, 1), new ItemStack(TinkerTools.fletching, 1, 2), 100F, 0F, 0.12F, 0x82c873); // Slime
TConstructRegistry.addFletchingMaterial(3, 2, new ItemStack(TinkerTools.materials, 1, 17), new ItemStack(TinkerTools.fletching, 1, 3), 100F, 0F, 0.12F, 0x74c8c7); // BlueSlime
// Register all the materials for default toolparts
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Wood);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Stone);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Iron);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Flint);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Cactus);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Bone);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Obsidian);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Netherrack);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Slime);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Paper);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Cobalt);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Ardite);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Manyullyn);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Copper);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Bronze);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Alumite);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.Steel);
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.BlueSlime );
TConstructRegistry.addDefaultToolPartMaterial(MaterialID.PigIron);
PatternBuilder pb = PatternBuilder.instance;
if (PHConstruct.enableTWood)
pb.registerFullMaterial(Blocks.planks, 2, "Wood", new ItemStack(Items.stick), new ItemStack(Items.stick), 0);
@@ -49,6 +49,7 @@ public final class IMCHandler {
ToolMaterial mat = scanMaterial(tag);
if(mat != null) {
TConstructRegistry.addtoolMaterial(tag.getInteger("Id"), mat);
TConstructRegistry.addDefaultToolPartMaterial(tag.getInteger("Id"));
TConstruct.logger.info("IMC: Added material " + mat.materialName);
}
}