Lucky Block Documentation

Contents

2.5 Structures

2.5 Structures


The structure type is used to indicate that the Lucky Block will place a structure in the world when harvested. Unlike other types, structures are first configured in a separate folder. This folder, /structures, contains all of the structures as either .schematic or .luckystruct files. In the main configuration directory there is also the file 'structures.txt', which is used to specify additional properties for each structure.

 

Schematic Structures


Schematic structures are found in files ending with .schematic in the config/lucky/structures directory. The majority of structures use this format, as it is widely supported by third-party Minecraft editors. Shematics are stored using the Minecraft NBT format, similarly to the way worlds are stores. These files cannot be viewed without the use of a Minecraft or NBT editor.

 

Advantages

  • Supported by third-party Minecraft editing software.
  • Sufficient in most situations.

Disadvantages

  • Blocks are stored using numerical Ids. DO NOT export modded blocks/items in schematics, as blocks/items from mods can change their IDs with new Minecraft releases or when combined with other mods.
  • Does not support any of the Lucky Block 3.2 Hash Variables.

Lucky Structures


Lucky structures are found in files ending with .luckystruct in the config/lucky/structures directory. These structures generally work together with a shematic structure, overlaying it, allow the things that do not work with schematics. Lucky Structures are stored in text format, and can be edited with any text editor.

 

Format

 

Lucky structures use a format similar to the main configuration file. The file is divided into three sections, >properties, >blocks and >entities. firstly, the length, width and height of the structure are specified under >properties. Below is an example.

>properties
length=5
height=2
width=3

Then, every block in the structure is listed under the >blocks section. Air blocks do not need to be listed, as any position is the structure without a block specified will default to air. The format for blocks is below.

x,y,z,id,meta*,tile entity*

* Optional

 

The X, Y and Z coordinates are in accordance with the regular structure coordinate format, see below. The following properties are similar to those specified in 2.3 Blocks. The ID can be either a text or numerical ID, though it is recommended to use text IDs. For modded block, such as the Lucky Block itself, text IDs must be used, as the numerical ID can change. The meta (optional, defaults to 0) specifies the metadata of the block. The tile entity (optional, none by default) specifies the tile entity to be added with the block. This tile entity is specified using the Lucky Block NBT format. Below is an example of a custom Lucky Block in the structure which, when harvested, will display the message Hello there, (the name of the player).

>blocks
4,0,1,lucky:lucky_block,0,(Drops=["type=message,ID=\"Hello there, #pName\""])

Finally, entities are specified below the >entities section. The format for entities is below.

x,y,z,id,data*

* Optional

 

The X, Y and Z coordinates are similar to those specified by blocks, though they are instead read as floats. Therefore, to place an entity in the center of a block, 0.5 must be added to X and Z, see 'Structure Coordinates' below. The following properties are similar to those specified in 2.4 Entities. The ID is the text ID of the entity being spawned. The data is an NBT Tag, specified using the Lucky Block NBT format, which stores additional data regarding the entity. Below is an example of a Zombie holding an enchanted diamond sword.

