use of com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup 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.GuiTextureGroup 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.GuiTextureGroup 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)));
}
use of com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup 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);
});
}
}
use of com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup 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);
});
}
Aggregations