Skip to content

Commit 003a995

Browse files
committed
v0.15.3.2 - Fix WSR-88D bug
- Fixed a crash when the WSR-88D lookup had something other than a block entity which returned null Took 26 minutes
1 parent 1fe8a33 commit 003a995

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ parchment_mappings_version=2024.11.17
1717
mod_id=pmweatherapi
1818
mod_name=PMWeatherAPI
1919
mod_license=GNU GPL 3.0
20-
mod_version=0.15.3.1
20+
mod_version=0.15.3.2
2121
mod_group_id=net.nullved
2222
mod_authors=NullVed
2323
mod_description=An API for interfacing with ProtoManly's Weather Mod

src/main/java/net/nullved/pmweatherapi/mixin/RadarRendererMixin.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,19 +104,26 @@ private void render(BlockEntity blockEntity, float partialTicks, PoseStack poseS
104104
if (ServerConfig.requireWSR88D && update) {
105105
canRender = false;
106106
int searchrange = 64;
107+
boolean shouldSearch = false;
107108
Level level = blockEntity.getLevel();
108109

109110
// PMWeatherAPI: Minor optimization, Create Radar -> WSR-88D lookup to not do up to 64^3 level#getBlockState calls EVERY 3 SECONDS
110111
if (PMWExtras.RADAR_WSR_88D_LOOKUP.containsKey(pos)) {
111112
BlockEntity wsr88D = level.getBlockEntity(PMWExtras.RADAR_WSR_88D_LOOKUP.get(pos));
112-
if (wsr88D.getBlockState().getBlock() instanceof WSR88DCore wsr88DCore) {
113+
if (wsr88D != null && wsr88D.getBlockState().getBlock() instanceof WSR88DCore wsr88DCore) {
113114
if (wsr88DCore.isComplete(wsr88D.getBlockState())) {
114115
canRender = true;
115116
} else {
116117
PMWExtras.RADAR_WSR_88D_LOOKUP.remove(pos);
118+
shouldSearch = true;
117119
}
120+
} else {
121+
PMWExtras.RADAR_WSR_88D_LOOKUP.remove(pos);
122+
shouldSearch = true;
118123
}
119-
} else {
124+
} else shouldSearch = true;
125+
126+
if (shouldSearch) {
120127
for (int x = -searchrange; x <= searchrange && !canRender; ++x) {
121128
for (int y = -searchrange; y <= searchrange && !canRender; ++y) {
122129
for (int z = -searchrange * 2; z <= searchrange * 2; ++z) {

0 commit comments

Comments
 (0)