cn.nukkit.item.ItemEnderPearl Maven / Gradle / Ivy
package cn.nukkit.item;
import cn.nukkit.Player;
import cn.nukkit.api.PowerNukkitOnly;
import cn.nukkit.entity.Entity;
import cn.nukkit.entity.projectile.EntityEnderPearl;
public class ItemEnderPearl extends ProjectileItem {
public ItemEnderPearl() {
this(0, 1);
}
public ItemEnderPearl(Integer meta) {
this(meta, 1);
}
public ItemEnderPearl(Integer meta, int count) {
super(ENDER_PEARL, 0, count, "Ender Pearl");
}
@Override
public int getMaxStackSize() {
return 16;
}
@Override
public String getProjectileEntityType() {
return "EnderPearl";
}
@Override
public float getThrowForce() {
return 1.5f;
}
@PowerNukkitOnly
@Override
protected Entity correctProjectile(Player player, Entity projectile) {
if (projectile instanceof EntityEnderPearl) {
if (player.getServer().getTick() - player.getLastEnderPearlThrowingTick() < 20) {
projectile.kill();
return null;
}
return projectile;
}
return null;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy