Browse Source

Added id to workOrder

feature-workorder
MagicBot 1 year ago
parent
commit
a0066bce20
  1. 4
      src/engine/gameManager/ForgeManager.java
  2. 3
      src/engine/loot/WorkOrder.java

4
src/engine/gameManager/ForgeManager.java

@ -12,12 +12,14 @@ import engine.loot.WorkOrder;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.DelayQueue; import java.util.concurrent.DelayQueue;
import java.util.concurrent.atomic.AtomicInteger;
public enum ForgeManager implements Runnable { public enum ForgeManager implements Runnable {
FORGE_MANAGER; FORGE_MANAGER;
private BlockingQueue<WorkOrder> workQueue = new DelayQueue(); private final BlockingQueue<WorkOrder> workQueue = new DelayQueue();
public static final AtomicInteger workOrder = new AtomicInteger(0);
@Override @Override
public void run() { public void run() {

3
src/engine/loot/WorkOrder.java

@ -8,6 +8,7 @@
package engine.loot; package engine.loot;
import engine.gameManager.ForgeManager;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.concurrent.Delayed; import java.util.concurrent.Delayed;
@ -17,6 +18,7 @@ import static java.lang.Math.toIntExact;
public class WorkOrder implements Delayed { public class WorkOrder implements Delayed {
public int workOrder;
public int npcUUID; public int npcUUID;
public int slotCount; public int slotCount;
public int itemCount; public int itemCount;
@ -27,6 +29,7 @@ public class WorkOrder implements Delayed {
public WorkOrder() { public WorkOrder() {
this.workOrder = ForgeManager.workOrder.incrementAndGet();
this.completionTime = System.currentTimeMillis() + 10000; this.completionTime = System.currentTimeMillis() + 10000;
} }

Loading…
Cancel
Save