Search in sources :

Example 1 with CoordinatesPacket

use of logisticspipes.network.abstractpackets.CoordinatesPacket in project LogisticsPipes by RS485.

the class ModuleCrafter method setPrevSatellite.

public void setPrevSatellite(EntityPlayer player) {
    if (MainProxy.isClient(player.worldObj)) {
        final CoordinatesPacket packet = PacketHandler.getPacket(CPipePrevSatellite.class).setModulePos(this);
        MainProxy.sendPacketToServer(packet);
    } else {
        satelliteId = getNextConnectSatelliteId(true, -1);
        final CoordinatesPacket packet = PacketHandler.getPacket(CPipeSatelliteId.class).setPipeId(satelliteId).setModulePos(this);
        MainProxy.sendPacketToPlayer(packet, player);
    }
}
Also used : CPipePrevSatellite(logisticspipes.network.packets.cpipe.CPipePrevSatellite) CoordinatesPacket(logisticspipes.network.abstractpackets.CoordinatesPacket)

Example 2 with CoordinatesPacket

use of logisticspipes.network.abstractpackets.CoordinatesPacket in project LogisticsPipes by RS485.

the class ModuleCrafter method setNextSatellite.

public void setNextSatellite(EntityPlayer player) {
    if (MainProxy.isClient(player.worldObj)) {
        final CoordinatesPacket packet = PacketHandler.getPacket(CPipeNextSatellite.class).setModulePos(this);
        MainProxy.sendPacketToServer(packet);
    } else {
        satelliteId = getNextConnectSatelliteId(false, -1);
        final CoordinatesPacket packet = PacketHandler.getPacket(CPipeSatelliteId.class).setPipeId(satelliteId).setModulePos(this);
        MainProxy.sendPacketToPlayer(packet, player);
    }
}
Also used : CPipeNextSatellite(logisticspipes.network.packets.cpipe.CPipeNextSatellite) CoordinatesPacket(logisticspipes.network.abstractpackets.CoordinatesPacket)

Example 3 with CoordinatesPacket

use of logisticspipes.network.abstractpackets.CoordinatesPacket in project LogisticsPipes by RS485.

the class ModuleCrafter method importFromCraftingTable.

public void importFromCraftingTable(EntityPlayer player) {
    if (MainProxy.isClient(getWorld())) {
        // Send packet asking for import
        final CoordinatesPacket packet = PacketHandler.getPacket(CPipeSatelliteImport.class).setModulePos(this);
        MainProxy.sendPacketToServer(packet);
    } else {
        WorldCoordinatesWrapper worldCoordinates = new WorldCoordinatesWrapper(getWorld(), getX(), getY(), getZ());
        for (AdjacentTileEntity adjacent : worldCoordinates.getConnectedAdjacentTileEntities(ConnectionPipeType.ITEM).collect(Collectors.toList())) {
            for (ICraftingRecipeProvider provider : SimpleServiceLocator.craftingRecipeProviders) {
                if (provider.importRecipe(adjacent.tileEntity, _dummyInventory)) {
                    if (provider instanceof IFuzzyRecipeProvider) {
                        ((IFuzzyRecipeProvider) provider).importFuzzyFlags(adjacent.tileEntity, _dummyInventory, fuzzyCraftingFlagArray, outputFuzzyFlags);
                    }
                    // ToDo: break only out of the inner loop?
                    break;
                }
            }
        }
        // Send inventory as packet
        final CoordinatesPacket packet = PacketHandler.getPacket(CPipeSatelliteImportBack.class).setInventory(_dummyInventory).setModulePos(this);
        if (player != null) {
            MainProxy.sendPacketToPlayer(packet, player);
        }
        MainProxy.sendPacketToAllWatchingChunk(getX(), getZ(), MainProxy.getDimensionForWorld(getWorld()), packet);
    }
}
Also used : IFuzzyRecipeProvider(logisticspipes.proxy.interfaces.IFuzzyRecipeProvider) CPipeSatelliteImport(logisticspipes.network.packets.cpipe.CPipeSatelliteImport) ICraftingRecipeProvider(logisticspipes.proxy.interfaces.ICraftingRecipeProvider) WorldCoordinatesWrapper(network.rs485.logisticspipes.world.WorldCoordinatesWrapper) CoordinatesPacket(logisticspipes.network.abstractpackets.CoordinatesPacket) AdjacentTileEntity(network.rs485.logisticspipes.world.WorldCoordinatesWrapper.AdjacentTileEntity)

Aggregations

CoordinatesPacket (logisticspipes.network.abstractpackets.CoordinatesPacket)3 CPipeNextSatellite (logisticspipes.network.packets.cpipe.CPipeNextSatellite)1 CPipePrevSatellite (logisticspipes.network.packets.cpipe.CPipePrevSatellite)1 CPipeSatelliteImport (logisticspipes.network.packets.cpipe.CPipeSatelliteImport)1 ICraftingRecipeProvider (logisticspipes.proxy.interfaces.ICraftingRecipeProvider)1 IFuzzyRecipeProvider (logisticspipes.proxy.interfaces.IFuzzyRecipeProvider)1 WorldCoordinatesWrapper (network.rs485.logisticspipes.world.WorldCoordinatesWrapper)1 AdjacentTileEntity (network.rs485.logisticspipes.world.WorldCoordinatesWrapper.AdjacentTileEntity)1