当前位置: 首页>>代码示例>>Java>>正文


Java EntityHelper.playSoundAtEntity方法代码示例

本文整理汇总了Java中me.ichun.mods.ichunutil.common.core.util.EntityHelper.playSoundAtEntity方法的典型用法代码示例。如果您正苦于以下问题:Java EntityHelper.playSoundAtEntity方法的具体用法?Java EntityHelper.playSoundAtEntity怎么用?Java EntityHelper.playSoundAtEntity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在me.ichun.mods.ichunutil.common.core.util.EntityHelper的用法示例。


在下文中一共展示了EntityHelper.playSoundAtEntity方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onItemRightClick

import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入方法依赖的package包/类
@Override
    public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand)
    {
//        player.setActiveHand(hand);
        if(ItemHandler.getUsableDualHandedItem(player) == player.getHeldItem(hand) && (player.capabilities.isCreativeMode || EntityHelper.consumeInventoryItem(player.inventory, Torched.itemTorchFirework, 1, 1)))
        {
            Torched.proxy.nudgeHand(player);
            if(!world.isRemote)
            {
                EntityHelper.playSoundAtEntity(player, Torched.soundRPT, SoundCategory.PLAYERS, 1.0F, 0.9F + (player.getRNG().nextFloat() * 2F - 1F) * 0.075F);
                player.world.spawnEntity(new EntityTorchFirework(player.world, player));
            }
        }
        return new ActionResult(EnumActionResult.PASS, player.getHeldItem(hand));
    }
 
开发者ID:iChun,项目名称:Torched,代码行数:16,代码来源:ItemTorchLauncher.java

示例2: shootTorch

import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入方法依赖的package包/类
public void shootTorch(EntityPlayer player)
{
    playerDelay.put(player.getName(), 5);
    ItemStack is = ItemHandler.getUsableDualHandedItem(player);
    if(player.capabilities.isCreativeMode || is.getItem() instanceof ItemTorchGun && is.getItemDamage() < is.getMaxDamage() && EntityHelper.consumeInventoryItem(player.inventory, Item.getItemFromBlock(Blocks.TORCH)))
    {
        if(!player.capabilities.isCreativeMode)
        {
            is.setItemDamage(is.getItemDamage() + 1);
            player.inventory.markDirty();
        }
        EntityHelper.playSoundAtEntity(player, Torched.soundTube, SoundCategory.PLAYERS, 0.5F, 0.85F + (player.getRNG().nextFloat() * 2F - 1F) * 0.075F);
        player.world.spawnEntity(new EntityTorch(player.world, player));
    }
}
 
开发者ID:iChun,项目名称:Torched,代码行数:16,代码来源:EventHandlerServer.java

示例3: onLeftClickEntity

import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入方法依赖的package包/类
@Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
{
    if(player.world.isRemote)
    {
        iChunUtil.proxy.nudgeHand(-50F);
    }
    EntityHelper.playSoundAtEntity(entity, SoundEvents.ENTITY_GENERIC_EAT, SoundCategory.NEUTRAL, 0.6F, (entity.world.rand.nextFloat() - entity.world.rand.nextFloat()) * 0.2F + 1F);
    return false;
}
 
开发者ID:iChun,项目名称:BeeBarker,代码行数:11,代码来源:ItemBeeBarker.java

示例4: execute

