Skip to content

UniDict

roidrole edited this page Oct 6, 2025 · 1 revision

Integrates UniDict more closely with CraftTweaker.

"But wait, doesn't UniDict already have CT integration?", you might ask

It has, but it only supports a limited number of recipe types, where this mod allows conversion to IItemStack

Let's start by explaining a few terms :

  • An IResource is a metal type, for example "Iron"
  • A kind is a type resources can have, for example "gear". It is an int

To get an IItemStack, you need both a resource and a kind. For example, "iron" resource and "gear" type return the IItemStack matching ore:gearIron\

Another thing important to mention is that the script using the UniDict class must be loaded after UniDict's init phase. The best way to do is by using ZenUtils custom script entrypoint. The following line will create the entrypoint used in the examples : afterunidict;unidict;I;after

UniDict

The entrypoint of the integration. Should be called after UniDict's initialization. All methods are static

Import:

import mods.roidtweaker.unidict.UniDict;
Method Parameters Return Type Description
getKind name as string int Returns the int representing this type, or null if absent
getResource name as string IResource Returns the IResource with this name. It uses the oreDictionary name
getResources kind as int[] IResource[] Returns all IResources which have an IItemStack for these kinds

IResource

A resource, e.g. Iron. All methods are instance methods. Get an instance via UniDict.

Import:

import mods.roidtweaker.unidict.IResource;
Method Parameters Return Type Description
getName [None] string
getStack kind as int IItemStack You can also call it with resource[kind]
getStacks [None] IItemStack[] Returns, in no particular order, the main IItemStack of every kind

Clone this wiki locally