Started on docstrings

This commit is contained in:
lukasabbe
2025-09-01 19:12:04 +02:00
parent 0a1ebf7992
commit 4c64a4d36b
@@ -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.ChiseledBookShelfBlockEntity;
import net.minecraft.world.level.block.entity.LecternBlockEntity; import net.minecraft.world.level.block.entity.LecternBlockEntity;
/**
* Tools for getting books from blocks, like lecterns and chiseled bookshelf's
*/
public class BlockTools { 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){ public static ItemStack getBookInChiseledBookShelf(BlockPos pos, int slotNum, Level world){
final BlockEntity blockEntity = world.getBlockEntity(pos); final BlockEntity blockEntity = world.getBlockEntity(pos);
if(blockEntity instanceof ChiseledBookShelfBlockEntity chiseledBookShelf) { if(blockEntity instanceof ChiseledBookShelfBlockEntity chiseledBookShelf) {
@@ -18,6 +29,12 @@ public class BlockTools {
return null; 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){ public static ItemStack getBookInLectern(BlockPos pos, Level world){
final BlockEntity blockEntity = world.getBlockEntity(pos); final BlockEntity blockEntity = world.getBlockEntity(pos);
if(blockEntity instanceof LecternBlockEntity lecternBlockEntity) return lecternBlockEntity.getBook(); if(blockEntity instanceof LecternBlockEntity lecternBlockEntity) return lecternBlockEntity.getBook();