diff --git a/net/terrain.json b/net/terrain.json index 623d7fde..1607ac24 100644 --- a/net/terrain.json +++ b/net/terrain.json @@ -287,6 +287,10 @@ { "name" : "randomizerValue44", "type" : "FIXED_LONG" + }, + { + "name" : "chunkData", + "type" : "BYTE_ARRAY" } ], "messageTypes" : [ @@ -405,6 +409,23 @@ "realLocationY", "realLocationZ" ] + }, + { + "messageName" : "RequestChunkData", + "data" : [ + "worldX", + "worldY", + "worldZ" + ] + }, + { + "messageName" : "sendChunkData", + "data" : [ + "worldX", + "worldY", + "worldZ", + "chunkData" + ] } ] } diff --git a/src/main/java/electrosphere/engine/Globals.java b/src/main/java/electrosphere/engine/Globals.java index c9572c31..474b1731 100644 --- a/src/main/java/electrosphere/engine/Globals.java +++ b/src/main/java/electrosphere/engine/Globals.java @@ -34,7 +34,6 @@ import electrosphere.game.collision.CollisionEngine; import electrosphere.game.collision.CommonWorldData; import electrosphere.game.config.UserSettings; import electrosphere.game.server.structure.virtual.StructureManager; -import electrosphere.game.server.terrain.manager.ServerTerrainManager; import electrosphere.game.server.world.MacroData; import electrosphere.game.server.world.ServerWorldData; import electrosphere.logger.LoggerInterface; @@ -70,6 +69,7 @@ import electrosphere.server.db.DatabaseController; import electrosphere.server.pathfinding.NavMeshManager; import electrosphere.server.simulation.MacroSimulation; import electrosphere.server.simulation.MicroSimulation; +import electrosphere.server.terrain.manager.ServerTerrainManager; import electrosphere.util.FileUtils; /** diff --git a/src/main/java/electrosphere/engine/Main.java b/src/main/java/electrosphere/engine/Main.java index ab9a85ab..62203066 100644 --- a/src/main/java/electrosphere/engine/Main.java +++ b/src/main/java/electrosphere/engine/Main.java @@ -13,6 +13,9 @@ import electrosphere.engine.loadingthreads.LoadingThread; import electrosphere.game.client.ClientFunctions; import electrosphere.game.config.UserSettings; import electrosphere.logger.LoggerInterface; +import electrosphere.net.parser.net.message.TerrainMessage; +import electrosphere.net.parser.net.raw.NetworkParser; +import electrosphere.net.parser.util.ByteStreamUtils; import electrosphere.renderer.Model; import electrosphere.renderer.RenderingEngine; import electrosphere.util.worldviewer.TerrainViewer; diff --git a/src/main/java/electrosphere/engine/loadingthreads/ArenaLoading.java b/src/main/java/electrosphere/engine/loadingthreads/ArenaLoading.java index 0c77e063..364ccebb 100644 --- a/src/main/java/electrosphere/engine/loadingthreads/ArenaLoading.java +++ b/src/main/java/electrosphere/engine/loadingthreads/ArenaLoading.java @@ -11,10 +11,10 @@ import electrosphere.entity.Entity; import electrosphere.entity.EntityDataStrings; import electrosphere.entity.EntityUtils; import electrosphere.entity.ServerEntityUtils; -import electrosphere.game.server.terrain.manager.ServerTerrainManager; import electrosphere.game.server.world.ServerWorldData; import electrosphere.logger.LoggerInterface; import electrosphere.server.saves.SaveUtils; +import electrosphere.server.terrain.manager.ServerTerrainManager; import electrosphere.util.FileUtils; public class ArenaLoading { diff --git a/src/main/java/electrosphere/engine/loadingthreads/DebugSPWorldLoading.java b/src/main/java/electrosphere/engine/loadingthreads/DebugSPWorldLoading.java index 12cf0567..2338ed7a 100644 --- a/src/main/java/electrosphere/engine/loadingthreads/DebugSPWorldLoading.java +++ b/src/main/java/electrosphere/engine/loadingthreads/DebugSPWorldLoading.java @@ -8,7 +8,6 @@ import electrosphere.auth.AuthenticationManager; import electrosphere.engine.Globals; import electrosphere.entity.types.camera.CameraEntityUtils; import electrosphere.game.client.targeting.crosshair.Crosshair; -import electrosphere.game.server.terrain.manager.ServerTerrainManager; import electrosphere.game.server.world.ServerWorldData; import electrosphere.logger.LoggerInterface; import electrosphere.menu.MenuGenerators; @@ -16,6 +15,7 @@ import electrosphere.menu.WindowStrings; import electrosphere.menu.WindowUtils; import electrosphere.renderer.ui.Window; import electrosphere.server.saves.SaveUtils; +import electrosphere.server.terrain.manager.ServerTerrainManager; import electrosphere.util.FileUtils; import electrosphere.controls.ControlHandler; diff --git a/src/main/java/electrosphere/engine/loadingthreads/LoadingUtils.java b/src/main/java/electrosphere/engine/loadingthreads/LoadingUtils.java index bf85ca33..e21ccbdf 100644 --- a/src/main/java/electrosphere/engine/loadingthreads/LoadingUtils.java +++ b/src/main/java/electrosphere/engine/loadingthreads/LoadingUtils.java @@ -23,7 +23,6 @@ import electrosphere.game.client.cells.DrawCellManager; import electrosphere.game.collision.CommonWorldData; import electrosphere.game.data.creature.type.CreatureType; import electrosphere.game.data.creature.type.visualattribute.VisualAttribute; -import electrosphere.game.server.terrain.manager.ServerTerrainManager; import electrosphere.game.server.town.Town; import electrosphere.game.server.world.MacroData; import electrosphere.game.server.world.ServerWorldData; @@ -36,6 +35,7 @@ import electrosphere.server.datacell.Realm; import electrosphere.server.saves.SaveUtils; import electrosphere.server.simulation.MacroSimulation; import electrosphere.server.simulation.MicroSimulation; +import electrosphere.server.terrain.manager.ServerTerrainManager; /** * Utilities for all loading thread types diff --git a/src/main/java/electrosphere/engine/loadingthreads/ServerLoading.java b/src/main/java/electrosphere/engine/loadingthreads/ServerLoading.java index 4b98c481..72641cbf 100644 --- a/src/main/java/electrosphere/engine/loadingthreads/ServerLoading.java +++ b/src/main/java/electrosphere/engine/loadingthreads/ServerLoading.java @@ -1,9 +1,9 @@ package electrosphere.engine.loadingthreads; import electrosphere.engine.Globals; -import electrosphere.game.server.terrain.manager.ServerTerrainManager; import electrosphere.logger.LoggerInterface; import electrosphere.server.saves.SaveUtils; +import electrosphere.server.terrain.manager.ServerTerrainManager; public class ServerLoading { diff --git a/src/main/java/electrosphere/game/client/cells/DrawCellManager.java b/src/main/java/electrosphere/game/client/cells/DrawCellManager.java index dd4e115b..1c6d9dac 100644 --- a/src/main/java/electrosphere/game/client/cells/DrawCellManager.java +++ b/src/main/java/electrosphere/game/client/cells/DrawCellManager.java @@ -2,12 +2,13 @@ package electrosphere.game.client.cells; import electrosphere.engine.Globals; import electrosphere.game.client.terrain.manager.ClientTerrainManager; -import electrosphere.game.server.terrain.manager.ServerTerrainManager; import electrosphere.game.terrain.processing.TerrainInterpolator; import electrosphere.game.client.world.ClientWorldData; import electrosphere.game.collision.CommonWorldData; import electrosphere.net.parser.net.message.TerrainMessage; import electrosphere.renderer.ShaderProgram; +import electrosphere.server.terrain.manager.ServerTerrainManager; + import java.util.Arrays; import java.util.HashMap; diff --git a/src/main/java/electrosphere/game/client/terrain/cache/ClientTerrainCache.java b/src/main/java/electrosphere/game/client/terrain/cache/ClientTerrainCache.java index 0eebcec3..fb91cb9b 100644 --- a/src/main/java/electrosphere/game/client/terrain/cache/ClientTerrainCache.java +++ b/src/main/java/electrosphere/game/client/terrain/cache/ClientTerrainCache.java @@ -1,8 +1,9 @@ package electrosphere.game.client.terrain.cache; import electrosphere.game.client.world.ClientWorldData; -import electrosphere.game.server.terrain.models.TerrainModel; import electrosphere.game.terrain.processing.TerrainInterpolator; +import electrosphere.server.terrain.models.TerrainModel; + import java.util.HashMap; import java.util.LinkedList; import java.util.List; diff --git a/src/main/java/electrosphere/game/client/world/ClientWorldData.java b/src/main/java/electrosphere/game/client/world/ClientWorldData.java index 666a6898..d2b41948 100644 --- a/src/main/java/electrosphere/game/client/world/ClientWorldData.java +++ b/src/main/java/electrosphere/game/client/world/ClientWorldData.java @@ -2,7 +2,7 @@ package electrosphere.game.client.world; import electrosphere.game.server.world.*; import electrosphere.server.datacell.ServerDataCell; -import electrosphere.game.server.terrain.manager.ServerTerrainManager; +import electrosphere.server.terrain.manager.ServerTerrainManager; import java.util.List; import org.joml.Vector2f; diff --git a/src/main/java/electrosphere/game/collision/CommonWorldData.java b/src/main/java/electrosphere/game/collision/CommonWorldData.java index a1f9bd0c..c14f764a 100644 --- a/src/main/java/electrosphere/game/collision/CommonWorldData.java +++ b/src/main/java/electrosphere/game/collision/CommonWorldData.java @@ -2,8 +2,9 @@ package electrosphere.game.collision; import electrosphere.game.client.terrain.manager.ClientTerrainManager; import electrosphere.game.client.world.ClientWorldData; -import electrosphere.game.server.terrain.manager.ServerTerrainManager; import electrosphere.game.server.world.ServerWorldData; +import electrosphere.server.terrain.manager.ServerTerrainManager; + import org.joml.Vector3d; import org.joml.Vector3f; diff --git a/src/main/java/electrosphere/game/server/town/Town.java b/src/main/java/electrosphere/game/server/town/Town.java index f1a22c07..cb32d82d 100644 --- a/src/main/java/electrosphere/game/server/town/Town.java +++ b/src/main/java/electrosphere/game/server/town/Town.java @@ -2,11 +2,11 @@ package electrosphere.game.server.town; import electrosphere.game.server.structure.virtual.Structure; import electrosphere.game.server.structure.virtual.VirtualStructureUtils; -import electrosphere.game.server.terrain.manager.ServerTerrainChunk; import electrosphere.engine.Globals; import electrosphere.game.server.character.Character; import electrosphere.logger.LoggerInterface; import electrosphere.server.db.DatabaseResult; +import electrosphere.server.terrain.manager.ServerTerrainChunk; import java.sql.ResultSet; import java.sql.SQLException; diff --git a/src/main/java/electrosphere/game/server/world/ServerWorldData.java b/src/main/java/electrosphere/game/server/world/ServerWorldData.java index e8ec954e..b7e48885 100644 --- a/src/main/java/electrosphere/game/server/world/ServerWorldData.java +++ b/src/main/java/electrosphere/game/server/world/ServerWorldData.java @@ -1,7 +1,7 @@ package electrosphere.game.server.world; -import electrosphere.game.server.terrain.manager.ServerTerrainManager; import electrosphere.server.datacell.ServerDataCell; +import electrosphere.server.terrain.manager.ServerTerrainManager; import java.util.List; import org.joml.Vector3f; diff --git a/src/main/java/electrosphere/menu/MenuGenerators.java b/src/main/java/electrosphere/menu/MenuGenerators.java index a03bd7d1..18116b8b 100644 --- a/src/main/java/electrosphere/menu/MenuGenerators.java +++ b/src/main/java/electrosphere/menu/MenuGenerators.java @@ -16,7 +16,6 @@ import electrosphere.entity.types.camera.CameraEntityUtils; import electrosphere.entity.types.creature.CreatureUtils; import electrosphere.game.data.creature.type.CreatureType; import electrosphere.game.data.creature.type.visualattribute.VisualAttribute; -import electrosphere.game.server.terrain.manager.ServerTerrainManager; import electrosphere.net.NetUtils; import electrosphere.renderer.Model; import electrosphere.renderer.RenderingEngine; @@ -41,6 +40,7 @@ import electrosphere.renderer.ui.events.NavigationEvent; import electrosphere.renderer.ui.events.ValueChangeEvent; import electrosphere.renderer.ui.form.FormElement; import electrosphere.server.saves.SaveUtils; +import electrosphere.server.terrain.manager.ServerTerrainManager; /** * diff --git a/src/main/java/electrosphere/net/parser/net/message/NetworkMessage.java b/src/main/java/electrosphere/net/parser/net/message/NetworkMessage.java index c50d6785..19478b05 100644 --- a/src/main/java/electrosphere/net/parser/net/message/NetworkMessage.java +++ b/src/main/java/electrosphere/net/parser/net/message/NetworkMessage.java @@ -223,6 +223,16 @@ INVENTORY_MESSAGE, rVal = TerrainMessage.parseSpawnPositionMessage(byteStream); } break; + case TypeBytes.TERRAIN_MESSAGE_TYPE_REQUESTCHUNKDATA: + if(TerrainMessage.canParseMessage(byteStream,secondByte)){ + rVal = TerrainMessage.parseRequestChunkDataMessage(byteStream); + } + break; + case TypeBytes.TERRAIN_MESSAGE_TYPE_SENDCHUNKDATA: + if(TerrainMessage.canParseMessage(byteStream,secondByte)){ + rVal = TerrainMessage.parsesendChunkDataMessage(byteStream); + } + break; } break; case TypeBytes.MESSAGE_TYPE_SERVER: diff --git a/src/main/java/electrosphere/net/parser/net/message/TerrainMessage.java b/src/main/java/electrosphere/net/parser/net/message/TerrainMessage.java index ea0ef35f..e5e1b67e 100644 --- a/src/main/java/electrosphere/net/parser/net/message/TerrainMessage.java +++ b/src/main/java/electrosphere/net/parser/net/message/TerrainMessage.java @@ -15,6 +15,8 @@ public class TerrainMessage extends NetworkMessage { MACROVALUE, HEIGHTMAPMODIFICATION, SPAWNPOSITION, + REQUESTCHUNKDATA, + SENDCHUNKDATA, } TerrainMessageType messageType; @@ -85,6 +87,7 @@ public class TerrainMessage extends NetworkMessage { long randomizerValue42; long randomizerValue43; long randomizerValue44; + byte[] chunkData; TerrainMessage(TerrainMessageType messageType){ this.type = MessageType.TERRAIN_MESSAGE; @@ -631,6 +634,14 @@ public class TerrainMessage extends NetworkMessage { this.randomizerValue44 = randomizerValue44; } + public byte[] getchunkData() { + return chunkData; + } + + public void setchunkData(byte[] chunkData) { + this.chunkData = chunkData; + } + static void stripPacketHeader(List byteStream){ byteStream.remove(0); byteStream.remove(0); @@ -686,6 +697,14 @@ public class TerrainMessage extends NetworkMessage { } else { return false; } + case TypeBytes.TERRAIN_MESSAGE_TYPE_REQUESTCHUNKDATA: + if(byteStream.size() >= TypeBytes.TERRAIN_MESSAGE_TYPE_REQUESTCHUNKDATA_SIZE){ + return true; + } else { + return false; + } + case TypeBytes.TERRAIN_MESSAGE_TYPE_SENDCHUNKDATA: + return TerrainMessage.canParsesendChunkDataMessage(byteStream); } return false; } @@ -940,6 +959,72 @@ public class TerrainMessage extends NetworkMessage { return rVal; } + public static TerrainMessage parseRequestChunkDataMessage(List byteStream){ + TerrainMessage rVal = new TerrainMessage(TerrainMessageType.REQUESTCHUNKDATA); + stripPacketHeader(byteStream); + rVal.setworldX(ByteStreamUtils.popIntFromByteQueue(byteStream)); + rVal.setworldY(ByteStreamUtils.popIntFromByteQueue(byteStream)); + rVal.setworldZ(ByteStreamUtils.popIntFromByteQueue(byteStream)); + return rVal; + } + + public static TerrainMessage constructRequestChunkDataMessage(int worldX,int worldY,int worldZ){ + TerrainMessage rVal = new TerrainMessage(TerrainMessageType.REQUESTCHUNKDATA); + rVal.setworldX(worldX); + rVal.setworldY(worldY); + rVal.setworldZ(worldZ); + rVal.serialize(); + return rVal; + } + + public static boolean canParsesendChunkDataMessage(List byteStream){ + int currentStreamLength = byteStream.size(); + List temporaryByteQueue = new LinkedList(); + if(currentStreamLength < 6){ + return false; + } + if(currentStreamLength < 10){ + return false; + } + if(currentStreamLength < 14){ + return false; + } + int chunkDataSize = 0; + if(currentStreamLength < 18){ + return false; + } else { + temporaryByteQueue.add(byteStream.get(14 + 0)); + temporaryByteQueue.add(byteStream.get(14 + 1)); + temporaryByteQueue.add(byteStream.get(14 + 2)); + temporaryByteQueue.add(byteStream.get(14 + 3)); + chunkDataSize = ByteStreamUtils.popIntFromByteQueue(temporaryByteQueue); + } + if(currentStreamLength < 18 + chunkDataSize){ + return false; + } + return true; + } + + public static TerrainMessage parsesendChunkDataMessage(List byteStream){ + TerrainMessage rVal = new TerrainMessage(TerrainMessageType.SENDCHUNKDATA); + stripPacketHeader(byteStream); + rVal.setworldX(ByteStreamUtils.popIntFromByteQueue(byteStream)); + rVal.setworldY(ByteStreamUtils.popIntFromByteQueue(byteStream)); + rVal.setworldZ(ByteStreamUtils.popIntFromByteQueue(byteStream)); + rVal.setchunkData(ByteStreamUtils.popByteArrayFromByteQueue(byteStream)); + return rVal; + } + + public static TerrainMessage constructsendChunkDataMessage(int worldX,int worldY,int worldZ,byte[] chunkData){ + TerrainMessage rVal = new TerrainMessage(TerrainMessageType.SENDCHUNKDATA); + rVal.setworldX(worldX); + rVal.setworldY(worldY); + rVal.setworldZ(worldZ); + rVal.setchunkData(chunkData); + rVal.serialize(); + return rVal; + } + @Override void serialize(){ byte[] intValues = new byte[8]; @@ -1281,6 +1366,51 @@ public class TerrainMessage extends NetworkMessage { rawBytes[18+i] = intValues[i]; } break; + case REQUESTCHUNKDATA: + rawBytes = new byte[2+4+4+4]; + //message header + rawBytes[0] = TypeBytes.MESSAGE_TYPE_TERRAIN; + //entity messaage header + rawBytes[1] = TypeBytes.TERRAIN_MESSAGE_TYPE_REQUESTCHUNKDATA; + intValues = ByteStreamUtils.serializeIntToBytes(worldX); + for(int i = 0; i < 4; i++){ + rawBytes[2+i] = intValues[i]; + } + intValues = ByteStreamUtils.serializeIntToBytes(worldY); + for(int i = 0; i < 4; i++){ + rawBytes[6+i] = intValues[i]; + } + intValues = ByteStreamUtils.serializeIntToBytes(worldZ); + for(int i = 0; i < 4; i++){ + rawBytes[10+i] = intValues[i]; + } + break; + case SENDCHUNKDATA: + rawBytes = new byte[2+4+4+4+4+chunkData.length]; + //message header + rawBytes[0] = TypeBytes.MESSAGE_TYPE_TERRAIN; + //entity messaage header + rawBytes[1] = TypeBytes.TERRAIN_MESSAGE_TYPE_SENDCHUNKDATA; + intValues = ByteStreamUtils.serializeIntToBytes(worldX); + for(int i = 0; i < 4; i++){ + rawBytes[2+i] = intValues[i]; + } + intValues = ByteStreamUtils.serializeIntToBytes(worldY); + for(int i = 0; i < 4; i++){ + rawBytes[6+i] = intValues[i]; + } + intValues = ByteStreamUtils.serializeIntToBytes(worldZ); + for(int i = 0; i < 4; i++){ + rawBytes[10+i] = intValues[i]; + } + intValues = ByteStreamUtils.serializeIntToBytes(chunkData.length); + for(int i = 0; i < 4; i++){ + rawBytes[14+i] = intValues[i]; + } + for(int i = 0; i < chunkData.length; i++){ + rawBytes[18+i] = chunkData[i]; + } + break; } serialized = true; } diff --git a/src/main/java/electrosphere/net/parser/net/message/TypeBytes.java b/src/main/java/electrosphere/net/parser/net/message/TypeBytes.java index ef19c5d6..2ce89e1f 100644 --- a/src/main/java/electrosphere/net/parser/net/message/TypeBytes.java +++ b/src/main/java/electrosphere/net/parser/net/message/TypeBytes.java @@ -85,6 +85,8 @@ Message categories public static final byte TERRAIN_MESSAGE_TYPE_MACROVALUE = 5; public static final byte TERRAIN_MESSAGE_TYPE_HEIGHTMAPMODIFICATION = 6; public static final byte TERRAIN_MESSAGE_TYPE_SPAWNPOSITION = 7; + public static final byte TERRAIN_MESSAGE_TYPE_REQUESTCHUNKDATA = 8; + public static final byte TERRAIN_MESSAGE_TYPE_SENDCHUNKDATA = 9; /* Terrain packet sizes */ @@ -96,6 +98,7 @@ Message categories public static final short TERRAIN_MESSAGE_TYPE_MACROVALUE_SIZE = 310; public static final byte TERRAIN_MESSAGE_TYPE_HEIGHTMAPMODIFICATION_SIZE = 30; public static final byte TERRAIN_MESSAGE_TYPE_SPAWNPOSITION_SIZE = 26; + public static final byte TERRAIN_MESSAGE_TYPE_REQUESTCHUNKDATA_SIZE = 14; /* Server subcategories */ diff --git a/src/main/java/electrosphere/net/parser/util/ByteStreamUtils.java b/src/main/java/electrosphere/net/parser/util/ByteStreamUtils.java index 5fd71c0d..a2336e25 100644 --- a/src/main/java/electrosphere/net/parser/util/ByteStreamUtils.java +++ b/src/main/java/electrosphere/net/parser/util/ByteStreamUtils.java @@ -78,6 +78,15 @@ public class ByteStreamUtils { return rVal; } + public static byte[] popByteArrayFromByteQueue(List queue){ + int length = popIntFromByteQueue(queue); + byte[] bytes = new byte[length]; + for(int i = 0; i < length; i++){ + bytes[i] = queue.remove(0); + } + return bytes; + } + public static double popDoubleFromByteQueue(List queue){ double rVal = -1; bufferLock.acquireUninterruptibly(); diff --git a/src/main/java/electrosphere/net/server/protocol/ServerProtocol.java b/src/main/java/electrosphere/net/server/protocol/ServerProtocol.java index 70e51a77..72513fb0 100644 --- a/src/main/java/electrosphere/net/server/protocol/ServerProtocol.java +++ b/src/main/java/electrosphere/net/server/protocol/ServerProtocol.java @@ -11,8 +11,6 @@ import electrosphere.entity.types.attach.AttachUtils; import electrosphere.entity.types.collision.CollisionObjUtils; import electrosphere.entity.types.creature.CreatureUtils; import electrosphere.entity.types.item.ItemUtils; -import electrosphere.game.server.terrain.manager.ServerTerrainChunk; -import electrosphere.game.server.terrain.models.TerrainModification; import electrosphere.logger.LoggerInterface; import electrosphere.net.NetUtils; import electrosphere.net.parser.net.message.AuthMessage; @@ -28,6 +26,8 @@ import electrosphere.net.parser.net.message.NetworkMessage.MessageType; import electrosphere.net.parser.net.message.ServerMessage.ServerMessageType; import electrosphere.net.server.ServerConnectionHandler; import electrosphere.net.server.player.Player; +import electrosphere.server.terrain.manager.ServerTerrainChunk; +import electrosphere.server.terrain.models.TerrainModification; public class ServerProtocol { diff --git a/src/main/java/electrosphere/net/server/protocol/TerrainProtocol.java b/src/main/java/electrosphere/net/server/protocol/TerrainProtocol.java index 2ec16918..8e56ef11 100644 --- a/src/main/java/electrosphere/net/server/protocol/TerrainProtocol.java +++ b/src/main/java/electrosphere/net/server/protocol/TerrainProtocol.java @@ -1,11 +1,11 @@ package electrosphere.net.server.protocol; import electrosphere.engine.Globals; -import electrosphere.game.server.terrain.manager.ServerTerrainChunk; -import electrosphere.game.server.terrain.models.TerrainModification; import electrosphere.net.parser.net.message.TerrainMessage; import electrosphere.net.server.Server; import electrosphere.net.server.ServerConnectionHandler; +import electrosphere.server.terrain.manager.ServerTerrainChunk; +import electrosphere.server.terrain.models.TerrainModification; public class TerrainProtocol { diff --git a/src/main/java/electrosphere/server/datacell/physics/DataCellPhysicsManager.java b/src/main/java/electrosphere/server/datacell/physics/DataCellPhysicsManager.java index 30515299..914a0a94 100644 --- a/src/main/java/electrosphere/server/datacell/physics/DataCellPhysicsManager.java +++ b/src/main/java/electrosphere/server/datacell/physics/DataCellPhysicsManager.java @@ -2,12 +2,13 @@ package electrosphere.server.datacell.physics; import electrosphere.engine.Globals; import electrosphere.game.client.terrain.manager.ClientTerrainManager; -import electrosphere.game.server.terrain.manager.ServerTerrainManager; import electrosphere.game.terrain.processing.TerrainInterpolator; import electrosphere.game.client.world.ClientWorldData; import electrosphere.game.collision.CommonWorldData; import electrosphere.net.parser.net.message.TerrainMessage; import electrosphere.renderer.ShaderProgram; +import electrosphere.server.terrain.manager.ServerTerrainManager; + import java.util.Arrays; import java.util.HashMap; diff --git a/src/main/java/electrosphere/server/pathfinding/ChunkMeshList.java b/src/main/java/electrosphere/server/pathfinding/ChunkMeshList.java index 850e113d..ee773296 100644 --- a/src/main/java/electrosphere/server/pathfinding/ChunkMeshList.java +++ b/src/main/java/electrosphere/server/pathfinding/ChunkMeshList.java @@ -1,7 +1,7 @@ package electrosphere.server.pathfinding; -import electrosphere.game.server.terrain.manager.ServerTerrainChunk; import electrosphere.server.pathfinding.navmesh.NavMesh; +import electrosphere.server.terrain.manager.ServerTerrainChunk; import java.util.LinkedList; import java.util.List; diff --git a/src/main/java/electrosphere/server/pathfinding/NavMeshManager.java b/src/main/java/electrosphere/server/pathfinding/NavMeshManager.java index 8ad6f55c..16004474 100644 --- a/src/main/java/electrosphere/server/pathfinding/NavMeshManager.java +++ b/src/main/java/electrosphere/server/pathfinding/NavMeshManager.java @@ -1,11 +1,11 @@ package electrosphere.server.pathfinding; -import electrosphere.game.server.terrain.manager.ServerTerrainChunk; import electrosphere.server.pathfinding.blocker.NavBlocker; import electrosphere.server.pathfinding.blocker.NavTerrainBlockerCache; import electrosphere.server.pathfinding.navmesh.NavMesh; import electrosphere.server.pathfinding.navmesh.NavShape; import electrosphere.server.pathfinding.path.Waypoint; +import electrosphere.server.terrain.manager.ServerTerrainChunk; import java.util.HashMap; import java.util.LinkedList; diff --git a/src/main/java/electrosphere/server/pathfinding/NavMeshUtils.java b/src/main/java/electrosphere/server/pathfinding/NavMeshUtils.java index 20d76c96..6d347fda 100644 --- a/src/main/java/electrosphere/server/pathfinding/NavMeshUtils.java +++ b/src/main/java/electrosphere/server/pathfinding/NavMeshUtils.java @@ -1,12 +1,12 @@ package electrosphere.server.pathfinding; import electrosphere.engine.Globals; -import electrosphere.game.server.terrain.manager.ServerTerrainChunk; import electrosphere.logger.LoggerInterface; import electrosphere.server.pathfinding.blocker.NavBlocker; import electrosphere.server.pathfinding.navmesh.NavCube; import electrosphere.server.pathfinding.navmesh.NavMesh; import electrosphere.server.pathfinding.navmesh.NavShape; +import electrosphere.server.terrain.manager.ServerTerrainChunk; import java.util.LinkedList; import java.util.List; diff --git a/src/main/java/electrosphere/server/saves/SaveUtils.java b/src/main/java/electrosphere/server/saves/SaveUtils.java index 8a8cc673..4949830c 100644 --- a/src/main/java/electrosphere/server/saves/SaveUtils.java +++ b/src/main/java/electrosphere/server/saves/SaveUtils.java @@ -3,10 +3,10 @@ package electrosphere.server.saves; import java.util.List; import electrosphere.engine.Globals; -import electrosphere.game.server.terrain.manager.ServerTerrainManager; import electrosphere.game.server.world.ServerWorldData; import electrosphere.logger.LoggerInterface; import electrosphere.server.db.DatabaseUtils; +import electrosphere.server.terrain.manager.ServerTerrainManager; import electrosphere.util.FileUtils; /** diff --git a/src/main/java/electrosphere/game/server/terrain/generation/Continent.java b/src/main/java/electrosphere/server/terrain/generation/Continent.java similarity index 87% rename from src/main/java/electrosphere/game/server/terrain/generation/Continent.java rename to src/main/java/electrosphere/server/terrain/generation/Continent.java index d3fdea6f..f2dfc84e 100644 --- a/src/main/java/electrosphere/game/server/terrain/generation/Continent.java +++ b/src/main/java/electrosphere/server/terrain/generation/Continent.java @@ -1,4 +1,4 @@ -package electrosphere.game.server.terrain.generation; +package electrosphere.server.terrain.generation; /** * Contains information about a continent diff --git a/src/main/java/electrosphere/game/server/terrain/generation/Hotspot.java b/src/main/java/electrosphere/server/terrain/generation/Hotspot.java similarity index 99% rename from src/main/java/electrosphere/game/server/terrain/generation/Hotspot.java rename to src/main/java/electrosphere/server/terrain/generation/Hotspot.java index 2671db25..66cd15af 100644 --- a/src/main/java/electrosphere/game/server/terrain/generation/Hotspot.java +++ b/src/main/java/electrosphere/server/terrain/generation/Hotspot.java @@ -1,4 +1,4 @@ -package electrosphere.game.server.terrain.generation; +package electrosphere.server.terrain.generation; /** * diff --git a/src/main/java/electrosphere/game/server/terrain/generation/InterpolationDisplay.java b/src/main/java/electrosphere/server/terrain/generation/InterpolationDisplay.java similarity index 99% rename from src/main/java/electrosphere/game/server/terrain/generation/InterpolationDisplay.java rename to src/main/java/electrosphere/server/terrain/generation/InterpolationDisplay.java index dee8ec5e..b4f1775a 100644 --- a/src/main/java/electrosphere/game/server/terrain/generation/InterpolationDisplay.java +++ b/src/main/java/electrosphere/server/terrain/generation/InterpolationDisplay.java @@ -1,4 +1,4 @@ -package electrosphere.game.server.terrain.generation; +package electrosphere.server.terrain.generation; import java.awt.Color; import java.awt.Graphics; diff --git a/src/main/java/electrosphere/game/server/terrain/generation/Region.java b/src/main/java/electrosphere/server/terrain/generation/Region.java similarity index 88% rename from src/main/java/electrosphere/game/server/terrain/generation/Region.java rename to src/main/java/electrosphere/server/terrain/generation/Region.java index e2d5f857..036d1a9b 100644 --- a/src/main/java/electrosphere/game/server/terrain/generation/Region.java +++ b/src/main/java/electrosphere/server/terrain/generation/Region.java @@ -1,4 +1,4 @@ -package electrosphere.game.server.terrain.generation; +package electrosphere.server.terrain.generation; /** * diff --git a/src/main/java/electrosphere/game/server/terrain/generation/TerrainGen.java b/src/main/java/electrosphere/server/terrain/generation/TerrainGen.java similarity index 99% rename from src/main/java/electrosphere/game/server/terrain/generation/TerrainGen.java rename to src/main/java/electrosphere/server/terrain/generation/TerrainGen.java index f4c76fa3..68083932 100644 --- a/src/main/java/electrosphere/game/server/terrain/generation/TerrainGen.java +++ b/src/main/java/electrosphere/server/terrain/generation/TerrainGen.java @@ -1,4 +1,4 @@ -package electrosphere.game.server.terrain.generation; +package electrosphere.server.terrain.generation; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; @@ -13,7 +13,7 @@ import java.util.Random; import javax.swing.JFrame; -import electrosphere.game.server.terrain.models.TerrainModel; +import electrosphere.server.terrain.models.TerrainModel; /** * diff --git a/src/main/java/electrosphere/game/server/terrain/generation/TerrainGenerator.java b/src/main/java/electrosphere/server/terrain/generation/TerrainGenerator.java similarity index 99% rename from src/main/java/electrosphere/game/server/terrain/generation/TerrainGenerator.java rename to src/main/java/electrosphere/server/terrain/generation/TerrainGenerator.java index b376e0fb..12e13754 100644 --- a/src/main/java/electrosphere/game/server/terrain/generation/TerrainGenerator.java +++ b/src/main/java/electrosphere/server/terrain/generation/TerrainGenerator.java @@ -1,4 +1,4 @@ -package electrosphere.game.server.terrain.generation; +package electrosphere.server.terrain.generation; import java.util.ArrayList; import java.util.Iterator; @@ -154,7 +154,7 @@ class TerrainGenerator { for(int x = 0; x < DIMENSION; x++){ for(int y = 0; y < DIMENSION; y++){ if(asthenosphereHeat[x][y] > 25){ - if(electrosphere.game.server.terrain.generation.Utilities.random_Integer(1, 10, rand) == 10){ + if(electrosphere.server.terrain.generation.Utilities.random_Integer(1, 10, rand) == 10){ elevation[x][y] = elevation[x][y] + 1; if(elevation[x][y] > 100){ elevation[x][y] = 100; diff --git a/src/main/java/electrosphere/game/server/terrain/generation/Utilities.java b/src/main/java/electrosphere/server/terrain/generation/Utilities.java similarity index 99% rename from src/main/java/electrosphere/game/server/terrain/generation/Utilities.java rename to src/main/java/electrosphere/server/terrain/generation/Utilities.java index c7335d45..8abe6b9b 100644 --- a/src/main/java/electrosphere/game/server/terrain/generation/Utilities.java +++ b/src/main/java/electrosphere/server/terrain/generation/Utilities.java @@ -1,4 +1,4 @@ -package electrosphere.game.server.terrain.generation; +package electrosphere.server.terrain.generation; import java.awt.Point; import java.io.BufferedReader; diff --git a/src/main/java/electrosphere/game/server/terrain/generation/Vector.java b/src/main/java/electrosphere/server/terrain/generation/Vector.java similarity index 63% rename from src/main/java/electrosphere/game/server/terrain/generation/Vector.java rename to src/main/java/electrosphere/server/terrain/generation/Vector.java index 8c82cbfd..c8b21d2c 100644 --- a/src/main/java/electrosphere/game/server/terrain/generation/Vector.java +++ b/src/main/java/electrosphere/server/terrain/generation/Vector.java @@ -1,4 +1,4 @@ -package electrosphere.game.server.terrain.generation; +package electrosphere.server.terrain.generation; /** * Int based 2 dimension vector diff --git a/src/main/java/electrosphere/game/server/terrain/manager/ServerTerrainChunk.java b/src/main/java/electrosphere/server/terrain/manager/ServerTerrainChunk.java similarity index 89% rename from src/main/java/electrosphere/game/server/terrain/manager/ServerTerrainChunk.java rename to src/main/java/electrosphere/server/terrain/manager/ServerTerrainChunk.java index e1af5e00..0ea3b837 100644 --- a/src/main/java/electrosphere/game/server/terrain/manager/ServerTerrainChunk.java +++ b/src/main/java/electrosphere/server/terrain/manager/ServerTerrainChunk.java @@ -1,10 +1,10 @@ -package electrosphere.game.server.terrain.manager; +package electrosphere.server.terrain.manager; -import electrosphere.game.server.terrain.models.TerrainModification; -import electrosphere.game.server.terrain.models.TerrainModification; import java.util.LinkedList; import java.util.List; +import electrosphere.server.terrain.models.TerrainModification; + /** * * @author amaterasu diff --git a/src/main/java/electrosphere/game/server/terrain/manager/ServerTerrainManager.java b/src/main/java/electrosphere/server/terrain/manager/ServerTerrainManager.java similarity index 97% rename from src/main/java/electrosphere/game/server/terrain/manager/ServerTerrainManager.java rename to src/main/java/electrosphere/server/terrain/manager/ServerTerrainManager.java index 0ce6c718..c1bde2de 100644 --- a/src/main/java/electrosphere/game/server/terrain/manager/ServerTerrainManager.java +++ b/src/main/java/electrosphere/server/terrain/manager/ServerTerrainManager.java @@ -1,12 +1,12 @@ -package electrosphere.game.server.terrain.manager; +package electrosphere.server.terrain.manager; import com.google.gson.Gson; import electrosphere.game.terrain.processing.TerrainInterpolator; +import electrosphere.server.terrain.generation.TerrainGen; +import electrosphere.server.terrain.models.ModificationList; +import electrosphere.server.terrain.models.TerrainModel; +import electrosphere.server.terrain.models.TerrainModification; import electrosphere.engine.Globals; -import electrosphere.game.server.terrain.generation.TerrainGen; -import electrosphere.game.server.terrain.models.ModificationList; -import electrosphere.game.server.terrain.models.TerrainModel; -import electrosphere.game.server.terrain.models.TerrainModification; import electrosphere.util.FileUtils; import electrosphere.util.Utilities; import java.io.File; diff --git a/src/main/java/electrosphere/game/server/terrain/models/ModificationList.java b/src/main/java/electrosphere/server/terrain/models/ModificationList.java similarity index 89% rename from src/main/java/electrosphere/game/server/terrain/models/ModificationList.java rename to src/main/java/electrosphere/server/terrain/models/ModificationList.java index 64862782..2d215e4f 100644 --- a/src/main/java/electrosphere/game/server/terrain/models/ModificationList.java +++ b/src/main/java/electrosphere/server/terrain/models/ModificationList.java @@ -1,4 +1,4 @@ -package electrosphere.game.server.terrain.models; +package electrosphere.server.terrain.models; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/electrosphere/game/server/terrain/models/TerrainModel.java b/src/main/java/electrosphere/server/terrain/models/TerrainModel.java similarity index 99% rename from src/main/java/electrosphere/game/server/terrain/models/TerrainModel.java rename to src/main/java/electrosphere/server/terrain/models/TerrainModel.java index 6e201708..ee1b2cd2 100644 --- a/src/main/java/electrosphere/game/server/terrain/models/TerrainModel.java +++ b/src/main/java/electrosphere/server/terrain/models/TerrainModel.java @@ -1,4 +1,4 @@ -package electrosphere.game.server.terrain.models; +package electrosphere.server.terrain.models; import java.util.ArrayList; import java.util.HashMap; diff --git a/src/main/java/electrosphere/game/server/terrain/models/TerrainModification.java b/src/main/java/electrosphere/server/terrain/models/TerrainModification.java similarity index 94% rename from src/main/java/electrosphere/game/server/terrain/models/TerrainModification.java rename to src/main/java/electrosphere/server/terrain/models/TerrainModification.java index fbad74b8..51841a92 100644 --- a/src/main/java/electrosphere/game/server/terrain/models/TerrainModification.java +++ b/src/main/java/electrosphere/server/terrain/models/TerrainModification.java @@ -1,4 +1,4 @@ -package electrosphere.game.server.terrain.models; +package electrosphere.server.terrain.models; /** * diff --git a/src/main/java/electrosphere/util/worldviewer/TerrainViewer.java b/src/main/java/electrosphere/util/worldviewer/TerrainViewer.java index c82e35a1..a50f79bd 100644 --- a/src/main/java/electrosphere/util/worldviewer/TerrainViewer.java +++ b/src/main/java/electrosphere/util/worldviewer/TerrainViewer.java @@ -1,8 +1,9 @@ package electrosphere.util.worldviewer; -import electrosphere.game.server.terrain.manager.ServerTerrainManager; -import electrosphere.game.server.terrain.models.TerrainModel; import electrosphere.server.simulation.MacroSimulation; +import electrosphere.server.terrain.manager.ServerTerrainManager; +import electrosphere.server.terrain.models.TerrainModel; + import java.util.Random; import java.util.concurrent.TimeUnit; import javax.swing.JFrame; diff --git a/src/main/java/electrosphere/util/worldviewer/TerrainViewerJComponent.java b/src/main/java/electrosphere/util/worldviewer/TerrainViewerJComponent.java index e4edd0fd..62b19e8c 100644 --- a/src/main/java/electrosphere/util/worldviewer/TerrainViewerJComponent.java +++ b/src/main/java/electrosphere/util/worldviewer/TerrainViewerJComponent.java @@ -1,10 +1,11 @@ package electrosphere.util.worldviewer; -import electrosphere.game.server.terrain.models.TerrainModel; import java.awt.Color; import java.awt.Graphics; import javax.swing.JComponent; +import electrosphere.server.terrain.models.TerrainModel; + /** * * @author amaterasu