diff --git a/common/src/main/java/com/lukasabbe/bookshelfinspector/util/BlockTools.java b/common/src/main/java/com/lukasabbe/bookshelfinspector/util/BlockTools.java index e22be58..c8d5728 100644 --- a/common/src/main/java/com/lukasabbe/bookshelfinspector/util/BlockTools.java +++ b/common/src/main/java/com/lukasabbe/bookshelfinspector/util/BlockTools.java @@ -7,7 +7,18 @@ import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.ChiseledBookShelfBlockEntity; import net.minecraft.world.level.block.entity.LecternBlockEntity; +/** + * Tools for getting books from blocks, like lecterns and chiseled bookshelf's + */ public class BlockTools { + + /** + * Gets a specific book from a chiseled bookshelf + * @param pos position of bookshelf + * @param slotNum slot number were the book you want is located + * @param world the world the bookshelf is in + * @return returns the book in that position or null if its empty + */ public static ItemStack getBookInChiseledBookShelf(BlockPos pos, int slotNum, Level world){ final BlockEntity blockEntity = world.getBlockEntity(pos); if(blockEntity instanceof ChiseledBookShelfBlockEntity chiseledBookShelf) { @@ -18,6 +29,12 @@ public class BlockTools { return null; } + /** + * Gets the book in the lectern + * @param pos position of lectern + * @param world the world the bookshelf is in + * @return returns the book in the lectern or if its empty it returns null + */ public static ItemStack getBookInLectern(BlockPos pos, Level world){ final BlockEntity blockEntity = world.getBlockEntity(pos); if(blockEntity instanceof LecternBlockEntity lecternBlockEntity) return lecternBlockEntity.getBook();