use of stevekung.mods.moreplanets.planets.nibiru.entity.projectile.EntityInfectedEgg in project MorePlanets by SteveKunG.
the class ItemInfectedEgg method onItemRightClick.
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
ItemStack itemStack = player.getHeldItem(hand);
if (!player.capabilities.isCreativeMode) {
itemStack.shrink(1);
}
world.playSound(null, player.getPosition(), SoundEvents.ENTITY_EGG_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
player.swingArm(hand);
if (!world.isRemote) {
EntityInfectedEgg entityegg = new EntityInfectedEgg(world, player);
entityegg.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
world.spawnEntity(entityegg);
}
player.addStat(StatList.getObjectUseStats(this));
return new ActionResult<>(EnumActionResult.SUCCESS, itemStack);
}
Aggregations