use of org.asassecreations.engine.serializer.AField in project Voxel_Game by ASasseCreations.
the class PlayerSave method load.
public static final void load(final Player player) {
player.position.x = 8;
player.position.y = 120;
player.position.z = 8;
player.rotation = 25;
ChunkGenerator.init(new Random().nextLong());
Time.rawTime = .1f;
if (!new File(Content.WORLD_FOLDER + "Player.dat").exists())
return;
final ADatabase database = ADatabase.DeserializeFromFile(Content.WORLD_FOLDER + "Player.dat");
final AObject object = database.findObject("Player");
AField temp;
if ((temp = object.findField("x")) != null)
player.position.x = temp.getFloat();
if ((temp = object.findField("y")) != null)
player.position.y = temp.getFloat();
if ((temp = object.findField("z")) != null)
player.position.z = temp.getFloat();
if ((temp = object.findField("rotation")) != null)
player.rotation = temp.getFloat();
if ((temp = object.findField("seed")) != null)
ChunkGenerator.init(temp.getLong());
if ((temp = object.findField("time")) != null)
Time.rawTime = temp.getFloat();
temp = null;
}