Fall back to the default icon provider if null is returned from ICraftingIconProvider, handle renamed interfaces in the crafting tree view (#306)

* Fall back to the default icon provider if null is returned from ICraftingIconProvider

* Handle renamed interfaces in the crafting tree view
This commit is contained in:
Raven Szewczyk authored and GitHub committed 2023-05-01 19:13:45 +02:00
1 parent 2a08134ad6
commit fe3f2756ec
1 file changed
+12 -2
@@ -1050,7 +1050,13 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
}
if (directedTile instanceof ICraftingIconProvider) {
return ((ICraftingIconProvider) directedTile).getMachineCraftingIcon();
final ItemStack icon = ((ICraftingIconProvider) directedTile).getMachineCraftingIcon();
if (icon != null) {
if (customName != null) {
icon.setStackDisplayName(customName);
}
return icon;
}
}
final InventoryAdaptor adaptor = InventoryAdaptor.getAdaptor(directedTile, direction.getOpposite());
@@ -1108,7 +1114,11 @@ public class DualityInterface implements IGridTickable, IStorageMonitorable, IIn
final Item item = Item.getItemFromBlock(directedBlock);
if (item != null) {
return new ItemStack(item);
final ItemStack icon = new ItemStack(item);
if (customName != null) {
icon.setStackDisplayName(customName);
}
return icon;
}
}
}