fixes
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
|
||||
public static List<string> FindAllFiles(string directoryPath)
|
||||
{
|
||||
return Directory.GetFiles(directoryPath, "*.*", SearchOption.AllDirectories).ToList();
|
||||
return Directory.GetFiles(directoryPath, "*.*", SearchOption.AllDirectories)
|
||||
.Select(file => Path.GetRelativePath(directoryPath, file))
|
||||
.ToList();
|
||||
}
|
||||
|
||||
var replacements = new[]
|
||||
{
|
||||
new { Old = "com.example", New = "io.github.cooldev" },
|
||||
new { Old = "template", New = "coolmod" },
|
||||
new { Old = "Template", New = "Cool Mod" },
|
||||
new { Old = "TempLate", New = "CoolMod" }
|
||||
//ORDER MATTERS
|
||||
new { Old = "JavaJumper", New = "CoolDev" } //change mod init class and other places where mod name is in PascalCase
|
||||
};
|
||||
|
||||
var files = FindAllFiles(Directory.GetCurrentDirectory());
|
||||
|
||||
@@ -10,7 +10,7 @@ org.gradle.parallel=false
|
||||
mod.version=2.0.0
|
||||
mod.group=io.github.jumperonjava
|
||||
mod.id=template
|
||||
mod.name=Custom cursor
|
||||
mod.name=Template
|
||||
|
||||
# Used for the mod metadata
|
||||
mod.mc_dep_fabric=[VERSIONED]
|
||||
|
||||
@@ -21,7 +21,7 @@ stonecutter {
|
||||
fun mc(loader: String, vararg versions: String) {
|
||||
for (version in versions) vers("$version-$loader", version)
|
||||
}
|
||||
//i would recommend to use neoforge for mc >= 1.20.1
|
||||
//i would recommend to use neoforge for mc > 1.20.1, i haven't tested template for forge on versions higher than that
|
||||
mc("fabric","1.20.1","1.20.4", "1.21.1", "1.21.3", "1.21.4")
|
||||
mc("forge","1.20.1")
|
||||
//WARNING: neoforge uses mods.toml instead of neoforge.mods.toml for versions 1.20.4 (?) and earlier
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.example.template;
|
||||
|
||||
import net.minecraft.client.gui.DrawContext;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
@@ -10,17 +11,16 @@ public class ConfigScreen extends Screen {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
addDrawableChild(((context, mouseX, mouseY, delta) -> {
|
||||
context.drawCenteredTextWithShadow(client.textRenderer,
|
||||
"Hello, world",
|
||||
width / 2,
|
||||
height / 2,
|
||||
0xFFFFFFFF);
|
||||
}));
|
||||
public void render(DrawContext context, int mouseX, int mouseY, float delta) {
|
||||
super.render(context, mouseX, mouseY, delta);
|
||||
context.drawCenteredTextWithShadow(client.textRenderer,
|
||||
"Hello, world",
|
||||
width / 2,
|
||||
height / 2,
|
||||
0xFFFFFFFF);
|
||||
}
|
||||
|
||||
public static ConfigScreen createCursorEditScreen(Screen parent) {
|
||||
public static ConfigScreen createConfigScreen(Screen parent) {
|
||||
return new ConfigScreen(parent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,10 @@ public class TempLateInit
|
||||
{
|
||||
public static final String MODID = "template";
|
||||
public static final Logger LOGGER = LoggerFactory.getLogger("Template");
|
||||
private static ModPlatform PLATFORM = null;
|
||||
public static ModPlatform PLATFORM = null;
|
||||
|
||||
public static void entrypoint(ModPlatform platform) {
|
||||
TempLateInit.PLATFORM = platform;
|
||||
LOGGER.info("Started mod in %s loader", TempLateInit.PLATFORM.getModloader());
|
||||
LOGGER.info("Started mod in %s loader".formatted(TempLateInit.PLATFORM.getModloader()));
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ public class ExampleMixin {
|
||||
|
||||
@Inject(method = "init",at=@At("HEAD"))
|
||||
void init(CallbackInfo ci){
|
||||
TempLateInit.LOGGER.info("Stonecutter example mixin init");
|
||||
TempLateInit.LOGGER.info("Stonecutter example mixin init in %s".formatted(TempLateInit.PLATFORM.getModloader()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//? if fabric {
|
||||
/*package com.example.platforms.fabric;
|
||||
package com.example.template.platforms.fabric;
|
||||
|
||||
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
|
||||
import com.terraformersmc.modmenu.api.ModMenuApi;
|
||||
@@ -7,7 +7,7 @@ import com.example.template.ConfigScreen;
|
||||
|
||||
public class ModMenuIntegration implements ModMenuApi {
|
||||
public ConfigScreenFactory<?> getModConfigScreenFactory() {
|
||||
return ConfigScreen::createCursorEditScreen;
|
||||
return ConfigScreen::createConfigScreen;
|
||||
}
|
||||
}
|
||||
*///?}
|
||||
//?}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//? if fabric {
|
||||
/*package com.example.platforms.fabric;
|
||||
package com.example.template.platforms.fabric;
|
||||
|
||||
import com.example.template.ModPlatform;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
@@ -24,4 +24,4 @@ public class TempLateFabric implements ModInitializer {
|
||||
}
|
||||
}
|
||||
}
|
||||
*///?}
|
||||
//?}
|
||||
@@ -1,5 +1,5 @@
|
||||
//? if forge {
|
||||
/*package com.example.platforms.forge;
|
||||
/*package com.example.template.platforms.forge;
|
||||
|
||||
import com.example.template.ConfigScreen;
|
||||
import com.example.template.TempLateInit;
|
||||
@@ -12,7 +12,7 @@ import net.minecraftforge.fml.common.Mod;
|
||||
public class TempLateForge {
|
||||
public TempLateForge() {
|
||||
TempLateInit.entrypoint(new ForgePlatform());
|
||||
MinecraftForge.registerConfigScreen(ConfigScreen::createCursorEditScreen);
|
||||
MinecraftForge.registerConfigScreen(ConfigScreen::createConfigScreen);
|
||||
}
|
||||
public static class ForgePlatform implements ModPlatform {
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//? if neoforge {
|
||||
package com.example.template.platforms.neoforge;
|
||||
/*package com.example.template.platforms.neoforge;
|
||||
|
||||
import com.example.template.ConfigScreen;
|
||||
import com.example.template.TempLateInit;
|
||||
@@ -11,8 +11,8 @@ import net.neoforged.fml.common.Mod;
|
||||
//? if <1.21 {
|
||||
import net.neoforged.neoforge.client.ConfigScreenHandler;
|
||||
//?} else {
|
||||
/*import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
|
||||
*///?}
|
||||
/^import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
|
||||
^///?}
|
||||
@Mod("template")
|
||||
public class TempLateNeoForge {
|
||||
public TempLateNeoForge() {
|
||||
@@ -21,12 +21,12 @@ public class TempLateNeoForge {
|
||||
//? if <1.21 {
|
||||
ConfigScreenHandler.ConfigScreenFactory.class,
|
||||
() -> new ConfigScreenHandler.ConfigScreenFactory(
|
||||
((client, parent) -> ConfigScreen.createCursorEditScreen(parent))
|
||||
((client, parent) -> ConfigScreen.createConfigScreen(parent))
|
||||
)
|
||||
//?} else {
|
||||
/*IConfigScreenFactory.class,
|
||||
() -> (client, parent) -> CursorEditScreen.createCursorEditScreen(parent)
|
||||
*///?}
|
||||
/^IConfigScreenFactory.class,
|
||||
() -> (client, parent) -> ConfigScreen.createConfigScreen(parent)
|
||||
^///?}
|
||||
);
|
||||
}
|
||||
public static class NeoForgePlatform implements ModPlatform {
|
||||
@@ -41,4 +41,4 @@ public class TempLateNeoForge {
|
||||
}
|
||||
}
|
||||
}
|
||||
//?}
|
||||
*///?}
|
||||
@@ -14,10 +14,10 @@
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [
|
||||
"com.example.platforms.fabric.TempLateFabric"
|
||||
"com.example.template.platforms.fabric.TempLateFabric"
|
||||
],
|
||||
"modmenu": [
|
||||
"com.example.platforms.fabric.ModMenuIntegration"
|
||||
"com.example.template.platforms.fabric.ModMenuIntegration"
|
||||
]
|
||||
},
|
||||
"mixins": [
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "com.example.mixin",
|
||||
"package": "com.example.template.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"com.example.template.mixin.ExampleMixin"
|
||||
"ExampleMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "com.example.platforms.fabric.mixin",
|
||||
"package": "com.example.template.platforms.fabric.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "com.example.platforms.forge.mixin",
|
||||
"package": "com.example.template.platforms.forge.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"required": true,
|
||||
"package": "com.example.platforms.neoforge.mixin",
|
||||
"package": "com.example.template.platforms.neoforge.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
|
||||
@@ -5,7 +5,7 @@ plugins {
|
||||
id("com.github.johnrengelman.shadow") version "8.1.1" apply false
|
||||
id("me.modmuss50.mod-publish-plugin") version "0.8.4" apply false
|
||||
}
|
||||
stonecutter active "1.20.4-neoforge" /* [SC] DO NOT EDIT */
|
||||
stonecutter active "1.20.1-fabric" /* [SC] DO NOT EDIT */
|
||||
stonecutter.automaticPlatformConstants = true
|
||||
|
||||
// Builds every version into `build/libs/{mod.version}/{loader}`
|
||||
|
||||
Reference in New Issue
Block a user