geforkt von Mirrors/Paper
64 Zeilen
2.4 KiB
Diff
64 Zeilen
2.4 KiB
Diff
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/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
index 75d24e0d9f3c84f436d967415ee469e5969d3368..e7f967e8f88e6fc5bcfdc033d14bb2b65dda3e67 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
@@ -1139,6 +1139,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 - Collision API
|
|
@Override
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
index 45ebd9ffc37163e3a11c80c15b41c5aeed2b6983..33e977f87e06c4f022b913006c20ac53eb28f172 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -1075,6 +1075,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) {
|