CraftTweaker

CraftTweaker

151M Downloads

[Suggestion] Add "oredicts" ZenGetter for IGame class

OrdinatorStouff opened this issue ยท 2 comments

commented

From https://crafttweaker.readthedocs.io/en/latest/#Vanilla/Game/IGame/#game-class I suggest adding an oredict ZenGetter the to game class something like the following:

Zengetter What does it do? Return Type Usage
oredicts Returns all registered ore dictionaries as list List<IOredDictEntry> game.oredicts

I have a use for iterating every registered oredict and right now the best way I can think of to get all is by iterating all items and appending each item's oredict to a list like so:

var allOreD as IOreDictEntry[];

for itemDef in game.items {
    for oreD in itemDef.ores {
        if !(oreD in allOreD) {
            allOreD += oreD;
        }
    }
}

(untested code just an example to how I'll try to do it without something like game.oredicts)

commented

http://crafttweaker.readthedocs.io/en/latest/#Vanilla/OreDict/#using-the-oredict-keyword
Gonna change that wiki entry though since currently IOreDict and IOreDictEntry are kinda mixed up

commented

oh wow I didn't realize. And I even read that part of the page yesterday but it didn't click later when I was looking at game.

So oreDict is an iterable of all registered IOreDictEntries? That's exactly what I needed.