From 4ef355f707749500acad40fc36d96141ef42a881 Mon Sep 17 00:00:00 2001 From: Andrew Lalis Date: Thu, 21 Jul 2022 13:13:52 +0200 Subject: [PATCH] Bleh --- .../java/nl/andrewl/aos2_client/config/ClientConfig.java | 2 +- .../java/nl/andrewl/aos2_server/ProjectileManager.java | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/client/src/main/java/nl/andrewl/aos2_client/config/ClientConfig.java b/client/src/main/java/nl/andrewl/aos2_client/config/ClientConfig.java index b4021ee..a8e62ff 100644 --- a/client/src/main/java/nl/andrewl/aos2_client/config/ClientConfig.java +++ b/client/src/main/java/nl/andrewl/aos2_client/config/ClientConfig.java @@ -13,7 +13,7 @@ public class ClientConfig { public static class DisplayConfig { public boolean fullscreen = false; - public boolean captureCursor = false; + public boolean captureCursor = true; public float fov = 70; } } diff --git a/server/src/main/java/nl/andrewl/aos2_server/ProjectileManager.java b/server/src/main/java/nl/andrewl/aos2_server/ProjectileManager.java index e149465..bd92755 100644 --- a/server/src/main/java/nl/andrewl/aos2_server/ProjectileManager.java +++ b/server/src/main/java/nl/andrewl/aos2_server/ProjectileManager.java @@ -3,6 +3,8 @@ package nl.andrewl.aos2_server; import nl.andrewl.aos2_server.model.ServerPlayer; import nl.andrewl.aos2_server.model.ServerProjectile; import nl.andrewl.aos_core.model.Projectile; +import nl.andrewl.aos_core.model.world.Hit; +import nl.andrewl.aos_core.net.world.ChunkUpdateMessage; import org.joml.Vector3f; import java.util.HashMap; @@ -46,9 +48,14 @@ public class ProjectileManager { projectile.getVelocity().y -= server.getConfig().physics.gravity * dt; // TODO: Check if bullet will hit anything, like blocks or players, if it follows current velocity. Vector3f movement = new Vector3f(projectile.getVelocity()).mul(dt); - + Vector3f movementDir = new Vector3f(movement).normalize(); +// Hit hit = server.getWorld().getLookingAtPos(projectile.getPosition(), movementDir, movement.length()); projectile.getPosition().add(movement); if (projectile.getDistanceTravelled() > 500) { +// if (hit != null) { +// server.getWorld().setBlockAt(hit.pos().x, hit.pos().y, hit.pos().z, (byte) 0); +// server.getPlayerManager().broadcastUdpMessage(ChunkUpdateMessage.fromWorld(hit.pos(), server.getWorld())); +// } removalQueue.add(projectile); server.getPlayerManager().broadcastUdpMessage(projectile.toMessage(true)); } else {