Files
CustomNPC-Plus/src/main/java/noppes/npcs/entity/EntityMagicProjectile.java
T
2025-03-13 17:14:45 -04:00

36 lines
1.0 KiB
Java

package noppes.npcs.entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
public class EntityMagicProjectile extends EntityProjectile {
private EntityPlayer player;
private ItemStack equiped;
public EntityMagicProjectile(World par1World) {
super(par1World);
}
public EntityMagicProjectile(World par1World,
EntityPlayer player, ItemStack item, boolean isNPC) {
super(par1World, player, item, isNPC);
this.player = player;
this.equiped = player.inventory.getCurrentItem();
}
@Override
public void onUpdate() {
if (!worldObj.isRemote && (player == null || player.inventory.getCurrentItem() != equiped))
this.setDead();
super.onUpdate();
}
@Override
public String getCommandSenderName() {
return StatCollector.translateToLocal("entity.throwableitem.name");
}
}