Search in sources :

Example 26 with LogisticsTileGenericPipe

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

the class ItemBufferSyncPacket method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    LogisticsTileGenericPipe pipe = this.getPipe(player.getEntityWorld());
    if (pipe == null || pipe.pipe == null || pipe.pipe.transport == null) {
        return;
    }
    pipe.pipe.transport._itemBuffer.clear();
    pipe.pipe.transport._itemBuffer.addAll(getList());
}
Also used : LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe)

Example 27 with LogisticsTileGenericPipe

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

the class PipeManagerContentPacket method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    LogisticsTileGenericPipe pipe = this.getPipe(player.getEntityWorld());
    if (pipe == null || !(pipe.pipe instanceof CoreRoutedPipe)) {
        return;
    }
    CoreRoutedPipe cPipe = (CoreRoutedPipe) pipe.pipe;
    cPipe.getClientSideOrderManager().clear();
    cPipe.getClientSideOrderManager().addAll(clientOrder);
}
Also used : LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe)

Example 28 with LogisticsTileGenericPipe

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

the class RequestRoutingLasersPacket method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    LogisticsTileGenericPipe tile = this.getPipe(player.world);
    if (tile == null) {
        return;
    }
    if (tile.pipe instanceof CoreRoutedPipe) {
        IRouter router = ((CoreRoutedPipe) tile.pipe).getRouter();
        // this is here to allow players to manually trigger a network-wide LSA update
        router.forceLsaUpdate();
        List<List<ExitRoute>> exits = router.getRouteTable();
        HashMap<EnumFacing, ArrayList<ExitRoute>> routers = new HashMap<>();
        for (List<ExitRoute> exit : exits) {
            if (exit == null) {
                continue;
            }
            for (ExitRoute e : exit) {
                if (!routers.containsKey(e.exitOrientation)) {
                    routers.put(e.exitOrientation, new ArrayList<>());
                }
                if (!routers.get(e.exitOrientation).contains(e)) {
                    routers.get(e.exitOrientation).add(e);
                }
            }
        }
        ArrayList<LaserData> lasers = new ArrayList<>();
        firstPipe = true;
        for (final EnumFacing dir : routers.keySet()) {
            if (dir == null) {
                continue;
            }
            handleRouteInDirection(tile, dir, routers.get(dir), lasers, EnumSet.allOf(PipeRoutingConnectionType.class), new Log() {

                @Override
                void log(String log) {
                    if (LogisticsPipes.isDEBUG()) {
                        System.out.println(dir.name() + ": " + log);
                    }
                }
            });
        }
        lasers = compressLasers(lasers);
        MainProxy.sendPacketToPlayer(PacketHandler.getPacket(RoutingLaserPacket.class).setLasers(lasers), player);
    }
}
Also used : PipeRoutingConnectionType(logisticspipes.routing.PipeRoutingConnectionType) HashMap(java.util.HashMap) EnumFacing(net.minecraft.util.EnumFacing) ArrayList(java.util.ArrayList) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe) IRouter(logisticspipes.routing.IRouter) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) List(java.util.List) LaserData(logisticspipes.routing.LaserData) ExitRoute(logisticspipes.routing.ExitRoute)

Example 29 with LogisticsTileGenericPipe

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

the class PipeTileStatePacket method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    LogisticsTileGenericPipe pipe = this.getPipe(player.getEntityWorld(), LTGPCompletionCheck.NONE);
    if (pipe == null) {
        return;
    }
    if (pipe.statePacketId < statePacketId) {
        LPDataIOWrapper.provideData(bytesRenderState, pipe.renderState::readData);
        LPDataIOWrapper.provideData(bytesCoreState, pipe.coreState::readData);
        pipe.afterStateUpdated();
        if (pipe.pipe != null && bytesPipe.length != 0) {
            LPDataIOWrapper.provideData(bytesPipe, pipe.pipe::readData);
        }
        pipe.statePacketId = statePacketId;
    }
}
Also used : LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe)

Example 30 with LogisticsTileGenericPipe

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

the class RequestSignPacket method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    LogisticsTileGenericPipe pipe = this.getPipe(player.getEntityWorld());
    if (pipe == null) {
        return;
    }
    ((CoreRoutedPipe) pipe.pipe).sendSignData(player, false);
}
Also used : LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) CoreRoutedPipe(logisticspipes.pipes.basic.CoreRoutedPipe)

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