Search in sources :

Example 6 with ColorRectTexture

use of com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture in project Multiblocked by Low-Drag-MC.

the class PlayerCapabilityTrait method refreshSlots.

protected void refreshSlots(DraggableScrollableWidgetGroup dragGroup) {
    dragGroup.widgets.forEach(dragGroup::waitToRemoved);
    ButtonWidget setting = (ButtonWidget) new ButtonWidget(width - 8, 0, 8, 8, new ResourceTexture("multiblocked:textures/gui/option.png"), null).setHoverBorderTexture(1, -1).setHoverTooltips("settings");
    ImageWidget imageWidget = new ImageWidget(0, 0, width, height, new TextTexture("Player Name").setWidth(width).setType(textType).setBackgroundColor(0xff000000));
    setting.setVisible(false);
    DraggableWidgetGroup slot = new DraggableWidgetGroup(x, y, width, height);
    slot.setOnSelected(w -> setting.setVisible(true));
    slot.setOnUnSelected(w -> setting.setVisible(false));
    slot.addWidget(imageWidget);
    slot.addWidget(setting);
    slot.setOnEndDrag(b -> {
        x = b.getSelfPosition().x;
        y = b.getSelfPosition().y;
    });
    dragGroup.addWidget(slot);
    setting.setOnPressCallback(cd2 -> {
        DialogWidget dialog = new DialogWidget(dragGroup, true);
        dialog.addWidget(new ImageWidget(0, 0, 176, 256, new ColorRectTexture(0xaf000000)));
        initSettingDialog(dialog, slot);
    });
}
Also used : ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) TextTexture(com.lowdragmc.lowdraglib.gui.texture.TextTexture) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) ImageWidget(com.lowdragmc.lowdraglib.gui.widget.ImageWidget) DraggableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableWidgetGroup) DialogWidget(com.lowdragmc.lowdraglib.gui.widget.DialogWidget) ButtonWidget(com.lowdragmc.lowdraglib.gui.widget.ButtonWidget)

Example 7 with ColorRectTexture

use of com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture in project Multiblocked by Low-Drag-MC.

the class ItemsContentWidget method updateIngredientWidget.

private void updateIngredientWidget(DraggableScrollableWidgetGroup container) {
    container.widgets.forEach(container::waitToRemoved);
    ItemStack[] matchingStacks = ArrayUtils.clone(content.ingredient.getItems());
    for (int i = 0; i < matchingStacks.length; i++) {
        ItemStack stack = matchingStacks[i];
        IItemHandlerModifiable handler;
        int finalI = i;
        int x = (i % 4) * 30;
        int y = (i / 4) * 20;
        container.addWidget(new PhantomSlotWidget(handler = new ItemStackHandler(1), 0, x + 1, y + 1).setClearSlotOnRightClick(false).setChangeListener(() -> {
            ItemStack newStack = handler.getStackInSlot(0);
            matchingStacks[finalI] = newStack;
            content = new ItemsIngredient(Ingredient.of(matchingStacks), content.getAmount());
            onContentUpdate();
        }).setBackgroundTexture(new ColorRectTexture(0xaf444444)));
        handler.setStackInSlot(0, stack);
        container.addWidget(new ButtonWidget(x + 21, y + 1, 9, 9, cd -> {
            content = new ItemsIngredient(Ingredient.of(ArrayUtils.remove(matchingStacks, finalI)), content.getAmount());
            updateIngredientWidget(container);
            onContentUpdate();
        }).setButtonTexture(new ResourceTexture("multiblocked:textures/gui/remove.png")).setHoverBorderTexture(1, -1).setHoverTooltips("multiblocked.gui.tips.remove"));
    }
}
Also used : CycleItemStackHandler(com.lowdragmc.lowdraglib.utils.CycleItemStackHandler) ItemStackHandler(net.minecraftforge.items.ItemStackHandler) IItemHandlerModifiable(net.minecraftforge.items.IItemHandlerModifiable) PhantomSlotWidget(com.lowdragmc.lowdraglib.gui.widget.PhantomSlotWidget) ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) ItemsIngredient(com.lowdragmc.multiblocked.api.recipe.ItemsIngredient) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) ItemStack(net.minecraft.item.ItemStack) ButtonWidget(com.lowdragmc.lowdraglib.gui.widget.ButtonWidget)

Example 8 with ColorRectTexture

use of com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture in project Multiblocked by Low-Drag-MC.

the class PredicateAnyCapability method getConfigWidget.

