pull/12/head
valoeghese 2020-02-28 21:05:58 +13:00
parent b7f25c72e4
commit c6fa5fe66d
2 changed files with 5 additions and 2 deletions

View File

@ -85,6 +85,7 @@ public final class LitecraftSave
DataSection playerData = data.get("player");
long seed = 0; // default seed if we cannot read it is 0
float playerX = 0, playerY = 0, playerZ = -3; // default player x/y/z
float playerYaw = 0.0f;
try // try read the seed from the file
{
seed = properties.readLong(0); // seed is at index 0
@ -93,7 +94,8 @@ public final class LitecraftSave
playerZ = playerData.readFloat(2);
Camera camera = Litecraft.getInstance().getCamera(); // get camera
camera.setPitch(playerData.readFloat(3)); // read pitch, yaw, roll from 3/4/5
camera.setYaw(playerData.readFloat(4));
playerYaw = playerData.readFloat(4);
camera.setYaw(playerYaw);
camera.setRoll(playerData.readFloat(5));
}
catch (Throwable e)

View File

@ -42,11 +42,12 @@ public class World implements BlockAccess, WorldGenConstants
public void spawnPlayer()
{ this.spawnPlayer(0, 0, -3); }
public void spawnPlayer(float x, float y, float z)
public Player spawnPlayer(float x, float y, float z)
{
TexturedModel dirtModel = ModelLoader.loadGenericCube("block/cubes/soil/dirt.png");
this.player = new Player(dirtModel, new Vector3f(x, y, z), 0, 180f, 0, new Vector3f(0.2f, 0.2f, 0.2f));
this.player.isVisible = false;
return this.player;
}
// this constructor will likely not be neccesary when we have dynamic chunkloading