LZ-17: Add initial block restore queue registry, and a registration event
This commit is contained in:
parent
3302ab14b8
commit
c03261fd7a
2 changed files with 38 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
Reference in a new issue