Skip to content

Commit

Permalink
reduce log spam
Browse files Browse the repository at this point in the history
  • Loading branch information
andi-makes committed Jun 8, 2024
1 parent f02bd51 commit bfaa8d5
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions common/src/main/java/dev/schmarrn/lighty/api/LightyHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.block.*;
import net.minecraft.world.level.block.state.BlockState;

import java.util.HashSet;

public class LightyHelper {
static HashSet<ResourceLocation> invalidBlocks = new HashSet<>();

private static boolean isRedstone(Block block) {
return block instanceof RedStoneWireBlock ||
block instanceof ButtonBlock ||
Expand All @@ -26,8 +31,12 @@ private static boolean protectedIsValidSpawnCheck(BlockState block, BlockPos pos
try {
return block.isValidSpawn(world, pos, null);
} catch (NullPointerException e) {
Lighty.LOGGER.error(e.getMessage());
Lighty.LOGGER.error("Cannot check `isValidSpawn` on Block {} because it uses entity checks. The overlay might not be accurate for that block.", BuiltInRegistries.BLOCK.getKey(block.getBlock()));
ResourceLocation rl = BuiltInRegistries.BLOCK.getKey(block.getBlock());
if (!invalidBlocks.contains(rl)) {
invalidBlocks.add(rl);
Lighty.LOGGER.error(e.getMessage());
Lighty.LOGGER.error("Cannot check `isValidSpawn` on Block {} because it uses entity checks. The overlay might not be accurate for that block.", rl);
}
return true;
}
}
Expand Down

0 comments on commit bfaa8d5

Please sign in to comment.