Search in sources :

Example 1 with ColorBorderTexture

use of com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture 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 ColorBorderTexture

use of com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture in project Multiblocked by Low-Drag-MC.

the class ComponentWidget method createBoolSwitch.

protected 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));
    return widgetGroup;
}
Also used : ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) DraggableScrollableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup) SwitchWidget(com.lowdragmc.lowdraglib.gui.widget.SwitchWidget)

Example 3 with ColorBorderTexture

use of com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture in project Multiblocked by Low-Drag-MC.

the class MultiCapabilityTrait method initSettingDialog.

protected void initSettingDialog(DialogWidget dialog, DraggableWidgetGroup slot, final int index) {
    ImageWidget imageWidget = (ImageWidget) slot.widgets.get(0);
    dialog.addWidget(new SelectorWidget(5, 30, 40, 15, Arrays.stream(IO.VALUES).map(Enum::name).collect(Collectors.toList()), -1).setValue(capabilityIO[index].name()).setOnChanged(io -> {
        capabilityIO[index] = IO.valueOf(io);
        imageWidget.setImage(new GuiTextureGroup(new ColorRectTexture(getColorByIO(guiIO[index])), new ColorBorderTexture(1, getColorByIO(capabilityIO[index]))));
    }).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xffaaaaaa)).setHoverTooltips("multiblocked.gui.trait.capability_io"));
    dialog.addWidget(new SelectorWidget(50, 30, 40, 15, Arrays.stream(IO.VALUES).map(Enum::name).collect(Collectors.toList()), -1).setValue(guiIO[index].name()).setOnChanged(io -> {
        guiIO[index] = IO.valueOf(io);
        imageWidget.setImage(new GuiTextureGroup(new ColorRectTexture(getColorByIO(guiIO[index])), new ColorBorderTexture(1, getColorByIO(capabilityIO[index]))));
    }).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xffaaaaaa)).setHoverTooltips("multiblocked.gui.trait.gui_io"));
    dialog.addWidget(new SelectorWidget(100, 30, 65, 15, Arrays.asList("multiblocked.gui.trait.auto_io", "multiblocked.gui.trait.passive_io"), -1).setValue(autoIO[index] ? "multiblocked.gui.trait.auto_io" : "multiblocked.gui.trait.passive_io").setOnChanged(auto -> autoIO[index] = auto.equals("multiblocked.gui.trait.auto_io")).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xffaaaaaa)).setHoverTooltips("multiblocked.gui.trait.auto"));
}
Also used : ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) SelectorWidget(com.lowdragmc.lowdraglib.gui.widget.SelectorWidget) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) ImageWidget(com.lowdragmc.lowdraglib.gui.widget.ImageWidget) GuiTextureGroup(com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup)

Example 4 with ColorBorderTexture

use of com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture 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;
}
Also used : ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) DraggableScrollableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) SwitchWidget(com.lowdragmc.lowdraglib.gui.widget.SwitchWidget)

Example 5 with ColorBorderTexture

use of com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture in project Multiblocked by Low-Drag-MC.

the class GTRenderer method addTextureSelector.

