Class PowerBlockManager
java.lang.Object
nl.pim16aap2.animatedarchitecture.core.api.restartable.Restartable
nl.pim16aap2.animatedarchitecture.core.managers.PowerBlockManager
- All Implemented Interfaces:
IRestartable, StructureDeletionManager.IDeletionListener
@Singleton
public final class PowerBlockManager
extends Restartable
implements StructureDeletionManager.IDeletionListener
Manages all power block interactions.
-
Method Summary
Modifier and TypeMethodDescriptionvoidinvalidateChunk(String worldName, Vector2Di chunk) Invalidates the cache of a chunk in a world.voidinvalidateChunkAt(String worldName, Vector3Di pos) Invalidates the cache for a chunk that contains a position.booleanisAnimatedArchitectureWorld(String worldName) Checks if a world is a AnimatedArchitecture world.voidLoads a world.voidonStructureDeletion(IStructureConst structure) Called when a structure is deleted.voidshutDown()Handles a shutdown.structuresFromPowerBlockLoc(ILocation location) Gets allStructures that have a powerblock at a location in a world.structuresFromPowerBlockLoc(Vector3Di loc, String worldName) Gets allStructures that have a powerblock at a location in a world.structuresFromPowerBlockLoc(Vector3Di loc, IWorld world) Gets allStructures that have a powerblock at a location in a world.structuresInChunk(Vector3Di loc, String worldName) Retrieves all structures whose powerblocks exist in the same chunk as a given location.voidunloadWorld(String worldName) Unloads a world from the cache.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IRestartable
initialize
-
Method Details
-
unloadWorld
Unloads a world from the cache.- Parameters:
worldName- The name of the world to unload.
-
loadWorld
Loads a world.- Parameters:
worldName- The name of the world.
-
structuresFromPowerBlockLoc
-
structuresFromPowerBlockLoc
-
structuresFromPowerBlockLoc
public CompletableFuture<List<Structure>> structuresFromPowerBlockLoc(Vector3Di loc, String worldName) Gets allStructures that have a powerblock at a location in a world.- Parameters:
loc- The location.worldName- The name of the world.- Returns:
- All
Structures that have a powerblock at a location in a world.
-
structuresInChunk
Retrieves all structures whose powerblocks exist in the same chunk as a given location.- Parameters:
loc- The location.worldName- The name of the world to search in.- Returns:
- The UIDs of the structures that whose powerblocks lie in the same chunk as the location.
-
isAnimatedArchitectureWorld
Checks if a world is a AnimatedArchitecture world. In other words, it checks if a world contains more than 0 structures.- Parameters:
worldName- The name of the world.- Returns:
- True if the world contains at least 1 structure.
-
invalidateChunkAt
-
invalidateChunk
-
shutDown
public void shutDown()Description copied from interface:IRestartableHandles a shutdown.- Specified by:
shutDownin interfaceIRestartable
-
onStructureDeletion
Description copied from interface:StructureDeletionManager.IDeletionListenerCalled when a structure is deleted.- Specified by:
onStructureDeletionin interfaceStructureDeletionManager.IDeletionListener- Parameters:
structure- The structure that was deleted.
-