Yo sup pmmp Devs, just wanted to ask how i can get all the blocks on a Level or a Chunk of a Player doesnt matter for what im going to make but the loop for() because it will lag the server i guess. ty
And the for() loop lags the server because getting all blocks on a chunk lacks by nature. Now what do you want?
i wanna get all Blocks on a chunk a player and hide them when he's like 10blocks away from them (AntiXray :v) . and all what i need is getting the blocks
You don't do it like that. When chunks are sent to the player, change the chunk into 100% air except the 10 blocks around the player. When the player moves, refresh the 10 blocks range, send old far blocks as air and new nearby blocks as-is. I may try to make a proof of concept for this.
i didnt mean change all the Blocks onlt ores and i will use the UpdateBlocksPacket and yea i was just lazy to do it like that xD
im sure that we can register a new Tile but will all the Diamond Blocks in the Level be a Tile (im not sure of that) ?
You should iterate over all blocks rather than trying to get all blocks together. for() lags, and getting all blocks together will both lag and kill your memory. And this thread is in Facepalm because it duplicates many other threads asking the exact same question.