Skip to content

Commit

Permalink
add registration, CT method
Browse files Browse the repository at this point in the history
  • Loading branch information
serenibyss committed Aug 12, 2021
1 parent b6cad8c commit 052fd4e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/java/gregtech/api/items/crafttweaker/CTItemUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package gregtech.api.items.crafttweaker;

import crafttweaker.annotations.ZenRegister;
import gregtech.api.items.metaitem.MetaOreDictItem;
import gregtech.api.unification.material.info.MaterialIconSet;
import gregtech.api.unification.ore.OrePrefix;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;

@ZenClass("mods.gregtech.item.ItemRegistry")
@ZenRegister
public class CTItemUtils {

@ZenMethod("registerItem")
public static void registerItem(String name, short id, int rgb, String materialIconSet, String orePrefix) {
new MetaOreDictItem.OreDictValueItem(
id, name, rgb, MaterialIconSet.valueOf(materialIconSet), OrePrefix.getPrefix(orePrefix));
}
}
3 changes: 3 additions & 0 deletions src/main/java/gregtech/common/items/MetaItems.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import gregtech.api.items.materialitem.MetaPrefixItem;
import gregtech.api.items.metaitem.MetaItem;
import gregtech.api.items.metaitem.MetaItem.MetaValueItem;
import gregtech.api.items.metaitem.MetaOreDictItem;
import gregtech.api.items.toolitem.ToolMetaItem;
import gregtech.api.unification.ore.OrePrefix;
import gregtech.api.util.GTLog;
Expand Down Expand Up @@ -533,6 +534,8 @@ public static void init() {
first.setRegistryName("meta_item_1");
MetaTool tool = new MetaTool();
tool.setRegistryName("meta_tool");
MetaOreDictItem oreDictItem = new MetaOreDictItem((short) 0);
oreDictItem.setRegistryName("meta_oredict_item");
for (OrePrefix prefix : orePrefixes) {
String regName = CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_UNDERSCORE, prefix.name());
MetaPrefixItem metaOrePrefix = new MetaPrefixItem(prefix);
Expand Down

0 comments on commit 052fd4e

Please sign in to comment.