13
0
geforkt von Mirrors/Paper

#955: Add test for BlockData class of Material

By: BlackHole <black-hole@live.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2021-11-23 08:07:10 +11:00
Ursprung 0e36e68e8b
Commit e3c01e2bf0

Datei anzeigen

@ -20,12 +20,14 @@ import net.minecraft.world.level.block.entity.TileEntityFurnace;
import net.minecraft.world.level.block.state.BlockBase; import net.minecraft.world.level.block.state.BlockBase;
import net.minecraft.world.level.block.state.IBlockData; import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.MovingObjectPositionBlock; import net.minecraft.world.phys.MovingObjectPositionBlock;
import org.bukkit.block.data.BlockData;
import org.bukkit.craftbukkit.CraftEquipmentSlot; import org.bukkit.craftbukkit.CraftEquipmentSlot;
import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.util.CraftMagicNumbers; import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.enchantments.EnchantmentTarget; import org.bukkit.enchantments.EnchantmentTarget;
import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.bukkit.material.MaterialData;
import org.bukkit.support.AbstractTestingBase; import org.bukkit.support.AbstractTestingBase;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
@ -273,4 +275,15 @@ public class PerMaterialTest extends AbstractTestingBase {
assertThat(material.getEquipmentSlot(), is(expected)); assertThat(material.getEquipmentSlot(), is(expected));
} }
} }
@Test
public void testBlockDataClass() {
if (material.isBlock()) {
Class<?> expectedClass = material.data;
if (expectedClass != MaterialData.class) {
BlockData blockData = Bukkit.createBlockData(material);
assertTrue(expectedClass + " <> " + blockData.getClass(), expectedClass.isInstance(blockData));
}
}
}
} }