Fixed several miscellaneous bugs
- Recolored Test:Stones to better match granite textures - Selection box restored - Controls no longer get stuck after player entity is reloaded - Moved test spawn location a little down so chunks would load conveniently - Moved test spawn variable into TestContent
This commit is contained in:
		| @@ -158,7 +158,7 @@ public class LayerWorld extends Layer { | |||||||
| 		 | 		 | ||||||
| 		final float f = 1e-2f; | 		final float f = 1e-2f; | ||||||
| 		final float scale = 1 - f/2; | 		final float scale = 1 - f/2; | ||||||
| 		final Vec4 color = new Vec4(1, 1, 1, 1).mul(0); | 		final Vec4 color = new Vec4(0, 0, 0, 1); | ||||||
| 		 | 		 | ||||||
| 		for (float phi = 0; phi < 2*FloatMathUtils.PI_F; phi += FloatMathUtils.PI_F/2) { | 		for (float phi = 0; phi < 2*FloatMathUtils.PI_F; phi += FloatMathUtils.PI_F/2) { | ||||||
| 			Mat4 rot = new Mat4().identity().rotateZ(phi).scale(scale); | 			Mat4 rot = new Mat4().identity().rotateZ(phi).scale(scale); | ||||||
|   | |||||||
| @@ -5,8 +5,6 @@ import java.util.Collection; | |||||||
| import java.util.Collections; | import java.util.Collections; | ||||||
|  |  | ||||||
| import glm.vec._2.Vec2; | import glm.vec._2.Vec2; | ||||||
| import glm.vec._3.Vec3; |  | ||||||
| import glm.vec._3.i.Vec3i; |  | ||||||
| import ru.windcorp.progressia.common.util.crash.CrashReports; | import ru.windcorp.progressia.common.util.crash.CrashReports; | ||||||
| import ru.windcorp.progressia.common.world.entity.EntityData; | import ru.windcorp.progressia.common.world.entity.EntityData; | ||||||
| import ru.windcorp.progressia.common.world.entity.EntityDataRegistry; | import ru.windcorp.progressia.common.world.entity.EntityDataRegistry; | ||||||
| @@ -30,8 +28,6 @@ public class PlayerManager { | |||||||
| 		this.players.add(player); | 		this.players.add(player); | ||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	private static final Vec3i SPAWN = new Vec3i(8, 8, 900); |  | ||||||
| 	 |  | ||||||
| 	public EntityData conjurePlayerEntity(String login) { | 	public EntityData conjurePlayerEntity(String login) { | ||||||
| 		// TODO Live up to the name | 		// TODO Live up to the name | ||||||
| 		if (TestContent.PLAYER_LOGIN.equals(login)) { | 		if (TestContent.PLAYER_LOGIN.equals(login)) { | ||||||
| @@ -46,7 +42,7 @@ public class PlayerManager { | |||||||
| 		EntityData player = EntityDataRegistry.getInstance().create("Test:Player"); | 		EntityData player = EntityDataRegistry.getInstance().create("Test:Player"); | ||||||
| 		 | 		 | ||||||
| 		player.setEntityId(TestContent.PLAYER_ENTITY_ID); | 		player.setEntityId(TestContent.PLAYER_ENTITY_ID); | ||||||
| 		player.setPosition(new Vec3(SPAWN.x, SPAWN.y, SPAWN.z)); | 		player.setPosition(TestContent.SPAWN); | ||||||
| 		player.setDirection(new Vec2( | 		player.setDirection(new Vec2( | ||||||
| 				Math.toRadians(40), Math.toRadians(10) | 				Math.toRadians(40), Math.toRadians(10) | ||||||
| 		)); | 		)); | ||||||
|   | |||||||
| @@ -7,6 +7,7 @@ import java.util.function.Consumer; | |||||||
|  |  | ||||||
| import org.lwjgl.glfw.GLFW; | import org.lwjgl.glfw.GLFW; | ||||||
|  |  | ||||||
|  | import glm.vec._3.Vec3; | ||||||
| import glm.vec._3.i.Vec3i; | import glm.vec._3.i.Vec3i; | ||||||
| import ru.windcorp.progressia.client.ClientState; | import ru.windcorp.progressia.client.ClientState; | ||||||
| import ru.windcorp.progressia.client.audio.SoundEffect; | import ru.windcorp.progressia.client.audio.SoundEffect; | ||||||
| @@ -36,6 +37,7 @@ public class TestContent { | |||||||
| 	public static final String PLAYER_LOGIN = "Sasha"; | 	public static final String PLAYER_LOGIN = "Sasha"; | ||||||
| 	public static final long PLAYER_ENTITY_ID = 0x42; | 	public static final long PLAYER_ENTITY_ID = 0x42; | ||||||
| 	public static final long STATIE_ENTITY_ID = 0xDEADBEEF; | 	public static final long STATIE_ENTITY_ID = 0xDEADBEEF; | ||||||
|  | 	public static final Vec3 SPAWN = new Vec3(8, 8, 880); | ||||||
| 	 | 	 | ||||||
| 	public static void registerContent() { | 	public static void registerContent() { | ||||||
| 		registerWorldContent(); | 		registerWorldContent(); | ||||||
|   | |||||||
| @@ -30,7 +30,7 @@ public class TestPlayerControls { | |||||||
| 	private TestPlayerControls() {} | 	private TestPlayerControls() {} | ||||||
| 	 | 	 | ||||||
| 	private static final double MODE_SWITCH_MAX_DELAY = 300 * Units.MILLISECONDS; | 	private static final double MODE_SWITCH_MAX_DELAY = 300 * Units.MILLISECONDS; | ||||||
| 	private static final double MIN_JUMP_DELAY = 400 * Units.MILLISECONDS; | 	private static final double MIN_JUMP_DELAY = 300 * Units.MILLISECONDS; | ||||||
|  |  | ||||||
| 	// Horizontal and vertical max control speed when flying | 	// Horizontal and vertical max control speed when flying | ||||||
| 	private static final float FLYING_SPEED = 6.0f * Units.METERS_PER_SECOND; | 	private static final float FLYING_SPEED = 6.0f * Units.METERS_PER_SECOND; | ||||||
| @@ -107,10 +107,6 @@ public class TestPlayerControls { | |||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	public void handleInput(Input input) { | 	public void handleInput(Input input) { | ||||||
| 		if (ClientState.getInstance() == null || !ClientState.getInstance().isReady()) { |  | ||||||
| 			return; |  | ||||||
| 		} |  | ||||||
| 		 |  | ||||||
| 		InputEvent event = input.getEvent(); | 		InputEvent event = input.getEvent(); | ||||||
| 		 | 		 | ||||||
| 		if (event instanceof KeyEvent) { | 		if (event instanceof KeyEvent) { | ||||||
| @@ -193,6 +189,10 @@ public class TestPlayerControls { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	private void jump() { | 	private void jump() { | ||||||
|  | 		if (ClientState.getInstance() == null || !ClientState.getInstance().isReady()) { | ||||||
|  | 			return; | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
| 		getEntity().getVelocity().add(0, 0, JUMP_VELOCITY * (useMinecraftGravity ? 2 : 1)); | 		getEntity().getVelocity().add(0, 0, JUMP_VELOCITY * (useMinecraftGravity ? 2 : 1)); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| @@ -214,6 +214,10 @@ public class TestPlayerControls { | |||||||
| 	} | 	} | ||||||
| 	 | 	 | ||||||
| 	private void handleCameraMode() { | 	private void handleCameraMode() { | ||||||
|  | 		if (ClientState.getInstance() == null || !ClientState.getInstance().isReady()) { | ||||||
|  | 			return; | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
| 		if (ClientState.getInstance().getCamera().hasAnchor()) { | 		if (ClientState.getInstance().getCamera().hasAnchor()) { | ||||||
| 			ClientState.getInstance().getCamera().selectNextMode(); | 			ClientState.getInstance().getCamera().selectNextMode(); | ||||||
| 			updateGUI(); | 			updateGUI(); | ||||||
| @@ -228,6 +232,10 @@ public class TestPlayerControls { | |||||||
| 	private void onMouseMoved(CursorMoveEvent event) { | 	private void onMouseMoved(CursorMoveEvent event) { | ||||||
| 		if (!captureMouse) return; | 		if (!captureMouse) return; | ||||||
|  |  | ||||||
|  | 		if (ClientState.getInstance() == null || !ClientState.getInstance().isReady()) { | ||||||
|  | 			return; | ||||||
|  | 		} | ||||||
|  | 		 | ||||||
| 		final float yawScale = -0.002f; | 		final float yawScale = -0.002f; | ||||||
| 		final float pitchScale = yawScale; | 		final float pitchScale = yawScale; | ||||||
|  |  | ||||||
|   | |||||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 8.3 KiB | 
		Reference in New Issue
	
	Block a user