add in method to get block/item from unique name, multiservant logic now uses this in r/w custom nbt

This commit is contained in:
Progwml6 committed 2014-02-14 16:01:57 -05:00
1 parent 536362cc77
commit 4e17485459
3 files changed
+12 -3

No files matched your search

+5
View File
@@ -22,4 +22,9 @@ public class BlockUtils
return GameData.blockRegistry.getNameForObject(block);
}
public static Block getBlockFromUniqueName (String uniqueName)
{
return GameData.blockRegistry.getObject(uniqueName);
}
}
@@ -1,5 +1,6 @@
package mantle.blocks.abstracts;
import mantle.blocks.BlockUtils;
import mantle.blocks.iface.IMasterLogic;
import mantle.blocks.iface.IServantLogic;
import mantle.debug.DebugData;
@@ -123,7 +124,7 @@ public class MultiServantLogic extends TileEntity implements IServantLogic, IDeb
int yCenter = tags.getInteger("yCenter");
int zCenter = tags.getInteger("zCenter");
master = new CoordTuple(xCenter, yCenter, zCenter);
masterBlock = GameRegistry.findBlock(tags.getString("MasterModName"), tags.getString("MasterBlockName"));
masterBlock = BlockUtils.getBlockFromUniqueName(tags.getString("MasterBlockName"));
masterMeat = tags.getByte("masterMeat");
}
}
@@ -136,8 +137,7 @@ public class MultiServantLogic extends TileEntity implements IServantLogic, IDeb
tags.setInteger("xCenter", master.x);
tags.setInteger("yCenter", master.y);
tags.setInteger("zCenter", master.z);
tags.setString("MasterBlockName", masterBlock.getUnlocalizedName());//<- unlocalized name?
tags.setString("MasterModName", "TConstruct"); //TODO get mod name of block here!!
tags.setString("MasterBlockName", BlockUtils.getUniqueName(masterBlock));
tags.setByte("masterMeat", masterMeat);
}
}
+4
View File
@@ -9,4 +9,8 @@ public class ItemUtils
{
return GameData.itemRegistry.getNameForObject(item);
}
public static Item getItemFromUniqueName (String uniqueName)
{
return GameData.itemRegistry.getObject(uniqueName);
}
}