#i mean i try this code

1 messages · Page 1 of 1 (latest)

solemn lark
#
    @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

mental anchor
#

if the chunk is loaded that code never runs

solemn lark
#

why ?

#

wdym for chunk is loaded

mental anchor
#

if you log out and back in the chunk doesn;t unload

solemn lark
#

so i need method for unload chunk ?

mental anchor
#

your original request was to grow wheat for the time the chunk was unloaded.

solemn lark
#

example
if player left chunk unload chunk

mental anchor
#

you are not actually growing wheat

solemn lark
#

ah actually i will do

#

check chunk time with pdc and unix time

mental anchor
#

then this replacing it with a diamond block is pointless

solemn lark
#

and add ifs system.time > time + 1000000 after on load chunk set crops

mental anchor
#

if the chunk is loaded it will grow naturally

mental anchor
#

this is not a good test

solemn lark
#

let give me a time for do my code

#

then please close my mistakes

mental anchor
#

you need to grow the wheat not replace it with a diamond block.

#

this code will work then

solemn lark
#

i have custom crops system

#

i don't use all wheat stages

#

so i need check some crop stages

#

i will show u 1m

mental anchor
#

I don;t need to see

#

you need a method that grows wheat

#

you then call that method with the length of time that has passed

solemn lark
#

i will do

#

let give me a time