#855: Add HumanEntity#getItemInUse and Material#getSlipperiness

By: konsolas <vincentyntang@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2021-06-12 21:07:45 +01:00
parent 3e7e42a371
commit 02ebbcfc81
2 changed files with 13 additions and 0 deletions

View file

@ -450,6 +450,12 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
return getHandle().isHandRaised();
}
@Override
public ItemStack getItemInUse() {
net.minecraft.world.item.ItemStack item = getHandle().getActiveItem();
return item.isEmpty() ? null : CraftItemStack.asCraftMirror(item);
}
@Override
public boolean setWindowProperty(InventoryView.Property prop, int value) {
return false;

View file

@ -242,6 +242,13 @@ public class PerMaterialTest extends AbstractTestingBase {
}
}
@Test
public void testSlipperiness() {
if (material.isBlock()) {
assertThat(material.getSlipperiness(), is(CraftMagicNumbers.getBlock(material).getFrictionFactor()));
}
}
@Test
public void testBlockDataCreation() {
if (material.isBlock()) {