BuildableMobs
  • What is BuildableMobs
  • How to create a structure
  • Structure JSON file
    • Activators
  • Forks
    • Blocks
    • Entities
  • Tutorial
Powered by GitBook
On this page

Structure JSON file

The plugin loads the structure JSON files from the ./plugins/BuildableMobs/Structures/ folder

{
  //This is the Display name of the structure
  "name": "Diamond Wither",
  
  //This is set to "true" if you want the schematic
  //to be built in both the X & Z Axis
  "bidirectional": true, 
  
  //This is set to "true" if you want
  //to remove the blocks when spawning the entity
  "destroyStructure": true,
  
  //Activators will decide if the actions will run depending on the way the
  //structure was built
  "activators": [
    //If "PLAYER_BLOCK_PLACE" is here, it will only activate when a player
    //places a block and no other way
    "PLAYER_BLOCK_PLACE",
    "BLOCK_PHYSICS",
    "PISTON",
    "REDSTONE",
    "LIQUID_FLOW",
    "BLOCK_INTERACT",
    "INVENTORY_CONFIRM" //This means when a chest closes, etc
  ],
  
  //Activation conditions are used to require certain criteria to create the structure
  "activationConditions": [
      //This condition has BOOLEAN which is used to validate if an expression
      //is true. Placeholder can also be used for this
      {
        "conditionType": "BOOLEAN",
        "failMessage": "The structure didnt activate because 1==1 but you are not astaspasta and 1!=3",
        "booleanCondition": "(1==1 && %entity%==astaspasta) || 1==3" //result is false
      },
      //This condition is BALANCE and checks if player has enough balance
      {
        "conditionType": "BALANCE",
        "failMessage": "none", //no message is sent
        "cost": 150
      },
      //This condition is BIOMES and checks if the structure is built
      //in specified biomes
      {
        "conditionType": "BIOMES",
        "failMessage": "none", //no message is sent
        "whitelistedBiomes": [
          "PLAINS"
        ]
      },
    ],
  
  //This is what will be executed once the structure is built
  "actions": {
    //these tasks have an execution order depending on the number,
    //this is 0 so it runs first, "1" runs second, etc
    "0": {
      //"action" is the task action that will be executed.
      //this example has SPAWN_ENTITY which is used to spawn an entity
      "action": "SPAWN_ENTITY",
      
      //conditions are requirements in order to execute the action or not
      //check Action Conditions for more info
      "executionConditions": [],
      
      //The type of the entity
      "entity": {
        "plugin": "MythicMobs", //It can be Minecraft, ItemsAdder, MythicMobs
        "name": "SkeletalKnight"
      },
      
      //the offset to spawn the entity from the structures center
      "offset": {
        "x": 0.0,
        "y": 0.0,
        "z": 0.0
      },
    "1": {
      //This action is COMMAND and is used to execute a command
      "action": "COMMAND",
      
      "executionConditions": [],
      
      //"executor" can be either "player" or "console" and determines if
      //the command is run by player or cnsole
      "executor": "console",
      
      //the command to execute (without "/")
      "command": "execute in %location_world% run summon zombie %location_x% %location_y% %location_z%"
    },
    "2": {
      //"EFFECT" action is used to play a sound or spawn a particle
      "action": "EFFECT",
      
      "executionConditions": [],
      
      //The sound to play
      "sound": "ENTITY_GENERIC_EXPLODE",
      //the location to play the sound (offset from structure's center)
      "soundOffset": {
        "x": 0.0,
        "y": 0.0,
        "z": 0.0
      },
      
      //particle to spawn
      "particle": "EXPLOSION_NORMAL",
      //particle offset
      "particleOffset": {
        "x": 0.0,
        "y": 0.0,
        "z": 0.0
      }
      
      //if you want to only play sound or only spawn particle,
      //do not include the other option
    },
    "3": {
      //action "DELAY" is used to add a delay between running tasks.
      "action": "DELAY",
      
      "executionConditions": [],
      
      //the milliseconds to wait before going to next action
      "milliseconds": 2500
    },
    "4": {
      //action "DELAY" is used to add a delay between running tasks.
      "action": "DELAY",
      
      "executionConditions": [],
      
      //the milliseconds to wait before going to next action
      "milliseconds": 2500
    }
  },
  
  //Here is the schematic of the structure
  "build": {
    
    //"structure" holds all the structure blocks
    "structure": {
      //you place here the block you want,
      //and what is its relevance to the center block.
      //Here we say that the structure has 4 diamond blocks and they should be:
      //"0,0,0": there is a diamond block in the center of the structure
      //"0,-1,0": one block below the center block
      //"0,0,-1": one block to the left
      //"0,0,1": one block to the right
      //INFO: if bidirectional is true then X & Z offsets will be swapped to check both ways
      "minecraft:diamond_block": ["0,0,0","0,-1,0","0,0,-1","0,0,1"],
      
      //You can enter here the blocks like when you would use the /setblock command
      //for example:
      "minecraft:chest[waterlogged=true]": ["0,0,0"],

      //If you want to include multiple options (for example facing) it can be done like so:
      //"minecraft:oak_log[facing=<axis if build was built in original direction>|<axis if build was built in other direction>]": ["0,0,0"]
      "minecraft:oak_log[facing=x|z]": ["0,0,0"],
      
      //If you want to allow either x or z axis for one block, it can be done like so:
      "minecraft:oak_log[facing=y+x|y+z]": ["0,0,0"]
    },    

    //"finish" holds all the blocks that must be
    //placed WHEN FINISHING the structure
    //meaning that ALL the blocks from "structure"
    //must be already built when placing
    //one of the blocks below
    "finish": {
      "minecraft:wither_skeleton_skull": [ "0,1,-1", "0,1,0", "0,1,1"]
    },
    
  }
}

Commands and conditions have the following placeholders:

%structureId% - Structure ID
%structureName% - Structure name
%entity% - Player name/Entity Type
%entityID% - Player UUID/Entity ID

%location_world% - Destination world
%location_x% - Destination X
%location_y% - Destination Y
%location_z% - Destination Z

Commands and conditions also support PlaceholderAPI

PreviousHow to create a structureNextActivators

Last updated 1 year ago