Skip to content
This repository has been archived by the owner on Sep 7, 2024. It is now read-only.

Commit

Permalink
Add Thaumcraft Support
Browse files Browse the repository at this point in the history
  • Loading branch information
wohaopa committed May 23, 2024
1 parent 39e7f14 commit 15eeeb2
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 10 deletions.
13 changes: 9 additions & 4 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,14 @@
*/
dependencies {
runtimeOnlyNonPublishable("com.github.GTNewHorizons:NotEnoughItems:2.6.0-GTNH:dev")
implementation("com.github.GTNewHorizons:GT5-Unofficial:5.09.46.21:dev")
compileOnly("com.github.GTNewHorizons:GT5-Unofficial:5.09.46.21:dev")
implementation("thaumcraft:Thaumcraft:1.7.10-4.2.3.5:dev")
runtimeOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-400-GTNH:dev")
runtimeOnly("com.github.GTNewHorizons:TecTech:5.4.2:dev")
runtimeOnly("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.3.0-gtnh:dev")
compileOnly("com.github.GTNewHorizons:TecTech:5.4.2:dev")

// runtimeOnly("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-400-GTNH:dev")
// runtimeOnly("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.3.0-gtnh:dev")
runtimeOnly("com.github.GTNewHorizons:Baubles:1.0.4:dev")
runtimeOnly("com.github.GTNewHorizons:waila:1.8.0:dev")


}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public List<String> getMixins(Set<String> loadedMods) {
mixins.add("gregtech.GT_MetaTileEntity_DrillerBaseMixin");
}
if (ModHelper.hasThaumcraft) {

mixins.add("thaumcraft.TileAlchemyFurnaceMixin");
}

return mixins;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.wohaopa.GTNHModify.handler;

import com.github.wohaopa.GTNHModify.ModHelper;
import com.github.wohaopa.GTNHModify.strategies.Strategy;

import gregtech.api.recipe.RecipeMap;
Expand All @@ -10,8 +9,6 @@
public class GregTechHandler {

protected static void init() {
if (!ModHelper.hasGregtech) return;

RecipeMap.ALL_RECIPE_MAPS.forEach(
(s, recipeMap) -> recipeMap.getAllRecipes()
.forEach(recipe -> Strategy.strategy.handler_GT_Recipe(recipe)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,25 @@
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.github.wohaopa.GTNHModify.GTNHModifyMod;
import com.github.wohaopa.GTNHModify.ModHelper;
import com.github.wohaopa.GTNHModify.strategies.Strategy;

public class Handlers {

public static List<String> handlers = Arrays.asList("Minecraft", "GregTech", "Thaumcraft");
public static List<String> handlers = new ArrayList<>();
private static final String Suffix = "Handler";
private static final List<Method> methods = new ArrayList<>();

public static void init() {
if (!Strategy.prevInit()) return;

handlers.add("Minecraft");
if (ModHelper.hasGregtech) handlers.add("GregTech");
if (ModHelper.hasThaumcraft) handlers.add("Thaumcraft");

GTNHModifyMod.LOG.info("Start processing the recipe");
if (methods.isEmpty()) {
String pkg = Handlers.class.getName()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.github.wohaopa.GTNHModify.handler;

import com.github.wohaopa.GTNHModify.strategies.Strategy;

@IHandler("init")
public class ThaumcraftHandler {

public static void init() {

}

public static int handle(Object owner, int number) {
// todo new method
return Strategy.strategy.handler_FurnaceProcessingTime(owner, number);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.github.wohaopa.GTNHModify.mixins.late.thaumcraft;

import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import com.github.wohaopa.GTNHModify.handler.ThaumcraftHandler;

import thaumcraft.common.tiles.TileAlchemyFurnace;

@Mixin(value = TileAlchemyFurnace.class, remap = false)
public abstract class TileAlchemyFurnaceMixin {

@Redirect(
method = "canSmelt",
at = @At(
value = "FIELD",
target = "Lthaumcraft/common/tiles/TileAlchemyFurnace;smeltTime:I",
opcode = Opcodes.PUTFIELD))
private void injectedSmeltTime(TileAlchemyFurnace furnace, int smeltTime) {
furnace.smeltTime = ThaumcraftHandler.handle(furnace, smeltTime);
}
}

0 comments on commit 15eeeb2

Please sign in to comment.