<commit_before># Ore Dictionary  Entries

If you want to refer to all entries that share the same oreDictionary entry, you can use its oreDictionary tag in recipes.


## How to refer to oreDictionaries

You refer to oreDictionaries the same way as you refer to items, using Brackets.
An example of the OreDict Bracket Handler would be:

```
<ore:ingotIron>
```

This will give you access to the OreDict for `ingotIron`.


## How to add/remove an oreDic entry

You can use the add or remove function to add or remove an item's ore Dictionary entry.
```
//This will add dirt to the iron Ingot ore Dictionary
<ore:ingotIron>.add(<minecraft:dirt>);

//And this will remove iron ingots from the iron ingot ore Dictionary
<ore:ingotIron>.remove(<minecraft:iron_ingot>);
```

You can also use variables/values
```
var copper = <ore:ingotCopper>;
val iron = <ore:ingotIron>;
copper.add(<minecraft:dirt>);
iron.remove(<minecraft:iron_ingot>);
```

## How to add/remove multiple oreDic entries

You can use the addItems or removeItems functions to add/remove all items of an array to/from an oreDictionary
PS: Yes, I know this script down there is kinda useless, but it's just for demonstration ☺
```
import crafttweaker.item.IItemStack;

val array = [<minecraft:iron_ingot>,<minecraft:dirt>,<minecraft:gold_ingot>] as IItemStack[];
val array2 = [<minecraft:iron_ingot>,<minecraft:dirt>] as IItemStack[];
val copper = <ore:copper>;

//adds iron, dirt, gold to Copper oreDic
copper.addItems(array);

//removes iron, dirt from Copper oreDic
copper.removeItems(array2);

```


## How to make a new OreDictionary

If you want to create a new oreDictionary, you just refer to it as if it would already be present.
If CraftTweaker can't find an oreDictionary, it will create a new, empty one.

```
//Create oreDic called test
val myEntry = <ore:test>;

//adds coal and iron ingots to the test entry.
myEntry.add(<minecraft:coal>);
myEntry.add(<minecraft:iron_ingot>);
```

## Merge and unify OreDictionaries

If you have two oreDictionaries that are essentially the same (such as ironBlock and blockIron), you may want to unify them.
This can be done using the addAll and mirror function.

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

//adds all entries from iron to copper so that Copper contains both, the iron and copper oreDic entries
iron.addAll(copper); 


//mirrors copper to iron, so all items in iron will be replaced by all the ones in copper.
//In this case that means by all iron and copper oreDic Entries
iron2.mirror(iron);
```

## Using oreDics in recipes

If you want to refer to all items in an oreDictionary, you can just use that entry where you'd normally put the single item.
```
val iron = <ore:ingotIron>;

recipes.add(<minecraft:dirt>,[[iron,iron,iron],[iron,iron,null],[iron,iron,iron]]);
```

## Iterating through an OreDictionary

You can iterate through an oreDictionary by making it to a list and iterating through that one.
This can be done using the function items.

```
val iron = <ore:ingotIron>;

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

## Check if an oreDic is empty

You can check if an oreDic is empty using the `oreDic.empty` function. This will return a boolean.
```
val OD = <ore:ingotIron>;
if(!OD.empty){
	//if ingotIron oreDic is not empty, print "NOPE"
	print("NOPE")
}
```

## Check if an oreDic contains an item

Usually, you can just use NEI/JEI, but if you ever need CT to check if a oreDictionary contains a specific item, you can use the `in` function.  
Remember, first the oreDic, then the item you want to check for.  
This will return a boolean.

```

if(<ore:ingotIron> in <minecraft:iron_ingot>){
	print("Iron is in the oreDic!");
}
```

## Get an oreDics name

If you ever need to get an oreDics name, you can use the `oreDic.name` function. This will return the name as String.  
The oreDic name is the part after the `:` in `<ore:name>`
```
val OD = <ore:ingotIron>;

//prints "ingotIron"
print(OD.name);

## Get the first item of an oreDic

I have no idea why you would ever need this, but here you go
the firstItem function returns an IItemStack

```
val fI = <ore:ingotIton>.firstItem;
print(fI.name);
```<commit_msg>Closed Code Segment in OreDict.md Also fixed typo<commit_after># Ore Dictionary  Entries

If you want to refer to all entries that share the same oreDictionary entry, you can use its oreDictionary tag in recipes.


## How to refer to oreDictionaries

You refer to oreDictionaries the same way as you refer to items, using Brackets.
An example of the OreDict Bracket Handler would be:

```
<ore:ingotIron>
```

This will give you access to the OreDict for `ingotIron`.


## How to add/remove an oreDic entry

You can use the add or remove function to add or remove an item's ore Dictionary entry.
```
//This will add dirt to the iron Ingot ore Dictionary
<ore:ingotIron>.add(<minecraft:dirt>);

