mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-13 16:54:20 +00:00
Fix client NPE when placing wireless powered lights on dedicated servers (#252)
This commit is contained in:
1 parent
046ad7441d
commit
cbeec42e47
1 file changed
+6
-2
@@ -24,7 +24,10 @@ public class WirelessChargedLocation {
|
||||
* use (unless ~4B changes happen in between). Do this instead directly updating so that WirelessChargedLocation
|
||||
* can be used while the TileEntity is still in construction (or loading).
|
||||
*/
|
||||
this.lastChangeCount = EnderIO.proxy.wirelessChargerController.getChangeCount() - 1;
|
||||
// The controller only exists on the server (created in FMLServerAboutToStartEvent), so it is null on
|
||||
// clients connected to a dedicated server. Chargers are only queried server-side, so stay inert there.
|
||||
WirelessChargerController wcc = EnderIO.proxy.wirelessChargerController;
|
||||
this.lastChangeCount = wcc == null ? 0 : wcc.getChangeCount() - 1;
|
||||
}
|
||||
|
||||
private void updateChargers() {
|
||||
@@ -41,7 +44,8 @@ public class WirelessChargedLocation {
|
||||
}
|
||||
|
||||
private void checkChangeCount() {
|
||||
if (lastChangeCount != EnderIO.proxy.wirelessChargerController.getChangeCount()) {
|
||||
WirelessChargerController wcc = EnderIO.proxy.wirelessChargerController;
|
||||
if (wcc != null && lastChangeCount != wcc.getChangeCount()) {
|
||||
updateChargers();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user