@@ -35,6 +35,33 @@ class ModPluginOpenComputers extends IModPlugin {
35
35
registry.addRecipeHandlers(CallbackDocHandler .CallbackDocRecipeHandler )
36
36
registry.addRecipes(CallbackDocHandler .getRecipes(registry))
37
37
38
+ def useNBT (names : String * ) = names.map(name => {
39
+ val info = Items .get(name)
40
+ Option (info.item).getOrElse(Item .getItemFromBlock(info.block))
41
+ }).filter(_ != null ).distinct.foreach(registry.getJeiHelpers.getSubtypeRegistry.useNbtForSubtypes(_))
42
+
43
+ // Only the preconfigured blocks and items have to be here.
44
+ useNBT(
45
+ Constants .BlockName .Microcontroller ,
46
+ Constants .BlockName .Robot ,
47
+
48
+ Constants .ItemName .Drone ,
49
+ Constants .ItemName .Tablet
50
+ )
51
+
52
+ registry.getJeiHelpers.getSubtypeRegistry.registerNbtInterpreter(Items .get(Constants .ItemName .Floppy ).item(), new ISubtypeInterpreter {
53
+ override def getSubtypeInfo (stack : ItemStack ): String = {
54
+ if (! stack.hasTagCompound) return null
55
+ val compound : NBTTagCompound = stack.getTagCompound
56
+ val data = new NBTTagCompound
57
+ // Separate loot disks from normal floppies
58
+ if (compound.hasKey(Settings .namespace + " lootFactory" )) {
59
+ data.setTag(Settings .namespace + " lootFactory" , compound.getTag(Settings .namespace + " lootFactory" ))
60
+ }
61
+ if (data.hasNoTags) null else data.toString
62
+ }
63
+ })
64
+
38
65
registry.addAdvancedGuiHandlers(RelayGuiHandler )
39
66
}
40
67
0 commit comments