Search in sources :

Example 1 with SatellitePipe

use of network.rs485.logisticspipes.SatellitePipe in project LogisticsPipes by RS485.

the class SatelliteSetNamePacket method processPacket.

@Override
public void processPacket(EntityPlayer player) {
    LogisticsTileGenericPipe pipe = this.getPipe(player.getEntityWorld(), LTGPCompletionCheck.PIPE);
    if (pipe == null || pipe.pipe == null) {
        return;
    }
    String newName = getString();
    SatelliteNamingResult result = null;
    if (newName.trim().isEmpty()) {
        result = SatelliteNamingResult.BLANK_NAME;
    } else if (pipe.pipe instanceof SatellitePipe) {
        final SatellitePipe satellitePipe = (SatellitePipe) pipe.pipe;
        if (satellitePipe.getSatellitesOfType().stream().anyMatch(it -> it.getSatellitePipeName().equals(newName))) {
            result = SatelliteNamingResult.DUPLICATE_NAME;
        } else {
            result = SatelliteNamingResult.SUCCESS;
            satellitePipe.setSatellitePipeName(newName);
            satellitePipe.updateWatchers();
            satellitePipe.ensureAllSatelliteStatus();
        }
    }
    if (result != null) {
        MainProxy.sendPacketToPlayer(PacketHandler.getPacket(SetNameResult.class).setResult(result).setNewName(getString()), player);
    }
}
Also used : ModernPacket(logisticspipes.network.abstractpackets.ModernPacket) SatellitePipe(network.rs485.logisticspipes.SatellitePipe) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) EntityPlayer(net.minecraft.entity.player.EntityPlayer) StaticResolve(logisticspipes.utils.StaticResolve) PacketHandler(logisticspipes.network.PacketHandler) MainProxy(logisticspipes.proxy.MainProxy) SatelliteNamingResult(logisticspipes.pipes.SatelliteNamingResult) StringCoordinatesPacket(logisticspipes.network.abstractpackets.StringCoordinatesPacket) SatellitePipe(network.rs485.logisticspipes.SatellitePipe) SatelliteNamingResult(logisticspipes.pipes.SatelliteNamingResult) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe)

Example 2 with SatellitePipe

use of network.rs485.logisticspipes.SatellitePipe in project LogisticsPipes by RS485.

the class GuiHandler method getClientGuiElement.

