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