mirror of
https://github.com/lukasabbe/bookshelf-inspector.git
synced 2026-04-30 10:40:53 +00:00
Started on docstrings
This commit is contained in:
@@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user