diff options
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java index 0229e4ef4..84df02552 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java @@ -2,7 +2,7 @@ package me.shedaniel.rei.gui.widget; import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.Drawable; +import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.render.GuiLighting; import net.minecraft.util.Identifier; import net.minecraft.util.math.MathHelper; @@ -11,9 +11,10 @@ import java.awt.*; import java.util.ArrayList; import java.util.List; -public class RecipeBaseWidget extends Drawable implements IWidget { +public class RecipeBaseWidget extends DrawableHelper implements HighlightableWidget { private static final Identifier CHEST_GUI_TEXTURE = new Identifier("roughlyenoughitems", "textures/gui/recipecontainer.png"); + private static final Color INNER_COLOR = new Color(198, 198, 198); private Rectangle bounds; @@ -22,12 +23,17 @@ public class RecipeBaseWidget extends Drawable implements IWidget { } @Override + public Rectangle getBounds() { + return bounds; + } + + @Override public List<IWidget> getListeners() { return new ArrayList<>(); } @Override - public void draw(int mouseX, int mouseY, float partialTicks) { + public void draw(int mouseX, int mouseY, float delta) { GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); GuiLighting.disable(); MinecraftClient.getInstance().getTextureManager().bindTexture(CHEST_GUI_TEXTURE); @@ -41,6 +47,15 @@ public class RecipeBaseWidget extends Drawable implements IWidget { drawTexturedRect(bounds.x, bounds.y + i, 106, 230, bounds.width / 2, height); drawTexturedRect(bounds.x + bounds.width / 2, bounds.y + i, 256 - bounds.width / 2, 210, bounds.width / 2, height); } + if (bounds.width > 40) + for(int i = 20; i < bounds.width - 20; i += MathHelper.clamp(40, 0, bounds.width - 20 - i)) { + int width = MathHelper.clamp(40, 0, bounds.width - 20 - i); + GlStateManager.color4f(1.0F, 1.0F, 1.0F, 1.0F); + GuiLighting.disable(); + drawTexturedRect(bounds.x + i, bounds.y, 113, 190, width, MathHelper.clamp(4, 0, bounds.height / 2)); + drawTexturedRect(bounds.x + i, bounds.y + bounds.height - 4, 113, 252, width, MathHelper.clamp(4, 0, bounds.height / 2)); + DrawableHelper.drawRect(bounds.x + i, bounds.y + 4, bounds.x + i + width, bounds.y + bounds.height - 4, INNER_COLOR.getRGB()); + } } } |
