java.lang.Object
com.minecolonies.core.colony.buildings.modules.expedition.ExpeditionLog

public class ExpeditionLog extends Object
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 Classes
    Modifier and Type
    Class
    Description
    static enum 
     
    static enum 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addLoot(@NotNull List<net.minecraft.world.item.ItemStack> loot)
    Adds a list of resources to this expedition.
    void
    addMob(@NotNull net.minecraft.world.entity.EntityType<?> mobType)
    Adds a mob to the interaction list of this expedition.
    void
    deserialize(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf)
    Reload from network
    void
    deserializeNBT(net.minecraft.core.HolderLookup.Provider provider, @NotNull net.minecraft.nbt.CompoundTag compound)
    Reload from NBT
    List<net.minecraft.world.item.ItemStack>
    Reports the list of equipment currently in use on this expedition.
    int
    Reports the id of the citizen who is on this expedition, if any.
    Reports the resources gathered so far during this expedition.
    List<Tuple<net.minecraft.world.entity.EntityType<?>,Integer>>
    Reports the list and count of mobs interacted with (usually fought, but doesn't have to be) during this expedition.
    @Nullable String
    Reports the name of the citizen who is (or was) on this expedition, if any.
    double
    Reports the stats of the citizen.
    Reports the current status of the expedition
    void
    Resets the expedition log to prepare to start a new expedition.
    void
    serialize(@NotNull net.minecraft.network.RegistryFriendlyByteBuf buf)
    Save to network
    void
    serializeNBT(net.minecraft.core.HolderLookup.Provider provider, @NotNull net.minecraft.nbt.CompoundTag compound)
    Save to NBT
    void
    setCitizen(@Nullable AbstractEntityCitizen citizen)
    Captures and updates the stats and other info for the citizen currently on the expedition.
    void
    setEquipment(@NotNull List<net.minecraft.world.item.ItemStack> equipment)
    Captures and sets the list of equipment currently in use on this expedition.
    void
    Indicates that the citizen was killed while on the expedition (which ends it).
    void
    Sets the current status of the expedition

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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

      public ExpeditionLog.Status getStatus()
      Reports the current status of the expedition
      Returns:
      the current expedition status
    • setStatus

      public void setStatus(ExpeditionLog.Status status)
      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

      @Nullable public @Nullable String 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

      public double getStat(ExpeditionLog.StatType stat)
      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

      public void setCitizen(@Nullable @Nullable AbstractEntityCitizen citizen)
      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

      public List<net.minecraft.world.item.ItemStack> getEquipment()
      Reports the list of equipment currently in use on this expedition.
      Returns:
      the equipment list. Some stacks might be empty.
    • setEquipment

      public void setEquipment(@NotNull @NotNull List<net.minecraft.world.item.ItemStack> equipment)
      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

      public List<Tuple<net.minecraft.world.entity.EntityType<?>,Integer>> 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

      public List<ItemStorage> getLoot()
      Reports the resources gathered so far during this expedition.
      Returns:
      the list of resources, sorted highest-amount-first
    • addLoot

      public void addLoot(@NotNull @NotNull List<net.minecraft.world.item.ItemStack> loot)
      Adds a list of resources to this expedition.
      Parameters:
      loot - the additional resources gathered this round
    • serializeNBT

      public void serializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull net.minecraft.nbt.CompoundTag compound)
      Save to NBT
      Parameters:
      compound - target
    • deserializeNBT

      public void deserializeNBT(@NotNull net.minecraft.core.HolderLookup.Provider provider, @NotNull @NotNull net.minecraft.nbt.CompoundTag compound)
      Reload from NBT
      Parameters:
      compound - source
    • serialize

      public void serialize(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf)
      Save to network
      Parameters:
      buf - target
    • deserialize

      public void deserialize(@NotNull @NotNull net.minecraft.network.RegistryFriendlyByteBuf buf)
      Reload from network
      Parameters:
      buf - source