From fdc6f88dbc3982bb71653b98af5f8d28a9047a49 Mon Sep 17 00:00:00 2001 From: drcrazy Date: Wed, 6 May 2020 15:08:46 +0300 Subject: [PATCH] Solar panels will work in Nether and The End. Closes #2105 --- .../generator/SolarPanelBlockEntity.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java b/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java index 3ebdc3418..30143f0d2 100644 --- a/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java +++ b/src/main/java/techreborn/blockentity/generator/SolarPanelBlockEntity.java @@ -63,10 +63,6 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I private SolarPanels panel; - public SolarPanelBlockEntity() { - super(TRBlockEntities.SOLAR_PANEL); - } - public SolarPanelBlockEntity(SolarPanels panel) { super(TRBlockEntities.SOLAR_PANEL); this.panel = panel; @@ -101,6 +97,9 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I } private void updateState() { + if (world == null) { + return; + } if (world.isSkyVisible(pos.up())) { this.setSunState(NIGHTGEN); @@ -110,6 +109,10 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I } else { this.setSunState(ZEROGEN); } + // Nether and The End + if (!world.dimension.hasSkyLight()) { + this.setSunState(NIGHTGEN); + } if (prevState != this.getSunState()) { boolean isGenerating = getSunState() == DAYGEN; @@ -141,6 +144,10 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I public void tick() { super.tick(); + if (world == null){ + return; + } + if (world.isClient) { return; }