a bit more

This commit is contained in:
lukasabbe
2025-09-05 20:56:52 +02:00
parent 4c64a4d36b
commit bfcea904ee
4 changed files with 24 additions and 0 deletions
@@ -12,11 +12,17 @@ import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.Map; import java.util.Map;
/**
* Config class, defines config values.
*/
public class Config { public class Config {
public boolean lecternToggle = true; public boolean lecternToggle = true;
public int scale = 10; public int scale = 10;
public boolean useRoman = false; public boolean useRoman = false;
/**
* Loads the config file in to mod
*/
public void loadConfig(){ public void loadConfig(){
Path configPath = Services.PLATFORM.getConfigPath("bookshelfinspector-config.yml"); Path configPath = Services.PLATFORM.getConfigPath("bookshelfinspector-config.yml");
if(!Files.exists(configPath))createConfig(configPath); if(!Files.exists(configPath))createConfig(configPath);
@@ -47,6 +53,9 @@ public class Config {
} }
} }
/**
* Saves config settings to config file
*/
public void saveConfig(){ public void saveConfig(){
Path configPath = Services.PLATFORM.getConfigPath("bookshelfinspector-config.yml"); Path configPath = Services.PLATFORM.getConfigPath("bookshelfinspector-config.yml");
if(!Files.exists(configPath)) createConfig(configPath); if(!Files.exists(configPath)) createConfig(configPath);
@@ -3,17 +3,26 @@ package com.lukasabbe.bookshelfinspector.data;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
/**
* Data for a slot in a chiseled bookshelf
*/
public class BookData { public class BookData {
public ItemStack itemStack; public ItemStack itemStack;
public BlockPos pos; public BlockPos pos;
public int slotId; public int slotId;
/**
* Creates data object with its data
*/
public BookData(ItemStack itemStack, BlockPos pos, int slotId) { public BookData(ItemStack itemStack, BlockPos pos, int slotId) {
this.itemStack = itemStack; this.itemStack = itemStack;
this.pos = pos; this.pos = pos;
this.slotId = slotId; this.slotId = slotId;
} }
/**
* Gets an empty BookData
*/
public static BookData empty(){ public static BookData empty(){
return new BookData(ItemStack.EMPTY, null, -1); return new BookData(ItemStack.EMPTY, null, -1);
} }
@@ -2,6 +2,9 @@ package com.lukasabbe.bookshelfinspector.data;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
/**
* Data for bookshelf
*/
public class BookShelfData { public class BookShelfData {
public boolean isCurrentBookDataToggled = false; public boolean isCurrentBookDataToggled = false;
public BlockPos latestPos = null; public BlockPos latestPos = null;
@@ -5,6 +5,9 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.TagKey; import net.minecraft.tags.TagKey;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
/**
* Tags for blocks used in the mod
*/
public class Tags { public class Tags {
public static final TagKey<Block> CHISELED_BOOKSHELVES = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("c", "chiseled_bookshelves")); public static final TagKey<Block> CHISELED_BOOKSHELVES = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("c", "chiseled_bookshelves"));
public static final TagKey<Block> LECTERNS = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("c", "lectern")); public static final TagKey<Block> LECTERNS = TagKey.create(Registries.BLOCK, ResourceLocation.fromNamespaceAndPath("c", "lectern"));