use of com.lowdragmc.lowdraglib.gui.texture.ResourceTexture in project Multiblocked by Low-Drag-MC.
the class PredicateBlocks method addBlockSelectorWidget.
private void addBlockSelectorWidget(List<BlockState> blockList, DraggableScrollableWidgetGroup container, BlockState blockState) {
BlockSelectorWidget bsw = new BlockSelectorWidget(0, container.widgets.size() * 21 + 1, false);
container.addWidget(bsw);
bsw.addWidget(new ButtonWidget(163, 1, 18, 18, cd -> {
int index = (bsw.getSelfPosition().y - 1) / 21;
blockList.remove(index);
updateStates(blockList);
for (int i = index + 1; i < container.widgets.size(); i++) {
container.widgets.get(i).addSelfPosition(0, -21);
}
container.waitToRemoved(bsw);
}).setButtonTexture(new ResourceTexture("multiblocked:textures/gui/remove.png")).setHoverBorderTexture(1, -1).setHoverTooltips("multiblocked.gui.tips.remove"));
if (blockState != null) {
bsw.setBlock(blockState);
}
bsw.setOnBlockStateUpdate(state -> {
int index = (bsw.getSelfPosition().y - 1) / 21;
blockList.set(index, state);
updateStates(blockList);
});
}
use of com.lowdragmc.lowdraglib.gui.texture.ResourceTexture 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.ResourceTexture in project Multiblocked by Low-Drag-MC.
the class PredicateStates method addBlockSelectorWidget.
private void addBlockSelectorWidget(List<BlockState> blockList, DraggableScrollableWidgetGroup container, BlockState blockState) {
BlockSelectorWidget bsw = new BlockSelectorWidget(0, container.widgets.size() * 21 + 1, true);
container.addWidget(bsw);
bsw.addWidget(new ButtonWidget(163, 1, 18, 18, cd -> {
int index = (bsw.getSelfPosition().y - 1) / 21;
blockList.remove(index);
updateStates(blockList);
for (int i = index + 1; i < container.widgets.size(); i++) {
container.widgets.get(i).addSelfPosition(0, -21);
}
container.waitToRemoved(bsw);
}).setButtonTexture(new ResourceTexture("multiblocked:textures/gui/remove.png")).setHoverBorderTexture(1, -1).setHoverTooltips("multiblocked.gui.tips.remove"));
if (blockState != null) {
bsw.setBlock(blockState);
}
bsw.setOnBlockStateUpdate(state -> {
int index = (bsw.getSelfPosition().y - 1) / 21;
blockList.set(index, state);
updateStates(blockList);
});
}
use of com.lowdragmc.lowdraglib.gui.texture.ResourceTexture in project Multiblocked by Low-Drag-MC.
the class PredicateStates 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 = new ArrayList<>(Arrays.asList(states));
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.states.add"));
return groups;
}
use of com.lowdragmc.lowdraglib.gui.texture.ResourceTexture 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;
}
Aggregations