diff options
author | maxcom1 <[email protected]> | 2024-03-23 22:26:17 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2024-03-23 17:26:17 -0400 |
commit | b6001403e9703cadaa6e8c8558e732b91c3c6d6e (patch) | |
tree | a8c57bbc334a8ad48d4ad2b43db335667b142bee /patches/server/0842-Add-Entity-Body-Yaw-API.patch | |
parent | 9ec7dfcbc41c6e625de0050b6997160a75df9f44 (diff) | |
download | Paper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.tar.gz Paper-b6001403e9703cadaa6e8c8558e732b91c3c6d6e.zip |
Add methods to change entity physics (#10334)
Diffstat (limited to 'patches/server/0842-Add-Entity-Body-Yaw-API.patch')
-rw-r--r-- | patches/server/0842-Add-Entity-Body-Yaw-API.patch | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/patches/server/0842-Add-Entity-Body-Yaw-API.patch b/patches/server/0842-Add-Entity-Body-Yaw-API.patch new file mode 100644 index 0000000000..87974f97d5 --- /dev/null +++ b/patches/server/0842-Add-Entity-Body-Yaw-API.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: TheTuso <[email protected]> +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/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +index b4ed7612a019a3d4d473dfbfed2067ea437fee06..509550bbfb7c6bcff5dffa535f40af12aab898a8 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +@@ -1136,6 +1136,31 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { + public boolean isInPowderedSnow() { + return getHandle().isInPowderSnow || getHandle().wasInPowderSnow; // depending on the location in the entity "tick" either could be needed. + } ++ ++ @Override ++ public double getX() { ++ return this.entity.getX(); ++ } ++ ++ @Override ++ public double getY() { ++ return this.entity.getY(); ++ } ++ ++ @Override ++ public double getZ() { ++ return this.entity.getZ(); ++ } ++ ++ @Override ++ public float getPitch() { ++ return this.entity.getXRot(); ++ } ++ ++ @Override ++ public float getYaw() { ++ return this.entity.getBukkitYaw(); ++ } + // Paper end + + // Paper start - missing entity api +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +index e8ef40fed546608d995fd31dc8a9721c00537749..fbe1d5051f8767db240e4d0c256f4a1088c4339c 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +@@ -1112,6 +1112,16 @@ 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) { |