Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 12:30:06 +01:00
bab31b6f55
The Enchantment damage increase API added previously used the EntityCategory enum as a parameter. These values are now however determined by tags instead of the categories themselves. Deprecated the outdated api method, create a new overload that takes EntityType instead and implement deprecated method by guessing an entity type from the builtin registry based on the category passed. This method allows a) the tags to still be modified and the legacy method still respecting such. b) potential cursed implementations of enchantments of plugins to not break that override the getDamageBonus method on Enchantment.
66 Zeilen
2.2 KiB
Diff
66 Zeilen
2.2 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 365281dfc0308c5db0c72b56208d9b87be0e955e..991b94ff1186b1071a94b2662873dc071255e2e6 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
@@ -1164,6 +1164,33 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
|
}
|
|
// Paper end - entity powdered snow API
|
|
|
|
+ // Paper start - entity body yaw API
|
|
+ @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 - entity body yaw API
|
|
+
|
|
// Paper start - missing entity api
|
|
@Override
|
|
public boolean isInvisible() { // Paper - moved up from LivingEntity
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
index e87a52f5dbb8cd984fd2203d912ac3f1ff9d68aa..2e614eb8cdc249670c3ca2be42704e4de69f3175 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -1154,4 +1154,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
|
|
this.getHandle().frictionState = state;
|
|
}
|
|
// Paper end - friction API
|
|
+
|
|
+ // Paper start - body yaw API
|
|
+ @Override
|
|
+ public float getBodyYaw() {
|
|
+ return this.getHandle().getVisualRotationYInDegrees();
|
|
+ }
|
|
+
|
|
+ @Override
|
|
+ public void setBodyYaw(final float bodyYaw) {
|
|
+ this.getHandle().setYBodyRot(bodyYaw);
|
|
+ }
|
|
+ // Paper end - body yaw API
|
|
}
|