move lots of global state to clientState
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-05-15 12:26:29 -04:00
parent f7790931bc
commit bf982f0a87
28 changed files with 128 additions and 107 deletions

View File

@ -1806,9 +1806,8 @@ Properly reset ClientState
Move clientWorldData to clientState Move clientWorldData to clientState
Move clientScene to clientState Move clientScene to clientState
Move clientSceneWrapper to clientState Move clientSceneWrapper to clientState
Move clientSimulation to clientState
Move clientSynchronizationMAnager to clientState
Move clientConnection to clientState Move clientConnection to clientState
Move lots of global state to clientState

View File

@ -1,8 +1,15 @@
package electrosphere.client; package electrosphere.client;
import electrosphere.client.block.ClientBlockManager;
import electrosphere.client.chemistry.ClientChemistryCollisionCallback;
import electrosphere.client.entity.character.ClientCharacterManager;
import electrosphere.client.fluid.manager.ClientFluidManager;
import electrosphere.client.scene.ClientSceneWrapper; import electrosphere.client.scene.ClientSceneWrapper;
import electrosphere.client.scene.ClientWorldData; import electrosphere.client.scene.ClientWorldData;
import electrosphere.client.sim.ClientSimulation; import electrosphere.client.sim.ClientSimulation;
import electrosphere.client.terrain.foliage.FoliageCellManager;
import electrosphere.client.terrain.manager.ClientTerrainManager;
import electrosphere.collision.CollisionEngine;
import electrosphere.entity.scene.Scene; import electrosphere.entity.scene.Scene;
import electrosphere.net.client.ClientNetworking; import electrosphere.net.client.ClientNetworking;
import electrosphere.net.synchronization.client.ClientSynchronizationManager; import electrosphere.net.synchronization.client.ClientSynchronizationManager;
@ -20,7 +27,7 @@ public class ClientState {
/** /**
* The scene on the client * The scene on the client
*/ */
public Scene clientScene; public Scene clientScene = new Scene();
/** /**
* The client scene wrapper * The client scene wrapper
@ -42,4 +49,36 @@ public class ClientState {
*/ */
public ClientNetworking clientConnection; public ClientNetworking clientConnection;
/**
* The foliage cell manager
*/
public FoliageCellManager foliageCellManager;
/**
* Manages characters on the client
*/
public ClientCharacterManager clientCharacterManager = new ClientCharacterManager();
/**
* Manages terrain data on client
*/
public ClientTerrainManager clientTerrainManager = new ClientTerrainManager();
/**
* Manages fluid data on client
*/
public ClientFluidManager clientFluidManager = new ClientFluidManager();
/**
* Manages block data on client
*/
public ClientBlockManager clientBlockManager = new ClientBlockManager();
/**
* Constructor
*/
public ClientState(){
this.clientSceneWrapper = new ClientSceneWrapper(this.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
}
} }

View File

