Search in sources :

Example 6 with ColorBorderTexture

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

the class ComponentWidget method createScene.

@OnlyIn(Dist.CLIENT)
protected WidgetGroup createScene(int x, int y, String text, String tips, IMultiblockedRenderer init, Consumer<IMultiblockedRenderer> onUpdate) {
    TrackedDummyWorld world = new TrackedDummyWorld();
    world.addBlock(BlockPos.ZERO, BlockInfo.fromBlockState(MbdComponents.DummyComponentBlock.defaultBlockState()));
    DummyComponentTileEntity tileEntity = (DummyComponentTileEntity) world.getBlockEntity(BlockPos.ZERO);
    tileEntity.setDefinition(new PartDefinition(new ResourceLocation(Multiblocked.MODID, "component_widget")));
    tileEntity.getDefinition().baseRenderer = init;
    WidgetGroup widgetGroup = new WidgetGroup(x, y, 90, 90);
    widgetGroup.addWidget(new LabelWidget(0, 0, text));
    widgetGroup.addWidget(new ImageWidget(0, 12, 90, 80, new ColorBorderTexture(2, 0xff4A82F7)));
    widgetGroup.addWidget(new SceneWidget(0, 12, 90, 80, world).setRenderedCore(Collections.singleton(BlockPos.ZERO), null).setRenderSelect(false).setRenderFacing(false));
    widgetGroup.addWidget(new ButtonWidget(90 - 15, 12, 15, 15, new ResourceTexture("multiblocked:textures/gui/option.png"), (cd) -> new IRendererWidget(this, tileEntity.getRenderer(), r -> {
        tileEntity.getDefinition().baseRenderer = r;
        onUpdate.accept(r);
    })).setHoverBorderTexture(1, -1).setHoverTooltips(tips));
    return widgetGroup;
}
Also used : JSONUtils(net.minecraft.util.JSONUtils) JsonObject(com.google.gson.JsonObject) TabButton(com.lowdragmc.lowdraglib.gui.widget.TabButton) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn) ImageWidget(com.lowdragmc.lowdraglib.gui.widget.ImageWidget) CapabilityTrait(com.lowdragmc.multiblocked.api.capability.trait.CapabilityTrait) IRendererWidget(com.lowdragmc.multiblocked.api.gui.dialogs.IRendererWidget) MultiblockCapability(com.lowdragmc.multiblocked.api.capability.MultiblockCapability) ResourceBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture) TabContainer(com.lowdragmc.lowdraglib.gui.widget.TabContainer) Dist(net.minecraftforge.api.distmarker.Dist) BlockInfo(com.lowdragmc.lowdraglib.utils.BlockInfo) TextBoxWidget(com.lowdragmc.lowdraglib.gui.widget.TextBoxWidget) Minecraft(net.minecraft.client.Minecraft) LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) ComponentDefinition(com.lowdragmc.multiblocked.api.definition.ComponentDefinition) DummyComponentTileEntity(com.lowdragmc.multiblocked.api.tile.DummyComponentTileEntity) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) IMultiblockedRenderer(com.lowdragmc.multiblocked.client.renderer.IMultiblockedRenderer) TextTexture(com.lowdragmc.lowdraglib.gui.texture.TextTexture) ResourceTextureWidget(com.lowdragmc.multiblocked.api.gui.dialogs.ResourceTextureWidget) MbdComponents(com.lowdragmc.multiblocked.api.registry.MbdComponents) TextFieldWidget(com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget) PartDefinition(com.lowdragmc.multiblocked.api.definition.PartDefinition) TrackedDummyWorld(com.lowdragmc.lowdraglib.utils.TrackedDummyWorld) ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) DraggableScrollableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup) SwitchWidget(com.lowdragmc.lowdraglib.gui.widget.SwitchWidget) BlockPos(net.minecraft.util.math.BlockPos) ButtonWidget(com.lowdragmc.lowdraglib.gui.widget.ButtonWidget) SceneWidget(com.lowdragmc.lowdraglib.gui.widget.SceneWidget) DialogWidget(com.lowdragmc.lowdraglib.gui.widget.DialogWidget) MbdCapabilities(com.lowdragmc.multiblocked.api.registry.MbdCapabilities) Consumer(java.util.function.Consumer) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) ResourceLocation(net.minecraft.util.ResourceLocation) Multiblocked(com.lowdragmc.multiblocked.Multiblocked) Collections(java.util.Collections) ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) IRendererWidget(com.lowdragmc.multiblocked.api.gui.dialogs.IRendererWidget) TrackedDummyWorld(com.lowdragmc.lowdraglib.utils.TrackedDummyWorld) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) DraggableScrollableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup) PartDefinition(com.lowdragmc.multiblocked.api.definition.PartDefinition) ButtonWidget(com.lowdragmc.lowdraglib.gui.widget.ButtonWidget) ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) ResourceLocation(net.minecraft.util.ResourceLocation) LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) ImageWidget(com.lowdragmc.lowdraglib.gui.widget.ImageWidget) DummyComponentTileEntity(com.lowdragmc.multiblocked.api.tile.DummyComponentTileEntity) SceneWidget(com.lowdragmc.lowdraglib.gui.widget.SceneWidget) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 7 with ColorBorderTexture

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

