Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SolarPanelBlockEntity.java #664

Open
wants to merge 1 commit into
base: 1.20.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,33 @@ public ChargeSlotType getChargeSlotType() {
return ChargeSlotType.POWER_ITEM;
}


//// cemerson 20250105 | temp patch for solar panels not working in space at night
//// Unsure if this
//// OLD VERSION
// @Override
// public void serverTick(ServerLevel level, long time, BlockState state, BlockPos pos) {
// if (canFunction()) {
// distributeToChargeSlots();
// if (isDay()) generateEnergy(PlanetApi.API.getSolarPower(level));
// }
// }
//// TEMP NEW VERSION (?)
private boolean isSpace = false;
private ServerLevel cachedSolarPanelsLevel = null;
@Override
public void serverTick(ServerLevel level, long time, BlockState state, BlockPos pos) {
if (canFunction()) {
distributeToChargeSlots();
if (isDay()) generateEnergy(PlanetApi.API.getSolarPower(level));
distributeToChargeSlots();
if(cachedSolarPanelsLevel == null){
cachedSolarPanelsLevel = level;
isSpace = PlanetApi.API.isSpace(cachedSolarPanelsLevel);
}
if (isDay() || isSpace) {
generateEnergy(PlanetApi.API.getSolarPower(level));
}
}
}
}

@Override
public void tickSideInteractions(BlockPos pos, Predicate<Direction> filter, List<ConfigurationEntry> sideConfig) {
Expand Down