Search in sources :

Example 1 with EntityInfectedEgg

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);
}
Also used : EnumActionResult(net.minecraft.util.EnumActionResult) ActionResult(net.minecraft.util.ActionResult) EntityInfectedEgg(stevekung.mods.moreplanets.planets.nibiru.entity.projectile.EntityInfectedEgg) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ItemStack (net.minecraft.item.ItemStack)1 ActionResult (net.minecraft.util.ActionResult)1 EnumActionResult (net.minecraft.util.EnumActionResult)1 EntityInfectedEgg (stevekung.mods.moreplanets.planets.nibiru.entity.projectile.EntityInfectedEgg)1