### Schematic Configuration Example Source: https://context7.com/magmaguy/betterstructures/llms.txt Configures individual schematic properties such as spawn weight, assigned generator, pedestal material, and custom treasure files. This YAML file controls how a specific schematic behaves when considered for spawning. ```yaml # my_structure.yml isEnabled: true weight: 1.0 generatorConfigFilename: generator_surface_grassland.yml pedestalMaterial: STONE_BRICKS treasureFile: custom_treasure.yml ``` -------------------------------- ### Treasure Configuration Example Source: https://context7.com/magmaguy/betterstructures/llms.txt Defines loot tables for chests within structures, specifying item materials, amount ranges, and drop chances. This YAML configuration allows for detailed customization of the loot players can find. ```yaml # custom_treasure.yml isEnabled: true chestEntries: - material=DIAMOND:amount=1-2:chance=0.05 - material=IRON_INGOT:amount=3-8:chance=0.25 - material=GOLD_INGOT:amount=2-5:chance=0.15 - material=COAL:amount=5-15:chance=0.40 - material=BREAD:amount=2-6:chance=0.30 - material=ARROW:amount=8-16:chance=0.20 ``` -------------------------------- ### Generator Configuration Example Source: https://context7.com/magmaguy/betterstructures/llms.txt Defines parameters for structure generation, including enabled status, structure types, Y-level ranges, valid world environments, biomes, and associated loot tables. This YAML configuration file dictates where and how structures will spawn. ```yaml # generator_surface_grassland.yml isEnabled: true structureType: - SURFACE lowestYLevel: 60 highestYLevel: 200 validWorldEnvironments: - NORMAL validBiomesV2: - minecraft:plains - minecraft:sunflower_plains - minecraft:meadow - minecraft:forest - minecraft:birch_forest treasureFilename: overworld_surface_treasure.yml ``` -------------------------------- ### Spawn Signs Formatting for Entities Source: https://context7.com/magmaguy/betterstructures/llms.txt Details the formatting required for signs within schematics to spawn entities upon structure placement. This includes configurations for vanilla mobs, EliteMobs bosses, and MythicMobs, specifying mob type, identifier, and optional level. ```text Vanilla Mob Spawning: Line 1: [spawn] Line 2: ZOMBIE Line 3: (empty) Line 4: (empty) EliteMobs Boss Spawning: Line 1: [elitemobs] Line 2: my_custom_boss.yml Line 3: (empty) Line 4: (empty) MythicMobs Spawning: Line 1: [mythicmobs] Line 2: MobIdentifier Line 3: 10 (optional level) Line 4: (empty) ``` -------------------------------- ### Gradle Dependency for BetterStructures Source: https://github.com/magmaguy/betterstructures/wiki/3.-Developers---API This snippet shows how to add the BetterStructures dependency to your Gradle project. Ensure you replace the placeholder with the correct version of the plugin. ```xml com.magmaguy BetterStructures -SNAPSHOT ``` -------------------------------- ### Configure Chest Loot Entries (YAML) Source: https://github.com/magmaguy/betterstructures/wiki/2---Advanced-Users Defines the items that can appear in structure chests. Each entry specifies the item material, the amount (as a MIN-MAX range), and the drop chance (0-1). Uses '=' for key-value pairs and ':' as separators. ```yaml chestEntries: - material=COAL:amount=2-5:chance=0.02 - material=BONE:amount=2-5:chance=0.02 ``` -------------------------------- ### Define Structure Spawn Type (YAML) Source: https://github.com/magmaguy/betterstructures/wiki/2---Advanced-Users Configures the type of environment where a structure can spawn. Supported types include SURFACE, SKY, UNDERGROUND_SHALLOW, UNDERGROUND_DEEP, and LIQUID_SURFACE. Multiple types can be specified in a list. ```yaml structureType: - SURFACE - SKY ``` -------------------------------- ### Place Schematic with Specific Placement Logic Source: https://context7.com/magmaguy/betterstructures/llms.txt Places a specific schematic at the player's location, adhering to a defined structure type placement logic. Supported types include SURFACE, SKY, LIQUID_SURFACE, UNDERGROUND_SHALLOW, and UNDERGROUND_DEEP. This command is essential for manually instantiating structures within the game world. ```bash # Place a surface structure /betterstructures place my_house.schem SURFACE # Place an underground structure /bs place dungeon_entrance.schem UNDERGROUND_SHALLOW # Place a sky structure /bs place floating_island.schem SKY ``` -------------------------------- ### Configuration Files Source: https://context7.com/magmaguy/betterstructures/llms.txt Details the structure and purpose of Generator, Schematic, and Treasure configuration files used by BetterStructures. ```APIDOC ## Configuration Files ### Generator Configuration Generators define where and how structures spawn. They control structure type, Y-level range, valid worlds, biomes, and loot tables. ```yaml # generator_surface_grassland.yml isEnabled: true structureType: - SURFACE lowestYLevel: 60 highestYLevel: 200 validWorldEnvironments: - NORMAL validBiomesV2: - minecraft:plains - minecraft:sunflower_plains - minecraft:meadow - minecraft:forest - minecraft:birch_forest treasureFilename: overworld_surface_treasure.yml ``` ### Schematic Configuration Each schematic has a configuration file that controls its spawn weight, assigned generator, pedestal material, and optional custom treasure. ```yaml # my_structure.yml isEnabled: true weight: 1.0 generatorConfigFilename: generator_surface_grassland.yml pedestalMaterial: STONE_BRICKS treasureFile: custom_treasure.yml ``` ### Treasure Configuration Treasure files define loot tables for chests with material, amount ranges, and drop chances. ```yaml # custom_treasure.yml isEnabled: true chestEntries: - material=DIAMOND:amount=1-2:chance=0.05 - material=IRON_INGOT:amount=3-8:chance=0.25 - material=GOLD_INGOT:amount=2-5:chance=0.15 - material=COAL:amount=5-15:chance=0.40 - material=BREAD:amount=2-6:chance=0.30 - material=ARROW:amount=8-16:chance=0.20 ``` ``` -------------------------------- ### Maven Dependency Source: https://context7.com/magmaguy/betterstructures/llms.txt Instructions on how to add BetterStructures as a dependency to your project for API access. ```APIDOC ## Maven Dependency Add BetterStructures as a dependency to access the API in your plugin. ```xml magmaguy-repo https://repo.magmaguy.com/releases com.magmaguy BetterStructures 2.1.2-SNAPSHOT provided ``` ```groovy // build.gradle repositories { maven { url 'https://repo.magmaguy.com/releases' } } dependencies { compileOnly 'com.magmaguy:BetterStructures:2.1.2-SNAPSHOT' } ``` ``` -------------------------------- ### WorldEdit Usage for Barrier Blocks Source: https://context7.com/magmaguy/betterstructures/llms.txt Demonstrates the use of barrier blocks within WorldEdit to create natural-looking structure edges that blend with the existing terrain. Barrier blocks instruct the plugin not to replace any block at their location, preserving the original environment. ```text Usage in WorldEdit: 1. Select your structure with //pos1 and //pos2 2. Place barrier blocks where you want terrain to show through 3. Save with //copy then /schem save Result: Barriers create natural-looking edges that blend with terrain ``` -------------------------------- ### Special Blocks in Schematics Source: https://context7.com/magmaguy/betterstructures/llms.txt Explains the functionality of Barrier Blocks, Bedrock Blocks, and Spawn Signs within schematic files. ```APIDOC ## Special Blocks in Schematics ### Barrier Blocks Barrier blocks in schematics tell the plugin not to paste any block at that location, preserving the original terrain. ``` Usage in WorldEdit: 1. Select your structure with //pos1 and //pos2 2. Place barrier blocks where you want terrain to show through 3. Save with //copy then /schem save Result: Barriers create natural-looking edges that blend with terrain ``` ### Bedrock Blocks Bedrock blocks guarantee a solid floor exists at that location. If the original block is air or liquid, it gets replaced with pedestal material. ``` Usage in WorldEdit: 1. Place bedrock blocks where you need guaranteed solid ground 2. Common uses: paths, minecart rails, bridge supports 3. Save your schematic normally Result: Bedrock becomes pedestal material, ensuring structural integrity ``` ### Spawn Signs Signs with special formatting spawn entities when the structure is placed. ``` Vanilla Mob Spawning: Line 1: [spawn] Line 2: ZOMBIE Line 3: (empty) Line 4: (empty) EliteMobs Boss Spawning: Line 1: [elitemobs] Line 2: my_custom_boss.yml Line 3: (empty) Line 4: (empty) MythicMobs Spawning: Line 1: [mythicmobs] Line 2: MobIdentifier Line 3: 10 (optional level) Line 4: (empty) ``` ``` -------------------------------- ### Maven Dependency for BetterStructures (build.gradle) Source: https://context7.com/magmaguy/betterstructures/llms.txt Shows how to add BetterStructures as a compile-only dependency in a Gradle project. This configuration enables your plugin to utilize the BetterStructures API. ```groovy // build.gradle repositories { maven { url = 'https://repo.magmaguy.com/releases' } } dependencies { compileOnly 'com.magmaguy:BetterStructures:2.1.2-SNAPSHOT' } ``` -------------------------------- ### WorldEdit Usage for Bedrock Blocks Source: https://context7.com/magmaguy/betterstructures/llms.txt Explains how to use bedrock blocks in schematics to ensure a solid floor is always present. If the original block is air or liquid, it will be replaced with the pedestal material, guaranteeing structural integrity for elements like paths or minecart rails. ```text Usage in WorldEdit: 1. Place bedrock blocks where you need guaranteed solid ground 2. Common uses: paths, minecart rails, bridge supports 3. Save your schematic normally Result: Bedrock becomes pedestal material, ensuring structural integrity ``` -------------------------------- ### Intercept Structure Placement with BuildPlaceEvent (Java) Source: https://context7.com/magmaguy/betterstructures/llms.txt The BuildPlaceEvent is a cancellable event triggered before a structure is placed. It provides access to placement details via the FitAnything object, allowing for custom logic or cancellation of placements based on world, schematic, or location. ```java import com.magmaguy.betterstructures.api.BuildPlaceEvent; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; public class StructureListener implements Listener { @EventHandler public void onBuildPlace(BuildPlaceEvent event) { // Get the FitAnything object containing all placement data FitAnything fitAnything = event.getFitAnything(); // Access schematic information SchematicContainer schematic = fitAnything.getSchematicContainer(); Location placementLocation = fitAnything.getLocation(); // Example: Cancel placement in specific worlds if (placementLocation.getWorld().getName().equals("spawn_world")) { event.setCancelled(true); return; } // Example: Log structure placements Bukkit.getLogger().info("Placing structure: " + schematic.getConfigFilename() + " at " + placementLocation.getBlockX() + ", " + placementLocation.getBlockY() + ", " + placementLocation.getBlockZ()); } } ``` -------------------------------- ### Maven Dependency for BetterStructures (pom.xml) Source: https://context7.com/magmaguy/betterstructures/llms.txt Provides the necessary Maven dependency configuration to include BetterStructures as a library in your Java project. This allows your plugin to interact with the BetterStructures API. ```xml magmaguy-repo https://repo.magmaguy.com/releases com.magmaguy BetterStructures 2.1.2-SNAPSHOT provided ``` -------------------------------- ### /betterstructures place Source: https://context7.com/magmaguy/betterstructures/llms.txt Places a specific schematic at the player's location. It supports various placement types to control where and how the structure appears. ```APIDOC ## POST /betterstructures place ### Description Places a specific schematic at your location following the specified structure type placement logic. Valid types are: `SURFACE`, `SKY`, `LIQUID_SURFACE`, `UNDERGROUND_SHALLOW`, and `UNDERGROUND_DEEP`. ### Method POST ### Endpoint /betterstructures place ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash # Place a surface structure /betterstructures place my_house.schem SURFACE # Place an underground structure /bs place dungeon_entrance.schem UNDERGROUND_SHALLOW # Place a sky structure /bs place floating_island.schem SKY ``` ### Response #### Success Response (200) Indicates that the schematic was placed successfully. #### Response Example (No specific response body is detailed, typically a confirmation message in chat. ``` -------------------------------- ### Handle World Generation Completion with WorldGenerationFinishEvent (Java) Source: https://context7.com/magmaguy/betterstructures/llms.txt The WorldGenerationFinishEvent is triggered upon the completion of modular world generation. It provides access to the ModularWorld object, allowing developers to retrieve information about the generated world and perform post-generation actions. ```java import com.magmaguy.betterstructures.api.WorldGenerationFinishEvent; import com.magmaguy.betterstructures.modules.ModularWorld; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; public class WorldGenListener implements Listener { @EventHandler public void onWorldGenFinish(WorldGenerationFinishEvent event) { ModularWorld modularWorld = event.getModularWorld(); // Access the generated world World world = modularWorld.getWorld(); // Log completion Bukkit.getLogger().info("Modular world generation completed for: " + world.getName()); // Perform post-generation actions // e.g., notify players, enable world access, etc. } } ``` -------------------------------- ### Reload BetterStructures Configurations Source: https://context7.com/magmaguy/betterstructures/llms.txt Reloads all BetterStructures configurations and schematics. This command allows for dynamic updates to structure definitions without requiring a server restart. It is useful when adding or modifying structure files. ```bash # Reload all configurations and schematics /betterstructures reload # Short form /bs reload ``` -------------------------------- ### Add Held Item to Treasure Configuration Source: https://context7.com/magmaguy/betterstructures/llms.txt Adds the item currently held by the player to a specified treasure configuration file's loot table. This functionality enables the customization of loot found in structure chests, allowing for the inclusion of items from any plugin. Parameters include the treasure file name, rarity, amount range, and drop chance. ```bash # Add held item to treasure file with rarity, amount range, and drop chance /betterstructures lootify # Example: Add held item to overworld treasure with common rarity /bs lootify overworld_surface_treasure.yml common 1 3 0.15 # Example: Add rare item with lower drop chance /bs lootify nether_treasure.yml rare 1 1 0.05 ``` -------------------------------- ### /betterstructures reload Source: https://context7.com/magmaguy/betterstructures/llms.txt Reloads all BetterStructures configurations and schematics. This command allows for dynamic updates to structures without requiring a server restart. ```APIDOC ## POST /betterstructures reload ### Description Reloads all BetterStructures configurations and schematics, allowing you to add or modify structures without restarting the server. ### Method POST ### Endpoint /betterstructures reload ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash /betterstructures reload ``` ### Response #### Success Response (200) Indicates that the configurations and schematics were reloaded successfully. #### Response Example (No specific response body is detailed, typically a confirmation message in chat. ``` -------------------------------- ### /betterstructures lootify Source: https://context7.com/magmaguy/betterstructures/llms.txt Adds the item currently held in the player's hand to a treasure configuration file's loot table. This facilitates the addition of custom items to structure chests. ```APIDOC ## POST /betterstructures lootify ### Description Adds the item currently held in your hand to a treasure configuration file's loot table. This allows adding custom items from any plugin to structure chest loot. ### Method POST ### Endpoint /betterstructures lootify ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```bash # Add held item to treasure file with rarity, amount range, and drop chance /betterstructures lootify # Example: Add held item to overworld treasure with common rarity /bs lootify overworld_surface_treasure.yml common 1 3 0.15 # Example: Add rare item with lower drop chance /bs lootify nether_treasure.yml rare 1 1 0.05 ``` ### Response #### Success Response (200) Indicates that the item was successfully added to the treasure file. #### Response Example (No specific response body is detailed, typically a confirmation message in chat. ``` -------------------------------- ### Customize Chest Loot with ChestFillEvent (Java) Source: https://context7.com/magmaguy/betterstructures/llms.txt The ChestFillEvent is a cancellable event that fires when a chest in a placed structure is being filled. It allows modification of chest contents by providing access to the container and the treasure configuration filename, enabling custom loot generation or replacement. ```java import com.magmaguy.betterstructures.api.ChestFillEvent; import org.bukkit.Material; import org.bukkit.block.Container; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.inventory.ItemStack; public class LootListener implements Listener { @EventHandler public void onChestFill(ChestFillEvent event) { Container container = event.getContainer(); String treasureConfig = event.getTreasureConfigFilename(); // Example: Add bonus items to specific treasure types if (treasureConfig != null && treasureConfig.contains("rare")) { container.getSnapshotInventory().addItem( new ItemStack(Material.DIAMOND, 1) ); } // Example: Replace all loot in underground chests if (treasureConfig != null && treasureConfig.contains("underground")) { container.getSnapshotInventory().clear(); container.getSnapshotInventory().addItem( new ItemStack(Material.IRON_INGOT, 5), new ItemStack(Material.COAL, 10), new ItemStack(Material.TORCH, 16) ); } // Example: Cancel chest filling entirely // event.setCancelled(true); } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.