Skip to content

Commit 58fef1d

Browse files
committed
Add more helpers for drawing common recipe elements
1 parent 703632d commit 58fef1d

37 files changed

+430
-173
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
@@ -6,11 +6,6 @@
66
import mezz.jei.api.constants.ModIds;
77

88
public final class Constants {
9-
public static final String TEXTURE_GUI_PATH = "textures/jei/gui/";
10-
public static final String TEXTURE_GUI_VANILLA = Constants.TEXTURE_GUI_PATH + "gui_vanilla.png";
11-
12-
public static final ResourceLocation RECIPE_GUI_VANILLA = new ResourceLocation(ModIds.JEI_ID, TEXTURE_GUI_VANILLA);
13-
149
public static final RecipeType<?> UNIVERSAL_RECIPE_TRANSFER_TYPE = RecipeType.create(ModIds.JEI_ID, "universal_recipe_transfer_handler", Object.class);
1510
public static final ResourceLocation LOCATION_JEI_GUI_TEXTURE_ATLAS = new ResourceLocation(ModIds.JEI_ID, "textures/atlas/gui.png");
1611
public static final ResourceLocation NETWORK_CHANNEL_ID = new ResourceLocation(ModIds.JEI_ID, "channel");
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: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
package mezz.jei.common.gui.textures;
22

3-
import mezz.jei.api.gui.drawable.IDrawable;
4-
import mezz.jei.common.gui.elements.HighResolutionDrawable;
5-
import net.minecraft.resources.ResourceLocation;
6-
73
import mezz.jei.api.constants.ModIds;
4+
import mezz.jei.api.gui.drawable.IDrawable;
85
import mezz.jei.api.gui.drawable.IDrawableStatic;
96
import mezz.jei.common.gui.elements.DrawableNineSliceTexture;
107
import mezz.jei.common.gui.elements.DrawableSprite;
8+
import mezz.jei.common.gui.elements.HighResolutionDrawable;
9+
import net.minecraft.resources.ResourceLocation;
1110

1211
public class Textures {
1312
private final JeiSpriteUploader spriteUploader;
1413

1514
private final IDrawableStatic slot;
15+
private final IDrawableStatic outputSlot;
1616
private final DrawableNineSliceTexture recipeCatalystSlotBackground;
1717
private final DrawableNineSliceTexture ingredientListSlotBackground;
1818
private final DrawableNineSliceTexture bookmarkListSlotBackground;
@@ -45,14 +45,23 @@ public class Textures {
4545
private final DrawableNineSliceTexture catalystTab;
4646
private final DrawableNineSliceTexture recipeOptionsTab;
4747
private final IDrawableStatic flameIcon;
48+
private final IDrawableStatic flameEmptyIcon;
4849
private final IDrawableStatic recipeArrow;
50+
private final IDrawableStatic recipeArrowFilled;
51+
private final IDrawableStatic recipePlusSign;
4952
private final IDrawableStatic bookmarksFirst;
5053
private final IDrawableStatic craftableFirst;
5154

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

5563
this.slot = createGuiSprite("slot", 18, 18);
64+
this.outputSlot = createGuiSprite("output_slot", 26, 26);
5665
this.recipeCatalystSlotBackground = createNineSliceGuiSprite("recipe_catalyst_slot_background", 18, 18, 4, 4, 4, 4);
5766
this.ingredientListSlotBackground = createNineSliceGuiSprite("ingredient_list_slot_background", 18, 18, 4, 4, 4, 4);
5867
this.bookmarkListSlotBackground = createNineSliceGuiSprite("bookmark_list_slot_background", 18, 18, 4, 4, 4, 4);
@@ -73,7 +82,14 @@ public Textures(JeiSpriteUploader spriteUploader) {
7382
this.scrollbarMarker = createNineSliceGuiSprite("scrollbar_marker", 12, 15, 2, 2, 2, 1);
7483
this.catalystTab = createNineSliceGuiSprite("catalyst_tab", 28, 28, 8, 9, 8, 8);
7584
this.recipeOptionsTab = createNineSliceGuiSprite("recipe_options_tab", 28, 28, 8, 9, 8, 8);
76-
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);
7793

7894
DrawableSprite rawShapelessIcon = createGuiSprite("icons/shapeless_icon", 36, 36)
7995
.trim(1, 2, 1, 1);
@@ -91,6 +107,7 @@ public Textures(JeiSpriteUploader spriteUploader) {
91107
this.bookmarkButtonEnabledIcon = createGuiSprite("icons/bookmark_button_enabled", 16, 16);
92108
this.infoIcon = createGuiSprite("icons/info", 16, 16);
93109
this.flameIcon = createGuiSprite("icons/flame", 14, 14);
110+
this.flameEmptyIcon = createGuiSprite("icons/flame_empty", 14, 14);
94111
this.bookmarksFirst = createGuiSprite("icons/bookmarks_first", 16, 16);
95112
this.craftableFirst = createGuiSprite("icons/craftable_first", 16, 16);
96113
}
@@ -109,10 +126,14 @@ private DrawableNineSliceTexture createNineSliceGuiSprite(String name, int width
109126
return new DrawableNineSliceTexture(spriteUploader, location, width, height, left, right, top, bottom);
110127
}
111128

112-
public IDrawableStatic getSlotDrawable() {
129+
public IDrawableStatic getSlot() {
113130
return slot;
114131
}
115132

133+
public IDrawableStatic getOutputSlot() {
134+
return outputSlot;
135+
}
136+
116137
public IDrawableStatic getTabSelected() {
117138
return tabSelected;
118139
}
@@ -213,6 +234,14 @@ public IDrawableStatic getRecipeArrow() {
213234
return recipeArrow;
214235
}
215236

237+
public IDrawableStatic getRecipeArrowFilled() {
238+
return recipeArrowFilled;
239+
}
240+
241+
public IDrawableStatic getRecipePlusSign() {
242+
return recipePlusSign;
243+
}
244+
216245
public DrawableNineSliceTexture getRecipeCatalystSlotBackground() {
217246
return recipeCatalystSlotBackground;
218247
}
@@ -229,6 +258,10 @@ public IDrawableStatic getFlameIcon() {
229258
return flameIcon;
230259
}
231260

261+
public IDrawableStatic getFlameEmptyIcon() {
262+
return flameEmptyIcon;
263+
}
264+
232265
public IDrawable getRecipeBookmark() {
233266
return recipeBookmark;
234267
}
@@ -241,6 +274,22 @@ public DrawableNineSliceTexture getScrollbarBackground() {
241274
return scrollbarBackground;
242275
}
243276

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+
244293
public JeiSpriteUploader getSpriteUploader() {
245294
return spriteUploader;
246295
}
118 Bytes
Loading
407 Bytes
Loading
166 Bytes
Loading
161 Bytes
Loading
179 Bytes
Loading
133 Bytes
Loading

0 commit comments

Comments
 (0)