@Override
public Object getClientGuiElement(int ID, EntityPlayer player, final World world, int x, int y, int z) {
    if (ID == -1) {
        return getClientGuiElement(-100 * 20 + x, player, world, 0, -1, z);
    }
    TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
    LogisticsTileGenericPipe pipe = null;
    if (tile instanceof LogisticsTileGenericPipe) {
        pipe = (LogisticsTileGenericPipe) tile;
    }
    if (ID < 110 && ID > 0) {
        switch(ID) {
            case GuiIDs.GUI_FluidSupplier_ID:
                if (pipe == null || !(pipe.pipe instanceof PipeItemsFluidSupplier)) {
                    return null;
                }
                return new GuiFluidSupplierPipe(player.inventory, ((PipeItemsFluidSupplier) pipe.pipe).getDummyInventory(), (PipeItemsFluidSupplier) pipe.pipe);
            case GuiIDs.GUI_FluidSupplier_MK2_ID:
                if (pipe == null || !(pipe.pipe instanceof PipeFluidSupplierMk2)) {
                    return null;
                }
                return new GuiFluidSupplierMk2Pipe(player.inventory, ((PipeFluidSupplierMk2) pipe.pipe).getDummyInventory(), (PipeFluidSupplierMk2) pipe.pipe);
            case GuiIDs.GUI_SatellitePipe_ID:
                if (pipe != null && pipe.pipe instanceof SatellitePipe) {
                    return new GuiSatellitePipe(((SatellitePipe) pipe.pipe));
                }
                return null;
            case GuiIDs.GUI_Normal_Orderer_ID:
                return new NormalGuiOrderer(x, y, z, world.provider.getDimension(), player);
            case GuiIDs.GUI_Normal_Mk2_Orderer_ID:
                if (pipe == null || !(pipe.pipe instanceof PipeItemsRequestLogisticsMk2)) {
                    return null;
                }
                return new NormalMk2GuiOrderer(((PipeItemsRequestLogisticsMk2) pipe.pipe), player);
            case GuiIDs.GUI_Fluid_Orderer_ID:
                if (pipe == null || !(pipe.pipe instanceof PipeFluidRequestLogistics)) {
                    return null;
                }
                return new FluidGuiOrderer(((PipeFluidRequestLogistics) pipe.pipe), player);
            case GuiIDs.GUI_Freq_Card_ID:
                if (pipe == null || !((pipe.pipe instanceof PipeItemsSystemEntranceLogistics) || (pipe.pipe instanceof PipeItemsSystemDestinationLogistics))) {
                    return null;
                }
                IInventory inv = null;
                if (pipe.pipe instanceof PipeItemsSystemEntranceLogistics) {
                    inv = ((PipeItemsSystemEntranceLogistics) pipe.pipe).inv;
                } else if (pipe.pipe instanceof PipeItemsSystemDestinationLogistics) {
                    inv = ((PipeItemsSystemDestinationLogistics) pipe.pipe).inv;
                }
                return new GuiFreqCardContent(player, inv);
            case GuiIDs.GUI_HUD_Settings:
                return new GuiHUDSettings(player, x);
            case GuiIDs.GUI_Fluid_Basic_ID:
                if (pipe == null || !((pipe.pipe instanceof PipeFluidBasic))) {
                    return null;
                }
                return new GuiFluidBasic(player, ((PipeFluidBasic) pipe.pipe).getSinkInv());
            case GuiIDs.GUI_Fluid_Terminus_ID:
                if (pipe == null || !((pipe.pipe instanceof PipeFluidTerminus))) {
                    return null;
                }
                return new GuiFluidTerminus(player, ((PipeFluidTerminus) pipe.pipe));
            case GuiIDs.GUI_FIREWALL:
                if (pipe == null || !((pipe.pipe instanceof PipeItemsFirewall))) {
                    return null;
                }
                return new GuiFirewall((PipeItemsFirewall) pipe.pipe, player);
            case GuiIDs.GUI_Request_Table_ID:
                if (pipe == null || !(pipe.pipe instanceof PipeBlockRequestTable)) {
                    return null;
                }
                return new GuiRequestTable(player, ((PipeBlockRequestTable) pipe.pipe));
            default:
                break;
        }
    }
    return null;
}
Also used : GuiFreqCardContent(logisticspipes.gui.GuiFreqCardContent) GuiFluidSupplierPipe(logisticspipes.gui.GuiFluidSupplierPipe) PipeFluidBasic(logisticspipes.pipes.PipeFluidBasic) TileEntity(net.minecraft.tileentity.TileEntity) PipeFluidSupplierMk2(logisticspipes.pipes.PipeFluidSupplierMk2) PipeItemsFluidSupplier(logisticspipes.pipes.PipeItemsFluidSupplier) PipeFluidRequestLogistics(logisticspipes.pipes.PipeFluidRequestLogistics) PipeItemsSystemDestinationLogistics(logisticspipes.pipes.PipeItemsSystemDestinationLogistics) NormalGuiOrderer(logisticspipes.gui.orderer.NormalGuiOrderer) NormalMk2GuiOrderer(logisticspipes.gui.orderer.NormalMk2GuiOrderer) LogisticsTileGenericPipe(logisticspipes.pipes.basic.LogisticsTileGenericPipe) BlockPos(net.minecraft.util.math.BlockPos) PipeItemsRequestLogisticsMk2(logisticspipes.pipes.PipeItemsRequestLogisticsMk2) GuiHUDSettings(logisticspipes.gui.hud.GuiHUDSettings) FluidGuiOrderer(logisticspipes.gui.orderer.FluidGuiOrderer) IInventory(net.minecraft.inventory.IInventory) GuiSatellitePipe(logisticspipes.gui.GuiSatellitePipe) PipeItemsFirewall(logisticspipes.pipes.PipeItemsFirewall) PipeBlockRequestTable(logisticspipes.pipes.PipeBlockRequestTable) GuiFirewall(logisticspipes.gui.GuiFirewall) PipeItemsSystemEntranceLogistics(logisticspipes.pipes.PipeItemsSystemEntranceLogistics) GuiFluidBasic(logisticspipes.gui.GuiFluidBasic) PipeFluidTerminus(logisticspipes.pipes.PipeFluidTerminus) SatellitePipe(network.rs485.logisticspipes.SatellitePipe) GuiSatellitePipe(logisticspipes.gui.GuiSatellitePipe) GuiRequestTable(logisticspipes.gui.orderer.GuiRequestTable) GuiFluidTerminus(logisticspipes.gui.GuiFluidTerminus) GuiFluidSupplierMk2Pipe(logisticspipes.gui.GuiFluidSupplierMk2Pipe)

Aggregations

LogisticsTileGenericPipe (logisticspipes.pipes.basic.LogisticsTileGenericPipe)2 SatellitePipe (network.rs485.logisticspipes.SatellitePipe)2 GuiFirewall (logisticspipes.gui.GuiFirewall)1 GuiFluidBasic (logisticspipes.gui.GuiFluidBasic)1 GuiFluidSupplierMk2Pipe (logisticspipes.gui.GuiFluidSupplierMk2Pipe)1 GuiFluidSupplierPipe (logisticspipes.gui.GuiFluidSupplierPipe)1 GuiFluidTerminus (logisticspipes.gui.GuiFluidTerminus)1 GuiFreqCardContent (logisticspipes.gui.GuiFreqCardContent)1 GuiSatellitePipe (logisticspipes.gui.GuiSatellitePipe)1 GuiHUDSettings (logisticspipes.gui.hud.GuiHUDSettings)1 FluidGuiOrderer (logisticspipes.gui.orderer.FluidGuiOrderer)1 GuiRequestTable (logisticspipes.gui.orderer.GuiRequestTable)1 NormalGuiOrderer (logisticspipes.gui.orderer.NormalGuiOrderer)1 NormalMk2GuiOrderer (logisticspipes.gui.orderer.NormalMk2GuiOrderer)1 PacketHandler (logisticspipes.network.PacketHandler)1 ModernPacket (logisticspipes.network.abstractpackets.ModernPacket)1 StringCoordinatesPacket (logisticspipes.network.abstractpackets.StringCoordinatesPacket)1 PipeBlockRequestTable (logisticspipes.pipes.PipeBlockRequestTable)1 PipeFluidBasic (logisticspipes.pipes.PipeFluidBasic)1 PipeFluidRequestLogistics (logisticspipes.pipes.PipeFluidRequestLogistics)1