mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-04-20 15:20:25 +00:00
Merge branch 'master' into dev/7.0-2
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class PlatformImpl extends AbstractPlatform {
|
||||
private int generationThreads;
|
||||
|
||||
public PlatformImpl(TerraBukkitPlugin plugin) {
|
||||
generationThreads = getGenerationThreadsWithReflection("ca.spottedleaf.moonrise.common.util.MoonriseCommon", "WORKER_THREADS", "Moonrise");
|
||||
generationThreads = getMoonriseGenerationThreadsWithReflection();
|
||||
if (generationThreads == 0) {
|
||||
generationThreads = 1;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -72,6 +72,10 @@ public class VanillaWorldProperties implements ConfigTemplate, Properties {
|
||||
@Default
|
||||
private Float ambientLight = null;
|
||||
|
||||
@Value("minecraft.cloud-height")
|
||||
@Default
|
||||
private Integer cloudHeight = null;
|
||||
|
||||
@Value("minecraft.monster-settings")
|
||||
@Default
|
||||
private MonsterSettingsConfig monsterSettings = null;
|
||||
@@ -153,6 +157,10 @@ public class VanillaWorldProperties implements ConfigTemplate, Properties {
|
||||
return ambientLight;
|
||||
}
|
||||
|
||||
public Integer getCloudHeight() {
|
||||
return cloudHeight;
|
||||
}
|
||||
|
||||
public MonsterSettingsConfig getMonsterSettings() {
|
||||
return monsterSettings;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -51,6 +51,7 @@ public class DimensionUtil {
|
||||
: TagKey.of(RegistryKeys.BLOCK, vanillaWorldProperties.getInfiniburn()),
|
||||
vanillaWorldProperties.getEffects() == null ? defaultDimension.effects() : vanillaWorldProperties.getEffects(),
|
||||
vanillaWorldProperties.getAmbientLight() == null ? defaultDimension.ambientLight() : vanillaWorldProperties.getAmbientLight(),
|
||||
vanillaWorldProperties.getCloudHeight() == null ? defaultDimension.cloudHeight() : vanillaWorldProperties.getCloudHeight().describeConstable(),
|
||||
monsterSettings
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:snowy_taiga"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:old_growth_pine_taiga"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:old_growth_spruce_taiga"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:taiga"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"#minecraft:is_jungle"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:grove"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"#minecraft:is_savanna"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"#minecraft:is_badlands"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"replace": false,
|
||||
"values": [
|
||||
"minecraft:forest"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"assets": {
|
||||
"angry": "minecraft:entity/wolf/wolf_ashen_angry",
|
||||
"tame": "minecraft:entity/wolf/wolf_ashen_tame",
|
||||
"wild": "minecraft:entity/wolf/wolf_ashen"
|
||||
},
|
||||
"spawn_conditions": [
|
||||
{
|
||||
"condition": {
|
||||
"type": "minecraft:biome",
|
||||
"biomes": "#c:has_wolf_variant/ashen"
|
||||
},
|
||||
"priority": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"assets": {
|
||||
"angry": "minecraft:entity/wolf/wolf_black_angry",
|
||||
"tame": "minecraft:entity/wolf/wolf_black_tame",
|
||||
"wild": "minecraft:entity/wolf/wolf_black"
|
||||
},
|
||||
"spawn_conditions": [
|
||||
{
|
||||
"condition": {
|
||||
"type": "minecraft:biome",
|
||||
"biomes": "#c:has_wolf_variant/black"
|
||||
},
|
||||
"priority": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"assets": {
|
||||
"angry": "minecraft:entity/wolf/wolf_chestnut_angry",
|
||||
"tame": "minecraft:entity/wolf/wolf_chestnut_tame",
|
||||
"wild": "minecraft:entity/wolf/wolf_chestnut"
|
||||
},
|
||||
"spawn_conditions": [
|
||||
{
|
||||
"condition": {
|
||||
"type": "minecraft:biome",
|
||||
"biomes": "#c:has_wolf_variant/chestnut"
|
||||
},
|
||||
"priority": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"assets": {
|
||||
"angry": "minecraft:entity/wolf/wolf_angry",
|
||||
"tame": "minecraft:entity/wolf/wolf_tame",
|
||||
"wild": "minecraft:entity/wolf/wolf"
|
||||
},
|
||||
"spawn_conditions": [
|
||||
{
|
||||
"condition": {
|
||||
"type": "minecraft:biome",
|
||||
"biomes": "#c:has_wolf_variant/pale"
|
||||
},
|
||||
"priority": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"assets": {
|
||||
"angry": "minecraft:entity/wolf/wolf_rusty_angry",
|
||||
"tame": "minecraft:entity/wolf/wolf_rusty_tame",
|
||||
"wild": "minecraft:entity/wolf/wolf_rusty"
|
||||
},
|
||||
"spawn_conditions": [
|
||||
{
|
||||
"condition": {
|
||||
"type": "minecraft:biome",
|
||||
"biomes": "#c:has_wolf_variant/rusty"
|
||||
},
|
||||
"priority": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"assets": {
|
||||
"angry": "minecraft:entity/wolf/wolf_snowy_angry",
|
||||
"tame": "minecraft:entity/wolf/wolf_snowy_tame",
|
||||
"wild": "minecraft:entity/wolf/wolf_snowy"
|
||||
},
|
||||
"spawn_conditions": [
|
||||
{
|
||||
"condition": {
|
||||
"type": "minecraft:biome",
|
||||
"biomes": "#c:has_wolf_variant/snowy"
|
||||
},
|
||||
"priority": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"assets": {
|
||||
"angry": "minecraft:entity/wolf/wolf_spotted_angry",
|
||||
"tame": "minecraft:entity/wolf/wolf_spotted_tame",
|
||||
"wild": "minecraft:entity/wolf/wolf_spotted"
|
||||
},
|
||||
"spawn_conditions": [
|
||||
{
|
||||
"condition": {
|
||||
"type": "minecraft:biome",
|
||||
"biomes": "#c:has_wolf_variant/spotted"
|
||||
},
|
||||
"priority": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"assets": {
|
||||
"angry": "minecraft:entity/wolf/wolf_striped_angry",
|
||||
"tame": "minecraft:entity/wolf/wolf_striped_tame",
|
||||
"wild": "minecraft:entity/wolf/wolf_striped"
|
||||
},
|
||||
"spawn_conditions": [
|
||||
{
|
||||
"condition": {
|
||||
"type": "minecraft:biome",
|
||||
"biomes": "#c:has_wolf_variant/striped"
|
||||
},
|
||||
"priority": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"assets": {
|
||||
"angry": "minecraft:entity/wolf/wolf_woods_angry",
|
||||
"tame": "minecraft:entity/wolf/wolf_woods_tame",
|
||||
"wild": "minecraft:entity/wolf/wolf_woods"
|
||||
},
|
||||
"spawn_conditions": [
|
||||
{
|
||||
"condition": {
|
||||
"type": "minecraft:biome",
|
||||
"biomes": "#c:has_wolf_variant/woods"
|
||||
},
|
||||
"priority": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -9,7 +9,6 @@
|
||||
"access.StateAccessor",
|
||||
"access.StructureAccessorAccessor",
|
||||
"access.VillagerTypeAccessor",
|
||||
"fix.BeeMoveGoalsUnsynchronizedRandomAccessFix",
|
||||
"generalize.ServerWorldMixin",
|
||||
"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")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class LifecyclePlatform extends ModPlatform {
|
||||
public LifecyclePlatform() {
|
||||
generationThreads = getGenerationThreadsWithReflection("com.ishland.c2me.base.common.GlobalExecutors", "GLOBAL_EXECUTOR_PARALLELISM", "C2ME");
|
||||
if (generationThreads == 0) {
|
||||
generationThreads = getGenerationThreadsWithReflection("ca.spottedleaf.moonrise.common.util.MoonriseCommon", "WORKER_THREADS", "Moonrise");
|
||||
generationThreads = getMoonriseGenerationThreadsWithReflection();
|
||||
} if (generationThreads == 0) {
|
||||
generationThreads = 1;
|
||||
}
|
||||
@@ -109,7 +109,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": {
|
||||
|
||||
Reference in New Issue
Block a user