Java Code Examples for net.minecraft.entity.player.EntityPlayer.isElytraFlying()

The following are Jave code examples for showing how to use isElytraFlying() of the net.minecraft.entity.player.EntityPlayer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Backmemed   File: ItemFirework.java   View Source Code Vote up 6 votes
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    if (worldIn.isElytraFlying())
    {
        ItemStack itemstack = worldIn.getHeldItem(playerIn);

        if (!itemStackIn.isRemote)
        {
            EntityFireworkRocket entityfireworkrocket = new EntityFireworkRocket(itemStackIn, itemstack, worldIn);
            itemStackIn.spawnEntityInWorld(entityfireworkrocket);

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

        return new ActionResult(EnumActionResult.SUCCESS, worldIn.getHeldItem(playerIn));
    }
    else
    {
        return new ActionResult(EnumActionResult.PASS, worldIn.getHeldItem(playerIn));
    }
}