Search in sources :

Example 1 with TAG_CITIZENS

use of com.minecolonies.api.util.constant.NbtTagConstants.TAG_CITIZENS in project minecolonies by ldtteam.

the class CitizenManager method write.

@Override
public void write(@NotNull final CompoundNBT compoundNBT) {
    @NotNull final ListNBT citizenTagList = citizens.values().stream().map(citizen -> citizen.serializeNBT()).collect(NBTUtils.toListNBT());
    compoundNBT.put(TAG_CITIZENS, citizenTagList);
}
Also used : java.util(java.util) LanguageHandler(com.ldtteam.structurize.util.LanguageHandler) ALL_CITIZENS_ARE_SLEEPING(com.minecolonies.api.util.constant.TranslationConstants.ALL_CITIZENS_ARE_SLEEPING) BedHandlingModule(com.minecolonies.coremod.colony.buildings.modules.BedHandlingModule) Constants(net.minecraftforge.common.util.Constants) CompoundNBT(net.minecraft.nbt.CompoundNBT) ICitizenData(com.minecolonies.api.colony.ICitizenData) Function(java.util.function.Function) MinecoloniesAPIProxy(com.minecolonies.api.MinecoloniesAPIProxy) CitizenData(com.minecolonies.coremod.colony.CitizenData) LivingBuildingModule(com.minecolonies.coremod.colony.buildings.modules.LivingBuildingModule) Network(com.minecolonies.coremod.Network) ICitizenDataManager(com.minecolonies.api.colony.ICitizenDataManager) EntityUtils(com.minecolonies.api.util.EntityUtils) ICitizenManager(com.minecolonies.api.colony.managers.interfaces.ICitizenManager) CitizenSpawnedEvent(com.minecolonies.coremod.colony.colonyEvents.citizenEvents.CitizenSpawnedEvent) Constants(com.minecolonies.api.util.constant.Constants) ColonyViewRemoveCitizenMessage(com.minecolonies.coremod.network.messages.client.colony.ColonyViewRemoveCitizenMessage) ListNBT(net.minecraft.nbt.ListNBT) Entity(net.minecraft.entity.Entity) AbstractAssignedCitizenModule(com.minecolonies.coremod.colony.buildings.modules.AbstractAssignedCitizenModule) CITIZEN_CAP(com.minecolonies.api.research.util.ResearchConstants.CITIZEN_CAP) Colony(com.minecolonies.coremod.colony.Colony) WorkAtHomeBuildingModule(com.minecolonies.coremod.colony.buildings.modules.WorkAtHomeBuildingModule) World(net.minecraft.world.World) ModEntities(com.minecolonies.api.entity.ModEntities) JobUndertaker(com.minecolonies.coremod.colony.jobs.JobUndertaker) BlockPos(net.minecraft.util.math.BlockPos) Collectors(java.util.stream.Collectors) AbstractCivilianEntity(com.minecolonies.api.entity.citizen.AbstractCivilianEntity) ICivilianData(com.minecolonies.api.colony.ICivilianData) Nullable(org.jetbrains.annotations.Nullable) AbstractEntityCitizen(com.minecolonies.api.entity.citizen.AbstractEntityCitizen) MineColonies(com.minecolonies.coremod.MineColonies) EntityCitizen(com.minecolonies.coremod.entity.citizen.EntityCitizen) IBuilding(com.minecolonies.api.colony.buildings.IBuilding) NBTUtils(com.minecolonies.api.util.NBTUtils) IColony(com.minecolonies.api.colony.IColony) AbstractJobGuard(com.minecolonies.coremod.colony.jobs.AbstractJobGuard) ColonyViewCitizenViewMessage(com.minecolonies.coremod.network.messages.client.colony.ColonyViewCitizenViewMessage) TAG_CITIZENS(com.minecolonies.api.util.constant.NbtTagConstants.TAG_CITIZENS) COM_MINECOLONIES_COREMOD_MOURN(com.minecolonies.api.util.constant.TranslationConstants.COM_MINECOLONIES_COREMOD_MOURN) TAG_ID(com.minecolonies.api.util.constant.NbtTagConstants.TAG_ID) WorldUtil(com.minecolonies.api.util.WorldUtil) NotNull(org.jetbrains.annotations.NotNull) ServerPlayerEntity(net.minecraft.entity.player.ServerPlayerEntity) ListNBT(net.minecraft.nbt.ListNBT) NotNull(org.jetbrains.annotations.NotNull)

Example 2 with TAG_CITIZENS

use of com.minecolonies.api.util.constant.NbtTagConstants.TAG_CITIZENS in project minecolonies by Minecolonies.

the class CitizenManager method writeToNBT.

@Override
public void writeToNBT(@NotNull final NBTTagCompound compound) {
    compound.setInteger(TAG_MAX_CITIZENS, maxCitizens);
    @NotNull final NBTTagList citizenTagList = citizens.values().stream().map(citizen -> citizen.writeToNBT(new NBTTagCompound())).collect(NBTUtils.toNBTTagList());
    compound.setTag(TAG_CITIZENS, citizenTagList);
}
Also used : NBTTagList(net.minecraft.nbt.NBTTagList) java.util(java.util) ColonyUtils(com.minecolonies.coremod.util.ColonyUtils) TAG_MAX_CITIZENS(com.minecolonies.api.util.constant.NbtTagConstants.TAG_MAX_CITIZENS) Constants(net.minecraftforge.common.util.Constants) Function(java.util.function.Function) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) CitizenData(com.minecolonies.coremod.colony.CitizenData) EntityCitizen(com.minecolonies.coremod.entity.EntityCitizen) NBTTagList(net.minecraft.nbt.NBTTagList) EntityUtils(com.minecolonies.api.util.EntityUtils) Log(com.minecolonies.api.util.Log) Constants(com.minecolonies.api.util.constant.Constants) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) LanguageHandler(com.minecolonies.api.util.LanguageHandler) Colony(com.minecolonies.coremod.colony.Colony) World(net.minecraft.world.World) ColonyViewRemoveCitizenMessage(com.minecolonies.coremod.network.messages.ColonyViewRemoveCitizenMessage) BlockPos(net.minecraft.util.math.BlockPos) Collectors(java.util.stream.Collectors) com.minecolonies.coremod.colony.buildings(com.minecolonies.coremod.colony.buildings) Nullable(org.jetbrains.annotations.Nullable) MineColonies(com.minecolonies.coremod.MineColonies) ColonyConstants(com.minecolonies.api.util.constant.ColonyConstants) NBTUtils(com.minecolonies.api.util.NBTUtils) ColonyViewCitizenViewMessage(com.minecolonies.coremod.network.messages.ColonyViewCitizenViewMessage) TAG_CITIZENS(com.minecolonies.api.util.constant.NbtTagConstants.TAG_CITIZENS) TickEvent(net.minecraftforge.fml.common.gameevent.TickEvent) NotNull(org.jetbrains.annotations.NotNull) Configurations(com.minecolonies.api.configuration.Configurations) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with TAG_CITIZENS

use of com.minecolonies.api.util.constant.NbtTagConstants.TAG_CITIZENS in project minecolonies by Minecolonies.

the class CitizenManager method write.

