diff --git a/src/main/java/com/simibubi/create/ScreenResources.java b/src/main/java/com/simibubi/create/ScreenResources.java index 8a85eb56f..6be7adbe8 100644 --- a/src/main/java/com/simibubi/create/ScreenResources.java +++ b/src/main/java/com/simibubi/create/ScreenResources.java @@ -2,6 +2,7 @@ package com.simibubi.create; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.AbstractGui; +import net.minecraft.client.gui.screen.Screen; import net.minecraft.util.ResourceLocation; public enum ScreenResources { @@ -62,13 +63,14 @@ public enum ScreenResources { SELECTED_SLOT_INNER("index.png", 18, 172, 18, 18), // JEI - CRUSHING_RECIPE("recipes1.png", 177, 109), - FAN_RECIPE("recipes1.png", 0, 128, 177, 109), - BLOCKZAPPER_UPGRADE_RECIPE("recipes2.png", 144, 66), - PRESSER_RECIPE("recipes2.png", 0, 108, 177, 109), - WASHING_RECIPE("recipes3.png", 177, 109), - PROCESSING_RECIPE_SLOT("recipes3.png", 177, 0, 20, 20), - + JEI_SLOT("jei/widgets.png", 18, 18), + JEI_ARROW("jei/widgets.png", 19, 10, 42, 10), + JEI_LONG_ARROW("jei/widgets.png", 19, 0, 71, 10), + JEI_DOWN_ARROW("jei/widgets.png", 0, 21, 18, 14), + JEI_LIGHT("jei/widgets.png", 0, 42, 52, 11), + JEI_SHADOW("jei/widgets.png", 0, 56, 52, 11), + BLOCKZAPPER_UPGRADE_RECIPE("jei/widgets.png", 0, 75, 144, 66), + // Widgets PALETTE_BUTTON("palette_picker.png", 0, 236, 20, 20), TEXT_INPUT("widgets.png", 0, 28, 194, 47), @@ -128,7 +130,7 @@ public enum ScreenResources { I_PRIORITY_VERY_HIGH(112, 0), I_ACTIVE(64, 16), I_PASSIVE(80, 16), - + ; public static final int FONT_COLOR = 0x575F7A; @@ -136,6 +138,8 @@ public enum ScreenResources { public final ResourceLocation location; public int width, height; public int startX, startY; + static Screen renderer = new Screen(null) { + }; private ScreenResources(String location, int width, int height) { this(location, 0, 0, width, height); @@ -157,9 +161,13 @@ public enum ScreenResources { Minecraft.getInstance().getTextureManager().bindTexture(location); } - public void draw(AbstractGui screen, int i, int j) { + public void draw(AbstractGui screen, int x, int y) { bind(); - screen.blit(i, j, startX, startY, width, height); + screen.blit(x, y, startX, startY, width, height); + } + + public void draw(int x, int y) { + draw(renderer, x, y); } } diff --git a/src/main/java/com/simibubi/create/compat/jei/BlastingViaFanCategory.java b/src/main/java/com/simibubi/create/compat/jei/BlastingViaFanCategory.java index d1fd3164d..41020fb84 100644 --- a/src/main/java/com/simibubi/create/compat/jei/BlastingViaFanCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/BlastingViaFanCategory.java @@ -3,7 +3,6 @@ package com.simibubi.create.compat.jei; import com.mojang.blaze3d.platform.GlStateManager; import com.simibubi.create.AllItems; import com.simibubi.create.Create; -import com.simibubi.create.ScreenResources; import com.simibubi.create.foundation.gui.ScreenElementRenderer; import com.simibubi.create.foundation.utility.Lang; @@ -46,15 +45,9 @@ public class BlastingViaFanCategory extends ProcessingViaFanCategory { private static ResourceLocation ID = new ResourceLocation(Create.ID, "crushing"); private AnimatedCrushingWheels crushingWheels = new AnimatedCrushingWheels(); private IDrawable icon; + private IDrawable background = new EmptyBackground(177, 100); public CrushingCategory() { icon = new DoubleItemIcon(() -> new ItemStack(AllBlocks.CRUSHING_WHEEL.get()), () -> new ItemStack(AllItems.FLOUR.get())); } + @Override + public IDrawable getBackground() { + return background; + } + @Override public ResourceLocation getUid() { return ID; @@ -47,11 +53,6 @@ public class CrushingCategory implements IRecipeCategory { return Lang.translate("recipe.crushing"); } - @Override - public IDrawable getBackground() { - return new ScreenResourceWrapper(ScreenResources.CRUSHING_RECIPE); - } - @Override public IDrawable getIcon() { return icon; @@ -66,12 +67,14 @@ public class CrushingCategory implements IRecipeCategory { @Override public void setRecipe(IRecipeLayout recipeLayout, CrushingRecipe recipe, IIngredients ingredients) { IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); - itemStacks.init(0, true, 60, 2); + itemStacks.init(0, true, 50, 2); itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks())); List results = recipe.getRollableResults(); - for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) { - itemStacks.init(outputIndex + 1, false, 60 + 18 * outputIndex, 78); + int size = results.size(); + int offset = -size * 19 / 2; + for (int outputIndex = 0; outputIndex < size; outputIndex++) { + itemStacks.init(outputIndex + 1, false, getBackground().getWidth() / 2 + offset + 19 * outputIndex, 78); itemStacks.set(outputIndex + 1, results.get(outputIndex).getStack()); } @@ -87,7 +90,16 @@ public class CrushingCategory implements IRecipeCategory { @Override public void draw(CrushingRecipe recipe, double mouseX, double mouseY) { - crushingWheels.draw(100, 47); + List results = recipe.getRollableResults(); + ScreenResources.JEI_SLOT.draw(50, 2); + ScreenResources.JEI_DOWN_ARROW.draw(72, 7); + + int size = results.size(); + int offset = -size * 19 / 2; + for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) + ScreenResources.JEI_SLOT.draw(getBackground().getWidth() / 2 + offset + 19 * outputIndex, 78); + + crushingWheels.draw(92, 49); } } diff --git a/src/main/java/com/simibubi/create/compat/jei/EmptyBackground.java b/src/main/java/com/simibubi/create/compat/jei/EmptyBackground.java new file mode 100644 index 000000000..38cac2394 --- /dev/null +++ b/src/main/java/com/simibubi/create/compat/jei/EmptyBackground.java @@ -0,0 +1,29 @@ +package com.simibubi.create.compat.jei; + +import mezz.jei.api.gui.drawable.IDrawable; + +public class EmptyBackground implements IDrawable { + + private int width; + private int height; + + public EmptyBackground(int width, int height) { + this.width = width; + this.height = height; + } + + @Override + public int getWidth() { + return width; + } + + @Override + public int getHeight() { + return height; + } + + @Override + public void draw(int xOffset, int yOffset) { + } + +} diff --git a/src/main/java/com/simibubi/create/compat/jei/PressingCategory.java b/src/main/java/com/simibubi/create/compat/jei/PressingCategory.java index c7490b8d7..8ec9aa309 100644 --- a/src/main/java/com/simibubi/create/compat/jei/PressingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/PressingCategory.java @@ -25,6 +25,7 @@ public class PressingCategory implements IRecipeCategory { private AnimatedPress press; private static ResourceLocation ID = new ResourceLocation(Create.ID, "pressing"); private IDrawable icon; + private IDrawable background = new EmptyBackground(177, 70); public PressingCategory() { icon = new DoubleItemIcon(() -> new ItemStack(AllBlocks.MECHANICAL_PRESS.get()), @@ -54,7 +55,7 @@ public class PressingCategory implements IRecipeCategory { @Override public IDrawable getBackground() { - return new ScreenResourceWrapper(ScreenResources.PRESSER_RECIPE); + return background; } @Override @@ -66,20 +67,24 @@ public class PressingCategory implements IRecipeCategory { @Override public void setRecipe(IRecipeLayout recipeLayout, PressingRecipe recipe, IIngredients ingredients) { IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); - itemStacks.init(0, true, 27, 60); + itemStacks.init(0, true, 26, 50); itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks())); List results = recipe.getRollableResults(); for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) { - itemStacks.init(outputIndex + 1, false, 113 + 19 * outputIndex, 60); + itemStacks.init(outputIndex + 1, false, 131 + 19 * outputIndex, 50); itemStacks.set(outputIndex + 1, results.get(outputIndex).getStack()); } } - + @Override public void draw(PressingRecipe recipe, double mouseX, double mouseY) { - press.draw(ScreenResources.PRESSER_RECIPE.width / 2, 30); - + ScreenResources.JEI_SLOT.draw(26, 50); + ScreenResources.JEI_SLOT.draw(131, 50); + if (recipe.getRollableResults().size() > 1) + ScreenResources.JEI_SLOT.draw(131 + 19, 50); + ScreenResources.JEI_LONG_ARROW.draw(52, 54); + press.draw(getBackground().getWidth() / 2, 20); } } diff --git a/src/main/java/com/simibubi/create/compat/jei/ProcessingViaFanCategory.java b/src/main/java/com/simibubi/create/compat/jei/ProcessingViaFanCategory.java index 428040eec..a4e90a3bd 100644 --- a/src/main/java/com/simibubi/create/compat/jei/ProcessingViaFanCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/ProcessingViaFanCategory.java @@ -20,9 +20,11 @@ import net.minecraft.util.Direction; public abstract class ProcessingViaFanCategory> implements IRecipeCategory { + private IDrawable background = new EmptyBackground(177, 70); + @Override public IDrawable getBackground() { - return new ScreenResourceWrapper(ScreenResources.FAN_RECIPE); + return background; } @Override @@ -34,20 +36,30 @@ public abstract class ProcessingViaFanCategory> implements @Override public void setRecipe(IRecipeLayout recipeLayout, T recipe, IIngredients ingredients) { IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); - itemStacks.init(0, true, 20, 67); + itemStacks.init(0, true, 20, 47); itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks())); - itemStacks.init(1, false, 139, 67); + itemStacks.init(1, false, 139, 47); itemStacks.set(1, recipe.getRecipeOutput()); } + protected void renderWidgets(T recipe, double mouseX, double mouseY) { + ScreenResources.JEI_SLOT.draw(20, 47); + ScreenResources.JEI_SLOT.draw(139, 47); + ScreenResources.JEI_SHADOW.draw(47, 29); + ScreenResources.JEI_LIGHT.draw(66, 39); + ScreenResources.JEI_LONG_ARROW.draw(53, 51); + } + @Override public void draw(T recipe, double mouseX, double mouseY) { + renderWidgets(recipe, mouseX, mouseY); + GlStateManager.pushMatrix(); GlStateManager.color3f(1, 1, 1); GlStateManager.enableDepthTest(); - GlStateManager.translated(28, 42, 0); + GlStateManager.translated(28, 18, 0); GlStateManager.rotated(10.5, -1f, 0, 0); GlStateManager.rotated(15.5, 0, 1, 0); GlStateManager.scaled(.6f, .6f, .6f); @@ -71,12 +83,10 @@ public abstract class ProcessingViaFanCategory> implements } protected BlockState renderFanCasing() { - return AllBlocks.ENCASED_FAN.get().getDefaultState().with(BlockStateProperties.FACING, Direction.WEST); } protected BlockState renderFanInner() { - return AllBlocks.ENCASED_FAN_INNER.get().getDefaultState().with(BlockStateProperties.FACING, Direction.WEST); } diff --git a/src/main/java/com/simibubi/create/compat/jei/SplashingCategory.java b/src/main/java/com/simibubi/create/compat/jei/SplashingCategory.java index 746e95984..e9a600e2f 100644 --- a/src/main/java/com/simibubi/create/compat/jei/SplashingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/SplashingCategory.java @@ -29,14 +29,18 @@ public class SplashingCategory extends ProcessingViaFanCategory private static ResourceLocation ID = new ResourceLocation(Create.ID, "splashing"); private IDrawable icon; - private IDrawable slot; + private IDrawable background = new EmptyBackground(177, 70); public SplashingCategory() { - slot = new ScreenResourceWrapper(ScreenResources.PROCESSING_RECIPE_SLOT); icon = new DoubleItemIcon(() -> new ItemStack(AllItems.PROPELLER.get()), () -> new ItemStack(Items.WATER_BUCKET)); } + @Override + public IDrawable getBackground() { + return background; + } + @Override public IDrawable getIcon() { return icon; @@ -66,15 +70,16 @@ public class SplashingCategory extends ProcessingViaFanCategory @Override public void setRecipe(IRecipeLayout recipeLayout, SplashingRecipe recipe, IIngredients ingredients) { IGuiItemStackGroup itemStacks = recipeLayout.getItemStacks(); - itemStacks.init(0, true, 20, 67); + itemStacks.init(0, true, 20, 47); itemStacks.set(0, Arrays.asList(recipe.getIngredients().get(0).getMatchingStacks())); List results = recipe.getRollableResults(); + boolean single = results.size() == 1; for (int outputIndex = 0; outputIndex < results.size(); outputIndex++) { int xOffset = outputIndex % 2 == 0 ? 0 : 19; int yOffset = (outputIndex / 2) * -19; - itemStacks.init(outputIndex + 1, false, 132 + xOffset, 77 + yOffset); + itemStacks.init(outputIndex + 1, false, single ? 139 : 133 + xOffset, 47 + yOffset); itemStacks.set(outputIndex + 1, results.get(outputIndex).getStack()); } @@ -89,25 +94,28 @@ public class SplashingCategory extends ProcessingViaFanCategory } @Override - public IDrawable getBackground() { - return new ScreenResourceWrapper(ScreenResources.WASHING_RECIPE); - } - - @Override - public void draw(SplashingRecipe recipe, double mouseX, double mouseY) { - super.draw(recipe, mouseX, mouseY); + protected void renderWidgets(SplashingRecipe recipe, double mouseX, double mouseY) { int size = recipe.getPossibleOutputs().size(); - for (int i = 4; i < size; i++) { - int xOffset = i % 2 == 0 ? 0 : 19; - int yOffset = (i / 2) * -19; - slot.draw(131 + xOffset, 76 + yOffset); + + ScreenResources.JEI_SLOT.draw(20, 47); + ScreenResources.JEI_SHADOW.draw(47, 29); + ScreenResources.JEI_SHADOW.draw(66, 39); + ScreenResources.JEI_LONG_ARROW.draw(53, 51); + + if (size > 1) { + for (int i = 0; i < size; i++) { + int xOffset = i % 2 == 0 ? 0 : 19; + int yOffset = (i / 2) * -19; + ScreenResources.JEI_SLOT.draw(133 + xOffset, 47 + yOffset); + } + } else { + ScreenResources.JEI_SLOT.draw(139, 47); } } @Override public void renderAttachedBlock() { BlockState state = Blocks.WATER.getDefaultState().with(FlowingFluidBlock.LEVEL, 8); - // This is stupid GlStateManager.pushMatrix(); GlStateManager.translated(0, 0, 200); diff --git a/src/main/resources/assets/create/textures/gui/jei/widgets.png b/src/main/resources/assets/create/textures/gui/jei/widgets.png new file mode 100644 index 000000000..42050a1b7 Binary files /dev/null and b/src/main/resources/assets/create/textures/gui/jei/widgets.png differ diff --git a/src/main/resources/assets/create/textures/gui/recipes1.png b/src/main/resources/assets/create/textures/gui/recipes1.png deleted file mode 100644 index 49228f8aa..000000000 Binary files a/src/main/resources/assets/create/textures/gui/recipes1.png and /dev/null differ diff --git a/src/main/resources/assets/create/textures/gui/recipes2.png b/src/main/resources/assets/create/textures/gui/recipes2.png deleted file mode 100644 index a6eddc19f..000000000 Binary files a/src/main/resources/assets/create/textures/gui/recipes2.png and /dev/null differ diff --git a/src/main/resources/assets/create/textures/gui/recipes3.png b/src/main/resources/assets/create/textures/gui/recipes3.png deleted file mode 100644 index 2012b71db..000000000 Binary files a/src/main/resources/assets/create/textures/gui/recipes3.png and /dev/null differ