Search in sources :

Example 1 with EntityTaserBullet

use of net.geforcemods.securitycraft.entity.EntityTaserBullet in project SecurityCraft by Geforce132.

the class ItemTaser method onItemRightClick.

@Override
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) {
    if (!worldIn.isRemote) {
        if (!itemStackIn.isItemDamaged()) {
            worldIn.spawnEntityInWorld(new EntityTaserBullet(worldIn, playerIn));
            mod_SecurityCraft.network.sendToAll(new PacketCPlaySoundAtPos(playerIn.posX, playerIn.posY, playerIn.posZ, SCSounds.TASERFIRED.path, 1.0F));
            if (!playerIn.capabilities.isCreativeMode) {
                itemStackIn.damageItem(150, playerIn);
            }
        }
    }
    return ActionResult.newResult(EnumActionResult.PASS, itemStackIn);
}
Also used : PacketCPlaySoundAtPos(net.geforcemods.securitycraft.network.packets.PacketCPlaySoundAtPos) EntityTaserBullet(net.geforcemods.securitycraft.entity.EntityTaserBullet)

Example 2 with EntityTaserBullet

use of net.geforcemods.securitycraft.entity.EntityTaserBullet in project SecurityCraft by Geforce132.

the class ItemTaser method onItemRightClick.

public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
    if (!par2World.isRemote) {
        if (!par1ItemStack.isItemDamaged()) {
            par2World.spawnEntityInWorld(new EntityTaserBullet(par2World, par3EntityPlayer));
            mod_SecurityCraft.network.sendToAll(new PacketCPlaySoundAtPos(par3EntityPlayer.posX, par3EntityPlayer.posY, par3EntityPlayer.posZ, SCSounds.TASERFIRED.path, 1.0F));
            if (!par3EntityPlayer.capabilities.isCreativeMode) {
                par1ItemStack.damageItem(150, par3EntityPlayer);
            }
        }
    }
    return par1ItemStack;
}
Also used : PacketCPlaySoundAtPos(net.geforcemods.securitycraft.network.packets.PacketCPlaySoundAtPos) EntityTaserBullet(net.geforcemods.securitycraft.entity.EntityTaserBullet)

Aggregations

EntityTaserBullet (net.geforcemods.securitycraft.entity.EntityTaserBullet)2 PacketCPlaySoundAtPos (net.geforcemods.securitycraft.network.packets.PacketCPlaySoundAtPos)2