3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-21 05:50:05 +01:00
Paper/src/test/java/org/bukkit/ParticleTest.java

36 Zeilen
1.4 KiB
Java

2016-02-29 22:32:46 +01:00
package org.bukkit;
2018-08-26 04:00:00 +02:00
import net.minecraft.server.IRegistry;
2018-07-15 02:00:00 +02:00
import org.bukkit.block.data.BlockData;
2016-02-29 22:32:46 +01:00
import org.bukkit.craftbukkit.CraftParticle;
2018-07-15 02:00:00 +02:00
import org.bukkit.craftbukkit.block.data.CraftBlockData;
import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import org.bukkit.support.AbstractTestingBase;
2016-02-29 22:32:46 +01:00
import org.junit.Assert;
import org.junit.Test;
2018-07-15 02:00:00 +02:00
public class ParticleTest extends AbstractTestingBase {
2016-02-29 22:32:46 +01:00
@Test
public void verifyMapping() {
for (Particle bukkit : Particle.values()) {
2018-07-15 02:00:00 +02:00
Object data = null;
if (bukkit.getDataType().equals(ItemStack.class)) {
data = new ItemStack(Material.STONE);
} else if (bukkit.getDataType() == MaterialData.class) {
data = new MaterialData(Material.LEGACY_STONE);
} else if (bukkit.getDataType() == Particle.DustOptions.class) {
data = new Particle.DustOptions(Color.BLACK, 0);
} else if (bukkit.getDataType() == BlockData.class) {
data = CraftBlockData.newData(Material.STONE, "");
}
Assert.assertNotNull("Missing Bukkit->NMS particle mapping for " + bukkit, CraftParticle.toNMS(bukkit, data));
2016-02-29 22:32:46 +01:00
}
2019-04-23 04:00:00 +02:00
for (net.minecraft.server.Particle nms : IRegistry.PARTICLE_TYPE) {
Assert.assertNotNull("Missing NMS->Bukkit particle mapping for " + IRegistry.PARTICLE_TYPE.getKey(nms), CraftParticle.toBukkit(nms));
2016-02-29 22:32:46 +01:00
}
}
}