use of net.minecraft.stats.StatFileWriter in project malmo by Microsoft.
the class JSONWorldDataHelper method buildAchievementStats.
/** Builds the basic achievement world data to be used as observation signals by the listener.
* @param json a JSON object into which the achievement stats will be added.
*/
public static void buildAchievementStats(JsonObject json, EntityPlayerMP player) {
StatFileWriter sfw = player.getStatFile();
json.addProperty("DistanceTravelled", sfw.readStat((StatBase) StatList.distanceWalkedStat) + sfw.readStat((StatBase) StatList.distanceSwumStat) + sfw.readStat((StatBase) StatList.distanceDoveStat) + sfw.readStat((StatBase) StatList.distanceFallenStat));
// TODO: there are many other ways of moving!
json.addProperty("TimeAlive", sfw.readStat((StatBase) StatList.timeSinceDeathStat));
json.addProperty("MobsKilled", sfw.readStat((StatBase) StatList.mobKillsStat));
json.addProperty("PlayersKilled", sfw.readStat((StatBase) StatList.playerKillsStat));
json.addProperty("DamageTaken", sfw.readStat((StatBase) StatList.damageTakenStat));
/* Other potential reinforcement signals that may be worth researching:
json.addProperty("BlocksDestroyed", sfw.readStat((StatBase)StatList.objectBreakStats) - but objectBreakStats is an array of 32000 StatBase objects - indexed by block type.);
json.addProperty("Blocked", ev.player.isMovementBlocked()) - but isMovementBlocker() is a protected method (can get round this with reflection)
*/
}
Aggregations