package dev.zontreck.otemod.antigrief; import java.util.ArrayList; import java.util.List; import java.util.concurrent.BlockingQueue; import dev.zontreck.libzontreck.vectors.WorldPosition; import dev.zontreck.otemod.OTEMod; import net.minecraft.server.level.ServerLevel; import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; public class HealerWorker implements Runnable { private List proc; public boolean alive=false; // These are the public boolean doTick = false; public Thread MyThread; private boolean skipWait; public int Pass; // A local pass for this worker public HealerWorker(List toProcess) { // TODO: Make this a individualized heal worker that does the task of the current HealerManager, but with a central list of positions for de-duplication. But that a second worker would not process the same positions // The goal is to have a worker so a second explosion elsewhere does not reset the entire thing for (StoredBlock sBlock : toProcess) { if(!sBlock.claimed()) // Checks if a thread has been set on this storage block yet or not. This data does not get serialized. sBlock.setClaimed(); // We are not yet in a new thread but we know we will be soon. } proc = toProcess; } @Override public void run() { alive=true; MyThread=Thread.currentThread(); HealerQueue.ManagerInstance.registerWorker(this); OTEMod.LOGGER.info("Hello from Healer Worker "+Thread.currentThread().getName()); for(int i=0;i