Search in sources :

Example 11 with TubeModule

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;
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) TubeModule(pneumaticCraft.common.block.tubes.TubeModule) TileEntityPressureTube(pneumaticCraft.common.tileentity.TileEntityPressureTube)

Example 12 with TubeModule

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);
                }
            }
        }
    }
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) TubeModule(pneumaticCraft.common.block.tubes.TubeModule)

Example 13 with TubeModule

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();
        }
    }
}
Also used : Item(net.minecraft.item.Item) TubeModule(pneumaticCraft.common.block.tubes.TubeModule) RenderItemTubeModule(pneumaticCraft.client.render.itemblock.RenderItemTubeModule) RenderItemTubeModule(pneumaticCraft.client.render.itemblock.RenderItemTubeModule)

Aggregations

TubeModule (pneumaticCraft.common.block.tubes.TubeModule)13 TileEntityPressureTube (pneumaticCraft.common.tileentity.TileEntityPressureTube)5 ItemTubeModule (pneumaticCraft.common.item.ItemTubeModule)4 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)3 SideOnly (cpw.mods.fml.relauncher.SideOnly)2 NBTTagList (net.minecraft.nbt.NBTTagList)2 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)2 EntityItem (net.minecraft.entity.item.EntityItem)1 Item (net.minecraft.item.Item)1 ItemStack (net.minecraft.item.ItemStack)1 TileEntity (net.minecraft.tileentity.TileEntity)1 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)1 MovingObjectPosition (net.minecraft.util.MovingObjectPosition)1 Pair (org.apache.commons.lang3.tuple.Pair)1 IAirHandler (pneumaticCraft.api.tileentity.IAirHandler)1 RenderItemTubeModule (pneumaticCraft.client.render.itemblock.RenderItemTubeModule)1