Skip to content

Commit

Permalink
Fix packet
Browse files Browse the repository at this point in the history
  • Loading branch information
Edivad99 committed Jan 2, 2024
1 parent e5787c4 commit d13dbab
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ plugins {
}

version = "$minecraft_version-$mod_version"
group = "edivad.solargeneration"
group = 'edivad.solargeneration'
base.archivesName = 'SolarGeneration'

java.toolchain.languageVersion = JavaLanguageVersion.of(17)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,13 @@ public ResourceLocation id() {
}

public void handle(PlayPayloadContext ctx) {
UpdateSolarPanelClient.handle(this, ctx);
}

private static class UpdateSolarPanelClient {

static void handle(UpdateSolarPanel packet, PlayPayloadContext ctx) {
ctx.level().ifPresent(level -> {
if (level.isLoaded(packet.pos)) {
if (level.getBlockEntity(packet.pos) instanceof SolarPanelBlockEntity solar) {
solar.energyClient = packet.currentEnergy;
solar.energyProductionClient = packet.currentProduction;
}
ctx.level().ifPresent(level -> {
if (level.isLoaded(pos)) {
if (level.getBlockEntity(pos) instanceof SolarPanelBlockEntity solar) {
solar.energyClient = currentEnergy;
solar.energyProductionClient = currentProduction;
}
});
}
}
});
}
}

0 comments on commit d13dbab

Please sign in to comment.