Home Getting Started With Scripts Using this wiki Commands CTGUI Global functions Bracket Handlers

ZenStager

This class is the main handler for creating new Stages, which then you can build to tell the game to start staging what you’ve staged. It comes pre-loaded with methods to allow easy integration with other mods using the GameStages API along with some custom tweaks to make modpack makers lives that little bit easier.

You can find more information and the latest source for the class here.

Importing the package

ZenStager : import mods.zenstages.ZenStager;

Stage (Recommended to import also) : import mods.zenstages.Stage;

Methods

Create Stage

Create and returns new Stage

script.zs
// mods.zenstages.ZenStager.initStage(string stageName);
var TestStage = ZenStager.initStage("test");

When you have created your Stage you should then create a static/global file which contains the following so you can then access the Stage on other scripts/classes.

Note: Do not have the initStage and the static creation in the same script. Due to limitations and other issues, the initStage will be called each time you reference a static member. So keep the init and the static creation separate

script.zs
import mods.zenstages.ZenStager;
static TestStage = ZenStager.getStage("test"); // The name being the one you just created.

Helper Methods

Get a Stage (Returns null if not found)

script.zs
// mods.zenstages.ZenStager.getStage(string stageName);
var TestStageGet = ZenStager.getStage("test");

Get a map of the Stages which are created.

script.zs
// mods.zenstages.ZenStager.getStageMap();
var StageMap as Stage[string] = ZenStager.getStageMap();

Get a map of the staged liquids.

script.zs
// mods.zenstages.ZenStager.getStagedLiquids();
var LiquidMap as ILiquidStack[][string] = ZenStager.getStagedLiquids();

Staging Methods

Add a package name. This requires RecipeStages to be installed. This follows the same logic as here.

script.zs
// mods.zenstages.ZenStager.addPackage(string packageName, Stage[] stages);
ZenStager.addPackage("appeng", [TestStage]);

Add a package name. This requires RecipeStages to be installed. This follows the same logic as here.

script.zs
// mods.zenstages.ZenStager.addContainer(string packageName, Stage[] stages);
ZenStager.addContainer("my.awesome.container", [TestStage]);

Get the ingredient stage, if staged it will return the Stage or null if not found.

script.zs
// mods.zenstages.ZenStager.getIngredientStage(IIngredient ingredient);
var StickStage as Stage = ZenStager.getIngredientStage(<minecraft:stick>);

Get the liquid stack stage, if staged it will return the Stage or null if not found.

script.zs
// mods.zenstages.ZenStager.getLiquidStage(ILiquidStack liquidStack);
var StickStage as Stage = ZenStager.getLiquidStage(<liquid:water>);

Get the recipe name stage, if staged it will return the Stage or null if not found. Requires RecipeStages to be installed.

script.zs
// mods.zenstages.ZenStager.getRecipeNameStage(string recipeName);
var RecipeNameStage as Stage = ZenStager.getRecipeNameStage("minecraft:boat");

Get the container stage, if staged it will return the Stage or null if not found. Requires RecipeStages to be installed.

script.zs
// mods.zenstages.ZenStager.getContainerStages(string containerName);
var ContainerStage as Stage = ZenStager.getContainerStages("my.awesome.container");

Get the package stage, if staged it will return the Stage or null if not found. Requires RecipeStages to be installed.

script.zs
// mods.zenstages.ZenStager.getPackageStages(string packageName);
var PackageStage as Stage = ZenStager.getPackageStages("appeng");

Get the dimension stage, if staged it will return the Stage or null if not found. Requires DimStages to be installed.

script.zs
// mods.zenstages.ZenStager.getDimensionStage(int dimId);
var DimStage as Stage = ZenStager.getDimensionStage(-1);

Get the mob stage, if staged it will return the Stage or null if not found. Requires MobStages to be installed.

script.zs
// mods.zenstages.ZenStager.getMobStage(string mobName);
var MobStage as Stage = ZenStager.getMobStage("minecraft:skeleton");

Get the TiC Material stage, if staged it will return the Stage or null if not found. Requires TinkerStages to be installed.

script.zs
// mods.zenstages.ZenStager.getTiCMaterialStage(string material);
var TiCMaterialStage as Stage = ZenStager.getTiCMaterialStage("bronze");

Check if something is Staged

Supported Types:

  • container
  • dimension
  • ingredient
  • mob
  • mod
  • mulitblock
  • ore
  • package
  • recipename
  • tinker
script.zs
// mods.zenstages.ZenStager.isStaged(string type, string value);
// mods.zenstages.ZenStager.isStaged(string type, int value);
// mods.zenstages.ZenStager.isStaged(string type, IIngredient value);
ZenStager.isStaged("ingredient", <minecraft:stick>);
ZenStager.isStaged("container", "my.awesome.container");
ZenStager.isStaged("mob", "minecraft:skeleton");
ZenStager.isStaged("tinker", "bronze");
ZenStager.isStaged("tinker", "tconstruct:crossbow");
ZenStager.isStaged("recipename", "minecraft:boat");
ZenStager.isStaged("dimension", -1);

Debugging

Calling this method will make the mod check over the Stages you have created and what’s staged. To see if you have mistakenly staged something more than once. If any are found they are logged to the crafttweaker.log file. Telling you what is duplicated staged and what stages it is in. This is an ideal method/tool to use before releasing updates to a modpack or just general development of a modpack.

script.zs
// mods.zenstages.ZenStager.checkConflicts();
ZenStager.checkConflicts();

Build Stages

This is important to call after you have completed adding entries to your stages. This calls upon all the mods to actually stage said entries. Failing to run this method will result in nothing being staged!

script.zs
// mods.zenstager.ZenStager.buildAll();
ZenStager.buildAll();