protected void addTextureSelector(int x, int y, int width, int height, String text, WidgetGroup parent, WidgetGroup group, ResourceLocation init, Consumer<ResourceLocation> newTexture) {
    ImageWidget imageWidget;
    if (init != null) {
        imageWidget = new ImageWidget(x, y, width, height, new GuiTextureGroup(new ColorBorderTexture(1, -1), new ResourceTexture(init.getNamespace() + ":textures/" + init.getPath() + ".png")));
    } else {
        imageWidget = new ImageWidget(x, y, width, height, new ColorBorderTexture(1, -1));
    }
    group.addWidget(imageWidget);
    group.addWidget(new ButtonWidget(x, y, width, height, null, cd -> new ResourceTextureWidget(parent, texture -> {
        if (texture != null) {
            imageWidget.setImage(new GuiTextureGroup(new ColorBorderTexture(1, -1), texture));
            newTexture.accept(new ResourceLocation(texture.imageLocation.toString().replace("textures/", "").replace(".png", "")));
        }
    })).setHoverTexture(new ColorRectTexture(0x4faaaaaa)).setHoverTooltips(String.format("select the %s texture", text)));
}
Also used : JsonObject(com.google.gson.JsonObject) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn) ImageWidget(com.lowdragmc.lowdraglib.gui.widget.ImageWidget) CustomBakedModel(com.lowdragmc.lowdraglib.client.model.custommodel.CustomBakedModel) IBakedModel(net.minecraft.client.renderer.model.IBakedModel) Random(java.util.Random) Direction(net.minecraft.util.Direction) Supplier(java.util.function.Supplier) BlockModel(net.minecraft.client.renderer.model.BlockModel) Dist(net.minecraftforge.api.distmarker.Dist) Minecraft(net.minecraft.client.Minecraft) Gson(com.google.gson.Gson) IBlockDisplayReader(net.minecraft.world.IBlockDisplayReader) BlockState(net.minecraft.block.BlockState) ModelLoader(net.minecraftforge.client.model.ModelLoader) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) Nonnull(javax.annotation.Nonnull) IMultiblockedRenderer(com.lowdragmc.multiblocked.client.renderer.IMultiblockedRenderer) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) ResourceTextureWidget(com.lowdragmc.multiblocked.api.gui.dialogs.ResourceTextureWidget) EnumMap(java.util.EnumMap) ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) IPartComponent(com.lowdragmc.multiblocked.api.tile.part.IPartComponent) IModelData(net.minecraftforge.client.model.data.IModelData) DraggableScrollableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup) AtlasTexture(net.minecraft.client.renderer.texture.AtlasTexture) ModelFactory(com.lowdragmc.lowdraglib.client.model.ModelFactory) GuiTextureGroup(com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup) IControllerComponent(com.lowdragmc.multiblocked.api.tile.IControllerComponent) BlockPos(net.minecraft.util.math.BlockPos) ButtonWidget(com.lowdragmc.lowdraglib.gui.widget.ButtonWidget) BakedQuad(net.minecraft.client.renderer.model.BakedQuad) Consumer(java.util.function.Consumer) List(java.util.List) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) ResourceLocation(net.minecraft.util.ResourceLocation) IUnbakedModel(net.minecraft.client.renderer.model.IUnbakedModel) TileEntity(net.minecraft.tileentity.TileEntity) Multiblocked(com.lowdragmc.multiblocked.Multiblocked) Collections(java.util.Collections) ResourceTextureWidget(com.lowdragmc.multiblocked.api.gui.dialogs.ResourceTextureWidget) ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) ResourceLocation(net.minecraft.util.ResourceLocation) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) ImageWidget(com.lowdragmc.lowdraglib.gui.widget.ImageWidget) ButtonWidget(com.lowdragmc.lowdraglib.gui.widget.ButtonWidget) GuiTextureGroup(com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup)

Aggregations

ColorBorderTexture (com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture)12 ColorRectTexture (com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture)10 ImageWidget (com.lowdragmc.lowdraglib.gui.widget.ImageWidget)10 ResourceTexture (com.lowdragmc.lowdraglib.gui.texture.ResourceTexture)9 GuiTextureGroup (com.lowdragmc.lowdraglib.gui.texture.GuiTextureGroup)8 ButtonWidget (com.lowdragmc.lowdraglib.gui.widget.ButtonWidget)6 WidgetGroup (com.lowdragmc.lowdraglib.gui.widget.WidgetGroup)6 DialogWidget (com.lowdragmc.lowdraglib.gui.widget.DialogWidget)5 DraggableScrollableWidgetGroup (com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup)5 JsonObject (com.google.gson.JsonObject)4 TextTexture (com.lowdragmc.lowdraglib.gui.texture.TextTexture)4 DraggableWidgetGroup (com.lowdragmc.lowdraglib.gui.widget.DraggableWidgetGroup)4 LabelWidget (com.lowdragmc.lowdraglib.gui.widget.LabelWidget)4 SelectorWidget (com.lowdragmc.lowdraglib.gui.widget.SelectorWidget)4 SwitchWidget (com.lowdragmc.lowdraglib.gui.widget.SwitchWidget)4 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)4 ResourceBorderTexture (com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture)3 TextFieldWidget (com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget)3 ResourceTextureWidget (com.lowdragmc.multiblocked.api.gui.dialogs.ResourceTextureWidget)3 Collections (java.util.Collections)3