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


Java EntityEnderPearl.setHeadingFromThrower方法代码示例

本文整理汇总了Java中net.minecraft.entity.item.EntityEnderPearl.setHeadingFromThrower方法的典型用法代码示例。如果您正苦于以下问题:Java EntityEnderPearl.setHeadingFromThrower方法的具体用法?Java EntityEnderPearl.setHeadingFromThrower怎么用?Java EntityEnderPearl.setHeadingFromThrower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.item.EntityEnderPearl的用法示例。


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

示例1: onItemRightClick

import net.minecraft.entity.item.EntityEnderPearl; //导入方法依赖的package包/类
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    ItemStack itemstack = worldIn.getHeldItem(playerIn);

    if (!worldIn.capabilities.isCreativeMode)
    {
        itemstack.func_190918_g(1);
    }

    itemStackIn.playSound((EntityPlayer)null, worldIn.posX, worldIn.posY, worldIn.posZ, SoundEvents.ENTITY_ENDERPEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
    worldIn.getCooldownTracker().setCooldown(this, 20);

    if (!itemStackIn.isRemote)
    {
        EntityEnderPearl entityenderpearl = new EntityEnderPearl(itemStackIn, worldIn);
        entityenderpearl.setHeadingFromThrower(worldIn, worldIn.rotationPitch, worldIn.rotationYaw, 0.0F, 1.5F, 1.0F);
        itemStackIn.spawnEntityInWorld(entityenderpearl);
    }

    worldIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:ItemEnderPearl.java

示例2: onItemRightClick

import net.minecraft.entity.item.EntityEnderPearl; //导入方法依赖的package包/类
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    if (!playerIn.capabilities.isCreativeMode)
    {
        --itemStackIn.stackSize;
    }

    worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_ENDERPEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
    playerIn.getCooldownTracker().setCooldown(this, 20);

    if (!worldIn.isRemote)
    {
        EntityEnderPearl entityenderpearl = new EntityEnderPearl(worldIn, playerIn);
        entityenderpearl.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
        worldIn.spawnEntityInWorld(entityenderpearl);
    }

    playerIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:21,代码来源:ItemEnderPearl.java

示例3: onItemRightClick

import net.minecraft.entity.item.EntityEnderPearl; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand hand) {
  ItemStack itemStackIn = playerIn.getHeldItem(hand);
  worldIn.playSound((EntityPlayer) null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_ENDERPEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
  playerIn.getCooldownTracker().setCooldown(this, cooldown);
  if (!worldIn.isRemote) {
    EntityEnderPearl entityenderpearl = new EntityEnderPearl(worldIn, playerIn); //func_184538_a
    entityenderpearl.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
    worldIn.spawnEntity(entityenderpearl);
    if (orbType == OrbType.MOUNTED) {
      playerIn.dismountRidingEntity();
      playerIn.startRiding(entityenderpearl);
    }
  }
  super.onUse(itemStackIn, playerIn, worldIn, hand);
  return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemStackIn);
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:18,代码来源:ItemEnderPearlReuse.java

示例4: onItemRightClick

import net.minecraft.entity.item.EntityEnderPearl; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
  switch (type) {
    case WEAK:
      spawnLingeringPotion(player, PotionTypes.WEAKNESS);
    break;
    case SLOW:
      spawnLingeringPotion(player, PotionTypes.SLOWNESS);
    break;
    case ENDER:
      player.addPotionEffect(new PotionEffect(PotionEffectRegistry.ENDER, 200, 0));
      if (!world.isRemote) {
        EntityEnderPearl entityenderpearl = new EntityEnderPearl(world, player);
        entityenderpearl.setHeadingFromThrower(player, player.rotationPitch - 20, player.rotationYaw, 0.0F, 1.6F, 1.0F);
        world.spawnEntity(entityenderpearl);
      }
  }
  UtilSound.playSound(player, SoundEvents.ENTITY_ENDERPEARL_THROW);
  player.getCooldownTracker().setCooldown(this, COOLDOWN);
  return new ActionResult<ItemStack>(EnumActionResult.PASS, player.getHeldItem(hand));
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:22,代码来源:ItemPowerSword.java

示例5: onMessage

import net.minecraft.entity.item.EntityEnderPearl; //导入方法依赖的package包/类
@Override
public IMessage onMessage(EnderPearlPacket message, MessageContext ctx) {
  EntityPlayer p = ctx.getServerHandler().playerEntity;
  ItemStack pearls = UtilPlayerInventoryFilestorage.getPlayerInventory(p).getStackInSlot(Const.SLOT_EPEARL);
  if (!pearls.isEmpty()) {
    World world = p.world;
    EntityEnderPearl entityenderpearl = new EntityEnderPearl(world, p);
    entityenderpearl.setHeadingFromThrower(p, p.rotationPitch, p.rotationYaw, 0.0F, 1.5F, 1.0F);
    world.spawnEntity(entityenderpearl);
    ModInv.playSound(p, SoundEvents.ENTITY_ARROW_SHOOT);
    if (p.capabilities.isCreativeMode == false) {
      UtilPlayerInventoryFilestorage.getPlayerInventory(p).decrStackSize(Const.SLOT_EPEARL, 1);
    }
  }
  return null;
}
 
开发者ID:LothrazarMinecraftMods,项目名称:OverpoweredInventory,代码行数:17,代码来源:EnderPearlPacket.java


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