mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 02:20:57 +00:00
fix: ignore and warn on snbt on particles
This commit is contained in:
@@ -3,8 +3,18 @@ package com.dfsek.terra.minestom.config;
|
|||||||
import com.dfsek.tectonic.api.config.template.annotations.Default;
|
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.kyori.adventure.nbt.BinaryTagIO;
|
||||||
|
import net.kyori.adventure.nbt.CompoundBinaryTag;
|
||||||
|
import net.kyori.adventure.nbt.TagStringIO;
|
||||||
|
import net.minestom.server.MinecraftServer;
|
||||||
|
import net.minestom.server.command.builder.arguments.Argument;
|
||||||
|
import net.minestom.server.command.builder.arguments.minecraft.registry.ArgumentParticle;
|
||||||
import net.minestom.server.particle.Particle;
|
import net.minestom.server.particle.Particle;
|
||||||
import net.minestom.server.world.biome.BiomeEffects;
|
import net.minestom.server.world.biome.BiomeEffects;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeEffects.Particle> {
|
public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeEffects.Particle> {
|
||||||
@@ -22,9 +32,15 @@ public class BiomeParticleConfigTemplate implements ObjectTemplate<BiomeEffects.
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String[] parts = particle.split("\\{");
|
||||||
|
Particle parsedParticle = Particle.fromKey(parts[0]);
|
||||||
|
if (parts.length > 1) {
|
||||||
|
LoggerFactory.getLogger(BiomeParticleConfigTemplate.class).warn("Particle {} has additional data, which will be ignored.", particle);
|
||||||
|
}
|
||||||
|
|
||||||
return new BiomeEffects.Particle(
|
return new BiomeEffects.Particle(
|
||||||
probability,
|
probability,
|
||||||
Particle.fromKey(particle)
|
parsedParticle
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user