2023-02-09 18:31:51 +01:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2023-08-21 09:35:05 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
2023-11-04 20:20:01 +01:00
|
|
|
index 841a007f24c3d9be2e8b6a9d03ba1694544996fd..9bd6d3be29b2f50bc91fa02382e34213f51337f5 100644
|
2023-08-21 09:35:05 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
2023-10-10 23:09:45 +02:00
|
|
|
@@ -1450,6 +1450,31 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
2023-08-21 09:35:05 +02:00
|
|
|
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 - Collision API
|
|
|
|
@Override
|
2023-02-09 18:31:51 +01:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2023-11-04 20:20:01 +01:00
|
|
|
index 962f4653757f870aff1bea8e98bcafabe639dc86..6a4639a4584f3497661f8870d5722e300638e52a 100644
|
2023-02-09 18:31:51 +01:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
2023-09-10 04:28:03 +02:00
|
|
|
@@ -1056,6 +1056,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
2023-02-09 18:31:51 +01:00
|
|
|
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) {
|