use of pneumaticCraft.common.block.tubes.TubeModule in project PneumaticCraft by MineMaarten.
the class WailaFMPHandler method getWailaBody.
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaFMPAccessor accessor, IWailaConfigHandler config) {
TileEntityPressureTube tube = ModInteractionUtils.getInstance().getTube(accessor.getTileEntity());
if (tube != null) {
NBTTagCompound tubeTag = accessor.getNBTData().getCompoundTag("tube");
tube.currentAir = tubeTag.getInteger("currentAir");
WailaPneumaticHandler.addTipToMachine(currenttip, tube);
TubeModule module = BlockPressureTube.getLookedModule(accessor.getWorld(), accessor.getTileEntity().xCoord, accessor.getTileEntity().yCoord, accessor.getTileEntity().zCoord, accessor.getPlayer());
if (module != null) {
WailaTubeModuleHandler.addModuleInfo(currenttip, tube, tubeTag, module.getDirection());
}
}
return currenttip;
}
use of pneumaticCraft.common.block.tubes.TubeModule in project PneumaticCraft by MineMaarten.
the class WailaTubeModuleHandler method addModuleInfo.
public static void addModuleInfo(List<String> currenttip, TileEntityPressureTube tube, NBTTagCompound tubeTag, ForgeDirection dir) {
if (dir != ForgeDirection.UNKNOWN) {
NBTTagList moduleList = tubeTag.getTagList("modules", 10);
for (int i = 0; i < moduleList.tagCount(); i++) {
NBTTagCompound moduleTag = moduleList.getCompoundTagAt(i);
if (dir == ForgeDirection.getOrientation(moduleTag.getInteger("side"))) {
if (tube != null && tube.modules[dir.ordinal()] != null) {
TubeModule module = tube.modules[dir.ordinal()];
module.readFromNBT(moduleTag);
module.addInfo(currenttip);
}
}
}
}
}
use of pneumaticCraft.common.block.tubes.TubeModule in project PneumaticCraft by MineMaarten.
the class ClientProxy method registerModuleRenderers.
public void registerModuleRenderers() {
Collection<Item> moduleItems = ModuleRegistrator.moduleItems.values();
Collection<Class<? extends TubeModule>> modules = ModuleRegistrator.modules.values();
Iterator<Item> itemIterator = moduleItems.iterator();
Iterator<Class<? extends TubeModule>> moduleIterator = modules.iterator();
while (itemIterator.hasNext()) {
try {
MinecraftForgeClient.registerItemRenderer(itemIterator.next(), new RenderItemTubeModule(moduleIterator.next().newInstance()));
} catch (Exception e) {
Log.error("Something happened when registering tube module renderers!");
e.printStackTrace();
}
}
}
Aggregations