Search in sources :

Example 11 with LogisticsTileGenericPipe

use of logisticspipes.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.

the class LogisticsTriggerProvider method getInternalTriggers.

@Override
public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer pipe) {
    if (pipe.getTile() instanceof LPBCTileGenericPipe) {
        LogisticsTileGenericPipe lPipe = ((LPBCTileGenericPipe) pipe.getTile()).getLpPipe();
        LinkedList<ITriggerInternal> triggers = new LinkedList<>();
        if (lPipe.pipe instanceof PipeItemsSupplierLogistics || lPipe.pipe instanceof PipeItemsFluidSupplier) {
            triggers.add(BuildCraftProxy.LogisticsFailedTrigger);
        }
        if (lPipe.pipe instanceof PipeItemsCraftingLogistics) {
            triggers.add(BuildCraftProxy.LogisticsCraftingTrigger);
        }
        if (lPipe.pipe instanceof CoreRoutedPipe) {
            //Only show this conditional on Gates that can accept parameters
            triggers.add(BuildCraftProxy.LogisticsHasDestinationTrigger);
        }
        if (!triggers.isEmpty()) {
            return triggers;
        }
    }
    return null;
}
Also used : PipeItemsCraftingLogistics(logisticspipes.pipes.PipeItemsCraftingLogistics) PipeItemsFluidSupplier(logisticspipes.pipes.PipeItemsFluidSupplier) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) PipeItemsSupplierLogistics(logisticspipes.pipes.PipeItemsSupplierLogistics) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) LPBCTileGenericPipe(logisticspipes.proxy.buildcraft.subproxies.LPBCTileGenericPipe) LinkedList(java.util.LinkedList) ITriggerInternal(buildcraft.api.statements.ITriggerInternal)

Example 12 with LogisticsTileGenericPipe

use of logisticspipes.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.

the class BuildCraftProxy method getBCRenderTESR.

@Override
public IBCRenderTESR getBCRenderTESR() {
    return new IBCRenderTESR() {

        @Override
        @SneakyThrows(Exception.class)
        public void renderWires(LogisticsTileGenericPipe pipe, double x, double y, double z) {
            TileGenericPipe tgPipe = (TileGenericPipe) pipe.tilePart.getOriginal();
            ReflectionHelper.invokePrivateMethod(Object.class, PipeRendererTESR.class, PipeRendererTESR.INSTANCE, "renderGatesWires", new Class[] { TileGenericPipe.class, double.class, double.class, double.class }, new Object[] { tgPipe, x, y, z });
        }

        @Override
        @SneakyThrows(Exception.class)
        public void dynamicRenderPluggables(LogisticsTileGenericPipe pipe, double x, double y, double z) {
            TileGenericPipe tgPipe = (TileGenericPipe) pipe.tilePart.getOriginal();
            ReflectionHelper.invokePrivateMethod(Object.class, PipeRendererTESR.class, PipeRendererTESR.INSTANCE, "renderPluggables", new Class[] { TileGenericPipe.class, double.class, double.class, double.class }, new Object[] { tgPipe, x, y, z });
        }
    };
}
Also used : IBCRenderTESR(logisticspipes.proxy.buildcraft.subproxies.IBCRenderTESR) LPBCTileGenericPipe(logisticspipes.proxy.buildcraft.subproxies.LPBCTileGenericPipe) TileGenericPipe(buildcraft.transport.TileGenericPipe) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe)

Example 13 with LogisticsTileGenericPipe

use of logisticspipes.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.

the class LogisticsNewSolidBlockWorldRenderer method renderWorldBlock.

public void renderWorldBlock(IBlockAccess world, LogisticsSolidTileEntity blockTile, RenderBlocks renderer, int x, int y, int z) {
    Tessellator tess = Tessellator.instance;
    SimpleServiceLocator.cclProxy.getRenderState().reset();
    SimpleServiceLocator.cclProxy.getRenderState().setUseNormals(true);
    SimpleServiceLocator.cclProxy.getRenderState().setAlphaOverride(0xff);
    BlockRotation rotation = BlockRotation.ZERO;
    int brightness = 0;
    IIconTransformation icon;
    if (blockTile != null) {
        BlockRotation.getRotation(blockTile.getRotation());
        brightness = new DoubleCoordinates(blockTile).getBlock(world).getMixedBrightnessForBlock(world, blockTile.xCoord, blockTile.yCoord, blockTile.zCoord);
        icon = SimpleServiceLocator.cclProxy.createIconTransformer(LogisticsSolidBlock.getNewIcon(world, blockTile.xCoord, blockTile.yCoord, blockTile.zCoord));
    } else {
        brightness = LogisticsPipes.LogisticsSolidBlock.getMixedBrightnessForBlock(world, x, y, z);
        icon = SimpleServiceLocator.cclProxy.createIconTransformer(LogisticsSolidBlock.getNewIcon(world, x, y, z));
    }
    tess.setColorOpaque_F(1F, 1F, 1F);
    tess.setBrightness(brightness);
    //Draw
    LogisticsNewSolidBlockWorldRenderer.block.get(rotation).render(new LPTranslation(x, y, z), icon);
    if (blockTile != null) {
        DoubleCoordinates pos = new DoubleCoordinates(blockTile);
        for (CoverSides side : CoverSides.values()) {
            boolean render = true;
            DoubleCoordinates newPos = CoordinateUtils.sum(pos, side.getDir(rotation));
            TileEntity sideTile = newPos.getTileEntity(blockTile.getWorldObj());
            if (sideTile instanceof LogisticsTileGenericPipe) {
                LogisticsTileGenericPipe tilePipe = (LogisticsTileGenericPipe) sideTile;
                if (tilePipe.renderState.pipeConnectionMatrix.isConnected(side.getDir(rotation).getOpposite())) {
                    render = false;
                }
            }
            if (render) {
                LogisticsNewSolidBlockWorldRenderer.texturePlate_Outer.get(side).get(rotation).render(new LPTranslation(x, y, z), icon);
                LogisticsNewSolidBlockWorldRenderer.texturePlate_Inner.get(side).get(rotation).render(new LPTranslation(x, y, z), icon);
            }
        }
    }
}
Also used : LPTranslation(logisticspipes.proxy.object3d.operation.LPTranslation) LogisticsSolidTileEntity(logisticspipes.blocks.LogisticsSolidTileEntity) TileEntity(net.minecraft.tileentity.TileEntity) Tessellator(net.minecraft.client.renderer.Tessellator) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) IIconTransformation(logisticspipes.proxy.object3d.interfaces.IIconTransformation) DoubleCoordinates(network.rs485.logisticspipes.world.DoubleCoordinates)

