@@ -13,6 +13,7 @@ import net.minecraft.core.particles.ParticleParamRedstone;
|
||||
import net.minecraft.core.particles.ParticleType;
|
||||
import net.minecraft.core.particles.SculkChargeParticleOptions;
|
||||
import net.minecraft.core.particles.ShriekParticleOption;
|
||||
import net.minecraft.core.particles.TargetColorParticleOption;
|
||||
import net.minecraft.core.particles.VibrationParticleOption;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.nbt.DynamicOpsNBT;
|
||||
@@ -112,6 +113,11 @@ public class ParticleTest {
|
||||
return;
|
||||
}
|
||||
|
||||
if (bukkit.getDataType().equals(Particle.TargetColor.class)) {
|
||||
testTargetColor(bukkit, minecraft);
|
||||
return;
|
||||
}
|
||||
|
||||
fail(String.format("""
|
||||
No test found for particle %s.
|
||||
Please add a test case for it here.
|
||||
@@ -242,6 +248,28 @@ public class ParticleTest {
|
||||
""", bukkit.getKey(), expected, actual)); // Print expected and got since we use assert true
|
||||
}
|
||||
|
||||
private <T extends ParticleParam> void testTargetColor(Particle bukkit, net.minecraft.core.particles.Particle<T> minecraft) {
|
||||
Color color = Color.fromRGB(236, 28, 36);
|
||||
Particle.TargetColor targetColor = new Particle.TargetColor(new Location(null, 1, 5, 9), color);
|
||||
|
||||
TargetColorParticleOption param = createAndTest(bukkit, minecraft, targetColor, TargetColorParticleOption.class);
|
||||
|
||||
Vec3D pos = param.target();
|
||||
assertEquals(new Vec3D(1.0, 5.0, 9.0), pos, String.format("""
|
||||
Vibration position for particle %s do not match.
|
||||
Did something change in the implementation or minecraft?
|
||||
""", bukkit.getKey()));
|
||||
|
||||
int actual = param.color();
|
||||
int expected = color.asRGB();
|
||||
assertEquals(expected, actual, String.format("""
|
||||
Color for particle %s do not match.
|
||||
Did something change in the implementation or minecraft?
|
||||
Expected: %s.
|
||||
Got: %s.
|
||||
""", bukkit.getKey(), expected, actual)); // Print expected and got since we use assert true
|
||||
}
|
||||
|
||||
private <D extends ParticleParam, T extends ParticleParam> D createAndTest(Particle bukkit, net.minecraft.core.particles.Particle<T> minecraft, Object data, Class<D> paramClass) {
|
||||
@SuppressWarnings("unchecked")
|
||||
T particleParam = (T) assertDoesNotThrow(() -> CraftParticle.createParticleParam(bukkit, data), String.format("""
|
||||
|
||||
Reference in New Issue
Block a user