本文整理匯總了Java中net.minecraft.entity.projectile.EntityPotion.setHeadingFromThrower方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityPotion.setHeadingFromThrower方法的具體用法?Java EntityPotion.setHeadingFromThrower怎麽用?Java EntityPotion.setHeadingFromThrower使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.projectile.EntityPotion
的用法示例。
在下文中一共展示了EntityPotion.setHeadingFromThrower方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onItemRightClick
import net.minecraft.entity.projectile.EntityPotion; //導入方法依賴的package包/類
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
ItemStack itemstack = worldIn.getHeldItem(playerIn);
ItemStack itemstack1 = worldIn.capabilities.isCreativeMode ? itemstack.copy() : itemstack.splitStack(1);
itemStackIn.playSound((EntityPlayer)null, worldIn.posX, worldIn.posY, worldIn.posZ, SoundEvents.ENTITY_LINGERINGPOTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!itemStackIn.isRemote)
{
EntityPotion entitypotion = new EntityPotion(itemStackIn, worldIn, itemstack1);
entitypotion.setHeadingFromThrower(worldIn, worldIn.rotationPitch, worldIn.rotationYaw, -20.0F, 0.5F, 1.0F);
itemStackIn.spawnEntityInWorld(entitypotion);
}
worldIn.addStat(StatList.getObjectUseStats(this));
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
示例2: onItemRightClick
import net.minecraft.entity.projectile.EntityPotion; //導入方法依賴的package包/類
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
ItemStack itemstack = worldIn.getHeldItem(playerIn);
ItemStack itemstack1 = worldIn.capabilities.isCreativeMode ? itemstack.copy() : itemstack.splitStack(1);
itemStackIn.playSound((EntityPlayer)null, worldIn.posX, worldIn.posY, worldIn.posZ, SoundEvents.ENTITY_SPLASH_POTION_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!itemStackIn.isRemote)
{
EntityPotion entitypotion = new EntityPotion(itemStackIn, worldIn, itemstack1);
entitypotion.setHeadingFromThrower(worldIn, worldIn.rotationPitch, worldIn.rotationYaw, -20.0F, 0.5F, 1.0F);
itemStackIn.spawnEntityInWorld(entitypotion);
}
worldIn.addStat(StatList.getObjectUseStats(this));
return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
示例3: onItemRightClick
import net.minecraft.entity.projectile.EntityPotion; //導入方法依賴的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_LINGERINGPOTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!worldIn.isRemote)
{
EntityPotion entitypotion = new EntityPotion(worldIn, playerIn, itemStackIn);
entitypotion.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, -20.0F, 0.5F, 1.0F);
worldIn.spawnEntityInWorld(entitypotion);
}
playerIn.addStat(StatList.getObjectUseStats(this));
return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
示例4: onItemRightClick
import net.minecraft.entity.projectile.EntityPotion; //導入方法依賴的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_SPLASH_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!worldIn.isRemote)
{
EntityPotion entitypotion = new EntityPotion(worldIn, playerIn, itemStackIn);
entitypotion.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, -20.0F, 0.5F, 1.0F);
worldIn.spawnEntityInWorld(entitypotion);
}
playerIn.addStat(StatList.getObjectUseStats(this));
return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
示例5: spawnLingeringPotion
import net.minecraft.entity.projectile.EntityPotion; //導入方法依賴的package包/類
private void spawnLingeringPotion(EntityPlayer player, PotionType ptype) {
World world = player.getEntityWorld();
ItemStack potion = PotionUtils.addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), ptype);
EntityPotion entitypotion = new EntityPotion(world, player, potion);
entitypotion.setHeadingFromThrower(player, player.rotationPitch - 20, player.rotationYaw, 0, 1.6F, 0.5F);
if (world.isRemote == false) {
world.spawnEntity(entitypotion);
}
}