Made special renderer work for metadatas

This commit is contained in:
Ellpeck 2015-11-15 00:57:38 +01:00
parent 2be8b18d71
commit b977909092
2 changed files with 28 additions and 17 deletions

View file

@ -1,4 +1,4 @@
ellpeck=ActuallyAdditions:itemPhantomConnector ellpeck=ActuallyAdditions:itemCrystal@4
dqmhose=minecraft:torch dqmhose=minecraft:torch@0
twoofeight=ActuallyAdditions:blockHeatCollector twoofeight=ActuallyAdditions:blockHeatCollector@0
larixine=ActuallyAdditions:blockBlackLotus larixine=ActuallyAdditions:blockBlackLotus@0

View file

@ -48,22 +48,33 @@ public class SpecialRenderInit{
public static void parse(Properties properties){ public static void parse(Properties properties){
for(String key : properties.stringPropertyNames()){ for(String key : properties.stringPropertyNames()){
String value = properties.getProperty(key); String[] values = properties.getProperty(key).split("@");
if(values != null && values.length > 0){
String itemName = values[0];
ItemStack stack = null; int meta;
//Get the Item from the String try{
if(Item.itemRegistry.containsKey(value)){ meta = Integer.parseInt(values[1]);
stack = new ItemStack((Item)Item.itemRegistry.getObject(value)); }
} catch(Exception e){
else{ meta = 0;
if(Block.blockRegistry.containsKey(value)){
stack = new ItemStack((Block)Block.blockRegistry.getObject(value));
} }
}
//Add a new Special Renderer to the list ItemStack stack = null;
if(stack != null){ //Get the Item from the String
specialList.put(key, new RenderSpecial(stack)); if(Item.itemRegistry.containsKey(itemName)){
stack = new ItemStack((Item)Item.itemRegistry.getObject(itemName), 1, meta);
}
else{
if(Block.blockRegistry.containsKey(itemName)){
stack = new ItemStack((Block)Block.blockRegistry.getObject(itemName), 1, meta);
}
}
//Add a new Special Renderer to the list
if(stack != null){
specialList.put(key, new RenderSpecial(stack));
}
} }
} }
} }