Search in sources :

Example 1 with PacketSendServerCommand

use of mcjty.lib.network.PacketSendServerCommand in project RFToolsControl by McJty.

the class ProcessorRenderer method renderGfx.

private void renderGfx(ProcessorTileEntity tileEntity) {
    long t = System.currentTimeMillis();
    if (t - tileEntity.clientTime > 250) {
        RFToolsCtrlMessages.INSTANCE.sendToServer(new PacketSendServerCommand(RFToolsControl.MODID, CommandHandler.CMD_GETGRAPHICS, Arguments.builder().value(tileEntity.getPos()).build()));
        tileEntity.clientTime = t;
    }
    List<GfxOp> ops = tileEntity.getClientGfxOps();
    if (ops != null) {
        for (GfxOp op : ops) {
            op.render();
        }
    }
}
Also used : GfxOp(mcjty.rftoolscontrol.blocks.vectorart.GfxOp) PacketSendServerCommand(mcjty.lib.network.PacketSendServerCommand)

Example 2 with PacketSendServerCommand

use of mcjty.lib.network.PacketSendServerCommand in project RFToolsControl by McJty.

the class GuiCraftingCard method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(iconLocation);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    toplevel.addChild(new Label(mc, this).setText("Regular 3x3 crafting recipe").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 4, 160, 14)));
    toplevel.addChild(new Label(mc, this).setText("or more complicated recipes").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 17, 160, 14)));
    toplevel.addChild(new Button(mc, this).setText("Update").setTooltips("Update the item in the output", "slot to the recipe in the", "3x3 grid").addButtonEvent(parent -> RFToolsCtrlMessages.INSTANCE.sendToServer(new PacketSendServerCommand(RFToolsControl.MODID, CommandHandler.CMD_TESTRECIPE, Arguments.EMPTY))).setLayoutHint(new PositionalLayout.PositionalHint(110, 57, 60, 14)));
    ToggleButton toggle = new ToggleButton(mc, this).setCheckMarker(true).setText("NBT").setTooltips("Enable this if you want", "opcodes like 'get_ingredients'", "to strictly match on NBT").setLayoutHint(new PositionalLayout.PositionalHint(110, 74, 60, 14));
    ItemStack heldItem = mc.player.getHeldItem(EnumHand.MAIN_HAND);
    if (!heldItem.isEmpty()) {
        toggle.setPressed(CraftingCardItem.isStrictNBT(heldItem));
    }
    toggle.addButtonEvent(parent -> {
        RFToolsCtrlMessages.INSTANCE.sendToServer(new PacketUpdateNBTItemCard(new Argument("strictnbt", toggle.isPressed())));
    });
    toplevel.addChild(toggle);
    for (int y = 0; y < GRID_HEIGHT; y++) {
        for (int x = 0; x < GRID_WIDTH; x++) {
            int idx = y * GRID_WIDTH + x;
            createDummySlot(toplevel, idx, new PositionalLayout.PositionalHint(x * 18 + 10, y * 18 + 37, 18, 18), createSelectionEvent(idx));
        }
    }
    createDummySlot(toplevel, INPUT_SLOTS, new PositionalLayout.PositionalHint(10 + 8 * 18, 37, 18, 18), createSelectionEvent(INPUT_SLOTS));
    updateSlots();
    window = new Window(this, toplevel);
}
Also used : Window(mcjty.lib.gui.Window) PacketSendServerCommand(mcjty.lib.network.PacketSendServerCommand) Argument(mcjty.lib.network.Argument) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle) ItemStack(net.minecraft.item.ItemStack)

Aggregations

PacketSendServerCommand (mcjty.lib.network.PacketSendServerCommand)2 Rectangle (java.awt.Rectangle)1 Window (mcjty.lib.gui.Window)1 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)1 Argument (mcjty.lib.network.Argument)1 GfxOp (mcjty.rftoolscontrol.blocks.vectorart.GfxOp)1 ItemStack (net.minecraft.item.ItemStack)1