diff --git a/Minecraft Client/Assets/Scripts/Game/Player.cs b/Minecraft Client/Assets/Scripts/Game/Player.cs index 83b3737..eef76e5 100644 --- a/Minecraft Client/Assets/Scripts/Game/Player.cs +++ b/Minecraft Client/Assets/Scripts/Game/Player.cs @@ -130,7 +130,7 @@ public class Player : MonoBehaviour //send destroy block request to server if (Input.GetMouseButtonDown(0)) { - if (Physics.Raycast(camera.transform.position, camera.transform.forward, out RaycastHit hit)) + if (Physics.Raycast(camera.transform.position, camera.transform.forward, out RaycastHit hit, 8)) { hit.point += camera.transform.forward / 10; client.EditBlock(hit.point, 0); @@ -140,7 +140,7 @@ public class Player : MonoBehaviour //send build block request to server if (Input.GetMouseButtonDown(1)) { - if (Physics.Raycast(camera.transform.position, camera.transform.forward, out RaycastHit hit)) + if (Physics.Raycast(camera.transform.position, camera.transform.forward, out RaycastHit hit, 8)) { hit.point -= camera.transform.forward / 10; client.EditBlock(hit.point, 6); diff --git a/Minecraft Client/ProjectSettings/ProjectSettings.asset b/Minecraft Client/ProjectSettings/ProjectSettings.asset index 7ab0736..3deae5f 100644 --- a/Minecraft Client/ProjectSettings/ProjectSettings.asset +++ b/Minecraft Client/ProjectSettings/ProjectSettings.asset @@ -603,7 +603,7 @@ PlayerSettings: additionalCompilerArguments: {} platformArchitecture: {} scriptingBackend: - Standalone: 0 + Standalone: 1 il2cppCompilerConfiguration: {} managedStrippingLevel: {} incrementalIl2cppBuild: {} diff --git a/Minecraft Server/Assets/Game/World.cs b/Minecraft Server/Assets/Game/World.cs index 68859a9..49edcbd 100644 --- a/Minecraft Server/Assets/Game/World.cs +++ b/Minecraft Server/Assets/Game/World.cs @@ -21,8 +21,8 @@ public class World : MonoBehaviour [SerializeField] private int transferDelay; private void Start() { - // randomOffsetX = Random.Range(0, 10000); - // randomOffsetZ = Random.Range(0, 10000); + randomOffsetX = Random.Range(0, 10000); + randomOffsetZ = Random.Range(0, 10000); if (File.Exists(Application.dataPath + "\\save.world")) { @@ -167,7 +167,7 @@ public class World : MonoBehaviour //return the ID of a block public byte GetBlockID(Vector3 positionInWorld) { - byte height = GetHeight((int)positionInWorld.x + randomOffsetX, (int)positionInWorld.z + randomOffsetZ); + byte height = GetHeight((int)positionInWorld.x, (int)positionInWorld.z); //world pass if (positionInWorld.x < 0 || positionInWorld.y < 0 || positionInWorld.z < 0 || @@ -243,7 +243,7 @@ public class World : MonoBehaviour byte perlinHeight = 10; byte groundHeight = 10; - byte height = (byte)(Mathf.PerlinNoise((x) * scale + 0.1f, (z) * scale + 0.1f) * perlinHeight + groundHeight); + byte height = (byte)(Mathf.PerlinNoise((x + randomOffsetX) * scale + 0.1f, (z + randomOffsetZ) * scale + 0.1f) * perlinHeight + groundHeight); return height; } @@ -276,7 +276,7 @@ public class World : MonoBehaviour private void OnApplicationQuit() { - //SaveWorld(); + SaveWorld(); server.Disconnect(); } diff --git a/Minecraft Server/Assets/save.world b/Minecraft Server/Assets/save.world new file mode 100644 index 0000000..a370d5a Binary files /dev/null and b/Minecraft Server/Assets/save.world differ diff --git a/Minecraft Server/Assets/save.world.meta b/Minecraft Server/Assets/save.world.meta new file mode 100644 index 0000000..69f851e --- /dev/null +++ b/Minecraft Server/Assets/save.world.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 940041af630d8d944ac3b74467aa4ae7 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: