Add more Witch API

== AT ==
public net.minecraft.world.entity.monster.Witch usingTime
This commit is contained in:
BillyGalbreath
2018-10-12 14:10:46 -05:00
parent 473a79e490
commit a24fb45a27
2 changed files with 67 additions and 10 deletions

View File

@@ -2,6 +2,13 @@ package org.bukkit.craftbukkit.entity;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.entity.Witch;
// Paper start
import com.destroystokyo.paper.entity.CraftRangedEntity;
import com.google.common.base.Preconditions;
import org.bukkit.Material;
import org.bukkit.craftbukkit.inventory.CraftItemStack;
import org.bukkit.inventory.ItemStack;
// Paper end
public class CraftWitch extends CraftRaider implements Witch, com.destroystokyo.paper.entity.CraftRangedEntity<net.minecraft.world.entity.monster.Witch> { // Paper
public CraftWitch(CraftServer server, net.minecraft.world.entity.monster.Witch entity) {
@@ -22,4 +29,23 @@ public class CraftWitch extends CraftRaider implements Witch, com.destroystokyo.
public boolean isDrinkingPotion() {
return this.getHandle().isDrinkingPotion();
}
// Paper start
public int getPotionUseTimeLeft() {
return getHandle().usingTime;
}
@Override
public void setPotionUseTimeLeft(int ticks) {
getHandle().usingTime = ticks;
}
public ItemStack getDrinkingPotion() {
return CraftItemStack.asCraftMirror(getHandle().getMainHandItem());
}
public void setDrinkingPotion(ItemStack potion) {
Preconditions.checkArgument(potion == null || potion.getType().isEmpty() || potion.getType() == Material.POTION, "must be potion, air, or null");
getHandle().setDrinkingPotion(CraftItemStack.asNMSCopy(potion));
}
// Paper end
}