Started migration to 1.21.11

This commit is contained in:
OakLoaf
2025-12-09 21:32:28 +00:00
parent 309fb5af96
commit b04156bb45
15 changed files with 89 additions and 84 deletions

View File

@@ -32,7 +32,7 @@ object Versions {
}
object Fabric {
const val fabricAPI = "0.134.1+${Mod.minecraft}"
const val fabricAPI = "0.139.4+${Mod.minecraft}"
const val cloud = "2.0.0-beta.13"
}
//
@@ -45,11 +45,11 @@ object Versions {
const val mixin = "0.16.4+mixin.0.8.7"
const val mixinExtras = "0.5.0"
const val minecraft = "1.21.10"
const val minecraft = "1.21.11"
const val yarn = "$minecraft+build.1"
const val fabricLoader = "0.17.2"
const val fabricLoader = "0.18.2"
const val architecuryLoom = "1.11.451"
const val architecturyLoom = "1.13.467"
const val architecturyPlugin = "3.4.162"
}
@@ -60,9 +60,9 @@ object Versions {
// }
object Bukkit {
const val minecraft = "1.21.10"
const val minecraft = "1.21.11-rc3"
const val nms = "$minecraft-R0.1"
const val paperBuild = "$nms-20251012.013929-7"
const val paperBuild = "$nms-20251208.200020-2"
const val paper = paperBuild
const val paperLib = "1.0.8"
const val reflectionRemapper = "0.1.3"

View File

@@ -7,10 +7,10 @@ import net.minecraft.core.HolderSet.Named;
import net.minecraft.core.MappedRegistry;
import net.minecraft.core.RegistrationInfo;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey;
import net.minecraft.world.entity.npc.VillagerType;
import net.minecraft.world.entity.npc.villager.VillagerType;
import net.minecraft.world.level.biome.Biome;
import org.bukkit.NamespacedKey;
import org.slf4j.Logger;
@@ -34,7 +34,7 @@ import com.dfsek.terra.registry.master.ConfigRegistry;
public class AwfulBukkitHacks {
private static final Logger LOGGER = LoggerFactory.getLogger(AwfulBukkitHacks.class);
private static final Map<ResourceLocation, List<ResourceLocation>> terraBiomeMap = new HashMap<>();
private static final Map<Identifier, List<Identifier>> terraBiomeMap = new HashMap<>();
public static void registerBiomes(ConfigRegistry configRegistry) {
try {
@@ -50,7 +50,7 @@ public class AwfulBukkitHacks {
BukkitPlatformBiome platformBiome = (BukkitPlatformBiome) biome.getPlatformBiome();
NamespacedKey vanillaBukkitKey = platformBiome.getHandle().getKey();
ResourceLocation vanillaMinecraftKey = ResourceLocation.fromNamespaceAndPath(vanillaBukkitKey.getNamespace(),
Identifier vanillaMinecraftKey = Identifier.fromNamespaceAndPath(vanillaBukkitKey.getNamespace(),
vanillaBukkitKey.getKey());
VanillaBiomeProperties vanillaBiomeProperties = biome.getContext().get(VanillaBiomeProperties.class);
@@ -58,7 +58,7 @@ public class AwfulBukkitHacks {
Biome platform = NMSBiomeInjector.createBiome(biomeRegistry.get(vanillaMinecraftKey).orElseThrow().value(),
vanillaBiomeProperties);
ResourceLocation delegateMinecraftKey = ResourceLocation.fromNamespaceAndPath("terra",
Identifier delegateMinecraftKey = Identifier.fromNamespaceAndPath("terra",
NMSBiomeInjector.createBiomeID(pack, key));
NamespacedKey delegateBukkitKey = NamespacedKey.fromString(delegateMinecraftKey.toString());
ResourceKey<Biome> delegateKey = ResourceKey.create(Registries.BIOME, delegateMinecraftKey);
@@ -75,7 +75,7 @@ public class AwfulBukkitHacks {
Objects.requireNonNullElse(vanillaBiomeProperties.getVillagerType(),
villagerMap.getOrDefault(delegateKey, VillagerType.PLAINS)));
terraBiomeMap.computeIfAbsent(vanillaMinecraftKey, i -> new ArrayList<>()).add(delegateKey.location());
terraBiomeMap.computeIfAbsent(vanillaMinecraftKey, i -> new ArrayList<>()).add(delegateKey.identifier());
LOGGER.debug("Registered biome: " + delegateKey);
} catch(NoSuchFieldException | SecurityException | IllegalArgumentException | IllegalAccessException e) {
@@ -100,8 +100,8 @@ public class AwfulBukkitHacks {
tb -> NMSBiomeInjector.getEntry(biomeRegistry, tb).ifPresentOrElse(
terra -> {
LOGGER.debug("{} (vanilla for {}): {}",
vanilla.unwrapKey().orElseThrow().location(),
terra.unwrapKey().orElseThrow().location(),
vanilla.unwrapKey().orElseThrow().identifier(),
terra.unwrapKey().orElseThrow().identifier(),
vanilla.tags().toList());
vanilla.tags()
.forEach(tag -> collect

View File

@@ -2,7 +2,8 @@ package com.dfsek.terra.bukkit.nms;
import net.minecraft.core.Holder;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.attribute.EnvironmentAttributes;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.BiomeGenerationSettings;
import net.minecraft.world.level.biome.BiomeSpecialEffects;
@@ -17,7 +18,7 @@ import com.dfsek.terra.bukkit.nms.config.VanillaBiomeProperties;
public class NMSBiomeInjector {
public static <T> Optional<Holder<T>> getEntry(Registry<T> registry, ResourceLocation identifier) {
public static <T> Optional<Holder<T>> getEntry(Registry<T> registry, Identifier identifier) {
return registry.getOptional(identifier)
.flatMap(registry::getResourceKey)
.flatMap(registry::get);
@@ -29,55 +30,59 @@ public class NMSBiomeInjector {
BiomeSpecialEffects.Builder effects = new BiomeSpecialEffects.Builder();
effects.fogColor(Objects.requireNonNullElse(vanillaBiomeProperties.getFogColor(), vanilla.getFogColor()))
.waterColor(Objects.requireNonNullElse(vanillaBiomeProperties.getWaterColor(), vanilla.getWaterColor()))
.waterFogColor(Objects.requireNonNullElse(vanillaBiomeProperties.getWaterFogColor(), vanilla.getWaterFogColor()))
.skyColor(Objects.requireNonNullElse(vanillaBiomeProperties.getSkyColor(), vanilla.getSkyColor()))
// TODO: Migrate to EnvironmentAttributes
// builder.setAttribute(EnvironmentAttributes.FOG_COLOR, Objects.requireNonNullElse(vanillaBiomeProperties.getFogColor(), vanilla.getAttributes().get(EnvironmentAttributes.FOG_COLOR)))
// effects.fogColor(Objects.requireNonNullElse(vanillaBiomeProperties.getFogColor(), vanilla.getFogColor()));
effects.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()))
.backgroundMusicVolume(Objects.requireNonNullElse(vanillaBiomeProperties.getMusicVolume(), vanilla.getBackgroundMusicVolume()));
vanilla.getSpecialEffects().grassColorModifier()));
// .backgroundMusicVolume(Objects.requireNonNullElse(vanillaBiomeProperties.getMusicVolume(), vanilla.getBackgroundMusicVolume()));
if(vanillaBiomeProperties.getGrassColor() == null) {
vanilla.getSpecialEffects().getGrassColorOverride().ifPresent(effects::grassColorOverride);
vanilla.getSpecialEffects().grassColorOverride().ifPresent(effects::grassColorOverride);
} else {
effects.grassColorOverride(vanillaBiomeProperties.getGrassColor());
}
if(vanillaBiomeProperties.getFoliageColor() == null) {
vanilla.getSpecialEffects().getFoliageColorOverride().ifPresent(effects::foliageColorOverride);
vanilla.getSpecialEffects().foliageColorOverride().ifPresent(effects::foliageColorOverride);
} else {
effects.foliageColorOverride(vanillaBiomeProperties.getFoliageColor());
}
if(vanillaBiomeProperties.getParticleConfig() == null) {
vanilla.getSpecialEffects().getAmbientParticleSettings().ifPresent(effects::ambientParticle);
} else {
effects.ambientParticle(vanillaBiomeProperties.getParticleConfig());
}
// TODO
// if(vanillaBiomeProperties.getParticleConfig() == null) {
// vanilla.getSpecialEffects().getAmbientParticleSettings().ifPresent(effects::ambientParticle);
// } else {
// effects.ambientParticle(vanillaBiomeProperties.getParticleConfig());
// }
if(vanillaBiomeProperties.getLoopSound() == null) {
vanilla.getSpecialEffects().getAmbientLoopSoundEvent().ifPresent(effects::ambientLoopSound);
} else {
RegistryFetcher.soundEventRegistry().get(vanillaBiomeProperties.getLoopSound().location()).ifPresent(effects::ambientLoopSound);
}
// if(vanillaBiomeProperties.getLoopSound() == null) {
// vanilla.getSpecialEffects().getAmbientLoopSoundEvent().ifPresent(effects::ambientLoopSound);
// } else {
// RegistryFetcher.soundEventRegistry().get(vanillaBiomeProperties.getLoopSound().location()).ifPresent(effects::ambientLoopSound);
// }
if(vanillaBiomeProperties.getMoodSound() == null) {
vanilla.getSpecialEffects().getAmbientMoodSettings().ifPresent(effects::ambientMoodSound);
} else {
effects.ambientMoodSound(vanillaBiomeProperties.getMoodSound());
}
if(vanillaBiomeProperties.getAdditionsSound() == null) {
vanilla.getSpecialEffects().getAmbientAdditionsSettings().ifPresent(effects::ambientAdditionsSound);
} else {
effects.ambientAdditionsSound(vanillaBiomeProperties.getAdditionsSound());
}
if(vanillaBiomeProperties.getMusic() == null) {
vanilla.getSpecialEffects().getBackgroundMusic().ifPresent(effects::backgroundMusic);
} else {
effects.backgroundMusic(vanillaBiomeProperties.getMusic());
}
// if(vanillaBiomeProperties.getMoodSound() == null) {
// vanilla.getSpecialEffects().getAmbientMoodSettings().ifPresent(effects::ambientMoodSound);
// } else {
// effects.ambientMoodSound(vanillaBiomeProperties.getMoodSound());
// }
//
// if(vanillaBiomeProperties.getAdditionsSound() == null) {
// vanilla.getSpecialEffects().getAmbientAdditionsSettings().ifPresent(effects::ambientAdditionsSound);
// } else {
// effects.ambientAdditionsSound(vanillaBiomeProperties.getAdditionsSound());
// }
//
// if(vanillaBiomeProperties.getMusic() == null) {
// vanilla.getSpecialEffects().getBackgroundMusic().ifPresent(effects::backgroundMusic);
// } else {
// effects.backgroundMusic(vanillaBiomeProperties.getMusic());
// }
builder.hasPrecipitation(Objects.requireNonNullElse(vanillaBiomeProperties.getPrecipitation(), vanilla.hasPrecipitation()));

View File

@@ -2,15 +2,15 @@ package com.dfsek.terra.bukkit.nms;
import com.dfsek.tectonic.api.TypeRegistry;
import com.dfsek.tectonic.api.exception.LoadException;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.sounds.Music;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.attribute.AmbientParticle;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.MobCategory;
import net.minecraft.world.entity.npc.VillagerType;
import net.minecraft.world.level.biome.AmbientAdditionsSettings;
import net.minecraft.world.level.biome.AmbientMoodSettings;
import net.minecraft.world.level.biome.AmbientParticleSettings;
import net.minecraft.world.attribute.AmbientAdditionsSettings;
import net.minecraft.world.attribute.AmbientMoodSettings;
import net.minecraft.world.entity.npc.villager.VillagerType;
import net.minecraft.world.level.biome.Biome.Precipitation;
import net.minecraft.world.level.biome.Biome.TemperatureModifier;
import net.minecraft.world.level.biome.BiomeSpecialEffects.GrassColorModifier;
@@ -52,8 +52,8 @@ public class NMSPlatform extends PlatformImpl {
public void register(TypeRegistry registry) {
super.register(registry);
registry.registerLoader(PlatformBiome.class, (type, o, loader, depthTracker) -> parseBiome((String) o, depthTracker))
.registerLoader(ResourceLocation.class, (type, o, loader, depthTracker) -> {
ResourceLocation identifier = ResourceLocation.tryParse((String) o);
.registerLoader(Identifier.class, (type, o, loader, depthTracker) -> {
Identifier identifier = Identifier.tryParse((String) o);
if(identifier == null)
throw new LoadException("Invalid identifier: " + o, depthTracker);
return identifier;
@@ -67,7 +67,7 @@ public class NMSPlatform extends PlatformImpl {
(type, o, loader, depthTracker) -> TemperatureModifier.valueOf(((String) o).toUpperCase(
Locale.ROOT)))
.registerLoader(MobCategory.class, (type, o, loader, depthTracker) -> MobCategory.valueOf((String) o))
.registerLoader(AmbientParticleSettings.class, BiomeParticleConfigTemplate::new)
.registerLoader(AmbientParticle.class, BiomeParticleConfigTemplate::new)
.registerLoader(SoundEvent.class, SoundEventTemplate::new)
.registerLoader(AmbientMoodSettings.class, BiomeMoodSoundTemplate::new)
.registerLoader(AmbientAdditionsSettings.class, BiomeAdditionsSoundTemplate::new)

View File

@@ -7,7 +7,7 @@ import net.minecraft.core.MappedRegistry;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.level.ChunkMap;
import net.minecraft.tags.TagKey;
import net.minecraft.world.entity.npc.VillagerType;
import net.minecraft.world.entity.npc.villager.VillagerType;
import net.minecraft.world.level.LevelAccessor;
import net.minecraft.world.level.StructureManager;
import net.minecraft.world.level.biome.Biome;

View File

@@ -5,7 +5,7 @@ import com.dfsek.tectonic.api.config.template.annotations.Value;
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.level.biome.AmbientAdditionsSettings;
import net.minecraft.world.attribute.AmbientAdditionsSettings;
public class BiomeAdditionsSoundTemplate implements ObjectTemplate<AmbientAdditionsSettings> {

View File

@@ -5,7 +5,7 @@ import com.dfsek.tectonic.api.config.template.annotations.Value;
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.level.biome.AmbientMoodSettings;
import net.minecraft.world.attribute.AmbientMoodSettings;
public class BiomeMoodSoundTemplate implements ObjectTemplate<AmbientMoodSettings> {

View File

@@ -8,12 +8,12 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.commands.arguments.ParticleArgument;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.level.biome.AmbientParticleSettings;
import net.minecraft.world.attribute.AmbientParticle;
import java.util.stream.Stream;
public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientParticleSettings> {
public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientParticle> {
@Value("particle")
@Default
private String particle = null;
@@ -23,13 +23,13 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientPartic
private Float probability = 0.1f;
@Override
public AmbientParticleSettings get() {
public AmbientParticle get() {
if(particle == null) {
return null;
}
try {
return new AmbientParticleSettings(ParticleArgument.readParticle(new StringReader(particle),
return new AmbientParticle(ParticleArgument.readParticle(new StringReader(particle),
HolderLookup.Provider.create(Stream.of(BuiltInRegistries.PARTICLE_TYPE))), probability);
} catch(CommandSyntaxException e) {
throw new RuntimeException(e);

View File

@@ -4,14 +4,14 @@ import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.world.entity.EntityType;
public class EntityTypeTemplate implements ObjectTemplate<EntityType<?>> {
@Value("id")
@Default
private ResourceLocation id = null;
private Identifier id = null;
@Override
public EntityType<?> get() {

View File

@@ -3,14 +3,14 @@ package com.dfsek.terra.bukkit.nms.config;
import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.sounds.SoundEvent;
public class SoundEventTemplate implements ObjectTemplate<SoundEvent> {
@Value("id")
@Default
private ResourceLocation id = null;
private Identifier id = null;
@Value("distance-to-travel")
@Default

View File

@@ -6,10 +6,10 @@ import com.dfsek.tectonic.api.config.template.annotations.Value;
import net.minecraft.resources.ResourceKey;
import net.minecraft.sounds.Music;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.entity.npc.VillagerType;
import net.minecraft.world.level.biome.AmbientAdditionsSettings;
import net.minecraft.world.level.biome.AmbientMoodSettings;
import net.minecraft.world.level.biome.AmbientParticleSettings;
import net.minecraft.world.entity.npc.villager.VillagerType;
import net.minecraft.world.attribute.AmbientAdditionsSettings;
import net.minecraft.world.attribute.AmbientMoodSettings;
import net.minecraft.world.attribute.AmbientParticle;
import net.minecraft.world.level.biome.Biome.TemperatureModifier;
import net.minecraft.world.level.biome.BiomeSpecialEffects.GrassColorModifier;
import net.minecraft.world.level.biome.MobSpawnSettings;
@@ -52,7 +52,7 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
@Value("particles")
@Default
private AmbientParticleSettings particleConfig = null;
private AmbientParticle particleConfig = null;
@Value("climate.precipitation")
@Default
@@ -130,7 +130,7 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
return grassColorModifier;
}
public AmbientParticleSettings getParticleConfig() {
public AmbientParticle getParticleConfig() {
return particleConfig;
}

View File

@@ -5,14 +5,14 @@ import com.dfsek.tectonic.api.config.template.annotations.Value;
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.npc.VillagerType;
import net.minecraft.resources.Identifier;
import net.minecraft.world.entity.npc.villager.VillagerType;
public class VillagerTypeTemplate implements ObjectTemplate<ResourceKey<VillagerType>> {
@Value("id")
@Default
private ResourceLocation id = null;
private Identifier id = null;
@Override
public ResourceKey<VillagerType> get() {

View File

@@ -1,7 +1,7 @@
import java.util.*
plugins {
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
id("dev.architectury.loom") version Versions.Mod.architecturyLoom
id("architectury-plugin") version Versions.Mod.architecturyPlugin
}

View File

@@ -1,5 +1,5 @@
plugins {
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
id("dev.architectury.loom") version Versions.Mod.architecturyLoom
id("architectury-plugin") version Versions.Mod.architecturyPlugin
}
@@ -16,7 +16,7 @@ dependencies {
compileOnly("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}")
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}")
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecturyLoom}")
minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}")
mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2")

View File

@@ -1,5 +1,5 @@
plugins {
id("dev.architectury.loom") version Versions.Mod.architecuryLoom
id("dev.architectury.loom") version Versions.Mod.architecturyLoom
id("architectury-plugin") version Versions.Mod.architecturyPlugin
}
@@ -9,7 +9,7 @@ dependencies {
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}")
annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecturyLoom}")
implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false }