When the IOreDict is the lexicon, the IOreDictEntries are the lexicon's entries.
They consist of a name (OreDictionary name) and an explanation (all matching items).

패키지 임포트하기

Link to 패키지-임포트하기

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import.
import crafttweaker.oredict.IOreDictEntry;

Retrieving such an Object.

Link to retrieving-such-an-object

There are multiple ways of getting an IOreDictEntry Object: If you refer to an oreDict that does not yet exist, it will be created.

You can use these getters to retrieve some information on the oredict:

nameDescriptionReturn type
name
name
Description
Returns the oreDict's name
Return type
string
name
empty
Description
Returns if the oreDict is empty
Return type
bool
name
firstItem
Description
Returns the first of the oreDict's items
Return type
IItemStack

You can use these methos on an IOreDictEntry Object:

Add/Remove items

Link to addremove-items

ZenScript
Copy
val oreDictEnt = <ore:ingotIron>;

//oreDictEnt.add(IItemStack... item_items);
oreDictEnt.add(<minecraft:grass>);
oreDictEnt.add(<minecraft:iron_ore>, <minecraft:dirt>);

//oreDictEnt.addItems(IItemStack[] items);
oreDictEnt.addItems([<minecraft:redstone>, <minecraft:gold_ore>]);

//oreDictEnt.addAll(IOreDictEntry otherEntry);
oreDictEnt.addAll(<ore:ingotGold>);



//oreDictEnt.remove(IItemStack... item_items);
oreDictEnt.remove(<minecraft:grass>);
oreDictEnt.remove(<minecraft:iron_ore>, <minecraft:dirt>);

//oreDictEnt.removeItems(IItemStack[] items);
oreDictEnt.removeItems([<minecraft:redstone>, <minecraft:gold_ore>]);

Check if an IOreDictEntry contains an item

Link to check-if-an-ioredictentry-contains-an-item

You can check if an IOreDictEntry contains an item using either the in or has keywords:

ZenScript
Copy
val oreDictEnt = <ore:ingotIron>;

//While using in is possible
if(oreDictEnt in <minecraft:iron_ingot>){
    print("Iron is in the oreDict!");
}

//many prefer using has as it might make more sense grammar-wise
if(oreDictEnt has <minecraft:iron_ingot>){
    print("Iron still is in the oreDict!");
}

Mirror an IOreDictEntry

Link to mirror-an-ioredictentry

Mirroring an IOreDictEntry means that all items in the other oreDictEntry will be replaced by the items in the oreDictEntry the method was executed on:

ZenScript
Copy
//make iron and copper equivalent
val iron = <ore:ingotIron>;
val copper = <ore:ingotCopper>;

//adds all entries from copper into iron so that the iron oreDictEntry contains both the iron and copper ingots
iron.addAll(copper);

//mirrors iron to copper, so all items in copper will be replaced by all the ones in iron.
//In this case that means by all iron and copper ingots, so copper and iron will have the same entries
copper.mirror(iron);

IIngredient implementation

Link to iingredient-implementation

IOreDictEntry extends IIngredient. This means that all methods available to IIngredient are also available to IOreDictEntries. It also means that you can put IOreDictEntries into IIngredient Arrays (such as the ones in crafting recipe methods).

Iterating through an oreDictEntry's items

Link to iterating-through-an-oredictentrys-items

ZenScript
Copy
val iron = <ore:ingotIron>;

for item in iron.items{
    recipe.remove(item);
}