mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-22 08:07:42 +00:00
Forge Adapter
This commit is contained in:
1 parent
921a98f210
commit
516537db72
68 files changed
+2049
-13
No files matched your search
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.forge;
|
||||
|
||||
import art.arcane.iris.modded.ModdedLoader;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.fml.loading.FMLPaths;
|
||||
import net.minecraftforge.forgespi.language.IModFileInfo;
|
||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public final class ForgeModdedLoader implements ModdedLoader {
|
||||
@Override
|
||||
public String platformName() {
|
||||
return "forge";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String minecraftVersion() {
|
||||
return FMLLoader.versionInfo().mcVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public MinecraftServer currentServer() {
|
||||
return ServerLifecycleHooks.getCurrentServer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Path configDir() {
|
||||
return FMLPaths.CONFIGDIR.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File modJar() {
|
||||
IModFileInfo info = ModList.getModFileById("irisworldgen");
|
||||
return info == null ? null : info.getFile().getFilePath().toFile();
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,57 @@
|
||||
|
||||
package art.arcane.iris.forge;
|
||||
|
||||
import art.arcane.iris.modded.IrisModdedChunkGenerator;
|
||||
import art.arcane.iris.modded.ModdedEngineBootstrap;
|
||||
import art.arcane.iris.modded.ModdedParityProbe;
|
||||
import art.arcane.iris.modded.ModdedWorldCheck;
|
||||
import art.arcane.iris.modded.ModdedWorldEngines;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraftforge.event.server.ServerStoppingEvent;
|
||||
import net.minecraftforge.fml.ModContainer;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import net.minecraftforge.fml.loading.VersionInfo;
|
||||
import net.minecraftforge.registries.DeferredRegister;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@Mod("irisworldgen")
|
||||
public final class IrisForgeBootstrap {
|
||||
public IrisForgeBootstrap() {
|
||||
throw new UnsupportedOperationException("The Iris Forge adapter is a build skeleton; worldgen is not wired yet (see CROSSPLATFORM_PLAN.md Phase 5).");
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger("Iris");
|
||||
|
||||
public IrisForgeBootstrap(FMLJavaModLoadingContext context) {
|
||||
ModdedEngineBootstrap.initialize(new ForgeModdedLoader());
|
||||
String modVersion = ModList.getModContainerById("irisworldgen")
|
||||
.map((ModContainer container) -> container.getModInfo().getVersion().toString())
|
||||
.orElse("unknown");
|
||||
VersionInfo versionInfo = FMLLoader.versionInfo();
|
||||
LOGGER.info("Iris {} bootstrapping on Minecraft {} (Forge {})", modVersion, versionInfo.mcVersion(), versionInfo.forgeVersion());
|
||||
|
||||
ModdedEngineBootstrap.selfTest(IrisForgeBootstrap.class.getClassLoader());
|
||||
ModdedEngineBootstrap.bind();
|
||||
|
||||
DeferredRegister<MapCodec<? extends ChunkGenerator>> chunkGenerators = DeferredRegister.create(Registries.CHUNK_GENERATOR, "irisworldgen");
|
||||
chunkGenerators.register("iris", () -> IrisModdedChunkGenerator.CODEC);
|
||||
chunkGenerators.register(context.getModBusGroup());
|
||||
LOGGER.info("Iris chunk generator registered as irisworldgen:iris");
|
||||
|
||||
ServerStoppingEvent.BUS.addListener((ServerStoppingEvent event) -> ModdedWorldEngines.shutdown());
|
||||
|
||||
String parity = System.getProperty("iris.parity");
|
||||
if (parity != null) {
|
||||
LOGGER.info("Iris parity probe armed: {}", parity);
|
||||
ModdedParityProbe.schedule(parity);
|
||||
}
|
||||
|
||||
String worldCheck = System.getProperty("iris.worldcheck");
|
||||
if (worldCheck != null) {
|
||||
LOGGER.info("Iris world check armed");
|
||||
ModdedWorldCheck.schedule();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,24 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[1,)"
|
||||
loaderVersion = "[64,)"
|
||||
license = "GPL-3.0"
|
||||
|
||||
[[mods]]
|
||||
modId = "irisworldgen"
|
||||
version = "${version}"
|
||||
displayName = "Iris"
|
||||
description = "Iris World Generation Engine (Forge adapter - SKELETON, worldgen not yet wired)"
|
||||
description = "Iris World Generation Engine (Forge adapter - native chunk generator, overworld override datapack, engine lifecycle)"
|
||||
authors = "Arcane Arts (Volmit Software)"
|
||||
|
||||
[[dependencies.irisworldgen]]
|
||||
modId = "forge"
|
||||
mandatory = true
|
||||
versionRange = "[64,)"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
|
||||
[[dependencies.irisworldgen]]
|
||||
modId = "minecraft"
|
||||
mandatory = true
|
||||
versionRange = "[${minecraftVersion}]"
|
||||
ordering = "NONE"
|
||||
side = "BOTH"
|
||||
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"pack": {
|
||||
"description": "Iris World Generation Engine resources",
|
||||
"max_format": 101,
|
||||
"min_format": [
|
||||
101,
|
||||
1
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user