Add setPotionUseTimeLeft to Witch (#5597)

This commit is contained in:
Owen1212055 2021-05-12 05:45:06 -04:00 committed by GitHub
parent 239935d183
commit 53d71b7179
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 4 deletions

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Add more Witch API
diff --git a/src/main/java/org/bukkit/entity/Witch.java b/src/main/java/org/bukkit/entity/Witch.java
index aa88aede6c4e66a608a63d07bc66d60357b0bee9..cd8d0a20e52ad35f659175e0d24a1dc0e92023b9 100644
index aa88aede6c4e66a608a63d07bc66d60357b0bee9..b7f9db08fb2e4633e1dfad5c752451f6ac23d437 100644
--- a/src/main/java/org/bukkit/entity/Witch.java
+++ b/src/main/java/org/bukkit/entity/Witch.java
@@ -2,8 +2,43 @@ package org.bukkit.entity;
@@ -2,8 +2,53 @@ package org.bukkit.entity;
import com.destroystokyo.paper.entity.RangedEntity;
@ -37,6 +37,16 @@ index aa88aede6c4e66a608a63d07bc66d60357b0bee9..cd8d0a20e52ad35f659175e0d24a1dc0
+ int getPotionUseTimeLeft();
+
+ /**
+ * Set time remaining (in ticks) that the Witch is drinking a potion.
+ * <p>
+ * This only has an effect while the Witch is drinking a potion.
+ *
+ * @param ticks Time in ticks remaining
+ * @see #isDrinkingPotion
+ */
+ void setPotionUseTimeLeft(int ticks);
+
+ /**
+ * Get the potion the Witch is drinking
+ *
+ * @return The potion the witch is drinking

View File

@ -105,7 +105,7 @@ index c6d79125e7dd982fc528ce61144005194cbaa323..63fb08e7b4290353e5148d1acb58f091
public SoundEffect eL() {
return SoundEffects.ENTITY_WITCH_CELEBRATE;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
index 9cc34cdb43596eff34625045f884b93da3f27ab6..72428396a8c91d5d848b3019aaaa03bc3283574b 100644
index 9cc34cdb43596eff34625045f884b93da3f27ab6..3b553c2455948a4102754b2617c2301c49f476d6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java
@@ -4,6 +4,13 @@ import net.minecraft.world.entity.monster.EntityWitch;
@ -122,7 +122,7 @@ index 9cc34cdb43596eff34625045f884b93da3f27ab6..72428396a8c91d5d848b3019aaaa03bc
public class CraftWitch extends CraftRaider implements Witch, com.destroystokyo.paper.entity.CraftRangedEntity<EntityWitch> { // Paper
public CraftWitch(CraftServer server, EntityWitch entity) {
@@ -24,4 +31,23 @@ public class CraftWitch extends CraftRaider implements Witch, com.destroystokyo.
@@ -24,4 +31,28 @@ public class CraftWitch extends CraftRaider implements Witch, com.destroystokyo.
public EntityType getType() {
return EntityType.WITCH;
}
@ -136,6 +136,11 @@ index 9cc34cdb43596eff34625045f884b93da3f27ab6..72428396a8c91d5d848b3019aaaa03bc
+ return getHandle().getPotionUseTimeLeft();
+ }
+
+ @Override
+ public void setPotionUseTimeLeft(int ticks) {
+ getHandle().setPotionUseTimeLeft(ticks);
+ }
+
+ public ItemStack getDrinkingPotion() {
+ return CraftItemStack.asCraftMirror(getHandle().getItemInMainHand());
+ }