Skip to content

Commit

Permalink
Migrate to new RecipeMap
Browse files Browse the repository at this point in the history
  • Loading branch information
miozune committed Dec 1, 2023
1 parent 07ce984 commit ee0775b
Show file tree
Hide file tree
Showing 22 changed files with 487 additions and 631 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//version: 1699290261
//version: 1700844281
/*
DO NOT CHANGE THIS FILE!
Also, you may replace this file at any time if there is an update available.
Expand Down Expand Up @@ -302,7 +302,7 @@ if (apiPackage) {
}

if (accessTransformersFile) {
for (atFile in accessTransformersFile.split(",")) {
for (atFile in accessTransformersFile.split(" ")) {
String targetFile = "src/main/resources/META-INF/" + atFile.trim()
if (!getFile(targetFile).exists()) {
throw new GradleException("Could not resolve \"accessTransformersFile\"! Could not find " + targetFile)
Expand Down
10 changes: 5 additions & 5 deletions dependencies.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
dependencies {
api('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.73:dev')
api('com.github.GTNewHorizons:TecTech:5.3.13:dev')
api('com.github.GTNewHorizons:Galaxy-Space-GTNH:1.2.11-GTNH:dev')
api('com.github.GTNewHorizons:GoodGenerator:0.7.5:dev')
api('com.github.GTNewHorizons:GT5-Unofficial:5.09.44.92-pre:dev')
api('com.github.GTNewHorizons:TecTech:5.3.16-pre:dev')
api('com.github.GTNewHorizons:Galaxy-Space-GTNH:1.2.14-GTNH:dev')
api('com.github.GTNewHorizons:GoodGenerator:0.7.7-pre:dev')
compileOnly("com.github.GTNewHorizons:Hodgepodge:2.3.22:dev") {transitive = false}
devOnlyNonPublishable('com.github.GTNewHorizons:GTplusplus:1.10.24:dev')
devOnlyNonPublishable('com.github.GTNewHorizons:GTplusplus:1.10.35-pre:dev')
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import com.gtnewhorizons.gtnhintergalactic.gui.IG_UITextures;
import com.gtnewhorizons.gtnhintergalactic.recipe.GasSiphonRecipes;
import com.gtnewhorizons.modularui.api.GlStateManager;
import com.gtnewhorizons.modularui.api.ModularUITextures;
import com.gtnewhorizons.modularui.api.UIInfos;
import com.gtnewhorizons.modularui.api.drawable.IDrawable;
import com.gtnewhorizons.modularui.api.math.Pos2d;
Expand All @@ -24,6 +23,7 @@
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import gregtech.api.gui.modularui.GT_UITextures;
import gregtech.api.util.GT_Utility;
import micdoodle8.mods.galacticraft.core.util.GCCoreUtil;

Expand All @@ -39,7 +39,7 @@ public class GasSiphonRecipeHandler extends TemplateRecipeHandler {
/** Modular window used to display the recipes */
protected final ModularWindow modularWindow;
/** Offsets of the recipe window */
private static final Pos2d WINDOW_OFFSET = new Pos2d(-3, -8);
private static final Pos2d WINDOW_OFFSET = new Pos2d(-2, -8);

