Merge pull request #545 from TheNick24/dev/1.21.11

feat: update minestom to 1.21.11
This commit is contained in:
Zoë Gidiere
2026-04-28 17:47:42 +00:00
committed by GitHub
7 changed files with 56 additions and 50 deletions
+1 -1
View File
@@ -96,6 +96,6 @@ object Versions {
}
object Minestom {
const val minestom = "2025.10.31-1.21.10"
const val minestom = "2025.12.20c-1.21.11"
}
}
@@ -7,6 +7,8 @@ import net.kyori.adventure.util.RGBLike;
import net.minestom.server.MinecraftServer;
import net.minestom.server.instance.Instance;
import net.minestom.server.sound.SoundEvent;
import net.minestom.server.world.attribute.AmbientParticle;
import net.minestom.server.world.attribute.AmbientSounds;
import net.minestom.server.world.biome.BiomeEffects;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -82,9 +84,9 @@ public final class TerraMinestomPlatform extends AbstractPlatform {
(TypeLoader<EntityType>) (annotatedType, o, configLoader, depthTracker) -> new MinestomEntityType((String) o))
.registerLoader(BlockState.class,
(TypeLoader<BlockState>) (annotatedType, o, configLoader, depthTracker) -> worldHandle.createBlockState((String) o))
.registerLoader(BiomeEffects.Particle.class, BiomeParticleConfigTemplate::new)
.registerLoader(BiomeEffects.MoodSound.class, BiomeMoodSoundTemplate::new)
.registerLoader(BiomeEffects.AdditionsSound.class, BiomeAdditionsSoundTemplate::new)
.registerLoader(AmbientParticle.class, BiomeParticleConfigTemplate::new)
.registerLoader(AmbientSounds.Mood.class, BiomeMoodSoundTemplate::new)
.registerLoader(AmbientSounds.Additions.class, BiomeAdditionsSoundTemplate::new)
.registerLoader(SoundEvent.class, SoundEventTemplate::new);
}
@@ -5,6 +5,7 @@ import net.minestom.server.MinecraftServer;
import net.minestom.server.color.Color;
import net.minestom.server.registry.DynamicRegistry;
import net.minestom.server.registry.RegistryKey;
import net.minestom.server.world.attribute.EnvironmentAttribute;
import net.minestom.server.world.biome.Biome;
import net.minestom.server.world.biome.BiomeEffects;
import org.intellij.lang.annotations.Subst;
@@ -27,6 +28,11 @@ public class MinestomUserDefinedBiomeFactory implements BiomeFactory {
return first;
}
private static <T> void applyAttributeIfNotNull(Biome.Builder biomeBuilder, EnvironmentAttribute<T> attribute, T value) {
if (value == null) return;
biomeBuilder.setAttribute(attribute, value);
}
@Subst("value")
protected static String createBiomeID(ConfigPack pack, String biomeId) {
return pack.getID().toLowerCase() + "/" + biomeId.toLowerCase(Locale.ROOT);
@@ -41,32 +47,25 @@ public class MinestomUserDefinedBiomeFactory implements BiomeFactory {
Key key = Key.key("terra", createBiomeID(pack, source.getID()));
BiomeEffects.Builder effectsBuilder = BiomeEffects.builder()
.fogColor(mergeNullable(properties.getFogColor(), parentEffects.fogColor()))
.skyColor(mergeNullable(properties.getSkyColor(), parentEffects.skyColor()))
.waterColor(mergeNullable(properties.getWaterColor(), parentEffects.waterColor()))
.waterFogColor(mergeNullable(properties.getWaterFogColor(), parentEffects.waterFogColor()))
.foliageColor(mergeNullable(properties.getFoliageColor(), parentEffects.foliageColor()))
.grassColor(mergeNullable(properties.getGrassColor(), parentEffects.grassColor()))
.grassColorModifier(mergeNullable(properties.getGrassColorModifier(), parentEffects.grassColorModifier()))
.biomeParticle(mergeNullable(properties.getParticleConfig(), parentEffects.biomeParticle()))
.ambientSound(mergeNullable(properties.getLoopSound(), parentEffects.ambientSound()))
.moodSound(mergeNullable(properties.getMoodSound(), parentEffects.moodSound()))
.additionsSound(mergeNullable(properties.getAdditionsSound(), parentEffects.additionsSound()))
// TODO music
.music(parentEffects.music())
.musicVolume(parentEffects.musicVolume());
.grassColorModifier(mergeNullable(properties.getGrassColorModifier(), parentEffects.grassColorModifier()));
if(effectsBuilder.build().equals(BiomeEffects.PLAINS_EFFECTS)) {
effectsBuilder.fogColor(new Color(0xC0D8FE)); // circumvent a minestom bug
}
Biome target = Biome.builder()
Biome.Builder targetBuilder = Biome.builder()
.downfall(mergeNullable(properties.getDownfall(), parent.downfall()))
.hasPrecipitation(mergeNullable(properties.getPrecipitation(), parent.hasPrecipitation()))
.precipitation(mergeNullable(properties.getPrecipitation(), parent.hasPrecipitation()))
.temperature(mergeNullable(properties.getTemperature(), parent.temperature()))
.temperatureModifier(mergeNullable(properties.getTemperatureModifier(), parent.temperatureModifier()))
.effects(effectsBuilder.build())
.build();
.effects(effectsBuilder.build());
applyAttributeIfNotNull(targetBuilder, EnvironmentAttribute.FOG_COLOR, properties.getFogColor());
applyAttributeIfNotNull(targetBuilder, EnvironmentAttribute.SKY_COLOR, properties.getSkyColor());
applyAttributeIfNotNull(targetBuilder, EnvironmentAttribute.WATER_FOG_COLOR, properties.getWaterFogColor());
applyAttributeIfNotNull(targetBuilder, EnvironmentAttribute.AMBIENT_PARTICLES, properties.getParticleConfig());
applyAttributeIfNotNull(targetBuilder, EnvironmentAttribute.AMBIENT_SOUNDS, properties.getAmbientSoundConfig());
// TODO music
Biome target = targetBuilder.build();
RegistryKey<Biome> registryKey = MinecraftServer.getBiomeRegistry().register(key, target);
return new UserDefinedBiome(key, registryKey, source.getID(), target);
@@ -4,10 +4,11 @@ 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.minestom.server.sound.SoundEvent;
import net.minestom.server.world.attribute.AmbientSounds;
import net.minestom.server.world.biome.BiomeEffects;
public class BiomeAdditionsSoundTemplate implements ObjectTemplate<BiomeEffects.AdditionsSound> {
public class BiomeAdditionsSoundTemplate implements ObjectTemplate<AmbientSounds.Additions> {
@Value("sound")
@Default
private SoundEvent sound = null;
@@ -17,8 +18,8 @@ public class BiomeAdditionsSoundTemplate implements ObjectTemplate<BiomeEffects.
private Double soundChance = null;
@Override
public BiomeEffects.AdditionsSound get() {
public AmbientSounds.Additions get() {
if(sound == null) return null;
return new BiomeEffects.AdditionsSound(sound, soundChance);
return new AmbientSounds.Additions(sound, soundChance);
}
}
@@ -4,10 +4,11 @@ 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.minestom.server.sound.SoundEvent;
import net.minestom.server.world.attribute.AmbientSounds;
import net.minestom.server.world.biome.BiomeEffects;
public class BiomeMoodSoundTemplate implements ObjectTemplate<BiomeEffects.MoodSound> {
public class BiomeMoodSoundTemplate implements ObjectTemplate<AmbientSounds.Mood> {
@Value("sound")
@Default
private SoundEvent sound = null;
@@ -25,9 +26,9 @@ public class BiomeMoodSoundTemplate implements ObjectTemplate<BiomeEffects.MoodS
private Double soundExtraDistance = null;
@Override
public BiomeEffects.MoodSound get() {
public AmbientSounds.Mood get() {
if(sound == null) return null;
return new BiomeEffects.MoodSound(
return new AmbientSounds.Mood(
sound,
soundCultivationTicks,
soundSpawnRange,
@@ -4,11 +4,12 @@ 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.minestom.server.particle.Particle;
import net.minestom.server.world.attribute.AmbientParticle;
import net.minestom.server.world.biome.BiomeEffects;
import org.slf4j.LoggerFactory;
public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeEffects.Particle> {
public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientParticle> {
@Value("particle")
@Default
private String particle = null;
@@ -18,7 +19,7 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeEffects.
private Float probability = null;
@Override
public BiomeEffects.Particle get() {
public AmbientParticle get() {
if(particle == null || probability == null) {
return null;
}
@@ -31,9 +32,9 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeEffects.
return null;
}
return new BiomeEffects.Particle(
probability,
parsedParticle
return new AmbientParticle(
parsedParticle,
probability
);
}
}
@@ -5,12 +5,16 @@ import com.dfsek.tectonic.api.config.template.annotations.Default;
import com.dfsek.tectonic.api.config.template.annotations.Value;
import net.kyori.adventure.util.RGBLike;
import net.minestom.server.sound.SoundEvent;
import net.minestom.server.world.attribute.AmbientParticle;
import net.minestom.server.world.attribute.AmbientSounds;
import net.minestom.server.world.biome.Biome.TemperatureModifier;
import net.minestom.server.world.biome.BiomeEffects;
import net.minestom.server.world.biome.BiomeEffects.GrassColorModifier;
import com.dfsek.terra.api.properties.Properties;
import java.util.List;
public class VanillaBiomeProperties implements ConfigTemplate, Properties {
@Value("colors.grass")
@@ -43,7 +47,7 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
@Value("particles")
@Default
private BiomeEffects.Particle particleConfig = null;
private AmbientParticle particleConfig = null;
@Value("climate.precipitation")
@Default
@@ -67,11 +71,11 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
@Value("sound.mood-sound")
@Default
private BiomeEffects.MoodSound moodSound = null;
private AmbientSounds.Mood moodSound = null;
@Value("sound.additions-sound")
@Default
private BiomeEffects.AdditionsSound additionsSound = null;
private AmbientSounds.Additions additionsSound = null;
// @Value("sound.music")
// @Default
@@ -105,8 +109,9 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
return grassColorModifier;
}
public BiomeEffects.Particle getParticleConfig() {
return particleConfig;
public List<AmbientParticle> getParticleConfig() {
if (particleConfig == null) return null;
return List.of(particleConfig);
}
public Boolean getPrecipitation() {
@@ -125,15 +130,12 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
return downfall;
}
public SoundEvent getLoopSound() {
return loopSound;
}
public BiomeEffects.MoodSound getMoodSound() {
return moodSound;
}
public BiomeEffects.AdditionsSound getAdditionsSound() {
return additionsSound;
public AmbientSounds getAmbientSoundConfig() {
List<AmbientSounds.Additions> additions = additionsSound == null ? List.of() : List.of(additionsSound);
return new AmbientSounds(
loopSound,
moodSound,
additions
);
}
}