Class ExpeditionLog
java.lang.Object
com.minecolonies.core.colony.buildings.modules.expedition.ExpeditionLog
This keeps track of an "expedition", which can be any worker that wanders off somewhere and gathers and fights.
It keeps track of the worker's health (and potentially other interesting stats), whatever equipment they're using
on the job, what mobs they're interacting with (fighting or otherwise), and any resources they've gathered along
the way. It is intended to be updated "live" while the expedition is in progress and then persist the final state
until the next expedition begins.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enum -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a list of resources to this expedition.voidaddMob(@NotNull net.minecraft.world.entity.EntityType<?> mobType) Adds a mob to the interaction list of this expedition.voiddeserialize(@NotNull net.minecraft.network.FriendlyByteBuf buf) Reload from networkvoiddeserializeNBT(@NotNull net.minecraft.nbt.CompoundTag compound) Reload from NBTList<net.minecraft.world.item.ItemStack>Reports the list of equipment currently in use on this expedition.intgetId()Reports the id of the citizen who is on this expedition, if any.getLoot()Reports the resources gathered so far during this expedition.getMobs()Reports the list and count of mobs interacted with (usually fought, but doesn't have to be) during this expedition.@Nullable StringgetName()Reports the name of the citizen who is (or was) on this expedition, if any.doubleReports the stats of the citizen.Reports the current status of the expeditionvoidreset()Resets the expedition log to prepare to start a new expedition.voidserialize(@NotNull net.minecraft.network.FriendlyByteBuf buf) Save to networkvoidserializeNBT(@NotNull net.minecraft.nbt.CompoundTag compound) Save to NBTvoidsetCitizen(@Nullable AbstractEntityCitizen citizen) Captures and updates the stats and other info for the citizen currently on the expedition.voidsetEquipment(@NotNull List<net.minecraft.world.item.ItemStack> equipment) Captures and sets the list of equipment currently in use on this expedition.voidIndicates that the citizen was killed while on the expedition (which ends it).voidsetStatus(ExpeditionLog.Status status) Sets the current status of the expedition
-
Constructor Details
-
ExpeditionLog
public ExpeditionLog()
-
-
Method Details
-
reset
public void reset()Resets the expedition log to prepare to start a new expedition. Only call this when the next expedition is actually about to begin, so that the player can see the results of the last expedition for as long as possible. -
getStatus
Reports the current status of the expedition- Returns:
- the current expedition status
-
setStatus
Sets the current status of the expedition- Parameters:
status- the new expedition status
-
getId
public int getId()Reports the id of the citizen who is on this expedition, if any.- Returns:
- the id, or 0 if there is no citizen or the citizen was killed.
-
getName
Reports the name of the citizen who is (or was) on this expedition, if any.- Returns:
- the name, or null if there is nobody. (does not reset when killed)
-
getStat
Reports the stats of the citizen.- Parameters:
stat- the stat to retrieve- Returns:
- the value of that stat (as of the latest update, not necessarily "live")
-
setCitizen
Captures and updates the stats and other info for the citizen currently on the expedition.- Parameters:
citizen- the citizen who is currently on the expedition
-
setKilled
public void setKilled()Indicates that the citizen was killed while on the expedition (which ends it). -
getEquipment
Reports the list of equipment currently in use on this expedition.- Returns:
- the equipment list. Some stacks might be empty.
-
setEquipment
Captures and sets the list of equipment currently in use on this expedition. Some stacks may be empty to indicate that there is no equipment in that "slot". It's up to the actual expedition to decide what equipment is interesting to show.- Parameters:
equipment- the list of equipment
-
getMobs
Reports the list and count of mobs interacted with (usually fought, but doesn't have to be) during this expedition.- Returns:
- the list of mobs and counts, sorted highest-count-first
-
addMob
public void addMob(@NotNull @NotNull net.minecraft.world.entity.EntityType<?> mobType) Adds a mob to the interaction list of this expedition.- Parameters:
mobType- the type of mob
-
getLoot
Reports the resources gathered so far during this expedition.- Returns:
- the list of resources, sorted highest-amount-first
-
addLoot
Adds a list of resources to this expedition.- Parameters:
loot- the additional resources gathered this round
-
serializeNBT
public void serializeNBT(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Save to NBT- Parameters:
compound- target
-
deserializeNBT
public void deserializeNBT(@NotNull @NotNull net.minecraft.nbt.CompoundTag compound) Reload from NBT- Parameters:
compound- source
-
serialize
public void serialize(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf) Save to network- Parameters:
buf- target
-
deserialize
public void deserialize(@NotNull @NotNull net.minecraft.network.FriendlyByteBuf buf) Reload from network- Parameters:
buf- source
-