Skip to content

Commit

Permalink
null check for spawner owner in isAgitated() mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
desht committed Nov 13, 2024
1 parent 84d7314 commit 9e47769
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks;

import java.util.Objects;

// Note: spawner agitator logic is handled by BaseSpawnerMixin for player-near checking,
// and in MiscEventHandler#onMobSpawn() for tagging & mob persistence

Expand All @@ -40,7 +38,10 @@ public boolean canPlace(Direction facing) {
}

public static boolean isAgitated(BaseSpawner spawner) {
return Objects.requireNonNull(spawner.getOwner()).left()
if (spawner.getOwner() == null) {
return false;
}
return spawner.getOwner().left()
.map(be -> SemiblockTracker.getInstance().getSemiblock(be.getLevel(), be.getBlockPos()) instanceof SpawnerAgitatorEntity)
.orElse(false);
}
Expand Down

0 comments on commit 9e47769

Please sign in to comment.