use of com.lowdragmc.multiblocked.api.definition.PartDefinition in project Multiblocked by Low-Drag-MC.
the class ComponentWidget method createScene.
@OnlyIn(Dist.CLIENT)
protected WidgetGroup createScene(int x, int y, String text, String tips, IMultiblockedRenderer init, Consumer<IMultiblockedRenderer> onUpdate) {
TrackedDummyWorld world = new TrackedDummyWorld();
world.addBlock(BlockPos.ZERO, BlockInfo.fromBlockState(MbdComponents.DummyComponentBlock.defaultBlockState()));
DummyComponentTileEntity tileEntity = (DummyComponentTileEntity) world.getBlockEntity(BlockPos.ZERO);
tileEntity.setDefinition(new PartDefinition(new ResourceLocation(Multiblocked.MODID, "component_widget")));
tileEntity.getDefinition().baseRenderer = init;
WidgetGroup widgetGroup = new WidgetGroup(x, y, 90, 90);
widgetGroup.addWidget(new LabelWidget(0, 0, text));
widgetGroup.addWidget(new ImageWidget(0, 12, 90, 80, new ColorBorderTexture(2, 0xff4A82F7)));
widgetGroup.addWidget(new SceneWidget(0, 12, 90, 80, world).setRenderedCore(Collections.singleton(BlockPos.ZERO), null).setRenderSelect(false).setRenderFacing(false));
widgetGroup.addWidget(new ButtonWidget(90 - 15, 12, 15, 15, new ResourceTexture("multiblocked:textures/gui/option.png"), (cd) -> new IRendererWidget(this, tileEntity.getRenderer(), r -> {
tileEntity.getDefinition().baseRenderer = r;
onUpdate.accept(r);
})).setHoverBorderTexture(1, -1).setHoverTooltips(tips));
return widgetGroup;
}
use of com.lowdragmc.multiblocked.api.definition.PartDefinition in project Multiblocked by Low-Drag-MC.
the class IRendererWidget method setNewRenderer.
private void setNewRenderer(IMultiblockedRenderer newRenderer) {
PartDefinition definition = new PartDefinition(new ResourceLocation(Multiblocked.MODID, "i_renderer"));
definition.baseRenderer = newRenderer;
tileEntity.setDefinition(definition);
}
use of com.lowdragmc.multiblocked.api.definition.PartDefinition in project Multiblocked by Low-Drag-MC.
the class JsonBlockPatternWidget method registerBlock.
public static void registerBlock() {
PartDefinition definition = new PartDefinition(new ResourceLocation(Multiblocked.MODID, "symbol"), SymbolTileEntity::new);
definition.properties.isOpaque = false;
definition.properties.tabGroup = null;
definition.showInJei = false;
MbdComponents.registerComponent(definition);
symbolBlock = (BlockComponent) MbdComponents.COMPONENT_BLOCKS_REGISTRY.get(definition.location);
}
Aggregations