#or any other blocking shit
1 messages · Page 1 of 1 (latest)
do u come ?
@EventHandler
public void loadChunk(ChunkLoadEvent e) {
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
scheduler.runTaskAsynchronously(plugin, () -> {
ChunkSnapshot chunk = e.getChunk().getChunkSnapshot();
World world = e.getChunk().getWorld();
for (int x = 0; x <= 15; x++) {
for (int z = 0; z <= 15; z++) {
for (int y = chunk.getHighestBlockYAt(x, z); y > world.getMinHeight(); y--) {
Block block = e.getChunk().getBlock(x, y, z);
if (block.getType() == Material.CARROTS) {
Ageable carrots = (Ageable) block.getBlockData();
carrots.setAge(7);
block.setBlockData(carrots);
}
}
}
}
});
}``` i add this runnable to my method
now my loop doesnt lag ?
just asking to understand the logic
actually i try without this runnable
and i don't saw lag