Search in sources :

Example 1 with TileEntityAssemblyIOUnit

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

the class GuiAssemblyController method getStatusText.

private List<String> getStatusText() {
    List<String> text = new ArrayList<String>();
    List<IAssemblyMachine> machineList = te.getMachines();
    boolean platformFound = false;
    boolean drillFound = false;
    boolean laserFound = false;
    boolean IOUnitExportFound = false;
    boolean IOUnitImportFound = false;
    text.add("ยง7Machine Status:");
    for (IAssemblyMachine machine : machineList) {
        if (machine instanceof TileEntityAssemblyPlatform) {
            platformFound = true;
            text.add(EnumChatFormatting.GREEN + "-Assembly Platform online");
        } else if (machine instanceof TileEntityAssemblyDrill) {
            drillFound = true;
            text.add(EnumChatFormatting.GREEN + "-Assembly Drill online");
        } else if (machine instanceof TileEntityAssemblyIOUnit) {
            if (((TileEntityAssemblyIOUnit) machine).getBlockMetadata() == 0) {
                IOUnitImportFound = true;
                text.add(EnumChatFormatting.GREEN + "-Assembly IO Unit (import) online");
            } else {
                IOUnitExportFound = true;
                text.add(EnumChatFormatting.GREEN + "-Assembly IO Unit (export) online");
            }
        } else if (machine instanceof TileEntityAssemblyLaser) {
            laserFound = true;
            text.add(EnumChatFormatting.GREEN + "-Assembly Laser online");
        }
    }
    if (!platformFound)
        text.add(EnumChatFormatting.DARK_RED + "-Assembly Platform offline");
    if (!drillFound)
        text.add(EnumChatFormatting.DARK_RED + "-Assembly Drill offline");
    if (!laserFound)
        text.add(EnumChatFormatting.DARK_RED + "-Assembly Laser offline");
    if (!IOUnitExportFound)
        text.add(EnumChatFormatting.DARK_RED + "-Assembly IO Unit (export) offline");
    if (!IOUnitImportFound)
        text.add(EnumChatFormatting.DARK_RED + "-Assembly IO Unit (import) offline");
    return text;
}
Also used : TileEntityAssemblyDrill(pneumaticCraft.common.tileentity.TileEntityAssemblyDrill) TileEntityAssemblyLaser(pneumaticCraft.common.tileentity.TileEntityAssemblyLaser) TileEntityAssemblyIOUnit(pneumaticCraft.common.tileentity.TileEntityAssemblyIOUnit) ArrayList(java.util.ArrayList) TileEntityAssemblyPlatform(pneumaticCraft.common.tileentity.TileEntityAssemblyPlatform) IAssemblyMachine(pneumaticCraft.common.tileentity.IAssemblyMachine)

Example 2 with TileEntityAssemblyIOUnit

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

the class ModelAssemblyIOUnit method renderDynamic.

@Override
public void renderDynamic(float size, TileEntity te, float partialTicks) {
    FMLClientHandler.instance().getClient().getTextureManager().bindTexture(te != null && te.getBlockMetadata() == 0 ? Textures.MODEL_ASSEMBLY_IO_IMPORT : Textures.MODEL_ASSEMBLY_IO_EXPORT);
    if (te instanceof TileEntityAssemblyIOUnit) {
        TileEntityAssemblyIOUnit tile = (TileEntityAssemblyIOUnit) te;
        float[] renderAngles = new float[5];
        for (int i = 0; i < 5; i++) {
            renderAngles[i] = tile.oldAngles[i] + (tile.angles[i] - tile.oldAngles[i]) * partialTicks;
        }
        // float rotationAngle = (float) (720.0 *
        // (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
        EntityItem ghostEntityItem = null;
        if (tile.inventory[0] != null) {
            ghostEntityItem = new EntityItem(tile.getWorldObj());
            ghostEntityItem.hoverStart = 0.0F;
            ghostEntityItem.setEntityItemStack(tile.inventory[0]);
        }
        boolean fancySetting = RenderManager.instance.options.fancyGraphics;
        RenderManager.instance.options.fancyGraphics = true;
        renderModel(size, renderAngles, tile.oldClawProgress + (tile.clawProgress - tile.oldClawProgress) * partialTicks, ghostEntityItem);
        RenderManager.instance.options.fancyGraphics = fancySetting;
    } else {
        renderModel(size, new float[] { 0, 0, 35, 55, 0 }, 0, null);
    }
}
Also used : TileEntityAssemblyIOUnit(pneumaticCraft.common.tileentity.TileEntityAssemblyIOUnit) EntityItem(net.minecraft.entity.item.EntityItem)

Example 3 with TileEntityAssemblyIOUnit

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

the class BlockAssemblyIOUnit method dropInventory.

@Override
protected //Overriden here because the IOUnit isn't implementing IInventory (intentionally).
void dropInventory(World world, int x, int y, int z) {
    TileEntity tileEntity = world.getTileEntity(x, y, z);
    if (!(tileEntity instanceof TileEntityAssemblyIOUnit))
        return;
    TileEntityAssemblyIOUnit inventory = (TileEntityAssemblyIOUnit) tileEntity;
    Random rand = new Random();
    ItemStack itemStack = inventory.inventory[0];
    if (itemStack != null && itemStack.stackSize > 0) {
        float dX = rand.nextFloat() * 0.8F + 0.1F;
        float dY = rand.nextFloat() * 0.8F + 0.1F;
        float dZ = rand.nextFloat() * 0.8F + 0.1F;
        EntityItem entityItem = new EntityItem(world, x + dX, y + dY, z + dZ, new ItemStack(itemStack.getItem(), itemStack.stackSize, itemStack.getItemDamage()));
        if (itemStack.hasTagCompound()) {
            entityItem.getEntityItem().setTagCompound((NBTTagCompound) itemStack.getTagCompound().copy());
        }
        float factor = 0.05F;
        entityItem.motionX = rand.nextGaussian() * factor;
        entityItem.motionY = rand.nextGaussian() * factor + 0.2F;
        entityItem.motionZ = rand.nextGaussian() * factor;
        world.spawnEntityInWorld(entityItem);
        itemStack.stackSize = 0;
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) Random(java.util.Random) TileEntityAssemblyIOUnit(pneumaticCraft.common.tileentity.TileEntityAssemblyIOUnit) ItemStack(net.minecraft.item.ItemStack) EntityItem(net.minecraft.entity.item.EntityItem)

Aggregations

TileEntityAssemblyIOUnit (pneumaticCraft.common.tileentity.TileEntityAssemblyIOUnit)3 EntityItem (net.minecraft.entity.item.EntityItem)2 ArrayList (java.util.ArrayList)1 Random (java.util.Random)1 ItemStack (net.minecraft.item.ItemStack)1 TileEntity (net.minecraft.tileentity.TileEntity)1 IAssemblyMachine (pneumaticCraft.common.tileentity.IAssemblyMachine)1 TileEntityAssemblyDrill (pneumaticCraft.common.tileentity.TileEntityAssemblyDrill)1 TileEntityAssemblyLaser (pneumaticCraft.common.tileentity.TileEntityAssemblyLaser)1 TileEntityAssemblyPlatform (pneumaticCraft.common.tileentity.TileEntityAssemblyPlatform)1