use of com.lowdragmc.lowdraglib.gui.texture.TextTexture 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.TextTexture in project Multiblocked by Low-Drag-MC.
the class PlayerCapabilityTrait method createUI.
@Override
public void createUI(ComponentTileEntity<?> component, WidgetGroup group, PlayerEntity player) {
super.createUI(component, group, player);
group.addWidget(new ImageWidget(x, y, width, height, new TextTexture("").setSupplier(() -> playerName).setWidth(width).setType(textType)) {
@Override
public void writeInitialData(PacketBuffer buffer) {
super.writeInitialData(buffer);
buffer.writeUtf(getPlayerName());
}
@Override
public void readInitialData(PacketBuffer buffer) {
super.readInitialData(buffer);
playerName = buffer.readUtf(Short.MAX_VALUE);
}
});
}
Aggregations