Example 14 with LogisticsTileGenericPipe

use of logisticspipes.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.

the class PipeMultiBlockTransportLogistics method handleTileReachedServer.

@Override
protected void handleTileReachedServer(LPTravelingItemServer arrivingItem, TileEntity tile, ForgeDirection dir) {
    markChunkModified(tile);
    if (tile instanceof LogisticsTileGenericPipe && ((LogisticsTileGenericPipe) tile).pipe instanceof CoreMultiBlockPipe) {
        passToNextPipe(arrivingItem, tile);
        return;
    } else if (tile instanceof LogisticsTileGenericSubMultiBlock) {
        List<LogisticsTileGenericPipe> masterTile = ((LogisticsTileGenericSubMultiBlock) tile).getMainPipe();
        if (!masterTile.isEmpty()) {
            if (masterTile.size() > 1) {
                throw new UnsupportedOperationException();
            }
            passToNextPipe(arrivingItem, masterTile.get(0));
            return;
        }
    }
    Explosion explosion = new Explosion(this.getWorld(), null, this.getPipe().getX(), this.getPipe().getY(), this.getPipe().getZ(), 4.0F);
    explosion.isFlaming = false;
    explosion.isSmoking = true;
    explosion.doExplosionB(true);
}
Also used : Explosion(net.minecraft.world.Explosion) CoreMultiBlockPipe(logisticspipes.pipes.basic.CoreMultiBlockPipe) LogisticsTileGenericSubMultiBlock(logisticspipes.pipes.basic.LogisticsTileGenericSubMultiBlock) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) List(java.util.List)

Example 15 with LogisticsTileGenericPipe

use of logisticspipes.pipes.basic.LogisticsTileGenericPipe in project LogisticsPipes by RS485.

the class PipeTransportLogistics method handleItemPositionPacket.

public void handleItemPositionPacket(int travelId, ForgeDirection input, ForgeDirection output, float speed, float position, float yaw) {
    WeakReference<LPTravelingItemClient> ref = LPTravelingItem.clientList.get(travelId);
    LPTravelingItemClient item = null;
    if (ref != null) {
        item = ref.get();
    }
    if (item == null) {
        sendItemContentRequest(travelId);
        item = new LPTravelingItemClient(travelId, position, input, output, yaw);
        item.setSpeed(speed);
        LPTravelingItem.clientList.put(travelId, new WeakReference<>(item));
    } else {
        if (item.getContainer() instanceof LogisticsTileGenericPipe) {
            ((LogisticsTileGenericPipe) item.getContainer()).pipe.transport.items.scheduleRemoval(item);
            ((LogisticsTileGenericPipe) item.getContainer()).pipe.transport.items.removeScheduledItems();
        }
        item.updateInformation(input, output, speed, position, yaw);
    }
    //update lastTicked so we don't double-move items
    item.lastTicked = MainProxy.getGlobalTick();
    if (items.get(travelId) == null) {
        items.add(item);
    }
//getPipe().spawnParticle(Particles.OrangeParticle, 1);
}
Also used : LPTravelingItemClient(logisticspipes.transport.LPTravelingItem.LPTravelingItemClient) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe)

Aggregations

LogisticsTileGenericPipe (logisticspipes.pipes.basic.LogisticsTileGenericPipe)115 CoreRoutedPipe (logisticspipes.pipes.basic.CoreRoutedPipe)47 TileEntity (net.minecraft.tileentity.TileEntity)45 DoubleCoordinates (network.rs485.logisticspipes.world.DoubleCoordinates)21 EnumFacing (net.minecraft.util.EnumFacing)15 ArrayList (java.util.ArrayList)14 List (java.util.List)12 EntityPlayer (net.minecraft.entity.player.EntityPlayer)10 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)10 BlockPos (net.minecraft.util.math.BlockPos)10 World (net.minecraft.world.World)9 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)9 HashMap (java.util.HashMap)8 LinkedList (java.util.LinkedList)8 PipeBlockRequestTable (logisticspipes.pipes.PipeBlockRequestTable)8 LogisticsPowerJunctionTileEntity (logisticspipes.blocks.powertile.LogisticsPowerJunctionTileEntity)7 MainProxy (logisticspipes.proxy.MainProxy)7 ExitRoute (logisticspipes.routing.ExitRoute)7 PipeLogisticsChassi (logisticspipes.pipes.PipeLogisticsChassi)6 SimpleServiceLocator (logisticspipes.proxy.SimpleServiceLocator)6