Skip to content

Commit

Permalink
Allow LargeAutoclave to enable canBeDsitinct() when enableGTBees
Browse files Browse the repository at this point in the history
…is true (#3)
  • Loading branch information
MrKono authored Feb 5, 2025
1 parent ae17fd6 commit 0d426dc
Show file tree
Hide file tree
Showing 7 changed files with 118 additions and 3 deletions.
6 changes: 6 additions & 0 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,10 @@ dependencies {
runtimeOnlyNonPublishable rfg.deobf("curse.maven:binnies-mods-patched-899182:5492997") // Binnie's Mods Patched 2.5.1.212
}
}

// Debug GCYM
compileOnly rfg.deobf("curse.maven:gregicality-multiblocks-564858:5619513") // GCYM 1.2.11
if (project.debug_all.toBoolean() || project.debug_gcym.toBoolean()) {
runtimeOnlyNonPublishable rfg.deobf("curse.maven:gregicality-multiblocks-564858:5619513")
}
}
7 changes: 4 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ debug_thaumcraft = false
debug_forestry = false
debug_gendustry = false
debug_binnies = false
debug_gcym = false

# Select a username for testing your mod with breakpoints. You may leave this empty for a random username each time you
# restart Minecraft in development. Choose this dependent on your mod:
Expand All @@ -37,7 +38,7 @@ developmentEnvironmentUserName = Developer
# Additional arguments applied to the JVM when launching minecraft
# Syntax: -arg1=value1;-arg2=value2;...
# Example value: -Dmixin.debug.verify=true;-XX:+UnlockExperimentalVMOptions
additionalJavaArguments =
additionalJavaArguments =

# Enables using modern java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
Expand Down Expand Up @@ -70,9 +71,9 @@ useSrcApiPath = false
accessTransformersFile =

# Provides setup for Mixins if enabled. If you don't know what mixins are: Keep it disabled!
usesMixins = false
usesMixins = true
# Specify the package that contains all of your Mixins. You may only place Mixins in this package or the build will fail!
mixinsPackage =
mixinsPackage = mixins
# Location of the mixin config refmap. If left, blank, defaults to "mixins.${modId}.refmap.json". Target file must have the "json" extension.
mixinConfigRefmap =
# Automatically generates a mixin config json if enabled, with the name mixins.modid.json
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.github.gtexpert.gtbm.api.capability;

public interface IMultiblockDistinctable {

boolean canBeDistinct();
}
62 changes: 62 additions & 0 deletions src/main/java/com/github/gtexpert/gtbm/mixins/GTBMMixinLoader.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
package com.github.gtexpert.gtbm.mixins;

import java.util.AbstractMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import net.minecraftforge.fml.common.Loader;

import com.github.gtexpert.gtbm.api.ModValues;
import com.github.gtexpert.gtbm.api.util.ModLog;
import com.github.gtexpert.gtbm.api.util.Mods;

import zone.rong.mixinbooter.ILateMixinLoader;

public class GTBMMixinLoader implements ILateMixinLoader {

public static final Map<String, Boolean> modMixinsConfig = Stream.of(
new AbstractMap.SimpleImmutableEntry<>(Mods.Names.GREGICALITY_MULTIBLOCKS,
Mods.GregicalityMultiblocks.isModLoaded()))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));

@Override
public List<String> getMixinConfigs() {
return modMixinsConfig.keySet().stream().map(mod -> "mixins." + ModValues.MODID + "." + mod + ".json")
.collect(Collectors.toList());
}

@Override
public boolean shouldMixinConfigQueue(String mixinConfig) {
String[] parts = mixinConfig.split("\\.");

if (parts.length != 4) {
ModLog.logger.fatal("Mixin Config Check Failed! Invalid Length.");
ModLog.logger.fatal("Mixin Config: " + mixinConfig);
return true;
}

if (!Objects.equals(parts[1], ModValues.MODID)) {
ModLog.logger.error("Non GTExpertCore Mixin Found in Mixin Queue. This is probably an error. Skipping...");
ModLog.logger.error("Mixin Config: " + mixinConfig);
return true;
}

if (!Loader.isModLoaded(parts[2])) {
ModLog.logger.error("Mod '" + parts[2] +
"' is not loaded. If this is a normal GTExpertCore instance, this is probably an error.");
ModLog.logger.error("Not Loading Mixin Config " + mixinConfig);
return false;
}

if (!modMixinsConfig.containsKey(parts[2]) || !modMixinsConfig.get(parts[2])) {
ModLog.logger.info("Integration for Mod '" + parts[2] + "' is not enabled, or does not exist.");
ModLog.logger.info("Not Loading Mixin Config " + mixinConfig);
return false;
}

return true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.github.gtexpert.gtbm.mixins.gcym;

import org.spongepowered.asm.mixin.Mixin;

import gregtech.integration.forestry.ForestryConfig;

import gregicality.multiblocks.common.metatileentities.multiblock.standard.MetaTileEntityLargeAutoclave;

import com.github.gtexpert.gtbm.api.capability.IMultiblockDistinctable;

@Mixin(value = MetaTileEntityLargeAutoclave.class, remap = false)
public class MetaTileEntityLargeAutoclaveMixin implements IMultiblockDistinctable {

@Override
public boolean canBeDistinct() {
return ForestryConfig.enableGTBees;
}
}
12 changes: 12 additions & 0 deletions src/main/resources/mixins.gtbm.gcym.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"package": "com.github.gtexpert.gtbm.mixins.gcym",
"refmap": "mixins.gtbm.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [
"MetaTileEntityLargeAutoclaveMixin"
],
"client": [],
"server": []
}
10 changes: 10 additions & 0 deletions src/main/resources/mixins.gtbm.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"package": "com.github.gtexpert.gtbm.mixins",
"refmap": "mixins.gtbm.refmap.json",
"target": "@env(DEFAULT)",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"mixins": [],
"client": [],
"server": []
}

0 comments on commit 0d426dc

Please sign in to comment.