mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 08:25:31 +00:00
Merge remote-tracking branch 'PolyhedralDev/ver/6.2.0' into dev/enviroment
This commit is contained in:
commit
0e9f9bd2b0
@ -15,7 +15,9 @@ buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven { url = uri("https://repo.codemc.org/repository/maven-public") }
|
||||
maven("https://repo.codemc.org/repository/maven-public") {
|
||||
name = "CodeMC"
|
||||
}
|
||||
maven("https://papermc.io/repo/repository/maven-public/") {
|
||||
name = "PaperMC"
|
||||
}
|
||||
|
@ -30,11 +30,21 @@ fun Project.configureDependencies() {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.fabricmc.net/")
|
||||
maven("https://repo.codemc.org/repository/maven-public")
|
||||
maven("https://repo.codemc.io/repository/nms/")
|
||||
maven("https://papermc.io/repo/repository/maven-public/")
|
||||
maven ( "https://files.minecraftforge.net/maven/" )
|
||||
maven("https://maven.fabricmc.net/") {
|
||||
name = "FabricMC"
|
||||
}
|
||||
maven("https://repo.codemc.org/repository/maven-public") {
|
||||
name = "CodeMC"
|
||||
}
|
||||
maven("https://papermc.io/repo/repository/maven-public/") {
|
||||
name = "PaperMC"
|
||||
}
|
||||
maven ( "https://files.minecraftforge.net/maven/" ) {
|
||||
name = "Forge"
|
||||
}
|
||||
maven ("https://maven.quiltmc.org/repository/release/") {
|
||||
name = "Quilt"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
@ -25,6 +25,12 @@ object Versions {
|
||||
const val minotaur = "1.1.0"
|
||||
}
|
||||
|
||||
object Quilt {
|
||||
const val quiltLoader = "0.17.0"
|
||||
const val loom = "0.12.+"
|
||||
const val fabricApi = "2.0.0-alpha.2+0.55.3-1.19"
|
||||
}
|
||||
|
||||
object Mod {
|
||||
const val minecraft = "1.19"
|
||||
const val yarn = "$minecraft+build.1"
|
||||
|
@ -1,4 +1,11 @@
|
||||
# Magic options for more perf
|
||||
# Project information
|
||||
terra.description=A modern voxel world generation modding platform
|
||||
terra.source=https://github.com/PolyhedralDev/Terra
|
||||
terra.issues=https://github.com/PolyhedralDev/Terra/issues
|
||||
terra.wiki=https://github.com/PolyhedralDev/Terra/wiki
|
||||
terra.license=MIT
|
||||
|
||||
# Gradle options
|
||||
org.gradle.jvmargs=-Xmx3072M -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC
|
||||
org.gradle.vfs.watch=true
|
||||
kapt.use.worker.api=true
|
||||
@ -6,11 +13,3 @@ kapt.include.compile.classpath=false
|
||||
org.gradle.parallel=true
|
||||
org.gradle.caching=true
|
||||
org.gradle.warning.mode=all
|
||||
#org.gradle.logging.level=info
|
||||
#org.gradle.configureondemand=true
|
||||
# Project information
|
||||
terra.description=A modern voxel world generation modding platform
|
||||
terra.source=https://github.com/PolyhedralDev/Terra
|
||||
terra.issues=https://github.com/PolyhedralDev/Terra/issues
|
||||
terra.wiki=https://github.com/PolyhedralDev/Terra/wiki
|
||||
terra.license=GNU General Public License, version 3.0
|
@ -14,12 +14,15 @@ configurations {
|
||||
dependencies {
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
|
||||
"compileOnly"("net.fabricmc:sponge-mixin:${Versions.Fabric.mixin}")
|
||||
"annotationProcessor"("net.fabricmc:sponge-mixin:${Versions.Fabric.mixin}")
|
||||
"annotationProcessor"("net.fabricmc:fabric-loom:${Versions.Fabric.loom}")
|
||||
compileOnly("net.fabricmc:sponge-mixin:${Versions.Fabric.mixin}")
|
||||
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Fabric.mixin}")
|
||||
annotationProcessor("net.fabricmc:fabric-loom:${Versions.Fabric.loom}")
|
||||
|
||||
"common"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
|
||||
shaded(project(path = ":platforms:mixin-common", configuration = "transformProductionFabric")) { isTransitive = false }
|
||||
"common"(project(path = ":platforms:mixin-lifecycle", configuration = "namedElements")) { isTransitive = false }
|
||||
shaded(project(path = ":platforms:mixin-lifecycle", configuration = "transformProductionFabric")) { isTransitive = false }
|
||||
|
||||
|
||||
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
|
||||
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
|
||||
|
@ -21,41 +21,17 @@ import cloud.commandframework.execution.CommandExecutionCoordinator;
|
||||
import cloud.commandframework.fabric.FabricServerCommandManager;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.dfsek.terra.api.command.CommandSender;
|
||||
import com.dfsek.terra.api.event.events.platform.CommandRegistrationEvent;
|
||||
import com.dfsek.terra.api.event.events.platform.PlatformInitializationEvent;
|
||||
import com.dfsek.terra.fabric.util.BiomeUtil;
|
||||
import com.dfsek.terra.mod.CommonPlatform;
|
||||
import com.dfsek.terra.mod.data.Codecs;
|
||||
|
||||
|
||||
public class FabricEntryPoint implements ModInitializer {
|
||||
private static final Logger logger = LoggerFactory.getLogger(FabricEntryPoint.class);
|
||||
|
||||
private static final PlatformImpl TERRA_PLUGIN = new PlatformImpl();
|
||||
|
||||
|
||||
public static PlatformImpl getPlatform() {
|
||||
return TERRA_PLUGIN;
|
||||
}
|
||||
|
||||
public static void register() { // register the things
|
||||
Registry.register(Registry.CHUNK_GENERATOR, new Identifier("terra:terra"), Codecs.MINECRAFT_CHUNK_GENERATOR_WRAPPER);
|
||||
Registry.register(Registry.BIOME_SOURCE, new Identifier("terra:terra"), Codecs.TERRA_BIOME_SOURCE);
|
||||
}
|
||||
|
||||
public static void initialize() {
|
||||
getPlatform().getEventManager().callEvent(
|
||||
new PlatformInitializationEvent());
|
||||
BiomeUtil.registerBiomes();
|
||||
CommonPlatform.get().registerWorldTypes((id, preset) -> BuiltinRegistries.add(BuiltinRegistries.WORLD_PRESET, id, preset));
|
||||
}
|
||||
private static final FabricPlatform TERRA_PLUGIN = new FabricPlatform();
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
|
@ -0,0 +1,76 @@
|
||||
/*
|
||||
* This file is part of Terra.
|
||||
*
|
||||
* Terra 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.
|
||||
*
|
||||
* Terra 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 Terra. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.fabric;
|
||||
|
||||
import ca.solostudios.strata.Versions;
|
||||
import ca.solostudios.strata.parser.tokenizer.ParseException;
|
||||
import ca.solostudios.strata.version.Version;
|
||||
|
||||
import com.dfsek.terra.lifecycle.LifecyclePlatform;
|
||||
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.dfsek.terra.addon.EphemeralAddon;
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.util.generic.Lazy;
|
||||
import com.dfsek.terra.mod.CommonPlatform;
|
||||
|
||||
|
||||
public class FabricPlatform extends LifecyclePlatform {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(FabricPlatform.class);
|
||||
|
||||
@Override
|
||||
protected Collection<BaseAddon> getPlatformMods() {
|
||||
return FabricLoader.getInstance().getAllMods().stream().flatMap(mod -> {
|
||||
String id = mod.getMetadata().getId();
|
||||
if(id.equals("terra") || id.equals("minecraft") || id.equals("java")) return Stream.empty();
|
||||
try {
|
||||
Version version = Versions.parseVersion(mod.getMetadata().getVersion().getFriendlyString());
|
||||
return Stream.<BaseAddon>of(new EphemeralAddon(version, "fabric:" + id));
|
||||
} catch(ParseException e) {
|
||||
LOGGER.warn(
|
||||
"Mod {}, version {} does not follow semantic versioning specification, Terra addons will be unable to depend on " +
|
||||
"it.",
|
||||
id, mod.getMetadata().getVersion().getFriendlyString());
|
||||
}
|
||||
return Stream.empty();
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
@Override
|
||||
public @NotNull String platformName() {
|
||||
return "Fabric";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull File getDataFolder() {
|
||||
return new File(FabricLoader.getInstance().getConfigDir().toFile(), "Terra");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseAddon getPlatformAddon() {
|
||||
return new FabricAddon(this);
|
||||
}
|
||||
}
|
@ -1,151 +0,0 @@
|
||||
/*
|
||||
* This file is part of Terra.
|
||||
*
|
||||
* Terra 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.
|
||||
*
|
||||
* Terra 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 Terra. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.fabric;
|
||||
|
||||
import ca.solostudios.strata.Versions;
|
||||
import ca.solostudios.strata.parser.tokenizer.ParseException;
|
||||
import ca.solostudios.strata.version.Version;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.minecraft.MinecraftVersion;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.dfsek.terra.addon.EphemeralAddon;
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.handle.ItemHandle;
|
||||
import com.dfsek.terra.api.handle.WorldHandle;
|
||||
import com.dfsek.terra.api.util.generic.Lazy;
|
||||
import com.dfsek.terra.fabric.util.BiomeUtil;
|
||||
import com.dfsek.terra.mod.CommonPlatform;
|
||||
import com.dfsek.terra.mod.ModPlatform;
|
||||
import com.dfsek.terra.mod.generation.MinecraftChunkGeneratorWrapper;
|
||||
import com.dfsek.terra.mod.handle.MinecraftItemHandle;
|
||||
import com.dfsek.terra.mod.handle.MinecraftWorldHandle;
|
||||
|
||||
|
||||
public class PlatformImpl extends ModPlatform {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PlatformImpl.class);
|
||||
private final ItemHandle itemHandle = new MinecraftItemHandle();
|
||||
private final WorldHandle worldHandle = new MinecraftWorldHandle();
|
||||
private final Lazy<File> dataFolder = Lazy.lazy(() -> new File(FabricLoader.getInstance().getConfigDir().toFile(), "Terra"));
|
||||
private MinecraftServer server;
|
||||
|
||||
public PlatformImpl() {
|
||||
CommonPlatform.initialize(this);
|
||||
load();
|
||||
}
|
||||
|
||||
public void setServer(MinecraftServer server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MinecraftServer getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reload() {
|
||||
getTerraConfig().load(this);
|
||||
getRawConfigRegistry().clear();
|
||||
boolean succeed = getRawConfigRegistry().loadAll(this);
|
||||
|
||||
|
||||
if(server != null) {
|
||||
server.reloadResources(server.getDataPackManager().getNames()).exceptionally(throwable -> {
|
||||
LOGGER.warn("Failed to execute reload", throwable);
|
||||
return null;
|
||||
}).join();
|
||||
BiomeUtil.registerBiomes();
|
||||
server.getWorlds().forEach(world -> {
|
||||
if(world.getChunkManager().getChunkGenerator() instanceof MinecraftChunkGeneratorWrapper chunkGeneratorWrapper) {
|
||||
getConfigRegistry().get(chunkGeneratorWrapper.getPack().getRegistryKey()).ifPresent(pack -> {
|
||||
chunkGeneratorWrapper.setPack(pack);
|
||||
LOGGER.info("Replaced pack in chunk generator for world {}", world);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
return succeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<BaseAddon> platformAddon() {
|
||||
List<BaseAddon> addons = new ArrayList<>();
|
||||
|
||||
super.platformAddon().forEach(addons::add);
|
||||
|
||||
String mcVersion = MinecraftVersion.CURRENT.getReleaseTarget();
|
||||
try {
|
||||
addons.add(new EphemeralAddon(Versions.parseVersion(mcVersion), "minecraft"));
|
||||
} catch(ParseException e) {
|
||||
try {
|
||||
addons.add(new EphemeralAddon(Versions.parseVersion(mcVersion + ".0"), "minecraft"));
|
||||
} catch(ParseException ex) {
|
||||
LOGGER.warn("Failed to parse Minecraft version", e);
|
||||
}
|
||||
}
|
||||
|
||||
FabricLoader.getInstance().getAllMods().forEach(mod -> {
|
||||
String id = mod.getMetadata().getId();
|
||||
if(id.equals("terra") || id.equals("minecraft") || id.equals("java")) return;
|
||||
try {
|
||||
Version version = Versions.parseVersion(mod.getMetadata().getVersion().getFriendlyString());
|
||||
addons.add(new EphemeralAddon(version, "fabric:" + id));
|
||||
} catch(ParseException e) {
|
||||
LOGGER.warn(
|
||||
"Mod {}, version {} does not follow semantic versioning specification, Terra addons will be unable to depend on " +
|
||||
"it.",
|
||||
id, mod.getMetadata().getVersion().getFriendlyString());
|
||||
}
|
||||
});
|
||||
|
||||
return addons;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String platformName() {
|
||||
return "Fabric";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull WorldHandle getWorldHandle() {
|
||||
return worldHandle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull File getDataFolder() {
|
||||
return dataFolder.value();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ItemHandle getItemHandle() {
|
||||
return itemHandle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseAddon getPlatformAddon() {
|
||||
return new FabricAddon(this);
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
/*
|
||||
* This file is part of Terra.
|
||||
*
|
||||
* Terra 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.
|
||||
*
|
||||
* Terra 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 Terra. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Mixins that inject behavior into the client/server lifecycle.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.fabric.mixin.lifecycle;
|
@ -22,6 +22,7 @@
|
||||
},
|
||||
"mixins": [
|
||||
"terra.fabric.mixins.json",
|
||||
"terra.lifecycle.mixins.json",
|
||||
"terra.common.mixins.json"
|
||||
],
|
||||
"depends": {
|
||||
|
@ -4,15 +4,10 @@
|
||||
"package": "com.dfsek.terra.fabric.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"lifecycle.MinecraftServerMixin",
|
||||
"lifecycle.NoiseConfigMixin",
|
||||
"lifecycle.RegistryMixin"
|
||||
],
|
||||
"client": [
|
||||
"lifecycle.client.MinecraftClientMixin"
|
||||
],
|
||||
"server": [
|
||||
"lifecycle.server.ServerMainMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
|
@ -47,16 +47,16 @@ public class ForgeEntryPoint {
|
||||
|
||||
static {
|
||||
AwfulForgeHacks.loadAllTerraClasses();
|
||||
TERRA_PLUGIN = new PlatformImpl();
|
||||
TERRA_PLUGIN = new ForgePlatform();
|
||||
}
|
||||
|
||||
public static final String MODID = "terra";
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(ForgeEntryPoint.class);
|
||||
|
||||
private static final PlatformImpl TERRA_PLUGIN;
|
||||
private static final ForgePlatform TERRA_PLUGIN;
|
||||
|
||||
public static PlatformImpl getPlatform() {
|
||||
public static ForgePlatform getPlatform() {
|
||||
return TERRA_PLUGIN;
|
||||
}
|
||||
|
||||
|
@ -34,23 +34,17 @@ import java.util.List;
|
||||
|
||||
import com.dfsek.terra.addon.EphemeralAddon;
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.handle.ItemHandle;
|
||||
import com.dfsek.terra.api.handle.WorldHandle;
|
||||
import com.dfsek.terra.api.util.generic.Lazy;
|
||||
import com.dfsek.terra.mod.CommonPlatform;
|
||||
import com.dfsek.terra.mod.ModPlatform;
|
||||
import com.dfsek.terra.mod.generation.MinecraftChunkGeneratorWrapper;
|
||||
import com.dfsek.terra.mod.handle.MinecraftItemHandle;
|
||||
import com.dfsek.terra.mod.handle.MinecraftWorldHandle;
|
||||
|
||||
|
||||
public class PlatformImpl extends ModPlatform {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(PlatformImpl.class);
|
||||
private final ItemHandle itemHandle = new MinecraftItemHandle();
|
||||
private final WorldHandle worldHandle = new MinecraftWorldHandle();
|
||||
public class ForgePlatform extends ModPlatform {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ForgePlatform.class);
|
||||
private final Lazy<File> dataFolder = Lazy.lazy(() -> new File("./config/Terra"));
|
||||
|
||||
public PlatformImpl() {
|
||||
public ForgePlatform() {
|
||||
CommonPlatform.initialize(this);
|
||||
load();
|
||||
}
|
||||
@ -118,22 +112,11 @@ public class PlatformImpl extends ModPlatform {
|
||||
return "Forge";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull WorldHandle getWorldHandle() {
|
||||
return worldHandle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull File getDataFolder() {
|
||||
return dataFolder.value();
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ItemHandle getItemHandle() {
|
||||
return itemHandle;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BaseAddon getPlatformAddon() {
|
||||
return new ForgeAddon(this);
|
@ -1,4 +1,4 @@
|
||||
# mixin-common
|
||||
|
||||
This project contains mixins shared between Forge & Fabric, as
|
||||
This project contains mixins shared between Forge, Fabric and Quilt, as
|
||||
well as glue code.
|
@ -22,7 +22,7 @@ dependencies {
|
||||
}
|
||||
|
||||
architectury {
|
||||
common("fabric", "forge")
|
||||
common("fabric", "forge", "quilt")
|
||||
minecraft = Versions.Mod.minecraft
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,14 @@ import com.dfsek.tectonic.api.TypeRegistry;
|
||||
import com.dfsek.tectonic.api.depth.DepthTracker;
|
||||
import com.dfsek.tectonic.api.exception.LoadException;
|
||||
|
||||
import com.dfsek.terra.api.handle.ItemHandle;
|
||||
import com.dfsek.terra.api.handle.WorldHandle;
|
||||
import com.dfsek.terra.mod.config.SpawnSettingsTemplate;
|
||||
|
||||
import com.dfsek.terra.mod.handle.MinecraftItemHandle;
|
||||
|
||||
import com.dfsek.terra.mod.handle.MinecraftWorldHandle;
|
||||
|
||||
import com.dfsek.terra.mod.config.VillagerTypeTemplate;
|
||||
|
||||
import net.minecraft.entity.EntityType;
|
||||
@ -46,10 +52,15 @@ import com.dfsek.terra.mod.config.SpawnGroupTemplate;
|
||||
import com.dfsek.terra.mod.config.SpawnTypeConfig;
|
||||
import com.dfsek.terra.mod.util.PresetUtil;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
||||
public abstract class ModPlatform extends AbstractPlatform {
|
||||
public abstract MinecraftServer getServer();
|
||||
|
||||
private final ItemHandle itemHandle = new MinecraftItemHandle();
|
||||
private final WorldHandle worldHandle = new MinecraftWorldHandle();
|
||||
|
||||
public void registerWorldTypes(BiConsumer<Identifier, WorldPreset> registerFunction) {
|
||||
getRawConfigRegistry()
|
||||
.forEach(pack -> PresetUtil.createDefault(pack).apply(registerFunction));
|
||||
@ -97,4 +108,14 @@ public abstract class ModPlatform extends AbstractPlatform {
|
||||
}
|
||||
|
||||
protected abstract BaseAddon getPlatformAddon();
|
||||
|
||||
@Override
|
||||
public @NotNull WorldHandle getWorldHandle() {
|
||||
return worldHandle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull ItemHandle getItemHandle() {
|
||||
return itemHandle;
|
||||
}
|
||||
}
|
||||
|
3
platforms/mixin-lifecycle/README.md
Normal file
3
platforms/mixin-lifecycle/README.md
Normal file
@ -0,0 +1,3 @@
|
||||
# mixin-lifecycle
|
||||
|
||||
This project contains lifecycle mixins shared between Fabric and Quilt.
|
31
platforms/mixin-lifecycle/build.gradle.kts
Normal file
31
platforms/mixin-lifecycle/build.gradle.kts
Normal file
@ -0,0 +1,31 @@
|
||||
plugins {
|
||||
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
|
||||
id("architectury-plugin") version Versions.Mod.architectutyPlugin
|
||||
id("io.github.juuxel.loom-quiltflower") version Versions.Mod.loomQuiltflower
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath.set(project(":platforms:mixin-common").file("terra.accesswidener"))
|
||||
|
||||
mixin {
|
||||
defaultRefmapName.set("terra.lifecycle.refmap.json")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
|
||||
modImplementation("net.fabricmc:fabric-loader:${Versions.Mod.fabricLoader}")
|
||||
compileOnly("net.fabricmc:sponge-mixin:${Versions.Fabric.mixin}")
|
||||
|
||||
compileOnly(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
|
||||
|
||||
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
|
||||
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
|
||||
}
|
||||
|
||||
architectury {
|
||||
common("fabric", "quilt")
|
||||
minecraft = Versions.Mod.minecraft
|
||||
}
|
||||
|
@ -0,0 +1,88 @@
|
||||
package com.dfsek.terra.lifecycle;
|
||||
|
||||
import ca.solostudios.strata.Versions;
|
||||
import ca.solostudios.strata.parser.tokenizer.ParseException;
|
||||
import net.minecraft.MinecraftVersion;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import com.dfsek.terra.addon.EphemeralAddon;
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.lifecycle.util.BiomeUtil;
|
||||
import com.dfsek.terra.mod.CommonPlatform;
|
||||
import com.dfsek.terra.mod.ModPlatform;
|
||||
import com.dfsek.terra.mod.generation.MinecraftChunkGeneratorWrapper;
|
||||
|
||||
|
||||
public abstract class LifecyclePlatform extends ModPlatform {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(LifecyclePlatform.class);
|
||||
private static MinecraftServer server;
|
||||
|
||||
public LifecyclePlatform() {
|
||||
CommonPlatform.initialize(this);
|
||||
load();
|
||||
}
|
||||
|
||||
public static void setServer(MinecraftServer server) {
|
||||
LifecyclePlatform.server = server;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MinecraftServer getServer() {
|
||||
return server;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reload() {
|
||||
getTerraConfig().load(this);
|
||||
getRawConfigRegistry().clear();
|
||||
boolean succeed = getRawConfigRegistry().loadAll(this);
|
||||
|
||||
|
||||
if(server != null) {
|
||||
server.reloadResources(server.getDataPackManager().getNames()).exceptionally(throwable -> {
|
||||
LOGGER.warn("Failed to execute reload", throwable);
|
||||
return null;
|
||||
}).join();
|
||||
BiomeUtil.registerBiomes();
|
||||
server.getWorlds().forEach(world -> {
|
||||
if(world.getChunkManager().getChunkGenerator() instanceof MinecraftChunkGeneratorWrapper chunkGeneratorWrapper) {
|
||||
getConfigRegistry().get(chunkGeneratorWrapper.getPack().getRegistryKey()).ifPresent(pack -> {
|
||||
chunkGeneratorWrapper.setPack(pack);
|
||||
LOGGER.info("Replaced pack in chunk generator for world {}", world);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
return succeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterable<BaseAddon> platformAddon() {
|
||||
List<BaseAddon> addons = new ArrayList<>();
|
||||
|
||||
super.platformAddon().forEach(addons::add);
|
||||
|
||||
String mcVersion = MinecraftVersion.CURRENT.getReleaseTarget();
|
||||
try {
|
||||
addons.add(new EphemeralAddon(Versions.parseVersion(mcVersion), "minecraft"));
|
||||
} catch(ParseException e) {
|
||||
try {
|
||||
addons.add(new EphemeralAddon(Versions.parseVersion(mcVersion + ".0"), "minecraft"));
|
||||
} catch(ParseException ex) {
|
||||
LOGGER.warn("Failed to parse Minecraft version", e);
|
||||
}
|
||||
}
|
||||
|
||||
addons.addAll(getPlatformMods());
|
||||
|
||||
return addons;
|
||||
}
|
||||
|
||||
protected abstract Collection<BaseAddon> getPlatformMods();
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.fabric.mixin.lifecycle;
|
||||
package com.dfsek.terra.lifecycle.mixin;
|
||||
|
||||
import net.minecraft.util.math.noise.DoublePerlinNoiseSampler;
|
||||
import net.minecraft.util.registry.Registry;
|
@ -1,5 +1,6 @@
|
||||
package com.dfsek.terra.fabric.mixin.lifecycle;
|
||||
package com.dfsek.terra.lifecycle.mixin;
|
||||
|
||||
import com.dfsek.terra.lifecycle.util.RegistryUtil;
|
||||
|
||||
import net.minecraft.util.registry.Registry;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@ -7,14 +8,11 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import com.dfsek.terra.fabric.FabricEntryPoint;
|
||||
|
||||
|
||||
// Register Terra things to the builtin registries.
|
||||
@Mixin(Registry.class)
|
||||
public class RegistryMixin {
|
||||
@Inject(method = "<clinit>", at = @At("RETURN"))
|
||||
private static void registerTerraGenerators(CallbackInfo ci) {
|
||||
FabricEntryPoint.register();
|
||||
RegistryUtil.register();
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.fabric.mixin.lifecycle;
|
||||
package com.dfsek.terra.lifecycle.mixin.lifecycle;
|
||||
|
||||
import com.mojang.datafixers.DataFixer;
|
||||
import net.minecraft.resource.ResourcePackManager;
|
||||
@ -14,7 +14,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.net.Proxy;
|
||||
|
||||
import com.dfsek.terra.fabric.FabricEntryPoint;
|
||||
import com.dfsek.terra.lifecycle.LifecyclePlatform;
|
||||
|
||||
|
||||
@Mixin(MinecraftServer.class)
|
||||
@ -27,6 +27,6 @@ public class MinecraftServerMixin {
|
||||
private void injectConstructor(Thread serverThread, LevelStorage.Session session, ResourcePackManager dataPackManager,
|
||||
SaveLoader saveLoader, Proxy proxy, DataFixer dataFixer, ApiServices apiServices,
|
||||
WorldGenerationProgressListenerFactory worldGenerationProgressListenerFactory, CallbackInfo ci) {
|
||||
FabricEntryPoint.getPlatform().setServer((MinecraftServer) (Object) this);
|
||||
LifecyclePlatform.setServer((MinecraftServer) (Object) this);
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
* along with Terra. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.fabric.mixin.lifecycle.client;
|
||||
package com.dfsek.terra.lifecycle.mixin.lifecycle.client;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.RunArgs;
|
||||
@ -24,7 +24,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import com.dfsek.terra.fabric.FabricEntryPoint;
|
||||
import com.dfsek.terra.lifecycle.util.LifecycleUtil;
|
||||
|
||||
|
||||
@Mixin(MinecraftClient.class)
|
||||
@ -36,6 +36,6 @@ public class MinecraftClientMixin {
|
||||
// sorta arbitrary position, after mod init, before window opens
|
||||
shift = At.Shift.BEFORE))
|
||||
public void injectConstructor(RunArgs args, CallbackInfo callbackInfo) {
|
||||
FabricEntryPoint.initialize();
|
||||
LifecycleUtil.initialize();
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@
|
||||
* along with Terra. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.fabric.mixin.lifecycle.server;
|
||||
package com.dfsek.terra.lifecycle.mixin.lifecycle.server;
|
||||
|
||||
import net.minecraft.server.Main;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
@ -23,7 +23,7 @@ import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import com.dfsek.terra.fabric.FabricEntryPoint;
|
||||
import com.dfsek.terra.lifecycle.util.LifecycleUtil;
|
||||
|
||||
|
||||
@Mixin(Main.class)
|
||||
@ -35,6 +35,6 @@ public class ServerMainMixin {
|
||||
// after registry manager creation
|
||||
)
|
||||
private static void injectConstructor(String[] args, CallbackInfo ci) {
|
||||
FabricEntryPoint.initialize();
|
||||
LifecycleUtil.initialize();
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.fabric.util;
|
||||
package com.dfsek.terra.lifecycle.util;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
@ -11,7 +11,7 @@ import java.util.ArrayList;
|
||||
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.api.world.biome.Biome;
|
||||
import com.dfsek.terra.fabric.FabricEntryPoint;
|
||||
import com.dfsek.terra.mod.CommonPlatform;
|
||||
import com.dfsek.terra.mod.config.PreLoadCompatibilityOptions;
|
||||
import com.dfsek.terra.mod.config.ProtoPlatformBiome;
|
||||
import com.dfsek.terra.mod.util.MinecraftUtil;
|
||||
@ -26,7 +26,7 @@ public final class BiomeUtil {
|
||||
|
||||
public static void registerBiomes() {
|
||||
logger.info("Registering biomes...");
|
||||
FabricEntryPoint.getPlatform().getConfigRegistry().forEach(pack -> { // Register all Terra biomes.
|
||||
CommonPlatform.get().getConfigRegistry().forEach(pack -> { // Register all Terra biomes.
|
||||
pack.getCheckedRegistry(Biome.class)
|
||||
.forEach((id, biome) -> registerBiome(biome, pack, id));
|
||||
});
|
@ -0,0 +1,19 @@
|
||||
package com.dfsek.terra.lifecycle.util;
|
||||
|
||||
import com.dfsek.terra.api.event.events.platform.PlatformInitializationEvent;
|
||||
import com.dfsek.terra.mod.CommonPlatform;
|
||||
|
||||
import net.minecraft.util.registry.BuiltinRegistries;
|
||||
|
||||
|
||||
public final class LifecycleUtil {
|
||||
private LifecycleUtil() {
|
||||
|
||||
}
|
||||
|
||||
public static void initialize() {
|
||||
CommonPlatform.get().getEventManager().callEvent(new PlatformInitializationEvent());
|
||||
BiomeUtil.registerBiomes();
|
||||
CommonPlatform.get().registerWorldTypes((id, preset) -> BuiltinRegistries.add(BuiltinRegistries.WORLD_PRESET, id, preset));
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.dfsek.terra.lifecycle.util;
|
||||
|
||||
import com.dfsek.terra.mod.data.Codecs;
|
||||
|
||||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
|
||||
|
||||
public final class RegistryUtil {
|
||||
private RegistryUtil() {
|
||||
|
||||
}
|
||||
|
||||
public static void register() {
|
||||
Registry.register(Registry.CHUNK_GENERATOR, new Identifier("terra:terra"), Codecs.MINECRAFT_CHUNK_GENERATOR_WRAPPER);
|
||||
Registry.register(Registry.BIOME_SOURCE, new Identifier("terra:terra"), Codecs.TERRA_BIOME_SOURCE);
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.dfsek.terra.lifecycle.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
"NoiseConfigMixin",
|
||||
"RegistryMixin",
|
||||
"lifecycle.MinecraftServerMixin"
|
||||
],
|
||||
"client": [
|
||||
"lifecycle.client.MinecraftClientMixin"
|
||||
],
|
||||
"server": [
|
||||
"lifecycle.server.ServerMainMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
69
platforms/quilt/build.gradle.kts
Normal file
69
platforms/quilt/build.gradle.kts
Normal file
@ -0,0 +1,69 @@
|
||||
plugins {
|
||||
id("org.quiltmc.loom") version Versions.Quilt.loom
|
||||
id("architectury-plugin") version Versions.Mod.architectutyPlugin
|
||||
}
|
||||
|
||||
|
||||
configurations {
|
||||
val common by creating
|
||||
compileClasspath.get().extendsFrom(common)
|
||||
runtimeClasspath.get().extendsFrom(common)
|
||||
}
|
||||
|
||||
dependencies {
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
|
||||
"common"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
|
||||
shaded(project(path = ":platforms:mixin-common", configuration = "transformProductionQuilt")) { isTransitive = false }
|
||||
"common"(project(path = ":platforms:mixin-lifecycle", configuration = "namedElements")) { isTransitive = false }
|
||||
shaded(project(path = ":platforms:mixin-lifecycle", configuration = "transformProductionQuilt")) { isTransitive = false }
|
||||
|
||||
|
||||
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
|
||||
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
|
||||
|
||||
modImplementation("org.quiltmc:quilt-loader:${Versions.Quilt.quiltLoader}")
|
||||
|
||||
modApi("org.quiltmc.quilted-fabric-api:quilted-fabric-api:${Versions.Quilt.fabricApi}")
|
||||
|
||||
setOf(
|
||||
"fabric-lifecycle-events-v1",
|
||||
"fabric-resource-loader-v0",
|
||||
"fabric-api-base",
|
||||
"fabric-command-api-v2",
|
||||
"fabric-networking-api-v1"
|
||||
).forEach { apiModule ->
|
||||
val module = fabricApi.module(apiModule, Versions.Fabric.fabricAPI)
|
||||
modImplementation(module)
|
||||
include(module)
|
||||
}
|
||||
|
||||
modImplementation("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud)
|
||||
include("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud)
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath.set(project(":platforms:mixin-common").file("terra.accesswidener"))
|
||||
|
||||
mixin {
|
||||
defaultRefmapName.set("terra.quilt.refmap.json")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
addonDir(project.file("./run/config/Terra/addons"), tasks.named("configureLaunch").get())
|
||||
|
||||
tasks {
|
||||
compileJava {
|
||||
options.release.set(17)
|
||||
}
|
||||
|
||||
remapJar {
|
||||
inputFile.set(shadowJar.get().archiveFile)
|
||||
archiveFileName.set("${rootProject.name.capitalize()}-${project.version}.jar")
|
||||
}
|
||||
|
||||
processResources {
|
||||
from(project(":platforms:mixin-common").file("terra.accesswidener"))
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.dfsek.terra.quilt;
|
||||
|
||||
import com.dfsek.terra.mod.MinecraftAddon;
|
||||
import com.dfsek.terra.mod.ModPlatform;
|
||||
|
||||
public class QuiltAddon extends MinecraftAddon {
|
||||
|
||||
public QuiltAddon(ModPlatform modPlatform) {
|
||||
super(modPlatform);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getID() {
|
||||
return "terra-quilt";
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* This file is part of Terra.
|
||||
*
|
||||
* Terra 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.
|
||||
*
|
||||
* Terra 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 Terra. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.quilt;
|
||||
|
||||
import cloud.commandframework.execution.CommandExecutionCoordinator;
|
||||
import cloud.commandframework.fabric.FabricServerCommandManager;
|
||||
import net.minecraft.server.command.ServerCommandSource;
|
||||
import org.quiltmc.loader.api.ModContainer;
|
||||
import org.quiltmc.qsl.base.api.entrypoint.ModInitializer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.dfsek.terra.api.command.CommandSender;
|
||||
import com.dfsek.terra.api.event.events.platform.CommandRegistrationEvent;
|
||||
|
||||
|
||||
public class QuiltEntryPoint implements ModInitializer {
|
||||
private static final Logger logger = LoggerFactory.getLogger(QuiltEntryPoint.class);
|
||||
|
||||
private static final QuiltPlatform TERRA_PLUGIN = new QuiltPlatform();
|
||||
@Override
|
||||
public void onInitialize(ModContainer container) {
|
||||
logger.info("Initializing Terra Quilt mod...");
|
||||
|
||||
FabricServerCommandManager<CommandSender> manager = new FabricServerCommandManager<>(
|
||||
CommandExecutionCoordinator.simpleCoordinator(),
|
||||
serverCommandSource -> (CommandSender) serverCommandSource,
|
||||
commandSender -> (ServerCommandSource) commandSender
|
||||
);
|
||||
|
||||
|
||||
manager.brigadierManager().setNativeNumberSuggestions(false);
|
||||
|
||||
TERRA_PLUGIN.getEventManager().callEvent(new CommandRegistrationEvent(manager));
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* This file is part of Terra.
|
||||
*
|
||||
* Terra 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.
|
||||
*
|
||||
* Terra 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 Terra. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.quilt;
|
||||
|
||||
import ca.solostudios.strata.Versions;
|
||||
import ca.solostudios.strata.parser.tokenizer.ParseException;
|
||||
import ca.solostudios.strata.version.Version;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.quiltmc.loader.api.QuiltLoader;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.dfsek.terra.addon.EphemeralAddon;
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.api.util.generic.Lazy;
|
||||
import com.dfsek.terra.lifecycle.LifecyclePlatform;
|
||||
|
||||
|
||||
public class QuiltPlatform extends LifecyclePlatform {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(QuiltPlatform.class);
|
||||
|
||||
@Override
|
||||
protected Collection<BaseAddon> getPlatformMods() {
|
||||
return QuiltLoader.getAllMods().stream().flatMap(mod -> {
|
||||
String id = mod.metadata().id();
|
||||
if(id.equals("terra") || id.equals("minecraft") || id.equals("java")) return Stream.empty();
|
||||
try {
|
||||
Version version = Versions.parseVersion(mod.metadata().version().raw());
|
||||
return Stream.of(new EphemeralAddon(version, "quilt:" + id));
|
||||
} catch(ParseException e) {
|
||||
LOGGER.warn(
|
||||
"Mod {}, version {} does not follow semantic versioning specification, Terra addons will be unable to depend on " +
|
||||
"it.",
|
||||
id, mod.metadata().version().raw());
|
||||
}
|
||||
return Stream.empty();
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String platformName() {
|
||||
return "Quilt";
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull File getDataFolder() {
|
||||
return new File(QuiltLoader.getConfigDir().toFile(), "Terra");
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseAddon getPlatformAddon() {
|
||||
return new QuiltAddon(this);
|
||||
}
|
||||
}
|
BIN
platforms/quilt/src/main/resources/assets/terra/icon.png
Normal file
BIN
platforms/quilt/src/main/resources/assets/terra/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 127 KiB |
@ -0,0 +1,4 @@
|
||||
{
|
||||
"generator.terra": "Terra"
|
||||
}
|
||||
|
53
platforms/quilt/src/main/resources/quilt.mod.json
Normal file
53
platforms/quilt/src/main/resources/quilt.mod.json
Normal file
@ -0,0 +1,53 @@
|
||||
{
|
||||
"schema_version": 1,
|
||||
"quilt_loader": {
|
||||
"group": "com.dfsek",
|
||||
"id": "terra",
|
||||
"version": "@VERSION@",
|
||||
"metadata": {
|
||||
"name": "Terra",
|
||||
"description": "@DESCRIPTION@",
|
||||
"authors": [
|
||||
"dfsek"
|
||||
],
|
||||
"contact": {
|
||||
"homepage": "@WIKI@",
|
||||
"sources": "@SOURCE@",
|
||||
"issues": "@ISSUES@"
|
||||
},
|
||||
"license": "@LICENSE@",
|
||||
"icon": "assets/terra/icon.png"
|
||||
},
|
||||
"environment": "*",
|
||||
"intermediate_mappings": "net.fabricmc:intermediary",
|
||||
"entrypoints": {
|
||||
"init": [
|
||||
"com.dfsek.terra.quilt.QuiltEntryPoint"
|
||||
]
|
||||
},
|
||||
"depends": [
|
||||
{
|
||||
"id": "quilt_loader",
|
||||
"version": ">=0.17.0"
|
||||
},
|
||||
{
|
||||
"id": "java",
|
||||
"version": ">=17"
|
||||
},
|
||||
{
|
||||
"id": "minecraft",
|
||||
"version": "1.19.x"
|
||||
},
|
||||
{
|
||||
"id": "quilted_fabric_api",
|
||||
"versions": ">=2.0.0-"
|
||||
}
|
||||
]
|
||||
},
|
||||
"mixin": [
|
||||
"terra.quilt.mixins.json",
|
||||
"terra.lifecycle.mixins.json",
|
||||
"terra.common.mixins.json"
|
||||
],
|
||||
"accessWidener": "terra.accesswidener"
|
||||
}
|
15
platforms/quilt/src/main/resources/terra.quilt.mixins.json
Normal file
15
platforms/quilt/src/main/resources/terra.quilt.mixins.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.dfsek.terra.quilt.mixin",
|
||||
"compatibilityLevel": "JAVA_17",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
],
|
||||
"server": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
@ -28,11 +28,14 @@ pluginManagement {
|
||||
maven("https://maven.fabricmc.net") {
|
||||
name = "Fabric Maven"
|
||||
}
|
||||
maven ( "https://maven.architectury.dev/" ) {
|
||||
maven("https://maven.architectury.dev/") {
|
||||
name = "Architectury Maven"
|
||||
}
|
||||
maven ( "https://files.minecraftforge.net/maven/" ) {
|
||||
maven("https://files.minecraftforge.net/maven/") {
|
||||
name = "Forge Maven"
|
||||
}
|
||||
maven("https://maven.quiltmc.org/repository/release/") {
|
||||
name = "Quilt"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user