Skip to content

Commit

Permalink
Tinkers' Construct support (#37)
Browse files Browse the repository at this point in the history
* Basic tinkers support

* Move SmelteryFuelRecipe

* Add entity melting

* Add casting

* Add materials

* Fix ore dict

* Improve melting recipes

* Tinkers Complement support

* Bracket handlers

* Disable tinkers debug

* Use EntityEntry for entity melting

* Add validation to ToolMaterialBuilder

* General cleanup

* Replace loader with events

* Remove trait builder

* Update Melter.java

* Update GroovyScriptSandbox.java

* Allow custom material class

* Manually call reload on nested registries

* Update GroovyScriptSandbox.java

* Remove null check for bracket handlers

* Fix repair amounts

* Run materials on item register

* Fix traits

* Allow materials to be uncraftable

* Allow no cast for casting recipes
  • Loading branch information
Testure authored Mar 24, 2023
1 parent b9f52a1 commit 9f3d711
Show file tree
Hide file tree
Showing 36 changed files with 2,492 additions and 5 deletions.
12 changes: 12 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,18 @@ dependencies {
} else {
deobfProvided 'curse.maven:immersive_engineering-231951:2974106'
}

if (project.debug_tinkers.toBoolean()) {
deobfCompile 'slimeknights.mantle:Mantle:1.12-1.3.3.55'
deobfCompile 'slimeknights:TConstruct:1.12.2-2.13.0.190'
deobfCompile 'curse.maven:constructs-armory-287683:3174535'
deobfCompile 'curse.maven:tinkers-complement-272671:2843439'
} else {
deobfProvided 'slimeknights.mantle:Mantle:1.12-1.3.3.55'
deobfProvided 'slimeknights:TConstruct:1.12.2-2.13.0.190'
deobfProvided 'curse.maven:constructs-armory-287683:3174535'
deobfProvided 'curse.maven:tinkers-complement-272671:2843439'
}
}

sourceSets {
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ debug_de = false
debug_ie = false
debug_enderio = false
debug_astral = false
debug_blood_magic = false
debug_blood_magic = false
debug_tinkers = false
19 changes: 16 additions & 3 deletions src/main/java/com/cleanroommc/groovyscript/GroovyScript.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.cleanroommc.groovyscript.command.GSCommand;
import com.cleanroommc.groovyscript.compat.content.GroovyResourcePack;
import com.cleanroommc.groovyscript.compat.mods.ModSupport;
import com.cleanroommc.groovyscript.compat.mods.tinkersconstruct.TinkersConstruct;
import com.cleanroommc.groovyscript.compat.vanilla.VanillaModule;
import com.cleanroommc.groovyscript.core.mixin.DefaultResourcePackAccessor;
import com.cleanroommc.groovyscript.event.EventHandler;
Expand All @@ -28,19 +29,20 @@
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.client.settings.KeyConflictContext;
import net.minecraftforge.client.settings.KeyModifier;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.event.FMLConstructionEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLServerStartingEvent;
import net.minecraftforge.fml.common.event.*;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.InputEvent;
import org.apache.logging.log4j.LogManager;
Expand Down Expand Up @@ -84,6 +86,7 @@ public class GroovyScript {

@Mod.EventHandler
public void onConstruction(FMLConstructionEvent event) {
MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(EventHandler.class);
NetworkHandler.init();
GroovySystem.getMetaClassRegistry().setMetaClassCreationHandle(GrSMetaClassCreationHandle.INSTANCE);
Expand All @@ -107,6 +110,16 @@ public void onConstruction(FMLConstructionEvent event) {
}
}

@Mod.EventHandler
public void onInit(FMLInitializationEvent event) {
if (ModSupport.TINKERS_CONSTRUCT.isLoaded()) TinkersConstruct.init();
}

@SubscribeEvent(priority = EventPriority.LOWEST)
public void onRegisterItem(RegistryEvent.Register<Item> event) {
if (ModSupport.TINKERS_CONSTRUCT.isLoaded()) TinkersConstruct.preInit();
}

@ApiStatus.Internal
public static void initializeGroovyPreInit() {
// called via mixin in between construction and fml pre init
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.cleanroommc.groovyscript.compat.mods.immersiveengineering.ImmersiveEngineering;
import com.cleanroommc.groovyscript.compat.mods.jei.JustEnoughItems;
import com.cleanroommc.groovyscript.compat.mods.mekanism.Mekanism;
import com.cleanroommc.groovyscript.compat.mods.tcomplement.TinkersComplement;
import com.cleanroommc.groovyscript.compat.mods.thaumcraft.Thaumcraft;
import com.cleanroommc.groovyscript.compat.mods.thermalexpansion.ThermalExpansion;
import com.cleanroommc.groovyscript.compat.mods.tinkersconstruct.TinkersConstruct;
Expand Down Expand Up @@ -39,6 +40,7 @@ public class ModSupport implements IDynamicGroovyProperty {
public static final Container<Mekanism> MEKANISM = new Container<>("mekanism", "Mekanism", Mekanism::new);
public static final Container<ThermalExpansion> THERMAL_EXPANSION = new Container<>("thermalexpansion", "Thermal Expansion", ThermalExpansion::new, "te", "thermal");
public static final Container<TinkersConstruct> TINKERS_CONSTRUCT = new Container<>("tconstruct", "Tinkers' Construct", TinkersConstruct::new, "ticon", "tinkersconstruct");
public static final Container<TinkersComplement> TINKERS_COMPLEMENT = new Container<>("tcomplement", "Tinkers Complement", TinkersComplement::new, "tcomp", "tinkerscomplement");
public static final Container<DraconicEvolution> DRACONIC_EVO = new Container<>("draconicevolution", "Draconic Evolution", DraconicEvolution::new, "de");
public static final Container<BloodMagic> BLOOD_MAGIC = new Container<>("bloodmagic", "Blood Magic: Alchemical Wizardry", BloodMagic::new, "bm");
public static final Container<ImmersiveEngineering> IMMERSIVE_ENGINEERING = new Container<>("immersiveengineering", "Immersive Engineering", ImmersiveEngineering::new, "ie");
Expand Down
Loading

0 comments on commit 9f3d711

Please sign in to comment.