fixed generation ofo elytrarace

This commit is contained in:
2026-07-20 13:47:25 +02:00
parent 0d7f1fc646
commit 7d60c74d85
2 changed files with 14 additions and 0 deletions
@@ -24,6 +24,7 @@ import net.minestom.server.event.player.PlayerMoveEvent;
import net.minestom.server.event.player.PlayerStartFlyingWithElytraEvent;
import net.minestom.server.event.player.PlayerStopFlyingWithElytraEvent;
import net.minestom.server.event.player.PlayerUseItemEvent;
import net.minestom.server.instance.Chunk;
import net.minestom.server.instance.batch.AbsoluteBlockBatch;
import net.minestom.server.instance.block.Block;
import net.minestom.server.item.ItemStack;
@@ -209,7 +210,16 @@ public class ElytraRace extends StatelessGame {
point -> batch.setBlock(point, Block.AIR)
);
int minChunkX = (ringPos.blockX() - 100) >> 4;
int maxChunkX = (ringPos.blockX() + 100) >> 4;
int chunkZ = ringPos.blockZ() >> 4;
BatchUtil.loadAndApplyBatch(batch, this, () -> {
for(int cx = minChunkX; cx <= maxChunkX; cx++) {
Chunk chunk = this.getChunk(cx, chunkZ);
if(chunk == null) continue;
this.getPlayers().forEach(chunk::sendChunk);
}
});
}