Skip to content

Basic Script Commands

Chris edited this page Mar 13, 2022 · 96 revisions

BiomeTweaker's script environment is meant to emulate a highly-restricted object oriented language. To begin writing a script, we will want to first define an object.

Defining an Object

The equals ('=') operator is used to define objects. The name of the object goes to the left of the equals sign, and whatever it is being assigned to goes on the right. e.g.

myObject = forAllBiomes()

There are several possible assignments, outlined below. Each assignment may or may not take a certain number arguments to determine what exactly it is assigning. Note that when the object requires ids, you can either give integers such as 1, 2, 3, ...; you can specify a range of integer such as 5-10; or you can specify another biome object to merge.

forBiomes

forBiomes does what you might expect it to do. This assignment requires at least one positive integer argument, but may take as many as you want. These arguments are the resource locations or IDs for the biomes you want the object to represent. Take, for example, the following assignment

myBiomes = forBiomes("minecraft:ocean", 20, 26, 156)

This assignment tells the object myBiomes that it is representing four biomes. In a Vanilla environment, these IDs correspond to Ocean, Extreme Hills Edge, Cold Beach, and Birch Hills Forest M, respectively. Now, whenever you refer to the object myBiomes, BiomeTweaker will know you are really referring to those biomes. We could also do something like the following:

otherBiomes = (myBiomes, 20-25)

This takes all of the ids from the myBiomes object, and any id in the range 20-25 (inclusive) as it's biomes.

forAllBiomes

Again, forAllBiomes does what you might expect. This assignment takes no arguments, and simply indicates that the object should represent all registered biomes. This is useful for applying universal tweaks. See the first example given.

forBiomesOfTypes

This one represents biomes from entries in the BiomeDictionary. You can find the possible entries in the description for the removeDicType command. You'll have to look in the output files to see a biome's dictionary types. Here is an example:

sandyWarmBiomes = forBiomesOfTypes("SANDY", "WARM")

forAllBiomesExcept

This allows you to specify a blacklist of ids to not tweak, but tweak everything else. For instance:

everythingButTaiga = forAllBiomesExcept("minecraft:taiga")

You can specify any amount of ids here.

forBiomesWithPropertyRange

This allows you to specify biomes that fall within a certain range. It takes three arguments: the property, the minimum value, and the maximum value. The valid properties are given under the set command, and must be integer properties.

Example:

coldBiomes = forBiomesWithPropertyRange("temperature", 0, 0.2)

intersectionOf

This object can be used if you only wish do to changes to biomes that are common between objects. It takes any number of arguments, all of which must either be an id, id range, or another biome object.

Example:

intersect = intersectionOf(myNewBiomes, sandyWarmBiomes)

subtractFrom

This object is used to subtract biome objects from other objects. I'll leave it up to you to decide why you would want this.

  • The first argument is the object to be subtracted from.

  • All subsequent objects will be subtracted from the first argument. Any IDs that appear in these objects but not in the first object will be ignored.

Example:

subtract = subtractFrom(everythingButTaiga, myNewBiomes)

Tweaker

There also exists a 'static' object called Tweaker. This can always be used and does not need to be defined. Any commands that work on a biome object work with the Tweaker object, with the specification that you must specify the biome ID in each command. Example:

