Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/main/java/gregtech/api/recipes/RecipeMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import gregtech.api.gui.widgets.SlotWidget;
import gregtech.api.gui.widgets.TankWidget;
import gregtech.api.recipes.builders.IntCircuitRecipeBuilder;
import gregtech.api.recipes.builders.SimpleRecipeBuilder;
import gregtech.api.recipes.crafttweaker.CTRecipe;
import gregtech.api.recipes.crafttweaker.CTRecipeBuilder;
import gregtech.api.unification.material.Material;
Expand Down Expand Up @@ -407,8 +406,8 @@ protected void addInventorySlotGroup(ModularUI.Builder builder, IItemHandlerModi
int itemSlotsToDown = inputSlotGrid[1];
int startInputsX = isOutputs ? 106 : 70 - itemSlotsToLeft * 18;
int startInputsY = 33 - (int) (itemSlotsToDown / 2.0 * 18) + yOffset;
boolean wasGroupOutput = itemHandler.getSlots() + fluidHandler.getTanks() == 12;
if (wasGroupOutput && isOutputs) startInputsY -= 9;
boolean wasGroup = itemHandler.getSlots() + fluidHandler.getTanks() == 12;
if (wasGroup) startInputsY -= 9;
if (itemHandler.getSlots() == 6 && fluidHandler.getTanks() == 2 && !isOutputs) startInputsY -= 9;
for (int i = 0; i < itemSlotsToDown; i++) {
for (int j = 0; j < itemSlotsToLeft; j++) {
Expand All @@ -419,7 +418,7 @@ protected void addInventorySlotGroup(ModularUI.Builder builder, IItemHandlerModi
addSlot(builder, x, y, slotIndex, itemHandler, fluidHandler, invertFluids, isOutputs);
}
}
if (wasGroupOutput) startInputsY += 2;
if (wasGroup) startInputsY += 2;
if (fluidInputsCount > 0 || invertFluids) {
if (itemSlotsToDown >= fluidInputsCount && itemSlotsToLeft < 3) {
int startSpecX = isOutputs ? startInputsX + itemSlotsToLeft * 18 : startInputsX - 18;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import gregtech.api.gui.widgets.ProgressWidget;
import gregtech.api.gui.widgets.SlotWidget;
import gregtech.api.gui.widgets.TankWidget;
import gregtech.api.recipes.Recipe;
import gregtech.api.recipes.Recipe.ChanceEntry;
import gregtech.api.recipes.RecipeMap;
import gregtech.integration.jei.utils.render.FluidStackTextRenderer;
Expand Down Expand Up @@ -41,9 +42,8 @@ public class RecipeMapCategory implements IRecipeCategory<GTRecipeWrapper> {
private final FluidTankList importFluids, exportFluids;
private final IDrawable backgroundDrawable;

private final int FONT_HEIGHT = 9;
private static final int FONT_HEIGHT = 9;
private static final HashMap<RecipeMap<?>, RecipeMapCategory> categoryMap = new HashMap<>();
private double timer = 0;

public RecipeMapCategory(RecipeMap<?> recipeMap, IGuiHelper guiHelper) {
this.recipeMap = recipeMap;
Expand All @@ -57,12 +57,10 @@ public RecipeMapCategory(RecipeMap<?> recipeMap, IGuiHelper guiHelper) {
(importItems = new ItemStackHandler(recipeMap.getMaxInputs())),
(exportItems = new ItemStackHandler(recipeMap.getMaxOutputs())),
(importFluids = new FluidTankList(false, importFluidTanks)),
(exportFluids = new FluidTankList(false, exportFluidTanks)),
(recipeMap.getMaxOutputs() >= 6 || recipeMap.getMaxInputs() >= 6 ||
recipeMap.getMaxFluidOutputs() >= 6 || recipeMap.getMaxFluidInputs() >= 6) ? FONT_HEIGHT : 0
(exportFluids = new FluidTankList(false, exportFluidTanks)), 0
).build(new BlankUIHolder(), Minecraft.getMinecraft().player);
this.modularUI.initWidgets();
this.backgroundDrawable = guiHelper.createBlankDrawable(modularUI.getWidth(), modularUI.getHeight() * 2 / 3);
this.backgroundDrawable = guiHelper.createBlankDrawable(modularUI.getWidth(), modularUI.getHeight() * 2 / 3 + getPropertyShiftAmount(recipeMap));
categoryMap.put(recipeMap, this);
}

Expand Down Expand Up @@ -179,4 +177,20 @@ public void drawExtras(@Nonnull Minecraft minecraft) {
public static HashMap<RecipeMap<?>, RecipeMapCategory> getCategoryMap() {
return categoryMap;
}

private static boolean shouldShiftWidgets(@Nonnull RecipeMap<?> recipeMap) {
return recipeMap.getMaxOutputs() >= 6 || recipeMap.getMaxInputs() >= 6 ||
recipeMap.getMaxFluidOutputs() >= 6 || recipeMap.getMaxFluidInputs() >= 6;
}

private static int getPropertyShiftAmount(@Nonnull RecipeMap<?> recipeMap) {
int maxPropertyCount = 0;
if (shouldShiftWidgets(recipeMap)) {
for (Recipe recipe : recipeMap.getRecipeList()) {
if (recipe.getPropertyCount() > maxPropertyCount)
maxPropertyCount = recipe.getPropertyCount();
}
}
return maxPropertyCount * FONT_HEIGHT;
}
}