Search in sources :

Example 41 with Argument

use of mcjty.lib.network.Argument in project RFTools by McJty.

the class GuiShapeCard method updateVoidSettings.

private void updateVoidSettings() {
    if (fromTE) {
        ItemStack stack = getStackToEdit();
        if (!stack.isEmpty()) {
            NBTTagCompound tag = stack.getTagCompound();
            if (tag == null) {
                tag = new NBTTagCompound();
            }
            tag.setBoolean("voidstone", stone.isPressed());
            tag.setBoolean("voidcobble", cobble.isPressed());
            tag.setBoolean("voiddirt", dirt.isPressed());
            tag.setBoolean("voidgravel", gravel.isPressed());
            tag.setBoolean("voidsand", sand.isPressed());
            tag.setBoolean("voidnetherrack", netherrack.isPressed());
            tag.setBoolean("voidendstone", endstone.isPressed());
            tag.setBoolean("oredict", oredict.isPressed());
            RFToolsMessages.INSTANCE.sendToServer(new PacketUpdateNBTItemInventoryShape(fromTEPos, fromTEStackSlot, tag));
        }
    } else {
        RFToolsMessages.INSTANCE.sendToServer(new PacketUpdateNBTShapeCard(new Argument("voidstone", stone.isPressed()), new Argument("voidcobble", cobble.isPressed()), new Argument("voiddirt", dirt.isPressed()), new Argument("voidgravel", gravel.isPressed()), new Argument("voidsand", sand.isPressed()), new Argument("voidnetherrack", netherrack.isPressed()), new Argument("voidendstone", endstone.isPressed()), new Argument("oredict", oredict.isPressed())));
    }
}
Also used : Argument(mcjty.lib.network.Argument) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemStack(net.minecraft.item.ItemStack) PacketUpdateNBTShapeCard(mcjty.rftools.shapes.PacketUpdateNBTShapeCard)

Example 42 with Argument

use of mcjty.lib.network.Argument in project RFTools by McJty.

the class GuiShapeCard method updateSettings.

private void updateSettings() {
    int dx = parseInt(dimX.getText());
    int dy = parseInt(dimY.getText());
    int dz = parseInt(dimZ.getText());
    int max = Math.max(ScannerConfiguration.maxScannerDimension, BuilderConfiguration.maxBuilderDimension);
    if (dx < 0) {
        dx = 0;
    } else if (dx > max) {
        dx = max;
    }
    dimX.setText(Integer.toString(dx));
    if (dz < 0) {
        dz = 0;
    } else if (dz > max) {
        dz = max;
    }
    dimZ.setText(Integer.toString(dz));
    if (dy < 0) {
        dy = 0;
    } else if (dy > 256) {
        dy = 256;
    }
    dimY.setText(Integer.toString(dy));
    if (isTorus()) {
        dimZ.setText(dimX.getText());
    }
    if (fromTE) {
        ItemStack stack = getStackToEdit();
        if (!stack.isEmpty()) {
            NBTTagCompound tag = stack.getTagCompound();
            if (tag == null) {
                tag = new NBTTagCompound();
            }
            ShapeCardItem.setShape(stack, getCurrentShape(), isSolid());
            ShapeCardItem.setDimension(stack, dx, dy, dz);
            ShapeCardItem.setOffset(stack, parseInt(offsetX.getText()), parseInt(offsetY.getText()), parseInt(offsetZ.getText()));
            RFToolsMessages.INSTANCE.sendToServer(new PacketUpdateNBTItemInventoryShape(fromTEPos, fromTEStackSlot, tag));
        }
    } else {
        RFToolsMessages.INSTANCE.sendToServer(new PacketUpdateNBTShapeCard(new Argument("shapenew", getCurrentShape().getDescription()), new Argument("solid", isSolid()), new Argument("dimX", dx), new Argument("dimY", dy), new Argument("dimZ", dz), new Argument("offsetX", parseInt(offsetX.getText())), new Argument("offsetY", parseInt(offsetY.getText())), new Argument("offsetZ", parseInt(offsetZ.getText()))));
    }
}
Also used : Argument(mcjty.lib.network.Argument) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemStack(net.minecraft.item.ItemStack) PacketUpdateNBTShapeCard(mcjty.rftools.shapes.PacketUpdateNBTShapeCard)

Example 43 with Argument

use of mcjty.lib.network.Argument in project RFTools by McJty.

the class GuiBuilder method updateMode.

private void updateMode() {
    String currentChoice = modeChoice.getCurrentChoice();
    int mode = 0;
    for (int i = 0; i < MODES.length; i++) {
        if (currentChoice.equals(MODES[i])) {
            mode = i;
            break;
        }
    }
    sendServerCommand(RFToolsMessages.INSTANCE, CMD_SETMODE, new Argument("mode", mode));
}
Also used : Argument(mcjty.lib.network.Argument)

Example 44 with Argument

use of mcjty.lib.network.Argument in project RFTools by McJty.

the class GuiBooster method changeRedstoneMode.

private void changeRedstoneMode() {
    tileEntity.setRSMode(RedstoneMode.values()[redstoneMode.getCurrentChoiceIndex()]);
    sendServerCommand(RFToolsMessages.INSTANCE, BoosterTileEntity.CMD_RSMODE, new Argument("rs", RedstoneMode.values()[redstoneMode.getCurrentChoiceIndex()].getDescription()));
}
Also used : Argument(mcjty.lib.network.Argument)

Example 45 with Argument

use of mcjty.lib.network.Argument in project RFTools by McJty.

the class GuiDialingDevice method checkStatus.

private void checkStatus() {
    int receiverSelected = receiverList.getSelected();
    TeleportDestination destination = getSelectedReceiver(receiverSelected);
    if (destination == null) {
        return;
    }
    BlockPos c = destination.getCoordinate();
    RFToolsMessages.INSTANCE.sendToServer(new PacketRequestIntegerFromServer(RFTools.MODID, tileEntity.getPos(), DialingDeviceTileEntity.CMD_CHECKSTATUS, DialingDeviceTileEntity.CLIENTCMD_STATUS, new Argument("c", c), new Argument("dim", destination.getDimension())));
    lastCheckedReceiver = true;
    listDirty = 0;
}
Also used : Argument(mcjty.lib.network.Argument) PacketRequestIntegerFromServer(mcjty.lib.network.PacketRequestIntegerFromServer) BlockPos(net.minecraft.util.math.BlockPos)

Aggregations

Argument (mcjty.lib.network.Argument)97 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)8 Window (mcjty.lib.gui.Window)7 Panel (mcjty.lib.gui.widgets.Panel)6 ItemStack (net.minecraft.item.ItemStack)6 PacketServerCommand (mcjty.lib.network.PacketServerCommand)4 ArrayList (java.util.ArrayList)3 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)3 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)3 Label (mcjty.lib.gui.widgets.Label)3 PacketRequestIntegerFromServer (mcjty.lib.network.PacketRequestIntegerFromServer)3 java.awt (java.awt)2 Rectangle (java.awt.Rectangle)2 StyleConfig (mcjty.lib.base.StyleConfig)2 GenericEnergyStorageTileEntity (mcjty.lib.entity.GenericEnergyStorageTileEntity)2 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)2 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)2 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)2 ChoiceLabel (mcjty.lib.gui.widgets.ChoiceLabel)2 TextField (mcjty.lib.gui.widgets.TextField)2