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


Java EntityEnderPearl类代码示例

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


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

示例1: onItemRightClick

import net.minecraft.entity.item.EntityEnderPearl; //导入依赖的package包/类
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
{
    if (playerIn.capabilities.isCreativeMode)
    {
        return itemStackIn;
    }
    else
    {
        --itemStackIn.stackSize;
        worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!worldIn.isRemote)
        {
            worldIn.spawnEntityInWorld(new EntityEnderPearl(worldIn, playerIn));
        }

        playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
        return itemStackIn;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:24,代码来源:ItemEnderPearl.java

示例2: 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

示例3: 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

示例4: throwPearl

import net.minecraft.entity.item.EntityEnderPearl; //导入依赖的package包/类
public static void throwPearl(EntityLiving entity, EntityLivingBase target) {
	World world = entity.getEntityWorld();
	EntityEnderPearl pearl = new EntityEnderPearl(world, entity);

	double dX = target.posX - entity.posX;
	double dY = target.getEntityBoundingBox().minY + (double) (target.height / 3.0F) - pearl.posY;
	double dZ = target.posZ - entity.posZ;

	double distanceSq = dX * dX + dY * dY + dZ * dZ;

	if (distanceSq < 20) {
		return;
	}

	double levelDistance = MathHelper.sqrt(dX * dX + dZ * dZ);

	pearl.setThrowableHeading(dX, dY + levelDistance * 0.20000000298023224D, dZ, 1.6F,
			(float) (14 - world.getDifficulty().getDifficultyId() * 4));

	entity.playSound(SoundEvents.ENTITY_ENDERPEARL_THROW, 1.0F, 1.0F / (world.rand.nextFloat() * 0.4F + 0.8F));

	world.spawnEntity(pearl);
}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:24,代码来源:NemesisActions.java

示例5: onItemRightClick

import net.minecraft.entity.item.EntityEnderPearl; //导入依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
    if (!world.isRemote)
    {
        int cooldown = stack.getItemDamage();

        if(cooldown == 0)
        {
            world.spawnEntityInWorld(new EntityEnderPearl(world, player));
            stack.damageItem(49, player);
            world.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
        }
    }
    return stack;
}
 
开发者ID:GamingsModding,项目名称:TeleComponents,代码行数:17,代码来源:ItemEPGun.java

示例6: 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

示例7: 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

示例8: 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

示例9: onItemRightClick

import net.minecraft.entity.item.EntityEnderPearl; //导入依赖的package包/类
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
    if (par3EntityPlayer.capabilities.isCreativeMode)
    {
        return par1ItemStack;
    }
    else
    {
        --par1ItemStack.stackSize;
        par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!par2World.isClient)
        {
            par2World.spawnEntityInWorld(new EntityEnderPearl(par2World, par3EntityPlayer));
        }

        return par1ItemStack;
    }
}
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:23,代码来源:ItemEnderPearl.java

示例10: onItemRightClick

import net.minecraft.entity.item.EntityEnderPearl; //导入依赖的package包/类
public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_)
{
    if (p_77659_3_.capabilities.isCreativeMode)
    {
        return p_77659_1_;
    }
    else
    {
        --p_77659_1_.stackSize;
        p_77659_2_.playSoundAtEntity(p_77659_3_, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!p_77659_2_.isRemote)
        {
            p_77659_2_.spawnEntityInWorld(new EntityEnderPearl(p_77659_2_, p_77659_3_));
        }

        return p_77659_1_;
    }
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:20,代码来源:ItemEnderPearl.java

示例11: onItemRightClick

import net.minecraft.entity.item.EntityEnderPearl; //导入依赖的package包/类
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
    if (par3EntityPlayer.capabilities.isCreativeMode)
    {
        return par1ItemStack;
    }
    else
    {
        --par1ItemStack.stackSize;
        par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!par2World.isRemote)
        {
            par2World.spawnEntityInWorld(new EntityEnderPearl(par2World, par3EntityPlayer));
        }

        return par1ItemStack;
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:23,代码来源:ItemEnderPearl.java

示例12: func_77659_a

import net.minecraft.entity.item.EntityEnderPearl; //导入依赖的package包/类
public ItemStack func_77659_a(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_) {
   if(p_77659_3_.field_71075_bZ.field_75098_d) {
      return p_77659_1_;
   } else {
      --p_77659_1_.field_77994_a;
      p_77659_2_.func_72956_a(p_77659_3_, "random.bow", 0.5F, 0.4F / (field_77697_d.nextFloat() * 0.4F + 0.8F));
      if(!p_77659_2_.field_72995_K) {
         p_77659_2_.func_72838_d(new EntityEnderPearl(p_77659_2_, p_77659_3_));
      }

      return p_77659_1_;
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:14,代码来源:ItemEnderPearl.java

示例13: onItemRightClick

import net.minecraft.entity.item.EntityEnderPearl; //导入依赖的package包/类
public ItemStack onItemRightClick(ItemStack stk, World w, EntityPlayer p){
	w.playSoundAtEntity(p, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
	if (!w.isRemote){
		w.spawnEntityInWorld(new EntityEnderPearl(w, p));
	}
	return stk;
}
 
开发者ID:planetguy32,项目名称:Gizmos,代码行数:8,代码来源:ItemCreativeEnderPearl.java

示例14: executeActivateBehavior

import net.minecraft.entity.item.EntityEnderPearl; //导入依赖的package包/类
@Override
public int executeActivateBehavior(TileEntityTrophy tile, EntityPlayer player) {
	final World world = tile.getWorld();
	EntityEnderPearl e = new EntityEnderPearl(world, player);
	final BlockPos pos = tile.getPos();
	e.setPosition(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
	e.motionX = world.rand.nextGaussian();
	e.motionY = 1;
	e.motionZ = world.rand.nextGaussian();
	world.spawnEntity(e);
	return 10;
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:13,代码来源:EndermanBehavior.java

示例15: execute

import net.minecraft.entity.item.EntityEnderPearl; //导入依赖的package包/类
@Override
public boolean execute(EntityPlayerMP target) {
	final World world = target.world;

	EntityEnderPearl e = new EntityEnderPearl(world, target);
	e.setPosition(target.posX, target.posY + 1, target.posZ);
	e.motionX = world.rand.nextGaussian();
	e.motionY = 0.5;
	e.motionZ = world.rand.nextGaussian();
	world.spawnEntity(e);
	return true;
}
 
开发者ID:OpenMods,项目名称:OpenBlocks,代码行数:13,代码来源:TeleportFlimFlam.java


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