mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-03 06:16:10 +00:00
Retooled for neoforge
This commit is contained in:
@@ -39,9 +39,6 @@ fun Project.configureDependencies() {
|
||||
maven("https://repo.papermc.io/repository/maven-public/") {
|
||||
name = "PaperMC"
|
||||
}
|
||||
maven("https://files.minecraftforge.net/maven/") {
|
||||
name = "Forge"
|
||||
}
|
||||
maven("https://maven.quiltmc.org/repository/release/") {
|
||||
name = "Quilt"
|
||||
}
|
||||
@@ -51,6 +48,9 @@ fun Project.configureDependencies() {
|
||||
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") {
|
||||
name = "Sonatype Snapshots"
|
||||
}
|
||||
maven ("https://maven.neoforged.net/releases/") {
|
||||
name = "Neoforged"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
|
||||
@@ -9,8 +9,6 @@ object Versions {
|
||||
const val strata = "1.3.2"
|
||||
|
||||
const val cloud = "2.0.0"
|
||||
const val cloudPaper = "2.0.0-beta.10"
|
||||
const val cloudFabric = "2.0.0-beta.9"
|
||||
|
||||
const val caffeine = "3.1.8"
|
||||
|
||||
@@ -28,15 +26,6 @@ object Versions {
|
||||
}
|
||||
}
|
||||
|
||||
object Fabric {
|
||||
const val fabricAPI = "0.104.0+${Mod.minecraft}"
|
||||
}
|
||||
//
|
||||
// object Quilt {
|
||||
// const val quiltLoader = "0.20.2"
|
||||
// const val fabricApi = "7.3.1+0.89.3-1.20.1"
|
||||
// }
|
||||
|
||||
object Mod {
|
||||
const val mixin = "0.15.3+mixin.0.8.7"
|
||||
|
||||
@@ -47,11 +36,18 @@ object Versions {
|
||||
const val architecuryLoom = "1.7.413"
|
||||
const val architecturyPlugin = "3.4.159"
|
||||
}
|
||||
//
|
||||
// object Forge {
|
||||
// const val forge = "${Mod.minecraft}-48.0.13"
|
||||
// const val burningwave = "12.63.0"
|
||||
// }
|
||||
|
||||
object Fabric {
|
||||
const val cloud = "2.0.0-beta.9"
|
||||
const val fabricAPI = "0.104.0+${Mod.minecraft}"
|
||||
}
|
||||
|
||||
object NeoForge {
|
||||
const val cloud = "2.0.0-beta.9"
|
||||
const val neoForge = "21.1.56"
|
||||
const val burningwave = "12.65.2"
|
||||
const val yarnPatch = "1.21+build.4"
|
||||
}
|
||||
|
||||
object Bukkit {
|
||||
const val minecraft = "1.21.1"
|
||||
@@ -61,6 +57,7 @@ object Versions {
|
||||
const val reflectionRemapper = "0.1.1"
|
||||
const val paperDevBundle = paperBuild
|
||||
const val runPaper = "2.3.1"
|
||||
const val cloud = "2.0.0-beta.10"
|
||||
const val paperWeight = "1.7.2"
|
||||
}
|
||||
|
||||
|
||||
@@ -11,5 +11,5 @@ dependencies {
|
||||
|
||||
shadedApi("com.google.guava", "guava", Versions.Libraries.Internal.guava)
|
||||
|
||||
shadedApi("org.incendo", "cloud-paper", Versions.Libraries.cloudPaper)
|
||||
shadedApi("org.incendo", "cloud-paper", Versions.Bukkit.cloud)
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ plugins {
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
loader("fabric")
|
||||
fabric()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -21,13 +21,13 @@ dependencies {
|
||||
shaded(project(path = ":platforms:mixin-lifecycle", configuration = "transformProductionFabric")) { isTransitive = false }
|
||||
|
||||
|
||||
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
|
||||
minecraft("com.mojang", "minecraft", Versions.Mod.minecraft)
|
||||
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
|
||||
|
||||
modImplementation("net.fabricmc:fabric-loader:${Versions.Mod.fabricLoader}")
|
||||
modImplementation("net.fabricmc", "fabric-loader", Versions.Mod.fabricLoader)
|
||||
|
||||
modImplementation("org.incendo", "cloud-fabric", Versions.Libraries.cloudFabric)
|
||||
include("org.incendo", "cloud-fabric", Versions.Libraries.cloudFabric)
|
||||
modImplementation("org.incendo", "cloud-fabric", Versions.Fabric.cloud)
|
||||
include("org.incendo", "cloud-fabric", Versions.Fabric.cloud)
|
||||
|
||||
modRuntimeOnly("net.fabricmc.fabric-api", "fabric-api", Versions.Fabric.fabricAPI)
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
"fabricloader": ">=0.16.5",
|
||||
"java": ">=21",
|
||||
"minecraft": ">=1.20.6",
|
||||
"cloud": "*",
|
||||
"fabric": "*"
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
import java.util.*
|
||||
|
||||
plugins {
|
||||
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
|
||||
id("architectury-plugin") version Versions.Mod.architecturyPlugin
|
||||
id("io.github.juuxel.loom-vineflower") version Versions.Mod.loomVineflower
|
||||
}
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
loader("forge")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
|
||||
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
"forgeRuntimeLibrary"(project(":common:implementation:base"))
|
||||
|
||||
implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
|
||||
"developmentForge"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
|
||||
shaded(project(path = ":platforms:mixin-common", configuration = "transformProductionForge")) { isTransitive = false }
|
||||
|
||||
forge(group = "net.minecraftforge", name = "forge", version = Versions.Forge.forge)
|
||||
|
||||
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
|
||||
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
|
||||
|
||||
//forge is not ok.
|
||||
compileOnly("org.burningwave:core:${Versions.Forge.burningwave}")
|
||||
"forgeRuntimeLibrary"("org.burningwave:core:${Versions.Forge.burningwave}")
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath.set(project(":platforms:mixin-common").file("src/main/resources/terra.accesswidener"))
|
||||
|
||||
mixin {
|
||||
defaultRefmapName.set("terra.forge.refmap.json")
|
||||
}
|
||||
|
||||
// launches {
|
||||
// named("client") {
|
||||
// property("fabric.log.level", "info")
|
||||
// property("mixin.env.disableRefMap", "true")
|
||||
// }
|
||||
// named("server") {
|
||||
// property("fabric.log.level", "info")
|
||||
// property("mixin.env.disableRefMap", "true")
|
||||
// }
|
||||
// }
|
||||
|
||||
forge {
|
||||
convertAccessWideners.set(true)
|
||||
mixinConfig("terra.common.mixins.json")
|
||||
mixinConfig("terra.forge.mixins.json")
|
||||
extraAccessWideners.add(loom.accessWidenerPath.get().asFile.name)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
addonDir(project.file("./run/config/Terra/addons"), tasks.named("configureLaunch").get())
|
||||
|
||||
tasks {
|
||||
jar {
|
||||
manifest {
|
||||
attributes(
|
||||
mapOf(
|
||||
"Implementation-Title" to rootProject.name,
|
||||
"Implementation-Version" to project.version,
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
remapJar {
|
||||
inputFile.set(shadowJar.get().archiveFile)
|
||||
archiveFileName.set("${rootProject.name.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() }}-forge-${project.version}.jar")
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
loom.platform=forge
|
||||
@@ -23,7 +23,7 @@ dependencies {
|
||||
}
|
||||
|
||||
architectury {
|
||||
common("fabric")
|
||||
common("fabric", "neoforge")
|
||||
minecraft = Versions.Mod.minecraft
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ dependencies {
|
||||
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
|
||||
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
|
||||
|
||||
modImplementation("org.incendo", "cloud-fabric", Versions.Libraries.cloudFabric) {
|
||||
modImplementation("org.incendo", "cloud-fabric", Versions.Fabric.cloud) {
|
||||
exclude("net.fabricmc")
|
||||
exclude("net.fabricmc.fabric-api")
|
||||
}
|
||||
|
||||
69
platforms/neoforge/build.gradle.kts
Normal file
69
platforms/neoforge/build.gradle.kts
Normal file
@@ -0,0 +1,69 @@
|
||||
import java.util.*
|
||||
|
||||
plugins {
|
||||
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
|
||||
id("architectury-plugin") version Versions.Mod.architecturyPlugin
|
||||
}
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
neoForge()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
"forgeRuntimeLibrary"(project(":common:implementation:base"))
|
||||
|
||||
implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
|
||||
"developmentNeoForge"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
|
||||
shaded(project(path = ":platforms:mixin-common", configuration = "transformProductionNeoForge")) { isTransitive = false }
|
||||
|
||||
minecraft("com.mojang", "minecraft", Versions.Mod.minecraft)
|
||||
mappings(
|
||||
loom.layered {
|
||||
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")
|
||||
mappings("dev.architectury:yarn-mappings-patch-neoforge:${Versions.NeoForge.yarnPatch}")
|
||||
}
|
||||
)
|
||||
|
||||
neoForge("net.neoforged", "neoforge", Versions.NeoForge.neoForge)
|
||||
|
||||
modImplementation("org.incendo", "cloud-neoforge", Versions.NeoForge.cloud)
|
||||
include("org.incendo", "cloud-neoforge", Versions.NeoForge.cloud)
|
||||
|
||||
//forge is not ok.
|
||||
compileOnly("org.burningwave:core:${Versions.NeoForge.burningwave}")
|
||||
"forgeRuntimeLibrary"("org.burningwave:core:${Versions.NeoForge.burningwave}")
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath.set(project(":platforms:mixin-common").file("src/main/resources/terra.accesswidener"))
|
||||
|
||||
// mixin {
|
||||
// defaultRefmapName.set("terra.neoforge.refmap.json")
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
addonDir(project.file("./run/config/Terra/addons"), tasks.named("configureLaunch").get())
|
||||
|
||||
tasks {
|
||||
jar {
|
||||
manifest {
|
||||
attributes(
|
||||
mapOf(
|
||||
"Implementation-Title" to rootProject.name,
|
||||
"Implementation-Version" to project.version,
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
remapJar {
|
||||
dependsOn("installAddons")
|
||||
|
||||
injectAccessWidener.set(true)
|
||||
inputFile.set(shadowJar.get().archiveFile)
|
||||
archiveFileName.set("${rootProject.name.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() }}-neoforge-${project.version}.jar")
|
||||
}
|
||||
}
|
||||
1
platforms/neoforge/gradle.properties
Normal file
1
platforms/neoforge/gradle.properties
Normal file
@@ -0,0 +1 @@
|
||||
loom.platform=neoforge
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.forge;
|
||||
package com.dfsek.terra.neoforge;
|
||||
|
||||
import net.minecraftforge.fml.loading.FMLLoader;
|
||||
import org.burningwave.core.classes.Classes;
|
||||
@@ -67,7 +67,7 @@ public final class AwfulForgeHacks {
|
||||
try(JarFile jar = getTerraJar()) {
|
||||
jar.stream()
|
||||
.forEach(jarEntry -> {
|
||||
if(jarEntry.getName().startsWith("com/dfsek/terra/forge/mixin")
|
||||
if(jarEntry.getName().startsWith("com/dfsek/terra/neoforge/mixin")
|
||||
|| jarEntry.getName().startsWith("com/dfsek/terra/mod/mixin")) {
|
||||
return;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.forge;
|
||||
package com.dfsek.terra.neoforge;
|
||||
|
||||
import com.dfsek.terra.mod.MinecraftAddon;
|
||||
import com.dfsek.terra.mod.ModPlatform;
|
||||
@@ -15,7 +15,7 @@
|
||||
* along with Terra. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.forge;
|
||||
package com.dfsek.terra.neoforge;
|
||||
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.util.Identifier;
|
||||
@@ -34,9 +34,9 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.dfsek.terra.api.event.events.platform.PlatformInitializationEvent;
|
||||
import com.dfsek.terra.forge.AwfulForgeHacks.RegistrySanityCheck;
|
||||
import com.dfsek.terra.forge.AwfulForgeHacks.RegistryStep;
|
||||
import com.dfsek.terra.forge.util.BiomeUtil;
|
||||
import com.dfsek.terra.neoforge.AwfulForgeHacks.RegistrySanityCheck;
|
||||
import com.dfsek.terra.neoforge.AwfulForgeHacks.RegistryStep;
|
||||
import com.dfsek.terra.neoforge.util.BiomeUtil;
|
||||
import com.dfsek.terra.mod.data.Codecs;
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ public class ForgeEntryPoint {
|
||||
|
||||
|
||||
event.register(RegistryKeys.CHUNK_GENERATOR,
|
||||
helper -> helper.register(new Identifier("terra:terra"), Codecs.MINECRAFT_CHUNK_GENERATOR_WRAPPER));
|
||||
event.register(RegistryKeys.BIOME_SOURCE, helper -> helper.register(new Identifier("terra:terra"), Codecs.TERRA_BIOME_SOURCE));
|
||||
helper -> helper.register(Identifier.of("terra:terra"), Codecs.MINECRAFT_CHUNK_GENERATOR_WRAPPER));
|
||||
event.register(RegistryKeys.BIOME_SOURCE, helper -> helper.register(Identifier.of("terra:terra"), Codecs.TERRA_BIOME_SOURCE));
|
||||
}
|
||||
}
|
||||
@@ -15,12 +15,13 @@
|
||||
* along with Terra. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.forge;
|
||||
package com.dfsek.terra.neoforge;
|
||||
|
||||
import ca.solostudios.strata.Versions;
|
||||
import ca.solostudios.strata.parser.tokenizer.ParseException;
|
||||
import ca.solostudios.strata.version.Version;
|
||||
import net.minecraft.MinecraftVersion;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.registry.Registry;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
@@ -68,7 +69,7 @@ public class ForgePlatform extends ModPlatform {
|
||||
MinecraftServer server = getServer();
|
||||
|
||||
if(server != null) {
|
||||
server.reloadResources(server.getDataPackManager().getNames()).exceptionally(throwable -> {
|
||||
server.reloadResources(server.getDataPackManager().getEnabledIds()).exceptionally(throwable -> {
|
||||
LOGGER.warn("Failed to execute reload", throwable);
|
||||
return null;
|
||||
}).join();
|
||||
@@ -147,4 +148,9 @@ public class ForgePlatform extends ModPlatform {
|
||||
public Registry<MultiNoiseBiomeSourceParameterList> multiNoiseBiomeSourceParameterListRegistry() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Registry<Enchantment> enchantmentRegistry() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.forge.mixin.lifecycle;
|
||||
package com.dfsek.terra.neoforge.mixin.lifecycle;
|
||||
|
||||
import net.minecraft.registry.RegistryEntryLookup;
|
||||
import net.minecraft.util.math.noise.DoublePerlinNoiseSampler.NoiseParameters;
|
||||
@@ -19,4 +19,4 @@
|
||||
* Mixins that inject behavior into the client/server lifecycle.
|
||||
*/
|
||||
|
||||
package com.dfsek.terra.forge.mixin.lifecycle;
|
||||
package com.dfsek.terra.neoforge.mixin.lifecycle;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.forge.util;
|
||||
package com.dfsek.terra.neoforge.util;
|
||||
|
||||
import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
@@ -16,7 +16,7 @@ import java.util.Objects;
|
||||
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.api.world.biome.Biome;
|
||||
import com.dfsek.terra.forge.ForgeEntryPoint;
|
||||
import com.dfsek.terra.neoforge.ForgeEntryPoint;
|
||||
import com.dfsek.terra.mod.config.PreLoadCompatibilityOptions;
|
||||
import com.dfsek.terra.mod.config.ProtoPlatformBiome;
|
||||
import com.dfsek.terra.mod.config.VanillaBiomeProperties;
|
||||
@@ -66,7 +66,7 @@ public final class BiomeUtil {
|
||||
.value(),
|
||||
vanillaBiomeProperties);
|
||||
|
||||
Identifier identifier = new Identifier("terra", MinecraftUtil.createBiomeID(pack, id));
|
||||
Identifier identifier = Identifier.of("terra", MinecraftUtil.createBiomeID(pack, id));
|
||||
|
||||
if(ForgeRegistries.BIOMES.containsKey(identifier)) {
|
||||
((ProtoPlatformBiome) biome.getPlatformBiome()).setDelegate(ForgeRegistries.BIOMES.getHolder(identifier)
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.dfsek.terra.forge.mixin",
|
||||
"package": "com.dfsek.terra.neoforge.mixin",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [
|
||||
"lifecycle.NoiseConfigMixin"
|
||||
@@ -1,65 +0,0 @@
|
||||
plugins {
|
||||
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
|
||||
id("architectury-plugin") version Versions.Mod.architecturyPlugin
|
||||
id("io.github.juuxel.loom-vineflower") version Versions.Mod.loomVineflower
|
||||
}
|
||||
|
||||
architectury {
|
||||
platformSetupLoomIde()
|
||||
loader("quilt")
|
||||
}
|
||||
|
||||
dependencies {
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
|
||||
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
|
||||
|
||||
|
||||
implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
|
||||
"developmentQuilt"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }
|
||||
shaded(project(path = ":platforms:mixin-common", configuration = "transformProductionQuilt")) { isTransitive = false }
|
||||
|
||||
implementation(project(path = ":platforms:mixin-lifecycle", configuration = "namedElements")) { isTransitive = false }
|
||||
"developmentQuilt"(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}")
|
||||
|
||||
modImplementation("org.quiltmc.quilted-fabric-api:quilted-fabric-api:${Versions.Quilt.fabricApi}")
|
||||
|
||||
modImplementation("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud) {
|
||||
exclude("net.fabricmc")
|
||||
exclude("net.fabricmc.fabric-api")
|
||||
}
|
||||
include("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud) {
|
||||
exclude("net.fabricmc")
|
||||
exclude("net.fabricmc.fabric-api")
|
||||
}
|
||||
}
|
||||
|
||||
loom {
|
||||
accessWidenerPath.set(project(":platforms:mixin-common").file("src/main/resources/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 {
|
||||
injectAccessWidener.set(true)
|
||||
inputFile.set(shadowJar.get().archiveFile)
|
||||
archiveFileName.set("${rootProject.name.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() })}-quilt-${project.version}.jar")
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
loom.platform=quilt
|
||||
@@ -1,44 +0,0 @@
|
||||
package com.dfsek.terra.quilt;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
|
||||
|
||||
/**
|
||||
* So you want to Mixin into Authlib/Brigadier/DataFixerUpper, on Fabric you'll need this guy.
|
||||
*
|
||||
* <p>YOU SHOULD ONLY USE THIS CLASS DURING "preLaunch" and ONLY TARGET A CLASS WHICH IS NOT ANY CLASS YOU MIXIN TO.
|
||||
* <p>
|
||||
* This will likely not work on Gson because FabricLoader has some special logic related to Gson.
|
||||
*/
|
||||
public final class AwfulQuiltHacks {
|
||||
private static final ClassLoader KNOT_CLASSLOADER = Thread.currentThread().getContextClassLoader();
|
||||
private static final Method ADD_URL_METHOD;
|
||||
static {
|
||||
Method tempAddUrlMethod = null;
|
||||
try {
|
||||
tempAddUrlMethod = KNOT_CLASSLOADER.getClass().getMethod("addURL", URL.class);
|
||||
tempAddUrlMethod.setAccessible(true);
|
||||
} catch(ReflectiveOperationException e) {
|
||||
throw new RuntimeException("Failed to load Classloader fields", e);
|
||||
}
|
||||
|
||||
ADD_URL_METHOD = tempAddUrlMethod;
|
||||
}
|
||||
|
||||
private AwfulQuiltHacks() { }
|
||||
|
||||
/**
|
||||
* Hackily load the package which a mixin may exist within.
|
||||
* <p>
|
||||
* YOU SHOULD NOT TARGET A CLASS WHICH YOU MIXIN TO.
|
||||
*
|
||||
* @param pathOfAClass The path of any class within the package.
|
||||
*/
|
||||
public static void hackilyLoadForMixin(String pathOfAClass)
|
||||
throws ClassNotFoundException, InvocationTargetException, IllegalAccessException {
|
||||
URL url = Class.forName(pathOfAClass).getProtectionDomain().getCodeSource().getLocation();
|
||||
ADD_URL_METHOD.invoke(KNOT_CLASSLOADER, url);
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
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";
|
||||
}
|
||||
}
|
||||
@@ -1,33 +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.quilt;
|
||||
|
||||
import org.quiltmc.loader.api.ModContainer;
|
||||
import org.quiltmc.qsl.base.api.entrypoint.ModInitializer;
|
||||
|
||||
import com.dfsek.terra.lifecycle.LifecycleEntryPoint;
|
||||
|
||||
|
||||
public class QuiltEntryPoint extends LifecycleEntryPoint implements ModInitializer {
|
||||
private static final QuiltPlatform TERRA_PLUGIN = new QuiltPlatform();
|
||||
|
||||
@Override
|
||||
public void onInitialize(ModContainer container) {
|
||||
initialize("Quilt", TERRA_PLUGIN);
|
||||
}
|
||||
}
|
||||
@@ -1,56 +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.quilt;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.quiltmc.loader.api.QuiltLoader;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.dfsek.terra.api.addon.BaseAddon;
|
||||
import com.dfsek.terra.lifecycle.LifecyclePlatform;
|
||||
|
||||
|
||||
public class QuiltPlatform extends LifecyclePlatform {
|
||||
|
||||
@Override
|
||||
protected Collection<BaseAddon> getPlatformMods() {
|
||||
return QuiltLoader.getAllMods()
|
||||
.stream()
|
||||
.flatMap(mod -> parseModData(mod.metadata().id(), mod.metadata().version().raw(), "quilt"))
|
||||
.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);
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.dfsek.terra.quilt;
|
||||
|
||||
import cloud.commandframework.brigadier.BrigadierMappingBuilder;
|
||||
import org.quiltmc.loader.api.ModContainer;
|
||||
import org.quiltmc.loader.api.QuiltLoader;
|
||||
import org.quiltmc.loader.api.entrypoint.PreLaunchEntrypoint;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
|
||||
public class QuiltPreLaunchEntryPoint implements PreLaunchEntrypoint {
|
||||
@Override
|
||||
public void onPreLaunch(ModContainer mod) {
|
||||
if(QuiltLoader.isDevelopmentEnvironment()) {
|
||||
try {
|
||||
AwfulQuiltHacks.hackilyLoadForMixin(BrigadierMappingBuilder.class.getName());
|
||||
} catch(ClassNotFoundException | InvocationTargetException | IllegalAccessException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 127 KiB |
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"generator.terra": "Terra"
|
||||
}
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
{
|
||||
"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"
|
||||
],
|
||||
"pre_launch": [
|
||||
"com.dfsek.terra.quilt.QuiltPreLaunchEntryPoint"
|
||||
]
|
||||
},
|
||||
"depends": [
|
||||
{
|
||||
"id": "quilt_loader",
|
||||
"version": ">=0.17.0"
|
||||
},
|
||||
{
|
||||
"id": "java",
|
||||
"version": ">=17"
|
||||
},
|
||||
{
|
||||
"id": "minecraft",
|
||||
"version": "1.20.x"
|
||||
},
|
||||
{
|
||||
"id": "quilted_fabric_api",
|
||||
"versions": ">=2.0.0-"
|
||||
}
|
||||
]
|
||||
},
|
||||
"mixin": [
|
||||
"terra.quilt.mixins.json",
|
||||
"terra.lifecycle.mixins.json",
|
||||
"terra.common.mixins.json"
|
||||
]
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"required": true,
|
||||
"minVersion": "0.8",
|
||||
"package": "com.dfsek.terra.quilt.mixin",
|
||||
"compatibilityLevel": "JAVA_21",
|
||||
"mixins": [
|
||||
],
|
||||
"client": [
|
||||
],
|
||||
"server": [
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": 1
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user