>entities
2.5,0,0.5,Zombie,0,(Equipment=[(id=diamond_sword,Count=1,Damage=0,tag=(ench=#luckySwordEnchantments))])

Advantages

  • Supports text IDs, allowing for modded blocks/items to be used.
  • All Lucky Block 3.2 Hash Variables are supported, allowing for randomness and other functions. Additionally, some hash variables such as #sPos are designed to be used only by lucky structures.

Disadvantages

  • Only supported by the Lucky Block mod.
  • Structures need to be manually created, without the help of third-party software.

Properties


Structures have two types of properties. The first, static properties, are configures in 'structures.txt'. These properties will apply to every instance of each structure. Additionally, similarly to all other drop types, structures have dynamic properties applied separately to each structure instance in the drops.txt configuration file.

 

Static Properties


'Property Value Type Default Value Example Description
ID* text ID - ID=ship Use to specify the ID of this structure. The ID will be used in the main config file as a reference to this structure. By convention, the ID should be the same as the name of the file.
file* filename.schematic - ID=ship,file=ship.schematic Used to specify the name of the file containing this structure. Must also specify the file extension, generally .schematic.
centerX, centerY, centerZ integer centerX=width / 2 centerY=0 centerZ=length / 2 ID=ship,centerX=4,
centerY=1,centerZ=2
Used to specify the default 'center point' of the structure, using the structure's coordinate system. This point will appear at exactly the world position where the structure is spawned, and all other blocks relative to it. The structure will also be rotated around centerX and centerZ.
blockMode

text (replace, overlay)

replace ID=ship,blockMode=overlay

Use to specify how the blocks in this structure should act with the blocks already in the world. Refer to the table below.

blockUpdate true/false true ID=ship,blockUpdate=false Used to specify whether the blocks in the structure should be updated once placed. If set to true, water will flow, blocks that cannot stay (such as torches in air) will be dropped and other updates will take place.
overlayStruct text ID - ID=ship,overlayStruct=ship_inner Use to specify the ID of a different structure that will be overlayed onto this structure. The other structure must also be configured in the structures file, and will generally set the 'blockMode' property to 'overlay'. This property is mainly used for .schematic structures which require a .luckystruct (containing perhaps modded blocks) overlay, and is more convenient than using groups in the main properties file to achieve the same result.

* Required

 

Block Mode


The blocks mode property is used to specify how the blocks in the structure should act with those already in the world. Below is a list of available block modes.

 

Mode Description
replace Blocks in the world are replaced by those added to form the structure. This applies for all blocks.
overlay Blocks in the world are replaced by those added form the structure, with the exception of air blocks. Air blocks in the structure will not be added to the world.
air Every block in the structure, except for air, will be added to the world as air. Therefore, the structure define a 'hole' that will be made in the world.

 

Dynamic Properties


When using the structure in the main drops file, you must set the type to 'structure'. Below are additional properties that can be used with structures, as with any other drop.

 

Property Value Type Default Value Example Description
ID* text ID - type=structure,ID=ship Used to specify the ID of the structure to spawn. The ID must match one of the structure IDs specified in the structure config file.
rotation integer 0 type=structure,ID=ship,rotation=3 Use to specify the amount of times this structure should be rotated by 90 degrees, clockwise. The structure will rotate around an axis at centerX and centerZ.
All base properties See 2.1 Base Properties See 2.1 Base Properties See 2.1 Base Properties See 2.1 Base Properties

* Required

 

Structure Coordinates


Within structures, each block is assigned a coordinate. These coordinates are later used to specify the center point property of the structure. Firstly, every structure should be built facing the north direction. If the structure's rotation is relative to the player's direction, it should be built in the way it will appear when the player is facing north. While this is not compulsory, it is a convention that will make structures much more consistent and easier to manage. The coordinate point (0, 0, 0) in the structure will appear in the east-most north-most (X=0 and Z=0) corner of the structure, on the bottom-most layer (Y=0). Increasing the X value will move the coordinate point east. Increasing the Y value will move the coordinate point upwards. Increasing the Z value will move the coordinate point south. Note that north is toward negative Z, and therefore increasing the Z value moves the point south rather than north.

 

Note that both entities in the structure also use this system, though entities store the coordinates as floats. Therefore, for an entity to be placed in the center of a block, its x and z coordinates need to be increased by 0.5 (as whole numbers mark the top-left corners of blocks). This will usually all be handled by the program used the export the schematic, however it is important to know the block coordinates in order to specify the center point.

 

Center Point


The center point is used to specify where the structure should be placed in the world, relative to the position at which the structure is spawned. More specifically, the coordinate of the center point will appear at the exact location where the structure is spawned, and all other blocks in the structure will appear relative to this location. By default, the center point is located in the middle of the structures base (centerX=width / 2, centerY=0, centerZ=length / 2). Therefore, if a castle with a square base were spawned at world coordinates (100, 64, 100), the castle's floor would be at layer 64, and the middle of the castle would be at X=100 and Z=100.

 

As another example, imagine a container ship structure with a width of 100, height of 50 and width of 50, and the ship appears to be traveling in the north direction. Assume that when player harvests a Lucky Block, we want the ship to spawn around the player, placing the player in the ship. Firstly, we want the have the player in the middle of the ships width, so we set centerX to 50 / 2 (25). Therefore, if the player looks north, the ships wall will appear to the player's left and right. Next we want a small proportion of the ship to be below the player, as a ship's bottom is generally submerged. We set centerY to 5, making 5 of the layers (layers 0-4) below the player's position. Finally, we want the player closer to the back of the ship, so we set centerZ to 75.

 

structures/structures.txt

file=ship.shematic,ID=ship,centerX=25,centerY=5,centerZ=75

drops.txt

type=structure,ID=ship,pos=#pPos

You should also note how changing the centerX, centerY and centerZ values affects the position of the structure. When facing north, increasing centerX will move the structure west and decreasing will move it east. Increasing centerY will move the structure down and decreasing will move it up. Increasing centerZ will move the structure north and decreasing will move it south. Note that both centerX and centerY seam inverted, but centerZ doesn't. This is because, as mentioned in structure coordinates, a structure facing north faces -Z. While this may seem somewhat counter intuitive, it makes far more sense to think of the the centerX, centerY and centerZ as a center point within the structure.

 

Finally, the center point does not have to be within the structures coordinates, it can be any value, including negative values. Regardless of what it is, the structure will always spawn relative to it.

 

Rotation


The rotation of a structure is specified in the main properties file, and is used to rotate the structure by 90 degrees in a clockwise direction a certain number of times. Negative values are also allowed, rotating the structure counter clockwise. The Lucky Block rotation system will rotate all blocks with special rotation states (such as chests, torches, rails and many other blocks), and will rotate all tile entities and entities. Structures will be rotated around their centerX and centerZ coordinates. To visualize this, imagine spawning the structure on a rotating table, where centerX and centerZ are at the center of the table. Then rotate this table 90 degrees clockwise each rotation (unless the rotation is negative, in which case counter clockwise). This will obtain the final position of the structure.

 

As an example, refer to the previous ship example in center point. The player will be looking in the direction of the ship (i.e. looking down the long ship all the way to the front) only if the player is facing north. If the player is facing east or west, the player will see the side walls of the ship, or at south will see the back. To make the player always see the front of the ship, simple add the rotation property to the structure in the main config file:

type=structure,ID=ship,pos=#pPos,rotation=#pDirect

Refer to 3.2 Hash Variables for more information regarding #pDirect. It will simply make the structure face in the direction that the player is facing.

As another example, assume we wanted to make the ship appear in directly front of the player, facing at the player. This would make the ship look like it is about to swim into the player. The conventional way of achieving this requires the ship to be swimming south, as it will be swimming south when spawned with the player facing north. Therefore, the structure first needs to be modified, preferably with a third-party Minecraft editing program. Once this is done, the structure's center point needs to be configured. Firstly, centerZ needs to be changed so that the front of the ship is to the north of the rotating table's center.

file=ship.shematic,ID=ship,centerX=25,centerY=5,centerZ=105

By setting centerZ to 105 (i.e. to south of the ship's front), the whole ship is now 5 blocks north of the center point. If it were spawned like this, the ship's nose would appear just in front of the player (if the player is facing north). To make the ship always spawn like this, for whichever direction the player is facing, the rotation needs to be set to the player's direction.

type=structure,ID=ship,pos=#pPos,rotation=#pDirect-2

 

Hash Variables


Lucky structures allow for custom hash variables to be used. These include #sPos and #drop, and allow for the coordinates and properties with which the structure is spawned to be obtained. For information on these, refer to 3.2 Hash Variables.

Back Forward

Copyright Minecraft Ascending 2015