Merge branch 'master' into weaponry

Conflicts:
	src/main/java/tconstruct/tools/TinkerTools.java
This commit is contained in:
Bernhard Bonigl committed 2014-10-16 16:13:11 +02:00
commit 65ce5f23c2
11 files changed
+163 -67

No files matched your search

@@ -220,6 +220,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
@@ -78,7 +78,14 @@ public class DynamicToolPart extends CraftingItem implements IToolPart
// general name
else
{
return StatCollector.translateToLocal("toolpart." + partName).replaceAll("%%material", toolmat.prefixName());
// specific material name for materials?
String matName;
if(StatCollector.canTranslate("toolpart.material." + material))
matName = StatCollector.translateToLocal("toolpart.material." + material);
else
matName = toolmat.prefixName();
return StatCollector.translateToLocal("toolpart." + partName).replaceAll("%%material", matName);
}
}
@@ -98,8 +105,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
@@ -258,6 +258,10 @@ public abstract class HarvestTool extends ToolCore
}
return;
}
// callback to the tool the player uses. Called on both sides. This damages the tool n stuff.
player.getCurrentEquippedItem().func_150999_a(world, block, x, y, z, player);
// server sided handling
if (!world.isRemote) {
// serverside we reproduce ItemInWorldManager.tryHarvestBlock