Error removing itementity on thread

Server background error when removing ItemEntity on thread
But item entities can be removed normally
Can you help me see why?!

There is an error in this line of code
Can’t I manipulate entities on threads?

So the Minecraft world is not thread safe. This means reading or writing to the world in anyway on something other then the servers thread can not be done. Hence your error. Take async() out and it should work.

You will find that most of minecraft is connected to the world, off the top of my head only chat is thread safe.

If you really need to use another thread to modify the world then take a look at projects such as LanternPowered (SpongeAPi) and Glowstone(BukkitAPi) that are minecraft servers from none mojang code

Sorry, I didn’t understand you

So the word “async” (short for “asymmetrical” “Asynchronous”) is where - in code - the specified block of code will run on another thread.
A thread is a section of code that needs to be ran, however this can be ran on another core of the processor. This essentially means that if you run your code on another thread then the code will run at the same time as your other code.

Minecraft does not like this. Minecraft wants to have all the changes done in a order instead of the same time. This means that you can not use the “.async()” function inside your scheduler when interacting with the minecraft world. So by removing that bit of your code, it will work.

It won’t work if I don’t use. Async()

Why wont it work if you dont use .async?
Because as i have mentioned. It wont work with it

Not to nitpick, but for sake of ensuring information is correct.
“asyc” would be short for “Asynchronous”

Thanks. Must have been autocorrect