the class SimplePredicate method getConfigWidget.

public List<WidgetGroup> getConfigWidget(List<WidgetGroup> groups) {
    WidgetGroup group = new WidgetGroup(0, 0, 300, 90);
    groups.add(group);
    group.setClientSideWidget();
    group.addWidget(new LabelWidget(0, 0, () -> LocalizationUtils.format("multiblocked.gui.label.type") + " " + type).setTextColor(-1).setDrop(true));
    TextFieldWidget min, max, preview, nbt, tooltips;
    group.addWidget(min = new TextFieldWidget(55, 15, 30, 15, () -> minCount + "", s -> {
        minCount = Integer.parseInt(s);
        if (minCount > maxCount) {
            maxCount = minCount;
        }
    }).setNumbersOnly(0, Integer.MAX_VALUE));
    min.setHoverTooltips("multiblocked.gui.tips.min").setVisible(minCount != -1);
    group.addWidget(new SwitchWidget(0, 15, 50, 15, (cd, r) -> {
        min.setVisible(r);
        minCount = r ? 0 : -1;
    }).setPressed(minCount != -1).setHoverBorderTexture(1, -1).setBaseTexture(new ResourceTexture("multiblocked:textures/gui/button_common.png"), new TextTexture("min (N)", -1).setDropShadow(true)).setPressedTexture(new ResourceTexture("multiblocked:textures/gui/button_common.png"), new TextTexture("min (Y)", -1).setDropShadow(true)).setHoverTooltips("multiblocked.gui.predicate.min"));
    group.addWidget(max = new TextFieldWidget(55, 33, 30, 15, () -> maxCount + "", s -> {
        maxCount = Integer.parseInt(s);
        if (minCount > maxCount) {
            minCount = maxCount;
        }
    }).setNumbersOnly(0, Integer.MAX_VALUE));
    max.setHoverTooltips("multiblocked.gui.tips.max").setVisible(maxCount != -1);
    group.addWidget(new SwitchWidget(0, 33, 50, 15, (cd, r) -> {
        max.setVisible(r);
        maxCount = r ? 0 : -1;
    }).setPressed(maxCount != -1).setHoverBorderTexture(1, -1).setBaseTexture(new ResourceTexture("multiblocked:textures/gui/button_common.png"), new TextTexture("max (N)", -1).setDropShadow(true)).setPressedTexture(new ResourceTexture("multiblocked:textures/gui/button_common.png"), new TextTexture("max (Y)", -1).setDropShadow(true)).setHoverTooltips("multiblocked.gui.predicate.max"));
    group.addWidget(preview = (TextFieldWidget) new TextFieldWidget(55, 51, 30, 15, () -> previewCount + "", s -> previewCount = Integer.parseInt(s)).setNumbersOnly(0, Integer.MAX_VALUE).setHoverTooltips("multiblocked.gui.predicate.preview"));
    preview.setHoverTooltips("multiblocked.gui.predicate.jei").setVisible(previewCount != -1);
    group.addWidget(new SwitchWidget(0, 51, 50, 15, (cd, r) -> {
        preview.setVisible(r);
        previewCount = r ? 0 : -1;
    }).setPressed(previewCount != -1).setHoverBorderTexture(1, -1).setBaseTexture(new ResourceTexture("multiblocked:textures/gui/button_common.png"), new TextTexture("jei (N)", -1).setDropShadow(true)).setPressedTexture(new ResourceTexture("multiblocked:textures/gui/button_common.png"), new TextTexture("jei (Y)", -1).setDropShadow(true)).setHoverTooltips("multiblocked.gui.predicate.preview.1"));
    WidgetGroup widgetGroup = new WidgetGroup(0, 70, 100, 15).addWidget(new SwitchWidget(0, 0, 15, 15, (cd, r) -> disableRenderFormed = r).setBaseTexture(new ResourceTexture("multiblocked:textures/gui/boolean.png").getSubTexture(0, 0, 1, 0.5)).setPressedTexture(new ResourceTexture("multiblocked:textures/gui/boolean.png").getSubTexture(0, 0.5, 1, 0.5)).setHoverTexture(new ColorBorderTexture(1, -1)).setPressed(disableRenderFormed).setHoverTooltips("multiblocked.gui.predicate.disabled")).addWidget(new ImageWidget(2, 2, 11, 11, new ColorBorderTexture(1, -1))).addWidget(new LabelWidget(20, 3, "disableRenderFormed").setTextColor(-1).setDrop(true));
    group.addWidget(widgetGroup);
    group.addWidget(nbt = new TextFieldWidget(155, 15, 100, 15, null, s -> nbtParser = s));
    nbt.setCurrentString(nbtParser == null ? "" : nbtParser).setHoverTooltips("nbt parser").setVisible(nbtParser != null);
    group.addWidget(new SwitchWidget(100, 15, 50, 15, (cd, r) -> {
        nbt.setVisible(r);
        nbtParser = r ? "" : null;
    }).setPressed(nbtParser != null).setHoverBorderTexture(1, -1).setBaseTexture(new ResourceTexture("multiblocked:textures/gui/button_common.png"), new TextTexture("nbt (N)", -1).setDropShadow(true)).setPressedTexture(new ResourceTexture("multiblocked:textures/gui/button_common.png"), new TextTexture("nbt (Y)", -1).setDropShadow(true)).setHoverTooltips("multiblocked.gui.predicate.nbt"));
    group.addWidget(tooltips = new TextFieldWidget(155, 33, 100, 15, null, s -> customTips = s));
    tooltips.setCurrentString(customTips != null ? customTips : "").setHoverTooltips("multiblocked.gui.predicate.tips").setVisible(customTips != null);
    group.addWidget(new SwitchWidget(100, 33, 50, 15, (cd, r) -> {
        tooltips.setVisible(r);
        customTips = r ? "" : null;
    }).setPressed(customTips != null).setHoverBorderTexture(1, -1).setBaseTexture(new ResourceTexture("multiblocked:textures/gui/button_common.png"), new TextTexture("tips (N)", -1).setDropShadow(true)).setPressedTexture(new ResourceTexture("multiblocked:textures/gui/button_common.png"), new TextTexture("tips (Y)", -1).setDropShadow(true)).setHoverTooltips("multiblocked.gui.predicate.add_tips"));
    group.addWidget(new SelectorWidget(130, 70, 40, 15, Arrays.asList("IN", "OUT", "BOTH", "NULL"), -1).setValue(io == null ? "NULL" : io.name()).setIsUp(true).setOnChanged(io -> this.io = io.equals("NULL") ? null : IO.valueOf(io)).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xff333333)).setHoverTooltips("multiblocked.gui.tips.io"));
    return groups;
}
Also used : JSONUtils(net.minecraft.util.JSONUtils) JsonObject(com.google.gson.JsonObject) Arrays(java.util.Arrays) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn) ImageWidget(com.lowdragmc.lowdraglib.gui.widget.ImageWidget) LocalizationUtils(com.lowdragmc.lowdraglib.utils.LocalizationUtils) CompoundNBT(net.minecraft.nbt.CompoundNBT) SinglePredicateError(com.lowdragmc.multiblocked.api.pattern.error.SinglePredicateError) ResourceBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture) Supplier(java.util.function.Supplier) Dist(net.minecraftforge.api.distmarker.Dist) ArrayList(java.util.ArrayList) I18n(net.minecraft.client.resources.I18n) SelectorWidget(com.lowdragmc.lowdraglib.gui.widget.SelectorWidget) ItemStack(net.minecraft.item.ItemStack) BlockInfo(com.lowdragmc.lowdraglib.utils.BlockInfo) Gson(com.google.gson.Gson) LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) IO(com.lowdragmc.multiblocked.api.capability.IO) JsonPrimitive(com.google.gson.JsonPrimitive) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) PatternStringError(com.lowdragmc.multiblocked.api.pattern.error.PatternStringError) TextTexture(com.lowdragmc.lowdraglib.gui.texture.TextTexture) TextFieldWidget(com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget) TraceabilityPredicate(com.lowdragmc.multiblocked.api.pattern.TraceabilityPredicate) Predicate(java.util.function.Predicate) ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) SwitchWidget(com.lowdragmc.lowdraglib.gui.widget.SwitchWidget) MultiblockState(com.lowdragmc.multiblocked.api.pattern.MultiblockState) Collectors(java.util.stream.Collectors) Blocks(net.minecraft.block.Blocks) List(java.util.List) LongOpenHashSet(it.unimi.dsi.fastutil.longs.LongOpenHashSet) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) TileEntity(net.minecraft.tileentity.TileEntity) Pattern(java.util.regex.Pattern) Collections(java.util.Collections) ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) SelectorWidget(com.lowdragmc.lowdraglib.gui.widget.SelectorWidget) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) TextTexture(com.lowdragmc.lowdraglib.gui.texture.TextTexture) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) TextFieldWidget(com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget) SwitchWidget(com.lowdragmc.lowdraglib.gui.widget.SwitchWidget) ImageWidget(com.lowdragmc.lowdraglib.gui.widget.ImageWidget)

