13
0
geforkt von Mirrors/Paper

#819: Implemented test for Material#getEquipmentSlot() method

By: Jakub Zacek <dawon.cz@gmail.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2021-04-13 19:16:32 +10:00
Ursprung 304aa91bb1
Commit 8ce553209c

Datei anzeigen

@ -7,6 +7,7 @@ import java.util.List;
import java.util.Map;
import net.minecraft.core.BlockPosition;
import net.minecraft.world.EnumHand;
import net.minecraft.world.entity.EntityInsentient;
import net.minecraft.world.entity.player.EntityHuman;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemRecord;
@ -19,9 +20,11 @@ import net.minecraft.world.level.block.entity.TileEntityFurnace;
import net.minecraft.world.level.block.state.BlockBase;
import net.minecraft.world.level.block.state.IBlockData;
import net.minecraft.world.phys.MovingObjectPositionBlock;
import org.bukkit.craftbukkit.CraftEquipmentSlot;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.craftbukkit.util.CraftMagicNumbers;
import org.bukkit.enchantments.EnchantmentTarget;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;
import org.bukkit.support.AbstractTestingBase;
import org.bukkit.support.Util;
@ -256,4 +259,12 @@ public class PerMaterialTest extends AbstractTestingBase {
assertThat(material.getCraftingRemainingItem(), is(expected));
}
}
@Test
public void testEquipmentSlot() {
if (material.isItem()) {
EquipmentSlot expected = CraftEquipmentSlot.getSlot(EntityInsentient.j(CraftItemStack.asNMSCopy(new ItemStack(material)))); // PAIL rename getEquipmentSlotForItem
assertThat(material.getEquipmentSlot(), is(expected));
}
}
}