#855: Add HumanEntity#getItemInUse and Material#getSlipperiness

This commit is contained in:
konsolas 2021-06-12 21:07:45 +01:00 committed by md_5
parent d9c69b44da
commit 20d3e57c4e
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11
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(); return getHandle().isHandRaised();
} }
@Override
public ItemStack getItemInUse() {
net.minecraft.world.item.ItemStack item = getHandle().getActiveItem();
return item.isEmpty() ? null : CraftItemStack.asCraftMirror(item);
}
@Override @Override
public boolean setWindowProperty(InventoryView.Property prop, int value) { public boolean setWindowProperty(InventoryView.Property prop, int value) {
return false; 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 @Test
public void testBlockDataCreation() { public void testBlockDataCreation() {
if (material.isBlock()) { if (material.isBlock()) {