use of com.lowdragmc.lowdraglib.gui.widget.BlockSelectorWidget 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.widget.BlockSelectorWidget 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.widget.BlockSelectorWidget in project Multiblocked by Low-Drag-MC.
the class MBDBlockStateRenderer method createConfigurator.
@Override
public Supplier<IMultiblockedRenderer> createConfigurator(WidgetGroup parent, DraggableScrollableWidgetGroup group, IMultiblockedRenderer current) {
BlockSelectorWidget blockSelectorWidget = new BlockSelectorWidget(0, 1, true);
if (current instanceof BlockStateRenderer) {
blockSelectorWidget.setBlock(((BlockStateRenderer) current).blockInfo.getBlockState());
}
group.addWidget(blockSelectorWidget);
return () -> {
if (blockSelectorWidget.getBlock() == null) {
return null;
} else {
return new MBDBlockStateRenderer(blockSelectorWidget.getBlock());
}
};
}
Aggregations