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);
});
}
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"));
}
}
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;
}
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;
}
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;
}
Aggregations