use of com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture in project Multiblocked by Low-Drag-MC.
the class PartBuilderWidget method initScene.
@OnlyIn(Dist.CLIENT)
private void initScene() {
TrackedDummyWorld world = new TrackedDummyWorld();
world.addBlock(BlockPos.ZERO, BlockInfo.fromBlockState(MbdComponents.DummyComponentBlock.defaultBlockState()));
tileEntity = (DummyComponentTileEntity) world.getBlockEntity(BlockPos.ZERO);
this.addWidget(new ImageWidget(30, 59, 138, 138, new GuiTextureGroup(new ColorBorderTexture(3, -1), new ColorRectTexture(0xaf444444))));
this.addWidget(new SceneWidget(30, 59, 138, 138, world).setRenderedCore(Collections.singleton(BlockPos.ZERO), null).setRenderSelect(false).setRenderFacing(false));
this.addWidget(new ImageWidget(30, 65, 138, 15, textTexture = new TextTexture("", 0xff00ff00).setDropShadow(true).setWidth(138).setType(TextTexture.TextType.ROLL)));
}
use of com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture in project Multiblocked by Low-Drag-MC.
the class ComponentWidget method createBoolSwitch.
protected WidgetGroup createBoolSwitch(int x, int y, String text, String tips, boolean init, Consumer<Boolean> onPressed) {
WidgetGroup widgetGroup = new WidgetGroup(x, y, 100, 15);
widgetGroup.addWidget(new SwitchWidget(0, 0, 15, 15, (cd, r) -> onPressed.accept(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, 0xff545757)).setPressed(init).setHoverTooltips(tips));
widgetGroup.addWidget(new LabelWidget(20, 3, text));
return widgetGroup;
}
use of com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture in project Multiblocked by Low-Drag-MC.
the class MultiCapabilityTrait method initSettingDialog.
protected void initSettingDialog(DialogWidget dialog, DraggableWidgetGroup slot, final int index) {
ImageWidget imageWidget = (ImageWidget) slot.widgets.get(0);
dialog.addWidget(new SelectorWidget(5, 30, 40, 15, Arrays.stream(IO.VALUES).map(Enum::name).collect(Collectors.toList()), -1).setValue(capabilityIO[index].name()).setOnChanged(io -> {
capabilityIO[index] = IO.valueOf(io);
imageWidget.setImage(new GuiTextureGroup(new ColorRectTexture(getColorByIO(guiIO[index])), new ColorBorderTexture(1, getColorByIO(capabilityIO[index]))));
}).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xffaaaaaa)).setHoverTooltips("multiblocked.gui.trait.capability_io"));
dialog.addWidget(new SelectorWidget(50, 30, 40, 15, Arrays.stream(IO.VALUES).map(Enum::name).collect(Collectors.toList()), -1).setValue(guiIO[index].name()).setOnChanged(io -> {
guiIO[index] = IO.valueOf(io);
imageWidget.setImage(new GuiTextureGroup(new ColorRectTexture(getColorByIO(guiIO[index])), new ColorBorderTexture(1, getColorByIO(capabilityIO[index]))));
}).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xffaaaaaa)).setHoverTooltips("multiblocked.gui.trait.gui_io"));
dialog.addWidget(new SelectorWidget(100, 30, 65, 15, Arrays.asList("multiblocked.gui.trait.auto_io", "multiblocked.gui.trait.passive_io"), -1).setValue(autoIO[index] ? "multiblocked.gui.trait.auto_io" : "multiblocked.gui.trait.passive_io").setOnChanged(auto -> autoIO[index] = auto.equals("multiblocked.gui.trait.auto_io")).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xffaaaaaa)).setHoverTooltips("multiblocked.gui.trait.auto"));
}
use of com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture in project Multiblocked by Low-Drag-MC.
the class IMultiblockedRenderer method createBoolSwitch.
default WidgetGroup createBoolSwitch(int x, int y, String text, String tips, boolean init, Consumer<Boolean> onPressed) {
WidgetGroup widgetGroup = new WidgetGroup(x, y, 100, 15);
widgetGroup.addWidget(new SwitchWidget(0, 0, 15, 15, (cd, r) -> onPressed.accept(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, 0xff545757)).setPressed(init).setHoverTooltips(tips));
widgetGroup.addWidget(new LabelWidget(20, 3, () -> text).setTextColor(-1).setDrop(true));
return widgetGroup;
}
use of com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture in project Multiblocked by Low-Drag-MC.
the class GTRenderer method addTextureSelector.
protected void addTextureSelector(int x, int y, int width, int height, String text, WidgetGroup parent, WidgetGroup group, ResourceLocation init, Consumer<ResourceLocation> newTexture) {
ImageWidget imageWidget;
if (init != null) {
imageWidget = new ImageWidget(x, y, width, height, new GuiTextureGroup(new ColorBorderTexture(1, -1), new ResourceTexture(init.getNamespace() + ":textures/" + init.getPath() + ".png")));
} else {
imageWidget = new ImageWidget(x, y, width, height, new ColorBorderTexture(1, -1));
}
group.addWidget(imageWidget);
group.addWidget(new ButtonWidget(x, y, width, height, null, cd -> new ResourceTextureWidget(parent, texture -> {
if (texture != null) {
imageWidget.setImage(new GuiTextureGroup(new ColorBorderTexture(1, -1), texture));
newTexture.accept(new ResourceLocation(texture.imageLocation.toString().replace("textures/", "").replace(".png", "")));
}
})).setHoverTexture(new ColorRectTexture(0x4faaaaaa)).setHoverTooltips(String.format("select the %s texture", text)));
}
Aggregations