Search in sources :

Example 1 with SceneWidget

use of com.lowdragmc.lowdraglib.gui.widget.SceneWidget in project Multiblocked by Low-Drag-MC.

the class PartBuilderWidget method initScene.

@OnlyIn(Dist.CLIENT)
private void initScene() {
    TrackedDummyWorld world = new TrackedDummyWorld();
    world.addBlock(BlockPos.ZERO, BlockInfo.fromBlockState(MbdComponents.DummyComponentBlock.defaultBlockState()));
    tileEntity = (DummyComponentTileEntity) world.getBlockEntity(BlockPos.ZERO);
    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.ZERO), null).setRenderSelect(false).setRenderFacing(false));
    this.addWidget(new ImageWidget(30, 65, 138, 15, textTexture = new TextTexture("", 0xff00ff00).setDropShadow(true).setWidth(138).setType(TextTexture.TextType.ROLL)));
}
Also used : ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) TrackedDummyWorld(com.lowdragmc.lowdraglib.utils.TrackedDummyWorld) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) TextTexture(com.lowdragmc.lowdraglib.gui.texture.TextTexture) ImageWidget(com.lowdragmc.lowdraglib.gui.widget.ImageWidget) GuiTextureGroup(com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup) SceneWidget(com.lowdragmc.lowdraglib.gui.widget.SceneWidget) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Example 2 with SceneWidget

use of com.lowdragmc.lowdraglib.gui.widget.SceneWidget 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;
}
Also used : JSONUtils(net.minecraft.util.JSONUtils) JsonObject(com.google.gson.JsonObject) TabButton(com.lowdragmc.lowdraglib.gui.widget.TabButton) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn) ImageWidget(com.lowdragmc.lowdraglib.gui.widget.ImageWidget) CapabilityTrait(com.lowdragmc.multiblocked.api.capability.trait.CapabilityTrait) IRendererWidget(com.lowdragmc.multiblocked.api.gui.dialogs.IRendererWidget) MultiblockCapability(com.lowdragmc.multiblocked.api.capability.MultiblockCapability) ResourceBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture) TabContainer(com.lowdragmc.lowdraglib.gui.widget.TabContainer) Dist(net.minecraftforge.api.distmarker.Dist) BlockInfo(com.lowdragmc.lowdraglib.utils.BlockInfo) TextBoxWidget(com.lowdragmc.lowdraglib.gui.widget.TextBoxWidget) Minecraft(net.minecraft.client.Minecraft) LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) ComponentDefinition(com.lowdragmc.multiblocked.api.definition.ComponentDefinition) DummyComponentTileEntity(com.lowdragmc.multiblocked.api.tile.DummyComponentTileEntity) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) IMultiblockedRenderer(com.lowdragmc.multiblocked.client.renderer.IMultiblockedRenderer) TextTexture(com.lowdragmc.lowdraglib.gui.texture.TextTexture) ResourceTextureWidget(com.lowdragmc.multiblocked.api.gui.dialogs.ResourceTextureWidget) MbdComponents(com.lowdragmc.multiblocked.api.registry.MbdComponents) TextFieldWidget(com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget) PartDefinition(com.lowdragmc.multiblocked.api.definition.PartDefinition) TrackedDummyWorld(com.lowdragmc.lowdraglib.utils.TrackedDummyWorld) ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) DraggableScrollableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup) SwitchWidget(com.lowdragmc.lowdraglib.gui.widget.SwitchWidget) BlockPos(net.minecraft.util.math.BlockPos) ButtonWidget(com.lowdragmc.lowdraglib.gui.widget.ButtonWidget) SceneWidget(com.lowdragmc.lowdraglib.gui.widget.SceneWidget) DialogWidget(com.lowdragmc.lowdraglib.gui.widget.DialogWidget) MbdCapabilities(com.lowdragmc.multiblocked.api.registry.MbdCapabilities) Consumer(java.util.function.Consumer) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) ResourceLocation(net.minecraft.util.ResourceLocation) Multiblocked(com.lowdragmc.multiblocked.Multiblocked) Collections(java.util.Collections) ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) IRendererWidget(com.lowdragmc.multiblocked.api.gui.dialogs.IRendererWidget) TrackedDummyWorld(com.lowdragmc.lowdraglib.utils.TrackedDummyWorld) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) DraggableScrollableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup) PartDefinition(com.lowdragmc.multiblocked.api.definition.PartDefinition) ButtonWidget(com.lowdragmc.lowdraglib.gui.widget.ButtonWidget) ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) ResourceLocation(net.minecraft.util.ResourceLocation) LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) ImageWidget(com.lowdragmc.lowdraglib.gui.widget.ImageWidget) DummyComponentTileEntity(com.lowdragmc.multiblocked.api.tile.DummyComponentTileEntity) SceneWidget(com.lowdragmc.lowdraglib.gui.widget.SceneWidget) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn)

Aggregations

ColorBorderTexture (com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture)2 ColorRectTexture (com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture)2 TextTexture (com.lowdragmc.lowdraglib.gui.texture.TextTexture)2 ImageWidget (com.lowdragmc.lowdraglib.gui.widget.ImageWidget)2 SceneWidget (com.lowdragmc.lowdraglib.gui.widget.SceneWidget)2 TrackedDummyWorld (com.lowdragmc.lowdraglib.utils.TrackedDummyWorld)2 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)2 JsonObject (com.google.gson.JsonObject)1 GuiTextureGroup (com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup)1 ResourceBorderTexture (com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture)1 ResourceTexture (com.lowdragmc.lowdraglib.gui.texture.ResourceTexture)1 ButtonWidget (com.lowdragmc.lowdraglib.gui.widget.ButtonWidget)1 DialogWidget (com.lowdragmc.lowdraglib.gui.widget.DialogWidget)1 DraggableScrollableWidgetGroup (com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup)1 LabelWidget (com.lowdragmc.lowdraglib.gui.widget.LabelWidget)1 SwitchWidget (com.lowdragmc.lowdraglib.gui.widget.SwitchWidget)1 TabButton (com.lowdragmc.lowdraglib.gui.widget.TabButton)1 TabContainer (com.lowdragmc.lowdraglib.gui.widget.TabContainer)1 TextBoxWidget (com.lowdragmc.lowdraglib.gui.widget.TextBoxWidget)1 TextFieldWidget (com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget)1