cn.nukkit.item.ItemEnderPearl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of powernukkit Show documentation
Show all versions of powernukkit Show documentation
A Minecraft Bedrock Edition server software implementation made in Java from scratch which supports all new features.
package cn.nukkit.item;
import cn.nukkit.Player;
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;
}
@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;
}
}