Example 8 with ColorBorderTexture

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

the class MultiCapabilityTrait method refreshSlots.

protected void refreshSlots(DraggableScrollableWidgetGroup dragGroup) {
    dragGroup.widgets.forEach(dragGroup::waitToRemoved);
    for (int i = 0; i < guiIO.length; i++) {
        int finalI = i;
        ButtonWidget setting = (ButtonWidget) new ButtonWidget(10, 0, 8, 8, new ResourceTexture("multiblocked:textures/gui/option.png"), null).setHoverBorderTexture(1, -1).setHoverTooltips("multiblocked.gui.tips.settings");
        ImageWidget imageWidget = new ImageWidget(1, 1, 16, 16, new GuiTextureGroup(new ColorRectTexture(getColorByIO(guiIO[finalI])), new ColorBorderTexture(1, getColorByIO(capabilityIO[finalI]))));
        setting.setVisible(false);
        DraggableWidgetGroup slot = new DraggableWidgetGroup(x[finalI], y[finalI], 18, 18);
        slot.setOnSelected(w -> setting.setVisible(true));
        slot.setOnUnSelected(w -> setting.setVisible(false));
        slot.addWidget(imageWidget);
        slot.addWidget(setting);
        slot.setOnEndDrag(b -> {
            x[finalI] = b.getSelfPosition().x;
            y[finalI] = 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)));
            dialog.addWidget(new ButtonWidget(5, 5, 85, 20, new GuiTextureGroup(ResourceBorderTexture.BUTTON_COMMON, new TextTexture("multiblocked.gui.trait.remove_slot")), cd3 -> {
                removeSlot(finalI);
                refreshSlots(dragGroup);
                dialog.close();
            }).setHoverBorderTexture(1, -1));
            initSettingDialog(dialog, slot, finalI);
        });
    }
}
Also used : ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) TextTexture(com.lowdragmc.lowdraglib.gui.texture.TextTexture) 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) GuiTextureGroup(com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup)