//And this will remove iron ingots from the iron ingot ore Dictionary
<ore:ingotIron>.remove(<minecraft:iron_ingot>);
```

You can also use variables/values
```
var copper = <ore:ingotCopper>;
val iron = <ore:ingotIron>;
copper.add(<minecraft:dirt>);
iron.remove(<minecraft:iron_ingot>);
```

## How to add/remove multiple oreDic entries

You can use the addItems or removeItems functions to add/remove all items of an array to/from an oreDictionary
PS: Yes, I know this script down there is kinda useless, but it's just for demonstration ☺
```
import crafttweaker.item.IItemStack;

val array = [<minecraft:iron_ingot>,<minecraft:dirt>,<minecraft:gold_ingot>] as IItemStack[];
val array2 = [<minecraft:iron_ingot>,<minecraft:dirt>] as IItemStack[];
val copper = <ore:copper>;

//adds iron, dirt, gold to Copper oreDic
copper.addItems(array);

//removes iron, dirt from Copper oreDic
copper.removeItems(array2);

```


## How to make a new OreDictionary

If you want to create a new oreDictionary, you just refer to it as if it would already be present.
If CraftTweaker can't find an oreDictionary, it will create a new, empty one.

```
//Create oreDic called test
val myEntry = <ore:test>;

//adds coal and iron ingots to the test entry.
myEntry.add(<minecraft:coal>);
myEntry.add(<minecraft:iron_ingot>);
```

## Merge and unify OreDictionaries

If you have two oreDictionaries that are essentially the same (such as ironBlock and blockIron), you may want to unify them.
This can be done using the addAll and mirror function.

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

//adds all entries from iron to copper so that Copper contains both, the iron and copper oreDic entries
iron.addAll(copper); 


//mirrors copper to iron, so all items in iron will be replaced by all the ones in copper.
//In this case that means by all iron and copper oreDic Entries
iron2.mirror(iron);
```

## Using oreDics in recipes

If you want to refer to all items in an oreDictionary, you can just use that entry where you'd normally put the single item.
```
val iron = <ore:ingotIron>;

recipes.add(<minecraft:dirt>,[[iron,iron,iron],[iron,iron,null],[iron,iron,iron]]);
```

## Iterating through an OreDictionary

You can iterate through an oreDictionary by making it to a list and iterating through that one.
This can be done using the function items.

```
val iron = <ore:ingotIron>;

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

## Check if an oreDic is empty

You can check if an oreDic is empty using the `oreDic.empty` function. This will return a boolean.
```
val OD = <ore:ingotIron>;
if(!OD.empty){
	//if ingotIron oreDic is not empty, print "NOPE"
	print("NOPE")
}
```

## Check if an oreDic contains an item

Usually, you can just use NEI/JEI, but if you ever need CT to check if a oreDictionary contains a specific item, you can use the `in` function.  
Remember, first the oreDic, then the item you want to check for.  
This will return a boolean.

```

if(<ore:ingotIron> in <minecraft:iron_ingot>){
	print("Iron is in the oreDic!");
}
```

## Get an oreDics name

If you ever need to get an oreDics name, you can use the `oreDic.name` function. This will return the name as String.  
The oreDic name is the part after the `:` in `<ore:name>`
```
val OD = <ore:ingotIron>;

//prints "ingotIron"
print(OD.name);
```

## Get the first item of an oreDic

I have no idea why you would ever need this, but here you go.  
The firstItem function returns an IItemStack

```
val fI = <ore:ingotIton>.firstItem;
print(fI.name);
```
{'fraction_non_alphanumeric': 0.09914147947783135, 'fraction_numerical': 0.0007056333058920382, 'mean_word_length': 4.504207119741101, 'pattern_counts': {'":': 0, '<': 61, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2229531', 'n_tokens_mistral': 2790, 'n_tokens_neox': 2665, 'n_words': 1179}