diff --git a/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java b/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java index d361cea0..12d266e5 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java @@ -23,6 +23,7 @@ import appeng.api.networking.crafting.ICraftingCPU; import appeng.api.networking.crafting.ICraftingGrid; import appeng.api.storage.ITerminalHost; import appeng.container.guisync.GuiSync; +import appeng.util.Platform; import com.google.common.collect.ImmutableSet; import net.minecraft.entity.player.InventoryPlayer; @@ -50,50 +51,53 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU @Override public void detectAndSendChanges() { - final ICraftingGrid cc = this.getNetwork().getCache( ICraftingGrid.class ); - final ImmutableSet cpuSet = cc.getCpus(); - - int matches = 0; - boolean changed = false; - for( final ICraftingCPU c : cpuSet ) + if( Platform.isServer() && this.getNetwork() != null ) { - boolean found = false; - for( final CraftingCPURecord ccr : this.cpus ) - { - if( ccr.getCpu() == c ) - { - found = true; - } - } + final ICraftingGrid cc = this.getNetwork().getCache( ICraftingGrid.class ); + final ImmutableSet cpuSet = cc.getCpus(); - final boolean matched = this.cpuMatches( c ); - - if( matched ) - { - matches++; - } - - if( found == !matched ) - { - changed = true; - } - } - - if( changed || this.cpus.size() != matches ) - { - this.cpus.clear(); + int matches = 0; + boolean changed = false; for( final ICraftingCPU c : cpuSet ) { - if( this.cpuMatches( c ) ) + boolean found = false; + for( final CraftingCPURecord ccr : this.cpus ) { - this.cpus.add( new CraftingCPURecord( c.getAvailableStorage(), c.getCoProcessors(), c ) ); + if( ccr.getCpu() == c ) + { + found = true; + } + } + + final boolean matched = this.cpuMatches( c ); + + if( matched ) + { + matches++; + } + + if( found == !matched ) + { + changed = true; } } - this.sendCPUs(); - } + if( changed || this.cpus.size() != matches ) + { + this.cpus.clear(); + for( final ICraftingCPU c : cpuSet ) + { + if( this.cpuMatches( c ) ) + { + this.cpus.add( new CraftingCPURecord( c.getAvailableStorage(), c.getCoProcessors(), c ) ); + } + } - this.noCPU = this.cpus.isEmpty(); + this.sendCPUs(); + } + + this.noCPU = this.cpus.isEmpty(); + } super.detectAndSendChanges(); }