mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-01 15:37:24 +00:00
commit
b2e21d8b70
@ -6,6 +6,12 @@ plugins {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.solo-studios.ca/releases") {
|
||||
name = "Solo Studios"
|
||||
}
|
||||
maven("https://maven.solo-studios.ca/snapshots") {
|
||||
name = "Solo Studios"
|
||||
}
|
||||
maven("https://repo.codemc.org/repository/maven-public") {
|
||||
name = "CodeMC"
|
||||
}
|
||||
|
@ -30,6 +30,12 @@ fun Project.configureDependencies() {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.solo-studios.ca/releases") {
|
||||
name = "Solo Studios"
|
||||
}
|
||||
maven("https://maven.solo-studios.ca/snapshots") {
|
||||
name = "Solo Studios"
|
||||
}
|
||||
maven("https://maven.fabricmc.net/") {
|
||||
name = "FabricMC"
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ object Versions {
|
||||
|
||||
const val cloud = "2.0.0"
|
||||
|
||||
const val caffeine = "3.2.0"
|
||||
const val caffeine = "3.2.1"
|
||||
|
||||
const val slf4j = "2.0.17"
|
||||
|
||||
@ -22,13 +22,13 @@ object Versions {
|
||||
const val asm = "9.8"
|
||||
const val snakeYml = "2.4"
|
||||
const val jetBrainsAnnotations = "26.0.2"
|
||||
const val junit = "5.13.0"
|
||||
const val junit = "5.13.1"
|
||||
const val nbt = "6.1"
|
||||
}
|
||||
}
|
||||
|
||||
object Fabric {
|
||||
const val fabricAPI = "0.125.3+${Mod.minecraft}"
|
||||
const val fabricAPI = "0.127.0+${Mod.minecraft}"
|
||||
const val cloud = "2.0.0-beta.10"
|
||||
}
|
||||
//
|
||||
@ -39,8 +39,9 @@ object Versions {
|
||||
|
||||
object Mod {
|
||||
const val mixin = "0.15.5+mixin.0.8.7"
|
||||
const val mixinExtras = "0.4.1"
|
||||
|
||||
const val minecraft = "1.21.5"
|
||||
const val minecraft = "1.21.6"
|
||||
const val yarn = "$minecraft+build.1"
|
||||
const val fabricLoader = "0.16.14"
|
||||
|
||||
@ -55,18 +56,18 @@ object Versions {
|
||||
// }
|
||||
|
||||
object Bukkit {
|
||||
const val minecraft = "1.21.5-R0.1"
|
||||
const val paperBuild = "$minecraft-20250529.121722-14"
|
||||
const val minecraft = "1.21.6-R0.1"
|
||||
const val paperBuild = "$minecraft-20250617.170821-8"
|
||||
const val paper = paperBuild
|
||||
const val paperLib = "1.0.8"
|
||||
const val reflectionRemapper = "0.1.2"
|
||||
const val paperDevBundle = "$minecraft-20250529.121722-99"
|
||||
const val paperDevBundle = paperBuild
|
||||
const val runPaper = "2.3.1"
|
||||
const val paperWeight = "2.0.0-beta.17"
|
||||
const val cloud = "2.0.0-beta.10"
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
// object Sponge {
|
||||
// const val sponge = "9.0.0-SNAPSHOT"
|
||||
// const val mixin = "0.8.2"
|
||||
|
@ -1,10 +1,14 @@
|
||||
plugins {
|
||||
id("io.papermc.paperweight.userdev")
|
||||
id("xyz.jpenilla.run-paper") version Versions.Bukkit.runPaper
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Required for :platforms:bukkit:runDevBundleServer task
|
||||
paperweight.paperDevBundle(Versions.Bukkit.paperDevBundle)
|
||||
|
||||
shaded(project(":platforms:bukkit:common"))
|
||||
shaded(project(":platforms:bukkit:nms:v1_21_5", configuration = "reobf"))
|
||||
shaded(project(":platforms:bukkit:nms:v1_21_6"))
|
||||
shaded("xyz.jpenilla", "reflection-remapper", Versions.Bukkit.reflectionRemapper)
|
||||
}
|
||||
|
||||
|
@ -54,6 +54,10 @@ public interface Initializer {
|
||||
private static Initializer constructInitializer() {
|
||||
try {
|
||||
String packageVersion = NMS;
|
||||
if (NMS.equals("v1_21_5")) {
|
||||
packageVersion = "v1_21_6";
|
||||
}
|
||||
|
||||
Class<?> initializerClass = Class.forName(TERRA_PACKAGE + "." + packageVersion + ".NMSInitializer");
|
||||
try {
|
||||
return (Initializer) initializerClass.getConstructor().newInstance();
|
||||
|
@ -6,10 +6,4 @@ dependencies {
|
||||
api(project(":platforms:bukkit:common"))
|
||||
paperweight.paperDevBundle(Versions.Bukkit.paperDevBundle)
|
||||
implementation("xyz.jpenilla", "reflection-remapper", Versions.Bukkit.reflectionRemapper)
|
||||
}
|
||||
|
||||
tasks {
|
||||
assemble {
|
||||
dependsOn("reobfJar")
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_5.config.VanillaBiomeProperties;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_6.config.VanillaBiomeProperties;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Holder.Reference;
|
@ -1,11 +1,11 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
|
||||
import com.dfsek.terra.api.event.events.config.ConfigurationLoadEvent;
|
||||
import com.dfsek.terra.api.event.functional.FunctionalEventHandler;
|
||||
import com.dfsek.terra.api.world.biome.Biome;
|
||||
import com.dfsek.terra.bukkit.BukkitAddon;
|
||||
import com.dfsek.terra.bukkit.PlatformImpl;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_5.config.VanillaBiomeProperties;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_6.config.VanillaBiomeProperties;
|
||||
|
||||
|
||||
public class NMSAddon extends BukkitAddon {
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.biome.Biome;
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
@ -12,7 +12,7 @@ import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.dfsek.terra.api.config.ConfigPack;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_5.config.VanillaBiomeProperties;
|
||||
import com.dfsek.terra.bukkit.nms.v1_21_6.config.VanillaBiomeProperties;
|
||||
|
||||
|
||||
public class NMSBiomeInjector {
|
||||
@ -33,9 +33,8 @@ public class NMSBiomeInjector {
|
||||
.waterColor(Objects.requireNonNullElse(vanillaBiomeProperties.getWaterColor(), vanilla.getWaterColor()))
|
||||
.waterFogColor(Objects.requireNonNullElse(vanillaBiomeProperties.getWaterFogColor(), vanilla.getWaterFogColor()))
|
||||
.skyColor(Objects.requireNonNullElse(vanillaBiomeProperties.getSkyColor(), vanilla.getSkyColor()))
|
||||
.grassColorModifier(Objects.requireNonNullElse(vanillaBiomeProperties.getGrassColorModifier(), vanilla.getSpecialEffects().getGrassColorModifier()));
|
||||
// .grassColorOverride(Objects.requireNonNullElse(vanillaBiomeProperties.getGrassColor(), vanilla.getSpecialEffects().getGrassColorOverride().orElseGet(() -> Reflection.BIOME.invokeGrassColorFromTexture(vanilla))))
|
||||
// .foliageColorOverride(Objects.requireNonNullElse(vanillaBiomeProperties.getFoliageColor(), vanilla.getFoliageColor()));
|
||||
.grassColorModifier(Objects.requireNonNullElse(vanillaBiomeProperties.getGrassColorModifier(), vanilla.getSpecialEffects().getGrassColorModifier()))
|
||||
.backgroundMusicVolume(Objects.requireNonNullElse(vanillaBiomeProperties.getMusicVolume(), vanilla.getBackgroundMusicVolume()));
|
||||
|
||||
if(vanillaBiomeProperties.getGrassColor() == null) {
|
||||
vanilla.getSpecialEffects().getGrassColorOverride().ifPresent(effects::grassColorOverride);
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.core.Holder;
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import net.minecraft.core.BlockPos;
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
|
||||
import com.dfsek.terra.bukkit.BukkitAddon;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
|
||||
import net.minecraft.server.level.ChunkMap;
|
||||
import net.minecraft.server.level.ServerLevel;
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
|
||||
import net.minecraft.world.level.LevelHeightAccessor;
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Holder.Reference;
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6;
|
||||
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.Registries;
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.ConfigTemplate;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
@ -38,6 +38,10 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
@Default
|
||||
private Integer foliageColor = null;
|
||||
|
||||
@Value("colors.dry-foliage")
|
||||
@Default
|
||||
private Integer dryFoliageColor = null;
|
||||
|
||||
@Value("colors.sky")
|
||||
@Default
|
||||
private Integer skyColor = null;
|
||||
@ -82,6 +86,10 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
@Default
|
||||
private Music music = null;
|
||||
|
||||
@Value("sound.music-volume")
|
||||
@Default
|
||||
private Float musicVolume = null;
|
||||
|
||||
@Value("spawning")
|
||||
@Default
|
||||
private MobSpawnSettings spawnSettings = null;
|
||||
@ -98,6 +106,10 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
return foliageColor;
|
||||
}
|
||||
|
||||
public Integer getDryFoliageColor() {
|
||||
return dryFoliageColor;
|
||||
}
|
||||
|
||||
public Integer getGrassColor() {
|
||||
return grassColor;
|
||||
}
|
||||
@ -154,6 +166,10 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
return music;
|
||||
}
|
||||
|
||||
public Float getMusicVolume() {
|
||||
return musicVolume;
|
||||
}
|
||||
|
||||
public MobSpawnSettings getSpawnSettings() {
|
||||
return spawnSettings;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_5.config;
|
||||
package com.dfsek.terra.bukkit.nms.v1_21_6.config;
|
||||
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
||||
import com.dfsek.tectonic.api.config.template.annotations.Value;
|
@ -26,7 +26,9 @@ dependencies {
|
||||
|
||||
modImplementation("net.fabricmc:fabric-loader:${Versions.Mod.fabricLoader}")
|
||||
|
||||
modImplementation("org.incendo", "cloud-fabric", Versions.Fabric.cloud)
|
||||
modImplementation("org.incendo", "cloud-fabric", Versions.Fabric.cloud) {
|
||||
exclude("me.lucko", "fabric-permissions-api")
|
||||
}
|
||||
include("org.incendo", "cloud-fabric", Versions.Fabric.cloud)
|
||||
|
||||
modRuntimeOnly("net.fabricmc.fabric-api", "fabric-api", Versions.Fabric.fabricAPI)
|
||||
|
@ -38,6 +38,10 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
@Default
|
||||
private Integer foliageColor = null;
|
||||
|
||||
@Value("colors.dry-foliage")
|
||||
@Default
|
||||
private Integer dryFoliageColor = null;
|
||||
|
||||
@Value("colors.sky")
|
||||
@Default
|
||||
private Integer skyColor = null;
|
||||
@ -82,6 +86,10 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
@Default
|
||||
private MusicSound music = null;
|
||||
|
||||
@Value("sound.music-volume")
|
||||
@Default
|
||||
private Float musicVolume = null;
|
||||
|
||||
@Value("spawning")
|
||||
@Default
|
||||
private SpawnSettings spawnSettings = null;
|
||||
@ -111,6 +119,10 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
return foliageColor;
|
||||
}
|
||||
|
||||
public Integer getDryFoliageColor() {
|
||||
return dryFoliageColor;
|
||||
}
|
||||
|
||||
public Integer getSkyColor() {
|
||||
return skyColor;
|
||||
}
|
||||
@ -155,6 +167,10 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
|
||||
return music;
|
||||
}
|
||||
|
||||
public Float getMusicVolume() {
|
||||
return musicVolume;
|
||||
}
|
||||
|
||||
public SpawnSettings getSpawnSettings() {
|
||||
return spawnSettings;
|
||||
}
|
||||
|
@ -1,28 +0,0 @@
|
||||
package com.dfsek.terra.mod.mixin.fix;
|
||||
|
||||
import net.minecraft.entity.passive.BeeEntity.MoveToFlowerGoal;
|
||||
import net.minecraft.entity.passive.BeeEntity.MoveToHiveGoal;
|
||||
import net.minecraft.util.math.random.CheckedRandom;
|
||||
import net.minecraft.util.math.random.Random;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import com.dfsek.terra.mod.CommonPlatform;
|
||||
|
||||
|
||||
/**
|
||||
* Bees spawning uses world.random without synchronization. This causes issues when spawning bees during world generation.
|
||||
*/
|
||||
@Mixin({
|
||||
MoveToHiveGoal.class,
|
||||
MoveToFlowerGoal.class
|
||||
})
|
||||
public class BeeMoveGoalsUnsynchronizedRandomAccessFix {
|
||||
@Redirect(method = "<init>",
|
||||
at = @At(value = "FIELD", target = "Lnet/minecraft/world/World;random:Lnet/minecraft/util/math/random/Random;"))
|
||||
public Random redirectRandomAccess(World instance) {
|
||||
return new CheckedRandom(CommonPlatform.get().getServer().getTicks()); // replace with new random seeded by tick time.
|
||||
}
|
||||
}
|
@ -35,9 +35,25 @@ public class BiomeUtil {
|
||||
.skyColor(Objects.requireNonNullElse(vanillaBiomeProperties.getSkyColor(), vanilla.getSkyColor()))
|
||||
.grassColorModifier(
|
||||
Objects.requireNonNullElse(vanillaBiomeProperties.getGrassColorModifier(), vanilla.getEffects().getGrassColorModifier()))
|
||||
.grassColor(Objects.requireNonNullElse(vanillaBiomeProperties.getGrassColor(),
|
||||
vanilla.getEffects().getGrassColor().orElseGet(() -> ((BiomeInvoker) ((Object) vanilla)).invokeGetDefaultGrassColor())))
|
||||
.foliageColor(Objects.requireNonNullElse(vanillaBiomeProperties.getFoliageColor(), vanilla.getFoliageColor()));
|
||||
.musicVolume(Objects.requireNonNullElse(vanillaBiomeProperties.getMusicVolume(), vanilla.getMusicVolume()));
|
||||
|
||||
if(vanillaBiomeProperties.getGrassColor() == null) {
|
||||
vanilla.getEffects().getGrassColor().ifPresent(effects::grassColor);
|
||||
} else {
|
||||
effects.grassColor(vanillaBiomeProperties.getGrassColor());
|
||||
}
|
||||
|
||||
if(vanillaBiomeProperties.getFoliageColor() == null) {
|
||||
vanilla.getEffects().getFoliageColor().ifPresent(effects::foliageColor);
|
||||
} else {
|
||||
effects.foliageColor(vanillaBiomeProperties.getFoliageColor());
|
||||
}
|
||||
|
||||
if(vanillaBiomeProperties.getDryFoliageColor() == null) {
|
||||
vanilla.getEffects().getDryFoliageColor().ifPresent(effects::dryFoliageColor);
|
||||
} else {
|
||||
effects.dryFoliageColor(vanillaBiomeProperties.getDryFoliageColor());
|
||||
}
|
||||
|
||||
if(vanillaBiomeProperties.getParticleConfig() == null) {
|
||||
vanilla.getEffects().getParticleConfig().ifPresent(effects::particleConfig);
|
||||
|
@ -9,7 +9,6 @@
|
||||
"access.StateAccessor",
|
||||
"access.StructureAccessorAccessor",
|
||||
"access.VillagerTypeAccessor",
|
||||
"fix.BeeMoveGoalsUnsynchronizedRandomAccessFix",
|
||||
"fix.NetherFossilOptimization",
|
||||
"implementations.compat.GenerationSettingsFloraFeaturesMixin",
|
||||
"implementations.terra.BiomeMixin",
|
||||
|
@ -7,6 +7,7 @@ dependencies {
|
||||
shadedApi(project(":common:implementation:base"))
|
||||
|
||||
compileOnly("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
compileOnly("io.github.llamalad7:mixinextras-common:${Versions.Mod.mixinExtras}")
|
||||
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
|
||||
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
|
||||
|
||||
@ -18,6 +19,7 @@ dependencies {
|
||||
modImplementation("org.incendo", "cloud-fabric", Versions.Fabric.cloud) {
|
||||
exclude("net.fabricmc")
|
||||
exclude("net.fabricmc.fabric-api")
|
||||
exclude("me.lucko", "fabric-permissions-api")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ public abstract class LifecyclePlatform extends ModPlatform {
|
||||
|
||||
super.platformAddon().forEach(addons::add);
|
||||
|
||||
String mcVersion = MinecraftVersion.CURRENT.getName();
|
||||
String mcVersion = MinecraftVersion.CURRENT.name();
|
||||
try {
|
||||
addons.add(new EphemeralAddon(Versions.parseVersion(mcVersion), "minecraft"));
|
||||
} catch(ParseException e) {
|
||||
|
@ -1,27 +0,0 @@
|
||||
package com.dfsek.terra.lifecycle.mixin.lifecycle;
|
||||
|
||||
|
||||
import com.dfsek.terra.api.Platform;
|
||||
|
||||
import com.dfsek.terra.mod.CommonPlatform;
|
||||
|
||||
import com.dfsek.terra.mod.ModPlatform;
|
||||
|
||||
import net.minecraft.client.gui.screen.world.CreateWorldScreen;
|
||||
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;
|
||||
|
||||
import static com.dfsek.terra.lifecycle.util.LifecycleUtil.initialized;
|
||||
|
||||
|
||||
@Mixin(CreateWorldScreen.class)
|
||||
public class CreateWorldScreenMixin {
|
||||
@Inject(method = "onCloseScreen()V", at = @At("HEAD"))
|
||||
public void onClose(CallbackInfo ci) {
|
||||
ModPlatform platform = CommonPlatform.get();
|
||||
platform.getRawConfigRegistry().clear();
|
||||
initialized = false;
|
||||
}
|
||||
}
|
@ -34,11 +34,4 @@ public class MinecraftServerMixin {
|
||||
WorldGenerationProgressListenerFactory worldGenerationProgressListenerFactory, CallbackInfo ci) {
|
||||
LifecyclePlatform.setServer((MinecraftServer) (Object) this);
|
||||
}
|
||||
|
||||
@Inject(method = "shutdown()V", at = @At("RETURN"))
|
||||
private void injectShutdown(CallbackInfo ci) {
|
||||
ModPlatform platform = CommonPlatform.get();
|
||||
platform.getRawConfigRegistry().clear();
|
||||
initialized = false;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
package com.dfsek.terra.lifecycle.mixin.lifecycle;
|
||||
|
||||
import com.dfsek.terra.mod.CommonPlatform;
|
||||
import com.dfsek.terra.mod.ModPlatform;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.registry.MutableRegistry;
|
||||
import net.minecraft.registry.Registry;
|
||||
@ -7,6 +10,7 @@ import net.minecraft.registry.RegistryKey;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.RegistryLoader;
|
||||
import net.minecraft.registry.RegistryLoader.Loader;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import net.minecraft.world.biome.Biome;
|
||||
import net.minecraft.world.biome.source.MultiNoiseBiomeSourceParameterList;
|
||||
import net.minecraft.world.dimension.DimensionType;
|
||||
@ -18,10 +22,27 @@ import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Coerce;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import com.llamalad7.mixinextras.sugar.Local;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Coerce;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.registry.DynamicRegistryManager;
|
||||
import net.minecraft.registry.RegistryKeys;
|
||||
import net.minecraft.registry.RegistryLoader;
|
||||
import net.minecraft.registry.RegistryWrapper;
|
||||
import net.minecraft.resource.ResourceManager;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import com.dfsek.terra.lifecycle.LifecyclePlatform;
|
||||
@ -38,31 +59,39 @@ public class RegistryLoaderMixin {
|
||||
@Final
|
||||
private static Logger LOGGER;
|
||||
|
||||
@Redirect(
|
||||
@Unique
|
||||
private static final AtomicBoolean LOADING_DYNAMIC_REGISTRIES = new AtomicBoolean(false);
|
||||
|
||||
@Inject(method = "loadFromResource(Lnet/minecraft/resource/ResourceManager;Ljava/util/List;Ljava/util/List;)Lnet/minecraft/registry/DynamicRegistryManager$Immutable;", at = @At("HEAD"))
|
||||
private static void loadFromResources(ResourceManager resourceManager, List<RegistryWrapper.Impl<?>> registries, List<RegistryLoader.Entry<?>> entries, CallbackInfoReturnable<DynamicRegistryManager.Immutable> cir) {
|
||||
LOADING_DYNAMIC_REGISTRIES.set(entries.stream().anyMatch(entry -> entry.key() == RegistryKeys.BIOME));
|
||||
}
|
||||
|
||||
@Inject(
|
||||
method = "load(Lnet/minecraft/registry/RegistryLoader$RegistryLoadable;Ljava/util/List;Ljava/util/List;)Lnet/minecraft/registry/DynamicRegistryManager$Immutable;",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Ljava/util/List;forEach(Ljava/util/function/Consumer;)V",
|
||||
ordinal = 1 // we want right after the first forEach
|
||||
)
|
||||
ordinal = 1
|
||||
)
|
||||
)
|
||||
private static void grabManager(List<RegistryLoader.Loader<?>> instance, Consumer<? super Loader<?>> consumer) {
|
||||
if(!initialized) {
|
||||
MutableRegistry<Biome> biomes = extractRegistry(instance, RegistryKeys.BIOME).orElseThrow();
|
||||
MutableRegistry<DimensionType> dimensionTypes = extractRegistry(instance, RegistryKeys.DIMENSION_TYPE).orElseThrow();
|
||||
MutableRegistry<WorldPreset> worldPresets = extractRegistry(instance, RegistryKeys.WORLD_PRESET).orElseThrow();
|
||||
MutableRegistry<ChunkGeneratorSettings> chunkGeneratorSettings = extractRegistry(instance,
|
||||
private static void beforeFreeze(@Coerce Object loadable, List<RegistryWrapper.Impl<?>> wrappers, List<RegistryLoader.Entry<?>> entries, CallbackInfoReturnable<DynamicRegistryManager.Immutable> cir, @Local(ordinal = 2) List<RegistryLoader.Loader<?>> registriesList) {
|
||||
if (LOADING_DYNAMIC_REGISTRIES.getAndSet(false)) {
|
||||
ModPlatform platform = CommonPlatform.get();
|
||||
platform.getRawConfigRegistry().clear();
|
||||
MutableRegistry<Biome> biomes = extractRegistry(registriesList, RegistryKeys.BIOME).orElseThrow();
|
||||
MutableRegistry<DimensionType> dimensionTypes = extractRegistry(registriesList, RegistryKeys.DIMENSION_TYPE).orElseThrow();
|
||||
MutableRegistry<WorldPreset> worldPresets = extractRegistry(registriesList, RegistryKeys.WORLD_PRESET).orElseThrow();
|
||||
MutableRegistry<ChunkGeneratorSettings> chunkGeneratorSettings = extractRegistry(registriesList,
|
||||
RegistryKeys.CHUNK_GENERATOR_SETTINGS).orElseThrow();
|
||||
MutableRegistry<MultiNoiseBiomeSourceParameterList> multiNoiseBiomeSourceParameterLists = extractRegistry(instance,
|
||||
MutableRegistry<MultiNoiseBiomeSourceParameterList> multiNoiseBiomeSourceParameterLists = extractRegistry(registriesList,
|
||||
RegistryKeys.MULTI_NOISE_BIOME_SOURCE_PARAMETER_LIST).orElseThrow();
|
||||
MutableRegistry<Enchantment> enchantments = extractRegistry(instance, RegistryKeys.ENCHANTMENT).orElseThrow();
|
||||
MutableRegistry<Enchantment> enchantments = extractRegistry(registriesList, RegistryKeys.ENCHANTMENT).orElseThrow();
|
||||
|
||||
LifecyclePlatform.setRegistries(biomes, dimensionTypes, chunkGeneratorSettings, multiNoiseBiomeSourceParameterLists,
|
||||
enchantments);
|
||||
LifecycleUtil.initialize(biomes, worldPresets);
|
||||
initialized = true;
|
||||
}
|
||||
instance.forEach(consumer);
|
||||
}
|
||||
|
||||
@Unique
|
||||
|
@ -12,9 +12,6 @@
|
||||
"lifecycle.RegistryLoaderMixin",
|
||||
"lifecycle.SaveLoadingMixin"
|
||||
],
|
||||
"client": [
|
||||
"lifecycle.CreateWorldScreenMixin"
|
||||
],
|
||||
"server": [
|
||||
],
|
||||
"injectors": {
|
||||
|
@ -26,6 +26,12 @@ include(":platforms:minestom:example")
|
||||
pluginManagement {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
maven("https://maven.solo-studios.ca/releases") {
|
||||
name = "Solo Studios"
|
||||
}
|
||||
maven("https://maven.solo-studios.ca/snapshots") {
|
||||
name = "Solo Studios"
|
||||
}
|
||||
maven("https://maven.fabricmc.net") {
|
||||
name = "Fabric Maven"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user