Contents
Class SingletonBlackboardViewManager<View extends IBlackboardView<View>>
java.lang.Object
com.hypixel.hytale.server.npc.blackboard.view.SingletonBlackboardViewManager<View>
- All Implemented Interfaces:
IBlackboardViewManager<View>
public class SingletonBlackboardViewManager<View extends IBlackboardView<View>>
extends Object
implements IBlackboardViewManager<View>
A singleton blackboard view manager for view types that only need a single instance across the whole world.
Created on 26/09/2018
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Clean up viewsvoidclear()Clear all views storedvoidforEachView(Consumer<View> consumer) Run a consumer on each view, mostly for debugging purposesget(int chunkX, int chunkZ, Blackboard blackboard) Fetch the blackboard view, or create it if it doesn't exist yetget(long index, Blackboard blackboard) Fetch the blackboard view, or create it if it doesn't exist yetget(Ref<EntityStore> ref, Blackboard blackboard, ComponentAccessor<EntityStore> componentAccessor) Fetch the blackboard view, or create it if it doesn't exist yetget(org.joml.Vector3d position, Blackboard blackboard) Fetch the blackboard view, or create it if it doesn't exist yetgetIfExists(long index) Fetch the blackboard view only if it already existsvoidHandle any final cleanup when the world is removed
-
Constructor Details
-
SingletonBlackboardViewManager
-
-
Method Details
-
get
public View get(Ref<EntityStore> ref, Blackboard blackboard, ComponentAccessor<EntityStore> componentAccessor) Description copied from interface:IBlackboardViewManagerFetch the blackboard view, or create it if it doesn't exist yet- Specified by:
getin interfaceIBlackboardViewManager<View extends IBlackboardView<View>>- Parameters:
ref- the entity accessing the viewblackboard- the main blackboardcomponentAccessor-- Returns:
- the associated blackboard view
-
get
Description copied from interface:IBlackboardViewManagerFetch the blackboard view, or create it if it doesn't exist yet- Specified by:
getin interfaceIBlackboardViewManager<View extends IBlackboardView<View>>- Parameters:
position- positional data for deciding on the blackboard viewblackboard- the main blackboard- Returns:
- the associated blackboard view
-
get
Description copied from interface:IBlackboardViewManagerFetch the blackboard view, or create it if it doesn't exist yet- Specified by:
getin interfaceIBlackboardViewManager<View extends IBlackboardView<View>>- Parameters:
chunkX- a chunk x coordinate for determining the viewchunkZ- a chunk z coordinate for determining the viewblackboard- the main blackboard- Returns:
- the associated blackboard view
-
get
Description copied from interface:IBlackboardViewManagerFetch the blackboard view, or create it if it doesn't exist yet- Specified by:
getin interfaceIBlackboardViewManager<View extends IBlackboardView<View>>- Parameters:
index- to use for determining the view, the computation for said index being dependent on the view class implementationblackboard- the main blackboard- Returns:
- the associated blackboard view
-
getIfExists
Description copied from interface:IBlackboardViewManagerFetch the blackboard view only if it already exists- Specified by:
getIfExistsin interfaceIBlackboardViewManager<View extends IBlackboardView<View>>- Parameters:
index- to use for determining the view, the computation for said index being dependent on the view class implementation- Returns:
- the associated blackboard view or null if it doesn't exist
-
cleanup
public void cleanup()Description copied from interface:IBlackboardViewManagerClean up views- Specified by:
cleanupin interfaceIBlackboardViewManager<View extends IBlackboardView<View>>
-
onWorldRemoved
public void onWorldRemoved()Description copied from interface:IBlackboardViewManagerHandle any final cleanup when the world is removed- Specified by:
onWorldRemovedin interfaceIBlackboardViewManager<View extends IBlackboardView<View>>
-
forEachView
Description copied from interface:IBlackboardViewManagerRun a consumer on each view, mostly for debugging purposes- Specified by:
forEachViewin interfaceIBlackboardViewManager<View extends IBlackboardView<View>>- Parameters:
consumer- the consumer to run
-
clear
public void clear()Description copied from interface:IBlackboardViewManagerClear all views stored- Specified by:
clearin interfaceIBlackboardViewManager<View extends IBlackboardView<View>>
-