### Managing Quests with IQuestDatabase (Java) Source: https://context7.com/funwayguy/betterquesting/llms.txt Provides examples of using the IQuestDatabase interface to manage quests, including creating new quests, adding them to the database, retrieving quests by ID, and removing them. It also covers bulk lookups and resetting the entire database. ```java import betterquesting.api.api.QuestingAPI; import betterquesting.api.api.ApiReference; import betterquesting.api.questing.IQuestDatabase; import betterquesting.api.questing.IQuest; import betterquesting2.storage.DBEntry; // Access the quest database IQuestDatabase questDB = QuestingAPI.getAPI(ApiReference.QUEST_DB); // Create a new quest int newQuestId = questDB.nextID(); IQuest newQuest = questDB.createNew(newQuestId); // Add quest to database DBEntry entry = questDB.add(newQuestId, newQuest); // Retrieve a quest by ID IQuest quest = questDB.getValue(0); // Get all quests as entries List> allQuests = questDB.getEntries(); for (DBEntry questEntry : allQuests) { int id = questEntry.getID(); IQuest q = questEntry.getValue(); System.out.println("Quest ID: " + id); } // Bulk lookup multiple quests List> specificQuests = questDB.bulkLookup(0, 1, 5, 10); // Remove a quest questDB.removeID(newQuestId); // Reset entire database questDB.reset(); ``` -------------------------------- ### QuestEventHandler - Handling Quest State Changes (Java) Source: https://context7.com/funwayguy/betterquesting/llms.txt An example of how to subscribe to and handle BetterQuesting's QuestEvent system using Forge's event bus. This allows mods to react to quest completions, updates, and resets. It requires Forge and BetterQuesting API dependencies. The input is a QuestEvent object, and the output is console logging based on the event type. ```java import betterquesting.api.events.QuestEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.common.MinecraftForge; import java.util.UUID; import java.util.Set; public class QuestEventHandler { public void register() { MinecraftForge.EVENT_BUS.register(this); } @SubscribeEvent public void onQuestEvent(QuestEvent event) { UUID playerId = event.getPlayerID(); Set questIds = event.getQuestIDs(); QuestEvent.Type type = event.getType(); switch (type) { case COMPLETED: // Quest(s) completed System.out.println("Player " + playerId + " completed quests: " + questIds); break; case UPDATED: // Quest progress updated System.out.println("Quest progress updated for: " + questIds); break; case RESET: // Quest(s) reset System.out.println("Quests reset: " + questIds); break; } } } ``` -------------------------------- ### IItemTask and IFluidTask - Submission Tasks Source: https://context7.com/funwayguy/betterquesting/llms.txt Implementations for tasks that require players to submit items or fluids. Includes examples for checking and submitting both items and fluids. ```APIDOC ## IItemTask and IFluidTask - Submission Tasks Extended task interfaces for tasks that accept item or fluid submissions from players. ### ItemSubmitTask Example This class implements `IItemTask` to handle item submissions. #### Methods - `canAcceptItem(UUID owner, DBEntry quest, ItemStack stack)`: Checks if the provided item stack can be accepted. - `submitItem(UUID owner, DBEntry quest, ItemStack stack)`: Processes the submission of an item stack and returns any remainder. ### FluidSubmitTask Example This class implements `IFluidTask` to handle fluid submissions. #### Methods - `canAcceptFluid(UUID owner, DBEntry quest, FluidStack fluid)`: Checks if the provided fluid stack can be accepted. - `submitFluid(UUID owner, DBEntry quest, FluidStack fluid)`: Processes the submission of a fluid stack and returns any remainder. ``` -------------------------------- ### Accessing Better Questing Core API (Java) Source: https://context7.com/funwayguy/betterquesting/llms.txt Demonstrates how to access the main QuestingAPI hub to interact with various subsystems like quest databases, party management, and network communication. It also shows how to register custom API extensions. ```java import betterquesting.api.api.QuestingAPI; import betterquesting.api.api.ApiReference; import betterquesting.api.questing.IQuestDatabase; import betterquesting.api.questing.IQuest; import net.minecraft.entity.player.EntityPlayer; // Get the quest database instance IQuestDatabase questDB = QuestingAPI.getAPI(ApiReference.QUEST_DB); // Get a player's unique questing UUID (handles offline servers properly) EntityPlayer player = /* your player instance */; UUID playerUUID = QuestingAPI.getQuestingUUID(player); // Access other API components IQuestLineDatabase lineDB = QuestingAPI.getAPI(ApiReference.LINE_DB); IPartyDatabase partyDB = QuestingAPI.getAPI(ApiReference.PARTY_DB); ILifeDatabase lifeDB = QuestingAPI.getAPI(ApiReference.LIFE_DB); IPacketSender packetSender = QuestingAPI.getAPI(ApiReference.PACKET_SENDER); // Register a custom API extension public class MyCustomAPI { public static final ApiKey MY_API = new ApiKey<>(); } QuestingAPI.registerAPI(MyCustomAPI.MY_API, new MyCustomFeatureImpl()); ``` -------------------------------- ### IParty - Multiplayer Party Management (Java) Source: https://context7.com/funwayguy/betterquesting/llms.txt Demonstrates the IParty interface for managing multiplayer party systems within BetterQuesting. It shows how to access the party database, find a player's party, retrieve members, check statuses, manage members, and access party properties. Requires BetterQuesting API and standard Java utilities. ```java import betterquesting.api.api.QuestingAPI; import betterquesting.api.api.ApiReference; import betterquesting.api.questing.party.IParty; import betterquesting.api.questing.party.IPartyDatabase; import betterquesting.api.enums.EnumPartyStatus; import betterquesting2.storage.DBEntry; import betterquesting.api.properties.NativeProps; import betterquesting.api.properties.IPropertyContainer; import java.util.UUID; import java.util.List; // Access party database IPartyDatabase partyDB = QuestingAPI.getAPI(ApiReference.PARTY_DB); // Find a player's party UUID playerUUID = /* player's UUID */; DBEntry partyEntry = partyDB.getParty(playerUUID); if (partyEntry != null) { IParty party = partyEntry.getValue(); // Get party members List members = party.getMembers(); // Check member status (OWNER, ADMIN, MEMBER) EnumPartyStatus status = party.getStatus(playerUUID); // Manage party members (requires appropriate permissions) party.setStatus(memberUUID, EnumPartyStatus.ADMIN); party.kickUser(memberUUID); // Access party properties IPropertyContainer props = party.getProperties(); String partyName = props.getProperty(NativeProps.NAME); } ``` -------------------------------- ### Implement Custom Task with ITask Source: https://context7.com/funwayguy/betterquesting/llms.txt Demonstrates how to create a custom task by implementing the ITask interface. This includes managing player progress, handling NBT serialization for persistence, and defining completion logic. ```java import betterquesting.api.questing.tasks.ITask; import betterquesting.api.questing.IQuest; import betterquesting.api2.storage.DBEntry; import betterquesting.api2.utils.ParticipantInfo; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; public class CustomKillTask implements ITask { private static final ResourceLocation FACTORY_ID = new ResourceLocation("mymod", "kill_task"); private String targetEntity = "minecraft:zombie"; private int requiredKills = 10; private Map playerProgress = new HashMap<>(); @Override public ResourceLocation getFactoryID() { return FACTORY_ID; } @Override public String getUnlocalisedName() { return "mymod.task.kill"; } @Override public void detect(ParticipantInfo participant, DBEntry quest) { UUID uuid = participant.UUID; int kills = playerProgress.getOrDefault(uuid, 0); if (kills >= requiredKills) { setComplete(uuid); } } @Override public boolean isComplete(UUID uuid) { return playerProgress.getOrDefault(uuid, 0) >= requiredKills; } @Override public void setComplete(UUID uuid) { playerProgress.put(uuid, requiredKills); } @Override public void resetUser(UUID uuid) { if (uuid == null) { playerProgress.clear(); } else { playerProgress.remove(uuid); } } @Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { nbt.setString("target", targetEntity); nbt.setInteger("required", requiredKills); return nbt; } @Override public void readFromNBT(NBTTagCompound nbt) { targetEntity = nbt.getString("target"); requiredKills = nbt.getInteger("required"); } @Override public NBTTagCompound writeProgressToNBT(NBTTagCompound nbt, List users) { NBTTagList list = new NBTTagList(); for (UUID uuid : users) { NBTTagCompound entry = new NBTTagCompound(); entry.setString("uuid", uuid.toString()); entry.setInteger("kills", playerProgress.getOrDefault(uuid, 0)); list.appendTag(entry); } nbt.setTag("progress", list); return nbt; } @Override public void readProgressFromNBT(NBTTagCompound nbt, boolean merge) { if (!merge) playerProgress.clear(); NBTTagList list = nbt.getTagList("progress", 10); for (int i = 0; i < list.tagCount(); i++) { NBTTagCompound entry = list.getCompoundTagAt(i); UUID uuid = UUID.fromString(entry.getString("uuid")); playerProgress.put(uuid, entry.getInteger("kills")); } } } ``` -------------------------------- ### Implement Custom Reward with IReward Source: https://context7.com/funwayguy/betterquesting/llms.txt Shows how to create a custom reward type by implementing the IReward interface. This includes defining claim conditions and the logic to apply rewards to a player. ```java import betterquesting.api.questing.rewards.IReward; import betterquesting.api.questing.IQuest; import betterquesting.api2.storage.DBEntry; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; public class CustomXPReward implements IReward { private static final ResourceLocation FACTORY_ID = new ResourceLocation("mymod", "xp_reward"); private int xpAmount = 100; private int levels = 0; @Override public ResourceLocation getFactoryID() { return FACTORY_ID; } @Override public String getUnlocalisedName() { return "mymod.reward.xp"; } @Override public boolean canClaim(EntityPlayer player, DBEntry quest) { return true; } @Override public void claimReward(EntityPlayer player, DBEntry quest) { if (levels > 0) { player.addExperienceLevel(levels); } if (xpAmount > 0) { player.addExperience(xpAmount); } } @Override public NBTTagCompound writeToNBT(NBTTagCompound nbt) { nbt.setInteger("xp", xpAmount); nbt.setInteger("levels", levels); return nbt; } @Override public void readFromNBT(NBTTagCompound nbt) { xpAmount = nbt.getInteger("xp"); levels = nbt.getInteger("levels"); } } ``` -------------------------------- ### Admin Commands Reference (Bash) Source: https://context7.com/funwayguy/betterquesting/llms.txt Provides a list of in-game commands for Better Questing administrators to manage quests and game elements directly from the console or chat. ```bash # This section is intended for command references and does not contain executable code snippets. ``` -------------------------------- ### Implement IItemTask and IFluidTask for Submission Mechanics Source: https://context7.com/funwayguy/betterquesting/llms.txt Demonstrates how to implement custom submission tasks for items and fluids. These interfaces allow quests to track player progress by accepting specific item or fluid stacks. ```java public class ItemSubmitTask implements IItemTask { private BigItemStack requiredItem; private Map submitted = new HashMap<>(); @Override public boolean canAcceptItem(UUID owner, DBEntry quest, ItemStack stack) { if (stack.isEmpty()) return false; return ItemComparison.compareItems(requiredItem.getBaseStack(), stack, true, false, requiredItem.hasOreDict() ? requiredItem.getOreDict() : ""); } @Override public ItemStack submitItem(UUID owner, DBEntry quest, ItemStack stack) { int needed = requiredItem.stackSize - submitted.getOrDefault(owner, 0); int toTake = Math.min(needed, stack.getCount()); submitted.merge(owner, toTake, Integer::sum); ItemStack remainder = stack.copy(); remainder.shrink(toTake); return remainder; } } public class FluidSubmitTask implements IFluidTask { private FluidStack requiredFluid; private Map submitted = new HashMap<>(); @Override public boolean canAcceptFluid(UUID owner, DBEntry quest, FluidStack fluid) { if (fluid == null) return false; return fluid.isFluidEqual(requiredFluid); } @Override public FluidStack submitFluid(UUID owner, DBEntry quest, FluidStack fluid) { int needed = requiredFluid.amount - submitted.getOrDefault(owner, 0); int toTake = Math.min(needed, fluid.amount); submitted.merge(owner, toTake, Integer::sum); FluidStack remainder = fluid.copy(); remainder.amount -= toTake; return remainder.amount > 0 ? remainder : null; } } ``` -------------------------------- ### EnumLogic - Quest Requirement Evaluation (Java) Source: https://context7.com/funwayguy/betterquesting/llms.txt Demonstrates the use of EnumLogic to evaluate quest prerequisites and task completion. It shows how AND, NAND, OR, NOR, XOR, and XNOR logic types determine the result based on completed conditions versus total required conditions. No external dependencies are needed beyond the BetterQuesting API. ```java import betterquesting.api.enums.EnumLogic; // AND - All conditions must be true EnumLogic.AND.getResult(3, 3); // true - 3 of 3 complete EnumLogic.AND.getResult(2, 3); // false - only 2 of 3 complete // NAND - At least one condition must be false EnumLogic.NAND.getResult(3, 3); // false - all complete EnumLogic.NAND.getResult(2, 3); // true - one incomplete // OR - At least one condition must be true EnumLogic.OR.getResult(1, 3); // true - at least one complete EnumLogic.OR.getResult(0, 3); // false - none complete // NOR - All conditions must be false EnumLogic.NOR.getResult(0, 3); // true - none complete EnumLogic.NOR.getResult(1, 3); // false - one complete // XOR - Exactly one condition must be true EnumLogic.XOR.getResult(1, 3); // true - exactly one EnumLogic.XOR.getResult(2, 3); // false - more than one // XNOR - All but one condition must be true EnumLogic.XNOR.getResult(2, 3); // true - 2 of 3 (all but one) EnumLogic.XNOR.getResult(3, 3); // false - all complete ``` -------------------------------- ### Configure Quest Properties with NativeProps Source: https://context7.com/funwayguy/betterquesting/llms.txt Shows how to set and retrieve various quest properties including visibility, logic, behavior flags, sound effects, and display settings using the NativeProps API. ```java IQuest quest = /* get quest */; quest.setProperty(NativeProps.NAME, "Gather Resources"); quest.setProperty(NativeProps.DESC, "Collect wood and stone to begin crafting"); quest.setProperty(NativeProps.VISIBILITY, EnumQuestVisibility.NORMAL); quest.setProperty(NativeProps.LOGIC_TASK, EnumLogic.AND); quest.setProperty(NativeProps.LOGIC_QUEST, EnumLogic.AND); quest.setProperty(NativeProps.GLOBAL, false); quest.setProperty(NativeProps.GLOBAL_SHARE, false); quest.setProperty(NativeProps.SILENT, false); quest.setProperty(NativeProps.AUTO_CLAIM, false); quest.setProperty(NativeProps.LOCKED_PROGRESS, false); quest.setProperty(NativeProps.SIMULTANEOUS, false); quest.setProperty(NativeProps.REPEAT_TIME, -1); quest.setProperty(NativeProps.REPEAT_REL, true); quest.setProperty(NativeProps.SOUND_UNLOCK, "minecraft:ui.button.click"); quest.setProperty(NativeProps.SOUND_UPDATE, "minecraft:entity.player.levelup"); quest.setProperty(NativeProps.SOUND_COMPLETE, "minecraft:entity.player.levelup"); quest.setProperty(NativeProps.ICON, new BigItemStack(Items.DIAMOND)); quest.setProperty(NativeProps.BG_IMAGE, "mymod:textures/gui/quest_bg.png"); quest.setProperty(NativeProps.BG_SIZE, 256); String name = quest.getProperty(NativeProps.NAME); EnumQuestVisibility vis = quest.getProperty(NativeProps.VISIBILITY); boolean autoClaim = quest.getProperty(NativeProps.AUTO_CLAIM, false); ``` -------------------------------- ### Manage Quest State and Progress in Java Source: https://context7.com/funwayguy/betterquesting/llms.txt This snippet demonstrates how to interact with the IQuest interface to check quest status, claim rewards, and modify quest properties. It requires the BetterQuesting API and standard Minecraft player instances. ```java import betterquesting.api.questing.IQuest; import betterquesting.api.enums.EnumQuestState; import betterquesting.api.properties.NativeProps; import betterquesting.api.questing.tasks.ITask; import betterquesting.api.questing.rewards.IReward; import betterquesting.api2.storage.IDatabaseNBT; import net.minecraft.nbt.NBTTagList; IQuest quest = /* get quest from database */; UUID playerUUID = /* player's UUID */; EntityPlayer player = /* player instance */; EnumQuestState state = quest.getState(playerUUID); boolean isUnlocked = quest.isUnlocked(playerUUID); boolean isComplete = quest.isComplete(playerUUID); boolean hasClaimed = quest.hasClaimed(playerUUID); boolean canClaim = quest.canClaim(player); long timestamp = System.currentTimeMillis(); quest.setComplete(playerUUID, timestamp); if (quest.canClaim(player)) { quest.claimReward(player); } IDatabaseNBT tasks = quest.getTasks(); IDatabaseNBT rewards = quest.getRewards(); int[] requirements = quest.getRequirements(); quest.setRequirements(new int[]{0, 1, 2}); quest.setProperty(NativeProps.NAME, "My Quest Name"); quest.setProperty(NativeProps.DESC, "Quest description here"); quest.setProperty(NativeProps.AUTO_CLAIM, true); quest.setProperty(NativeProps.SILENT, false); quest.setProperty(NativeProps.REPEAT_TIME, 24000); quest.resetUser(playerUUID, true); quest.detect(player); quest.update(player); ``` -------------------------------- ### ILifeDatabase - Hardcore Lives System (Java) Source: https://context7.com/funwayguy/betterquesting/llms.txt Shows how to interact with the ILifeDatabase interface for managing player lives in BetterQuesting's hardcore mode. It covers retrieving current lives, setting lives directly, and resetting all life data. This functionality is crucial for implementing permadeath mechanics. Requires BetterQuesting API. ```java import betterquesting.api.api.QuestingAPI; import betterquesting.api.api.ApiReference; import betterquesting.api.storage.ILifeDatabase; import java.util.UUID; ILifeDatabase lifeDB = QuestingAPI.getAPI(ApiReference.LIFE_DB); UUID playerUUID = /* player's UUID */; // Get current lives int currentLives = lifeDB.getLives(playerUUID); // Set lives directly lifeDB.setLives(playerUUID, 3); // Reset all life data lifeDB.reset(); ``` -------------------------------- ### Core API - QuestingAPI Source: https://context7.com/funwayguy/betterquesting/llms.txt Provides access to all Better Questing subsystems including quest databases, party management, network communication, and custom registries. It also allows for registering custom API extensions. ```APIDOC ## Core API - QuestingAPI ### Description The central API hub that provides access to all Better Questing subsystems including quest databases, party management, network communication, and custom registries. ### Method N/A (Static API access) ### Endpoint N/A ### Parameters N/A ### Request Example ```java import betterquesting.api.api.QuestingAPI; import betterquesting.api.api.ApiReference; import betterquesting.api.questing.IQuestDatabase; import betterquesting.api.questing.IQuest; import net.minecraft.entity.player.EntityPlayer; import java.util.UUID; // Get the quest database instance IQuestDatabase questDB = QuestingAPI.getAPI(ApiReference.QUEST_DB); // Get a player's unique questing UUID (handles offline servers properly) EntityPlayer player = /* your player instance */; UUID playerUUID = QuestingAPI.getQuestingUUID(player); // Access other API components // IQuestLineDatabase lineDB = QuestingAPI.getAPI(ApiReference.LINE_DB); // IPartyDatabase partyDB = QuestingAPI.getAPI(ApiReference.PARTY_DB); // ILifeDatabase lifeDB = QuestingAPI.getAPI(ApiReference.LIFE_DB); // IPacketSender packetSender = QuestingAPI.getAPI(ApiReference.PACKET_SENDER); // Register a custom API extension // public class MyCustomAPI { // public static final ApiKey MY_API = new ApiKey<>(); // } // QuestingAPI.registerAPI(MyCustomAPI.MY_API, new MyCustomFeatureImpl()); ``` ### Response N/A (This is an API access point, not a direct endpoint response) ### Response Example N/A ``` -------------------------------- ### IQuestDatabase - Quest Management Source: https://context7.com/funwayguy/betterquesting/llms.txt Interface for managing quests within the Better Questing mod, including creation, retrieval, storage, and deletion of quests. ```APIDOC ## IQuestDatabase - Quest Management ### Description The database interface for storing, retrieving, and managing quests with support for NBT serialization and partial loading. ### Method N/A (Interface methods) ### Endpoint N/A ### Parameters N/A ### Request Example ```java import betterquesting.api.api.QuestingAPI; import betterquesting.api.api.ApiReference; import betterquesting.api.questing.IQuestDatabase; import betterquesting.api.questing.IQuest; import betterquesting2.storage.DBEntry; import java.util.List; // Access the quest database IQuestDatabase questDB = QuestingAPI.getAPI(ApiReference.QUEST_DB); // Create a new quest int newQuestId = questDB.nextID(); IQuest newQuest = questDB.createNew(newQuestId); // Add quest to database DBEntry entry = questDB.add(newQuestId, newQuest); // Retrieve a quest by ID IQuest quest = questDB.getValue(0); // Get all quests as entries List> allQuests = questDB.getEntries(); for (DBEntry questEntry : allQuests) { int id = questEntry.getID(); IQuest q = questEntry.getValue(); System.out.println("Quest ID: " + id); } // Bulk lookup multiple quests List> specificQuests = questDB.bulkLookup(0, 1, 5, 10); // Remove a quest questDB.removeID(newQuestId); // Reset entire database questDB.reset(); ``` ### Response N/A (This describes an interface for programmatic use) ### Response Example N/A ``` -------------------------------- ### Quest Properties - NativeProps Source: https://context7.com/funwayguy/betterquesting/llms.txt Configuration of quest behavior, visibility, sounds, and display options using native properties. ```APIDOC ## Quest Properties - NativeProps Native property definitions for configuring quest behavior, visibility, sounds, and display options. ### Setting Quest Properties Use `quest.setProperty(NativeProps.PROPERTY_NAME, value)` to set various quest configurations. #### Basic Properties - `NativeProps.NAME`: Sets the quest's display name. - `NativeProps.DESC`: Sets the quest's description. #### Visibility Settings - `NativeProps.VISIBILITY`: Controls when the quest is visible (e.g., `EnumQuestVisibility.NORMAL`, `EnumQuestVisibility.COMPLETED`). #### Logic Settings - `NativeProps.LOGIC_TASK`: Determines how task completion is evaluated (e.g., `EnumLogic.AND`, `EnumLogic.OR`). - `NativeProps.LOGIC_QUEST`: Determines how prerequisite quests are evaluated. #### Behavior Flags - `NativeProps.GLOBAL`: Whether quest progress is shared globally. - `NativeProps.GLOBAL_SHARE`: Whether global rewards are shared. - `NativeProps.SILENT`: Disables quest notifications. - `NativeProps.AUTO_CLAIM`: Automatically claims rewards upon completion. - `NativeProps.LOCKED_PROGRESS`: Locks progress until the quest is complete. - `NativeProps.SIMULTANEOUS`: Allows multiple quests to be completed simultaneously. #### Repeatability - `NativeProps.REPEAT_TIME`: Sets the time in ticks until the quest can be repeated (-1 for not repeatable). - `NativeProps.REPEAT_REL`: If true, repeatability is relative to completion time. #### Sound Effects - `NativeProps.SOUND_UNLOCK`: Sound played when the quest is unlocked. - `NativeProps.SOUND_UPDATE`: Sound played when quest progress updates. - `NativeProps.SOUND_COMPLETE`: Sound played when the quest is completed. #### Display Settings - `NativeProps.ICON`: Sets the quest's icon using an item stack. - `NativeProps.BG_IMAGE`: Sets a custom background image for the quest. - `NativeProps.BG_SIZE`: Sets the size of the background image. ### Retrieving Quest Properties Use `quest.getProperty(NativeProps.PROPERTY_NAME, [defaultValue])` to retrieve property values. ``` -------------------------------- ### User Commands Source: https://github.com/funwayguy/betterquesting/wiki/Commands Commands available to all players for managing quest synchronization and help. ```APIDOC ## GET /bq_user refresh ### Description Manually resyncs the local questing database with the server to resolve desync issues. ## GET /bq_user help ### Description Provides the player with a copy of the in-game starter guide. ``` -------------------------------- ### JsonHelper - JSON/NBT Utilities (Java) Source: https://context7.com/funwayguy/betterquesting/llms.txt Provides utility methods for reading and writing JSON files, and for converting between JSON, NBT, item stacks, fluid stacks, and entities. It includes safe accessors for JSON properties and validation helpers. ```java import betterquesting.api.utils.JsonHelper; import betterquesting.api.utils.BigItemStack; import com.google.gson.JsonObject; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; // Read JSON from file File questFile = new File("config/betterquesting/quests.json"); JsonObject json = JsonHelper.ReadFromFile(questFile); // Write JSON to file (with validation and backup) JsonObject newData = new JsonObject(); newData.addProperty("version", 1); JsonHelper.WriteToFile(new File("config/mymod/data.json"), newData); // Safe JSON property access with defaults String name = JsonHelper.GetString(json, "name", "Unnamed"); int count = JsonHelper.GetNumber(json, "count", 1).intValue(); boolean enabled = JsonHelper.GetBoolean(json, "enabled", true); JsonArray items = JsonHelper.GetArray(json, "items"); JsonObject nested = JsonHelper.GetObject(json, "settings"); // Item conversion NBTTagCompound itemNBT = new NBTTagCompound(); itemNBT.setString("id", "minecraft:diamond"); itemNBT.setInteger("Count", 64); itemNBT.setShort("Damage", (short) 0); BigItemStack bigStack = JsonHelper.JsonToItemStack(itemNBT); // Save item to NBT BigItemStack myStack = new BigItemStack(Items.IRON_INGOT, 128); NBTTagCompound savedItem = JsonHelper.ItemStackToJson(myStack, new NBTTagCompound()); // Fluid conversion NBTTagCompound fluidNBT = new NBTTagCompound(); fluidNBT.setString("FluidName", "water"); fluidNBT.setInteger("Amount", 1000); FluidStack fluidStack = JsonHelper.JsonToFluidStack(fluidNBT); // Validation helpers boolean isValidItem = JsonHelper.isItem(itemNBT); boolean isValidFluid = JsonHelper.isFluid(fluidNBT); boolean isValidEntity = JsonHelper.isEntity(entityNBT); ``` -------------------------------- ### BetterQuesting GUI Color Configuration Source: https://github.com/funwayguy/betterquesting/wiki/Theme-Creation Defines the color values for various text and GUI elements within the BetterQuesting interface. These colors are applied statically and can be customized to theme the quest book. ```json { "colors": { "betterquesting:text_header": { "colorType": "betterquesting:color_static", "color": "FFFFFF" }, "betterquesting:text_main": { "colorType": "betterquesting:color_static", "color": "FFFFFF" }, "betterquesting:gui_divider": { "colorType": "betterquesting:color_static", "color": "000000" }, "betterquesting:grid_major": { "colorType": "betterquesting:color_static", "color": "000000" }, "betterquesting:grid_minor": { "colorType": "betterquesting:color_static", "color": "000000" } } } } ``` -------------------------------- ### Define Better Questing Theme JSON Source: https://github.com/funwayguy/betterquesting/wiki/Theme-Creation This JSON structure defines a custom theme for Better Questing. It includes theme identification, naming, parent theme, and texture configurations. The 'textures' object maps specific UI elements to their corresponding image files and defines how they are rendered (e.g., sliced, simple). ```json [ { "themeID": "packname:themename", "themeName": "Theme Name", "themeParent": "none", "textures": { "betterquesting:panel_main": { "atlas": "packname:textures/gui/image_file.png", "bounds": [0, 0, 48, 48], "padding": [8, 8, 8, 8], "sliceMode": 1, "textureType": "betterquesting:texture_sliced" }, "betterquesting:aux_frame_0": { "textureType": "betterquesting:texture_sliced", "atlas": "packname:textures/gui/image_file.png", "bounds": [60, 0, 24, 24], "padding": [4, 4, 4, 4], "sliceMode": 1 }, "betterquesting:scroll_v_bg": { "textureType": "betterquesting:texture_sliced", "atlas": "packname:textures/gui/image_file.png", "bounds": [96, 0, 8, 8], "padding": [2, 2, 2, 2], "sliceMode": 2 }, "betterquesting:scroll_v_0": { "textureType": "betterquesting:texture_sliced", "atlas": "packname:textures/gui/image_file.png", "bounds": [104, 0, 8, 8], "padding": [3, 3, 3, 3], "sliceMode": 2 }, "betterquesting:scroll_v_1": { "textureType": "betterquesting:texture_sliced", "atlas": "packname:textures/gui/image_file.png", "bounds": [112, 0, 8, 8], "padding": [3, 3, 3, 3], "sliceMode": 2 }, "betterquesting:scroll_v_2": { "textureType": "betterquesting:texture_sliced", "atlas": "packname:textures/gui/image_file.png", "bounds": [120, 0, 8, 8], "padding": [3, 3, 3, 3], "sliceMode": 2 }, "betterquesting:btn_normal_0": { "textureType": "betterquesting:texture_sliced", "atlas": "packname:textures/gui/image_file.png", "bounds": [48, 0, 12, 12], "padding": [5, 5, 5, 5], "sliceMode": 1 }, "betterquesting:btn_normal_1": { "textureType": "betterquesting:texture_sliced", "atlas": "packname:textures/gui/image_file.png", "bounds": [48, 12, 12, 12], "padding": [5, 5, 5, 5], "sliceMode": 1 }, "betterquesting:btn_normal_2": { "textureType": "betterquesting:texture_sliced", "atlas": "packname:textures/gui/image_file.png", "bounds": [48, 24, 12, 12], "padding": [4, 4, 4, 4], "sliceMode": 1 }, "betterquesting:quest_main_0": { "textureType": "betterquesting:texture_simple", "atlas": "packname:textures/gui/image_file.png", "bounds": [60, 24, 16, 16] }, "betterquesting:quest_main_1": { "textureType": "betterquesting:texture_simple", "atlas": "packname:textures/gui/image_file.png", "bounds": [60, 24, 16, 16] }, "betterquesting:quest_main_2": { "textureType": "betterquesting:texture_simple", "atlas": "packname:textures/gui/image_file.png", "bounds": [60, 24, 16, 16] }, "betterquesting:quest_main_3": { "textureType": "betterquesting:texture_simple", "atlas": "packname:textures/gui/image_file.png", "bounds": [60, 24, 16, 16] }, "betterquesting:quest_norm_0": { "textureType": "betterquesting:texture_simple", "atlas": "packname:textures/gui/image_file.png", "bounds": [60, 40, 16, 16] }, "betterquesting:quest_norm_1": { "textureType": "betterquesting:texture_simple", "atlas": "packname:textures/gui/image_file.png", "bounds": [60, 40, 16, 16] }, "betterquesting:quest_norm_2": { "textureType": "betterquesting:texture_simple", "atlas": "packname:textures/gui/image_file.png", "bounds": [60, 40, 16, 16] }, "betterquesting:quest_norm_3": { "textureType": "betterquesting:texture_simple", "atlas": "packname:textures/gui/image_file.png", "bounds": [60, 40, 16, 16] } } } ] ``` -------------------------------- ### Admin Commands Source: https://github.com/funwayguy/betterquesting/wiki/Commands Commands restricted to server operators for managing quest data, editing, and hardcore settings. ```APIDOC ## POST /bq_admin edit ### Description Toggles quest editing mode for operators. ## POST /bq_admin hardcore ### Description Toggles hardcore life mechanics on or off. ## POST /bq_admin reset ### Parameters - **target** (string) - Required - 'all' or quest_id - **user** (string) - Optional - username or uuid ### Description Erases quest completion data for a specific user. ## POST /bq_admin default ### Parameters - **action** (string) - Required - 'save' or 'load' ### Description Manages global default quest database files. ## POST /bq_admin complete ### Parameters - **quest_id** (int) - Required - ID of the quest - **user** (string) - Optional - username or uuid ### Description Force completes a specific quest for a user. ## POST /bq_admin delete ### Parameters - **target** (string) - Required - 'all' or quest_id ### Description Deletes quest data and progression. ``` -------------------------------- ### IPacketSender - Network Communication (Java) Source: https://context7.com/funwayguy/betterquesting/llms.txt An interface for managing network packet transmission between the server and clients in BetterQuesting. It allows sending packets to specific players, all players, or players within a certain area. ```java import betterquesting.api.api.QuestingAPI; import betterquesting.api.api.ApiReference; import betterquesting.api.network.IPacketSender; import betterquesting.api.network.QuestingPacket; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint; IPacketSender sender = QuestingAPI.getAPI(ApiReference.PACKET_SENDER); // Create a packet ResourceLocation packetId = new ResourceLocation("mymod", "quest_sync"); NBTTagCompound payload = new NBTTagCompound(); payload.setInteger("questId", 5); payload.setBoolean("completed", true); QuestingPacket packet = new QuestingPacket(packetId, payload); // Server to specific players EntityPlayerMP player1 = /* player instance */; EntityPlayerMP player2 = /* player instance */; sender.sendToPlayers(packet, player1, player2); // Server to all players sender.sendToAll(packet); // Client to server sender.sendToServer(packet); // Server to players in area TargetPoint point = new TargetPoint(0, 100, 64, 100, 32); // dim, x, y, z, radius sender.sendToAround(packet, point); // Server to all players in dimension sender.sendToDimension(packet, 0); // Overworld ``` -------------------------------- ### BigItemStack - Large Stack Handling (Java) Source: https://context7.com/funwayguy/betterquesting/llms.txt A container class designed to manage item stacks that exceed the standard Minecraft 64-item limit. It supports OreDict entries, NBT data, and conversion to multiple vanilla ItemStacks. ```java import betterquesting.api.utils.BigItemStack; import net.minecraft.init.Items; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; // Create from item BigItemStack stack1 = new BigItemStack(Items.DIAMOND, 256); BigItemStack stack2 = new BigItemStack(Items.IRON_INGOT, 1000, 0); // item, amount, damage // Create from block BigItemStack stack3 = new BigItemStack(Blocks.COBBLESTONE, 500); // Create from existing ItemStack ItemStack vanillaStack = new ItemStack(Items.GOLD_INGOT, 32); BigItemStack stack4 = new BigItemStack(vanillaStack); stack4.stackSize = 256; // Increase beyond vanilla limit // OreDict support BigItemStack oreStack = new BigItemStack(Items.IRON_INGOT, 64); oreStack.setOreDict("ingotIron"); boolean hasOre = oreStack.hasOreDict(); String oreName = oreStack.getOreDict(); // Access underlying ItemStack ItemStack baseStack = stack1.getBaseStack(); // NBT handling stack1.SetTagCompound(new NBTTagCompound()); NBTTagCompound tags = stack1.GetTagCompound(); boolean hasNBT = stack1.HasTagCompound(); // Convert to multiple vanilla stacks (respects max stack size) List vanillaStacks = stack1.getCombinedStacks(); // 256 diamonds -> 4 stacks of 64 // Copy BigItemStack copy = stack1.copy(); // NBT serialization NBTTagCompound nbt = new NBTTagCompound(); stack1.writeToNBT(nbt); // Load from NBT BigItemStack loaded = new BigItemStack(nbt); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.