Class VisitorManager
java.lang.Object
com.minecolonies.core.colony.managers.VisitorManager
- All Implemented Interfaces:
IEntityManager,IVisitorManager
Manages all visiting entities to the colony
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidClear dirty from all buildings.Creates Civilian Data for a new civiliangetCivilian(int citizenId) Get civilian by ID.@NotNull Map<Integer,ICivilianData> Returns a map of civilian in the colony.<T extends IVisitorData>
TgetVisitor(int citizenId) Gets the visitor data for the given citizenvoidMarks civilian data dirty.voidonColonyTick(IColony colony) Actions to execute on a colony tick.voidread(@NotNull net.minecraft.nbt.CompoundTag compound) Read the civilian from nbt.voidregisterCivilian(AbstractCivilianEntity visitor) Register a civilian entity with the colonyvoidremoveCivilian(@NotNull ICivilianData citizen) Removes a civilian from the colony.voidsendPackets(@NotNull Set<net.minecraft.server.level.ServerPlayer> closeSubscribers, @NotNull Set<net.minecraft.server.level.ServerPlayer> newSubscribers) Sends packages to update the civilian.<T extends ICivilianData>
TspawnOrCreateCivilian(T data, net.minecraft.world.level.Level world, List<net.minecraft.core.BlockPos> spawnPositions, boolean force) Spawns a civilian with the specific civilian data.voidUnregiters a civilian with the colonyvoidwrite(@NotNull net.minecraft.nbt.CompoundTag compoundNBT) Write the civilian to nbt.
-
Field Details
-
TAG_VISIT_MANAGER
NBT Tags -
TAG_VISITORS
-
TAG_NEXTID
-
-
Constructor Details
-
VisitorManager
-
-
Method Details
-
registerCivilian
Description copied from interface:IEntityManagerRegister a civilian entity with the colony- Specified by:
registerCivilianin interfaceIEntityManager- Parameters:
visitor- civilian to register
-
unregisterCivilian
Description copied from interface:IEntityManagerUnregiters a civilian with the colony- Specified by:
unregisterCivilianin interfaceIEntityManager- Parameters:
entity- civilian to unregister
-
read
public void read(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Description copied from interface:IEntityManagerRead the civilian from nbt.- Specified by:
readin interfaceIEntityManager- Parameters:
compound- the compound to read it from.
-
write
public void write(@NotNull @NotNull net.minecraft.nbt.CompoundTag compoundNBT) Description copied from interface:IEntityManagerWrite the civilian to nbt.- Specified by:
writein interfaceIEntityManager- Parameters:
compoundNBT- the compound to write it to.
-
sendPackets
public void sendPackets(@NotNull @NotNull Set<net.minecraft.server.level.ServerPlayer> closeSubscribers, @NotNull @NotNull Set<net.minecraft.server.level.ServerPlayer> newSubscribers) Description copied from interface:IEntityManagerSends packages to update the civilian.- Specified by:
sendPacketsin interfaceIEntityManager- Parameters:
closeSubscribers- the existing subscribers.newSubscribers- new subscribers
-
getCivilianDataMap
Description copied from interface:IEntityManagerReturns a map of civilian in the colony. The map has ID as key, and civilian data as value.- Specified by:
getCivilianDataMapin interfaceIEntityManager- Returns:
- Map of civilian in the colony, with as key the civilian ID, and as value the civilian data.
-
getCivilian
Description copied from interface:IEntityManagerGet civilian by ID.- Specified by:
getCivilianin interfaceIEntityManager- Parameters:
citizenId- ID of the civilian.- Returns:
- ICivilianData associated with the ID, or null if it was not found.
-
getVisitor
Description copied from interface:IVisitorManagerGets the visitor data for the given citizen- Specified by:
getVisitorin interfaceIVisitorManager- Type Parameters:
T- data type- Parameters:
citizenId- id to get data for- Returns:
- visitor data
-
spawnOrCreateCivilian
public <T extends ICivilianData> T spawnOrCreateCivilian(T data, net.minecraft.world.level.Level world, List<net.minecraft.core.BlockPos> spawnPositions, boolean force) Description copied from interface:IEntityManagerSpawns a civilian with the specific civilian data.- Specified by:
spawnOrCreateCivilianin interfaceIEntityManager- Parameters:
data- Data to use when spawn, null when new generation.world- THe world.spawnPositions- the positions to spawn it at, tried in order.force- True to skip max civilian test, false when not.- Returns:
- the new civilian.
-
createAndRegisterCivilianData
Description copied from interface:IEntityManagerCreates Civilian Data for a new civilian- Specified by:
createAndRegisterCivilianDatain interfaceIEntityManager- Returns:
- new ICivilianData
-
removeCivilian
Description copied from interface:IEntityManagerRemoves a civilian from the colony.- Specified by:
removeCivilianin interfaceIEntityManager- Parameters:
citizen- data to remove.
-
markDirty
public void markDirty()Description copied from interface:IEntityManagerMarks civilian data dirty.- Specified by:
markDirtyin interfaceIEntityManager
-
clearDirty
public void clearDirty()Description copied from interface:IEntityManagerClear dirty from all buildings.- Specified by:
clearDirtyin interfaceIEntityManager
-
onColonyTick
Description copied from interface:IEntityManagerActions to execute on a colony tick.- Specified by:
onColonyTickin interfaceIEntityManager- Parameters:
colony- the event.
-