Skip to content

Commit

Permalink
Expand Microverse Recipe Map
Browse files Browse the repository at this point in the history
A week and a half of suffering ended... mostly.

This needs to be reviewed. Its still not good enough.

It barely works.
  • Loading branch information
IntegerLimit committed Mar 5, 2024
1 parent c650053 commit 9ac07c9
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static void preInit() {
}

private static RecipeMap<SimpleRecipeBuilder> createMicroverseRecipeMap(int tier) {
return new RecipeMap<>("microverse_projector_" + tier, tier == 3 ? 9 : 4, 16, tier == 1 ? 1 : 0, 0, new SimpleRecipeBuilder(), !oldMultis())
return new MicroverseMap("microverse_projector_" + tier, tier == 3 ? 9 : 4, tier == 1 ? 20 : 16, tier == 1 ? 1 : 0, 0, new SimpleRecipeBuilder(), !oldMultis())
.setProgressBar(LabsTextures.PROGRESS_BAR_ROCKET, ProgressWidget.MoveType.HORIZONTAL).setSound(LabsSounds.MICROVERSE)
.setSlotOverlay(false, false, GuiTextures.IMPLOSION_OVERLAY_1);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package com.nomiceu.nomilabs.gregtech.recipe;

import gregtech.api.capability.impl.FluidTankList;
import gregtech.api.gui.ModularUI;
import gregtech.api.recipes.RecipeMap;
import gregtech.api.recipes.builders.SimpleRecipeBuilder;
import net.minecraftforge.items.IItemHandlerModifiable;
import org.jetbrains.annotations.NotNull;

/**
* TODO: Refactor when GT MUI Change Rolls In
*/
public class MicroverseMap extends RecipeMap<SimpleRecipeBuilder> {
public MicroverseMap(@NotNull String unlocalizedName, int maxInputs, int maxOutputs, int maxFluidInputs, int maxFluidOutputs, @NotNull SimpleRecipeBuilder defaultRecipeBuilder, boolean isHidden) {
super(unlocalizedName, maxInputs, maxOutputs, maxFluidInputs, maxFluidOutputs, defaultRecipeBuilder, isHidden);
}

@Override
protected void addInventorySlotGroup(ModularUI.Builder builder, IItemHandlerModifiable itemHandler,
FluidTankList fluidHandler, boolean isOutputs, int yOffset) {
int itemInputsCount = itemHandler.getSlots();
int fluidInputsCount = fluidHandler.getTanks();
boolean invertFluids = false;
if (itemInputsCount == 0) {
int tmp = itemInputsCount;
itemInputsCount = fluidInputsCount;
fluidInputsCount = tmp;
invertFluids = true;
}
int[] inputSlotGrid = determineSlotsGrid(itemInputsCount);
/* One Change: Swap Left & Down */
int itemSlotsToLeft = inputSlotGrid[1];
int itemSlotsToDown = inputSlotGrid[0];
int startInputsX = isOutputs ? 106 : 70 - itemSlotsToLeft * 18;
int startInputsY = 33 - (int) (itemSlotsToDown / 2.0 * 18) + yOffset;
// yOffset - 2 is the very border
if (startInputsY < yOffset - 2)
startInputsY = yOffset - 2;

boolean wasGroup = itemHandler.getSlots() + fluidHandler.getTanks() == 12;
if (wasGroup) startInputsY -= 9;
else if (itemHandler.getSlots() >= 6 && fluidHandler.getTanks() >= 2 && !isOutputs) startInputsY -= 9;
for (int i = 0; i < itemSlotsToDown; i++) {
for (int j = 0; j < itemSlotsToLeft; j++) {
int slotIndex = i * itemSlotsToLeft + j;
if (slotIndex >= itemInputsCount) break;
int x = startInputsX + 18 * j;
int y = startInputsY + 18 * i;
addSlot(builder, x, y, slotIndex, itemHandler, fluidHandler, invertFluids, isOutputs);
}
}
if (wasGroup) startInputsY += 2;
if (fluidInputsCount > 0 || invertFluids) {
if (itemSlotsToDown >= fluidInputsCount && itemSlotsToLeft < 3) {
int startSpecX = isOutputs ? startInputsX + itemSlotsToLeft * 18 : startInputsX - 18;
for (int i = 0; i < fluidInputsCount; i++) {
int y = startInputsY + 18 * i;
addSlot(builder, startSpecX, y, i, itemHandler, fluidHandler, !invertFluids, isOutputs);
}
} else {
int startSpecY = startInputsY + itemSlotsToDown * 18;
for (int i = 0; i < fluidInputsCount; i++) {
int x = isOutputs ? startInputsX + 18 * (i % 3) :
startInputsX + itemSlotsToLeft * 18 - 18 - 18 * (i % 3);
int y = startSpecY + (i / 3) * 18;
addSlot(builder, x, y, i, itemHandler, fluidHandler, !invertFluids, isOutputs);
}
}
}
}



}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static void initRecipes() {
.buildAndRegister();

for (var recipeBuilder : LabsRecipeMaps.MICROVERSE_RECIPES) {
recipeBuilder.recipeBuilder().duration(1200).EUt(GTValues.VHA[GTValues.MV])
recipeBuilder.recipeBuilder().duration(9408).EUt(GTValues.VA[GTValues.LuV])
.input(LabsItems.T1_SHIP)
.output(Blocks.REDSTONE_ORE, 64)
.buildAndRegister();
Expand Down

0 comments on commit 9ac07c9

Please sign in to comment.