Paper/patches/server/0843-Add-Entity-Body-Yaw-API.patch
Owen 89d51d5f29
Allow enabling sand duping (#10191)
Because this exploit has been widely known for years and has not been fixed by Mojang, we decided that it was worth allowing people to toggle it on/off due to how easy it is to make it configurable.

It should be noted that this decision does not promise all future exploits will be configurable.
2024-03-03 17:05:34 -05:00

64 lines
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 69dc7d9cc9ebd681d842099e2de521fd11ff5242..ba915f1b3cd00c8afe39ece9c9e68737673777f5 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 - 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 d7492b969750fddca8bf09fdf2e91b146db03dc4..3302d8e9b7c2c48b20dd257f4699b263d3bc52dc 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1113,6 +1113,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) {