Search in sources :

Example 11 with CitizenData

use of com.minecolonies.coremod.colony.CitizenData in project minecolonies by Minecolonies.

the class BuildingHome method readFromNBT.

@Override
public void readFromNBT(@NotNull final NBTTagCompound compound) {
    super.readFromNBT(compound);
    residents.clear();
    final int[] residentIds = compound.getIntArray(TAG_RESIDENTS);
    for (final int citizenId : residentIds) {
        final CitizenData citizen = getColony().getCitizen(citizenId);
        if (citizen != null) {
            // Bypass addResident (which marks dirty)
            residents.add(citizen);
            citizen.setHomeBuilding(this);
        }
    }
}
Also used : CitizenData(com.minecolonies.coremod.colony.CitizenData)

Aggregations

CitizenData (com.minecolonies.coremod.colony.CitizenData)11 BlockPos (net.minecraft.util.math.BlockPos)7 Colony (com.minecolonies.coremod.colony.Colony)5 EntityCitizen (com.minecolonies.coremod.entity.EntityCitizen)4 TextComponentString (net.minecraft.util.text.TextComponentString)4 NotNull (org.jetbrains.annotations.NotNull)3 AbstractBuildingWorker (com.minecolonies.coremod.colony.buildings.AbstractBuildingWorker)2 Nullable (org.jetbrains.annotations.Nullable)2 IColony (com.minecolonies.coremod.colony.IColony)1 AbstractBuilding (com.minecolonies.coremod.colony.buildings.AbstractBuilding)1 BuildingGuardTower (com.minecolonies.coremod.colony.buildings.BuildingGuardTower)1 BuildingTownHall (com.minecolonies.coremod.colony.buildings.BuildingTownHall)1 JobBuilder (com.minecolonies.coremod.colony.jobs.JobBuilder)1 ArrayList (java.util.ArrayList)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ITextComponent (net.minecraft.util.text.ITextComponent)1 Style (net.minecraft.util.text.Style)1 TextComponentTranslation (net.minecraft.util.text.TextComponentTranslation)1 ClickEvent (net.minecraft.util.text.event.ClickEvent)1 World (net.minecraft.world.World)1