Tutorial: Spawning custom objects - PG85/OpenTerrainGenerator GitHub Wiki

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

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.

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 position by left clicking, with a wooden axe, the first corner and then right clicking the other corner block.

  • Left click = Position 1
  • Right click = Position 2 This creates a bounded selection around the object.

At the base of your tree, place a diamond block. This block is a placeholder that will be used to center-align the object when converting the schematic into a BO3. A placeholder can be any solid block.

To export the now-selected object, ensure you have removed the corner blocks and simply use the commands:

  • //copy
  • //schematic save [name]

The schematic will be exported and saved in /plugins/WorldEdit/schematics/[PlayerUUID]/.

Converting and editing BO3 objects

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.
  2. Locate your schematic using Windows Explorer and select it.
  3. Choose a location to save your BO3 object.
  4. Choose a type of object (usually CustomObject).
  5. Choose to keep or remove air (usually remove).
  6. Choose the center block by typing the ID of the placeholder used, such as the diamond block mentioned above.
  7. Confirm that the object was converted successfully and saved in the location specified.

Editing

Locate the Bo3 and open it with a text editor. We recommend Visual Studio Code.

Config explanation 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.

  • 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.
    • Changing the percentage of MaxPercentageOutsideSourceBlock means the tree can only spawn in air and will not crash with land or other objects.
  • SourceBlocks: AIR
    • The block(s) the BO3 should spawn in.

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 the placeholder block

The diamond block used to demarcate the center must be removed or replaced in the finished BO3. Use the find function on your editor to identify and replace it. If using a diamond block in 1.12.2, for example:

Block(0,0,0,57)

Can be edited to:

Block(0,0,0,0)

This replaces the diamond block with air.

Adding a block check

Adding the following line to the end of the BO3 config will require that a grass or dirt exist in a specific location relative to the placement of the BO3 in order for the BO3 to spawn:

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

BlockChecks can be used in any location and with any block.

Spawning & biomeconfig resource queue

Spawning the BO3 in your world requires two steps:

Placing the BO3s in your WorldObjects folder

Locate the Directory where the BO3 needs to be stored. Using Biome Bundle on Forge, this would be:

/mods/OpenTerrainGenerator/worlds/Biome Bundle/WorldObjects/

In Biome Bundle, trees are stored in their own folders:

/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:

/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.

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]