Example 9 with ColorBorderTexture

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

the class ProgressCapabilityTrait 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("multiblocked.gui.tips.settings");
    ImageWidget imageWidget = new ImageWidget(0, 0, width, height, new GuiTextureGroup(new ResourceTexture(texture).getSubTexture(0, 0, 1, 0.5), new ColorBorderTexture(1, getColorByIO(capabilityIO))));
    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) ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) 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) GuiTextureGroup(com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup)

Example 10 with ColorBorderTexture

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

the class ProgressCapabilityTrait method initSettingDialog.

@Override
protected void initSettingDialog(DialogWidget dialog, DraggableWidgetGroup slot) {
    ImageWidget imageWidget = (ImageWidget) slot.widgets.get(0);
    ButtonWidget setting = (ButtonWidget) slot.widgets.get(1);
    ButtonWidget imageSelector = (ButtonWidget) new ButtonWidget(5, 65, width, height, new GuiTextureGroup(new ColorBorderTexture(1, -1), new ResourceTexture(texture).getSubTexture(0, 0, 1, 0.5)), null).setHoverTooltips("multiblocked.gui.tips.select_image");
    dialog.addWidget(new TextFieldWidget(5, 25, 50, 15, null, s -> {
        width = Integer.parseInt(s);
        Size size = new Size(width, height);
        slot.setSize(size);
        imageWidget.setSize(size);
        imageSelector.setSize(size);
        setting.setSelfPosition(new Position(width - 8, 0));
    }).setCurrentString(width + "").setNumbersOnly(1, 180).setHoverTooltips("multiblocked.gui.trait.set_width"));
    dialog.addWidget(new TextFieldWidget(5, 45, 50, 15, null, s -> {
        height = Integer.parseInt(s);
        Size size = new Size(width, height);
        slot.setSize(size);
        imageWidget.setSize(size);
        imageSelector.setSize(size);
        setting.setSelfPosition(new Position(width - 8, 0));
    }).setCurrentString(height + "").setNumbersOnly(1, 180).setHoverTooltips("multiblocked.gui.trait.set_height"));
    dialog.addWidget(new SelectorWidget(5, 5, 50, 15, Arrays.stream(IO.VALUES).map(Enum::name).collect(Collectors.toList()), -1).setValue(capabilityIO.name()).setOnChanged(io -> {
        capabilityIO = IO.valueOf(io);
        imageWidget.setImage(new GuiTextureGroup(new ResourceTexture(texture).getSubTexture(0, 0, 1, 0.5), new ColorBorderTexture(1, getColorByIO(capabilityIO))));
    }).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xffaaaaaa)).setHoverTooltips("multiblocked.gui.trait.capability_io"));
    dialog.addWidget(imageSelector);
    imageSelector.setOnPressCallback(cd -> new ResourceTextureWidget(dialog.getParent().getGui().mainGroup, texture1 -> {
        if (texture1 != null) {
            texture = texture1.imageLocation.toString();
            ResourceTexture resourceTexture = new ResourceTexture(texture).getSubTexture(0, 0, 1, 0.5);
            imageSelector.setButtonTexture(new GuiTextureGroup(new ColorBorderTexture(1, -1), resourceTexture));
            imageWidget.setImage(new GuiTextureGroup(resourceTexture, new ColorBorderTexture(1, getColorByIO(capabilityIO))));
        }
    }));
}
Also used : JSONUtils(net.minecraft.util.JSONUtils) JsonObject(com.google.gson.JsonObject) Arrays(java.util.Arrays) ComponentTileEntity(com.lowdragmc.multiblocked.api.tile.ComponentTileEntity) ImageWidget(com.lowdragmc.lowdraglib.gui.widget.ImageWidget) MultiblockCapability(com.lowdragmc.multiblocked.api.capability.MultiblockCapability) ResourceBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture) JsonElement(com.google.gson.JsonElement) SelectorWidget(com.lowdragmc.lowdraglib.gui.widget.SelectorWidget) IO(com.lowdragmc.multiblocked.api.capability.IO) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) Nullable(javax.annotation.Nullable) ResourceTextureWidget(com.lowdragmc.multiblocked.api.gui.dialogs.ResourceTextureWidget) Position(com.lowdragmc.lowdraglib.utils.Position) TextFieldWidget(com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget) PlayerEntity(net.minecraft.entity.player.PlayerEntity) ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) Size(com.lowdragmc.lowdraglib.utils.Size) DraggableScrollableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup) GuiTextureGroup(com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup) ProgressWidget(com.lowdragmc.multiblocked.api.gui.recipe.ProgressWidget) Collectors(java.util.stream.Collectors) ButtonWidget(com.lowdragmc.lowdraglib.gui.widget.ButtonWidget) DialogWidget(com.lowdragmc.lowdraglib.gui.widget.DialogWidget) DraggableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableWidgetGroup) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) ResourceTextureWidget(com.lowdragmc.multiblocked.api.gui.dialogs.ResourceTextureWidget) ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) Position(com.lowdragmc.lowdraglib.utils.Position) Size(com.lowdragmc.lowdraglib.utils.Size) SelectorWidget(com.lowdragmc.lowdraglib.gui.widget.SelectorWidget) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) ButtonWidget(com.lowdragmc.lowdraglib.gui.widget.ButtonWidget) GuiTextureGroup(com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup) ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) TextFieldWidget(com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget) ImageWidget(com.lowdragmc.lowdraglib.gui.widget.ImageWidget)

