v0.13:CraftTweaker

From Mystcraft
Revision as of 18:09, 26 November 2018 by Floydman (talk | contribs) (Corrected more errors and clarified a bit.)

Jump to: navigation, search

CraftTweaker is a mod that allows certain aspects of specific mods to be edited through the use of scripts. Mystcraft includes CraftTweaker integration for the creation of custom Pages, but there are also other uses. CraftTweaker scripts are files with a ".zs" extension that are placed in the "scripts" folder of a Minecraft instance. The same file must also be present on a server if playing online. The scripts are only loaded during startup, so Minecraft must be restarted to see changes made to a script.

Custom Block Pages

Mystcraft supports adding new block Pages through CraftTweaker. There are several blocks, even in vanilla Minecraft, that do not have corresponding Pages by default. A short script will allow you to add support for as many of these blocks as you would like. Mod blocks are also supported.

Start by importing a couple of Mystcraft classes:

import mods.mystcraft.CTAgeSymbol;
import mods.mystcraft.symbol.CTBlockSymbol;


Call the createBlockSymbol method using a unique variable name:

static newBlockSymbol as CTBlockSymbol = CTAgeSymbol.createBlockSymbol("Word", <BlockState>, CRank);


Then repeat this code block for as many categories as you would like your block to belong to:

newBlockSymbol.addCategory("mystcraft", "BlockType", GRank);


Finally, use this register method just once:

newBlockSymbol.register();


There are several variables here that need to be replaced:

  1. CRank and GRank are small integers: the card (loot) rank and grammar (random expansion) ranks. 3 is "typically once an age", for things like standard world or normal sun. Really imbalancing things should be 5 or 6. CRank affects how often this Page is found in loot like village and dungeon chests. GRank affects how often Mystcraft uses this Page to satisfy grammar you don't specify.
  2. Word can be any string. An appropriate symbol will be generated if it is not a known Narayani word. In that case, the last two symbols on the Page will look unique, but the mod mystcraft-info will give them the same translation. (For a complete list of canonical Narayani words, see http://isomerica.net/~mlah/narayan/symbols.html.)
  3. BlockState can be any BlockState. Remember to use the appropriate Mod ID for the mod that adds the block.
  4. BlockType can be any block category that Mystcraft currently supports. Your options are:
    • BlockAny
    • BlockSolid
    • BlockFluid
    • BlockGas
    • BlockTerrain
    • BlockStructure
    • BlockOrganic
    • BlockCrystal
    • BlockSea

For example, this script would add one Page for podzol blocks and another for diamond blocks:

import mods.mystcraft.CTAgeSymbol;
import mods.mystcraft.symbol.CTBlockSymbol;

static symbolPodzol as CTBlockSymbol = CTAgeSymbol.createBlockSymbol("Cycle", <blockstate:minecraft:dirt:variant=podzol>, 3);
symbolPodzol.addCategory("mystcraft", "BlockSolid", 6);
symbolPodzol.addCategory("mystcraft", "BlockStructure", 6);
symbolPodzol.addCategory("mystcraft", "BlockTerrain", 5);
symbolPodzol.register();

static symbolDiamondBlock as CTBlockSymbol = CTAgeSymbol.createBlockSymbol("Power", <blockstate:minecraft:diamond_block>, 3);
symbolDiamondBlock.addCategory("mystcraft", "BlockSolid", 7);
symbolDiamondBlock.addCategory("mystcraft", "BlockTerrain", 6);
symbolDiamondBlock.register();


Bottling Machine (Immersive Engineering)

Immersive Engineering includes a Bottling Machine that can bottle liquids automatically so long as fluid is inputted to the machine. To add support for bottling Black Ink into Ink Vials, use this script:

import mods.immersiveengineering.BottlingMachine;

BottlingMachine.addRecipe(<mystcraft:vial>, <minecraft:glass_bottle>, <liquid:myst.ink.black> * 250);


The "250" will yield four Ink Vials for every 1000mb of Black Ink (or four Ink Vials for every Black Ink Block). It may be changed to any positive integer for different yields.