本文整理汇总了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));
}
示例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));
}
}
示例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;
}
示例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());
}
}
示例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);
}