Search in sources :

Example 1 with SceneWidget

use of com.cleanroommc.multiblocked.api.gui.widget.imp.SceneWidget in project Multiblocked by CleanroomMC.

the class ComponentWidget method createScene.

@SideOnly(Side.CLIENT)
protected WidgetGroup createScene(int x, int y, String text, String tips, IRenderer init, Consumer<IRenderer> onUpdate) {
    TrackedDummyWorld world = new TrackedDummyWorld();
    world.addBlock(BlockPos.ORIGIN, new BlockInfo(MbdComponents.DummyComponentBlock));
    DummyComponentTileEntity tileEntity = (DummyComponentTileEntity) world.getTileEntity(BlockPos.ORIGIN);
    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.ORIGIN), 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).setHoverTooltip(tips));
    return widgetGroup;
}
Also used : DialogWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.DialogWidget) JsonObject(com.google.gson.JsonObject) IRenderer(com.cleanroommc.multiblocked.client.renderer.IRenderer) SceneWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.SceneWidget) SwitchWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.SwitchWidget) Multiblocked(com.cleanroommc.multiblocked.Multiblocked) TextTexture(com.cleanroommc.multiblocked.api.gui.texture.TextTexture) ButtonWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.ButtonWidget) DummyComponentTileEntity(com.cleanroommc.multiblocked.api.tile.DummyComponentTileEntity) TrackedDummyWorld(com.cleanroommc.multiblocked.client.util.TrackedDummyWorld) CapabilityTrait(com.cleanroommc.multiblocked.api.capability.trait.CapabilityTrait) MultiblockCapability(com.cleanroommc.multiblocked.api.capability.MultiblockCapability) Side(net.minecraftforge.fml.relauncher.Side) MbdCapabilities(com.cleanroommc.multiblocked.api.registry.MbdCapabilities) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) TextFieldWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.TextFieldWidget) ImageWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.ImageWidget) IRendererWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.blueprint_table.dialogs.IRendererWidget) ResourceBorderTexture(com.cleanroommc.multiblocked.api.gui.texture.ResourceBorderTexture) BlockPos(net.minecraft.util.math.BlockPos) WidgetGroup(com.cleanroommc.multiblocked.api.gui.widget.WidgetGroup) LabelWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.LabelWidget) TabContainer(com.cleanroommc.multiblocked.api.gui.widget.imp.tab.TabContainer) ColorBorderTexture(com.cleanroommc.multiblocked.api.gui.texture.ColorBorderTexture) DraggableScrollableWidgetGroup(com.cleanroommc.multiblocked.api.gui.widget.imp.DraggableScrollableWidgetGroup) Consumer(java.util.function.Consumer) BlockInfo(com.cleanroommc.multiblocked.api.pattern.util.BlockInfo) ResourceTextureWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.blueprint_table.dialogs.ResourceTextureWidget) GuiScreen(net.minecraft.client.gui.GuiScreen) PartDefinition(com.cleanroommc.multiblocked.api.definition.PartDefinition) ComponentDefinition(com.cleanroommc.multiblocked.api.definition.ComponentDefinition) JsonUtils(net.minecraft.util.JsonUtils) ColorRectTexture(com.cleanroommc.multiblocked.api.gui.texture.ColorRectTexture) TextBoxWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.TextBoxWidget) MbdComponents(com.cleanroommc.multiblocked.api.registry.MbdComponents) ResourceLocation(net.minecraft.util.ResourceLocation) ResourceTexture(com.cleanroommc.multiblocked.api.gui.texture.ResourceTexture) TabButton(com.cleanroommc.multiblocked.api.gui.widget.imp.tab.TabButton) Collections(java.util.Collections) ResourceTexture(com.cleanroommc.multiblocked.api.gui.texture.ResourceTexture) IRendererWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.blueprint_table.dialogs.IRendererWidget) TrackedDummyWorld(com.cleanroommc.multiblocked.client.util.TrackedDummyWorld) WidgetGroup(com.cleanroommc.multiblocked.api.gui.widget.WidgetGroup) DraggableScrollableWidgetGroup(com.cleanroommc.multiblocked.api.gui.widget.imp.DraggableScrollableWidgetGroup) PartDefinition(com.cleanroommc.multiblocked.api.definition.PartDefinition) ButtonWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.ButtonWidget) ColorBorderTexture(com.cleanroommc.multiblocked.api.gui.texture.ColorBorderTexture) BlockInfo(com.cleanroommc.multiblocked.api.pattern.util.BlockInfo) ResourceLocation(net.minecraft.util.ResourceLocation) LabelWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.LabelWidget) ImageWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.ImageWidget) DummyComponentTileEntity(com.cleanroommc.multiblocked.api.tile.DummyComponentTileEntity) SceneWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.SceneWidget) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with SceneWidget

