first
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package net.cmr.jurassicrevived;
|
||||
|
||||
import dev.architectury.platform.forge.EventBuses;
|
||||
import net.cmr.jurassicrevived.client.config.JRClothConfigScreens;
|
||||
import net.minecraftforge.client.ConfigScreenHandler;
|
||||
import net.minecraftforge.fml.ModLoadingContext;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
|
||||
@Mod(Constants.MOD_ID)
|
||||
public class JRMod {
|
||||
|
||||
@SuppressWarnings({"deprecation", "removal"})
|
||||
public JRMod() {
|
||||
|
||||
// This method is invoked by the Forge mod loader when it is ready
|
||||
// to load your mod. You can access Forge and Common code in this
|
||||
// project.
|
||||
|
||||
EventBuses.registerModEventBus(Constants.MOD_ID, FMLJavaModLoadingContext.get().getModEventBus());
|
||||
|
||||
// Use Forge to bootstrap the Common mod.
|
||||
Constants.LOG.info("Hello Forge world!");
|
||||
CommonClass.init();
|
||||
|
||||
|
||||
ModLoadingContext.get().registerExtensionPoint(
|
||||
ConfigScreenHandler.ConfigScreenFactory.class,
|
||||
() -> new ConfigScreenHandler.ConfigScreenFactory(
|
||||
(mc, parent) -> JRClothConfigScreens.create(parent)
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package net.cmr.jurassicrevived.client.config;
|
||||
|
||||
import me.shedaniel.clothconfig2.api.ConfigBuilder;
|
||||
import me.shedaniel.clothconfig2.api.ConfigCategory;
|
||||
import me.shedaniel.clothconfig2.api.ConfigEntryBuilder;
|
||||
import net.cmr.jurassicrevived.config.JRConfig;
|
||||
import net.cmr.jurassicrevived.config.JRConfigManager;
|
||||
import net.cmr.jurassicrevived.platform.Services;
|
||||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.network.chat.Component;
|
||||
|
||||
public final class JRClothConfigScreens {
|
||||
private JRClothConfigScreens() {}
|
||||
|
||||
public static Screen create(Screen parent) {
|
||||
JRConfig cfg = JRConfigManager.get();
|
||||
|
||||
ConfigBuilder builder = ConfigBuilder.create()
|
||||
.setParentScreen(parent)
|
||||
.setTitle(Component.literal("Jurassic Revived Config"));
|
||||
|
||||
ConfigCategory general = builder.getOrCreateCategory(Component.literal("General"));
|
||||
ConfigEntryBuilder eb = builder.entryBuilder();
|
||||
|
||||
general.addEntry(
|
||||
eb.startBooleanToggle(Component.literal("Enable Dinosaurs"), cfg.enableDinosaurs)
|
||||
.setDefaultValue(true)
|
||||
.setSaveConsumer(v -> cfg.enableDinosaurs = v)
|
||||
.build()
|
||||
);
|
||||
|
||||
general.addEntry(
|
||||
eb.startIntField(Component.literal("Spawn Weight"), cfg.spawnWeight)
|
||||
.setDefaultValue(10)
|
||||
.setMin(0)
|
||||
.setMax(1000)
|
||||
.setSaveConsumer(v -> cfg.spawnWeight = v)
|
||||
.build()
|
||||
);
|
||||
|
||||
builder.setSavingRunnable(() -> JRConfigManager.save(Services.PLATFORM.getConfigDir()));
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package net.cmr.jurassicrevived.mixin;
|
||||
|
||||
import net.cmr.jurassicrevived.Constants;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.TitleScreen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(TitleScreen.class)
|
||||
public class MixinTitleScreen {
|
||||
|
||||
@Inject(at = @At("HEAD"), method = "init()V")
|
||||
private void init(CallbackInfo info) {
|
||||
|
||||
Constants.LOG.info("This line is printed by an example mod mixin from Forge!");
|
||||
Constants.LOG.info("MC Version: {}", Minecraft.getInstance().getVersionType());
|
||||
}
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package net.cmr.jurassicrevived.platform;
|
||||
|
||||
import net.cmr.jurassicrevived.platform.services.IPlatformHelper;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.fml.loading.FMLPaths;
|
||||
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class ForgePlatformHelper implements IPlatformHelper {
|
||||
|
||||
@Override
|
||||
public String getPlatformName() {
|
||||
return "Forge";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModLoaded(String modId) {
|
||||
return ModList.get().isLoaded(modId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDevelopmentEnvironment() {
|
||||
return !FMLLoader.isProduction();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path getConfigDir() {
|
||||
return FMLPaths.CONFIGDIR.get();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
modLoader = "javafml" #mandatory
|
||||
loaderVersion = "${minecraftforge_version_range}" #mandatory This is typically bumped every Minecraft version by Forge. See https://files.minecraftforge.net/ for a list of versions.
|
||||
license = "${license}" # Review your options at https://choosealicense.com/.
|
||||
#issueTrackerURL="https://change.me.to.your.issue.tracker.example.invalid/" #optional
|
||||
#clientSideOnly=true #optional
|
||||
[[mods]] #mandatory
|
||||
modId = "${mod_id}" #mandatory
|
||||
version = "${version}" #mandatory
|
||||
displayName = "${mod_name}" #mandatory
|
||||
#updateJSONURL="https://change.me.example.invalid/updates.json" #optional (see https://mcforge.readthedocs.io/en/latest/gettingstarted/autoupdate/)
|
||||
#displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional (displayed in the mod UI)
|
||||
logoFile = "${mod_id}.png" #optional
|
||||
credits = "${credits}" #optional
|
||||
authors = "${mod_author}" #optional
|
||||
description = '''${description}''' #mandatory (Supports multiline text)
|
||||
[[dependencies.${mod_id}]] #optional
|
||||
modId = "forge" #mandatory
|
||||
mandatory = true #mandatory
|
||||
versionRange = "[${minecraftforge_version},)" #mandatory
|
||||
ordering = "NONE" # The order that this dependency should load in relation to your mod, required to be either 'BEFORE' or 'AFTER' if the dependency is not mandatory
|
||||
side = "BOTH" # Side this dependency is applied on - 'BOTH', 'CLIENT' or 'SERVER'
|
||||
[[dependencies.${mod_id}]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
versionRange = "${minecraft_version_range}"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="architectury"
|
||||
mandatory=true
|
||||
versionRange="[${architectury_version},)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="cloth_config"
|
||||
mandatory=true
|
||||
versionRange="[${cloth_config_version_1_20_1},)"
|
||||
ordering="NONE"
|
||||
side="CLIENT"
|
||||
|
||||
[[dependencies.${mod_id}]]
|
||||
modId="geckolib"
|
||||
mandatory=true
|
||||
versionRange="[${geckolib_version},)"
|
||||
ordering="NONE"
|
||||
side="BOTH"
|
||||
+1
@@ -0,0 +1 @@
|
||||
net.cmr.jurassicrevived.platform.ForgePlatformHelper
|
||||
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "net.cmr.jurassicrevived.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [],
|
||||
"client": [
|
||||
"MixinTitleScreen"
|
||||
],
|
||||
"server": [],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user