Search in sources :

Example 11 with TileEntityPressureTube

use of pneumaticCraft.common.tileentity.TileEntityPressureTube 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 TileEntityPressureTube

use of pneumaticCraft.common.tileentity.TileEntityPressureTube in project PneumaticCraft by MineMaarten.

the class PartPressureTube method update.

@Override
public void update() {
    //Log.info("sides connected " + world().isRemote + ": " + Arrays.toString(sidesConnected));
    if (Config.convertMultipartsToBlocks && !world().isRemote) {
        Log.info("Converting Pressure Tube part to Pressure Tube block at " + x() + ", " + y() + ", " + z());
        Block pressureTube = Block.getBlockFromItem(getItem().getItem());
        world().setBlock(x(), y(), z(), pressureTube);
        TileEntityPressureTube t = (TileEntityPressureTube) world().getTileEntity(x(), y(), z());
        NBTTagCompound tag = new NBTTagCompound();
        tube.writeToNBTI(tag);
        t.readFromNBT(tag);
        world().notifyBlocksOfNeighborChange(x(), y(), z(), pressureTube);
        return;
    }
    tube.updateEntityI();
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Block(net.minecraft.block.Block) TileEntityPressureTube(pneumaticCraft.common.tileentity.TileEntityPressureTube)

Aggregations

TileEntityPressureTube (pneumaticCraft.common.tileentity.TileEntityPressureTube)12 TubeModule (pneumaticCraft.common.block.tubes.TubeModule)5 TileEntity (net.minecraft.tileentity.TileEntity)4 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)4 ItemTubeModule (pneumaticCraft.common.item.ItemTubeModule)4 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 MovingObjectPosition (net.minecraft.util.MovingObjectPosition)2 SideOnly (cpw.mods.fml.relauncher.SideOnly)1 HashSet (java.util.HashSet)1 Stack (java.util.Stack)1 Block (net.minecraft.block.Block)1 EntityItem (net.minecraft.entity.item.EntityItem)1 ItemStack (net.minecraft.item.ItemStack)1 AxisAlignedBB (net.minecraft.util.AxisAlignedBB)1 Vec3 (net.minecraft.util.Vec3)1 TubeModuleRedstoneEmitting (pneumaticCraft.common.block.tubes.TubeModuleRedstoneEmitting)1 TileEntityPneumaticBase (pneumaticCraft.common.tileentity.TileEntityPneumaticBase)1 TileEntityCache (pneumaticCraft.common.util.TileEntityCache)1