Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
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 d97bc672a8e6fb7c2a0ed668cc15b54bf4254217..314168d162f1242eca67706fd3fa225f1ed30cc4 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
@@ -1450,6 +1450,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 6ec847b7928cf4217f4588cbb35224fe8db85fd4..bb5980b7e265860968bc86216f2f3ad47301830c 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -1056,6 +1056,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) {
|