mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-29 12:27:59 +01:00
Add Entity Body Yaw API (#8822)
This commit is contained in:
parent
b2b666ced2
commit
ab76bb014b
32
patches/api/Add-Entity-Body-Yaw-API.patch
Normal file
32
patches/api/Add-Entity-Body-Yaw-API.patch
Normal file
@ -0,0 +1,32 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: TheTuso <piotrekpasztor@gmail.com>
|
||||
Date: Thu, 2 Feb 2023 16:40:11 +0100
|
||||
Subject: [PATCH] Add Entity Body Yaw API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
|
||||
* @param amount the amount of damage to do
|
||||
*/
|
||||
void damageItemStack(org.bukkit.inventory.@NotNull EquipmentSlot slot, int amount);
|
||||
+
|
||||
+ /**
|
||||
+ * Gets entity body yaw
|
||||
+ *
|
||||
+ * @return entity body yaw
|
||||
+ * @see Location#getYaw()
|
||||
+ */
|
||||
+ float getBodyYaw();
|
||||
+
|
||||
+ /**
|
||||
+ * Sets entity body yaw
|
||||
+ *
|
||||
+ * @param bodyYaw new entity body yaw
|
||||
+ * @see Location#setYaw(float)
|
||||
+ */
|
||||
+ void setBodyYaw(float bodyYaw);
|
||||
// Paper end
|
||||
}
|
27
patches/server/Add-Entity-Body-Yaw-API.patch
Normal file
27
patches/server/Add-Entity-Body-Yaw-API.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: TheTuso <piotrekpasztor@gmail.com>
|
||||
Date: Thu, 2 Feb 2023 16:40:41 +0100
|
||||
Subject: [PATCH] Add Entity Body Yaw API
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
||||
this.damageItemStack0(this.getHandle().getItemBySlot(nmsSlot), amount, nmsSlot);
|
||||
}
|
||||
|
||||
+ @Override
|
||||
+ public float getBodyYaw() {
|
||||
+ return this.getHandle().getVisualRotationYInDegrees();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void setBodyYaw(float bodyYaw) {
|
||||
+ this.getHandle().setYBodyRot(bodyYaw);
|
||||
+ }
|
||||
+
|
||||
private void damageItemStack0(net.minecraft.world.item.ItemStack nmsStack, int amount, net.minecraft.world.entity.EquipmentSlot slot) {
|
||||
nmsStack.hurtAndBreak(amount, this.getHandle(), livingEntity -> {
|
||||
if (slot != null) {
|
Loading…
Reference in New Issue
Block a user