Skip to content

Commit a4bf629

Browse files
committed
Thanks elucent, new fancy sprites :D
1 parent f7c20f8 commit a4bf629

5 files changed

Lines changed: 81 additions & 19 deletions

File tree

assets/jei-sprites.png

2 KB
Loading

src/main/java/com/robotgryphon/compactcrafting/compat/jei/JeiMiniaturizationCraftingCategory.java

Lines changed: 67 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ public class JeiMiniaturizationCraftingCategory implements IRecipeCategory<Minia
5151
private int singleLayerOffset = 0;
5252
private boolean debugMode = false;
5353

54-
private Rectangle explodeToggle = new Rectangle(0, 0, 10, 10);
55-
private Rectangle layerUp = new Rectangle(0, 12, 10, 10);
56-
private Rectangle layerSwap = new Rectangle(0, 23, 10, 10);
57-
private Rectangle layerDown = new Rectangle(0, 34, 10, 10);
54+
private Rectangle explodeToggle = new Rectangle(0, 0, 20, 20);
55+
private Rectangle layerUp = new Rectangle(0, 32, 20, 20);
56+
private Rectangle layerSwap = new Rectangle(0, 52, 20, 20);
57+
private Rectangle layerDown = new Rectangle(0, 72, 20, 20);
5858

