LZ-17: Add initial block restore queue registry, and a registration event

This commit is contained in:
zontreck 2024-04-11 01:21:13 -07:00
parent 3302ab14b8
commit c03261fd7a
2 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,17 @@
package dev.zontreck.libzontreck.events;
import dev.zontreck.libzontreck.memory.world.BlockRestoreQueue;
import dev.zontreck.libzontreck.memory.world.BlockRestoreQueueRegistry;
import net.minecraftforge.eventbus.api.Event;
public class BlockRestoreQueueRegistrationEvent extends Event
{
/**
* Registers the provided queue to be able to be ticked
* @param queue
*/
public void register(BlockRestoreQueue queue)
{
BlockRestoreQueueRegistry.addQueue(queue);
}
}

View file

@ -0,0 +1,21 @@
package dev.zontreck.libzontreck.memory.world;
import java.util.*;
/**
* DANGER: DO NOT USE THIS CLASS DIRECTLY
*/
public class BlockRestoreQueueRegistry
{
private static Map<String, BlockRestoreQueue> QUEUES = new HashMap<>();
/**
* Internal use only
*
* @see dev.zontreck.libzontreck.events.BlockRestoreQueueRegistrationEvent
* @param queue The queue to register
*/
public static void addQueue(BlockRestoreQueue queue) {
QUEUES.put(queue.getRestoreQueueName(), queue);
}
}