Solar panels will work in Nether and The End. Closes #2105

This commit is contained in:
drcrazy 2020-05-06 15:08:46 +03:00
parent 2e67d56225
commit fdc6f88dbc

View file

@ -63,10 +63,6 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
private SolarPanels panel; private SolarPanels panel;
public SolarPanelBlockEntity() {
super(TRBlockEntities.SOLAR_PANEL);
}
public SolarPanelBlockEntity(SolarPanels panel) { public SolarPanelBlockEntity(SolarPanels panel) {
super(TRBlockEntities.SOLAR_PANEL); super(TRBlockEntities.SOLAR_PANEL);
this.panel = panel; this.panel = panel;
@ -101,6 +97,9 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
} }
private void updateState() { private void updateState() {
if (world == null) {
return;
}
if (world.isSkyVisible(pos.up())) { if (world.isSkyVisible(pos.up())) {
this.setSunState(NIGHTGEN); this.setSunState(NIGHTGEN);
@ -110,6 +109,10 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
} else { } else {
this.setSunState(ZEROGEN); this.setSunState(ZEROGEN);
} }
// Nether and The End
if (!world.dimension.hasSkyLight()) {
this.setSunState(NIGHTGEN);
}
if (prevState != this.getSunState()) { if (prevState != this.getSunState()) {
boolean isGenerating = getSunState() == DAYGEN; boolean isGenerating = getSunState() == DAYGEN;
@ -141,6 +144,10 @@ public class SolarPanelBlockEntity extends PowerAcceptorBlockEntity implements I
public void tick() { public void tick() {
super.tick(); super.tick();
if (world == null){
return;
}
if (world.isClient) { if (world.isClient) {
return; return;
} }