#i mean i try this code
1 messages · Page 1 of 1 (latest)
@EventHandler
public void loadChunk(ChunkLoadEvent e) {
ChunkSnapshot chunk = e.getChunk().getChunkSnapshot();
System.out.println("test1");
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--) {
System.out.println("test2");
Block block = e.getChunk().getBlock(x,y,z);
if (block.getType() == Material.WHEAT) {
block.setType(Material.DIAMOND_BLOCK);
System.out.println("test3");
}
}
}
}
}```
i rejoin server isnt working but
if i wait 10 sec and join server
working
so for the unload chunks i need wait some time
if the chunk is loaded that code never runs
if you log out and back in the chunk doesn;t unload
so i need method for unload chunk ?
your original request was to grow wheat for the time the chunk was unloaded.
example
if player left chunk unload chunk
you are not actually growing wheat
then this replacing it with a diamond block is pointless
and add ifs system.time > time + 1000000 after on load chunk set crops
if the chunk is loaded it will grow naturally
for the test
this is not a good test
you need to grow the wheat not replace it with a diamond block.
this code will work then
i have custom crops system
i don't use all wheat stages
so i need check some crop stages
i will show u 1m