Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Current features:
* 64A Energy Converters
* The Wireless Active Transformer (WAT)
* Has an opt-in coolant system, where the WAT requires coolant to be used, or it'll explode (or just stop if GTm is set to have harmless active transformers)
* Automatically set placed Parallel Hatches to their maximum parallels

All features can be enabled or disabled in the config.

Expand Down
8 changes: 8 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ sourceSets {
}
}

mixin {
add sourceSets.main, "mixins.${mod_id}.refmap.json"
config "${mod_id}.mixins.json"
}

repositories {
mavenLocal()
mavenCentral()
Expand Down Expand Up @@ -138,6 +143,9 @@ apply from: "$rootDir/gradle/scripts/spotless.gradle"
dependencies {
compileOnly("org.jetbrains:annotations:26.0.1")

// Apply Mixin AP
annotationProcessor('org.spongepowered:mixin:0.8.5:processor')

// JEI, EMI, Jade
modCompileOnly("mezz.jei:jei-${minecraft_version}-forge-api:${jei_version}")
modCompileOnly("mezz.jei:jei-${minecraft_version}-common-api:${jei_version}")
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/net/neganote/gtutilities/config/UtilConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public static class FeatureConfigs {
@Configurable.Comment({ "Whether the Wireless Active Transformer is enabled." })
public boolean pterbEnabled = true;

@Configurable
@Configurable.Comment({
"Whether placed Parallel Hatches should be automatically set to their maximum parallels." })
public boolean parallelHatchAutoConfigure = false;

@Configurable
@Configurable.Comment({ "Base amount of WAT coolant to drain every second.",
"(Setting both this amount and the IO multiplier to 0 disables the coolant mechanic.)" })
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package net.neganote.gtutilities.mixin;

import com.gregtechceu.gtceu.api.machine.IMachineBlockEntity;
import com.gregtechceu.gtceu.common.machine.multiblock.part.ParallelHatchPartMachine;

import net.neganote.gtutilities.config.UtilConfig;

import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(ParallelHatchPartMachine.class)
public abstract class ParallelHatchPartMachineMixin {

@Shadow
public abstract void setCurrentParallel(int parallelAmount);

@Shadow
@Final
private int maxParallel;

@Inject(
method = "<init>",
at = @At("TAIL"))
public void constructor(IMachineBlockEntity holder, int tier, CallbackInfo ci) {
if (UtilConfig.INSTANCE.features.parallelHatchAutoConfigure)
this.setCurrentParallel(this.maxParallel);
}
}
5 changes: 4 additions & 1 deletion src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ GregTech Utilities
A GregTech Modern addon, adding some nice quality-of-life features.
'''

[[mixins]]
config="${mod_id}.mixins.json"

[[dependencies.${mod_id}]]
modId = "forge"
mandatory = true
Expand All @@ -40,4 +43,4 @@ A GregTech Modern addon, adding some nice quality-of-life features.
mandatory = true
versionRange = "[${gtceu_version},)"
ordering = "AFTER"
side = "BOTH"
side = "BOTH"
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"required": true,
"package": "com.example.examplemod.mixin",
"package": "net.neganote.gtutilities.mixin",
"compatibilityLevel": "JAVA_17",
"minVersion": "0.8",
"mixins": [
"ParallelHatchPartMachineMixin"
],
"client": [
],
Expand Down