/** * Gets a person's relation to the owner from the map. * * @param id The ID of the entity. * @return The relation of the entity with the provided ID. */ public EnumRelation getRelationOf(int id) { if (idIsRelative(id)) { EnumRelation returnRelation = relationMap.get(id); if (returnRelation.equals(EnumRelation.Greatgrandparent)) { if (id < 0) { WorldPropertiesManager manager = MCA.instance.playerWorldManagerMap.get( MCA.instance.getPlayerByID(owner.worldObj, id).username); if (manager.worldProperties.playerGender.equals("Male")) { return EnumRelation.Greatgrandfather; } else { return EnumRelation.Greatgrandmother; } } } else if (returnRelation.equals(EnumRelation.Grandparent)) { if (id < 0) { WorldPropertiesManager manager = MCA.instance.playerWorldManagerMap.get( MCA.instance.getPlayerByID(owner.worldObj, id).username); if (manager.worldProperties.playerGender.equals("Male")) { return EnumRelation.Grandfather; } else { return EnumRelation.Grandmother; } } } return relationMap.get(id); } else { return EnumRelation.None; } }
/** * Reads the entity's family tree from NBT. * * @param NBT The NBT object that reads information about the entity. */ public void readTreeFromNBT(NBTTagCompound NBT) { int counter = 0; while (true) { try { int entryID = NBT.getInteger("familyTreeEntryID" + counter); String entryRelation = NBT.getString("familyTreeEntryRelation" + counter); if (entryID == 0 && entryRelation.equals("")) { break; } else { relationMap.put(entryID, EnumRelation.getEnum(entryRelation)); counter++; } } catch (NullPointerException e) { break; } } }