Started working on TiC
This commit is contained in:
parent
022153d81a
commit
998af08f76
3 changed files with 115 additions and 0 deletions
|
@ -53,6 +53,8 @@ dependencies {
|
||||||
deobfCompile "cofh:ThermalExpansion:1.12-5.3.3.15:deobf"
|
deobfCompile "cofh:ThermalExpansion:1.12-5.3.3.15:deobf"
|
||||||
deobfCompile "betterwithmods:BetterWithMods:1.12-2.0.8-110"
|
deobfCompile "betterwithmods:BetterWithMods:1.12-2.0.8-110"
|
||||||
deobfCompile "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12-r113"
|
deobfCompile "de.ellpeck.actuallyadditions:ActuallyAdditions:1.12-r113"
|
||||||
|
deobfCompile "slimeknights.mantle:Mantle:1.12-1.3.1.+"
|
||||||
|
deobfCompile "slimeknights:TConstruct:1.12-2.7.3.30"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
101
src/main/java/com/blamejared/compat/tconstruct/Drying.java
Normal file
101
src/main/java/com/blamejared/compat/tconstruct/Drying.java
Normal file
|
@ -0,0 +1,101 @@
|
||||||
|
package com.blamejared.compat.tconstruct;
|
||||||
|
|
||||||
|
import com.blamejared.ModTweaker;
|
||||||
|
import com.blamejared.compat.tconstruct.recipes.DryingRecipeTweaker;
|
||||||
|
import com.blamejared.mtlib.helpers.*;
|
||||||
|
import com.blamejared.mtlib.utils.BaseUndoable;
|
||||||
|
import crafttweaker.CraftTweakerAPI;
|
||||||
|
import crafttweaker.annotations.*;
|
||||||
|
import crafttweaker.api.item.IItemStack;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
|
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||||
|
import slimeknights.mantle.util.RecipeMatch;
|
||||||
|
import slimeknights.tconstruct.library.*;
|
||||||
|
import slimeknights.tconstruct.library.events.TinkerRegisterEvent;
|
||||||
|
import stanhebben.zenscript.annotations.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
@ZenClass("mods.tconstruct.Drying")
|
||||||
|
@ZenRegister
|
||||||
|
@ModOnly("tconstruct")
|
||||||
|
public class Drying {
|
||||||
|
|
||||||
|
public static final List<IItemStack> DRYING_RECIPES = new LinkedList<>();
|
||||||
|
private static boolean init = false;
|
||||||
|
|
||||||
|
private static void init() {
|
||||||
|
if(!init) {
|
||||||
|
MinecraftForge.EVENT_BUS.register(new Drying());
|
||||||
|
init = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ZenMethod
|
||||||
|
public static void addRecipe(IItemStack output, IItemStack input, int time) {
|
||||||
|
init();
|
||||||
|
ModTweaker.LATE_ADDITIONS.add(new Add(InputHelper.toStack(output), InputHelper.toStack(input), time));
|
||||||
|
}
|
||||||
|
|
||||||
|
@ZenMethod
|
||||||
|
public static void removeRecipe(IItemStack output) {
|
||||||
|
init();
|
||||||
|
CraftTweakerAPI.apply(new Remove(output));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class Add extends BaseUndoable {
|
||||||
|
|
||||||
|
private ItemStack output, input;
|
||||||
|
private int time;
|
||||||
|
|
||||||
|
public Add(ItemStack output, ItemStack input, int time) {
|
||||||
|
super("Drying");
|
||||||
|
this.output = output;
|
||||||
|
this.input = input;
|
||||||
|
this.time = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply() {
|
||||||
|
TinkerRegistry.addDryingRecipe(new DryingRecipeTweaker(new RecipeMatch.Item(input, 1), output, time));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getRecipeInfo() {
|
||||||
|
return LogHelper.getStackDescription(output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class Remove extends BaseUndoable {
|
||||||
|
|
||||||
|
private IItemStack output;
|
||||||
|
|
||||||
|
protected Remove(IItemStack output) {
|
||||||
|
super("Drying");
|
||||||
|
this.output = output;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void apply() {
|
||||||
|
DRYING_RECIPES.add(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getRecipeInfo() {
|
||||||
|
return LogHelper.getStackDescription(output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SubscribeEvent
|
||||||
|
public void onTinkerRegister(TinkerRegisterEvent.DryingRackRegisterEvent event) {
|
||||||
|
if(event.getRecipe() instanceof DryingRecipeTweaker) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(IItemStack stack : DRYING_RECIPES) {
|
||||||
|
if(stack.matches(InputHelper.toIItemStack(event.getRecipe().getResult()))) {
|
||||||
|
event.setCanceled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.blamejared.compat.tconstruct.recipes;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import slimeknights.mantle.util.RecipeMatch;
|
||||||
|
import slimeknights.tconstruct.library.DryingRecipe;
|
||||||
|
|
||||||
|
public class DryingRecipeTweaker extends DryingRecipe {
|
||||||
|
|
||||||
|
public DryingRecipeTweaker(RecipeMatch input, ItemStack output, int time) {
|
||||||
|
super(input, output, time);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue