Class ServerColonySaveData

java.lang.Object
net.minecraft.world.level.saveddata.SavedData
com.minecolonies.api.colony.savedata.ServerColonySaveData
All Implemented Interfaces:
IServerColonySaveData

public class ServerColonySaveData extends net.minecraft.world.level.saveddata.SavedData implements IServerColonySaveData
The implementation of the colonyTagCapability.
  • Nested Class Summary

    Nested classes/interfaces inherited from class net.minecraft.world.level.saveddata.SavedData

    net.minecraft.world.level.saveddata.SavedData.Factory<T extends net.minecraft.world.level.saveddata.SavedData>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.world.level.saveddata.SavedData.Factory<ServerColonySaveData>
    Worldsavedata factory.
    static final String
    World save data name.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add a new colony to the capability.
    createColony(@NotNull net.minecraft.server.level.ServerLevel w, @NotNull String name, @NotNull net.minecraft.core.BlockPos pos)
    Create a colony and return it.
    void
    deleteColony(int id)
    Delete a colony with a certain id.
    Get a list of all colonies.
    getColony(int id)
    Get a colony with a certain id.
    int
    Get the top most id of all colonies.
    boolean
     
    @NotNull net.minecraft.nbt.CompoundTag
    save(@NotNull net.minecraft.nbt.CompoundTag tag, net.minecraft.core.HolderLookup.Provider provider)
     
    setOverworld(boolean overworld)
    Set as overworld.

    Methods inherited from class net.minecraft.world.level.saveddata.SavedData

    save, setDirty, setDirty

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NAME

      public static final String NAME
      World save data name.
    • FACTORY

      public static final net.minecraft.world.level.saveddata.SavedData.Factory<ServerColonySaveData> FACTORY
      Worldsavedata factory.
  • Method Details

    • save

      @NotNull public @NotNull net.minecraft.nbt.CompoundTag save(@NotNull @NotNull net.minecraft.nbt.CompoundTag tag, @NotNull net.minecraft.core.HolderLookup.Provider provider)
      Specified by:
      save in class net.minecraft.world.level.saveddata.SavedData
    • createColony

      public IColony createColony(@NotNull @NotNull net.minecraft.server.level.ServerLevel w, @NotNull @NotNull String name, @NotNull @NotNull net.minecraft.core.BlockPos pos)
      Description copied from interface: IServerColonySaveData
      Create a colony and return it.
      Specified by:
      createColony in interface IServerColonySaveData
      Parameters:
      w - the world the colony is in.
      name - the name of the colony.
      pos - the position of the colony.
      Returns:
      the created colony.
    • deleteColony

      public void deleteColony(int id)
      Description copied from interface: IServerColonySaveData
      Delete a colony with a certain id.
      Specified by:
      deleteColony in interface IServerColonySaveData
      Parameters:
      id - the id of the colony.
    • getColony

      public IColony getColony(int id)
      Description copied from interface: IServerColonySaveData
      Get a colony with a certain id.
      Specified by:
      getColony in interface IServerColonySaveData
      Parameters:
      id - the id of the colony.
      Returns:
      the colony or null.
    • getColonies

      public List<IColony> getColonies()
      Description copied from interface: IServerColonySaveData
      Get a list of all colonies.
      Specified by:
      getColonies in interface IServerColonySaveData
      Returns:
      a complete list.
    • addColony

      public void addColony(IColony colony)
      Description copied from interface: IServerColonySaveData
      add a new colony to the capability.
      Specified by:
      addColony in interface IServerColonySaveData
      Parameters:
      colony - the colony to add.
    • getTopID

      public int getTopID()
      Description copied from interface: IServerColonySaveData
      Get the top most id of all colonies.
      Specified by:
      getTopID in interface IServerColonySaveData
      Returns:
      the top most id.
    • isDirty

      public boolean isDirty()
      Overrides:
      isDirty in class net.minecraft.world.level.saveddata.SavedData
    • setOverworld

      public IServerColonySaveData setOverworld(boolean overworld)
      Description copied from interface: IServerColonySaveData
      Set as overworld.
      Specified by:
      setOverworld in interface IServerColonySaveData
      Parameters:
      overworld - if overworld.
      Returns:
      itself.