Search in sources :

Example 1 with EntityMudball

use of biomesoplenty.common.entities.projectiles.EntityMudball in project BiomesOPlenty by Glitchfiend.

the class ItemMudball method onItemRightClick.

// throw a mudball on right click
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
    ItemStack stack = player.getHeldItem(hand);
    if (!player.capabilities.isCreativeMode) {
        stack.setCount(stack.getCount() - 1);
    }
    world.playSound(player, player.getPosition(), SoundEvents.ENTITY_ARROW_SHOOT, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
    if (!world.isRemote) {
        EntityMudball mudball = new EntityMudball(world, player);
        mudball.shoot(player, player.rotationPitch, player.rotationYaw, 0.0F, 1.5F, 1.0F);
        world.spawnEntity(mudball);
    }
    player.addStat(StatList.getObjectUseStats(this));
    return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
}
Also used : EntityMudball(biomesoplenty.common.entities.projectiles.EntityMudball) EnumActionResult(net.minecraft.util.EnumActionResult) ActionResult(net.minecraft.util.ActionResult) ItemStack(net.minecraft.item.ItemStack)

Aggregations

EntityMudball (biomesoplenty.common.entities.projectiles.EntityMudball)1 ItemStack (net.minecraft.item.ItemStack)1 ActionResult (net.minecraft.util.ActionResult)1 EnumActionResult (net.minecraft.util.EnumActionResult)1