@Override
public void write(@NotNull final CompoundNBT compoundNBT) {
    @NotNull final ListNBT citizenTagList = citizens.values().stream().map(citizen -> citizen.serializeNBT()).collect(NBTUtils.toListNBT());
    compoundNBT.put(TAG_CITIZENS, citizenTagList);
}
Also used : java.util(java.util) BedHandlingModule(com.minecolonies.coremod.colony.buildings.modules.BedHandlingModule) Constants(net.minecraftforge.common.util.Constants) CompoundNBT(net.minecraft.nbt.CompoundNBT) ICitizenData(com.minecolonies.api.colony.ICitizenData) Function(java.util.function.Function) MinecoloniesAPIProxy(com.minecolonies.api.MinecoloniesAPIProxy) CitizenData(com.minecolonies.coremod.colony.CitizenData) LivingBuildingModule(com.minecolonies.coremod.colony.buildings.modules.LivingBuildingModule) Network(com.minecolonies.coremod.Network) ICitizenDataManager(com.minecolonies.api.colony.ICitizenDataManager) EntityUtils(com.minecolonies.api.util.EntityUtils) ICitizenManager(com.minecolonies.api.colony.managers.interfaces.ICitizenManager) CitizenSpawnedEvent(com.minecolonies.coremod.colony.colonyEvents.citizenEvents.CitizenSpawnedEvent) Constants(com.minecolonies.api.util.constant.Constants) ColonyViewRemoveCitizenMessage(com.minecolonies.coremod.network.messages.client.colony.ColonyViewRemoveCitizenMessage) ListNBT(net.minecraft.nbt.ListNBT) Entity(net.minecraft.entity.Entity) TranslationConstants(com.minecolonies.api.util.constant.TranslationConstants) MessageUtils(com.minecolonies.api.util.MessageUtils) AbstractAssignedCitizenModule(com.minecolonies.coremod.colony.buildings.modules.AbstractAssignedCitizenModule) CITIZEN_CAP(com.minecolonies.api.research.util.ResearchConstants.CITIZEN_CAP) Colony(com.minecolonies.coremod.colony.Colony) WorkAtHomeBuildingModule(com.minecolonies.coremod.colony.buildings.modules.WorkAtHomeBuildingModule) World(net.minecraft.world.World) ModEntities(com.minecolonies.api.entity.ModEntities) JobUndertaker(com.minecolonies.coremod.colony.jobs.JobUndertaker) BlockPos(net.minecraft.util.math.BlockPos) Collectors(java.util.stream.Collectors) AbstractCivilianEntity(com.minecolonies.api.entity.citizen.AbstractCivilianEntity) ICivilianData(com.minecolonies.api.colony.ICivilianData) Nullable(org.jetbrains.annotations.Nullable) AbstractEntityCitizen(com.minecolonies.api.entity.citizen.AbstractEntityCitizen) MineColonies(com.minecolonies.coremod.MineColonies) EntityCitizen(com.minecolonies.coremod.entity.citizen.EntityCitizen) IBuilding(com.minecolonies.api.colony.buildings.IBuilding) NBTUtils(com.minecolonies.api.util.NBTUtils) IColony(com.minecolonies.api.colony.IColony) AbstractJobGuard(com.minecolonies.coremod.colony.jobs.AbstractJobGuard) ColonyViewCitizenViewMessage(com.minecolonies.coremod.network.messages.client.colony.ColonyViewCitizenViewMessage) TAG_CITIZENS(com.minecolonies.api.util.constant.NbtTagConstants.TAG_CITIZENS) TAG_ID(com.minecolonies.api.util.constant.NbtTagConstants.TAG_ID) WorldUtil(com.minecolonies.api.util.WorldUtil) NotNull(org.jetbrains.annotations.NotNull) ServerPlayerEntity(net.minecraft.entity.player.ServerPlayerEntity) ListNBT(net.minecraft.nbt.ListNBT) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

EntityUtils (com.minecolonies.api.util.EntityUtils)3 NBTUtils (com.minecolonies.api.util.NBTUtils)3 Constants (com.minecolonies.api.util.constant.Constants)3 TAG_CITIZENS (com.minecolonies.api.util.constant.NbtTagConstants.TAG_CITIZENS)3 MineColonies (com.minecolonies.coremod.MineColonies)3 CitizenData (com.minecolonies.coremod.colony.CitizenData)3 Colony (com.minecolonies.coremod.colony.Colony)3 java.util (java.util)3 Function (java.util.function.Function)3 Collectors (java.util.stream.Collectors)3 BlockPos (net.minecraft.util.math.BlockPos)3 World (net.minecraft.world.World)3 Constants (net.minecraftforge.common.util.Constants)3 NotNull (org.jetbrains.annotations.NotNull)3 Nullable (org.jetbrains.annotations.Nullable)3 MinecoloniesAPIProxy (com.minecolonies.api.MinecoloniesAPIProxy)2 ICitizenData (com.minecolonies.api.colony.ICitizenData)2 ICitizenDataManager (com.minecolonies.api.colony.ICitizenDataManager)2 ICivilianData (com.minecolonies.api.colony.ICivilianData)2 IColony (com.minecolonies.api.colony.IColony)2