@ -33,7 +33,7 @@ public class ClientBlockSelection {
for(int z = 0; z < Globals.clientState.clientWorldData.getWorldDiscreteSize(); z++){ for(int z = 0; z < Globals.clientState.clientWorldData.getWorldDiscreteSize(); z++){
chunkPos = new Vector3i(x,y,z); chunkPos = new Vector3i(x,y,z);
BlockChunkData blockChunkData = Globals.clientBlockManager.getChunkDataAtWorldPoint(chunkPos, 0); BlockChunkData blockChunkData = Globals.clientState.clientBlockManager.getChunkDataAtWorldPoint(chunkPos, 0);
if(blockChunkData.getHomogenousValue() == BlockChunkData.BLOCK_TYPE_EMPTY){ if(blockChunkData.getHomogenousValue() == BlockChunkData.BLOCK_TYPE_EMPTY){
continue; continue;
} }
@ -98,7 +98,7 @@ public class ClientBlockSelection {
Vector3i blockStart = Globals.clientState.clientWorldData.convertRealToBlockSpace(selection.getRectStart()); Vector3i blockStart = Globals.clientState.clientWorldData.convertRealToBlockSpace(selection.getRectStart());
Vector3i blockEnd = Globals.clientState.clientWorldData.convertRealToBlockSpace(selection.getRectEnd()); Vector3i blockEnd = Globals.clientState.clientWorldData.convertRealToBlockSpace(selection.getRectEnd());
BlockChunkData chunk = Globals.clientBlockManager.getChunkDataAtWorldPoint(startChunk, 0); BlockChunkData chunk = Globals.clientState.clientBlockManager.getChunkDataAtWorldPoint(startChunk, 0);
if(chunk == null){ if(chunk == null){
throw new Error("Failed to grab chunk at " + startChunk); throw new Error("Failed to grab chunk at " + startChunk);
} }

View File

@ -114,7 +114,7 @@ public class BlockDrawCell {
public void generateDrawableEntity(BlockTextureAtlas atlas, int lod){ public void generateDrawableEntity(BlockTextureAtlas atlas, int lod){
boolean success = true; boolean success = true;
if(chunkData == null){ if(chunkData == null){
BlockChunkData currentChunk = Globals.clientBlockManager.getChunkDataAtWorldPoint( BlockChunkData currentChunk = Globals.clientState.clientBlockManager.getChunkDataAtWorldPoint(
worldPos.x, worldPos.x,
worldPos.y, worldPos.y,
worldPos.z, worldPos.z,

View File

@ -711,11 +711,11 @@ public class ClientBlockCellManager {
worldPos.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() && worldPos.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.z >= 0 && worldPos.z >= 0 &&
worldPos.z < Globals.clientState.clientWorldData.getWorldDiscreteSize() && worldPos.z < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
!Globals.clientBlockManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, lod) !Globals.clientState.clientBlockManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, lod)
){ ){
//client should request chunk data from server for each chunk necessary to create the model //client should request chunk data from server for each chunk necessary to create the model
LoggerInterface.loggerNetworking.DEBUG("(Client) Send Request for block data at " + worldPos); LoggerInterface.loggerNetworking.DEBUG("(Client) Send Request for block data at " + worldPos);
if(!Globals.clientBlockManager.requestChunk(worldPos.x, worldPos.y, worldPos.z, lod)){ if(!Globals.clientState.clientBlockManager.requestChunk(worldPos.x, worldPos.y, worldPos.z, lod)){
return false; return false;
} }
} }
@ -731,7 +731,7 @@ public class ClientBlockCellManager {
BlockDrawCell cell = node.getData(); BlockDrawCell cell = node.getData();
int lod = this.chunkTree.getMaxLevel() - node.getLevel(); int lod = this.chunkTree.getMaxLevel() - node.getLevel();
Vector3i worldPos = cell.getWorldPos(); Vector3i worldPos = cell.getWorldPos();
if(!Globals.clientBlockManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, lod)){ if(!Globals.clientState.clientBlockManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, lod)){
return false; return false;
} }
return true; return true;

View File

@ -65,7 +65,7 @@ public class FluidCell {
Globals.clientState.clientScene.deregisterEntity(modelEntity); Globals.clientState.clientScene.deregisterEntity(modelEntity);
} }
FluidChunkData currentChunk = Globals.clientFluidManager.getChunkDataAtWorldPoint(worldPos); FluidChunkData currentChunk = Globals.clientState.clientFluidManager.getChunkDataAtWorldPoint(worldPos);
if(!currentChunk.isHomogenous()){ if(!currentChunk.isHomogenous()){
this.fillInData(currentChunk); this.fillInData(currentChunk);
modelEntity = FluidChunk.clientCreateFluidChunkEntity(weights); modelEntity = FluidChunk.clientCreateFluidChunkEntity(weights);

View File

@ -169,7 +169,7 @@ public class FluidCellManager {
if(containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z)){ if(containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z)){
FluidCell cell = FluidCell.generateFluidCell( FluidCell cell = FluidCell.generateFluidCell(
worldPos, worldPos,
Globals.clientFluidManager.getChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z), Globals.clientState.clientFluidManager.getChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z),
program program
); );
cells.add(cell); cells.add(cell);
@ -399,8 +399,8 @@ public class FluidCellManager {
} }
boolean containsChunkDataAtWorldPoint(int worldX, int worldY, int worldZ){ boolean containsChunkDataAtWorldPoint(int worldX, int worldY, int worldZ){
if(Globals.clientFluidManager != null){ if(Globals.clientState.clientFluidManager != null){
return Globals.clientFluidManager.containsChunkDataAtWorldPoint(worldX,worldY,worldZ); return Globals.clientState.clientFluidManager.containsChunkDataAtWorldPoint(worldX,worldY,worldZ);
} }
return true; return true;
} }
@ -413,7 +413,7 @@ public class FluidCellManager {
* @return The chunk data at the specified points * @return The chunk data at the specified points
*/ */
ChunkData getChunkDataAtPoint(int worldX, int worldY, int worldZ){ ChunkData getChunkDataAtPoint(int worldX, int worldY, int worldZ){
return Globals.clientTerrainManager.getChunkDataAtWorldPoint(worldX,worldY,worldZ,ChunkData.NO_STRIDE); return Globals.clientState.clientTerrainManager.getChunkDataAtWorldPoint(worldX,worldY,worldZ,ChunkData.NO_STRIDE);
} }

View File

@ -277,7 +277,7 @@ public class ClientInteractionEngine {
collisionPosition.x >= 0 && collisionPosition.y >= 0 && collisionPosition.z >= 0 collisionPosition.x >= 0 && collisionPosition.y >= 0 && collisionPosition.z >= 0
){ ){
//grab block at point //grab block at point
BlockChunkData blockChunkData = Globals.clientBlockManager.getChunkDataAtWorldPoint(Globals.clientState.clientWorldData.convertRealToWorldSpace(collisionPosition), 0); BlockChunkData blockChunkData = Globals.clientState.clientBlockManager.getChunkDataAtWorldPoint(Globals.clientState.clientWorldData.convertRealToWorldSpace(collisionPosition), 0);
if(blockChunkData != null){ if(blockChunkData != null){
Vector3i blockPos = Globals.clientState.clientWorldData.convertRealToBlockSpace(new Vector3d(collisionPosition).add(new Vector3d(eyePos).mul(-BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0f))); Vector3i blockPos = Globals.clientState.clientWorldData.convertRealToBlockSpace(new Vector3d(collisionPosition).add(new Vector3d(eyePos).mul(-BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0f)));
if(!blockChunkData.isEmpty(blockPos.x, blockPos.y, blockPos.z)){ if(!blockChunkData.isEmpty(blockPos.x, blockPos.y, blockPos.z)){
@ -291,7 +291,7 @@ public class ClientInteractionEngine {
} }
//if we didn't find a block type, try terrain //if we didn't find a block type, try terrain
if(!set){ if(!set){
ChunkData chunkData = Globals.clientTerrainManager.getChunkDataAtWorldPoint(Globals.clientState.clientWorldData.convertRealToWorldSpace(collisionPosition), 0); ChunkData chunkData = Globals.clientState.clientTerrainManager.getChunkDataAtWorldPoint(Globals.clientState.clientWorldData.convertRealToWorldSpace(collisionPosition), 0);
if(chunkData != null){ if(chunkData != null){
int voxelType = chunkData.getType(Globals.clientState.clientWorldData.convertRealToVoxelSpace(new Vector3d(collisionPosition).add(new Vector3d(ServerTerrainChunk.VOXEL_SIZE / 2.0f)))); int voxelType = chunkData.getType(Globals.clientState.clientWorldData.convertRealToVoxelSpace(new Vector3d(collisionPosition).add(new Vector3d(ServerTerrainChunk.VOXEL_SIZE / 2.0f))));
if(voxelType != ServerTerrainChunk.VOXEL_TYPE_AIR){ if(voxelType != ServerTerrainChunk.VOXEL_TYPE_AIR){

View File

@ -204,7 +204,7 @@ public class AreaSelection {
} }
continue; continue;
} }
BlockChunkData chunkData = Globals.clientBlockManager.getChunkDataAtWorldPoint(currChunkPos, BlockChunkData.LOD_FULL_RES); BlockChunkData chunkData = Globals.clientState.clientBlockManager.getChunkDataAtWorldPoint(currChunkPos, BlockChunkData.LOD_FULL_RES);
if(chunkData == null){ if(chunkData == null){
switch(increment % 6){ switch(increment % 6){
case 0: { case 0: {

View File

@ -42,6 +42,13 @@ public class ClientSimulation {
* Main simulation function * Main simulation function
*/ */
public void simulate(){ public void simulate(){
//
//check for dependencies
if(Globals.clientState.clientSceneWrapper == null){
return;
}
Globals.profiler.beginCpuSample("simulate"); Globals.profiler.beginCpuSample("simulate");
// //
@ -88,8 +95,8 @@ public class ClientSimulation {
Globals.profiler.endCpuSample(); Globals.profiler.endCpuSample();
// //
//update foliage //update foliage
if(Globals.foliageCellManager != null){ if(Globals.clientState.foliageCellManager != null){
Globals.foliageCellManager.update(); Globals.clientState.foliageCellManager.update();
} }
// //
//targeting crosshair //targeting crosshair
@ -173,16 +180,16 @@ public class ClientSimulation {
*/ */
public void loadTerrain(){ public void loadTerrain(){
Globals.profiler.beginCpuSample("ClientSimulation.loadTerrain"); Globals.profiler.beginCpuSample("ClientSimulation.loadTerrain");
if(Globals.clientTerrainManager != null){ if(Globals.clientState.clientTerrainManager != null){
Globals.clientTerrainManager.handleMessages(); Globals.clientState.clientTerrainManager.handleMessages();
this.updateTerrainCellManager(); this.updateTerrainCellManager();
} }
if(Globals.clientFluidManager != null && Globals.RUN_FLUIDS){ if(Globals.clientState.clientFluidManager != null && Globals.RUN_FLUIDS){
Globals.clientFluidManager.handleMessages(); Globals.clientState.clientFluidManager.handleMessages();
this.updateFluidCellManager(); this.updateFluidCellManager();
} }
if(Globals.clientBlockManager != null){ if(Globals.clientState.clientBlockManager != null){
Globals.clientBlockManager.handleMessages(); Globals.clientState.clientBlockManager.handleMessages();
this.updateBlockCellManager(); this.updateBlockCellManager();
} }
Globals.profiler.endCpuSample(); Globals.profiler.endCpuSample();

View File

@ -848,11 +848,11 @@ public class ClientDrawCellManager {
worldPos.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() && worldPos.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.z >= 0 && worldPos.z >= 0 &&
worldPos.z < Globals.clientState.clientWorldData.getWorldDiscreteSize() && worldPos.z < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
!Globals.clientTerrainManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, lod) !Globals.clientState.clientTerrainManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, lod)
){ ){
//client should request chunk data from server for each chunk necessary to create the model //client should request chunk data from server for each chunk necessary to create the model
LoggerInterface.loggerNetworking.DEBUG("(Client) Send Request for terrain at " + worldPos); LoggerInterface.loggerNetworking.DEBUG("(Client) Send Request for terrain at " + worldPos);
if(!Globals.clientTerrainManager.requestChunk(worldPos.x, worldPos.y, worldPos.z, lod)){ if(!Globals.clientState.clientTerrainManager.requestChunk(worldPos.x, worldPos.y, worldPos.z, lod)){
return false; return false;
} }
} }
@ -892,10 +892,10 @@ public class ClientDrawCellManager {
posToCheck.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() && posToCheck.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
posToCheck.z >= 0 && posToCheck.z >= 0 &&
posToCheck.z < Globals.clientState.clientWorldData.getWorldDiscreteSize() && posToCheck.z < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
!Globals.clientTerrainManager.containsChunkDataAtWorldPoint(posToCheck.x, posToCheck.y, posToCheck.z, highResLod) !Globals.clientState.clientTerrainManager.containsChunkDataAtWorldPoint(posToCheck.x, posToCheck.y, posToCheck.z, highResLod)
){ ){
LoggerInterface.loggerNetworking.DEBUG("(Client) Send Request for terrain at " + posToCheck); LoggerInterface.loggerNetworking.DEBUG("(Client) Send Request for terrain at " + posToCheck);
if(!Globals.clientTerrainManager.requestChunk(posToCheck.x, posToCheck.y, posToCheck.z, highResLod)){ if(!Globals.clientState.clientTerrainManager.requestChunk(posToCheck.x, posToCheck.y, posToCheck.z, highResLod)){
return false; return false;
} }
} }
@ -917,7 +917,7 @@ public class ClientDrawCellManager {
int lod = this.chunkTree.getMaxLevel() - node.getLevel(); int lod = this.chunkTree.getMaxLevel() - node.getLevel();
int spacingFactor = (int)Math.pow(2,lod); int spacingFactor = (int)Math.pow(2,lod);
Vector3i worldPos = cell.getWorldPos(); Vector3i worldPos = cell.getWorldPos();
if(!Globals.clientTerrainManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, lod)){ if(!Globals.clientState.clientTerrainManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, lod)){
return false; return false;
} }
int highResLod = this.chunkTree.getMaxLevel() - (node.getLevel() + 1); int highResLod = this.chunkTree.getMaxLevel() - (node.getLevel() + 1);
@ -956,7 +956,7 @@ public class ClientDrawCellManager {
posToCheck.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() && posToCheck.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
posToCheck.z >= 0 && posToCheck.z >= 0 &&
posToCheck.z < Globals.clientState.clientWorldData.getWorldDiscreteSize() && posToCheck.z < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
!Globals.clientTerrainManager.containsChunkDataAtWorldPoint(posToCheck.x, posToCheck.y, posToCheck.z, highResLod) !Globals.clientState.clientTerrainManager.containsChunkDataAtWorldPoint(posToCheck.x, posToCheck.y, posToCheck.z, highResLod)
){ ){
return false; return false;
} }

View File

@ -147,7 +147,7 @@ public class DrawCell {
public void generateDrawableEntity(VoxelTextureAtlas atlas, int lod, List<DrawCellFace> higherLODFaces){ public void generateDrawableEntity(VoxelTextureAtlas atlas, int lod, List<DrawCellFace> higherLODFaces){
boolean success = true; boolean success = true;
if(chunkData == null){ if(chunkData == null){
ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint( ChunkData currentChunk = Globals.clientState.clientTerrainManager.getChunkDataAtWorldPoint(
worldPos.x, worldPos.x,
worldPos.y, worldPos.y,
worldPos.z, worldPos.z,
@ -292,7 +292,7 @@ public class DrawCell {
//implicitly performing transforms to adapt from face-space to world & local space //implicitly performing transforms to adapt from face-space to world & local space
switch(higherLODFace){ switch(higherLODFace){
case X_POSITIVE: { case X_POSITIVE: {
ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint( ChunkData currentChunk = Globals.clientState.clientTerrainManager.getChunkDataAtWorldPoint(
new Vector3i( new Vector3i(
worldPos.x + mainSpacing, worldPos.x + mainSpacing,
worldPos.y + worldCoordOffset1, worldPos.y + worldCoordOffset1,
@ -318,7 +318,7 @@ public class DrawCell {
} }
} break; } break;
case X_NEGATIVE: { case X_NEGATIVE: {
ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint( ChunkData currentChunk = Globals.clientState.clientTerrainManager.getChunkDataAtWorldPoint(
new Vector3i( new Vector3i(
worldPos.x, worldPos.x,
worldPos.y + worldCoordOffset1, worldPos.y + worldCoordOffset1,
@ -344,7 +344,7 @@ public class DrawCell {
} }
} break; } break;
case Y_POSITIVE: { case Y_POSITIVE: {
ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint( ChunkData currentChunk = Globals.clientState.clientTerrainManager.getChunkDataAtWorldPoint(
new Vector3i( new Vector3i(
worldPos.x + worldCoordOffset1, worldPos.x + worldCoordOffset1,
worldPos.y + mainSpacing, worldPos.y + mainSpacing,
@ -370,7 +370,7 @@ public class DrawCell {
} }
} break; } break;
case Y_NEGATIVE: { case Y_NEGATIVE: {
ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint( ChunkData currentChunk = Globals.clientState.clientTerrainManager.getChunkDataAtWorldPoint(
new Vector3i( new Vector3i(
worldPos.x + worldCoordOffset1, worldPos.x + worldCoordOffset1,
worldPos.y, worldPos.y,
@ -396,7 +396,7 @@ public class DrawCell {
} }
} break; } break;
case Z_POSITIVE: { case Z_POSITIVE: {
ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint( ChunkData currentChunk = Globals.clientState.clientTerrainManager.getChunkDataAtWorldPoint(
new Vector3i( new Vector3i(
worldPos.x + worldCoordOffset1, worldPos.x + worldCoordOffset1,
worldPos.y + worldCoordOffset2, worldPos.y + worldCoordOffset2,
@ -422,7 +422,7 @@ public class DrawCell {
} }
} break; } break;
case Z_NEGATIVE: { case Z_NEGATIVE: {
ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint( ChunkData currentChunk = Globals.clientState.clientTerrainManager.getChunkDataAtWorldPoint(
new Vector3i( new Vector3i(
worldPos.x + worldCoordOffset1, worldPos.x + worldCoordOffset1,
worldPos.y + worldCoordOffset2, worldPos.y + worldCoordOffset2,

View File

@ -226,7 +226,7 @@ public class FoliageCell {
public void generateDrawableEntity(int lod){ public void generateDrawableEntity(int lod){
boolean success = true; boolean success = true;
if(chunkData == null){ if(chunkData == null){
ChunkData currentChunk = Globals.clientTerrainManager.getChunkDataAtWorldPoint( ChunkData currentChunk = Globals.clientState.clientTerrainManager.getChunkDataAtWorldPoint(
worldPos.x, worldPos.x,
worldPos.y, worldPos.y,
worldPos.z, worldPos.z,

View File

@ -814,11 +814,11 @@ public class FoliageCellManager {
worldPos.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() && worldPos.y < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
worldPos.z >= 0 && worldPos.z >= 0 &&
worldPos.z < Globals.clientState.clientWorldData.getWorldDiscreteSize() && worldPos.z < Globals.clientState.clientWorldData.getWorldDiscreteSize() &&
!Globals.clientTerrainManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, ChunkData.NO_STRIDE) !Globals.clientState.clientTerrainManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, ChunkData.NO_STRIDE)
){ ){
//client should request chunk data from server for each chunk necessary to create the model //client should request chunk data from server for each chunk necessary to create the model
LoggerInterface.loggerNetworking.DEBUG("(Client) Send Request for terrain at " + worldPos); LoggerInterface.loggerNetworking.DEBUG("(Client) Send Request for terrain at " + worldPos);
if(!Globals.clientTerrainManager.requestChunk(worldPos.x, worldPos.y, worldPos.z, ChunkData.NO_STRIDE)){ if(!Globals.clientState.clientTerrainManager.requestChunk(worldPos.x, worldPos.y, worldPos.z, ChunkData.NO_STRIDE)){
return false; return false;
} }
} }
@ -833,7 +833,7 @@ public class FoliageCellManager {
private boolean containsDataToGenerate(WorldOctTree.WorldOctTreeNode<FoliageCell> node){ private boolean containsDataToGenerate(WorldOctTree.WorldOctTreeNode<FoliageCell> node){
FoliageCell cell = node.getData(); FoliageCell cell = node.getData();
Vector3i worldPos = cell.getWorldPos(); Vector3i worldPos = cell.getWorldPos();
return Globals.clientTerrainManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, ChunkData.NO_STRIDE); return Globals.clientState.clientTerrainManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, ChunkData.NO_STRIDE);
} }
/** /**

View File

@ -212,7 +212,7 @@ public class FoliageModel {
currVoxelPos.y + currWorldPos.y * ServerTerrainChunk.CHUNK_PLACEMENT_OFFSET, currVoxelPos.y + currWorldPos.y * ServerTerrainChunk.CHUNK_PLACEMENT_OFFSET,
currVoxelPos.z + currWorldPos.z * ServerTerrainChunk.CHUNK_PLACEMENT_OFFSET currVoxelPos.z + currWorldPos.z * ServerTerrainChunk.CHUNK_PLACEMENT_OFFSET
); );
ChunkData data = Globals.clientTerrainManager.getChunkDataAtWorldPoint(currWorldPos,ChunkData.NO_STRIDE); ChunkData data = Globals.clientState.clientTerrainManager.getChunkDataAtWorldPoint(currWorldPos,ChunkData.NO_STRIDE);
if(data == null){ if(data == null){
continue; continue;
} }

View File

@ -185,7 +185,7 @@ public class ClientTerrainManager {
if(message.getchunkResolution() == ChunkData.NO_STRIDE && terrainCache.containsChunkDataAtWorldPoint(message.getworldX(), message.getworldY(), message.getworldZ(), ChunkData.NO_STRIDE)){ if(message.getchunkResolution() == ChunkData.NO_STRIDE && terrainCache.containsChunkDataAtWorldPoint(message.getworldX(), message.getworldY(), message.getworldZ(), ChunkData.NO_STRIDE)){
//this is a full-res chunk, and we already had this chunk in cache //this is a full-res chunk, and we already had this chunk in cache
//need to flag foliage cell to update these positions given that we have changed terrain values //need to flag foliage cell to update these positions given that we have changed terrain values
Globals.foliageCellManager.markUpdateable(message.getworldX(), message.getworldY(), message.getworldZ()); Globals.clientState.foliageCellManager.markUpdateable(message.getworldX(), message.getworldY(), message.getworldZ());
} }
terrainCache.addChunkDataToCache( terrainCache.addChunkDataToCache(
message.getworldX(), message.getworldY(), message.getworldZ(), message.getworldX(), message.getworldY(), message.getworldZ(),

View File

@ -37,8 +37,8 @@ public class ClientVoxelSampler {
int voxelId = 0; int voxelId = 0;
Vector3i chunkSpacePos = Globals.clientState.clientWorldData.convertRealToWorldSpace(realPos); Vector3i chunkSpacePos = Globals.clientState.clientWorldData.convertRealToWorldSpace(realPos);
Vector3i voxelSpacePos = Globals.clientState.clientWorldData.convertRealToVoxelSpace(realPos); Vector3i voxelSpacePos = Globals.clientState.clientWorldData.convertRealToVoxelSpace(realPos);
if(Globals.clientTerrainManager.containsChunkDataAtWorldPoint(chunkSpacePos, ChunkData.NO_STRIDE)){ if(Globals.clientState.clientTerrainManager.containsChunkDataAtWorldPoint(chunkSpacePos, ChunkData.NO_STRIDE)){
ChunkData chunkData = Globals.clientTerrainManager.getChunkDataAtWorldPoint(chunkSpacePos, ChunkData.NO_STRIDE); ChunkData chunkData = Globals.clientState.clientTerrainManager.getChunkDataAtWorldPoint(chunkSpacePos, ChunkData.NO_STRIDE);
voxelId = chunkData.getType(voxelSpacePos); voxelId = chunkData.getType(voxelSpacePos);
} else { } else {
return INVALID_POSITION; return INVALID_POSITION;

View File

@ -40,13 +40,13 @@ public class ImGuiChunkMonitor {
if(Globals.clientBlockCellManager != null){ if(Globals.clientBlockCellManager != null){
ImGui.text("Block node count: " + Globals.clientBlockCellManager.getNodeCount()); ImGui.text("Block node count: " + Globals.clientBlockCellManager.getNodeCount());
} }
if(Globals.foliageCellManager != null){ if(Globals.clientState.foliageCellManager != null){
ImGui.text("Foliage node count: " + Globals.foliageCellManager.getNodeCount()); ImGui.text("Foliage node count: " + Globals.clientState.foliageCellManager.getNodeCount());
} }
if(ImGui.button("Break at chunk")){ if(ImGui.button("Break at chunk")){
if(Globals.foliageCellManager != null){ if(Globals.clientState.foliageCellManager != null){
Vector3i absVoxelPos = Globals.clientState.clientWorldData.convertRealToAbsoluteVoxelSpace(EntityUtils.getPosition(Globals.playerEntity)); Vector3i absVoxelPos = Globals.clientState.clientWorldData.convertRealToAbsoluteVoxelSpace(EntityUtils.getPosition(Globals.playerEntity));
Globals.foliageCellManager.addBreakPoint(absVoxelPos); Globals.clientState.foliageCellManager.addBreakPoint(absVoxelPos);
} }
} }
} }

View File

@ -39,7 +39,7 @@ public class ImGuiClientServices {
LoggerInterface.loggerEngine.WARNING("" + cell); LoggerInterface.loggerEngine.WARNING("" + cell);
LoggerInterface.loggerEngine.WARNING("Chunk topology:"); LoggerInterface.loggerEngine.WARNING("Chunk topology:");
ChunkData data = Globals.clientTerrainManager.getChunkDataAtWorldPoint(cameraWorldPos, 1); ChunkData data = Globals.clientState.clientTerrainManager.getChunkDataAtWorldPoint(cameraWorldPos, 1);
if(data != null){ if(data != null){
for(int x = 0; x < ChunkData.CHUNK_DATA_SIZE; x++){ for(int x = 0; x < ChunkData.CHUNK_DATA_SIZE; x++){
String line = ""; String line = "";
@ -61,17 +61,17 @@ public class ImGuiClientServices {
} }
if(ImGui.button("Print debug info for FoliageCell at camera position")){ if(ImGui.button("Print debug info for FoliageCell at camera position")){
Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera)); Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
FoliageCell cell = Globals.foliageCellManager.getFoliageCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z); FoliageCell cell = Globals.clientState.foliageCellManager.getFoliageCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z);
LoggerInterface.loggerEngine.WARNING("" + cell); LoggerInterface.loggerEngine.WARNING("" + cell);
} }
if(ImGui.button("Debug FoliageCell evaluation at camera position")){ if(ImGui.button("Debug FoliageCell evaluation at camera position")){
Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera)); Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
FoliageCell cell = Globals.foliageCellManager.getFoliageCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z); FoliageCell cell = Globals.clientState.foliageCellManager.getFoliageCell(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z);
cell.setTripDebug(true); cell.setTripDebug(true);
} }
if(ImGui.button("Request terrain at camera position")){ if(ImGui.button("Request terrain at camera position")){
Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera)); Vector3i cameraWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Globals.clientTerrainManager.requestChunk(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z, 0); Globals.clientState.clientTerrainManager.requestChunk(cameraWorldPos.x, cameraWorldPos.y, cameraWorldPos.z, 0);
} }
} }

View File

@ -85,7 +85,7 @@ public class ImGuiEntityFoliageTab {
} }
if(ImGui.button("Regenerate All Grass")){ if(ImGui.button("Regenerate All Grass")){
Globals.foliageCellManager.evictAll(); Globals.clientState.foliageCellManager.evictAll();
} }
} }
} }

View File

@ -53,7 +53,7 @@ public class ImGuiFluidMonitor {
ImGui.text("Undrawable size: " + fluidCellManager.getUndrawableSize()); ImGui.text("Undrawable size: " + fluidCellManager.getUndrawableSize());
ImGui.text("Unrequested size: " + fluidCellManager.getUnrequestedSize()); ImGui.text("Unrequested size: " + fluidCellManager.getUnrequestedSize());
ClientFluidManager clientFluidManager = Globals.clientFluidManager; ClientFluidManager clientFluidManager = Globals.clientState.clientFluidManager;
ImGui.text("ClientFluidManager Data"); ImGui.text("ClientFluidManager Data");
ImGui.text("Message Count (This Frame): " + clientFluidManager.getMessageCount()); ImGui.text("Message Count (This Frame): " + clientFluidManager.getMessageCount());
} }

View File

@ -50,7 +50,7 @@ public class ImGuiTestGen {
//clear client //clear client
Globals.clientDrawCellManager.evictAll(); Globals.clientDrawCellManager.evictAll();
Globals.clientTerrainManager.evictAll(); Globals.clientState.clientTerrainManager.evictAll();
}); });
} }

View File

@ -37,8 +37,8 @@ public class MenuCharacterCreation {
//the list of characters //the list of characters
Div selectContainer = Div.createCol(); Div selectContainer = Div.createCol();
if(Globals.clientCharacterManager.getCharacterList() != null){ if(Globals.clientState.clientCharacterManager.getCharacterList() != null){
for(CharacterDescriptionDTO description : Globals.clientCharacterManager.getCharacterList().getCharacters()){ for(CharacterDescriptionDTO description : Globals.clientState.clientCharacterManager.getCharacterList().getCharacters()){
String buttonTitle = "Character " + description.getId(); String buttonTitle = "Character " + description.getId();
Div charNameContainer = Div.createRow(Button.createButton(buttonTitle, () -> { Div charNameContainer = Div.createRow(Button.createButton(buttonTitle, () -> {
Globals.clientState.clientConnection.queueOutgoingMessage(CharacterMessage.constructRequestSpawnCharacterMessage(description.getId())); Globals.clientState.clientConnection.queueOutgoingMessage(CharacterMessage.constructRequestSpawnCharacterMessage(description.getId()));

View File

@ -13,21 +13,16 @@ import electrosphere.audio.collision.HitboxAudioService;
import electrosphere.audio.movement.MovementAudioService; import electrosphere.audio.movement.MovementAudioService;
import electrosphere.auth.AuthenticationManager; import electrosphere.auth.AuthenticationManager;
import electrosphere.client.ClientState; import electrosphere.client.ClientState;
import electrosphere.client.block.ClientBlockManager;
import electrosphere.client.block.cells.BlockTextureAtlas; import electrosphere.client.block.cells.BlockTextureAtlas;
import electrosphere.client.block.cells.ClientBlockCellManager; import electrosphere.client.block.cells.ClientBlockCellManager;
import electrosphere.client.chemistry.ClientChemistryCollisionCallback; import electrosphere.client.chemistry.ClientChemistryCollisionCallback;
import electrosphere.client.entity.character.ClientCharacterManager;
import electrosphere.client.entity.particle.ParticleService; import electrosphere.client.entity.particle.ParticleService;
import electrosphere.client.fluid.cells.FluidCellManager; import electrosphere.client.fluid.cells.FluidCellManager;
import electrosphere.client.fluid.manager.ClientFluidManager;
import electrosphere.client.player.ClientPlayerData; import electrosphere.client.player.ClientPlayerData;
import electrosphere.client.scene.ClientLevelEditorData; import electrosphere.client.scene.ClientLevelEditorData;
import electrosphere.client.scene.ClientSceneWrapper; import electrosphere.client.scene.ClientSceneWrapper;
import electrosphere.client.terrain.cells.ClientDrawCellManager; import electrosphere.client.terrain.cells.ClientDrawCellManager;
import electrosphere.client.terrain.cells.VoxelTextureAtlas; import electrosphere.client.terrain.cells.VoxelTextureAtlas;
import electrosphere.client.terrain.foliage.FoliageCellManager;
import electrosphere.client.terrain.manager.ClientTerrainManager;
import electrosphere.client.ui.menu.WindowUtils; import electrosphere.client.ui.menu.WindowUtils;
import electrosphere.collision.CollisionEngine; import electrosphere.collision.CollisionEngine;
import electrosphere.collision.CollisionWorldData; import electrosphere.collision.CollisionWorldData;
@ -336,18 +331,6 @@ public class Globals {
//instanced actor manager //instanced actor manager
public static InstanceManager clientInstanceManager = new InstanceManager(); public static InstanceManager clientInstanceManager = new InstanceManager();
//client side foliage manager
// public static ClientFoliageManager clientFoliageManager;
public static FoliageCellManager foliageCellManager;
//client world data
public static ClientCharacterManager clientCharacterManager = new ClientCharacterManager();
//client gridded manager
public static ClientTerrainManager clientTerrainManager;
public static ClientFluidManager clientFluidManager;
public static ClientBlockManager clientBlockManager;
//client player data //client player data
public static ClientPlayerData clientPlayerData = new ClientPlayerData(); public static ClientPlayerData clientPlayerData = new ClientPlayerData();
@ -496,9 +479,6 @@ public class Globals {
//load in shader options map //load in shader options map
shaderOptionMap = FileUtils.loadObjectFromAssetPath("Shaders/shaderoptions.json", ShaderOptionMap.class); shaderOptionMap = FileUtils.loadObjectFromAssetPath("Shaders/shaderoptions.json", ShaderOptionMap.class);
shaderOptionMap.debug(); shaderOptionMap.debug();
//client scene wrapper
Globals.clientState.clientScene = new Scene();
Globals.clientState.clientSceneWrapper = new ClientSceneWrapper(Globals.clientState.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
//temporary hold for skybox colors //temporary hold for skybox colors
skyboxColors = new ArrayList<Vector3f>(); skyboxColors = new ArrayList<Vector3f>();
//load asset manager //load asset manager
@ -508,10 +488,6 @@ public class Globals {
//realm & data cell manager //realm & data cell manager
realmManager = new RealmManager(); realmManager = new RealmManager();
entityDataCellMapper = new EntityDataCellMapper(); entityDataCellMapper = new EntityDataCellMapper();
//gridded managers
Globals.clientTerrainManager = new ClientTerrainManager();
Globals.clientFluidManager = new ClientFluidManager();
Globals.clientBlockManager = new ClientBlockManager();
//game config //game config
gameConfigDefault = electrosphere.data.Config.loadDefaultConfig(); gameConfigDefault = electrosphere.data.Config.loadDefaultConfig();
gameConfigCurrent = gameConfigDefault; gameConfigCurrent = gameConfigDefault;

View File

@ -348,7 +348,7 @@ public class ClientLoading {
){ ){
i++; i++;
if(i % DRAW_CELL_UPDATE_RATE == 0){ if(i % DRAW_CELL_UPDATE_RATE == 0){
WindowUtils.updateLoadingWindow("WAITING ON SERVER TO SEND TERRAIN (" + Globals.clientTerrainManager.getAllChunks().size() + ")"); WindowUtils.updateLoadingWindow("WAITING ON SERVER TO SEND TERRAIN (" + Globals.clientState.clientTerrainManager.getAllChunks().size() + ")");
} }
try { try {
TimeUnit.MILLISECONDS.sleep(10); TimeUnit.MILLISECONDS.sleep(10);
@ -374,7 +374,7 @@ public class ClientLoading {
} }
//initialize draw cell manager //initialize draw cell manager
Globals.fluidCellManager = new FluidCellManager(Globals.clientTerrainManager, 0, 0, 0); Globals.fluidCellManager = new FluidCellManager(Globals.clientState.clientTerrainManager, 0, 0, 0);
Globals.fluidCellManager.setGenerateDrawables(true); Globals.fluidCellManager.setGenerateDrawables(true);
Globals.clientState.clientSimulation.setLoadingTerrain(true); Globals.clientState.clientSimulation.setLoadingTerrain(true);
@ -432,7 +432,7 @@ public class ClientLoading {
){ ){
i++; i++;
if(i % DRAW_CELL_UPDATE_RATE == 0){ if(i % DRAW_CELL_UPDATE_RATE == 0){
WindowUtils.updateLoadingWindow("WAITING ON SERVER TO SEND BLOCKS (" + Globals.clientTerrainManager.getAllChunks().size() + ")"); WindowUtils.updateLoadingWindow("WAITING ON SERVER TO SEND BLOCKS (" + Globals.clientState.clientTerrainManager.getAllChunks().size() + ")");
} }
try { try {
TimeUnit.MILLISECONDS.sleep(10); TimeUnit.MILLISECONDS.sleep(10);
@ -446,8 +446,8 @@ public class ClientLoading {
* Starts up the foliage manager * Starts up the foliage manager
*/ */
private static void initFoliageManager(){ private static void initFoliageManager(){
Globals.foliageCellManager = new FoliageCellManager(Globals.clientState.clientWorldData.getWorldDiscreteSize()); Globals.clientState.foliageCellManager = new FoliageCellManager(Globals.clientState.clientWorldData.getWorldDiscreteSize());
Globals.foliageCellManager.init(); Globals.clientState.foliageCellManager.init();
// Globals.foliageCellManager.start(); // Globals.foliageCellManager.start();
} }

View File

@ -64,7 +64,7 @@ public class ClientPhysicsSyncTree implements BehaviorTree {
if(parent == Globals.playerEntity){ if(parent == Globals.playerEntity){
if(position.distance(EntityUtils.getPosition(parent)) > FoliageCellManager.TELEPORT_DISTANCE){ if(position.distance(EntityUtils.getPosition(parent)) > FoliageCellManager.TELEPORT_DISTANCE){
Globals.clientDrawCellManager.bustDistanceCache(); Globals.clientDrawCellManager.bustDistanceCache();
Globals.foliageCellManager.bustDistanceCache(); Globals.clientState.foliageCellManager.bustDistanceCache();
} }
} }

View File

@ -34,7 +34,7 @@ public class CharacterProtocol implements ClientProtocolTemplate<CharacterMessag
Globals.threadManager.start(clientThread); Globals.threadManager.start(clientThread);
} break; } break;
case RESPONSECHARACTERLIST: { case RESPONSECHARACTERLIST: {
Globals.clientCharacterManager.setCharacterList(new Gson().fromJson(message.getdata(), ClientCharacterListDTO.class)); Globals.clientState.clientCharacterManager.setCharacterList(new Gson().fromJson(message.getdata(), ClientCharacterListDTO.class));
Globals.signalSystem.post(SignalType.UI_MODIFICATION,() -> { Globals.signalSystem.post(SignalType.UI_MODIFICATION,() -> {
WindowUtils.replaceMainMenuContents(MenuCharacterCreation.createCharacterSelectionWindow()); WindowUtils.replaceMainMenuContents(MenuCharacterCreation.createCharacterSelectionWindow());
}); });

View File

@ -53,15 +53,15 @@ public class TerrainProtocol implements ClientProtocolTemplate<TerrainMessage> {
break; break;
case SENDCHUNKDATA: { case SENDCHUNKDATA: {
LoggerInterface.loggerNetworking.DEBUG("(Client) Received terrain at " + message.getworldX() + " " + message.getworldY() + " " + message.getworldZ()); LoggerInterface.loggerNetworking.DEBUG("(Client) Received terrain at " + message.getworldX() + " " + message.getworldY() + " " + message.getworldZ());
Globals.clientTerrainManager.attachTerrainMessage(message); Globals.clientState.clientTerrainManager.attachTerrainMessage(message);
} break; } break;
case SENDREDUCEDCHUNKDATA: { case SENDREDUCEDCHUNKDATA: {
LoggerInterface.loggerNetworking.DEBUG("(Client) Received terrain at " + message.getworldX() + " " + message.getworldY() + " " + message.getworldZ() + " " + message.getchunkResolution()); LoggerInterface.loggerNetworking.DEBUG("(Client) Received terrain at " + message.getworldX() + " " + message.getworldY() + " " + message.getworldZ() + " " + message.getchunkResolution());
Globals.clientTerrainManager.attachTerrainMessage(message); Globals.clientState.clientTerrainManager.attachTerrainMessage(message);
} break; } break;
case SENDREDUCEDBLOCKDATA: { case SENDREDUCEDBLOCKDATA: {
LoggerInterface.loggerNetworking.DEBUG("(Client) Received blocks at " + message.getworldX() + " " + message.getworldY() + " " + message.getworldZ() + " " + message.getchunkResolution()); LoggerInterface.loggerNetworking.DEBUG("(Client) Received blocks at " + message.getworldX() + " " + message.getworldY() + " " + message.getworldZ() + " " + message.getchunkResolution());
Globals.clientBlockManager.attachTerrainMessage(message); Globals.clientState.clientBlockManager.attachTerrainMessage(message);
} break; } break;
case UPDATEVOXEL: { case UPDATEVOXEL: {
// //
@ -95,8 +95,8 @@ public class TerrainProtocol implements ClientProtocolTemplate<TerrainMessage> {
} }
// //
//update the terrain cache //update the terrain cache
if(Globals.clientTerrainManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, ChunkData.NO_STRIDE)){ if(Globals.clientState.clientTerrainManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, ChunkData.NO_STRIDE)){
ChunkData data = Globals.clientTerrainManager.getChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, ChunkData.NO_STRIDE); ChunkData data = Globals.clientState.clientTerrainManager.getChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, ChunkData.NO_STRIDE);
if(data != null){ if(data != null){
data.updatePosition( data.updatePosition(
message.getvoxelX(), message.getvoxelX(),
@ -121,29 +121,29 @@ public class TerrainProtocol implements ClientProtocolTemplate<TerrainMessage> {
// //
//update foliage manager //update foliage manager
Globals.foliageCellManager.markUpdateable( Globals.clientState.foliageCellManager.markUpdateable(
worldPosToUpdate.x, worldPosToUpdate.y, worldPosToUpdate.z, worldPosToUpdate.x, worldPosToUpdate.y, worldPosToUpdate.z,
message.getvoxelX(), message.getvoxelY(), message.getvoxelZ() message.getvoxelX(), message.getvoxelY(), message.getvoxelZ()
); );
if(message.getvoxelX() > 0){ if(message.getvoxelX() > 0){
Globals.foliageCellManager.markUpdateable( Globals.clientState.foliageCellManager.markUpdateable(
worldPosToUpdate.x, worldPosToUpdate.y, worldPosToUpdate.z, worldPosToUpdate.x, worldPosToUpdate.y, worldPosToUpdate.z,
message.getvoxelX() - 1, message.getvoxelY(), message.getvoxelZ() message.getvoxelX() - 1, message.getvoxelY(), message.getvoxelZ()
); );
if(message.getvoxelY() > 0){ if(message.getvoxelY() > 0){
Globals.foliageCellManager.markUpdateable( Globals.clientState.foliageCellManager.markUpdateable(
worldPosToUpdate.x, worldPosToUpdate.y, worldPosToUpdate.z, worldPosToUpdate.x, worldPosToUpdate.y, worldPosToUpdate.z,
message.getvoxelX() - 1, message.getvoxelY() - 1, message.getvoxelZ() message.getvoxelX() - 1, message.getvoxelY() - 1, message.getvoxelZ()
); );
if(message.getvoxelZ() > 0){ if(message.getvoxelZ() > 0){
Globals.foliageCellManager.markUpdateable( Globals.clientState.foliageCellManager.markUpdateable(
worldPosToUpdate.x, worldPosToUpdate.y, worldPosToUpdate.z, worldPosToUpdate.x, worldPosToUpdate.y, worldPosToUpdate.z,
message.getvoxelX() - 1, message.getvoxelY() - 1, message.getvoxelZ() - 1 message.getvoxelX() - 1, message.getvoxelY() - 1, message.getvoxelZ() - 1
); );
} }
} else { } else {
if(message.getvoxelZ() > 0){ if(message.getvoxelZ() > 0){
Globals.foliageCellManager.markUpdateable( Globals.clientState.foliageCellManager.markUpdateable(
worldPosToUpdate.x, worldPosToUpdate.y, worldPosToUpdate.z, worldPosToUpdate.x, worldPosToUpdate.y, worldPosToUpdate.z,
message.getvoxelX() - 1, message.getvoxelY(), message.getvoxelZ() - 1 message.getvoxelX() - 1, message.getvoxelY(), message.getvoxelZ() - 1
); );
@ -151,19 +151,19 @@ public class TerrainProtocol implements ClientProtocolTemplate<TerrainMessage> {
} }
} else { } else {
if(message.getvoxelY() > 0){ if(message.getvoxelY() > 0){
Globals.foliageCellManager.markUpdateable( Globals.clientState.foliageCellManager.markUpdateable(
worldPosToUpdate.x, worldPosToUpdate.y, worldPosToUpdate.z, worldPosToUpdate.x, worldPosToUpdate.y, worldPosToUpdate.z,
message.getvoxelX(), message.getvoxelY() - 1, message.getvoxelZ() message.getvoxelX(), message.getvoxelY() - 1, message.getvoxelZ()
); );
if(message.getvoxelZ() > 0){ if(message.getvoxelZ() > 0){
Globals.foliageCellManager.markUpdateable( Globals.clientState.foliageCellManager.markUpdateable(
worldPosToUpdate.x, worldPosToUpdate.y, worldPosToUpdate.z, worldPosToUpdate.x, worldPosToUpdate.y, worldPosToUpdate.z,
message.getvoxelX(), message.getvoxelY() - 1, message.getvoxelZ() - 1 message.getvoxelX(), message.getvoxelY() - 1, message.getvoxelZ() - 1
); );
} }
} else { } else {
if(message.getvoxelZ() > 0){ if(message.getvoxelZ() > 0){
Globals.foliageCellManager.markUpdateable( Globals.clientState.foliageCellManager.markUpdateable(
worldPosToUpdate.x, worldPosToUpdate.y, worldPosToUpdate.z, worldPosToUpdate.x, worldPosToUpdate.y, worldPosToUpdate.z,
message.getvoxelX(), message.getvoxelY(), message.getvoxelZ() - 1 message.getvoxelX(), message.getvoxelY(), message.getvoxelZ() - 1
); );
@ -205,8 +205,8 @@ public class TerrainProtocol implements ClientProtocolTemplate<TerrainMessage> {
} }
// //
//update the block cache //update the block cache
if(Globals.clientBlockManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, ChunkData.NO_STRIDE)){ if(Globals.clientState.clientBlockManager.containsChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, ChunkData.NO_STRIDE)){
BlockChunkData data = Globals.clientBlockManager.getChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, ChunkData.NO_STRIDE); BlockChunkData data = Globals.clientState.clientBlockManager.getChunkDataAtWorldPoint(worldPos.x, worldPos.y, worldPos.z, ChunkData.NO_STRIDE);
if(data != null){ if(data != null){
data.setType( data.setType(
message.getvoxelX(), message.getvoxelX(),
@ -235,10 +235,10 @@ public class TerrainProtocol implements ClientProtocolTemplate<TerrainMessage> {
} }
} break; } break;
case SENDFLUIDDATA: { case SENDFLUIDDATA: {
Globals.clientFluidManager.attachFluidMessage(message); Globals.clientState.clientFluidManager.attachFluidMessage(message);
} break; } break;
case UPDATEFLUIDDATA: { case UPDATEFLUIDDATA: {
Globals.clientFluidManager.attachFluidMessage(message); Globals.clientState.clientFluidManager.attachFluidMessage(message);
} break; } break;
default: { default: {
LoggerInterface.loggerNetworking.WARNING("Client networking: Unhandled message of type: " + message.getMessageSubtype()); LoggerInterface.loggerNetworking.WARNING("Client networking: Unhandled message of type: " + message.getMessageSubtype());