@Override
public List<WidgetGroup> getConfigWidget(List<WidgetGroup> groups) {
    super.getConfigWidget(groups);
    WidgetGroup group = new WidgetGroup(0, 0, 100, 20);
    groups.add(group);
    MultiblockCapability<?> current = MbdCapabilities.get(capability);
    group.addWidget(new SelectorWidget(0, 0, 120, 20, MbdCapabilities.CAPABILITY_REGISTRY.values().stream().map(MultiblockCapability::getUnlocalizedName).collect(Collectors.toList()), -1).setValue(current == null ? "" : current.getUnlocalizedName()).setOnChanged(capability -> {
        this.capability = capability.replace("multiblocked.capability.", "");
        buildPredicate();
    }).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xffaaaaaa)).setHoverTooltips("multiblocked.gui.predicate.capability"));
    return groups;
}
Also used : MultiblockCapability(com.lowdragmc.multiblocked.api.capability.MultiblockCapability) SelectorWidget(com.lowdragmc.lowdraglib.gui.widget.SelectorWidget) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture)

Example 9 with ColorRectTexture

use of com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture in project Multiblocked by Low-Drag-MC.

the class PredicateBlocks method getConfigWidget.

@Override
public List<WidgetGroup> getConfigWidget(List<WidgetGroup> groups) {
    super.getConfigWidget(groups);
    WidgetGroup group = new WidgetGroup(0, 0, 182, 100);
    groups.add(group);
    DraggableScrollableWidgetGroup container = new DraggableScrollableWidgetGroup(0, 25, 182, 80).setBackground(new ColorRectTexture(0xffaaaaaa));
    group.addWidget(container);
    List<BlockState> blockList = Arrays.stream(blocks).map(Block::defaultBlockState).collect(Collectors.toList());
    for (BlockState blockState : blockList) {
        addBlockSelectorWidget(blockList, container, blockState);
    }
    group.addWidget(new LabelWidget(0, 6, "multiblocked.gui.label.block_settings"));
    group.addWidget(new ButtonWidget(162, 0, 20, 20, cd -> {
        blockList.add(null);
        addBlockSelectorWidget(blockList, container, null);
    }).setButtonTexture(new ResourceTexture("multiblocked:textures/gui/add.png")).setHoverBorderTexture(1, -1).setHoverTooltips("multiblocked.gui.predicate.blocks.add"));
    return groups;
}
Also used : BlockState(net.minecraft.block.BlockState) DraggableScrollableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup) ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) DraggableScrollableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) ButtonWidget(com.lowdragmc.lowdraglib.gui.widget.ButtonWidget)

Example 10 with ColorRectTexture

use of com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture in project Multiblocked by Low-Drag-MC.

the class PredicateComponent method getConfigWidget.

@Override
public List<WidgetGroup> getConfigWidget(List<WidgetGroup> groups) {
    super.getConfigWidget(groups);
    WidgetGroup group = new WidgetGroup(0, 0, 100, 20);
    groups.add(group);
    group.addWidget(new LabelWidget(0, 0, "multiblocked.gui.label.component_registry_name"));
    group.addWidget(new SelectorWidget(0, 10, 120, 20, getAvailableComponents(), -1).setValue(this.location.toString()).setOnChanged(name -> {
        if (name != null && !name.isEmpty()) {
            this.location = new ResourceLocation(name);
            buildPredicate();
        }
    }).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xff333333)).setHoverTooltips("multiblocked.gui.tips.component"));
    return groups;
}
Also used : LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) SelectorWidget(com.lowdragmc.lowdraglib.gui.widget.SelectorWidget) ResourceLocation(net.minecraft.util.ResourceLocation) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture)

Aggregations

ColorRectTexture (com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture)24 ImageWidget (com.lowdragmc.lowdraglib.gui.widget.ImageWidget)18 ResourceTexture (com.lowdragmc.lowdraglib.gui.texture.ResourceTexture)17 ButtonWidget (com.lowdragmc.lowdraglib.gui.widget.ButtonWidget)17 TextTexture (com.lowdragmc.lowdraglib.gui.texture.TextTexture)13 WidgetGroup (com.lowdragmc.lowdraglib.gui.widget.WidgetGroup)10 ColorBorderTexture (com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture)9 DraggableScrollableWidgetGroup (com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup)9 GuiTextureGroup (com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup)8 SelectorWidget (com.lowdragmc.lowdraglib.gui.widget.SelectorWidget)7 JsonElement (com.google.gson.JsonElement)6 ResourceBorderTexture (com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture)6 SelectableWidgetGroup (com.lowdragmc.lowdraglib.gui.widget.SelectableWidgetGroup)6 Multiblocked (com.lowdragmc.multiblocked.Multiblocked)6 ItemStack (net.minecraft.item.ItemStack)6 ResourceLocation (net.minecraft.util.ResourceLocation)6 DialogWidget (com.lowdragmc.lowdraglib.gui.widget.DialogWidget)5 DraggableWidgetGroup (com.lowdragmc.lowdraglib.gui.widget.DraggableWidgetGroup)5 LabelWidget (com.lowdragmc.lowdraglib.gui.widget.LabelWidget)5 List (java.util.List)5