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);
}
Aggregations