Interface IEntityManager
- All Known Subinterfaces:
ICitizenManager,IVisitorManager
- All Known Implementing Classes:
CitizenManager,VisitorManager
public interface IEntityManager
Manager interface for managing entities for a colony
-
Method Summary
Modifier and TypeMethodDescriptionvoidClear dirty from all buildings.Creates Civilian Data for a new civilian<T extends ICivilianData>
TgetCivilian(int civilianId) Get civilian by ID.@NotNull Map<Integer, ICivilianData> Returns a map of civilian in the colony.voidMarks civilian data dirty.voidonColonyTick(IColony colony) Actions to execute on a colony tick.voidread(net.minecraft.core.HolderLookup.Provider provider, @NotNull net.minecraft.nbt.CompoundTag compound) Read the civilian from nbt.voidRegister a civilian entity with the colonyvoidremoveCivilian(@NotNull ICivilianData civilian) 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(net.minecraft.core.HolderLookup.Provider provider, @NotNull net.minecraft.nbt.CompoundTag compoundNBT) Write the civilian to nbt.
-
Method Details
-
registerCivilian
Register a civilian entity with the colony- Parameters:
entity- civilian to register
-
unregisterCivilian
Unregiters a civilian with the colony- Parameters:
entity- civilian to unregister
-
read
void read(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Read the civilian from nbt.- Parameters:
compound- the compound to read it from.
-
write
void write(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull net.minecraft.nbt.CompoundTag compoundNBT) Write the civilian to nbt.- Parameters:
compoundNBT- the compound to write it to.
-
sendPackets
void sendPackets(@NotNull @NotNull Set<net.minecraft.server.level.ServerPlayer> closeSubscribers, @NotNull @NotNull Set<net.minecraft.server.level.ServerPlayer> newSubscribers) Sends packages to update the civilian.- Parameters:
closeSubscribers- the existing subscribers.newSubscribers- new subscribers
-
getCivilianDataMap
Returns a map of civilian in the colony. The map has ID as key, and civilian data as value.- Returns:
- Map of civilian in the colony, with as key the civilian ID, and as value the civilian data.
-
getCivilian
Get civilian by ID.- Parameters:
civilianId- ID of the civilian.- Returns:
- ICivilianData associated with the ID, or null if it was not found.
-
spawnOrCreateCivilian
<T extends ICivilianData> T spawnOrCreateCivilian(T data, net.minecraft.world.level.Level world, List<net.minecraft.core.BlockPos> spawnPositions, boolean force) Spawns a civilian with the specific civilian data.- 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
ICivilianData createAndRegisterCivilianData()Creates Civilian Data for a new civilian- Returns:
- new ICivilianData
-
removeCivilian
Removes a civilian from the colony.- Parameters:
civilian- data to remove.
-
markDirty
void markDirty()Marks civilian data dirty. -
clearDirty
void clearDirty()Clear dirty from all buildings. -
onColonyTick
Actions to execute on a colony tick.- Parameters:
colony- the event.
-