Code:
package com.jinrake.game.world.entity.mob.npc.anim;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import com.google.gson.Gson;
public class CachedAnimation {
public static HashMap<Integer, CachedAnimationDefinition> definitions = new HashMap<Integer, CachedAnimationDefinition>();
public static void loaddump() throws IOException {
FileReader reader = new FileReader(new File("./data/def/npc/possibleanimations.json"));
CachedAnimationDefinition[] defs = new Gson().fromJson(reader, CachedAnimationDefinition[].class);
for (CachedAnimationDefinition def : defs) {
definitions.put(def.id, def);
System.out.println("ID: "+def.id+" NAME: "+def.name+" ANIMS: "+def.attackBlockAnims.length);
}
reader.close();
}
/**
* rewrite original data file
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
loaddump();
}
public class CachedAnimationDefinition {
private int id;
private String name;
private int[] stanceAnims;
private int[] walkAnims;
private int[] attackBlockAnims;
private int[] deathAnims;
private int[] otherAnims;
public CachedAnimationDefinition() {
}
public CachedAnimationDefinition(final int id) {
this.id = id;
setDefault();
}
private void setDefault() {
}
}
}
Tnx 4 the dump this is a quick loader