5959
/**
6060
* Whether or not the preview is exploded (expanded) or not.
@@ -123,7 +123,6 @@ public void setIngredients(MiniaturizationRecipe recipe, IIngredients ing) {
123123

124124
@Override
125125
public void setRecipe(IRecipeLayout recipeLayout, MiniaturizationRecipe recipe, IIngredients iIngredients) {
126-
127126
singleLayer = false;
128127
singleLayerOffset = 0;
129128

@@ -249,23 +248,70 @@ public void draw(MiniaturizationRecipe recipe, MatrixStack mx, double mouseX, do
249248
AxisAlignedBB dims = recipe.getDimensions();
250249

251250
//region JEI controls
252-
IDrawableStatic jei = guiHelper
251+
IDrawableStatic button;
252+
if(exploded) {
253+
button = guiHelper
254+
.drawableBuilder(
255+
new ResourceLocation(CompactCrafting.MOD_ID, "textures/gui/jei-sprites.png"),
256+
20, 0,
257+
20, 20
258+
).setTextureSize(120, 20).build();
259+
} else {
260+
button = guiHelper
261+
.drawableBuilder(
262+
new ResourceLocation(CompactCrafting.MOD_ID, "textures/gui/jei-sprites.png"),
263+
0, 0,
264+
20, 20
265+
).setTextureSize(120, 20).build();
266+
}
267+
268+
IDrawableStatic layerUp = guiHelper
269+
.drawableBuilder(
270+
new ResourceLocation(CompactCrafting.MOD_ID, "textures/gui/jei-sprites.png"),
271+
80, 20,
272+
20, 20
273+
).setTextureSize(120, 20).build();
274+
275+
IDrawableStatic layerMode;
276+
if(singleLayer) {
277+
layerMode =guiHelper
278+
.drawableBuilder(
279+
new ResourceLocation(CompactCrafting.MOD_ID, "textures/gui/jei-sprites.png"),
280+
60, 20,
281+
20, 20
282+
).setTextureSize(120, 20).build();
283+
} else {
284+
layerMode = guiHelper
253285
.drawableBuilder(
254-
new ResourceLocation(CompactCrafting.MOD_ID, "textures/nope.png"),
255-
0, 0,
256-
10, 10
257-
).setTextureSize(16, 16).build();
286+
new ResourceLocation(CompactCrafting.MOD_ID, "textures/gui/jei-sprites.png"),
287+
40, 20,
288+
20, 20
289+
).setTextureSize(120, 20).build();
290+
}
291+
292+
IDrawableStatic lDown = guiHelper
293+
.drawableBuilder(
294+
new ResourceLocation(CompactCrafting.MOD_ID, "textures/gui/jei-sprites.png"),
295+
100, 20,
296+
20, 20
297+
).setTextureSize(120, 20).build();
258298

259-
jei.draw(mx, explodeToggle.x, explodeToggle.y);
299+
mx.push();
260300

261-
jei.draw(mx, layerSwap.x, layerSwap.y);
301+
button.draw(mx, explodeToggle.x, explodeToggle.y);
302+
303+
layerMode.draw(mx, layerSwap.x, layerSwap.y);
262304
if (singleLayer) {
263305
if (singleLayerOffset < dims.getYSize() - 1)
264-
jei.draw(mx, layerUp.x, layerUp.y);
306+
layerUp.draw(mx, this.layerUp.x, this.layerUp.y);
265307

266-
if (singleLayerOffset > 0)
267-
jei.draw(mx, layerDown.x, layerDown.y);
308+
if (singleLayerOffset > 0) {
309+
lDown.draw(mx, layerDown.x, layerDown.y);
310+
}
268311
}
312+
313+
mx.pop();
314+
269315
//endregion
270316

271317
try {
@@ -304,6 +350,12 @@ public void draw(MiniaturizationRecipe recipe, MatrixStack mx, double mouseX, do
304350
-(dims.getZSize() / 2) * explodeMulti - 0.5
305351
);
306352

353+
// ZORN NO
354+
//if(exploded) {
355+
// float s = 1 / (float) explodeMulti;
356+
// mx.scale(s, s, s);
357+
//}
358+
307359
for (int y : renderLayers) {
308360
Optional<IRecipeLayer> layer = recipe.getLayer(y);
309361
layer.ifPresent(l -> renderRecipeLayer(recipe, mx, buffers, l, y));

src/main/java/com/robotgryphon/compactcrafting/compat/jei/JeiMiniaturizationPlugin.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
package com.robotgryphon.compactcrafting.compat.jei;
22

33
import com.robotgryphon.compactcrafting.CompactCrafting;
4+
import com.robotgryphon.compactcrafting.core.Registration;
45
import com.robotgryphon.compactcrafting.recipes.MiniaturizationRecipe;
56
import com.robotgryphon.compactcrafting.recipes.MiniaturizationRecipeManager;
67
import mezz.jei.api.IModPlugin;
78
import mezz.jei.api.JeiPlugin;
89
import mezz.jei.api.registration.IGuiHandlerRegistration;
10+
import mezz.jei.api.registration.IRecipeCatalystRegistration;
911
import mezz.jei.api.registration.IRecipeCategoryRegistration;
1012
import mezz.jei.api.registration.IRecipeRegistration;
13+
import net.minecraft.item.ItemStack;
1114
import net.minecraft.util.ResourceLocation;
1215

1316
import java.util.Collection;
@@ -26,6 +29,13 @@ public void registerCategories(IRecipeCategoryRegistration registration) {
2629

2730
@Override
2831
public void registerGuiHandlers(IGuiHandlerRegistration registration) {
32+
}
33+
34+
@Override
35+
public void registerRecipeCatalysts(IRecipeCatalystRegistration registration) {
36+
registration.addRecipeCatalyst(
37+
new ItemStack(Registration.FIELD_PROJECTOR_ITEM.get(), 4),
38+
JeiMiniaturizationCraftingCategory.UID);
2939

3040
}
3141

src/main/java/com/robotgryphon/compactcrafting/recipes/json/MiniaturizationPatternLoader.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,7 @@
1616
import net.minecraft.util.ResourceLocation;
1717
import net.minecraft.util.math.AxisAlignedBB;
1818

19-
import java.util.Arrays;
20-
import java.util.Collections;
21-
import java.util.Map;
22-
import java.util.Optional;
19+
import java.util.*;
2320

2421
public class MiniaturizationPatternLoader extends JsonReloadListener {
2522
public MiniaturizationPatternLoader() {
@@ -66,6 +63,9 @@ protected void apply(Map<ResourceLocation, JsonElement> objectIn, IResourceManag
6663

6764
MiniaturizationRecipeManager.add(rl, recipe);
6865
}
66+
67+
Collection<MiniaturizationRecipe> loaded = MiniaturizationRecipeManager.getAll();
68+
CompactCrafting.LOGGER.info("Done reloading data; got {} recipes.", loaded.size());
6969
}
7070

7171
private boolean loadOutputs(MiniaturizationRecipe recipe, JsonObject root) {
2 KB
Loading

0 commit comments

Comments
 (0)