Aggregations

ColorBorderTexture (com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture)12 ColorRectTexture (com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture)10 ImageWidget (com.lowdragmc.lowdraglib.gui.widget.ImageWidget)10 ResourceTexture (com.lowdragmc.lowdraglib.gui.texture.ResourceTexture)9 GuiTextureGroup (com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup)8 ButtonWidget (com.lowdragmc.lowdraglib.gui.widget.ButtonWidget)6 WidgetGroup (com.lowdragmc.lowdraglib.gui.widget.WidgetGroup)6 DialogWidget (com.lowdragmc.lowdraglib.gui.widget.DialogWidget)5 DraggableScrollableWidgetGroup (com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup)5 JsonObject (com.google.gson.JsonObject)4 TextTexture (com.lowdragmc.lowdraglib.gui.texture.TextTexture)4 DraggableWidgetGroup (com.lowdragmc.lowdraglib.gui.widget.DraggableWidgetGroup)4 LabelWidget (com.lowdragmc.lowdraglib.gui.widget.LabelWidget)4 SelectorWidget (com.lowdragmc.lowdraglib.gui.widget.SelectorWidget)4 SwitchWidget (com.lowdragmc.lowdraglib.gui.widget.SwitchWidget)4 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)4 ResourceBorderTexture (com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture)3 TextFieldWidget (com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget)3 ResourceTextureWidget (com.lowdragmc.multiblocked.api.gui.dialogs.ResourceTextureWidget)3 Collections (java.util.Collections)3