Skip to content

Commit 55b258f

Browse files
committed
Add more helpers for drawing common recipe elements
1 parent be35470 commit 55b258f

34 files changed

+387
-147
lines changed

Common/src/main/java/mezz/jei/common/Constants.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55
import net.minecraft.resources.ResourceLocation;
66

77
public final class Constants {
8-
public static final String TEXTURE_GUI_PATH = "textures/jei/gui/";
9-
public static final String TEXTURE_GUI_VANILLA = Constants.TEXTURE_GUI_PATH + "gui_vanilla.png";
10-
11-
public static final ResourceLocation RECIPE_GUI_VANILLA = ResourceLocation.fromNamespaceAndPath(ModIds.JEI_ID, TEXTURE_GUI_VANILLA);
12-
138
public static final RecipeType<?> UNIVERSAL_RECIPE_TRANSFER_TYPE = RecipeType.create(ModIds.JEI_ID, "universal_recipe_transfer_handler", Object.class);
149
public static final ResourceLocation LOCATION_JEI_GUI_TEXTURE_ATLAS = ResourceLocation.fromNamespaceAndPath(ModIds.JEI_ID, "textures/atlas/gui.png");
1510

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package mezz.jei.common.gui.elements;
2+
3+
import mezz.jei.api.gui.drawable.IDrawableStatic;
4+
import mezz.jei.api.helpers.IGuiHelper;
5+
import net.minecraft.client.gui.GuiGraphics;
6+
7+
public class DrawableAnimatedRecipeArrow extends DrawableAnimated {
8+
private final IDrawableStatic blankArrow;
9+
10+
public DrawableAnimatedRecipeArrow(IGuiHelper guiHelper, int ticksPerCycle) {
11+
super(guiHelper.getRecipeArrowFilled(), ticksPerCycle, StartDirection.LEFT, false);
12+
this.blankArrow = guiHelper.getRecipeArrow();
13+
}
14+
15+
@Override
16+
public void draw(GuiGraphics guiGraphics, int xOffset, int yOffset) {
17+
this.blankArrow.draw(guiGraphics, xOffset, yOffset);
18+
super.draw(guiGraphics, xOffset, yOffset);
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package mezz.jei.common.gui.elements;
2+
3+
import mezz.jei.api.gui.drawable.IDrawableStatic;
4+
import mezz.jei.api.helpers.IGuiHelper;
5+
import net.minecraft.client.gui.GuiGraphics;
6+
7+
public class DrawableAnimatedRecipeFlame extends DrawableAnimated {
8+
private final IDrawableStatic emptyFlame;
9+
10+
public DrawableAnimatedRecipeFlame(IGuiHelper guiHelper, int ticksPerCycle) {
11+
super(guiHelper.getRecipeFlameFilled(), ticksPerCycle, StartDirection.TOP, true);
12+
this.emptyFlame = guiHelper.getRecipeFlameEmpty();
13+
}
14+
15+
@Override
16+
public void draw(GuiGraphics guiGraphics, int xOffset, int yOffset) {
17+
this.emptyFlame.draw(guiGraphics, xOffset, yOffset);
18+
super.draw(guiGraphics, xOffset, yOffset);
19+
}
20+
}

Common/src/main/java/mezz/jei/common/gui/textures/Textures.java

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public class Textures {
1212
private final JeiSpriteUploader spriteUploader;
1313

1414
private final IDrawableStatic slot;
15+
private final IDrawableStatic outputSlot;
1516
private final DrawableNineSliceTexture recipeCatalystSlotBackground;
1617
private final DrawableNineSliceTexture ingredientListSlotBackground;
1718
private final DrawableNineSliceTexture bookmarkListSlotBackground;
@@ -44,14 +45,23 @@ public class Textures {
4445
private final DrawableNineSliceTexture catalystTab;
4546
private final DrawableNineSliceTexture recipeOptionsTab;
4647
private final IDrawableStatic flameIcon;
48+
private final IDrawableStatic flameEmptyIcon;
4749
private final IDrawableStatic recipeArrow;
50+
private final IDrawableStatic recipeArrowFilled;
51+
private final IDrawableStatic recipePlusSign;
4852
private final IDrawableStatic bookmarksFirst;
4953
private final IDrawableStatic craftableFirst;
5054

55+
private final IDrawableStatic brewingStandBackground;
56+
private final IDrawableStatic brewingStandBlazeHeat;
57+
private final IDrawableStatic brewingStandBubbles;
58+
private final IDrawableStatic brewingStandArrow;
59+
5160
public Textures(JeiSpriteUploader spriteUploader) {
5261
this.spriteUploader = spriteUploader;
5362

5463
this.slot = createGuiSprite("slot", 18, 18);
64+
this.outputSlot = createGuiSprite("output_slot", 26, 26);
5565
this.recipeCatalystSlotBackground = createNineSliceGuiSprite("recipe_catalyst_slot_background", 18, 18, 4, 4, 4, 4);
5666
this.ingredientListSlotBackground = createNineSliceGuiSprite("ingredient_list_slot_background", 18, 18, 4, 4, 4, 4);
5767
this.bookmarkListSlotBackground = createNineSliceGuiSprite("bookmark_list_slot_background", 18, 18, 4, 4, 4, 4);
@@ -72,7 +82,14 @@ public Textures(JeiSpriteUploader spriteUploader) {
7282
this.scrollbarMarker = createNineSliceGuiSprite("scrollbar_marker", 12, 15, 2, 2, 2, 1);
7383
this.catalystTab = createNineSliceGuiSprite("catalyst_tab", 28, 28, 8, 9, 8, 8);
7484
this.recipeOptionsTab = createNineSliceGuiSprite("recipe_options_tab", 28, 28, 8, 9, 8, 8);
75-
this.recipeArrow = createGuiSprite("recipe_arrow", 22, 15);
85+
this.recipeArrow = createGuiSprite("recipe_arrow", 22, 16);
86+
this.recipeArrowFilled = createGuiSprite("recipe_arrow_filled", 22, 16);
87+
this.recipePlusSign = createGuiSprite("recipe_plus_sign", 13, 13);
88+
89+
this.brewingStandBackground = createGuiSprite("brewing_stand_background", 64, 60);
90+
this.brewingStandBlazeHeat = createGuiSprite("brewing_stand_blaze_heat", 18, 4);
91+
this.brewingStandBubbles = createGuiSprite("brewing_stand_bubbles", 11, 28);
92+
this.brewingStandArrow = createGuiSprite("brewing_stand_arrow", 7, 27);
7693

7794
DrawableSprite rawShapelessIcon = createGuiSprite("icons/shapeless_icon", 36, 36)
7895
.trim(1, 2, 1, 1);
@@ -90,6 +107,7 @@ public Textures(JeiSpriteUploader spriteUploader) {
90107
this.bookmarkButtonEnabledIcon = createGuiSprite("icons/bookmark_button_enabled", 16, 16);
91108
this.infoIcon = createGuiSprite("icons/info", 16, 16);
92109
this.flameIcon = createGuiSprite("icons/flame", 14, 14);
110+
this.flameEmptyIcon = createGuiSprite("icons/flame_empty", 14, 14);
93111
this.bookmarksFirst = createGuiSprite("icons/bookmarks_first", 16, 16);
94112
this.craftableFirst = createGuiSprite("icons/craftable_first", 16, 16);
95113
}
@@ -108,10 +126,14 @@ private DrawableNineSliceTexture createNineSliceGuiSprite(String name, int width
108126
return new DrawableNineSliceTexture(spriteUploader, location, width, height, left, right, top, bottom);
109127
}
110128

111-
public IDrawableStatic getSlotDrawable() {
129+
public IDrawableStatic getSlot() {
112130
return slot;
113131
}
114132

133+
public IDrawableStatic getOutputSlot() {
134+
return outputSlot;
135+
}
136+
115137
public IDrawableStatic getTabSelected() {
116138
return tabSelected;
117139
}
@@ -216,6 +238,14 @@ public IDrawableStatic getRecipeArrow() {
216238
return recipeArrow;
217239
}
218240

241+
public IDrawableStatic getRecipeArrowFilled() {
242+
return recipeArrowFilled;
243+
}
244+
245+
public IDrawableStatic getRecipePlusSign() {
246+
return recipePlusSign;
247+
}
248+
219249
public DrawableNineSliceTexture getRecipeCatalystSlotBackground() {
220250
return recipeCatalystSlotBackground;
221251
}
@@ -232,6 +262,10 @@ public IDrawableStatic getFlameIcon() {
232262
return flameIcon;
233263
}
234264

265+
public IDrawableStatic getFlameEmptyIcon() {
266+
return flameEmptyIcon;
267+
}
268+
235269
public DrawableNineSliceTexture getScrollbarMarker() {
236270
return scrollbarMarker;
237271
}
@@ -240,6 +274,22 @@ public DrawableNineSliceTexture getScrollbarBackground() {
240274
return scrollbarBackground;
241275
}
242276

277+
public IDrawableStatic getBrewingStandBackground() {
278+
return brewingStandBackground;
279+
}
280+
281+
public IDrawableStatic getBrewingStandBlazeHeat() {
282+
return brewingStandBlazeHeat;
283+
}
284+
285+
public IDrawableStatic getBrewingStandBubbles() {
286+
return brewingStandBubbles;
287+
}
288+
289+
public IDrawableStatic getBrewingStandArrow() {
290+
return brewingStandArrow;
291+
}
292+
243293
public JeiSpriteUploader getSpriteUploader() {
244294
return spriteUploader;
245295
}
118 Bytes
Loading
407 Bytes
Loading
166 Bytes
Loading
161 Bytes
Loading
179 Bytes
Loading
133 Bytes
Loading

0 commit comments

Comments
 (0)