/** X coordinate of the category titles */
private static final int CATEGORY_TITLE_X = 30;
Expand All @@ -58,7 +58,7 @@ public class GasSiphonRecipeHandler extends TemplateRecipeHandler {
* Initialize the handler for gas siphons recipes
*/
public GasSiphonRecipeHandler() {
modularWindow = ModularWindow.builder(172, 82).setBackground(ModularUITextures.VANILLA_BACKGROUND)
modularWindow = ModularWindow.builder(170, 82).setBackground(GT_UITextures.BACKGROUND_NEI_SINGLE_RECIPE)
.widget(
new DrawableWidget().setDrawable(IG_UITextures.PICTURE_ELEVATOR_LOGO).setSize(17, 17)
.setPos(new Pos2d(147, 52)))
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
package com.gtnewhorizons.gtnhintergalactic.nei;

import java.util.Arrays;

import net.minecraft.item.ItemStack;

import com.gtnewhorizons.gtnhintergalactic.Tags;
import com.gtnewhorizons.gtnhintergalactic.item.IGItems;

import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import codechicken.nei.event.NEIRegisterHandlerInfosEvent;
import codechicken.nei.recipe.HandlerInfo;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;

public class NEI_IG_Config implements IConfigureNEI {

public static boolean executed = false;

@Override
public void loadConfig() {
API.registerRecipeHandler(new SpacePumpModuleRecipeHandler());
API.registerUsageHandler(new SpacePumpModuleRecipeHandler());
API.registerRecipeHandler(new GasSiphonRecipeHandler());
API.registerUsageHandler(new GasSiphonRecipeHandler());

for (ItemStack pump : Arrays.asList(
IGItems.SpaceElevatorModulePumpT1,
IGItems.SpaceElevatorModulePumpT2,
IGItems.SpaceElevatorModulePumpT3)) {
API.addRecipeCatalyst(pump, "com.gtnewhorizons.gtnhintergalactic.nei.SpacePumpModuleRecipeHandler");
}
API.addRecipeCatalyst(
IGItems.PlanetaryGasSiphon,
"com.gtnewhorizons.gtnhintergalactic.nei.GasSiphonRecipeHandler");

executed = true;
}

@SubscribeEvent
public void registerHandlerInfo(NEIRegisterHandlerInfosEvent event) {
event.registerHandlerInfo(
new HandlerInfo.Builder(
"com.gtnewhorizons.gtnhintergalactic.nei.SpacePumpModuleRecipeHandler",
Tags.MODNAME,
Tags.MODID).setDisplayStack(IGItems.SpaceElevatorModulePumpT1).setShiftY(6).setWidth(160)
.setHeight(90).setMaxRecipesPerPage(3).build());
event.registerHandlerInfo(
new HandlerInfo.Builder(
"com.gtnewhorizons.gtnhintergalactic.nei.GasSiphonRecipeHandler",
Tags.MODNAME,
Tags.MODID).setDisplayStack(IGItems.PlanetaryGasSiphon).setShiftY(6).setWidth(160).setHeight(90)
.setMaxRecipesPerPage(3).build());
}

@Override
public String getName() {
return "GTNH-Intergalactic NEI Plugin";
}

@Override
public String getVersion() {
return Tags.VERSION;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import com.gtnewhorizons.gtnhintergalactic.gui.IG_UITextures;
import com.gtnewhorizons.gtnhintergalactic.recipe.SpacePumpingRecipes;
import com.gtnewhorizons.modularui.api.GlStateManager;
import com.gtnewhorizons.modularui.api.ModularUITextures;
import com.gtnewhorizons.modularui.api.UIInfos;
import com.gtnewhorizons.modularui.api.drawable.IDrawable;
import com.gtnewhorizons.modularui.api.math.Pos2d;
Expand All @@ -26,6 +25,7 @@
import codechicken.lib.gui.GuiDraw;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import gregtech.api.gui.modularui.GT_UITextures;
import gregtech.api.util.GT_Utility;

/**
Expand All @@ -40,7 +40,7 @@ public class SpacePumpModuleRecipeHandler extends TemplateRecipeHandler {
/** Modular window used to display the recipes */
protected final ModularWindow modularWindow;
/** Offsets of the recipe window */
private static final Pos2d WINDOW_OFFSET = new Pos2d(-3, -8);
private static final Pos2d WINDOW_OFFSET = new Pos2d(-2, -8);

/** X coordinate of the category titles */
private static final int CATEGORY_TITLE_X = 30;
Expand All @@ -59,7 +59,7 @@ public class SpacePumpModuleRecipeHandler extends TemplateRecipeHandler {
* Initialize the handler for space pumping recipes
*/
public SpacePumpModuleRecipeHandler() {
modularWindow = ModularWindow.builder(172, 82).setBackground(ModularUITextures.VANILLA_BACKGROUND)
modularWindow = ModularWindow.builder(170, 82).setBackground(GT_UITextures.BACKGROUND_NEI_SINGLE_RECIPE)
.widget(
new DrawableWidget().setDrawable(IG_UITextures.PICTURE_ELEVATOR_LOGO).setSize(17, 17)
.setPos(new Pos2d(147, 52)))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package com.gtnewhorizons.gtnhintergalactic.proxy;

import net.minecraft.util.IIcon;
import net.minecraftforge.common.MinecraftForge;

import com.gtnewhorizons.gtnhintergalactic.block.BlockSpaceElevatorCable;
import com.gtnewhorizons.gtnhintergalactic.client.IGTextures;
import com.gtnewhorizons.gtnhintergalactic.client.TooltipUtil;
import com.gtnewhorizons.gtnhintergalactic.nei.NEI_IG_Config;
import com.gtnewhorizons.gtnhintergalactic.render.RenderSpaceElevatorCable;
import com.gtnewhorizons.gtnhintergalactic.tile.TileEntitySpaceElevatorCable;
import com.mitchej123.hodgepodge.textures.IPatchedTextureAtlasSprite;
Expand Down Expand Up @@ -52,6 +54,7 @@ public void init(FMLInitializationEvent event) {
ClientRegistry
.bindTileEntitySpecialRenderer(TileEntitySpaceElevatorCable.class, new RenderSpaceElevatorCable());
new IGTextures().run();
MinecraftForge.EVENT_BUS.register(new NEI_IG_Config());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.gtnewhorizons.gtnhintergalactic.item.IGItems;
import com.gtnewhorizons.gtnhintergalactic.loader.MachineLoader;
import com.gtnewhorizons.gtnhintergalactic.loader.RecipeLoader;
import com.gtnewhorizons.gtnhintergalactic.nei.IMCForNEI;
import com.gtnewhorizons.gtnhintergalactic.recipe.IG_RecipeAdder;
import com.gtnewhorizons.gtnhintergalactic.recipe.MachineRecipes;
import com.gtnewhorizons.gtnhintergalactic.recipe.ResultNoSpaceProject;
Expand Down Expand Up @@ -37,7 +36,6 @@ public void preInit(FMLPreInitializationEvent event) {

// load "Do your mod setup. Build whatever data structures you care about. Register recipes." (Remove if not needed)
public void init(FMLInitializationEvent event) {
IMCForNEI.IMCSender();
if (Textures.BlockIcons.casingTexturePages[32] == null) {
Textures.BlockIcons.casingTexturePages[32] = new ITexture[128];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package com.gtnewhorizons.gtnhintergalactic.recipe;

import java.util.Comparator;

import com.gtnewhorizons.gtnhintergalactic.gui.IG_UITextures;
import com.gtnewhorizons.gtnhintergalactic.recipe.maps.SpaceAssemblerFrontend;
import com.gtnewhorizons.gtnhintergalactic.recipe.maps.SpaceMiningFrontend;
import com.gtnewhorizons.gtnhintergalactic.recipe.maps.SpaceResearchFrontend;

import gregtech.api.recipe.RecipeMap;
import gregtech.api.recipe.RecipeMapBackend;
import gregtech.api.recipe.RecipeMapBuilder;
import gregtech.api.util.GT_Recipe;

public class IGRecipeMaps {

/** Recipe map for recipes in the Space Research Module */
public static final RecipeMap<RecipeMapBackend> spaceResearchRecipes = RecipeMapBuilder
.of("gt.recipe.spaceResearch").maxIO(7, 1, 3, 0).minInputs(1, 0).logo(IG_UITextures.PICTURE_ELEVATOR_LOGO)
.logoSize(18, 18).neiTransferRect(110, 35, 18, 18).progressBarPos(110, 35)
.frontend(SpaceResearchFrontend::new).build();
/** Recipe map for recipes in the Space Assembler Module */
public static final RecipeMap<RecipeMapBackend> spaceAssemblerRecipes = RecipeMapBuilder
.of("gt.recipe.spaceAssembler").maxIO(16, 1, 4, 0).minInputs(1, 0).logo(IG_UITextures.PICTURE_ELEVATOR_LOGO)
.logoSize(18, 18).neiTransferRect(124, 8, 16, 16)
.neiRecipeComparator(
Comparator.<GT_Recipe, Integer>comparing(recipe -> recipe.mSpecialValue)
.thenComparing(GT_Recipe::compareTo))
.neiTransferRect(88, 8, 18, 72).neiTransferRect(124, 8, 18, 72).useCustomFilterForNEI()
.frontend(SpaceAssemblerFrontend::new).build();
/** Recipe map for recipes in the Space Mining Module */
public static final RecipeMap<RecipeMapBackend> spaceMiningRecipes = RecipeMapBuilder.of("gt.recipe.spaceMining")
.maxIO(5, 16, 2, 0).minInputs(1, 0)
.neiRecipeComparator(
Comparator.<GT_Recipe, Integer>comparing(recipe -> recipe.mSpecialValue)
.thenComparing(GT_Recipe::compareTo))
.logo(IG_UITextures.PICTURE_ELEVATOR_LOGO).logoPos(151, 58).logoSize(18, 18)
.neiRecipeBackgroundSize(170, 78).neiTransferRect(46, 6, 23, 63).dontUseProgressBar()
.addSpecialTexture(46, 6, 23, 63, IG_UITextures.PROGRESSBAR_SPACE_MINING_MODULE_ARROW)
.useCustomFilterForNEI().frontend(SpaceMiningFrontend::new).build();
}
Loading

0 comments on commit ee0775b

Please sign in to comment.