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

The following are Jave code examples for showing how to use openBook() 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.
Example 1
Project: Backmemed   File: ItemWrittenBook.java   Source Code and License Vote up 5 votes
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    ItemStack itemstack = worldIn.getHeldItem(playerIn);

    if (!itemStackIn.isRemote)
    {
        this.resolveContents(itemstack, worldIn);
    }

    worldIn.openBook(itemstack, playerIn);
    worldIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
 
Example 2
Project: Backmemed   File: ItemWritableBook.java   Source Code and License Vote up 5 votes
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    ItemStack itemstack = worldIn.getHeldItem(playerIn);
    worldIn.openBook(itemstack, playerIn);
    worldIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
 
Example 3
Project: CustomWorldGen   File: ItemWrittenBook.java   Source Code and License Vote up 5 votes
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    if (!worldIn.isRemote)
    {
        this.resolveContents(itemStackIn, playerIn);
    }

    playerIn.openBook(itemStackIn, hand);
    playerIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
 
Example 4
Project: CustomWorldGen   File: ItemWritableBook.java   Source Code and License Vote up 4 votes
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    playerIn.openBook(itemStackIn, hand);
    playerIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}