Skip to content

Commit

Permalink
Fix data generation step (#122)
Browse files Browse the repository at this point in the history
* Added runData loader check

* Fixed fabric compatibility on data generation
  • Loading branch information
caxapexac authored Dec 4, 2023
1 parent 63a8399 commit 012850a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
17 changes: 17 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,23 @@ minecraft {
}
}
}

data {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'
property 'forge.logging.console.level', 'debug'

// https://github.com/SpongePowered/Mixin/issues/462#issuecomment-791370319
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"

args '--mod', 'mousetweaks', '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
mods {
mousetweaks {
source sourceSets.main
}
}
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/yalter/mousetweaks/forge/MouseTweaksForge.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import net.minecraftforge.fml.ModLoadingContext;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.loading.FMLEnvironment;
import net.minecraftforge.fml.loading.FMLLoader;
import yalter.mousetweaks.Constants;
import yalter.mousetweaks.Logger;
import yalter.mousetweaks.Main;
Expand All @@ -26,6 +27,11 @@ public MouseTweaksForge() {
return;
}

if (FMLLoader.getLaunchHandler().isData()) {
Logger.Log("Disabled because running data generation.");
return;
}

Main.initialize();
MinecraftForge.EVENT_BUS.register(this);

Expand Down

0 comments on commit 012850a

Please sign in to comment.