From 7ad05756184482a2e47a07a3a4f8843dbd915070 Mon Sep 17 00:00:00 2001 From: zelophed Date: Wed, 7 Apr 2021 02:17:55 +0200 Subject: [PATCH] fancy text --- .../com/simibubi/create/CreateClient.java | 1 + .../simibubi/create/events/ClientEvents.java | 4 +- .../command/ConfigureConfigPacket.java | 4 +- .../config/ui/BaseConfigScreen.java | 62 +++++++++++++ .../foundation/config/ui/ConfigButton.java | 56 ++++++++++++ .../foundation/config/ui/ConfigScreen.java | 8 +- .../gui/CombinedStencilElement.java | 58 +++++++++++++ .../create/foundation/gui/StencilElement.java | 55 ++++++++++++ .../foundation/gui/TextStencilElement.java | 87 +++++++++++++++++++ .../create/foundation/gui/UIRenderHelper.java | 33 +++++++ .../gui/widgets/AbstractSimiWidget.java | 4 +- .../foundation/gui/widgets/IconButton.java | 4 +- .../foundation/gui/widgets/StencilWidget.java | 33 +++++++ .../foundation/ponder/PonderProgressBar.java | 4 +- .../foundation/ponder/ui/PonderButton.java | 4 +- 15 files changed, 408 insertions(+), 9 deletions(-) create mode 100644 src/main/java/com/simibubi/create/foundation/config/ui/BaseConfigScreen.java create mode 100644 src/main/java/com/simibubi/create/foundation/config/ui/ConfigButton.java create mode 100644 src/main/java/com/simibubi/create/foundation/gui/CombinedStencilElement.java create mode 100644 src/main/java/com/simibubi/create/foundation/gui/StencilElement.java create mode 100644 src/main/java/com/simibubi/create/foundation/gui/TextStencilElement.java create mode 100644 src/main/java/com/simibubi/create/foundation/gui/widgets/StencilWidget.java diff --git a/src/main/java/com/simibubi/create/CreateClient.java b/src/main/java/com/simibubi/create/CreateClient.java index d8c61294d..80c6141e9 100644 --- a/src/main/java/com/simibubi/create/CreateClient.java +++ b/src/main/java/com/simibubi/create/CreateClient.java @@ -110,6 +110,7 @@ public class CreateClient { PonderIndex.registerTags(); UIRenderHelper.init(); + UIRenderHelper.enableStencil(); IResourceManager resourceManager = Minecraft.getInstance() .getResourceManager(); diff --git a/src/main/java/com/simibubi/create/events/ClientEvents.java b/src/main/java/com/simibubi/create/events/ClientEvents.java index 3633ad869..d5861bde4 100644 --- a/src/main/java/com/simibubi/create/events/ClientEvents.java +++ b/src/main/java/com/simibubi/create/events/ClientEvents.java @@ -29,7 +29,7 @@ import com.simibubi.create.content.curiosities.zapper.terrainzapper.WorldshaperR import com.simibubi.create.content.logistics.block.depot.EjectorTargetHandler; import com.simibubi.create.content.logistics.block.mechanicalArm.ArmInteractionPointHandler; import com.simibubi.create.foundation.config.AllConfigs; -import com.simibubi.create.foundation.config.ui.ConfigScreen; +import com.simibubi.create.foundation.config.ui.BaseConfigScreen; import com.simibubi.create.foundation.item.ItemDescription; import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.networking.AllPackets; @@ -312,7 +312,7 @@ public class ClientEvents { public static void loadCompleted(FMLLoadCompleteEvent event) { ModContainer createContainer = ModList.get().getModContainerById("create").orElseThrow(() -> new IllegalStateException("Create Mod Container missing after loadCompleted")); - createContainer.registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY, () -> (mc, previousScreen) -> new ConfigScreen(previousScreen)); + createContainer.registerExtensionPoint(ExtensionPoint.CONFIGGUIFACTORY, () -> (mc, previousScreen) -> new BaseConfigScreen(previousScreen)); } } diff --git a/src/main/java/com/simibubi/create/foundation/command/ConfigureConfigPacket.java b/src/main/java/com/simibubi/create/foundation/command/ConfigureConfigPacket.java index 2482b4155..b84fed0a1 100644 --- a/src/main/java/com/simibubi/create/foundation/command/ConfigureConfigPacket.java +++ b/src/main/java/com/simibubi/create/foundation/command/ConfigureConfigPacket.java @@ -3,7 +3,7 @@ package com.simibubi.create.foundation.command; import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.goggles.GoggleConfigScreen; import com.simibubi.create.foundation.config.AllConfigs; -import com.simibubi.create.foundation.config.ui.ConfigScreen; +import com.simibubi.create.foundation.config.ui.BaseConfigScreen; import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.foundation.networking.SimplePacketBase; import com.simibubi.create.foundation.ponder.PonderRegistry; @@ -93,7 +93,7 @@ public class ConfigureConfigPacket extends SimplePacketBase { @OnlyIn(Dist.CLIENT) private static void configScreen(String value) { - ScreenOpener.open(new ConfigScreen(null)); + ScreenOpener.open(new BaseConfigScreen(null)); } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/com/simibubi/create/foundation/config/ui/BaseConfigScreen.java b/src/main/java/com/simibubi/create/foundation/config/ui/BaseConfigScreen.java new file mode 100644 index 000000000..849792f5d --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/config/ui/BaseConfigScreen.java @@ -0,0 +1,62 @@ +package com.simibubi.create.foundation.config.ui; + +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; + +import com.mojang.blaze3d.matrix.MatrixStack; +import com.simibubi.create.foundation.gui.CombinedStencilElement; +import com.simibubi.create.foundation.gui.StencilElement; +import com.simibubi.create.foundation.gui.TextStencilElement; +import com.simibubi.create.foundation.gui.UIRenderHelper; +import com.simibubi.create.foundation.gui.widgets.StencilWidget; + +public class BaseConfigScreen extends ConfigScreen { + + StencilWidget clientConfigWidget; + StencilWidget commonConfigWidget; + StencilWidget serverConfigWidget; + + public BaseConfigScreen(Screen parent) { + super(parent); + } + + @Override + protected void init() { + widgets.clear(); + super.init(); + + StencilElement text = new TextStencilElement.Centered(client.fontRenderer, new StringTextComponent("CLIENT CONFIG").formatted(TextFormatting.BOLD), 200).at(0, 11, 0); + widgets.add(clientConfigWidget = ConfigButton.createFromTextElement( + width/2 - 100, + height/2 - 15 - 50, + 200, + 30, + text + )); + + StencilElement text2 = new TextStencilElement.Centered(client.fontRenderer, new StringTextComponent("COMMON CONFIG").formatted(TextFormatting.BOLD), 200).at(0, 11, 0); + widgets.add(commonConfigWidget = ConfigButton.createFromTextElement( + width/2 - 100, + height/2 - 15, + 200, + 30, + text2 + )); + + StencilElement text3 = new TextStencilElement.Centered(client.fontRenderer, new StringTextComponent("SERVER CONFIG").formatted(TextFormatting.BOLD), 200).at(0, 11, 0); + widgets.add(serverConfigWidget = ConfigButton.createFromTextElement( + width/2 - 100, + height/2 - 15 + 50, + 200, + 30, + text3 + )); + } + + @Override + protected void renderWindow(MatrixStack ms, int mouseX, int mouseY, float partialTicks) { + super.renderWindow(ms, mouseX, mouseY, partialTicks); + + } +} diff --git a/src/main/java/com/simibubi/create/foundation/config/ui/ConfigButton.java b/src/main/java/com/simibubi/create/foundation/config/ui/ConfigButton.java new file mode 100644 index 000000000..de4aabeb0 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/config/ui/ConfigButton.java @@ -0,0 +1,56 @@ +package com.simibubi.create.foundation.config.ui; + +import net.minecraft.client.gui.AbstractGui; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.util.text.StringTextComponent; + +import javax.annotation.Nonnull; +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; +import com.simibubi.create.foundation.gui.CombinedStencilElement; +import com.simibubi.create.foundation.gui.StencilElement; +import com.simibubi.create.foundation.gui.UIRenderHelper; +import com.simibubi.create.foundation.gui.widgets.StencilWidget; + +public class ConfigButton extends StencilWidget { + + protected int gradientColor1 = 0xff_c0c0ff, gradientColor2 = 0xff_7b7ba3; + + public static ConfigButton createFromTextElement(int x, int y, int width, int height, StencilElement text) { + ConfigButton button = new ConfigButton(x, y, width, height); + StencilElement box = new StencilElement() { + @Override + protected void renderStencil(MatrixStack ms) { + fill(ms, 0, 0 , width, 0 + 1, 0xff_000000); + fill(ms, 0, height, width +1, height + 1, 0xff_000000); + fill(ms, 0 , 0, 0 + 1, height, 0xff_000000); + fill(ms, width, 0, width + 1, height, 0xff_000000); + } + + @Override + protected void renderElement(MatrixStack ms) { + UIRenderHelper.angledGradient(ms, 0, 0, 15, 32, 201, button.gradientColor1, button.gradientColor2); + } + }; + button.stencilElement = CombinedStencilElement.of(box, text); + return button; + } + + protected ConfigButton(int x, int y, int width, int height) { + super(x, y, width, height); + } + + public ConfigButton(int x, int y, int width, int height, StencilElement stencilElement) { + super(x, y, width, height, stencilElement); + } + + @Override + public void renderButton(@Nonnull MatrixStack ms, int mouseX, int mouseY, float partialTicks) { + RenderSystem.enableBlend(); + RenderSystem.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); + fill(ms, x, y, x + width, y + height, 0x30_ffffff); + RenderSystem.defaultBlendFunc(); + super.renderButton(ms, mouseX, mouseY, partialTicks); + } +} diff --git a/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreen.java b/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreen.java index 3848f917f..a02bc1cca 100644 --- a/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreen.java +++ b/src/main/java/com/simibubi/create/foundation/config/ui/ConfigScreen.java @@ -11,6 +11,8 @@ import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock; import com.simibubi.create.foundation.gui.GuiGameElement; +import com.simibubi.create.foundation.gui.StencilElement; +import com.simibubi.create.foundation.gui.TextStencilElement; import com.simibubi.create.foundation.gui.UIRenderHelper; import com.simibubi.create.foundation.ponder.NavigatableSimiScreen; import com.simibubi.create.foundation.utility.animation.Force; @@ -22,6 +24,8 @@ public class ConfigScreen extends NavigatableSimiScreen { protected static final PhysicalFloat cogSpin = PhysicalFloat.create().withDrag(0.3).addForce(new Force.Static(.2f)); protected static final BlockState cogwheelState = AllBlocks.LARGE_COGWHEEL.getDefaultState().with(CogWheelBlock.AXIS, Direction.Axis.Y); + protected StencilElement testStencil; + public ConfigScreen(Screen parent) { this.parent = parent; } @@ -35,7 +39,7 @@ public class ConfigScreen extends NavigatableSimiScreen { @Override protected void init() { super.init(); - + testStencil = new TextStencilElement(client.fontRenderer, "POGGERS").at(width*0.5f, height*0.5f, 0); } @Override @@ -78,6 +82,8 @@ public class ConfigScreen extends NavigatableSimiScreen { this.drawHorizontalLine(ms, x-25, x+25, y, 0xff_807060); this.drawVerticalLine(ms, x, y-25, y+25, 0xff_90a0b0); + //this.testStencil.render(ms); + //UIRenderHelper.streak(ms, 0, mouseX, mouseY, 16, 50, 0xaa_1e1e1e); } diff --git a/src/main/java/com/simibubi/create/foundation/gui/CombinedStencilElement.java b/src/main/java/com/simibubi/create/foundation/gui/CombinedStencilElement.java new file mode 100644 index 000000000..7a8077ea8 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/gui/CombinedStencilElement.java @@ -0,0 +1,58 @@ +package com.simibubi.create.foundation.gui; + +import javax.annotation.Nonnull; +import com.mojang.blaze3d.matrix.MatrixStack; + +public class CombinedStencilElement extends StencilElement { + + private StencilElement element1; + private StencilElement element2; + private ElementMode mode; + + private CombinedStencilElement() {} + + public static CombinedStencilElement of(@Nonnull StencilElement element1, @Nonnull StencilElement element2) { + return of(element1, element2, ElementMode.FIRST); + } + + public static CombinedStencilElement of(@Nonnull StencilElement element1, @Nonnull StencilElement element2, ElementMode mode) { + CombinedStencilElement e = new CombinedStencilElement(); + e.element1 = element1; + e.element2 = element2; + e.mode = mode; + return e; + } + + @Override + protected void renderStencil(MatrixStack ms) { + ms.push(); + element1.transform(ms); + element1.renderStencil(ms); + ms.pop(); + ms.push(); + element2.transform(ms); + element2.renderStencil(ms); + ms.pop(); + } + + @Override + protected void renderElement(MatrixStack ms) { + if (mode.rendersFirst()) + element1.renderElement(ms); + + if (mode.rendersSecond()) + element2.renderElement(ms); + } + + public enum ElementMode { + FIRST, SECOND, BOTH; + + boolean rendersFirst() { + return this == FIRST || this == BOTH; + } + + boolean rendersSecond() { + return this == SECOND || this == BOTH; + } + } +} diff --git a/src/main/java/com/simibubi/create/foundation/gui/StencilElement.java b/src/main/java/com/simibubi/create/foundation/gui/StencilElement.java new file mode 100644 index 000000000..814ab2ff3 --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/gui/StencilElement.java @@ -0,0 +1,55 @@ +package com.simibubi.create.foundation.gui; + +import org.lwjgl.opengl.GL11; +import com.mojang.blaze3d.matrix.MatrixStack; +import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; + +public abstract class StencilElement { + + float x, y , z; + + public StencilElement at(float x, float y, float z) { + this.x = x; + this.y = y; + this.z = z; + return this; + } + + public void render(MatrixStack ms) { + ms.push(); + transform(ms); + prepareStencil(ms); + renderStencil(ms); + prepareElement(ms); + renderElement(ms); + cleanUp(ms); + ms.pop(); + } + + protected abstract void renderStencil(MatrixStack ms); + + protected abstract void renderElement(MatrixStack ms); + + protected void transform(MatrixStack ms) { + ms.translate(x, y, z); + } + + protected void prepareStencil(MatrixStack ms) { + GL11.glEnable(GL11.GL_STENCIL_TEST); + RenderSystem.clearStencil(0); + RenderSystem.stencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_REPLACE); + RenderSystem.stencilMask(0xFF); + RenderSystem.stencilFunc(GL11.GL_ALWAYS, 1, 0xFF); + } + + protected void prepareElement(MatrixStack ms) { + GL11.glEnable(GL11.GL_STENCIL_TEST); + RenderSystem.stencilOp(GL11.GL_KEEP, GL11.GL_KEEP, GL11.GL_KEEP); + RenderSystem.stencilFunc(GL11.GL_EQUAL, 1, 0xFF); + } + + protected void cleanUp(MatrixStack ms) { + GL11.glDisable(GL11.GL_STENCIL_TEST); + } +} diff --git a/src/main/java/com/simibubi/create/foundation/gui/TextStencilElement.java b/src/main/java/com/simibubi/create/foundation/gui/TextStencilElement.java new file mode 100644 index 000000000..c1382507a --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/gui/TextStencilElement.java @@ -0,0 +1,87 @@ +package com.simibubi.create.foundation.gui; + +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.util.text.IFormattableTextComponent; +import net.minecraft.util.text.StringTextComponent; + +import com.mojang.blaze3d.matrix.MatrixStack; + +public class TextStencilElement extends StencilElement { + + protected static final ElementRenderer DEFAULT_RENDERER = ((ms, width, _height) -> UIRenderHelper.angledGradient(ms, 15, -3, 5, 14, width+6, 0xff_10dd10, 0x1010dd)); + + protected FontRenderer font; + protected IFormattableTextComponent component; + protected ElementRenderer elementRenderer = DEFAULT_RENDERER; + + public TextStencilElement(FontRenderer font) { + super(); + this.font = font; + } + + public TextStencilElement(FontRenderer font, String text) { + this(font); + component = new StringTextComponent(text); + } + + public TextStencilElement(FontRenderer font, IFormattableTextComponent component) { + this(font); + this.component = component; + } + + public TextStencilElement withElementRenderer(ElementRenderer renderer) { + elementRenderer = renderer; + return this; + } + + public TextStencilElement withText(String text) { + component = new StringTextComponent(text); + return this; + } + + public TextStencilElement withText(IFormattableTextComponent component) { + this.component = component; + return this; + } + + @Override + protected void renderStencil(MatrixStack ms) { + font.draw(ms, component, 0, 0, 0xff_000000); + } + + @Override + protected void renderElement(MatrixStack ms) { + elementRenderer.render(ms, font.getWidth(component), 10); + } + + @FunctionalInterface + public interface ElementRenderer { + void render(MatrixStack ms, int width, int height); + } + + public static class Centered extends TextStencilElement { + + int width; + + public Centered(FontRenderer font, String text, int width) { + super(font, text); + this.width = width; + } + + public Centered(FontRenderer font, IFormattableTextComponent component, int width) { + super(font, component); + this.width = width; + } + + @Override + protected void renderStencil(MatrixStack ms) { + int textWidth = font.getWidth(component); + font.draw(ms, component, width / 2f - textWidth / 2f, 0, 0xff_000000); + } + + @Override + protected void renderElement(MatrixStack ms) { + elementRenderer.render(ms, width, 10); + } + } +} diff --git a/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java b/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java index b8dfbb8a2..c409480bd 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java +++ b/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java @@ -16,8 +16,14 @@ import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.shader.Framebuffer; import net.minecraftforge.fml.client.gui.GuiUtils; +import javax.annotation.Nonnull; + public class UIRenderHelper { + public static void enableStencil() { + RenderSystem.recordRenderCall(() -> Minecraft.getInstance().getFramebuffer().enableStencil()); + } + public static Framebuffer framebuffer; public static void init() { @@ -102,6 +108,33 @@ public class UIRenderHelper { GuiUtils.drawGradientRect(model, 0, -width, (int) (split2 * height), width, height, c3, c4); } + /** + * @see #angledGradient(MatrixStack, float, int, int, int, int, int, int, int) + */ + public static void angledGradient(@Nonnull MatrixStack ms, float angle, int x, int y, int width, int length, int color1, int color2) { + angledGradient(ms, angle, x, y, 0, width, length, color1, color2); + } + /** + * x and y specify the middle point of the starting edge + * + * @param angle the angle of the gradient in degrees; 0° means from left to right + * @param color1 the color at the starting edge + * @param color2 the color at the ending edge + * @param width the total width of the gradient + * + */ + public static void angledGradient(@Nonnull MatrixStack ms, float angle, int x, int y, int z, int width, int length, int color1, int color2) { + ms.push(); + ms.translate(x, y, z); + ms.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(angle - 90)); + + Matrix4f model = ms.peek().getModel(); + int w = width / 2; + GuiUtils.drawGradientRect(model, 0, -w, 0, w, length, color1, color2); + + ms.pop(); + } + //draws a wide chevron-style breadcrumb arrow pointing left public static void breadcrumbArrow(MatrixStack matrixStack, int x, int y, int z, int width, int height, int indent, int startColor, int endColor) { matrixStack.push(); diff --git a/src/main/java/com/simibubi/create/foundation/gui/widgets/AbstractSimiWidget.java b/src/main/java/com/simibubi/create/foundation/gui/widgets/AbstractSimiWidget.java index 2c84c9ccf..f6ba1668c 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widgets/AbstractSimiWidget.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widgets/AbstractSimiWidget.java @@ -9,6 +9,8 @@ import net.minecraft.client.gui.widget.Widget; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; +import javax.annotation.Nonnull; + public abstract class AbstractSimiWidget extends Widget { protected List toolTip; @@ -23,7 +25,7 @@ public abstract class AbstractSimiWidget extends Widget { } @Override - public void renderButton(MatrixStack matrixStack, int p_renderButton_1_, int p_renderButton_2_, float p_renderButton_3_) { + public void renderButton(@Nonnull MatrixStack ms, int mouseX, int mouseY, float partialTicks) { } } diff --git a/src/main/java/com/simibubi/create/foundation/gui/widgets/IconButton.java b/src/main/java/com/simibubi/create/foundation/gui/widgets/IconButton.java index 83049c1de..dcd54ac69 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/widgets/IconButton.java +++ b/src/main/java/com/simibubi/create/foundation/gui/widgets/IconButton.java @@ -7,6 +7,8 @@ import com.simibubi.create.foundation.gui.AllIcons; import net.minecraft.util.text.ITextComponent; +import javax.annotation.Nonnull; + public class IconButton extends AbstractSimiWidget { private AllIcons icon; @@ -18,7 +20,7 @@ public class IconButton extends AbstractSimiWidget { } @Override - public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { + public void renderButton(@Nonnull MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { if (this.visible) { this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height; diff --git a/src/main/java/com/simibubi/create/foundation/gui/widgets/StencilWidget.java b/src/main/java/com/simibubi/create/foundation/gui/widgets/StencilWidget.java new file mode 100644 index 000000000..b58638d1e --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/gui/widgets/StencilWidget.java @@ -0,0 +1,33 @@ +package com.simibubi.create.foundation.gui.widgets; + +import javax.annotation.Nonnull; +import com.mojang.blaze3d.matrix.MatrixStack; +import com.simibubi.create.foundation.gui.StencilElement; + +public class StencilWidget extends AbstractSimiWidget { + + protected StencilElement stencilElement; + + protected StencilWidget(int x, int y, int width, int height) { + super(x, y, width, height); + } + + public StencilWidget(int x, int y, int width, int height, StencilElement stencilElement) { + super(x, y, width, height); + this.stencilElement = stencilElement; + } + + @Override + public void renderButton(@Nonnull MatrixStack ms, int mouseX, int mouseY, float partialTicks) { + ms.push(); + + ms.translate(x, y, 0); + stencilElement.render(ms); + + ms.pop(); + } + + public StencilElement getStencilElement() { + return stencilElement; + } +} diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderProgressBar.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderProgressBar.java index fc2921ef2..de60e663c 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderProgressBar.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderProgressBar.java @@ -11,6 +11,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.audio.SoundHandler; import net.minecraft.client.gui.FontRenderer; import net.minecraftforge.fml.client.gui.GuiUtils; + +import javax.annotation.Nonnull; import org.antlr.v4.runtime.misc.IntegerList; public class PonderProgressBar extends AbstractSimiWidget { @@ -103,7 +105,7 @@ public class PonderProgressBar extends AbstractSimiWidget { } @Override - public void renderButton(MatrixStack ms, int mouseX, int mouseY, float partialTicks) { + public void renderButton(@Nonnull MatrixStack ms, int mouseX, int mouseY, float partialTicks) { hovered = clicked(mouseX, mouseY); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderButton.java b/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderButton.java index deb018c6e..a5e31246c 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderButton.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/ui/PonderButton.java @@ -16,6 +16,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.settings.KeyBinding; import net.minecraft.item.ItemStack; +import javax.annotation.Nonnull; + public class PonderButton extends AbstractSimiWidget { private IScreenRenderable icon; @@ -87,7 +89,7 @@ public class PonderButton extends AbstractSimiWidget { } @Override - public void renderButton(MatrixStack ms, int mouseX, int mouseY, float partialTicks) { + public void renderButton(@Nonnull MatrixStack ms, int mouseX, int mouseY, float partialTicks) { if (!visible) return; if (fade < .1f)