Skip to content

Commit

Permalink
Try to reduce serverlag a bit (#718)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nightenom authored Feb 22, 2025
1 parent 8e218e2 commit f20085d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/main/java/com/ldtteam/structurize/util/BlockUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import net.minecraft.world.item.Items;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.item.context.UseOnContext;
import net.minecraft.world.level.ChunkPos;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.*;
Expand Down Expand Up @@ -767,6 +768,20 @@ public boolean hasChunk(int p_9574_, int p_9575_)
{
return level.hasChunk(p_9574_, p_9575_);
}

@Override
public boolean isOldChunkAround(ChunkPos pos, int radius)
{
final int minX = pos.x - radius;
final int maxX = pos.x + radius;
final int minZ = pos.z - radius;
final int maxZ = pos.z + radius;

return chunks.contains(minX, minZ) &&
chunks.contains(minX, maxZ) &&
chunks.contains(maxX, minZ) &&
chunks.contains(maxX, maxZ);
}
}

/**
Expand Down

0 comments on commit f20085d

Please sign in to comment.