aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java
diff options
context:
space:
mode:
authorDaniel She <shekwancheung0528@gmail.com>2019-02-25 21:18:26 +0800
committerGitHub <noreply@github.com>2019-02-25 21:18:26 +0800
commit9e55b44b710f38c63a4bfd17d0b07318d5c68535 (patch)
treea2cc0c519b4327028d7b8f544ba5171fff2d8dc1 /src/main/java/me/shedaniel/rei/gui/widget/RecipeBaseWidget.java
parentb7e018527db2e9cae2db4226f6af9fc34054c964 (diff)
downloadRoughlyEnoughItems-9e55b44b710f38c63a4bfd17d0b07318d5c68535.tar.gz
RoughlyEnoughItems-9e55b44b710f38c63a4bfd17d0b07318d5c68535.tar.bz2
RoughlyEnoughItems-9e55b44b710f38c63a4bfd17d0b07318d5c68535.zip
REI v2.3.1 (#40)
- API Changes - Updated Config Screen - Added Tipped Arrows Recipes - Updated Mappings - Added IRecipeHelper - Turning things to Optional - Removed Cheats button, now included with the new config button - Buttons for switching gamemodes / time / weather (default: off) [Maybe not in this update] - Clickable Labels - 3+ recipes at the same time - Fixed RecipeBaseWidget bad rendering when too big - Fixed #42 Patched up item deleting & cheating - Choose Page Dialog
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.java21
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());
+ }
}
}