Search in sources :

Example 6 with PacketGuiReturn

use of mods.railcraft.common.util.network.PacketGuiReturn in project Railcraft by Railcraft.

the class GuiDetectorItem method actionPerformed.

@Override
protected void actionPerformed(GuiButton button) {
    if (tile == null)
        return;
    int primary = detector.getPrimaryMode().ordinal();
    int filter = detector.getFilterMode().ordinal();
    switch(button.id) {
        case 0:
            primary--;
            break;
        case 1:
            primary++;
            break;
        case 2:
            filter--;
            break;
        case 3:
            filter++;
            break;
    }
    if (primary < 0)
        primary = DetectorItem.PrimaryMode.values().length - 1;
    if (primary >= DetectorItem.PrimaryMode.values().length)
        primary = 0;
    detector.setPrimaryMode(DetectorItem.PrimaryMode.values()[primary]);
    if (filter < 0)
        filter = DetectorItem.FilterMode.values().length - 1;
    if (filter >= DetectorItem.FilterMode.values().length)
        filter = 0;
    detector.setFilterMode(DetectorItem.FilterMode.values()[filter]);
    if (Game.isClient(tile.getWorld())) {
        PacketGuiReturn pkt = new PacketGuiReturn(tile);
        PacketDispatcher.sendToServer(pkt);
    }
}
Also used : PacketGuiReturn(mods.railcraft.common.util.network.PacketGuiReturn)

Example 7 with PacketGuiReturn

use of mods.railcraft.common.util.network.PacketGuiReturn in project Railcraft by Railcraft.

the class GuiBoxController method onGuiClosed.

@Override
public void onGuiClosed() {
    if (Game.isClient(tile.getWorld())) {
        tile.defaultAspect = defaultAspect;
        tile.poweredAspect = poweredAspect;
        PacketGuiReturn pkt = new PacketGuiReturn(tile);
        PacketDispatcher.sendToServer(pkt);
    }
}
Also used : PacketGuiReturn(mods.railcraft.common.util.network.PacketGuiReturn)

Example 8 with PacketGuiReturn

use of mods.railcraft.common.util.network.PacketGuiReturn in project Railcraft by Railcraft.

the class GuiBoxAnalogController method onGuiClosed.

@Override
public void onGuiClosed() {
    if (Game.isClient(tile.getWorld())) {
        for (Map.Entry<SignalAspect, BitSet> entry : aspects.entrySet()) {
            parseRegex(textBox.get(entry.getKey()).getText(), entry.getValue());
        }
        tile.aspects = aspects;
        PacketGuiReturn pkt = new PacketGuiReturn(tile);
        PacketDispatcher.sendToServer(pkt);
    }
}
Also used : SignalAspect(mods.railcraft.api.signals.SignalAspect) BitSet(java.util.BitSet) EnumMap(java.util.EnumMap) Map(java.util.Map) PacketGuiReturn(mods.railcraft.common.util.network.PacketGuiReturn)

Example 9 with PacketGuiReturn

use of mods.railcraft.common.util.network.PacketGuiReturn in project Railcraft by Railcraft.

the class GuiBoxCapacitor method onGuiClosed.

@Override
public void onGuiClosed() {
    if (Game.isClient(tile.getWorld())) {
        tile.ticksToPower = ticksToPower;
        tile.getStateModeController().setCurrentState(stateMode.getController().getCurrentState());
        PacketGuiReturn pkt = new PacketGuiReturn(tile);
        PacketDispatcher.sendToServer(pkt);
    }
}
Also used : PacketGuiReturn(mods.railcraft.common.util.network.PacketGuiReturn)

Example 10 with PacketGuiReturn

use of mods.railcraft.common.util.network.PacketGuiReturn in project Railcraft by Railcraft.

the class GuiTrackEmbarking method onGuiClosed.

@Override
public void onGuiClosed() {
    track.setArea(radius);
    if (Game.isClient(track.theWorldAsserted())) {
        PacketGuiReturn pkt = new PacketGuiReturn((IGuiReturnHandler) track.getTile());
        pkt.sendPacket();
    }
}
Also used : PacketGuiReturn(mods.railcraft.common.util.network.PacketGuiReturn)

Aggregations

PacketGuiReturn (mods.railcraft.common.util.network.PacketGuiReturn)14 BitSet (java.util.BitSet)1 EnumMap (java.util.EnumMap)1 Map (java.util.Map)1 SignalAspect (mods.railcraft.api.signals.SignalAspect)1 IGuiReturnHandler (mods.railcraft.common.util.network.IGuiReturnHandler)1