Search in sources :

Example 1 with LecternBlock

use of net.minecraft.block.LecternBlock in project AstralSorcery by HellFirePvP.

the class ItemTome method onItemUse.

@Override
public ActionResultType onItemUse(ItemUseContext context) {
    World world = context.getWorld();
    BlockState blockstate = world.getBlockState(context.getPos());
    if (blockstate.getBlock() instanceof LecternBlock) {
        return LecternBlock.tryPlaceBook(world, context.getPos(), blockstate, context.getItem()) ? ActionResultType.SUCCESS : ActionResultType.PASS;
    } else {
        return ActionResultType.PASS;
    }
}
Also used : LecternBlock(net.minecraft.block.LecternBlock) BlockState(net.minecraft.block.BlockState) World(net.minecraft.world.World)

Aggregations

BlockState (net.minecraft.block.BlockState)1 LecternBlock (net.minecraft.block.LecternBlock)1 World (net.minecraft.world.World)1