Search in sources :

Example 11 with ModernPacket

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

the class PipeItemsSatelliteLogistics method onWrenchClicked.

@Override
public void onWrenchClicked(EntityPlayer entityplayer) {
    // Send the satellite id when opening gui
    final ModernPacket packet = PacketHandler.getPacket(SatPipeSetID.class).setSatID(satelliteId).setPosX(getX()).setPosY(getY()).setPosZ(getZ());
    MainProxy.sendPacketToPlayer(packet, entityplayer);
    entityplayer.openGui(LogisticsPipes.instance, GuiIDs.GUI_SatellitePipe_ID, getWorld(), getX(), getY(), getZ());
}
Also used : ModernPacket(logisticspipes.network.abstractpackets.ModernPacket)

Example 12 with ModernPacket

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

the class PipeItemsSatelliteLogistics method setNextId.

public void setNextId(EntityPlayer player) {
    satelliteId = findId(1);
    ensureAllSatelliteStatus();
    if (MainProxy.isClient(player.worldObj)) {
        final ModernPacket packet = PacketHandler.getPacket(SatPipeNext.class).setPosX(getX()).setPosY(getY()).setPosZ(getZ());
        MainProxy.sendPacketToServer(packet);
    } else {
        final ModernPacket packet = PacketHandler.getPacket(SatPipeSetID.class).setSatID(satelliteId).setPosX(getX()).setPosY(getY()).setPosZ(getZ());
        MainProxy.sendPacketToPlayer(packet, player);
    }
    updateWatchers();
}
Also used : ModernPacket(logisticspipes.network.abstractpackets.ModernPacket) SatPipeNext(logisticspipes.network.packets.satpipe.SatPipeNext)

Example 13 with ModernPacket

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

the class PipeItemsSatelliteLogistics method playerStartWatching.

@Override
public void playerStartWatching(EntityPlayer player, int mode) {
    if (mode == 1) {
        localModeWatchers.add(player);
        final ModernPacket packet = PacketHandler.getPacket(SatPipeSetID.class).setSatID(satelliteId).setPosX(getX()).setPosY(getY()).setPosZ(getZ());
        MainProxy.sendPacketToPlayer(packet, player);
        updateInv(true);
    } else {
        super.playerStartWatching(player, mode);
    }
}
Also used : ModernPacket(logisticspipes.network.abstractpackets.ModernPacket)

Example 14 with ModernPacket

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

the class PipeFluidTransportLogistics method updateFluid.

private void updateFluid() {
    if (MainProxy.isClient(getWorld())) {
        return;
    }
    if (tracker.markTimeIfDelay(getWorld())) {
        boolean init = false;
        if (++clientSyncCounter > 40) {
            clientSyncCounter = 0;
            init = true;
        }
        if (clientSyncCounter < 0) {
            clientSyncCounter = 0;
        }
        ModernPacket packet = computeFluidUpdate(init, true);
        if (packet != null) {
            MainProxy.sendPacketToAllWatchingChunk(container.xCoord, container.zCoord, MainProxy.getDimensionForWorld(getWorld()), packet);
        }
    }
}
Also used : ModernPacket(logisticspipes.network.abstractpackets.ModernPacket)

Example 15 with ModernPacket

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

the class ModuleItemSink method setIgnoreNBT.

public void setIgnoreNBT(int slot, EntityPlayer player) {
    if (slot < 0 || slot >= 9) {
        return;
    }
    if (MainProxy.isClient(_world.getWorld())) {
        if (player == null) {
            MainProxy.sendPacketToServer(PacketHandler.getPacket(ItemSinkFuzzy.class).setPos(slot).setNBT(true).setModulePos(this));
        }
    } else {
        ignoreNBT.set(slot, !ignoreNBT.get(slot));
        ModernPacket pak = PacketHandler.getPacket(ItemSinkFuzzy.class).setIgnoreData(ignoreData).setIgnoreNBT(ignoreNBT).setModulePos(this);
        if (player != null) {
            MainProxy.sendPacketToPlayer(pak, player);
        }
        MainProxy.sendPacketToAllWatchingChunk(getX(), getZ(), MainProxy.getDimensionForWorld(_world.getWorld()), pak);
    }
}
Also used : ModernPacket(logisticspipes.network.abstractpackets.ModernPacket) ItemSinkFuzzy(logisticspipes.network.packets.modules.ItemSinkFuzzy)

Aggregations

ModernPacket (logisticspipes.network.abstractpackets.ModernPacket)16 ArrayList (java.util.ArrayList)2 ItemSinkFuzzy (logisticspipes.network.packets.modules.ItemSinkFuzzy)2 SatPipeNext (logisticspipes.network.packets.satpipe.SatPipeNext)2 SatPipePrev (logisticspipes.network.packets.satpipe.SatPipePrev)2 ClassInfo (com.google.common.reflect.ClassPath.ClassInfo)1 ByteBuf (io.netty.buffer.ByteBuf)1 LogisticsModule (logisticspipes.modules.abstractmodules.LogisticsModule)1 IPipeSign (logisticspipes.pipes.signs.IPipeSign)1 SneakyThrows (lombok.SneakyThrows)1