From 4c380f7a5976fe7f0ba4cedb675a7cef4015ee3b Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 10 Dec 2019 17:02:27 +0100 Subject: [PATCH] Fixed accelerator rebooting on chunk loading --- .../warpdrive/block/atomic/TileEntityAcceleratorCore.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/cr0s/warpdrive/block/atomic/TileEntityAcceleratorCore.java b/src/main/java/cr0s/warpdrive/block/atomic/TileEntityAcceleratorCore.java index 6b121d46..eb515389 100644 --- a/src/main/java/cr0s/warpdrive/block/atomic/TileEntityAcceleratorCore.java +++ b/src/main/java/cr0s/warpdrive/block/atomic/TileEntityAcceleratorCore.java @@ -834,6 +834,7 @@ public class TileEntityAcceleratorCore extends TileEntityAbstractEnergyCoreOrCon protected boolean doScanAssembly(final boolean isDirty, final WarpDriveText textReason) { final boolean isValid = super.doScanAssembly(isDirty, textReason); + // note: acceleratorSetup is null when loading chunk, always defined otherwise final AcceleratorSetup legacy_acceleratorSetup = acceleratorSetup; if ( isDirty || acceleratorSetup == null @@ -857,11 +858,12 @@ public class TileEntityAcceleratorCore extends TileEntityAbstractEnergyCoreOrCon // reset accelerator in case of major changes if (isDirty) { - if (acceleratorSetup.isMajorChange(legacy_acceleratorSetup)) { + if ( legacy_acceleratorSetup != null + && acceleratorSetup.isMajorChange(legacy_acceleratorSetup) ) { if (WarpDriveConfig.LOGGING_ACCELERATOR) { WarpDrive.logger.info(this + " rebooting due to major change..."); } - rebootAccelerator(legacy_acceleratorSetup != null ? legacy_acceleratorSetup : acceleratorSetup, true, true); + rebootAccelerator(legacy_acceleratorSetup, true, true); } sendEvent("acceleratorUpdated"); }