import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入方法依赖的package包/类
@Override
public void execute(Side side, EntityPlayer player)
{
    if(pressed)
    {
        ItemStack is = ItemHandler.getUsableDualHandedItem(player);
        if(is.getItem() == BeeBarker.itemBeeBarker && is.getTagCompound() != null && is.getTagCompound().hasKey(ItemBeeBarker.WOLF_DATA_STRING))
        {
            if(BeeBarker.config.easterEgg == 1 && ((NBTTagCompound)is.getTagCompound().getTag(ItemBeeBarker.WOLF_DATA_STRING)).hasKey("CustomName") && ((NBTTagCompound)is.getTagCompound().getTag(ItemBeeBarker.WOLF_DATA_STRING)).getString("CustomName").equals("iChun"))
            {
                if(!BarkHelper.pressState.contains(player.getName()))
                {
                    BarkHelper.pressState.add(player.getName());
                    EntityHelper.playSoundAtEntity(player, SoundEvents.ENTITY_WOLF_GROWL, SoundCategory.PLAYERS, 0.4F, 1.0F);
                    BeeBarker.channel.sendToAll(new PacketKeyState(player.getName(), true));
                }
            }
            else
            {
                BarkHelper.bark(player);
            }
        }
    }
    else
    {
        BarkHelper.removePressState(player.getName());
    }
}
 
开发者ID:iChun,项目名称:BeeBarker,代码行数:29,代码来源:PacketBark.java

示例5: bark

import me.ichun.mods.ichunutil.common.core.util.EntityHelper; //导入方法依赖的package包/类
public static void bark(EntityLivingBase living)
{
    float pitch = 1F;
    if(living instanceof EntityPlayer)
    {
        Integer speed = cooldown.get(living.getName());
        if(speed == null)
        {
            speed = 0;
        }
        if(speed < 252)
        {
            cooldown.put(living.getName(), speed + 8);
        }

        if(speed > 10)
        {
            float pitchSpike = (float)Math.pow(MathHelper.clamp((speed - 10) / 250F, 0F, 1F), 1D);
            pitch += 1.5F * pitchSpike;
        }

        EntityPlayer player = (EntityPlayer)living;
        ItemStack is = ItemHandler.getUsableDualHandedItem(player);
        if(is.getItem() instanceof ItemBeeBarker && is.getTagCompound() != null && is.getTagCompound().hasKey(ItemBeeBarker.WOLF_DATA_STRING) && !player.capabilities.isCreativeMode)
        {
            NBTTagCompound tag = (NBTTagCompound)((NBTTagCompound)is.getTagCompound().getTag(ItemBeeBarker.WOLF_DATA_STRING)).getTag("ForgeData");

            if(!tag.getBoolean("IsSuperBeeDog"))
            {
                if(tag.getInteger(EventHandlerServer.BEE_CHARGE_STRING) <= 0)
                {
                    EntityHelper.playSoundAtEntity(living, SoundEvents.ENTITY_WOLF_HURT, SoundCategory.PLAYERS, 0.4F, (living.world.rand.nextFloat() - living.world.rand.nextFloat()) * 0.2F + pitch);
                    return;
                }
                tag.setInteger(EventHandlerServer.BEE_CHARGE_STRING, tag.getInteger(EventHandlerServer.BEE_CHARGE_STRING) - 1);
                is.setItemDamage(1 + (int)((1.0F - (tag.getInteger(EventHandlerServer.BEE_CHARGE_STRING) / (float)tag.getInteger(EventHandlerServer.BEE_HIGHEST_CHARGE))) * 250F));
            }
        }
    }
    else
    {
        BeeBarker.channel.sendToAllAround(new PacketSpawnParticles(-1, living.getEntityId(), true), new NetworkRegistry.TargetPoint(living.dimension, living.posX, living.posY, living.posZ, 32D));
    }
    for(int i = 0; i < BeeBarker.config.beeCount; i++)
    {
        living.world.spawnEntity(new EntityBee(living.world, living));
    }
    EntityHelper.playSoundAtEntity(living, SoundEvents.ENTITY_WOLF_AMBIENT, SoundCategory.PLAYERS, 0.4F, (living.world.rand.nextFloat() - living.world.rand.nextFloat()) * 0.2F + pitch);
}
 
开发者ID:iChun,项目名称:BeeBarker,代码行数:50,代码来源:BarkHelper.java


注:本文中的me.ichun.mods.ichunutil.common.core.util.EntityHelper.playSoundAtEntity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。