use of com.cleanroommc.multiblocked.api.gui.widget.imp.SceneWidget in project Multiblocked by CleanroomMC.

the class PartBuilderWidget method initScene.

@SideOnly(Side.CLIENT)
private void initScene() {
    TrackedDummyWorld world = new TrackedDummyWorld();
    world.addBlock(BlockPos.ORIGIN, new BlockInfo(MbdComponents.DummyComponentBlock));
    tileEntity = (DummyComponentTileEntity) world.getTileEntity(BlockPos.ORIGIN);
    this.addWidget(new ImageWidget(30, 59, 138, 138, new GuiTextureGroup(new ColorBorderTexture(3, -1), new ColorRectTexture(0xaf444444))));
    this.addWidget(new SceneWidget(30, 59, 138, 138, world).setRenderedCore(Collections.singleton(BlockPos.ORIGIN), null).setRenderSelect(false).setRenderFacing(false));
}
Also used : ColorBorderTexture(com.cleanroommc.multiblocked.api.gui.texture.ColorBorderTexture) TrackedDummyWorld(com.cleanroommc.multiblocked.client.util.TrackedDummyWorld) BlockInfo(com.cleanroommc.multiblocked.api.pattern.util.BlockInfo) ColorRectTexture(com.cleanroommc.multiblocked.api.gui.texture.ColorRectTexture) ImageWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.ImageWidget) GuiTextureGroup(com.cleanroommc.multiblocked.api.gui.texture.GuiTextureGroup) SceneWidget(com.cleanroommc.multiblocked.api.gui.widget.imp.SceneWidget) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Aggregations

ColorBorderTexture (com.cleanroommc.multiblocked.api.gui.texture.ColorBorderTexture)2 ColorRectTexture (com.cleanroommc.multiblocked.api.gui.texture.ColorRectTexture)2 ImageWidget (com.cleanroommc.multiblocked.api.gui.widget.imp.ImageWidget)2 SceneWidget (com.cleanroommc.multiblocked.api.gui.widget.imp.SceneWidget)2 BlockInfo (com.cleanroommc.multiblocked.api.pattern.util.BlockInfo)2 TrackedDummyWorld (com.cleanroommc.multiblocked.client.util.TrackedDummyWorld)2 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)2 Multiblocked (com.cleanroommc.multiblocked.Multiblocked)1 MultiblockCapability (com.cleanroommc.multiblocked.api.capability.MultiblockCapability)1 CapabilityTrait (com.cleanroommc.multiblocked.api.capability.trait.CapabilityTrait)1 ComponentDefinition (com.cleanroommc.multiblocked.api.definition.ComponentDefinition)1 PartDefinition (com.cleanroommc.multiblocked.api.definition.PartDefinition)1 GuiTextureGroup (com.cleanroommc.multiblocked.api.gui.texture.GuiTextureGroup)1 ResourceBorderTexture (com.cleanroommc.multiblocked.api.gui.texture.ResourceBorderTexture)1 ResourceTexture (com.cleanroommc.multiblocked.api.gui.texture.ResourceTexture)1 TextTexture (com.cleanroommc.multiblocked.api.gui.texture.TextTexture)1 WidgetGroup (com.cleanroommc.multiblocked.api.gui.widget.WidgetGroup)1 ButtonWidget (com.cleanroommc.multiblocked.api.gui.widget.imp.ButtonWidget)1 DialogWidget (com.cleanroommc.multiblocked.api.gui.widget.imp.DialogWidget)1 DraggableScrollableWidgetGroup (com.cleanroommc.multiblocked.api.gui.widget.imp.DraggableScrollableWidgetGroup)1