Commits
Black Hole authored and md_5 committed 7c4707e46b1
13 13 | import net.minecraft.world.item.ItemRecord; |
14 14 | import net.minecraft.world.level.BlockAccessAir; |
15 15 | import net.minecraft.world.level.block.Block; |
16 16 | import net.minecraft.world.level.block.BlockFalling; |
17 17 | import net.minecraft.world.level.block.BlockFire; |
18 18 | import net.minecraft.world.level.block.Blocks; |
19 19 | import net.minecraft.world.level.block.entity.TileEntityFurnace; |
20 20 | import net.minecraft.world.level.block.state.BlockBase; |
21 21 | import net.minecraft.world.level.block.state.IBlockData; |
22 22 | import net.minecraft.world.phys.MovingObjectPositionBlock; |
23 + | import org.bukkit.block.data.BlockData; |
23 24 | import org.bukkit.craftbukkit.CraftEquipmentSlot; |
24 25 | import org.bukkit.craftbukkit.inventory.CraftItemStack; |
25 26 | import org.bukkit.craftbukkit.util.CraftMagicNumbers; |
26 27 | import org.bukkit.enchantments.EnchantmentTarget; |
27 28 | import org.bukkit.inventory.EquipmentSlot; |
28 29 | import org.bukkit.inventory.ItemStack; |
30 + | import org.bukkit.material.MaterialData; |
29 31 | import org.bukkit.support.AbstractTestingBase; |
30 32 | import org.junit.BeforeClass; |
31 33 | import org.junit.Test; |
32 34 | import org.junit.runner.RunWith; |
33 35 | import org.junit.runners.Parameterized; |
34 36 | import org.junit.runners.Parameterized.Parameter; |
35 37 | import org.junit.runners.Parameterized.Parameters; |
36 38 | |
37 39 | Parameterized.class) | (
38 40 | public class PerMaterialTest extends AbstractTestingBase { |
266 268 | } |
267 269 | } |
268 270 | |
269 271 | |
270 272 | public void testEquipmentSlot() { |
271 273 | if (material.isItem()) { |
272 274 | EquipmentSlot expected = CraftEquipmentSlot.getSlot(EntityInsentient.getEquipmentSlotForItem(CraftItemStack.asNMSCopy(new ItemStack(material)))); |
273 275 | assertThat(material.getEquipmentSlot(), is(expected)); |
274 276 | } |
275 277 | } |
278 + | |
279 + | |
280 + | public void testBlockDataClass() { |
281 + | if (material.isBlock()) { |
282 + | Class<?> expectedClass = material.data; |
283 + | if (expectedClass != MaterialData.class) { |
284 + | BlockData blockData = Bukkit.createBlockData(material); |
285 + | assertTrue(expectedClass + " <> " + blockData.getClass(), expectedClass.isInstance(blockData)); |
286 + | } |
287 + | } |
288 + | } |
276 289 | } |