mirror of
https://github.com/GTNewHorizons/Applied-Energistics-2-Unofficial.git
synced 2026-10-26 14:25:20 +00:00
fix: crash when check crafting CPU (#864)
Co-authored-by: Martin Robertz <dream-master@gmx.net>
This commit is contained in:
1 parent
67a46f5770
commit
8c55f9fce1
2 files changed
+19
-17
No files matched your search
@@ -77,6 +77,7 @@ import appeng.integration.IntegrationRegistry;
|
||||
import appeng.integration.IntegrationType;
|
||||
import appeng.integration.modules.NEI;
|
||||
import appeng.items.misc.ItemEncodedPattern;
|
||||
import appeng.me.cluster.implementations.CraftingCPUCluster;
|
||||
import appeng.parts.reporting.PartInterfaceTerminal;
|
||||
import appeng.tile.inventory.AppEngInternalInventory;
|
||||
import appeng.util.Platform;
|
||||
@@ -1331,7 +1332,7 @@ public class GuiInterfaceTerminal extends AEBaseGui
|
||||
|
||||
InterfaceTerminalEntry(long id, String name, int rows, int rowSize, boolean online, boolean p2pOutput) {
|
||||
this.id = id;
|
||||
this.dispName = translateFromNetwork(name);
|
||||
this.dispName = CraftingCPUCluster.translateFromNetwork(name);
|
||||
this.inv = new AppEngInternalInventory(null, rows * rowSize, 1);
|
||||
this.rows = rows;
|
||||
this.rowSize = rowSize;
|
||||
@@ -1520,18 +1521,4 @@ public class GuiInterfaceTerminal extends AEBaseGui
|
||||
}
|
||||
}
|
||||
|
||||
public static String translateFromNetwork(String name) {
|
||||
final String dispName;
|
||||
if (StatCollector.canTranslate(name)) {
|
||||
dispName = StatCollector.translateToLocal(name);
|
||||
} else {
|
||||
String fallback = name + ".name"; // its whatever. save some bytes on network but looks ugly
|
||||
if (StatCollector.canTranslate(fallback)) {
|
||||
dispName = StatCollector.translateToLocal(fallback);
|
||||
} else {
|
||||
dispName = StatCollector.translateToFallback(name);
|
||||
}
|
||||
}
|
||||
return dispName;
|
||||
}
|
||||
}
|
||||
@@ -50,6 +50,7 @@ import net.minecraft.util.ChatComponentText;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
|
||||
@@ -98,7 +99,6 @@ import appeng.api.util.DimensionalCoord;
|
||||
import appeng.api.util.IInterfaceViewable;
|
||||
import appeng.api.util.NamedDimensionalCoord;
|
||||
import appeng.api.util.WorldCoord;
|
||||
import appeng.client.gui.implementations.GuiInterfaceTerminal;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.container.implementations.ContainerCraftingCPU;
|
||||
import appeng.core.AELog;
|
||||
@@ -1346,7 +1346,7 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||
for (ICraftingMedium craftingProvider : craftingProviders) {
|
||||
final TileEntity tile = this.getTile(craftingProvider);
|
||||
if (tile instanceof TileInterface tileInterface) {
|
||||
final String dispName = GuiInterfaceTerminal.translateFromNetwork(
|
||||
final String dispName = translateFromNetwork(
|
||||
tileInterface.getInterfaceDuality().getTermName());
|
||||
dimensionalCoords.add(new NamedDimensionalCoord(tile, dispName));
|
||||
}
|
||||
@@ -1776,6 +1776,21 @@ public final class CraftingCPUCluster implements IAECluster, ICraftingCPU {
|
||||
}
|
||||
}
|
||||
|
||||
public static String translateFromNetwork(String name) {
|
||||
final String dispName;
|
||||
if (StatCollector.canTranslate(name)) {
|
||||
dispName = StatCollector.translateToLocal(name);
|
||||
} else {
|
||||
String fallback = name + ".name"; // its whatever. save some bytes on network but looks ugly
|
||||
if (StatCollector.canTranslate(fallback)) {
|
||||
dispName = StatCollector.translateToLocal(fallback);
|
||||
} else {
|
||||
dispName = StatCollector.translateToFallback(name);
|
||||
}
|
||||
}
|
||||
return dispName;
|
||||
}
|
||||
|
||||
public BaseActionSource getCurrentJobSource() {
|
||||
return currentJobSource;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user