Expose LivingEntity hurt direction

This commit is contained in:
Mark Vainomaa
2020-12-13 05:32:05 +02:00
parent 3f4b9fd365
commit 1cedeb97af
3 changed files with 37 additions and 9 deletions

View File

@@ -125,6 +125,13 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity {
}
}
// Paper start
@Override
public void setHurtDirection(float hurtDirection) {
this.getHandle().hurtDir = hurtDirection;
}
// Paper end
@Override
public int getSleepTicks() {
return this.getHandle().sleepCounter;

View File

@@ -1024,4 +1024,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
this.getHandle().take(((CraftItem) item).getHandle(), quantity);
}
// Paper end - pickup animation API
// Paper start - hurt direction API
@Override
public float getHurtDirection() {
return this.getHandle().getHurtDir();
}
@Override
public void setHurtDirection(final float hurtDirection) {
throw new UnsupportedOperationException("Cannot set the hurt direction on a non player");
}
// Paper end - hurt direction API
}