13
0
geforkt von Mirrors/Paper

Add getHandRaised to LivingEntity (#5752)

Dieser Commit ist enthalten in:
Jake Potrebic 2021-05-29 18:51:13 -07:00
Ursprung 0d254aed35
Commit 4e835fca94
5 geänderte Dateien mit 21 neuen und 6 gelöschten Zeilen

Datei anzeigen

@ -61,9 +61,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/entity/LivingEntity.java
+++ b/src/main/java/org/bukkit/entity/LivingEntity.java
@@ -0,0 +0,0 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource
* @return Whether or not this entity is using or charging an attack (Bow pulled back, drinking potion, eating food)
*/
boolean isHandRaised();
@NotNull
org.bukkit.inventory.EquipmentSlot getHandRaised();
+
+ /**
+ * Get entity jump state.

Datei anzeigen

@ -48,5 +48,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ * @return Whether or not this entity is using or charging an attack (Bow pulled back, drinking potion, eating food)
+ */
+ boolean isHandRaised();
+
+ /**
+ * Gets the hand raised by this living entity. Will be either
+ * {@link org.bukkit.inventory.EquipmentSlot#HAND} or
+ * {@link org.bukkit.inventory.EquipmentSlot#OFF_HAND}.
+ *
+ * @return the hand raised
+ */
+ @NotNull
+ org.bukkit.inventory.EquipmentSlot getHandRaised();
// Paper end
}

Datei anzeigen

@ -9,9 +9,10 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
((EntityInsentient) getHandle()).getControllerJump().jump();
}
}
+
+ @Override
+ public void playPickupItemAnimation(org.bukkit.entity.Item item, int quantity) {
+ getHandle().receive(((CraftItem) item).getHandle(), quantity);

Datei anzeigen

@ -38,8 +38,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -0,0 +0,0 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public boolean isHandRaised() {
return getHandle().isHandRaised();
public org.bukkit.inventory.EquipmentSlot getHandRaised() {
return getHandle().getRaisedHand() == net.minecraft.world.EnumHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND;
}
+
+ @Override
@ -55,6 +55,5 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ ((EntityInsentient) getHandle()).getControllerJump().jump();
+ }
+ }
+
// Paper end
}

Datei anzeigen

@ -58,6 +58,11 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ @Override
+ public boolean isHandRaised() {
+ return getHandle().isHandRaised();
+ }
+
+ @Override
+ public org.bukkit.inventory.EquipmentSlot getHandRaised() {
+ return getHandle().getRaisedHand() == net.minecraft.world.EnumHand.MAIN_HAND ? org.bukkit.inventory.EquipmentSlot.HAND : org.bukkit.inventory.EquipmentSlot.OFF_HAND;
+ }
// Paper end
}