Tweaker.set("minecraft:extreme_hills", "liquidFillerBlock", "minecraft"lava")

Now that we've defined our object, let's actually do some stuff with it.

Custom Decorations

BiomeTweaker allows you to create custom decorations for your biomes. See the page on custom decorations for more information.

Example:

myDecoration = newOreDecoration()

Blocks

When you need to use blocks in scripts, you have two options. If you don't need to specify any properties, you can simply give the resource name of the block, such as "minecraft:grass". If you need to specify properties, you must use a custom block object. See the page on custom blocks for more information.

Example:

myBlock = forBlock("minecraft:stone")
myBlock.setProperty("variant", "andesite")
allBiomes.addActualFillerBlock(myBlock)
allBiomes.addActualFillerBlock("minecraft:grass")

Operating on Objects

In general, the period operator ('.') is used to operate on an object. Basically, this tells the object to do something. Here's an example:

myBiomes.set("temperature", 0)

This is telling the myBiomes object (which should have been defined earlier) to set the temperature field to 0.

createBiome

This command is used to create new biomes. This must be called before any other command if you are using biome ids that do not already exist. You must use the "BIOME_REGISTRY" script stage for anything involving new biomes in 1.12. It takes 1-2 arguments. First, a string. This specifies the biome resource location. You can put anything you want here, but it should be informative of what the biome is. For example, "plains". Second, you can optionally specify a biome to copy. This will attempt to copy all properties and the class from the existing biome to the new biome. The biome will then be created with the resource location "biometweaker:", where "" is the first argument you passed to the command.

Example

Tweaker.createBiome("crimson_plains", "minecraft:plains")

remove

The remove commands removes the biomes from world generation. It takes no arguments. See the FAQ page for more information on the details of this.

Example:

myBiomes.remove()

addToGeneration

This command can be used to add a biome to generation. Some biomes (oceans, edge, mutated, desert, etc...) are hardcoded, and so their generation weights can not be configured. This can also be used to add biomes you have created to other generation types. This command takes two arguments. First, a string representing the type. See the create command for the possible values. Second, an integer for the generation weight. Usual weights are around 10.

Example

taigaBiomes.addToGeneration("WARM", 10)

addDecoration

Use this command to add your custom decoration to a biome. See the page on custom decorations for more information.

Example:

myBiome.addDecoration(myDecoration)

addFlower & removeFlower

Currently, these are essentially useless. These commands allow you to add blocks to Forge's flower collection for a biome, which isn't ever used by anything. The addFlower command takes two arguments, a block and a non-negative integer for the flower's weight. The removeFlower commands does not take the weight argument. Example:

myBiomes.addFlower("minecraft:yellow_flower", 10)
myBiomes.removeFlower("minecraft:yellow_flower", 0)

set

This is by far the most useful command, allowing you to tweak nearly every setting of a biome. This command takes two arguments. The first argument is a String to determine what value is set, and the second is what to set that value to. The type for the second argument depends on the first argument. Possible first argument are given below.

  • "name" - This will set the name of biome, usually displayed in the f3 debug display. The second argument must be a String.

  • "height" - This determines the base height for the biomes land generation. This is multiplied by 32 and added to 64. However, this is fairly loose. The actual height experienced may vary. It takes a float argument, can be negative. The second argument is a float. See this issue for more info.

  • "heightVariation" - This determines how far the land generation will stray from the root height on average. Seems to be multiplied by 32 when generating, but more extreme values have been experienced. The second argument is a float. See this issue for more info.

  • "topBlock" - Used to set the block that appears on top of a biome. By default, this is usually dirt, or "minecraft:grass". The argument is a block.

  • "fillerBlock" - Like topBlock, but used to set the filler block for a biome. Usually "minecraft:dirt". Note that this does not determine what block will appear below the surface. It only effects about 3-4 layers below the surface. Use registerGenBlockRep for the rest of the way to bedrock.

  • "oceanTopBlock" - Used to set the block that appears on the ocean floor. By default, this is usually gravel, or "minecraft:gravel". The argument a block. Disabled by default. Requires BiomeTweakerCore.

  • "oceanFillerBlock" - Like oceanTopBlock, but used to set the filler block, directly under the top block. Usually "minecraft:stone". Note that this does not determine what block will appear below the surface. It only effects about 3-4 layers below the surface. Use registerGenBlockRep for the rest of the way to bedrock. Disabled by default. Requires BiomeTweakerCore.

  • "temperature" - Sets the temperature for the biome. This is used in determining whether it snows or rains, and factors into the foliage color. Second argument is a float. Values around 0 (-0.2 to 0.2) will cause snow if snow is enabled. Hot biomes are around 1.

  • "humidity" - I'm not entirely certain what this does, haven't tested enough, although it seems to factor into a biome's foliage color along with temperature. Second argument is float.

  • "grassColor" - Sets the color of grass and tall grass. It takes an integer value that represents a standard RGB hex value. Disabled by default. Requires BiomeTweakerCore.

  • "foliageColor" - Sets the color of trees and vines. It takes an integer value that represents a standard RGB hex value. Disabled by default. Requires BiomeTweakerCore.

  • "waterColor" - Added to the water color as a "tint". It takes an integer value that represents a standard RGB hex value. May not work in some biomes. Requires BiomeTweakerCore to work in all biomes.

  • "enableRain" - Determines if it rains in a biome. Second argument is a boolean (true or false, no quotes).

  • "enableSnow" - Like enableRain, but determines if it snows instead of rains if the temperature if cold enough. Only meaningful if enableRain is true.

  • "xxxPerChunk" - This is used to set the generation density of features. The "xxx" means that there are multiple value that can be used. You can find the valid values (without underscores) here. The second argument must be a non-negative integer. Default for trees is usually around 10, others are usually 1-4. Most features generate in "patches", trees only generate one at a time. That is, setting flowers to 3 will generate 3 "patches" of flowers, while setting trees to 3 will generate 3 trees. You must set the application stage to "INIT" or earlier for this to have any effect.

  • "genWeight" - Used to change the generation weight of biomes. The second argument must be a non-negative integer. Standard value for vanilla biomes is 10. Some thing like 1000 will cause the world to be almost entirely that biome.

  • "genVillages" - Used to set if villages can appear in biomes. The second parameter must be a boolean (true/false)

  • "genStrongholds" - Used to set of strongholds can appear in biomes. The second parameter must be a boolean (true/false)

  • "isSpawnBiome" - Used to set if biomes can be a valid spawn point for players. Second argument must be a boolean.

  • "genTallPlants" - If set to false, plants such as sunflowers and double tall grass won't generate. This is a global tweak, affecting all biomes.

  • "skyColor" - Sets the color of the sky (not the horizon, see fogColor for that). Takes an integer representation of an RGB hex value. Disabled by default. Requires BiomeTweakerCore.

  • "genScatteredFeatures" - Sets if scattered features should generate. Scattered features are biome-specific structures such as swamp huts, jungle temples, and desert temples. Set to false to disable generation.

  • "fogColor" - Sets the fog (or horizon) color. Takes an integer representation of an RGB hex value. Disabled by default. Requires BiomeTweakerCore.

  • "genInitialSnow" - Sets if the initial snow generator should run. Even if snow is disabled, snow will initially be placed in very cold biomes. Set to false to disable that. Disabled by default. Requires BiomeTweakerCore.

  • contiguousReplacement - If true, any replacements with the contiguous property set to true will carry over for the entire swath of biome. Use this if you have multiple weighted replacements that you want to be contiguous in large swaths.

Example:

myBiomes.set("topBlock", "minecraft:netherrack")

inheritProperties

This command allows you to copy properties from one biome to another. You can specify any amount of properties to inherit, and giving none will cause all properties to be inherited. A list of properties is given under the set command.

Example:

crimsonPlains.inheritProperties("minecraft:hell", "temperature", "humidity")

addSpawn

This commands is used to add Entity spawns to a biome. It takes five arguments. First, a String representing the name of the Entity. An example of this "net.minecraft.entity.monster.EntityPigZombie" or "minecraft:bat. The second argument is the type of spawn this should be registered as. there are four possible values for this: "CREATURE", "MONSTER", "AMBIENT", "WATER_CREATURE". They are pretty self-explanatory. The last three arguments are non-negative integers. First, the weight of the spawn. This determines how often the entity will spawn. Second, the minimum group count. This determines the minimum size of spawn groups. Third, the maximum group count.

Example:

taigaBiome.addSpawn("net.minecraft.entity.monster.EntityPigZombie", "MONSTER", 100, 4, 4)

removeSpawn

Used to remove an entity from a biome's spawn list. It takes a String argument for the Entity class and a String argument for the type. See the addSpawn command for possible types.

Example:

hellBiome.removeSpawn("net.minecraft.entity.monster.EntityPigZombie", "MONSTER")

removeAllSpawns

This is used to remove all possible spawns of a certain type. It takes a String argument for the type.

Example:

taigaBiome.removeAllSpawns("CREATURE")

removeDecoration

This is used to remove decorations from a biome such as trees, flowers, lakes, and grass. It takes a String argument for the type. The valid values are: "BIG_SHROOM", "CACTUS", "CLAY", "DEAD_BUSH", "DESERT_WELL", "LILYPAD", "FLOWERS", "FOSSIL", "GRASS", "ICE", "LAKE_WATER", "LAKE_LAVA", "PUMPKIN", "REED", "ROCK", "SAND", "SAND_PASS2", "SHROOM", "TREE", "CUSTOM". Note that "SAND_PASS2" is actually gravel.

Example:

taigaBiome.removeDecoration("GRASS")

removeFeature

This is used to remove features from a biome, such as dungeons, lakes, and animals. It takes a string argument for the type. Valid values are: "DUNGEON", "FIRE", "GLOWSTONE", "ICE", "LAKE", "LAVA", "NETHER_LAVA", "NETHER_LAVA2", "NETHER_MAGMA", "ANIMALS", and "CUSTOM".

Example:

nether.removeFeature("NETHER_LAVA")

removeOre

This is used to remove ores from generation. It takes a string argument for the type. Valid values are: "COAL", "DIAMOND", "DIRT", "GOLD", "GRAVEL", "IRON", "LAPIS", "REDSTONE", "QUARTZ", "DIORITE", "GRANITE", "ANDESITE", "EMERALD", "SILVERFISH", "CUSTOM".

Example:

allBiomes.removeOre("IRON")

addDicTypes

Used to add a type to the BiomeDictionary for a biome. This is mainly used by other mods to keep tabs on biomes. You can specify what you want, but the default values can be found here.

Example:

taigaBiome.addDicTypes("BEACH")

removeDicTypes

Nearly identical to addDicType, but used to remove a type from the BiomeDictionary for a biome.

Example:

taigaBiome.removeDicTypes("CONIFEROUS")

registerGenBlockRep

A very powerful command that allows you to register replacements for any block present after early generation. With vanilla generation, the only blocks present are stone and water (lava in the nether, endstone in the end). This takes two required arguments and one optional arguments. First, optionally, a weight. If there are multiple replacements registered for the same block, you can specify a selection weight here. If none is specified, it will default to 1. Second, the block that should be replaced. Third, the block to replace with. See the page on block replacement for more advanced uses of this command.

Example

andesite = forBlock("minecraft:stone")
andesite.setProperty("variant", "andesite")
taigaBiome.registerGenBlockRep("minecraft:stone", andesite)
taigaBiome.registerGenBlockRep(4, "minecraft:stone", "minecraft:sandstone")

registerGenVillageBlockRep

Similar to registerGenBlockRep, but replaces village blocks. Uses the same syntax.

registerGenBiomeRep

Another very powerful command that lets you replace biomes. This is mainly useful for removing those pesky hard-coded biomes. It takes only one argument, the biome to replace with.

Example

taigaBioma.registerGenBiomeRep(2)

addActualFillerBlock

This command replaces the previous actualFillerBlock option in the set command. This is set to indicate what blocks should be considered as the filler, rather than just vanilla stone. Since you can now have several weighted options to replace one block, there may be more than one actual filler block. This command simply a block. Disabled by default. Requires BiomeTweakerCore.

Example

taigaBiome.addActualFillerBlock("minecraft:sandstone")

setAverageBiomeSize

This command only works with the Tweaker object. This command will set the average size of biomes, measured in chunk radius. Takes up to two arguments. First, optionally a String for the WorldType that should be affected. Vanilla options are "default", "flat", "largeBiomes", "amplified", and "default_1_1". Note that mods such as Biomes O' Plenty add their own WorldTypes that you can use as well. If no WorldType is specified, the size will be used for all types. Second, a positive byte for the radius (1-127). By default, this is 4 for "default" and 6 for "largeBiomes".

Example:

Tweaker.setAverageBiomeSize("largeBiomes", 20)

setStage or setScriptStage

This command only works with the Tweaker object. Used to tell BiomeTweaker what stage of the FML lifecycle to apply tweaks. Any script lines appearing after this one and before the next setStage will be applied on the specified stage. This resets to "FINISHED_LOAD" for every script file. Takes a String argument. Valid stages are given here.

Example:

Tweaker.setScriptStage("PRE_INIT")

setPlacementStage

This command only works with the Tweaker object. This is a very powerful command that lets you control when block replacement and decoration placement is done. Any script lines appearing after this one and before the next setPlacementStage will apply during the specified stage. Valid stages can be found here. The order in which they occur is.

BIOME_BLOCKS -> PRE_POPULATE -> PRE_DECORATE -> PRE_ORES -> POST_ORES -> POST_DECORATE -> POST_POPULATE

See the page on block replacement for more information of the block placement cycle. This resets to "BIOME_BLOCKS" for every script file.

Please note that any stage after "BIOME_BLOCKS" will cause a noticeable amount of lag if you're doing heavy block replacement. Try to keep the heavy duty stuff to "BIOME_BLOCKS" and only finesse in later stages if absolutely necessary.

Example:

Tweaker.setPlacementStage("POST_ORES")

setWorld

This command only works with the Tweaker object. This is a very powerful command that lets you control what world block replacement and decoration placement is done in. Any script lines appearing after this one and before the next setWorld will be done in the specified world. You can specify any integer here as the dimension number. In vanilla, 0 is the overwold, -1 is the nether, and 1 is the end. By default, there is no world selected, so tweaks are applied to all worlds. This resets to all worlds for every script file, or you can reset it yourself by passing no arguments to the command.

Example:

Tweaker.setWorld(-1)

Biomes O' Plenty (BOP) Integration

BiomeTweaker offers several modified commands to allow tweaking biomes while using the Biomes O' Plenty world type. There are also a few commands to allow some BOP biomes to generate properly in a non-BOP world.

removeExcludedBOPWorldType

This command only works with the Tweaker object. All you need to know is this will cause the BOP decorator to run on world types other than BOP's. Use this if you plan to add BOP biomes to a non-BOP world (not recommended). Takes a String argument. A list of world types can be found here: http://minecraft.gamepedia.com/World_type

Example:

Tweaker.removeExcludedBOPWorldType("default")

addExcludedBOPWorldType

This command only works with the Tweaker object. Nearly the same as removeExcludedBOPWorldType, except it will cause BOP's decorator to not run on the given world type.

Example:

Tweaker.addExcludedBOPWorldType("BIOMESOP")

addToGenerationBOP

This command is identical to addToGeneration, except it adds the biome to BOP's generation system. This will cause the biome to appear in the BOP world type. A list of BOP climate types can be found here.

Example

taigaBiomes.addToGenerationBOP("TROPICAL", 10)

removeBOP

This command is identical to remove, except it removes the biome from BOP's generation system. You cna also specify climate types to have the biome only removed from those climates. This will cause the biome to no longer appear in the BOP world type.

Example:

myBiomes.removeBOP()
otherBiomes.removeBOP("COLD")

addSubBiomeBOP

This command will register a biome as a subbiome of another BOP biome. If you don't know what that means, look it up in the BOP documentation. Takes biomes as the argument.

Example

myBiomes.addSubBiomeBOP(35)

removeSubBiomeBOP

Identical to addSubBiomeBOP but unregisters a biome as a subbiome. Does nothing if it is not a subbiome. Takes biomes as the argument.

Example

myBiomes.removeSubBiomeBOP(35)

removeGeneratorBOP

This command is identical to removeFeature, except it removes the generator from BOP's decoration generation system. This will cause the generator to no longer appear in the BOP world type for this biome. Generator names can be found in the output files.

Example:

nether.removeGeneratorBOP("trees")