88import gregtech .api .pipenet .block .material .BlockMaterialPipe ;
99import gregtech .api .recipes .Recipe ;
1010import gregtech .api .recipes .RecipeMap ;
11+ import gregtech .api .unification .material .Material ;
1112import gregtech .api .util .GTUtility ;
1213import gregtech .common .blocks .BlockCompressed ;
1314import gregtech .common .blocks .BlockFrame ;
2324import org .jetbrains .annotations .NotNull ;
2425import org .jetbrains .annotations .Nullable ;
2526
27+ import java .util .Objects ;
28+
2629/**
2730 * Contains utilities for recipe compatibility with scripting mods
2831 */
@@ -51,7 +54,11 @@ public static String getFirstOutputString(@NotNull Recipe recipe) {
5154 public static String getMetaItemId (ItemStack item ) {
5255 if (item .getItem () instanceof MetaItem ) {
5356 MetaItem <?>.MetaValueItem metaValueItem = ((MetaItem <?>) item .getItem ()).getItem (item );
54- if (metaValueItem != null ) return metaValueItem .unlocalizedName ;
57+ if (metaValueItem != null ) {
58+ String nameSpace = Objects .requireNonNull (metaValueItem .getMetaItem ().getRegistryName ()).getNamespace ();
59+ String name = metaValueItem .unlocalizedName ;
60+ return nameSpace .equals (GTValues .MODID ) ? name : (nameSpace + ":" + name );
61+ }
5562 }
5663 if (item .getItem () instanceof ItemBlock ) {
5764 Block block = ((ItemBlock ) item .getItem ()).getBlock ();
@@ -62,14 +69,17 @@ public static String getMetaItemId(ItemStack item) {
6269 mte .metaTileEntityId .getPath () : mte .metaTileEntityId .toString ());
6370 }
6471 }
65- if (block instanceof BlockCompressed ) {
66- return "block" + ((BlockCompressed ) block ).getGtMaterial (item ).toCamelCaseString ();
72+ if (block instanceof BlockCompressed blockCompressed ) {
73+ Material material = blockCompressed .getGtMaterial (item );
74+ return getRLPrefix (material ) + "block" + material .toCamelCaseString ();
6775 }
68- if (block instanceof BlockFrame ) {
69- return "frame" + ((BlockFrame ) block ).getGtMaterial (item ).toCamelCaseString ();
76+ if (block instanceof BlockFrame blockFrame ) {
77+ Material material = blockFrame .getGtMaterial (item );
78+ return getRLPrefix (material ) + "frame" + material .toCamelCaseString ();
7079 }
71- if (block instanceof BlockMaterialPipe blockMaterialPipe ) {
72- return blockMaterialPipe .getPrefix ().name + blockMaterialPipe .getItemMaterial (item ).toCamelCaseString ();
80+ if (block instanceof BlockMaterialPipe <?, ?, ?>blockMaterialPipe ) {
81+ Material material = blockMaterialPipe .getItemMaterial (item );
82+ return getRLPrefix (material ) + blockMaterialPipe .getPrefix ().name + material .toCamelCaseString ();
7383 }
7484 }
7585 return null ;
@@ -97,6 +107,10 @@ public static TweakerType getPriorityTweaker() {
97107 return TweakerType .NONE ;
98108 }
99109
110+ public static String getRLPrefix (Material material ) {
111+ return material .getModid ().equals (GTValues .MODID ) ? "" : material .getModid () + ":" ;
112+ }
113+
100114 public static boolean isTweakerLoaded () {
101115 return getPriorityTweaker () != TweakerType .NONE ;
102116 }
0 commit comments