Search in sources :

Example 16 with Skill

use of com.minecolonies.api.entity.citizen.Skill in project minecolonies by ldtteam.

the class CitizenSkillHandler method write.

@NotNull
@Override
public CompoundNBT write() {
    final CompoundNBT compoundNBT = new CompoundNBT();
    @NotNull final ListNBT levelTagList = new ListNBT();
    for (@NotNull final Map.Entry<Skill, Tuple<Integer, Double>> entry : skillMap.entrySet()) {
        if (entry.getKey() != null && entry.getValue() != null) {
            @NotNull final CompoundNBT levelCompound = new CompoundNBT();
            levelCompound.putInt(TAG_SKILL, entry.getKey().ordinal());
            levelCompound.putInt(TAG_LEVEL, entry.getValue().getA());
            levelCompound.putDouble(TAG_EXPERIENCE, entry.getValue().getB());
            levelTagList.add(levelCompound);
        }
    }
    compoundNBT.put(TAG_LEVEL_MAP, levelTagList);
    return compoundNBT;
}
Also used : ListNBT(net.minecraft.nbt.ListNBT) Skill(com.minecolonies.api.entity.citizen.Skill) CompoundNBT(net.minecraft.nbt.CompoundNBT) NotNull(org.jetbrains.annotations.NotNull) ImmutableMap(com.google.common.collect.ImmutableMap) HashMap(java.util.HashMap) Map(java.util.Map) Tuple(net.minecraft.util.Tuple) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Skill (com.minecolonies.api.entity.citizen.Skill)16 Text (com.ldtteam.blockout.controls.Text)6 Pane (com.ldtteam.blockout.Pane)4 ICitizenData (com.minecolonies.api.colony.ICitizenData)4 WorkerBuildingModuleView (com.minecolonies.coremod.colony.buildings.moduleviews.WorkerBuildingModuleView)4 Map (java.util.Map)4 CompoundNBT (net.minecraft.nbt.CompoundNBT)4 ListNBT (net.minecraft.nbt.ListNBT)4 Tuple (net.minecraft.util.Tuple)4 NotNull (org.jetbrains.annotations.NotNull)4 ImmutableMap (com.google.common.collect.ImmutableMap)2 TextBuilder (com.ldtteam.blockout.controls.AbstractTextBuilder.TextBuilder)2 Button (com.ldtteam.blockout.controls.Button)2 Image (com.ldtteam.blockout.controls.Image)2 ScrollingList (com.ldtteam.blockout.views.ScrollingList)2 ICitizenDataView (com.minecolonies.api.colony.ICitizenDataView)2 IBuilding (com.minecolonies.api.colony.buildings.IBuilding)2 IBuildingView (com.minecolonies.api.colony.buildings.views.IBuildingView)2 JobEntry (com.minecolonies.api.colony.jobs.registry.JobEntry)2 WorkerBuildingModule (com.minecolonies.coremod.colony.buildings.modules.WorkerBuildingModule)2