Skip to content

Commit 063540d

Browse files
authored
fix the addon template and add a dummy mixin (#8)
1 parent d8ba840 commit 063540d

File tree

5 files changed

+26
-7
lines changed

5 files changed

+26
-7
lines changed

build.gradle

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,22 @@ legacyForge {
9595
// You can set various levels here.
9696
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
9797
logLevel = org.slf4j.event.Level.DEBUG
98-
sourceSet = sourceSets.main
9998
}
10099
client {
101100
client()
101+
sourceSet = sourceSets.main
102102
programArguments.addAll('--refresh-dependencies')
103103
systemProperty('forge.enabledGameTestNamespaces', project.mod_id)
104104
}
105105
server {
106106
server()
107+
sourceSet = sourceSets.main
107108
systemProperty('forge.enabledGameTestNamespaces', project.mod_id)
108109
programArguments.addAll('--nogui', '--world', 'world-extra')
109110
}
110111
data {
111112
data()
112-
113+
sourceSet = sourceSets.main
113114
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
114115
programArguments.addAll('--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath())
115116
programArguments.addAll('--existing-mod', 'gtceu')
@@ -151,15 +152,16 @@ dependencies {
151152
modImplementation("com.gregtechceu.gtceu:gtceu-${minecraft_version}:${gtceu_version}:slim") { transitive = false }
152153
modImplementation("com.lowdragmc.ldlib:ldlib-forge-${minecraft_version}:${ldlib_version}") { transitive = false }
153154
modImplementation("com.tterrag.registrate:Registrate:${registrate_version}")
154-
modRuntimeOnly("dev.toma.configuration:configuration-forge-${minecraft_version}:${configuration_version}")
155+
modImplementation("dev.toma.configuration:configuration-forge-${minecraft_version}:${configuration_version}")
155156

156157
// lombok
157158
compileOnly 'org.projectlombok:lombok:1.18.24'
158159
annotationProcessor 'org.projectlombok:lombok:1.18.24'
159160
}
160161

162+
// See com.example.examplemod.mixin.DummyMixin for information about mixins
161163
mixin {
162-
add sourceSets.main, "${mod_id}.refmap.json"
164+
add sourceSets.main, "mixins.${mod_id}.refmap.json"
163165
config "${mod_id}.mixins.json"
164166
}
165167

@@ -190,4 +192,5 @@ tasks.withType(JavaCompile).configureEach {
190192
// If Javadoc is generated, this must be specified in that task too.
191193
options.encoding = "UTF-8"
192194
options.release.set(17)
195+
options.compilerArgs << "-Aquiet=true" // Suppress mixin notes
193196
}

src/main/java/com/example/examplemod/ExampleGTAddon.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ public void addRecipes(Consumer<FinishedRecipe> provider) {
3939
// KubeJS WILL REMOVE YOUR RECIPES IF THESE ARE NOT REGISTERED.
4040
/*
4141
* public static final ContentJS<Double> PRESSURE_IN = new ContentJS<>(NumberComponent.ANY_DOUBLE,
42-
* GregitasRecipeCapabilities.PRESSURE, false);
42+
* CustomRecipeCapabilities.PRESSURE, false);
4343
* public static final ContentJS<Double> PRESSURE_OUT = new ContentJS<>(NumberComponent.ANY_DOUBLE,
44-
* GregitasRecipeCapabilities.PRESSURE, true);
44+
* CustomRecipeCapabilities.PRESSURE, true);
4545
*
4646
* @Override
4747
* public void registerRecipeKeys(KJSRecipeKeyEvent event) {

src/main/java/com/example/examplemod/ExampleMod.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import org.apache.logging.log4j.Logger;
2424

2525
@Mod(ExampleMod.MOD_ID)
26+
@SuppressWarnings("removal")
2627
public class ExampleMod {
2728

2829
public static final String MOD_ID = "examplemod";
@@ -113,7 +114,7 @@ private void registerRecipeTypes(GTCEuAPI.RegisterEvent<ResourceLocation, GTReci
113114
}
114115

115116
/**
116-
* Used to register your own new RecipeTypes.
117+
* Used to register your own new machines.
117118
* Call init() from your Machine class(es) here
118119
*
119120
* @param event
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package com.example.examplemod.mixin;
2+
3+
import net.minecraft.world.level.levelgen.WorldgenRandom;
4+
5+
import org.spongepowered.asm.mixin.Mixin;
6+
7+
// This is a dummy mixin! It doesn't actually do anything.
8+
// Mixins are ways to modify code in other classes.
9+
// They can be very valuable in the right circumstances,
10+
// but it is generally preferred that you try to use other means
11+
// to get your code to work before resorting to mixins,
12+
// as they can be highly invasive.
13+
@Mixin(value = WorldgenRandom.class, remap = false)
14+
public class DummyMixin {}

src/main/resources/examplemod.mixins.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"compatibilityLevel": "JAVA_17",
55
"minVersion": "0.8",
66
"mixins": [
7+
"DummyMixin"
78
],
89
"client": [
910
],

0 commit comments

Comments
 (0)