Tutorial: Spawning Custom Object

Note: This tutorial was written for OTG 1.12.2. Though basic settings and principles remain the same for 1.16.x, tooling and commands have changed.

## **Basic Tutorial Introduction**

Structures represent objects from trees and rocks to villages and dungeons. They are all hand made in minecraft and turned into schematics to be spawned in the world by specific biome configurations. All objects have dependent rules of how they should spawn in the world such as trees can only spawn on grass or dungeons only underground. These rules also ensure objects do not appear too often or not often enough, stop objects crashing into other objects.

This tutorial will guide you through creating a simple object, capturing and exporting for editing. As well as explain how to spawn the object in the world. There a some tools you need which are discussed below. The tutorial ends with an advanced guide on custom objects and structures.

## **Creating and Exporting an Object**

### **Required Tools**

* FAWE (Spigot)/ FAWE (Forge)- For exporting schematics and provides useful build commands and brushes.
* OTGE- For converting schematics into Bo3s.

### **Using FAWE**

The following tutorial will give a simple guide on exporting schematics only, however FAWE (and FAVS) are capable of so much more. For more instruction on using these building tools, check out the FAWE Wiki.For the purposes of exporting a simple object (<32x32) the only commands needed are described below.

### **Exporting your object to a Schematic file**

A Bo3 can be any object no bigger than 2x2 chunks in size. A simple example object to begin spawning in the world is a tree with a one block wide trunk like this.

On a flat world, build a simple tree.

**note**

You will need a wooden axe. WorldEdit changes the wooden axe to working as a selection wand.

Put down a placeholder block in the furthest corner of the bottom of the object, and one diagonally in the upper most corner of the object.

To select an object, choose the first postion by left clicking, with a wooden axe, the first corner and then right clicking the other corner block.

* Left click = Position 1
* Right click = Postion 2

This creates a bounded selection around the object.

**note**

A mod is used to visualize the bounding box, Spigot and Forge

**Selecting the object method 2:**

* You can also select an area by typing a command when stood in the location of where you want the corners of the object to be

* By standing in the corner of the object you can type /pos1 and /pos2

* This will then assign the coordinates to the position of where you are stood

You will notice the base block of the tree is a diamond block. This is a placeholder block that will be used to centre align the object when converting the schematic into a Bo3.

The tree centre is the block that will be placed at ground level, as this is the lowest log of the tree trunk, this is the block used for the centre placeholder.

A placeholder can be any solid block.

To export the now selected object, ensure you have removed the corner blocks (i.e. the orange wool in the image) and simply use the commands:

* //copy
* //schematic save [name]

The schematic will now be exported and save in the directory: Server\plugins\WorldEdit\schematics\[UUID]\

Schematics are exported into player specified folders, the plugin will create this. Useful if multiple players are exporting objects on the same server. Schematics are exported server side only.

**note**

A gridworld preset can be downloaded here. This is useful if you are deciding to create multiple structures.

## **Converting and Editing Bo3 Objects**

### **Converting**

OTGE is required to convert schematics into Bo3s. A Bo3 is an editable object config file that the terrain generator places in the world.

It can be used to create biomes and convert objects. The following will focus only on converting objects.

1: Select "Convert .schematic to Bo3 on OTGEdit (shown above)

This will open windows explorer. Locate your schematic and select it.

2: You will be asked to choose a location to save your Bo3 object.

3: Choose the type of object it will be, for the tree it will be CustomObject as it is <32x32 in size

4: Choose to remove air or keep it. For a tree we don't want it to have a cube of air around the object, so select remove air.

5: Choose the centre block by typing the ID of the placeholder used. i.e. the diamond block.

For a list of block IDs go here.

6: The following message will confirm the object was converted successfully and has been saved in the file location you specified.

### **Editing**

Locate the Bo3 and open it with a notepad editor. It is highly reccommend you use NotePad++.

Config explaination can be found here.

The following steps will guide placing the new tree in the world.

Change the default settings to the following numbers in the Bo3 Config. Use the find function to locate each setting.

* **Tree: true** - This needs to be set to true to spawn the object in the Tree and Sapling resources.
* **Frequency**: **5** - The frequency of the BO3 from 1 to 200. Tries this many times to spawn this BO3 when using the CustomObject(...) resource. Ignored by Tree(..), Sapling(..) and CustomStructure(..)
* **Rarity: 50.0** - The rarity of the BO3 from 0 to 100. Each spawn attempt has rarity% chance to succeed when using the CustomObject(...) resource. Ignored by Tree(..), Sapling(..) and CustomStructure(..)
* **RotateRandomly: true** - If you set this to true, the BO3 will be placed with a random rotation.
* **SpawnHeight: highestSolidBlock** - The spawn height of the BO3 - randomY, highestBlock or highestSolidBlock. This needs to be highestSolidBlock to ensure it doesn't spawn on water.
* **MinHeight: 62** - The minimum height limit for the BO3.
* **MaxHeight: 256** - The maximum height limit for the BO3.
* **MaxPercentageOutsideSourceBlock: 0** - The maximum percentage of the BO3 that can be outside the SourceBlock. The BO3 won't be placed on a location with more blocks outside the SourceBlock than this percentage.
* **SourceBlocks: AIR** - The block(s) the BO3 should spawn in.

**note**

Changing the percentage of MaxPercentageOutsideSourceBlock means the tree can only spawn in air and will not crash with land or other objects.

Open Terrain Generator will clean up the BO3 file if the SettingsMode isn't WriteDisable. It will add missing settings, reset the comments and removes everything it doesn't understand.

#### **Removing placeholder block**

The diamond block is still in the structure, which we need to locate and replace it to the block it should be. Simply locate the block with the find function and replace the ID with the ID you want it to be. In this instance:

**Block(0,0,0,57)**

Becomes

**Block(0,0,0,161)**

#### **Adding a Block Check**

If we want to specify the blocks the tree has permission to spawn on, we can add a block check. To do this add the following line to the end of the Bo3 Config.

**BlockCheck(0,-1,0,Grass,Dirt)**

This will mean the tree will only spawn on top of Grass and Dirt blocks.

## **Spawning & Biome Config Resource Queue**

### **Spawning**

Placing the BO3 in your world consists of two steps.

### **Placing the BO3s in your WorldObjects Folder**

We will use the Biome Bundle folder structure as an example of where to place the new tree and how to spawn it in the world.

Locate the directory where the Bo3 needs to be stored:

**\minecraft\mods\OpenTerrainGenerator\worlds\Biome Bundle\WorldObjects**

In Biome Bundle trees are stored in their own folder structure:

\**minecraft\mods\OpenTerrainGenerator\worlds\Biome Bundle\WorldObjects\Trees\Acacia**

Folder structures for storing Bo3s can be managed how you wish, as long they are placed in the **WorldObjects** folder.

### **Biome Config Resource Queue**

After all the objects are placed in one of the folders you can add them to your world. Locate the Biome you wish to add the trees to such as:

**minecraft\mods\OpenTerrainGenerator\worlds\Biome Bundle\WorldBiomes\Savanna.bc**

Find the resource queue, and add the tree to the list. You can use the following resources:

**CustomObject(AcaciaTree1,AcaciaTree2)**

or

**Tree(1,AcaciaTree1,10,AcaciaTree2,10)**

Trees should, just like the vanilla trees, use Tree. BO3 objects that have their Tree settings set to false won't be able to use this structure.

**note**
The resource queue spawns the resources in the order they are listed

### **Finding the Object**

The world can now be launched, and you can locate the tree by finding the biome you are spawning it in by using the biome locate command:

**/otg tp [biome name]**

eg.

**/otg tp Savanna**