mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Expose LivingEntity hurt direction
This commit is contained in:
parent
3f4b9fd365
commit
1cedeb97af
@ -35,12 +35,20 @@
|
||||
public final InventoryMenu inventoryMenu;
|
||||
public AbstractContainerMenu containerMenu;
|
||||
protected FoodData foodData = new FoodData();
|
||||
@@ -188,7 +198,18 @@
|
||||
@@ -181,13 +191,24 @@
|
||||
private Optional<GlobalPos> lastDeathLocation;
|
||||
@Nullable
|
||||
public FishingHook fishing;
|
||||
- protected float hurtDir;
|
||||
+ public float hurtDir; // Paper - protected -> public
|
||||
@Nullable
|
||||
public Vec3 currentImpulseImpactPos;
|
||||
@Nullable
|
||||
public Entity currentExplosionCause;
|
||||
private boolean ignoreFallDamageFromCurrentImpulse;
|
||||
private int currentImpulseContextResetGraceTime;
|
||||
+ public boolean affectsSpawning = true; // Paper - Affects Spawning API
|
||||
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public boolean fauxSleeping;
|
||||
+ public int oldLevel = -1;
|
||||
@ -50,10 +58,9 @@
|
||||
+ return (CraftHumanEntity) super.getBukkitEntity();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
|
||||
public Player(Level world, BlockPos pos, float yaw, GameProfile gameProfile) {
|
||||
super(EntityType.PLAYER, world);
|
||||
this.lastItemInMainHand = ItemStack.EMPTY;
|
||||
@@ -261,7 +282,7 @@
|
||||
this.updateIsUnderwater();
|
||||
super.tick();
|
||||
@ -605,10 +612,12 @@
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2005,18 +2201,29 @@
|
||||
@@ -2003,20 +2199,31 @@
|
||||
@Override
|
||||
public ImmutableList<Pose> getDismountPoses() {
|
||||
return ImmutableList.of(Pose.STANDING, Pose.CROUCHING, Pose.SWIMMING);
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ // Paper start - PlayerReadyArrowEvent
|
||||
+ protected boolean tryReadyArrow(ItemStack bow, ItemStack itemstack) {
|
||||
+ return !(this instanceof ServerPlayer) ||
|
||||
@ -617,9 +626,9 @@
|
||||
+ org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(bow),
|
||||
+ org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(itemstack)
|
||||
+ ).callEvent();
|
||||
+ }
|
||||
}
|
||||
+ // Paper end - PlayerReadyArrowEvent
|
||||
+
|
||||
|
||||
@Override
|
||||
public ItemStack getProjectile(ItemStack stack) {
|
||||
if (!(stack.getItem() instanceof ProjectileWeaponItem)) {
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user