Search in sources :

Example 1 with TabButton

use of com.lowdragmc.lowdraglib.gui.widget.TabButton in project Multiblocked by Low-Drag-MC.

the class ComponentTileEntity method initTraitUI.

protected void initTraitUI(TabContainer tabContainer, PlayerEntity PlayerEntity) {
    WidgetGroup group = new WidgetGroup(20, 0, 176, 256);
    tabContainer.addTab(new TabButton(0, tabContainer.containerGroup.widgets.size() * 20, 20, 20).setTexture(new ResourceTexture("multiblocked:textures/gui/custom_gui_tab_button.png").getSubTexture(0, 0, 1, 0.5), new ResourceTexture("multiblocked:textures/gui/custom_gui_tab_button.png").getSubTexture(0, 0.5, 1, 0.5)), group);
    group.addWidget(new ImageWidget(0, 0, 176, 256, new ResourceTexture(JSONUtils.getAsString(definition.traits, "background", "multiblocked:textures/gui/custom_gui.png"))));
    if (traits.size() > 0) {
        for (int row = 0; row < 3; row++) {
            for (int col = 0; col < 9; col++) {
                group.addWidget(new SlotWidget(PlayerEntity.inventory, col + (row + 1) * 9, 7 + col * 18, 173 + row * 18).setLocationInfo(true, false));
            }
        }
        for (int slot = 0; slot < 9; slot++) {
            group.addWidget(new SlotWidget(PlayerEntity.inventory, slot, 7 + slot * 18, 231).setLocationInfo(true, true));
        }
    }
    for (CapabilityTrait trait : traits.values()) {
        trait.createUI(this, group, PlayerEntity);
    }
}
Also used : SlotWidget(com.lowdragmc.lowdraglib.gui.widget.SlotWidget) ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) TabButton(com.lowdragmc.lowdraglib.gui.widget.TabButton) CapabilityTrait(com.lowdragmc.multiblocked.api.capability.trait.CapabilityTrait) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) ImageWidget(com.lowdragmc.lowdraglib.gui.widget.ImageWidget)

Aggregations

ResourceTexture (com.lowdragmc.lowdraglib.gui.texture.ResourceTexture)1 ImageWidget (com.lowdragmc.lowdraglib.gui.widget.ImageWidget)1 SlotWidget (com.lowdragmc.lowdraglib.gui.widget.SlotWidget)1 TabButton (com.lowdragmc.lowdraglib.gui.widget.TabButton)1 WidgetGroup (com.lowdragmc.lowdraglib.gui.widget.WidgetGroup)1 CapabilityTrait (com.lowdragmc.multiblocked.api.capability.trait.CapabilityTrait)1