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 { 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.MinecraftServer;
import net.minestom.server.instance.Instance; import net.minestom.server.instance.Instance;
import net.minestom.server.sound.SoundEvent; 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 net.minestom.server.world.biome.BiomeEffects;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; 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)) (TypeLoader<EntityType>) (annotatedType, o, configLoader, depthTracker) -> new MinestomEntityType((String) o))
.registerLoader(BlockState.class, .registerLoader(BlockState.class,
(TypeLoader<BlockState>) (annotatedType, o, configLoader, depthTracker) -> worldHandle.createBlockState((String) o)) (TypeLoader<BlockState>) (annotatedType, o, configLoader, depthTracker) -> worldHandle.createBlockState((String) o))
.registerLoader(BiomeEffects.Particle.class, BiomeParticleConfigTemplate::new) .registerLoader(AmbientParticle.class, BiomeParticleConfigTemplate::new)
.registerLoader(BiomeEffects.MoodSound.class, BiomeMoodSoundTemplate::new) .registerLoader(AmbientSounds.Mood.class, BiomeMoodSoundTemplate::new)
.registerLoader(BiomeEffects.AdditionsSound.class, BiomeAdditionsSoundTemplate::new) .registerLoader(AmbientSounds.Additions.class, BiomeAdditionsSoundTemplate::new)
.registerLoader(SoundEvent.class, SoundEventTemplate::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.color.Color;
import net.minestom.server.registry.DynamicRegistry; import net.minestom.server.registry.DynamicRegistry;
import net.minestom.server.registry.RegistryKey; 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.Biome;
import net.minestom.server.world.biome.BiomeEffects; import net.minestom.server.world.biome.BiomeEffects;
import org.intellij.lang.annotations.Subst; import org.intellij.lang.annotations.Subst;
@@ -27,6 +28,11 @@ public class MinestomUserDefinedBiomeFactory implements BiomeFactory {
return first; 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") @Subst("value")
protected static String createBiomeID(ConfigPack pack, String biomeId) { protected static String createBiomeID(ConfigPack pack, String biomeId) {
return pack.getID().toLowerCase() + "/" + biomeId.toLowerCase(Locale.ROOT); 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())); Key key = Key.key("terra", createBiomeID(pack, source.getID()));
BiomeEffects.Builder effectsBuilder = BiomeEffects.builder() BiomeEffects.Builder effectsBuilder = BiomeEffects.builder()
.fogColor(mergeNullable(properties.getFogColor(), parentEffects.fogColor()))
.skyColor(mergeNullable(properties.getSkyColor(), parentEffects.skyColor()))
.waterColor(mergeNullable(properties.getWaterColor(), parentEffects.waterColor())) .waterColor(mergeNullable(properties.getWaterColor(), parentEffects.waterColor()))
.waterFogColor(mergeNullable(properties.getWaterFogColor(), parentEffects.waterFogColor()))
.foliageColor(mergeNullable(properties.getFoliageColor(), parentEffects.foliageColor())) .foliageColor(mergeNullable(properties.getFoliageColor(), parentEffects.foliageColor()))
.grassColor(mergeNullable(properties.getGrassColor(), parentEffects.grassColor())) .grassColor(mergeNullable(properties.getGrassColor(), parentEffects.grassColor()))
.grassColorModifier(mergeNullable(properties.getGrassColorModifier(), parentEffects.grassColorModifier())) .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());
if(effectsBuilder.build().equals(BiomeEffects.PLAINS_EFFECTS)) { Biome.Builder targetBuilder = Biome.builder()
effectsBuilder.fogColor(new Color(0xC0D8FE)); // circumvent a minestom bug
}
Biome target = Biome.builder()
.downfall(mergeNullable(properties.getDownfall(), parent.downfall())) .downfall(mergeNullable(properties.getDownfall(), parent.downfall()))
.hasPrecipitation(mergeNullable(properties.getPrecipitation(), parent.hasPrecipitation())) .precipitation(mergeNullable(properties.getPrecipitation(), parent.hasPrecipitation()))
.temperature(mergeNullable(properties.getTemperature(), parent.temperature())) .temperature(mergeNullable(properties.getTemperature(), parent.temperature()))
.temperatureModifier(mergeNullable(properties.getTemperatureModifier(), parent.temperatureModifier())) .effects(effectsBuilder.build());
.effects(effectsBuilder.build())
.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); RegistryKey<Biome> registryKey = MinecraftServer.getBiomeRegistry().register(key, target);
return new UserDefinedBiome(key, registryKey, source.getID(), 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.annotations.Value;
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate; import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
import net.minestom.server.sound.SoundEvent; import net.minestom.server.sound.SoundEvent;
import net.minestom.server.world.attribute.AmbientSounds;
import net.minestom.server.world.biome.BiomeEffects; import net.minestom.server.world.biome.BiomeEffects;
public class BiomeAdditionsSoundTemplate implements ObjectTemplate<BiomeEffects.AdditionsSound> { public class BiomeAdditionsSoundTemplate implements ObjectTemplate<AmbientSounds.Additions> {
@Value("sound") @Value("sound")
@Default @Default
private SoundEvent sound = null; private SoundEvent sound = null;
@@ -17,8 +18,8 @@ public class BiomeAdditionsSoundTemplate implements ObjectTemplate<BiomeEffects.
private Double soundChance = null; private Double soundChance = null;
@Override @Override
public BiomeEffects.AdditionsSound get() { public AmbientSounds.Additions get() {
if(sound == null) return null; 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.annotations.Value;
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate; import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
import net.minestom.server.sound.SoundEvent; import net.minestom.server.sound.SoundEvent;
import net.minestom.server.world.attribute.AmbientSounds;
import net.minestom.server.world.biome.BiomeEffects; import net.minestom.server.world.biome.BiomeEffects;
public class BiomeMoodSoundTemplate implements ObjectTemplate<BiomeEffects.MoodSound> { public class BiomeMoodSoundTemplate implements ObjectTemplate<AmbientSounds.Mood> {
@Value("sound") @Value("sound")
@Default @Default
private SoundEvent sound = null; private SoundEvent sound = null;
@@ -25,9 +26,9 @@ public class BiomeMoodSoundTemplate implements ObjectTemplate<BiomeEffects.MoodS
private Double soundExtraDistance = null; private Double soundExtraDistance = null;
@Override @Override
public BiomeEffects.MoodSound get() { public AmbientSounds.Mood get() {
if(sound == null) return null; if(sound == null) return null;
return new BiomeEffects.MoodSound( return new AmbientSounds.Mood(
sound, sound,
soundCultivationTicks, soundCultivationTicks,
soundSpawnRange, 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.annotations.Value;
import com.dfsek.tectonic.api.config.template.object.ObjectTemplate; import com.dfsek.tectonic.api.config.template.object.ObjectTemplate;
import net.minestom.server.particle.Particle; import net.minestom.server.particle.Particle;
import net.minestom.server.world.attribute.AmbientParticle;
import net.minestom.server.world.biome.BiomeEffects; import net.minestom.server.world.biome.BiomeEffects;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeEffects.Particle> { public class BiomeParticleConfigTemplate implements ObjectTemplate<AmbientParticle> {
@Value("particle") @Value("particle")
@Default @Default
private String particle = null; private String particle = null;
@@ -18,7 +19,7 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeEffects.
private Float probability = null; private Float probability = null;
@Override @Override
public BiomeEffects.Particle get() { public AmbientParticle get() {
if(particle == null || probability == null) { if(particle == null || probability == null) {
return null; return null;
} }
@@ -31,9 +32,9 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeEffects.
return null; return null;
} }
return new BiomeEffects.Particle( return new AmbientParticle(
probability, parsedParticle,
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 com.dfsek.tectonic.api.config.template.annotations.Value;
import net.kyori.adventure.util.RGBLike; import net.kyori.adventure.util.RGBLike;
import net.minestom.server.sound.SoundEvent; 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.Biome.TemperatureModifier;
import net.minestom.server.world.biome.BiomeEffects; import net.minestom.server.world.biome.BiomeEffects;
import net.minestom.server.world.biome.BiomeEffects.GrassColorModifier; import net.minestom.server.world.biome.BiomeEffects.GrassColorModifier;
import com.dfsek.terra.api.properties.Properties; import com.dfsek.terra.api.properties.Properties;
import java.util.List;
public class VanillaBiomeProperties implements ConfigTemplate, Properties { public class VanillaBiomeProperties implements ConfigTemplate, Properties {
@Value("colors.grass") @Value("colors.grass")
@@ -43,7 +47,7 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
@Value("particles") @Value("particles")
@Default @Default
private BiomeEffects.Particle particleConfig = null; private AmbientParticle particleConfig = null;
@Value("climate.precipitation") @Value("climate.precipitation")
@Default @Default
@@ -67,11 +71,11 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
@Value("sound.mood-sound") @Value("sound.mood-sound")
@Default @Default
private BiomeEffects.MoodSound moodSound = null; private AmbientSounds.Mood moodSound = null;
@Value("sound.additions-sound") @Value("sound.additions-sound")
@Default @Default
private BiomeEffects.AdditionsSound additionsSound = null; private AmbientSounds.Additions additionsSound = null;
// @Value("sound.music") // @Value("sound.music")
// @Default // @Default
@@ -105,8 +109,9 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
return grassColorModifier; return grassColorModifier;
} }
public BiomeEffects.Particle getParticleConfig() { public List<AmbientParticle> getParticleConfig() {
return particleConfig; if (particleConfig == null) return null;
return List.of(particleConfig);
} }
public Boolean getPrecipitation() { public Boolean getPrecipitation() {
@@ -125,15 +130,12 @@ public class VanillaBiomeProperties implements ConfigTemplate, Properties {
return downfall; return downfall;
} }
public SoundEvent getLoopSound() { public AmbientSounds getAmbientSoundConfig() {
return loopSound; List<AmbientSounds.Additions> additions = additionsSound == null ? List.of() : List.of(additionsSound);
} return new AmbientSounds(
loopSound,
public BiomeEffects.MoodSound getMoodSound() { moodSound,
return moodSound; additions
} );
public BiomeEffects.AdditionsSound getAdditionsSound() {
return additionsSound;
} }
} }