本文整理汇总了Java中net.minecraft.entity.projectile.EntityEgg.setHeadingFromThrower方法的典型用法代码示例。如果您正苦于以下问题:Java EntityEgg.setHeadingFromThrower方法的具体用法?Java EntityEgg.setHeadingFromThrower怎么用?Java EntityEgg.setHeadingFromThrower使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.projectile.EntityEgg
的用法示例。
在下文中一共展示了EntityEgg.setHeadingFromThrower方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemRightClick
import net.minecraft.entity.projectile.EntityEgg; //导入方法依赖的package包/类
/**
* Called when the equipped item is right clicked.
*/
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn)
{
ItemStack itemstack = playerIn.getHeldItem(handIn);
itemstack.shrink(1);
worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!worldIn.isRemote)
{
EntityEgg entityegg = new CoreEntityEgg(worldIn, playerIn);
entityegg.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
worldIn.spawnEntity(entityegg);
}
playerIn.addStat(StatList.getObjectUseStats(this));
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
示例2: onItemRightClick
import net.minecraft.entity.projectile.EntityEgg; //导入方法依赖的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_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!itemStackIn.isRemote)
{
EntityEgg entityegg = new EntityEgg(itemStackIn, worldIn);
entityegg.setHeadingFromThrower(worldIn, worldIn.rotationPitch, worldIn.rotationYaw, 0.0F, 1.5F, 1.0F);
itemStackIn.spawnEntityInWorld(entityegg);
}
worldIn.addStat(StatList.getObjectUseStats(this));
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
示例3: onItemRightClick
import net.minecraft.entity.projectile.EntityEgg; //导入方法依赖的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_EGG_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!worldIn.isRemote)
{
EntityEgg entityegg = new EntityEgg(worldIn, playerIn);
entityegg.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, 0.0F, 1.5F, 1.0F);
worldIn.spawnEntityInWorld(entityegg);
}
playerIn.addStat(StatList.getObjectUseStats(this));
return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}