move clientSceneWrapper to clientState

This commit is contained in:
austin 2025-05-15 12:04:38 -04:00
parent 9edae4055c
commit 295c94f392
74 changed files with 334 additions and 330 deletions

View File

@ -1805,6 +1805,7 @@ Create ClientState global
Properly reset ClientState
Move clientWorldData to clientState
Move clientScene to clientState
Move clientSceneWrapper to clientState

View File

@ -1,5 +1,6 @@
package electrosphere.client;
import electrosphere.client.scene.ClientSceneWrapper;
import electrosphere.client.scene.ClientWorldData;
import electrosphere.entity.scene.Scene;
@ -18,4 +19,9 @@ public class ClientState {
*/
public Scene clientScene;
/**
* The client scene wrapper
*/
public ClientSceneWrapper clientSceneWrapper;
}

View File

@ -117,7 +117,7 @@ public class CameraEntityUtils {
public static void initCamera(){
//destroy if it already exists
if(Globals.playerCamera != null){
Globals.clientSceneWrapper.getScene().deregisterEntity(Globals.playerCamera);
Globals.clientState.clientSceneWrapper.getScene().deregisterEntity(Globals.playerCamera);
}
//create
if(Globals.controlHandler.cameraIsThirdPerson()){

View File

@ -62,7 +62,7 @@ public class DebugVisualizerUtils {
callback.accept(rVal);
}
};
Globals.clientSceneWrapper.getScene().registerBehaviorTree(updateTree);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(updateTree);
return rVal;
}

View File

@ -32,7 +32,7 @@ public class ParticleUtils {
// ClientParticleTree particleTree = new ClientParticleTree(rVal, 10, new Vector3f(0,0,0), 0, 0, false);
// rVal.putData(EntityDataStrings.TREE_CLIENTPARTICLETREE, particleTree);
// rVal.putData(EntityDataStrings.IS_PARTICLE, true);
// Globals.clientSceneWrapper.getScene().registerEntityToTag(rVal, EntityTags.PARTICLE);
// Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(rVal, EntityTags.PARTICLE);
// return rVal;
// }
@ -54,7 +54,7 @@ public class ParticleUtils {
//behavior tree attachments
ClientParticleTree.attachTree(rVal, data, destination);
rVal.putData(EntityDataStrings.IS_PARTICLE, true);
Globals.clientSceneWrapper.getScene().registerEntityToTag(rVal, EntityTags.PARTICLE);
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(rVal, EntityTags.PARTICLE);
return rVal;
}

View File

@ -85,7 +85,7 @@ public class FluidCell {
* Destroys a drawcell including its physics
*/
public void destroy(){
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
if(modelEntity != null){
collisionEngine.destroyPhysics(modelEntity);
ClientEntityUtils.destroyEntity(modelEntity);

View File

@ -55,11 +55,11 @@ public class ButtonInteraction {
WindowUtils.openInteractionMenu(interactionData.getWindowTarget(), interactionData.getWindowData());
} break;
case InteractionData.ON_INTERACT_HARVEST: {
int serverEntityId = Globals.clientSceneWrapper.mapClientToServerId(target.getId());
int serverEntityId = Globals.clientState.clientSceneWrapper.mapClientToServerId(target.getId());
Globals.clientConnection.queueOutgoingMessage(EntityMessage.constructinteractMessage(serverEntityId, InteractionData.ON_INTERACT_HARVEST));
} break;
case InteractionData.ON_INTERACT_DOOR: {
int serverEntityId = Globals.clientSceneWrapper.mapClientToServerId(target.getId());
int serverEntityId = Globals.clientState.clientSceneWrapper.mapClientToServerId(target.getId());
Globals.clientConnection.queueOutgoingMessage(EntityMessage.constructinteractMessage(serverEntityId, InteractionData.ON_INTERACT_DOOR));
} break;
case InteractionData.ON_INTERACT_DIALOG: {
@ -69,7 +69,7 @@ public class ButtonInteraction {
LoggerInterface.loggerEngine.DEBUG("Interacting with inventory");
InventoryMainWindow.viewInventory(target);
InventoryMainWindow.viewInventory(Globals.playerEntity);
Globals.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestWatchInventoryMessage(Globals.clientSceneWrapper.mapClientToServerId(target.getId())));
Globals.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestWatchInventoryMessage(Globals.clientState.clientSceneWrapper.mapClientToServerId(target.getId())));
} break;
default: {
throw new Error("Unhandled interaction signal " + interactionData.getOnInteract());

View File

@ -59,7 +59,7 @@ public class ClientInteractionEngine {
//
//create dbody
rigidBody = CollisionBodyCreation.createCylinderBody(
Globals.clientSceneWrapper.getInteractionEngine(),
Globals.clientState.clientSceneWrapper.getInteractionEngine(),
physicsTemplate.getDimension1(),
physicsTemplate.getDimension2(),
categoryBit
@ -68,7 +68,7 @@ public class ClientInteractionEngine {
//
//set offset from center of entity position
CollisionBodyCreation.setOffsetPosition(
Globals.clientSceneWrapper.getInteractionEngine(),
Globals.clientState.clientSceneWrapper.getInteractionEngine(),
rigidBody,
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
);
@ -88,13 +88,13 @@ public class ClientInteractionEngine {
rVal.putData(EntityDataStrings.INTERACTION_COLLIDABLE, collidable);
rVal.putData(EntityDataStrings.INTERACTION_BODY, rigidBody);
Globals.clientSceneWrapper.getInteractionEngine().registerCollisionObject(rigidBody, collidable);
Globals.clientState.clientSceneWrapper.getInteractionEngine().registerCollisionObject(rigidBody, collidable);
} break;
case "CUBE": {
//
//create dbody
rigidBody = CollisionBodyCreation.createCubeBody(
Globals.clientSceneWrapper.getInteractionEngine(),
Globals.clientState.clientSceneWrapper.getInteractionEngine(),
new Vector3d(physicsTemplate.getDimension1(),physicsTemplate.getDimension2(),physicsTemplate.getDimension3()),
categoryBit
);
@ -102,7 +102,7 @@ public class ClientInteractionEngine {
//
//set offset from center of entity position
CollisionBodyCreation.setOffsetPosition(
Globals.clientSceneWrapper.getInteractionEngine(),
Globals.clientState.clientSceneWrapper.getInteractionEngine(),
rigidBody,
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
);
@ -123,13 +123,13 @@ public class ClientInteractionEngine {
rVal.putData(EntityDataStrings.INTERACTION_COLLIDABLE, collidable);
rVal.putData(EntityDataStrings.INTERACTION_BODY, rigidBody);
Globals.clientSceneWrapper.getInteractionEngine().registerCollisionObject(rigidBody, collidable);
Globals.clientState.clientSceneWrapper.getInteractionEngine().registerCollisionObject(rigidBody, collidable);
} break;
case "CAPSULE": {
//
//create dbody
rigidBody = CollisionBodyCreation.createCapsuleBody(
Globals.clientSceneWrapper.getInteractionEngine(),
Globals.clientState.clientSceneWrapper.getInteractionEngine(),
physicsTemplate.getDimension2(),
physicsTemplate.getDimension2() - physicsTemplate.getDimension1() - physicsTemplate.getDimension1(),
categoryBit
@ -138,7 +138,7 @@ public class ClientInteractionEngine {
//
//set offset from center of entity position
CollisionBodyCreation.setOffsetPosition(
Globals.clientSceneWrapper.getInteractionEngine(),
Globals.clientState.clientSceneWrapper.getInteractionEngine(),
rigidBody,
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
);
@ -159,7 +159,7 @@ public class ClientInteractionEngine {
rVal.putData(EntityDataStrings.INTERACTION_COLLIDABLE, collidable);
rVal.putData(EntityDataStrings.INTERACTION_BODY, rigidBody);
Globals.clientSceneWrapper.getInteractionEngine().registerCollisionObject(rigidBody, collidable);
Globals.clientState.clientSceneWrapper.getInteractionEngine().registerCollisionObject(rigidBody, collidable);
} break;
default: {
throw new Error("Unsupported shape type! " + physicsTemplate.getType());
@ -174,7 +174,7 @@ public class ClientInteractionEngine {
*/
public static void destroyCollidableTemplate(Entity rVal){
lock.lock();
CollisionEngine interactionEngine = Globals.clientSceneWrapper.getInteractionEngine();
CollisionEngine interactionEngine = Globals.clientState.clientSceneWrapper.getInteractionEngine();
DBody body = null;
Collidable collidable = null;
if(rVal.containsKey(EntityDataStrings.INTERACTION_BODY)){
@ -198,7 +198,7 @@ public class ClientInteractionEngine {
*/
private static void updateInteractableTransforms(){
lock.lock();
CollisionEngine interactionEngine = Globals.clientSceneWrapper.getInteractionEngine();
CollisionEngine interactionEngine = Globals.clientState.clientSceneWrapper.getInteractionEngine();
for(Entity entity : interactables){
if(entity != null){
Vector3d entityPosition = EntityUtils.getPosition(entity);
@ -216,7 +216,7 @@ public class ClientInteractionEngine {
*/
public static Entity rayCast(Vector3d centerPos, Vector3d eyePos){
lock.lock();
CollisionEngine interactionEngine = Globals.clientSceneWrapper.getInteractionEngine();
CollisionEngine interactionEngine = Globals.clientState.clientSceneWrapper.getInteractionEngine();
//update position of all interactables
ClientInteractionEngine.updateInteractableTransforms();
//ray cast
@ -244,7 +244,7 @@ public class ClientInteractionEngine {
set = true;
}
if(!set){
target = Globals.clientSceneWrapper.getCollisionEngine().rayCast(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
target = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCast(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
if(target != null){
EntityType type = CommonEntityUtils.getEntityType(target);
if(type == null){
@ -270,7 +270,7 @@ public class ClientInteractionEngine {
}
}
if(!set){
Vector3d collisionPosition = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(centerPos, new Vector3d(eyePos).mul(-1), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
Vector3d collisionPosition = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(centerPos, new Vector3d(eyePos).mul(-1), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
if(
collisionPosition != null &&
collisionPosition.distance(centerPos) < CollisionEngine.DEFAULT_INTERACT_DISTANCE &&
@ -353,7 +353,7 @@ public class ClientInteractionEngine {
*/
public static int getCollidablesCount(){
lock.lock();
CollisionEngine interactionEngine = Globals.clientSceneWrapper.getInteractionEngine();
CollisionEngine interactionEngine = Globals.clientState.clientSceneWrapper.getInteractionEngine();
int rVal = interactionEngine.getCollidables().size();
lock.unlock();
return rVal;

View File

@ -55,7 +55,7 @@ public class ItemActions {
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
if(cursorPos == null){
cursorPos = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
}
if(cursorPos == null){
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
@ -115,7 +115,7 @@ public class ItemActions {
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
if(cursorPos == null){
cursorPos = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
}
if(cursorPos == null){
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
@ -140,7 +140,7 @@ public class ItemActions {
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
if(cursorPos == null){
cursorPos = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
}
if(cursorPos == null){
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
@ -173,7 +173,7 @@ public class ItemActions {
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
if(cursorPos == null){
cursorPos = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
}
if(cursorPos == null){
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
@ -225,7 +225,7 @@ public class ItemActions {
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
if(cursorPos == null){
cursorPos = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
}
if(cursorPos == null){
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
@ -277,7 +277,7 @@ public class ItemActions {
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Vector3d cursorPos = Globals.cursorState.getCursorPosition();
if(cursorPos == null){
cursorPos = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
cursorPos = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
}
if(cursorPos == null){
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));

View File

@ -42,7 +42,7 @@ public class ScriptClientVoxelUtils {
*/
@Export
public static void applyEdit(){
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
Entity camera = Globals.playerCamera;
if(
collisionEngine != null &&
@ -66,7 +66,7 @@ public class ScriptClientVoxelUtils {
*/
@Export
public static void spawnWater(){
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
Entity camera = Globals.playerCamera;
if(
collisionEngine != null &&
@ -102,7 +102,7 @@ public class ScriptClientVoxelUtils {
*/
@Export
public static void dig(){
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
Entity camera = Globals.playerCamera;
if(
collisionEngine != null &&

View File

@ -57,13 +57,13 @@ public class ClientSimulation {
//
//simulate bullet physics engine step
if(Globals.RUN_PHYSICS){
Globals.clientSceneWrapper.getCollisionEngine().simulatePhysics((float)Globals.timekeeper.getSimFrameTime());
Globals.clientSceneWrapper.getCollisionEngine().updateDynamicObjectTransforms();
Globals.clientState.clientSceneWrapper.getCollisionEngine().simulatePhysics((float)Globals.timekeeper.getSimFrameTime());
Globals.clientState.clientSceneWrapper.getCollisionEngine().updateDynamicObjectTransforms();
}
//update actor animations
Globals.profiler.beginCpuSample("update actor animations");
for(Entity currentEntity : Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE)){
for(Entity currentEntity : Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE)){
Actor currentActor = EntityUtils.getActor(currentEntity);
if(currentActor.isPlayingAnimation()){
currentActor.incrementAnimationTime((float)Globals.timekeeper.getSimFrameTime());
@ -73,7 +73,7 @@ public class ClientSimulation {
//
//make items play idle animation
Globals.profiler.beginCpuSample("item animations");
for(Entity item : Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM)){
for(Entity item : Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM)){
ItemUtils.updateItemActorAnimation(item);
}
Globals.profiler.endCpuSample();
@ -84,7 +84,7 @@ public class ClientSimulation {
//
//Hitbox stuff
Globals.profiler.beginCpuSample("update hitboxes");
Globals.clientSceneWrapper.getHitboxManager().simulate();
Globals.clientState.clientSceneWrapper.getHitboxManager().simulate();
Globals.profiler.endCpuSample();
//
//update foliage
@ -99,17 +99,17 @@ public class ClientSimulation {
Globals.profiler.endCpuSample();
//
//simulate behavior trees
Globals.clientSceneWrapper.getScene().simulateBehaviorTrees((float)Globals.timekeeper.getSimFrameTime());
Globals.clientState.clientSceneWrapper.getScene().simulateBehaviorTrees((float)Globals.timekeeper.getSimFrameTime());
//
//sum collidable impulses
Globals.profiler.beginCpuSample("collidable logic");
for(Entity collidable : Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.COLLIDABLE)){
for(Entity collidable : Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.COLLIDABLE)){
ClientCollidableTree.getClientCollidableTree(collidable).simulate((float)Globals.timekeeper.getSimFrameTime());
}
//
//clear collidable impulse lists
Globals.clientSceneWrapper.getCollisionEngine().clearCollidableImpulseLists();
Globals.clientSceneWrapper.getChemistryEngine().clearCollidableImpulseLists();
Globals.clientState.clientSceneWrapper.getCollisionEngine().clearCollidableImpulseLists();
Globals.clientState.clientSceneWrapper.getChemistryEngine().clearCollidableImpulseLists();
Globals.profiler.endCpuSample();
//
@ -127,7 +127,7 @@ public class ClientSimulation {
ClientTerrainManager.generateTerrainChunkGeometry();
ClientFluidManager.generateFluidChunkGeometry();
this.updateSkyboxPos();
Globals.clientSceneWrapper.destroyEntitiesOutsideSimRange();
Globals.clientState.clientSceneWrapper.destroyEntitiesOutsideSimRange();
InstanceUpdater.updateInstancedActorPriority();
Globals.cameraHandler.updateGlobalCamera();
this.updateFirstPersonAttachments();

View File

@ -306,15 +306,15 @@ public class FoliageModel {
float heightMultiplier = foliageType.getGrassData().getMaxHeight() - foliageType.getGrassData().getMinHeight();
//construct simple grid to place foliage on
// Vector3d sample_00 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add(-SAMPLE_OFFSET,SAMPLE_START_HEIGHT,-SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_01 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add(-SAMPLE_OFFSET,SAMPLE_START_HEIGHT, 0), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_02 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add(-SAMPLE_OFFSET,SAMPLE_START_HEIGHT, SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_10 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( 0,SAMPLE_START_HEIGHT,-SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_11 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( 0,SAMPLE_START_HEIGHT, 0), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_12 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( 0,SAMPLE_START_HEIGHT, SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_20 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( SAMPLE_OFFSET,SAMPLE_START_HEIGHT,-SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_21 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( SAMPLE_OFFSET,SAMPLE_START_HEIGHT, 0), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_22 = Globals.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( SAMPLE_OFFSET,SAMPLE_START_HEIGHT, SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_00 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add(-SAMPLE_OFFSET,SAMPLE_START_HEIGHT,-SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_01 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add(-SAMPLE_OFFSET,SAMPLE_START_HEIGHT, 0), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_02 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add(-SAMPLE_OFFSET,SAMPLE_START_HEIGHT, SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_10 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( 0,SAMPLE_START_HEIGHT,-SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_11 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( 0,SAMPLE_START_HEIGHT, 0), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_12 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( 0,SAMPLE_START_HEIGHT, SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_20 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( SAMPLE_OFFSET,SAMPLE_START_HEIGHT,-SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_21 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( SAMPLE_OFFSET,SAMPLE_START_HEIGHT, 0), new Vector3d(0,-1,0), RAY_LENGTH);
// Vector3d sample_22 = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(new Vector3d(realPos).add( SAMPLE_OFFSET,SAMPLE_START_HEIGHT, SAMPLE_OFFSET), new Vector3d(0,-1,0), RAY_LENGTH);
boolean sample_11 = true;
boolean sample_12 = true;

View File

@ -135,10 +135,10 @@ public class NaturalInventoryPanel {
panel = ItemIconPanel.createEmptyItemPanel(() -> {
if(Globals.draggedItem != null){
NetworkMessage requestPickupMessage = InventoryMessage.constructclientRequestStoreItemMessage(
Globals.clientSceneWrapper.mapClientToServerId(entity.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(entity.getId()),
InventoryProtocol.INVENTORY_TYPE_NATURAL,
0 + "",
Globals.clientSceneWrapper.mapClientToServerId(Globals.draggedItem.getId())
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.draggedItem.getId())
);
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
}

View File

@ -146,10 +146,10 @@ public class ToolbarInventoryPanel {
int slotId = i;
panel = ItemIconPanel.createEmptyItemPanel(() -> {
NetworkMessage requestPickupMessage = InventoryMessage.constructclientRequestStoreItemMessage(
Globals.clientSceneWrapper.mapClientToServerId(entity.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(entity.getId()),
InventoryProtocol.INVENTORY_TYPE_TOOLBAR,
slotId + "",
Globals.clientSceneWrapper.mapClientToServerId(Globals.draggedItem.getId())
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.draggedItem.getId())
);
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
});

View File

@ -90,7 +90,7 @@ public class ImGuiPlayerEntity {
ImGui.sameLine();
if(ImGui.button("Server Details")){
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
ImGuiEntityMacros.showEntity(serverPlayerEntity);
}
@ -126,7 +126,7 @@ public class ImGuiPlayerEntity {
*/
private static void drawSynchronizationData(){
//server pos
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
if(serverPlayerEntity != null){
ImGui.text("Position (Server): " + EntityUtils.getPosition(serverPlayerEntity));

View File

@ -118,7 +118,7 @@ public class ImGuiEntityMacros {
if(ImGui.checkbox("Filter to Terrain", filterToTerrain)){
filterToTerrain = !filterToTerrain;
}
for(Entity entity : Globals.clientSceneWrapper.getScene().getEntityList()){
for(Entity entity : Globals.clientState.clientSceneWrapper.getScene().getEntityList()){
//filters
if(filterToCreatures && !CreatureUtils.isCreature(entity)){
continue;
@ -191,7 +191,7 @@ public class ImGuiEntityMacros {
AttachUtils.getParent(detailViewEntity) != null ||
detailViewEntity == Globals.firstPersonEntity ||
detailViewEntity == Globals.playerEntity ||
Globals.clientSceneWrapper.clientToServerMapContainsId(detailViewEntity.getId())
Globals.clientState.clientSceneWrapper.clientToServerMapContainsId(detailViewEntity.getId())
) &&
ImGui.checkbox("Linked entities`", showLinkedEntitiesTab)
){
@ -371,7 +371,7 @@ public class ImGuiEntityMacros {
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(Globals.playerEntity));
});
DebugVisualizerUtils.clientSpawnVectorVisualizer((Entity vector) -> {
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
EntityUtils.getPosition(vector).set(EntityUtils.getPosition(serverPlayerEntity));
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(serverPlayerEntity));
@ -518,19 +518,19 @@ public class ImGuiEntityMacros {
}
}
}
if(Globals.clientSceneWrapper.clientToServerMapContainsId(detailViewEntity.getId())){
if(Globals.clientState.clientSceneWrapper.clientToServerMapContainsId(detailViewEntity.getId())){
//detailViewEntity is a client entity
//get server entity
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(detailViewEntity.getId());
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(detailViewEntity.getId());
Entity serverEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
if(serverEntity != null && ImGui.button("Server Entity")){
ImGuiEntityMacros.showEntity(serverEntity);
}
} else if(Globals.clientSceneWrapper.containsServerId(detailViewEntity.getId())){
} else if(Globals.clientState.clientSceneWrapper.containsServerId(detailViewEntity.getId())){
//detailViewEntity is a server entity
//get client entity
int clientId = Globals.clientSceneWrapper.mapServerToClientId(detailViewEntity.getId());
Entity clientEntity = Globals.clientSceneWrapper.getScene().getEntityFromId(clientId);
int clientId = Globals.clientState.clientSceneWrapper.mapServerToClientId(detailViewEntity.getId());
Entity clientEntity = Globals.clientState.clientSceneWrapper.getScene().getEntityFromId(clientId);
if(clientEntity != null && ImGui.button("Client Entity")){
ImGuiEntityMacros.showEntity(clientEntity);
}

View File

@ -20,7 +20,7 @@ public class ImGuiEntityDebugActions {
if(detailViewEntity != null){
if(ImGui.button("Teleport to player")){
if(Globals.clientSceneWrapper.containsServerId(detailViewEntity.getId())){
if(Globals.clientState.clientSceneWrapper.containsServerId(detailViewEntity.getId())){
ServerEntityUtils.repositionEntity(detailViewEntity, EntityUtils.getPosition(Globals.playerEntity));
}
}

View File

@ -40,12 +40,12 @@ public class ImGuiEntityPhysicsTab {
}
//synchronized data
if(
Globals.clientSceneWrapper.getScene().getEntityFromId(detailViewEntity.getId()) != null &&
Globals.clientSceneWrapper.mapClientToServerId(detailViewEntity.getId()) != -1
Globals.clientState.clientSceneWrapper.getScene().getEntityFromId(detailViewEntity.getId()) != null &&
Globals.clientState.clientSceneWrapper.mapClientToServerId(detailViewEntity.getId()) != -1
){
//detailViewEntity is a client entity
//get server entity
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(detailViewEntity.getId());
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(detailViewEntity.getId());
Entity serverEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
DBody serverPhysicsBody = PhysicsEntityUtils.getDBody(serverEntity);
if(serverPhysicsBody != null){
@ -62,11 +62,11 @@ public class ImGuiEntityPhysicsTab {
ImGui.text("Enabled: " + serverPhysicsBody.isEnabled());
ImGui.text("Kinematic: " + serverPhysicsBody.isKinematic());
}
} else if(Globals.clientSceneWrapper.containsServerId(detailViewEntity.getId())){
} else if(Globals.clientState.clientSceneWrapper.containsServerId(detailViewEntity.getId())){
//detailViewEntity is a server entity
//get client entity
int clientId = Globals.clientSceneWrapper.mapServerToClientId(detailViewEntity.getId());
Entity clientEntity = Globals.clientSceneWrapper.getScene().getEntityFromId(clientId);
int clientId = Globals.clientState.clientSceneWrapper.mapServerToClientId(detailViewEntity.getId());
Entity clientEntity = Globals.clientState.clientSceneWrapper.getScene().getEntityFromId(clientId);
DBody clientPhysicsBody = PhysicsEntityUtils.getDBody(clientEntity);
if(clientPhysicsBody != null){
ImGui.newLine();

View File

@ -93,7 +93,7 @@ public class ImGuiAI {
}
if(ImGui.collapsingHeader("Debug Player AI")){
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
AI playerAi = AI.getAI(serverPlayerEntity);
Vector3d playerTargetPos = null;

View File

@ -59,14 +59,14 @@ public class CraftingWindow {
(RecipeData recipe) -> {
if(Globals.interactionTarget != null){
Globals.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestCraftMessage(
Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
Globals.clientSceneWrapper.mapClientToServerId(Globals.interactionTarget.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.interactionTarget.getId()),
recipe.getId()
));
} else {
Globals.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestCraftMessage(
Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
recipe.getId()
));
}

View File

@ -172,7 +172,7 @@ public class MenuGeneratorsLevelEditor {
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Realm realm = Globals.realmManager.getRealms().iterator().next();
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
CreatureUtils.serverSpawnBasicCreature(realm, cursorPos, data.getId(), null);
}));
@ -202,7 +202,7 @@ public class MenuGeneratorsLevelEditor {
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Realm realm = Globals.realmManager.getRealms().iterator().next();
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
if(cursorPos == null){
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
@ -235,7 +235,7 @@ public class MenuGeneratorsLevelEditor {
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Realm realm = Globals.realmManager.getRealms().iterator().next();
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
FoliageUtils.serverSpawnTreeFoliage(realm, cursorPos, data.getId());
}));
@ -264,7 +264,7 @@ public class MenuGeneratorsLevelEditor {
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Realm realm = Globals.realmManager.getRealms().iterator().next();
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
ItemUtils.serverSpawnBasicItem(realm, cursorPos, item.getId());
}));
@ -294,7 +294,7 @@ public class MenuGeneratorsLevelEditor {
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Realm realm = Globals.realmManager.getRealms().iterator().next();
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE).add(cursorVerticalOffset);
CommonEntityUtils.serverSpawnBasicObject(realm, cursorPos, object.getId());
}));

View File

@ -37,7 +37,7 @@ public class ScriptLevelEditorUtils {
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Realm realm = Globals.realmManager.getRealms().iterator().next();
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
if(cursorPos == null){
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
@ -49,7 +49,7 @@ public class ScriptLevelEditorUtils {
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Realm realm = Globals.realmManager.getRealms().iterator().next();
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
if(cursorPos == null){
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
@ -61,7 +61,7 @@ public class ScriptLevelEditorUtils {
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Realm realm = Globals.realmManager.getRealms().iterator().next();
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
if(cursorPos == null){
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
@ -73,7 +73,7 @@ public class ScriptLevelEditorUtils {
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
Realm realm = Globals.realmManager.getRealms().iterator().next();
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
Vector3d cursorPos = clientCollisionEngine.rayCastPosition(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
if(cursorPos == null){
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
@ -91,7 +91,7 @@ public class ScriptLevelEditorUtils {
public static void inspectEntity(){
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera));
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(Globals.playerCamera));
CollisionEngine clientCollisionEngine = Globals.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
CollisionEngine clientCollisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine(); //using client collision engine so ray doesn't collide with player entity
Entity target = clientCollisionEngine.rayCast(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1.0), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
//show detail view here
if(target != null){

View File

@ -74,14 +74,14 @@ public class PhysicsEntityUtils {
//
//create dbody
rigidBody = CollisionBodyCreation.createCylinderBody(
Globals.clientSceneWrapper.getCollisionEngine(),
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
physicsTemplate.getDimension1(),
physicsTemplate.getDimension2(),
categoryBit
);
if(physicsTemplate.getMass() != null){
CollisionBodyCreation.setCylinderMass(
Globals.clientSceneWrapper.getCollisionEngine(),
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
rigidBody,
mass,
physicsTemplate.getDimension1(),
@ -90,12 +90,12 @@ public class PhysicsEntityUtils {
new Quaterniond(physicsTemplate.getRotX(), physicsTemplate.getRotY(), physicsTemplate.getRotZ(), physicsTemplate.getRotW())
);
}
CollisionBodyCreation.setAutoDisable(Globals.clientSceneWrapper.getCollisionEngine(), rigidBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
CollisionBodyCreation.setAutoDisable(Globals.clientState.clientSceneWrapper.getCollisionEngine(), rigidBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
//
//set offset from center of entity position
CollisionBodyCreation.setOffsetPosition(
Globals.clientSceneWrapper.getCollisionEngine(),
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
rigidBody,
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
);
@ -119,10 +119,10 @@ public class PhysicsEntityUtils {
physicsTemplate.getRotX(), physicsTemplate.getRotY(), physicsTemplate.getRotZ(), physicsTemplate.getRotW() //rotate
);
if(physicsTemplate.isAngularlyStatic()){
Globals.clientSceneWrapper.getCollisionEngine().setAngularlyStatic(rigidBody, true);
Globals.clientState.clientSceneWrapper.getCollisionEngine().setAngularlyStatic(rigidBody, true);
}
if(physicsTemplate.getKinematic()){
Globals.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
Globals.clientState.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
rigidBody.disable();
}
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
@ -132,20 +132,20 @@ public class PhysicsEntityUtils {
rVal.putData(EntityDataStrings.PHYSICS_MASS, mass);
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
Globals.clientState.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.COLLIDABLE);
} break;
case "CUBE": {
//
//create dbody
rigidBody = CollisionBodyCreation.createCubeBody(
Globals.clientSceneWrapper.getCollisionEngine(),
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
new Vector3d(physicsTemplate.getDimension1(),physicsTemplate.getDimension2(),physicsTemplate.getDimension3()),
categoryBit
);
if(physicsTemplate.getMass() != null){
CollisionBodyCreation.setBoxMass(
Globals.clientSceneWrapper.getCollisionEngine(),
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
rigidBody,
mass,
new Vector3d(physicsTemplate.getDimension1(),physicsTemplate.getDimension2(),physicsTemplate.getDimension3()),
@ -153,12 +153,12 @@ public class PhysicsEntityUtils {
new Quaterniond(physicsTemplate.getRotX(), physicsTemplate.getRotY(), physicsTemplate.getRotZ(), physicsTemplate.getRotW())
);
}
CollisionBodyCreation.setAutoDisable(Globals.clientSceneWrapper.getCollisionEngine(), rigidBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
CollisionBodyCreation.setAutoDisable(Globals.clientState.clientSceneWrapper.getCollisionEngine(), rigidBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
//
//set offset from center of entity position
CollisionBodyCreation.setOffsetPosition(
Globals.clientSceneWrapper.getCollisionEngine(),
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
rigidBody,
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
);
@ -183,10 +183,10 @@ public class PhysicsEntityUtils {
1, 1, 1 //scale
);
if(physicsTemplate.isAngularlyStatic()){
Globals.clientSceneWrapper.getCollisionEngine().setAngularlyStatic(rigidBody, true);
Globals.clientState.clientSceneWrapper.getCollisionEngine().setAngularlyStatic(rigidBody, true);
}
if(physicsTemplate.getKinematic()){
Globals.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
Globals.clientState.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
rigidBody.disable();
}
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
@ -196,21 +196,21 @@ public class PhysicsEntityUtils {
rVal.putData(EntityDataStrings.PHYSICS_MASS, mass);
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
Globals.clientState.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.COLLIDABLE);
} break;
case "CAPSULE": {
//
//create dbody
rigidBody = CollisionBodyCreation.createCapsuleBody(
Globals.clientSceneWrapper.getCollisionEngine(),
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
physicsTemplate.getDimension2(),
physicsTemplate.getDimension2() - physicsTemplate.getDimension1() - physicsTemplate.getDimension1(),
categoryBit
);
if(physicsTemplate.getMass() != null){
CollisionBodyCreation.setCapsuleMass(
Globals.clientSceneWrapper.getCollisionEngine(),
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
rigidBody,
mass,
physicsTemplate.getDimension1(),
@ -219,12 +219,12 @@ public class PhysicsEntityUtils {
new Quaterniond(physicsTemplate.getRotX(), physicsTemplate.getRotY(), physicsTemplate.getRotZ(), physicsTemplate.getRotW())
);
}
CollisionBodyCreation.setAutoDisable(Globals.clientSceneWrapper.getCollisionEngine(), rigidBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
CollisionBodyCreation.setAutoDisable(Globals.clientState.clientSceneWrapper.getCollisionEngine(), rigidBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
//
//set offset from center of entity position
CollisionBodyCreation.setOffsetPosition(
Globals.clientSceneWrapper.getCollisionEngine(),
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
rigidBody,
new Vector3d(physicsTemplate.getOffsetX(), physicsTemplate.getOffsetY(), physicsTemplate.getOffsetZ())
);
@ -249,10 +249,10 @@ public class PhysicsEntityUtils {
1, 1, 1 //scale
);
if(physicsTemplate.isAngularlyStatic()){
Globals.clientSceneWrapper.getCollisionEngine().setAngularlyStatic(rigidBody, true);
Globals.clientState.clientSceneWrapper.getCollisionEngine().setAngularlyStatic(rigidBody, true);
}
if(physicsTemplate.getKinematic()){
Globals.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
Globals.clientState.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
rigidBody.disable();
}
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
@ -262,7 +262,7 @@ public class PhysicsEntityUtils {
rVal.putData(EntityDataStrings.PHYSICS_MASS, mass);
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
Globals.clientState.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
Globals.clientState.clientScene.registerEntityToTag(rVal, EntityTags.COLLIDABLE);
} break;
}
@ -345,7 +345,7 @@ public class PhysicsEntityUtils {
realm.getCollisionEngine().setAngularlyStatic(rigidBody, true);
}
if(physicsTemplate.getKinematic()){
Globals.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
Globals.clientState.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
rigidBody.disable();
}
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
@ -409,7 +409,7 @@ public class PhysicsEntityUtils {
realm.getCollisionEngine().setAngularlyStatic(rigidBody, true);
}
if(physicsTemplate.getKinematic()){
Globals.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
Globals.clientState.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
rigidBody.disable();
}
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
@ -475,7 +475,7 @@ public class PhysicsEntityUtils {
realm.getCollisionEngine().setAngularlyStatic(rigidBody, true);
}
if(physicsTemplate.getKinematic()){
Globals.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
Globals.clientState.clientSceneWrapper.getCollisionEngine().setKinematic(rigidBody);
rigidBody.disable();
}
rVal.putData(EntityDataStrings.PHYSICS_COLLISION_BODY_TRANSFORM, offsetTransform);
@ -503,10 +503,10 @@ public class PhysicsEntityUtils {
* @return The rigid body created (note, attachment has already been performed)
*/
public static void clientAttachTriGeomRigidBody(Entity terrain, TriGeomData data){
DBody terrainBody = CollisionBodyCreation.generateBodyFromTerrainData(Globals.clientSceneWrapper.getCollisionEngine(), data, Collidable.TYPE_STATIC_BIT);
CollisionBodyCreation.setAutoDisable(Globals.clientSceneWrapper.getCollisionEngine(), terrainBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
DBody terrainBody = CollisionBodyCreation.generateBodyFromTerrainData(Globals.clientState.clientSceneWrapper.getCollisionEngine(), data, Collidable.TYPE_STATIC_BIT);
CollisionBodyCreation.setAutoDisable(Globals.clientState.clientSceneWrapper.getCollisionEngine(), terrainBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
Collidable collidable = new Collidable(terrain,Collidable.TYPE_STATIC, false);
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(terrainBody, collidable);
Globals.clientState.clientSceneWrapper.getCollisionEngine().registerCollisionObject(terrainBody, collidable);
PhysicsEntityUtils.setDBody(terrain,terrainBody);
terrain.putData(EntityDataStrings.PHYSICS_COLLIDABLE, collidable);
}
@ -518,10 +518,10 @@ public class PhysicsEntityUtils {
* @return The rigid body created (note, attachment has already been performed)
*/
public static void clientAttachMultiShapeTriGeomRigidBody(Entity terrain, MultiShapeTriGeomData data){
DBody terrainBody = CollisionBodyCreation.generateBodyFromMultiShapeMeshData(Globals.clientSceneWrapper.getCollisionEngine(), data, Collidable.TYPE_STATIC_BIT);
CollisionBodyCreation.setAutoDisable(Globals.clientSceneWrapper.getCollisionEngine(), terrainBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
DBody terrainBody = CollisionBodyCreation.generateBodyFromMultiShapeMeshData(Globals.clientState.clientSceneWrapper.getCollisionEngine(), data, Collidable.TYPE_STATIC_BIT);
CollisionBodyCreation.setAutoDisable(Globals.clientState.clientSceneWrapper.getCollisionEngine(), terrainBody, true, LINEAR_THRESHOLD, ANGULAR_THRESHOLD, STEP_THRESHOLD);
Collidable collidable = new Collidable(terrain,Collidable.TYPE_STATIC, false);
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(terrainBody, collidable);
Globals.clientState.clientSceneWrapper.getCollisionEngine().registerCollisionObject(terrainBody, collidable);
PhysicsEntityUtils.setDBody(terrain,terrainBody);
terrain.putData(EntityDataStrings.PHYSICS_COLLIDABLE, collidable);
}

View File

@ -153,7 +153,7 @@ public class CameraHandler {
if(Globals.cameraHandler.getTrackPlayerEntity() && Globals.playerEntity != null){
Globals.clientConnection.queueOutgoingMessage(
EntityMessage.constructupdateEntityViewDirMessage(
Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
Globals.timekeeper.getNumberOfSimFramesElapsed(),
perspectiveVal,
yaw,

View File

@ -140,7 +140,7 @@ public class CursorState {
cursorActor.addTextureMask(new ActorTextureMask("sphere", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
DrawableUtils.makeEntityTransparent(Globals.playerCursor);
EntityUtils.getScale(Globals.playerCursor).set(0.2f);
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
//player's block cursor
Globals.playerBlockCursor = EntityCreationUtils.createClientSpatialEntity();
@ -149,7 +149,7 @@ public class CursorState {
blockCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
DrawableUtils.makeEntityTransparent(Globals.playerBlockCursor);
EntityUtils.getScale(Globals.playerBlockCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER);
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
//player's area cursor
Globals.playerAreaCursor = EntityCreationUtils.createClientSpatialEntity();
@ -158,7 +158,7 @@ public class CursorState {
areaCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
DrawableUtils.makeEntityTransparent(Globals.playerAreaCursor);
EntityUtils.getScale(Globals.playerAreaCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER);
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
//player's fab cursor
playerFabCursor = EntityCreationUtils.createClientSpatialEntity();
@ -166,7 +166,7 @@ public class CursorState {
Actor fabCursorActor = EntityUtils.getActor(playerFabCursor);
fabCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
DrawableUtils.makeEntityTransparent(playerFabCursor);
Globals.clientSceneWrapper.getScene().removeEntityFromTag(playerFabCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(playerFabCursor, EntityTags.DRAWABLE);
//player's grid-aligned cursor
playerGridAlignedCursor = EntityCreationUtils.createClientSpatialEntity();
@ -174,14 +174,14 @@ public class CursorState {
Actor gridAlignedCursorActor = EntityUtils.getActor(playerGridAlignedCursor);
gridAlignedCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
DrawableUtils.makeEntityTransparent(playerGridAlignedCursor);
Globals.clientSceneWrapper.getScene().removeEntityFromTag(playerGridAlignedCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(playerGridAlignedCursor, EntityTags.DRAWABLE);
}
/**
* Updates the position of the player's in world cursor
*/
public void updatePlayerCursor(){
CollisionEngine collisionEngine = Globals.clientSceneWrapper.getCollisionEngine();
CollisionEngine collisionEngine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
Entity camera = Globals.playerCamera;
if(
collisionEngine != null &&
@ -216,7 +216,7 @@ public class CursorState {
*/
public static void makeRealVisible(){
CursorState.hide();
Globals.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerCursor, EntityTags.DRAWABLE);
}
/**
@ -226,7 +226,7 @@ public class CursorState {
CursorState.hide();
Actor blockCursorActor = EntityUtils.getActor(Globals.playerBlockCursor);
blockCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{texture})));
Globals.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
}
/**
@ -234,7 +234,7 @@ public class CursorState {
*/
public static void makeAreaVisible(){
CursorState.hide();
Globals.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
}
/**
@ -243,7 +243,7 @@ public class CursorState {
public static void makeFabVisible(){
CursorState.hide();
Globals.cursorState.setClampToExistingBlock(false);
Globals.clientSceneWrapper.getScene().registerEntityToTag(CursorState.playerFabCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(CursorState.playerFabCursor, EntityTags.DRAWABLE);
Globals.cursorState.fabCursorRotation = 0;
}
@ -253,7 +253,7 @@ public class CursorState {
public static void makeGridAlignedVisible(String modelPath){
CursorState.hide();
Globals.cursorState.setClampToExistingBlock(true);
Globals.clientSceneWrapper.getScene().registerEntityToTag(CursorState.playerGridAlignedCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(CursorState.playerGridAlignedCursor, EntityTags.DRAWABLE);
EntityCreationUtils.makeEntityDrawable(playerGridAlignedCursor, modelPath);
Globals.cursorState.fabCursorRotation = 0;
}
@ -262,11 +262,11 @@ public class CursorState {
* Hides the cursor
*/
public static void hide(){
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
Globals.clientSceneWrapper.getScene().removeEntityFromTag(CursorState.playerFabCursor, EntityTags.DRAWABLE);
Globals.clientSceneWrapper.getScene().removeEntityFromTag(CursorState.playerGridAlignedCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(CursorState.playerFabCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(CursorState.playerGridAlignedCursor, EntityTags.DRAWABLE);
}
/**
@ -557,7 +557,7 @@ public class CursorState {
}
}
if(clearBlockCursor){
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
}
}
}
@ -567,9 +567,9 @@ public class CursorState {
*/
public void hintShowBlockCursor(){
if(
!Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerFabCursor) &&
!Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerAreaCursor) &&
!Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerCursor)
!Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerFabCursor) &&
!Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerAreaCursor) &&
!Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerCursor)
){
CursorState.makeBlockVisible(AssetDataStrings.TEXTURE_RED_TRANSPARENT);
}
@ -604,19 +604,19 @@ public class CursorState {
* @return The position if a cursor is visible, null otherwise
*/
public Vector3d getCursorPosition(){
if(Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerCursor)){
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerCursor)){
return EntityUtils.getPosition(Globals.playerCursor);
}
if(Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerBlockCursor)){
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerBlockCursor)){
return EntityUtils.getPosition(Globals.playerBlockCursor);
}
if(Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerAreaCursor)){
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerAreaCursor)){
return EntityUtils.getPosition(Globals.playerAreaCursor);
}
if(Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerFabCursor)){
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerFabCursor)){
return EntityUtils.getPosition(CursorState.playerFabCursor);
}
if(Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerGridAlignedCursor)){
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerGridAlignedCursor)){
return EntityUtils.getPosition(CursorState.playerGridAlignedCursor);
}
return null;

View File

@ -338,7 +338,6 @@ public class Globals {
public static MainThreadSignalService mainThreadSignalService;
//client scene management
public static ClientSceneWrapper clientSceneWrapper;
public static ClientSimulation clientSimulation;
public static ClientSynchronizationManager clientSynchronizationManager;
@ -506,7 +505,7 @@ public class Globals {
shaderOptionMap.debug();
//client scene wrapper
Globals.clientState.clientScene = new Scene();
clientSceneWrapper = new ClientSceneWrapper(Globals.clientState.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
Globals.clientState.clientSceneWrapper = new ClientSceneWrapper(Globals.clientState.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
//temporary hold for skybox colors
skyboxColors = new ArrayList<Vector3f>();
//load asset manager
@ -724,7 +723,7 @@ public class Globals {
Globals.clientPlayer = null;
Globals.playerManager = new PlayerManager();
Globals.clientState.clientScene = new Scene();
Globals.clientSceneWrapper = new ClientSceneWrapper(Globals.clientState.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
Globals.clientState.clientSceneWrapper = new ClientSceneWrapper(Globals.clientState.clientScene, new CollisionEngine(), CollisionEngine.create(new ClientChemistryCollisionCallback()), new CollisionEngine());
Globals.clientState = new ClientState();
Globals.clientSynchronizationManager = new ClientSynchronizationManager();
Globals.server = null;
@ -752,7 +751,6 @@ public class Globals {
Globals.assetManager = null;
Globals.elementService = null;
Globals.realmManager = null;
Globals.clientSceneWrapper = null;
Globals.clientState = null;
Globals.audioEngine = null;
Globals.renderingEngine = null;

View File

@ -71,11 +71,11 @@ public class ClientEntityUtils {
}
if(Globals.clientSceneWrapper != null){
Globals.clientSceneWrapper.getScene().deregisterEntity(entity);
Globals.clientSceneWrapper.deregisterTranslationMapping(entity);
if(Globals.clientSceneWrapper.getCollisionEngine() != null){
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(entity);
if(Globals.clientState.clientSceneWrapper != null){
Globals.clientState.clientSceneWrapper.getScene().deregisterEntity(entity);
Globals.clientState.clientSceneWrapper.deregisterTranslationMapping(entity);
if(Globals.clientState.clientSceneWrapper.getCollisionEngine() != null){
Globals.clientState.clientSceneWrapper.getCollisionEngine().destroyPhysics(entity);
}
}
if(Globals.clientState.clientScene != null){

View File

@ -109,7 +109,7 @@ public class EntityCreationUtils {
*/
public static Entity createClientSpatialEntity(){
Entity rVal = EntityCreationUtils.spawnSpatialEntity();
Globals.clientSceneWrapper.getScene().registerEntity(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerEntity(rVal);
return rVal;
}
@ -119,7 +119,7 @@ public class EntityCreationUtils {
*/
public static Entity createClientNonSpatialEntity(){
Entity rVal = new Entity();
Globals.clientSceneWrapper.getScene().registerEntity(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerEntity(rVal);
return rVal;
}

View File

@ -34,9 +34,9 @@ public class EntityUtils {
*/
protected static void cleanUpEntity(Entity e){
//remove from client
if(Globals.clientSceneWrapper != null){
Globals.clientSceneWrapper.getScene().deregisterEntity(e);
Globals.clientSceneWrapper.deregisterTranslationMapping(e);
if(Globals.clientState.clientSceneWrapper != null){
Globals.clientState.clientSceneWrapper.getScene().deregisterEntity(e);
Globals.clientState.clientSceneWrapper.deregisterTranslationMapping(e);
}
//remove from all server classes
if(Globals.realmManager != null){

View File

@ -54,9 +54,9 @@ public class StateTransitionUtil {
StateTransitionUtil rVal = new StateTransitionUtil(entity,isServer,states);
//error checking
if(!isServer && Globals.clientSceneWrapper.getScene().getEntityFromId(entity.getId()) == null){
if(!isServer && Globals.clientState.clientSceneWrapper.getScene().getEntityFromId(entity.getId()) == null){
throw new IllegalArgumentException("Tried to create state transition util with isServer=false and passed in a server entity");
} else if(isServer && Globals.clientSceneWrapper.getScene().getEntityFromId(entity.getId()) != null){
} else if(isServer && Globals.clientState.clientSceneWrapper.getScene().getEntityFromId(entity.getId()) != null){
throw new IllegalArgumentException("Tried to create state transition util with isServer=true and passed in a client entity");
}

View File

@ -173,7 +173,7 @@ public class AttachUtils {
private static void clientUpdateBoneAttachments(){
Globals.profiler.beginCpuSample("AttachUtils.clientUpdateBoneAttachments");
//update entities attached to bones of other entities
for(Entity currentEntity : Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.BONE_ATTACHED)){
for(Entity currentEntity : Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.BONE_ATTACHED)){
Entity parent;
if(currentEntity == null){
LoggerInterface.loggerEngine.ERROR(new IllegalStateException("Trying to update client bone attachment where null entity is registered!"));
@ -230,7 +230,7 @@ public class AttachUtils {
Entity parent;
Matrix4d transform;
//update entities attached to centerpoint + transform of other entities
for(Entity currentEntity : Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.TRANSFORM_ATTACHED)){
for(Entity currentEntity : Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.TRANSFORM_ATTACHED)){
if((parent = (Entity)currentEntity.getData(EntityDataStrings.ATTACH_PARENT))!=null){
if((transform = AttachUtils.getTransformOffset(currentEntity))!=null){
//parent objects
@ -466,7 +466,7 @@ public class AttachUtils {
* @param rotation The rotation applied
*/
public static void clientAttachEntityToEntityAtBone(Entity parent, Entity toAttach, String boneName, Vector3d offset, Quaterniond rotation){
Globals.clientSceneWrapper.getScene().registerEntityToTag(toAttach, EntityTags.BONE_ATTACHED);
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(toAttach, EntityTags.BONE_ATTACHED);
toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true);
toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent);
toAttach.putData(EntityDataStrings.ATTACH_TARGET_BONE, boneName);
@ -493,7 +493,7 @@ public class AttachUtils {
Vector3d parentPosition = EntityUtils.getPosition(parent);
Vector3d childPosition = EntityUtils.getPosition(toAttach);
Vector3d offset = new Vector3d(childPosition).sub(parentPosition);
Globals.clientSceneWrapper.getScene().registerEntityToTag(toAttach, EntityTags.TRANSFORM_ATTACHED);
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(toAttach, EntityTags.TRANSFORM_ATTACHED);
toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true);
toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent);
toAttach.putData(EntityDataStrings.ATTACH_TARGET_BASE, true);
@ -514,7 +514,7 @@ public class AttachUtils {
* @param transform The transform
*/
public static void clientAttachEntityAtTransform(Entity parent, Entity toAttach, Matrix4d transform){
Globals.clientSceneWrapper.getScene().registerEntityToTag(toAttach, EntityTags.TRANSFORM_ATTACHED);
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(toAttach, EntityTags.TRANSFORM_ATTACHED);
toAttach.putData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED, true);
toAttach.putData(EntityDataStrings.ATTACH_PARENT, parent);
toAttach.putData(EntityDataStrings.ATTACH_TARGET_BASE, true);
@ -614,7 +614,7 @@ public class AttachUtils {
*/
public static String clientDetatchEntityFromEntityAtBone(Entity parent, Entity toAttach){
String bone = getTargetBone(toAttach);
Globals.clientSceneWrapper.getScene().removeEntityFromTag(toAttach, EntityTags.BONE_ATTACHED);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(toAttach, EntityTags.BONE_ATTACHED);
toAttach.removeData(EntityDataStrings.ATTACH_ENTITY_IS_ATTACHED);
toAttach.removeData(EntityDataStrings.ATTACH_PARENT);
toAttach.removeData(EntityDataStrings.ATTACH_TARGET_BONE);

View File

@ -636,7 +636,7 @@ public class ClientAttackTree implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTATTACKTREE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTATTACKTREE_ID);
return rVal;
}

View File

@ -202,7 +202,7 @@ public class ClientBlockTree implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTBLOCKTREE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTBLOCKTREE_ID);
return rVal;
}

View File

@ -111,7 +111,7 @@ public class ClientParticleEmitterComponent implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTPARTICLEEMITTERSTATE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
return rVal;
}

View File

@ -148,7 +148,7 @@ public class ClientParticleTree implements BehaviorTree {
lifeCurrent--;
if(lifeCurrent <= 0){
ClientEntityUtils.destroyEntity(parent);
Globals.clientSceneWrapper.getScene().deregisterBehaviorTree(this);
Globals.clientState.clientSceneWrapper.getScene().deregisterBehaviorTree(this);
}
}
@ -182,7 +182,7 @@ public class ClientParticleTree implements BehaviorTree {
public static ClientParticleTree attachTree(Entity parent, Object ... params){
ClientParticleTree rVal = new ClientParticleTree(parent,params);
parent.putData(EntityDataStrings.TREE_CLIENTPARTICLETREE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
return rVal;
}

View File

@ -64,7 +64,7 @@ public class ClientCollidableTree implements BehaviorTree {
newPosition.z = Globals.clientState.clientWorldData.getWorldBoundMin().z;
}
}
PhysicsUtils.setRigidBodyTransform(Globals.clientSceneWrapper.getCollisionEngine(), newPosition, rotation, body);
PhysicsUtils.setRigidBodyTransform(Globals.clientState.clientSceneWrapper.getCollisionEngine(), newPosition, rotation, body);
}
/**

View File

@ -93,7 +93,7 @@ public class ClientEquipState implements BehaviorTree {
if(!hasEquipped && targetIsItem && itemIsInPointWhitelist){
//send packet to server requesting to equip
String pointName = point.getEquipPointId();
int serverSideID = Globals.clientSceneWrapper.mapClientToServerId(toEquip.getId());
int serverSideID = Globals.clientState.clientSceneWrapper.mapClientToServerId(toEquip.getId());
NetworkMessage requestPickupMessage = InventoryMessage.constructclientRequestEquipItemMessage(pointName, serverSideID);
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
}
@ -155,10 +155,10 @@ public class ClientEquipState implements BehaviorTree {
}
//make uncollidable
if(PhysicsEntityUtils.containsDBody(toEquip) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
Globals.clientState.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
}
//make untargetable
Globals.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
break;
}
}
@ -192,9 +192,9 @@ public class ClientEquipState implements BehaviorTree {
);
}
if(PhysicsEntityUtils.containsDBody(toEquip) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
Globals.clientState.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
}
Globals.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
GravityUtils.clientAttemptDeactivateGravity(toEquip);
}
}
@ -479,7 +479,7 @@ public class ClientEquipState implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTEQUIPSTATE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTEQUIPSTATE_ID);
return rVal;
}

View File

@ -81,7 +81,7 @@ public class ClientToolbarState implements BehaviorTree {
*/
public void attemptAddToToolbar(Entity item, int toolbarSlot){
if(item != null){
NetworkMessage requestUnequipMessage = InventoryMessage.constructclientRequestAddToolbarMessage(Globals.clientSceneWrapper.mapClientToServerId(item.getId()), toolbarSlot);
NetworkMessage requestUnequipMessage = InventoryMessage.constructclientRequestAddToolbarMessage(Globals.clientState.clientSceneWrapper.mapClientToServerId(item.getId()), toolbarSlot);
Globals.clientConnection.queueOutgoingMessage(requestUnequipMessage);
}
}
@ -140,10 +140,10 @@ public class ClientToolbarState implements BehaviorTree {
}
//make uncollidable
if(PhysicsEntityUtils.containsDBody(toEquip) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
Globals.clientState.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
}
//make untargetable
Globals.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
break;
}
}
@ -176,9 +176,9 @@ public class ClientToolbarState implements BehaviorTree {
);
}
if(PhysicsEntityUtils.containsDBody(toEquip) && toEquip.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
Globals.clientState.clientSceneWrapper.getCollisionEngine().destroyPhysics(toEquip);
}
Globals.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(toEquip, EntityTags.TARGETABLE);
GravityUtils.clientAttemptDeactivateGravity(toEquip);
}
@ -269,10 +269,10 @@ public class ClientToolbarState implements BehaviorTree {
}
if(Globals.playerCursor != null){
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
}
if(Globals.playerBlockCursor != null){
Globals.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
}
//hide cursors
@ -329,7 +329,7 @@ public class ClientToolbarState implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTTOOLBARSTATE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTTOOLBARSTATE_ID);
return rVal;
}

View File

@ -63,7 +63,7 @@ public class AmbientFoliage implements BehaviorTree {
public static void attachAmbientFoliageTree(Entity parent, float growthLevel, float growthRate){
AmbientFoliage tree = new AmbientFoliage(parent, growthLevel, growthRate);
parent.putData(EntityDataStrings.FOLIAGE_AMBIENT_TREE, tree);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(tree);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(tree);
}
/**

View File

@ -92,7 +92,7 @@ public class ClientDoorState implements BehaviorTree {
doorData.getOpening(),
() -> {
this.setState(DoorState.OPEN);
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(this.parent);
Globals.clientState.clientSceneWrapper.getCollisionEngine().destroyPhysics(this.parent);
}
),
StateTransitionUtilItem.create(
@ -133,7 +133,7 @@ public class ClientDoorState implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTDOOR, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTDOOR_ID);
return rVal;
}

View File

@ -166,7 +166,7 @@ public class ClientGravityTree implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTGRAVITY, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTGRAVITY_ID);
return rVal;
}

View File

@ -65,7 +65,7 @@ public class ClientGrowthComponent implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTGROWTH, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTGROWTH_ID);
return rVal;
}

View File

@ -631,7 +631,7 @@ public class HitboxCollectionState {
engine = realm.getHitboxManager().getCollisionEngine();
}
} else {
engine = Globals.clientSceneWrapper.getHitboxManager().getCollisionEngine();
engine = Globals.clientState.clientSceneWrapper.getHitboxManager().getCollisionEngine();
}
if(engine != null && body != null){
PhysicsUtils.destroyBody(engine, body);

View File

@ -140,7 +140,7 @@ public class ClientIdleTree implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_IDLE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_IDLE_ID);
return rVal;
}

View File

@ -51,7 +51,7 @@ public class ClientInventoryState implements BehaviorTree {
public static ClientInventoryState clientCreateInventoryState(Entity parent){
ClientInventoryState rVal = new ClientInventoryState();
rVal.parent = parent;
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
return rVal;
}
@ -62,15 +62,15 @@ public class ClientInventoryState implements BehaviorTree {
networkMessageQueue.remove(message);
switch(message.getMessageSubtype()){
case SERVERCOMMANDSTOREITEM: {
Entity clientSideContainer = Globals.clientSceneWrapper.getEntityFromServerId(message.gettargetEntId());
Entity clientSideContainer = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.gettargetEntId());
Entity clientSideItem = null;
if(Globals.clientSceneWrapper.containsServerId(message.getitemEntId())){
if(Globals.clientState.clientSceneWrapper.containsServerId(message.getitemEntId())){
LoggerInterface.loggerNetworking.DEBUG("Client move item " + message.getitemEntId());
clientSideItem = Globals.clientSceneWrapper.getEntityFromServerId(message.getitemEntId());
clientSideItem = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getitemEntId());
} else {
LoggerInterface.loggerNetworking.DEBUG("Client create item " + message.getitemEntId());
clientSideItem = ClientInventoryState.clientConstructInInventoryItem(clientSideContainer,message.getitemTemplate());
Globals.clientSceneWrapper.mapIdToId(clientSideItem.getId(), message.getitemEntId());
Globals.clientState.clientSceneWrapper.mapIdToId(clientSideItem.getId(), message.getitemEntId());
}
ClientInventoryState.moveItem(clientSideContainer, clientSideItem, message.getcontainerType(), message.getequipPointId());
//attempt re-render ui
@ -78,19 +78,19 @@ public class ClientInventoryState implements BehaviorTree {
} break;
case ADDITEMTOINVENTORY: {
LoggerInterface.loggerNetworking.WARNING("Client create item " + message.getitemEntId());
Entity clientSideContainer = Globals.clientSceneWrapper.getEntityFromServerId(message.gettargetEntId());
Entity clientSideContainer = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.gettargetEntId());
//the ID we get is of the in-inventory item
Entity inInventorySpawnedItem = ClientInventoryState.clientConstructInInventoryItem(clientSideContainer,message.getitemTemplate());
//map id
if(inInventorySpawnedItem != null){
Globals.clientSceneWrapper.mapIdToId(inInventorySpawnedItem.getId(), message.getitemEntId());
Globals.clientState.clientSceneWrapper.mapIdToId(inInventorySpawnedItem.getId(), message.getitemEntId());
}
//attempt re-render ui
WindowUtils.attemptRedrawInventoryWindows();
} break;
case REMOVEITEMFROMINVENTORY: {
LoggerInterface.loggerNetworking.DEBUG("Client remove item from inventories " + message.getentityId());
Entity item = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId());
Entity item = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityId());
if(item != null){
ClientInventoryState.clientRemoveItemFromInventories(item);
//attempt re-render ui
@ -100,7 +100,7 @@ public class ClientInventoryState implements BehaviorTree {
case SERVERCOMMANDMOVEITEMCONTAINER: {
LoggerInterface.loggerNetworking.DEBUG("Client move item container " + message.getentityId());
//this is a command to switch an item from one inventory to another (ie equip->natural or vice-versa)
Entity itemEnt = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId());
Entity itemEnt = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityId());
ClientInventoryState.moveItem(this.parent, itemEnt, message.getcontainerType(), message.getequipPointId());
//once we've switched the items around, redraw the inventory to reflect the updated contents
WindowUtils.attemptRedrawInventoryWindows();
@ -132,12 +132,12 @@ public class ClientInventoryState implements BehaviorTree {
case SERVERCOMMANDEQUIPITEM: {
LoggerInterface.loggerNetworking.DEBUG("Client equip item " + message.getentityId());
//translate equipper id
Entity equipper = Globals.clientSceneWrapper.getEntityFromServerId(message.getequipperId());
Entity equipper = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getequipperId());
//spawn in world id
Entity inWorldEntity = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId());
Entity inWorldEntity = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityId());
if(inWorldEntity != null){
//translate id
Globals.clientSceneWrapper.mapIdToId(inWorldEntity.getId(), message.getentityId());
Globals.clientState.clientSceneWrapper.mapIdToId(inWorldEntity.getId(), message.getentityId());
switch(message.getcontainerType()){
case InventoryProtocol.INVENTORY_TYPE_NATURAL: {
throw new UnsupportedOperationException("unsupported!");
@ -165,7 +165,7 @@ public class ClientInventoryState implements BehaviorTree {
} break;
case SERVERUPDATEITEMCHARGES: {
LoggerInterface.loggerNetworking.DEBUG("Client set item charges " + message.getentityId());
Entity clientInventoryItem = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId());
Entity clientInventoryItem = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityId());
ClientChargeState clientChargeState = ClientChargeState.getClientChargeState(clientInventoryItem);
clientChargeState.setCharges(message.getcharges());
} break;
@ -292,7 +292,7 @@ public class ClientInventoryState implements BehaviorTree {
public static void clientAddToNatural(Entity item){
//tell the server we want to try the transform
NetworkMessage requestPickupMessage = InventoryMessage.constructclientRequestAddNaturalMessage(
Globals.clientSceneWrapper.mapClientToServerId(item.getId())
Globals.clientState.clientSceneWrapper.mapClientToServerId(item.getId())
);
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
}
@ -305,8 +305,8 @@ public class ClientInventoryState implements BehaviorTree {
public static void clientAttemptStoreItem(Entity creature, Entity item){
//tell the server we want to try the transform
NetworkMessage requestPickupMessage = InventoryMessage.constructaddItemToInventoryMessage(
Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
Globals.clientSceneWrapper.mapClientToServerId(item.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(item.getId()),
ItemUtils.getType(item)
);
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
@ -351,7 +351,7 @@ public class ClientInventoryState implements BehaviorTree {
*/
public static void clientAttemptEjectItem(Entity creature, Entity item){
//if we're the client, tell the server we want to try the transform
NetworkMessage requestPickupMessage = InventoryMessage.constructremoveItemFromInventoryMessage(Globals.clientSceneWrapper.mapClientToServerId(item.getId()));
NetworkMessage requestPickupMessage = InventoryMessage.constructremoveItemFromInventoryMessage(Globals.clientState.clientSceneWrapper.mapClientToServerId(item.getId()));
Globals.clientConnection.queueOutgoingMessage(requestPickupMessage);
if(Globals.virtualAudioSourceManager != null){
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(item));

View File

@ -57,7 +57,7 @@ public class ClientChargeState implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTCHARGESTATE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTCHARGESTATE_ID);
return rVal;
}

View File

@ -85,7 +85,7 @@ public class ClientLifeTree implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTLIFETREE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTLIFETREE_ID);
return rVal;
}

View File

@ -70,7 +70,7 @@ public class ClientPointLightComponent implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTLIGHTSTATE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
return rVal;
}
/**

View File

@ -142,7 +142,7 @@ public class ClientEditorMovementTree implements BehaviorTree {
if(this.parent == Globals.playerEntity){
Globals.clientConnection.queueOutgoingMessage(
EntityMessage.constructmoveUpdateMessage(
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
Globals.timekeeper.getNumberOfSimFramesElapsed(),
position.x,
position.y,
@ -172,7 +172,7 @@ public class ClientEditorMovementTree implements BehaviorTree {
if(this.parent == Globals.playerEntity){
Globals.clientConnection.queueOutgoingMessage(
EntityMessage.constructmoveUpdateMessage(
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
Globals.timekeeper.getNumberOfSimFramesElapsed(),
position.x,
position.y,
@ -195,7 +195,7 @@ public class ClientEditorMovementTree implements BehaviorTree {
Vector3d facingVector = CreatureUtils.getFacingVector(parent);
float maxNaturalVelocity = EDITOR_MAX_VELOCITY;
Entity serverEntity = EntityLookupUtils.getEntityById(Globals.clientSceneWrapper.mapClientToServerId(parent.getId()));
Entity serverEntity = EntityLookupUtils.getEntityById(Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()));
//
//rotation update
@ -524,7 +524,7 @@ public class ClientEditorMovementTree implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTEDITORMOVEMENTTREE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTEDITORMOVEMENTTREE_ID);
return rVal;
}

View File

@ -150,7 +150,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
if(this.parent == Globals.playerEntity){
Globals.clientConnection.queueOutgoingMessage(
EntityMessage.constructmoveUpdateMessage(
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
Globals.timekeeper.getNumberOfSimFramesElapsed(),
position.x,
position.y,
@ -180,7 +180,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
if(this.parent == Globals.playerEntity){
Globals.clientConnection.queueOutgoingMessage(
EntityMessage.constructmoveUpdateMessage(
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
Globals.timekeeper.getNumberOfSimFramesElapsed(),
position.x,
position.y,
@ -820,7 +820,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTGROUNDMOVEMENTTREE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTGROUNDMOVEMENTTREE_ID);
return rVal;
}

View File

@ -82,7 +82,7 @@ public class ClientJumpTree implements BehaviorTree {
public void start(){
Globals.clientConnection.queueOutgoingMessage(
SynchronizationMessage.constructClientRequestBTreeActionMessage(
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
BehaviorTreeIdEnums.BTREE_CLIENTJUMPTREE_ID,
ServerSynchronizationManager.SERVER_SYNC_START
)
@ -191,7 +191,7 @@ public class ClientJumpTree implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTJUMPTREE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTJUMPTREE_ID);
return rVal;
}
@ -301,7 +301,7 @@ public class ClientJumpTree implements BehaviorTree {
public void interrupt(){
Globals.clientConnection.queueOutgoingMessage(
SynchronizationMessage.constructClientRequestBTreeActionMessage(
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
BehaviorTreeIdEnums.BTREE_CLIENTJUMPTREE_ID,
ServerSynchronizationManager.SERVER_SYNC_INTERRUPT
)

View File

@ -63,7 +63,7 @@ public class ClientSprintTree implements BehaviorTree {
public void start(){
Globals.clientConnection.queueOutgoingMessage(
SynchronizationMessage.constructClientRequestBTreeActionMessage(
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
BehaviorTreeIdEnums.BTREE_CLIENTSPRINTTREE_ID,
ServerSynchronizationManager.SERVER_SYNC_START
)
@ -123,7 +123,7 @@ public class ClientSprintTree implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTSPRINTTREE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTSPRINTTREE_ID);
return rVal;
}
@ -160,7 +160,7 @@ public class ClientSprintTree implements BehaviorTree {
public void interrupt(){
Globals.clientConnection.queueOutgoingMessage(
SynchronizationMessage.constructClientRequestBTreeActionMessage(
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
BehaviorTreeIdEnums.BTREE_CLIENTSPRINTTREE_ID,
ServerSynchronizationManager.SERVER_SYNC_INTERRUPT
)

View File

@ -91,7 +91,7 @@ public class ClientWalkTree implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTWALKTREE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTWALKTREE_ID);
return rVal;
}
@ -145,7 +145,7 @@ public class ClientWalkTree implements BehaviorTree {
public void start(){
Globals.clientConnection.queueOutgoingMessage(
SynchronizationMessage.constructClientRequestBTreeActionMessage(
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
BehaviorTreeIdEnums.BTREE_CLIENTWALKTREE_ID,
ServerSynchronizationManager.SERVER_SYNC_START
)
@ -161,7 +161,7 @@ public class ClientWalkTree implements BehaviorTree {
public void interrupt(){
Globals.clientConnection.queueOutgoingMessage(
SynchronizationMessage.constructClientRequestBTreeActionMessage(
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
BehaviorTreeIdEnums.BTREE_CLIENTWALKTREE_ID,
ServerSynchronizationManager.SERVER_SYNC_INTERRUPT
)

View File

@ -72,7 +72,7 @@ public class ClientPhysicsSyncTree implements BehaviorTree {
//Synchronize data
EntityUtils.getPosition(parent).set(position);
EntityUtils.getRotation(parent).set(rotationFromServer);
PhysicsUtils.synchronizeData(Globals.clientSceneWrapper.getCollisionEngine(), body, position, rotationFromServer, linearVelocity, angularVelocity, linearForce, angularForce);
PhysicsUtils.synchronizeData(Globals.clientState.clientSceneWrapper.getCollisionEngine(), body, position, rotationFromServer, linearVelocity, angularVelocity, linearForce, angularForce);
//
//update facing vector if relevant
@ -110,7 +110,7 @@ public class ClientPhysicsSyncTree implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTPHYSICSSYNCTREE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
return rVal;
}

View File

@ -43,7 +43,7 @@ public class ClientAlwaysUprightTree implements BehaviorTree {
EntityUtils.getPosition(parent).set(position);
EntityUtils.getRotation(parent).set(sourceRotation);
PhysicsUtils.synchronizeData(Globals.clientSceneWrapper.getCollisionEngine(), body, position, sourceRotation, linearVelocity, angularVelocity, linearForce, angularForce);
PhysicsUtils.synchronizeData(Globals.clientState.clientSceneWrapper.getCollisionEngine(), body, position, sourceRotation, linearVelocity, angularVelocity, linearForce, angularForce);
}
}
@ -61,7 +61,7 @@ public class ClientAlwaysUprightTree implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTALWAYSUPRIGHTTREE, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
return rVal;
}

View File

@ -61,7 +61,7 @@ public class ClientStanceComponent implements BehaviorTree {
//!!WARNING!! from here below should not be touched
//This was generated automatically to properly alert various systems that the btree exists and should be tracked
parent.putData(EntityDataStrings.TREE_CLIENTSTANCECOMPONENT, rVal);
Globals.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(rVal);
Globals.entityValueTrackingService.attachTreeToEntity(parent, BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID);
return rVal;
}
@ -111,7 +111,7 @@ public class ClientStanceComponent implements BehaviorTree {
public void start(){
Globals.clientConnection.queueOutgoingMessage(
SynchronizationMessage.constructClientRequestBTreeActionMessage(
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID,
ServerSynchronizationManager.SERVER_SYNC_START
)
@ -127,7 +127,7 @@ public class ClientStanceComponent implements BehaviorTree {
public void interrupt(){
Globals.clientConnection.queueOutgoingMessage(
SynchronizationMessage.constructClientRequestBTreeActionMessage(
Globals.clientSceneWrapper.mapClientToServerId(parent.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
BehaviorTreeIdEnums.BTREE_CLIENTSTANCECOMPONENT_ID,
ServerSynchronizationManager.SERVER_SYNC_INTERRUPT
)

View File

@ -30,7 +30,7 @@ public class CollisionObjUtils {
Vector3d position = EntityUtils.getPosition(entity);
Quaterniond rotation = EntityUtils.getRotation(entity);
Collidable collidable = new Collidable(entity, collidableType, true);
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(collisionObject, collidable);
Globals.clientState.clientSceneWrapper.getCollisionEngine().registerCollisionObject(collisionObject, collidable);
PhysicsEntityUtils.setDBody(entity, collisionObject);
@ -90,7 +90,7 @@ public class CollisionObjUtils {
EntityUtils.getPosition(e).set(position);
DBody body = PhysicsEntityUtils.getDBody(e);
if(body != null){
PhysicsUtils.setRigidBodyTransform(Globals.clientSceneWrapper.getCollisionEngine(), position, rotation, body);
PhysicsUtils.setRigidBodyTransform(Globals.clientState.clientSceneWrapper.getCollisionEngine(), position, rotation, body);
}
}

View File

@ -134,21 +134,21 @@ public class CommonEntityUtils {
for(String token : rawType.getTokens()){
switch(token){
case "GENERATE_COLLISION_OBJECT": {
Globals.assetManager.addCollisionMeshToQueue(new PhysicsMeshQueueItem(Globals.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath()));
Globals.clientSceneWrapper.getScene().registerBehaviorTree(new BehaviorTree() {public void simulate(float deltaTime) {
DBody collisionObject = Globals.assetManager.fetchCollisionObject(Globals.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath());
Globals.assetManager.addCollisionMeshToQueue(new PhysicsMeshQueueItem(Globals.clientState.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath()));
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(new BehaviorTree() {public void simulate(float deltaTime) {
DBody collisionObject = Globals.assetManager.fetchCollisionObject(Globals.clientState.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath());
if(collisionObject != null){
Globals.clientSceneWrapper.getScene().deregisterBehaviorTree(this);
Globals.clientState.clientSceneWrapper.getScene().deregisterBehaviorTree(this);
CollisionObjUtils.clientAttachCollisionObjectToEntity(entity, collisionObject, 0, Collidable.TYPE_OBJECT);
}
}});
} break;
case "GENERATE_COLLISION_TERRAIN": {
Globals.assetManager.addCollisionMeshToQueue(new PhysicsMeshQueueItem(Globals.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath()));
Globals.clientSceneWrapper.getScene().registerBehaviorTree(new BehaviorTree() {public void simulate(float deltaTime) {
DBody collisionObject = Globals.assetManager.fetchCollisionObject(Globals.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath());
Globals.assetManager.addCollisionMeshToQueue(new PhysicsMeshQueueItem(Globals.clientState.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath()));
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(new BehaviorTree() {public void simulate(float deltaTime) {
DBody collisionObject = Globals.assetManager.fetchCollisionObject(Globals.clientState.clientSceneWrapper.getCollisionEngine(),rawType.getGraphicsTemplate().getModel().getPath());
if(collisionObject != null){
Globals.clientSceneWrapper.getScene().deregisterBehaviorTree(this);
Globals.clientState.clientSceneWrapper.getScene().deregisterBehaviorTree(this);
CollisionObjUtils.clientAttachCollisionObjectToEntity(entity, collisionObject, 0, Collidable.TYPE_STATIC);
}
}});
@ -205,7 +205,7 @@ public class CommonEntityUtils {
///
///
if(rawType.getHitboxes() != null){
HitboxCollectionState.attachHitboxState(Globals.clientSceneWrapper.getHitboxManager(), false, entity, rawType.getHitboxes());
HitboxCollectionState.attachHitboxState(Globals.clientState.clientSceneWrapper.getHitboxManager(), false, entity, rawType.getHitboxes());
}

View File

@ -170,7 +170,7 @@ public class CreatureUtils {
clientToolbarState.attemptAddToToolbar(itemInInventory, Integer.parseInt(toolbarSlot));
//map the constructed item to its server id
Globals.clientSceneWrapper.mapIdToId(itemInInventory.getId(), inventoryData.getToolbarId(toolbarSlot));
Globals.clientState.clientSceneWrapper.mapIdToId(itemInInventory.getId(), inventoryData.getToolbarId(toolbarSlot));
}
for(Entry<String,EntitySerialization> equippedItem : inventoryData.getEquipItems()){
EntitySerialization serialization = equippedItem.getValue();
@ -184,7 +184,7 @@ public class CreatureUtils {
clientEquipState.attemptEquip(itemInInventory, clientEquipState.getEquipPoint(equipSlot));
//map the constructed item to its server id
Globals.clientSceneWrapper.mapIdToId(itemInInventory.getId(), inventoryData.getEquippedId(equipSlot));
Globals.clientState.clientSceneWrapper.mapIdToId(itemInInventory.getId(), inventoryData.getEquippedId(equipSlot));
}
int i = 0;
for(EntitySerialization naturalItem : inventoryData.getNaturalItems()){
@ -192,7 +192,7 @@ public class CreatureUtils {
Entity itemInInventory = ClientInventoryState.clientConstructInInventoryItem(creature,naturalItem.getSubtype());
//map the constructed item to its server id
Globals.clientSceneWrapper.mapIdToId(itemInInventory.getId(), inventoryData.getNaturalId(i));
Globals.clientState.clientSceneWrapper.mapIdToId(itemInInventory.getId(), inventoryData.getNaturalId(i));
i++;
}
}

View File

@ -74,7 +74,7 @@ public class ItemUtils {
rVal.putData(EntityDataStrings.ITEM_IS_WEAPON, true);
WeaponData weaponData = item.getWeaponData();
if(weaponData.getHitboxes() != null){
HitboxCollectionState.attachHitboxState(Globals.clientSceneWrapper.getHitboxManager(), false, rVal, weaponData.getHitboxes());
HitboxCollectionState.attachHitboxState(Globals.clientState.clientSceneWrapper.getHitboxManager(), false, rVal, weaponData.getHitboxes());
}
rVal.putData(EntityDataStrings.ITEM_WEAPON_CLASS,weaponData.getWeaponClass());
rVal.putData(EntityDataStrings.ITEM_WEAPON_DATA_RAW,weaponData);
@ -128,7 +128,7 @@ public class ItemUtils {
ClientChargeState.attachTree(rVal, item.getMaxStack());
}
Globals.clientSceneWrapper.getScene().registerEntityToTag(rVal, EntityTags.ITEM);
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(rVal, EntityTags.ITEM);
return rVal;
}
@ -530,8 +530,8 @@ public class ItemUtils {
rVal.putData(EntityDataStrings.ITEM_IS_IN_INVENTORY, true);
ItemUtils.setContainingParent(rVal, containingParent);
CommonEntityUtils.setEntitySubtype(rVal, CommonEntityUtils.getEntitySubtype(item));
Globals.clientSceneWrapper.getScene().registerEntity(rVal);
Globals.clientSceneWrapper.getScene().registerEntityToTag(rVal, EntityTags.ITEM);
Globals.clientState.clientSceneWrapper.getScene().registerEntity(rVal);
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(rVal, EntityTags.ITEM);
return rVal;
} else {
return null;
@ -652,7 +652,7 @@ public class ItemUtils {
if(PhysicsEntityUtils.containsDBody(item) && item.containsKey(EntityDataStrings.PHYSICS_COLLIDABLE)){
//destroy physics
//this deregisters from all four & unhooks rigid bodies from the physics runtime
Globals.clientSceneWrapper.getCollisionEngine().destroyPhysics(item);
Globals.clientState.clientSceneWrapper.getCollisionEngine().destroyPhysics(item);
//destroy graphics
ClientEntityUtils.destroyEntity(item);
}

View File

@ -40,7 +40,7 @@ public class ProjectileUtils {
ProjectileTree tree = new ProjectileTree(rVal,maxLife,new Vector3d(initialVector),velocity);
EntityUtils.getPosition(rVal).set(initialPosition);
EntityUtils.getRotation(rVal).rotationTo(SpatialMathUtils.getOriginVector(), new Vector3d(initialVector.x,initialVector.y,initialVector.z)).normalize();
Globals.clientSceneWrapper.getScene().registerBehaviorTree(tree);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(tree);
return rVal;
}
@ -86,7 +86,7 @@ public class ProjectileUtils {
EntityUtils.getPosition(rVal).set(initialPosition);
//projectile behavior tree
ProjectileTree tree = new ProjectileTree(rVal,rawType.getMaxLife(),initialVector,rawType.getVelocity(), rawType.getDamage());
Globals.clientSceneWrapper.getScene().registerBehaviorTree(tree);
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(tree);
ProjectileTree.setProjectileTree(rVal, tree);
//filter construction
List<Entity> filter = new LinkedList<Entity>();
@ -94,7 +94,7 @@ public class ProjectileUtils {
//collidable
HitboxData hitboxData = new HitboxData();
hitboxData.setRadius(rawType.getHitboxRadius());
HitboxCollectionState.attachHitboxStateWithCallback(Globals.clientSceneWrapper.getHitboxManager(), Globals.clientSceneWrapper.getCollisionEngine(), rVal, hitboxData,
HitboxCollectionState.attachHitboxStateWithCallback(Globals.clientState.clientSceneWrapper.getHitboxManager(), Globals.clientState.clientSceneWrapper.getCollisionEngine(), rVal, hitboxData,
new HitboxPositionCallback() {
public Vector3d getPosition(){
return EntityUtils.getPosition(rVal);

View File

@ -125,13 +125,13 @@ public class ProceduralTree {
//attach physics
DBody rigidBody = CollisionBodyCreation.createCylinderBody(
Globals.clientSceneWrapper.getCollisionEngine(),
Globals.clientState.clientSceneWrapper.getCollisionEngine(),
treeModel.getPhysicsBody().getDimension1(),
treeModel.getPhysicsBody().getDimension2(),
Collidable.TYPE_STATIC_BIT
);
CollisionBodyCreation.setOffsetPosition(Globals.clientSceneWrapper.getCollisionEngine(), rigidBody, new Vector3d(0,treeModel.getPhysicsBody().getOffsetY(),0));
CollisionBodyCreation.setKinematic(Globals.clientSceneWrapper.getCollisionEngine(), rigidBody);
CollisionBodyCreation.setOffsetPosition(Globals.clientState.clientSceneWrapper.getCollisionEngine(), rigidBody, new Vector3d(0,treeModel.getPhysicsBody().getOffsetY(),0));
CollisionBodyCreation.setKinematic(Globals.clientState.clientSceneWrapper.getCollisionEngine(), rigidBody);
Collidable collidable = new Collidable(trunkChild, Collidable.TYPE_STATIC, true);
PhysicsEntityUtils.setDBody(trunkChild, rigidBody);
Matrix4d offsetTransform = new Matrix4d().translationRotateScale(
@ -144,7 +144,7 @@ public class ProceduralTree {
trunkChild.putData(EntityDataStrings.PHYSICS_COLLIDABLE, collidable);
trunkChild.putData(EntityDataStrings.PHYSICS_MASS, TREE_MASS);
Globals.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
Globals.clientState.clientSceneWrapper.getCollisionEngine().registerCollisionObject(rigidBody, collidable);
//generate branches
@ -498,7 +498,7 @@ public class ProceduralTree {
//add behavior tree to update all child branch attachment points to new point
if(childBranches.size() > 0 && segment.scalar >= type.getMinimumScalarToGenerateSwayTree() && segment.scalar <= type.getMaximumScalarToGenerateSwayTree()){
Globals.clientSceneWrapper.getScene().registerBehaviorTree(new BranchBehaviorTree(
Globals.clientState.clientSceneWrapper.getScene().registerBehaviorTree(new BranchBehaviorTree(
type,
parent,
branch,

View File

@ -23,8 +23,8 @@ public class CombatProtocol implements ClientProtocolTemplate<CombatMessage> {
switch(message.getMessageSubtype()){
case SERVERREPORTHITBOXCOLLISION: {
Vector3d position = new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ());
Entity senderEntity = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID());
Entity receiverEntity = Globals.clientSceneWrapper.getEntityFromServerId(message.getreceiverEntityID());
Entity senderEntity = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityID());
Entity receiverEntity = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getreceiverEntityID());
if(senderEntity != null && receiverEntity != null){
ClientNetworkHitboxCollision.handleHitboxCollision(senderEntity, receiverEntity, position, message.gethitboxType(), message.gethurtboxType());
}

View File

@ -54,10 +54,10 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
}
//error check
if(Globals.clientState.clientScene != null && Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID()) == null && !idModifyingMessages.contains(message.getMessageSubtype())){
if(Globals.clientState.clientScene != null && Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityID()) == null && !idModifyingMessages.contains(message.getMessageSubtype())){
LoggerInterface.loggerNetworking.WARNING("Client received packet for entity that is not in the client scene!");
Globals.clientSceneWrapper.dumpTranslationLayerStatus();
Globals.clientSceneWrapper.dumpIdData(message.getentityID());
Globals.clientState.clientSceneWrapper.dumpTranslationLayerStatus();
Globals.clientState.clientSceneWrapper.dumpIdData(message.getentityID());
Entity serverEntity = EntityLookupUtils.getEntityById(message.getentityID());
LoggerInterface.loggerNetworking.WARNING("Entity type: " + CommonEntityUtils.getEntityType(serverEntity));
LoggerInterface.loggerNetworking.WARNING("Entity subtype: " + CommonEntityUtils.getEntitySubtype(serverEntity));
@ -104,7 +104,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
//
//
case SETPROPERTY: {
if(Globals.clientSceneWrapper.serverToClientMapContainsId(message.getentityID())){
if(Globals.clientState.clientSceneWrapper.serverToClientMapContainsId(message.getentityID())){
if(message.getpropertyType() == 0){
EntityProtocol.setPlayerEntity(message);
}
@ -115,8 +115,8 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
Globals.clientConnection.release(message);
} break;
case ATTACHENTITYTOENTITY: {
Entity child = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID());
Entity parent = Globals.clientSceneWrapper.getEntityFromServerId(message.gettargetID());
Entity child = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityID());
Entity parent = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.gettargetID());
LoggerInterface.loggerNetworking.DEBUG("Attach " + message.getentityID() + " to " + message.gettargetID() + " on bone " + message.getbone());
if(child != null && parent != null){
AttachUtils.clientAttachEntityToEntityAtBone(
@ -130,7 +130,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
Globals.clientConnection.release(message);
} break;
case MOVEUPDATE: {
Entity target = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID());
Entity target = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityID());
if(target != null){
CreatureUtils.clientAttachEntityMessageToMovementTree(target,message);
}
@ -140,7 +140,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
} break;
case SYNCPHYSICS: {
Entity entity = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID());
Entity entity = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityID());
if(entity != null && ClientPhysicsSyncTree.hasTree(entity)){
ClientPhysicsSyncTree.getTree(entity).setMessage(message);
}
@ -153,7 +153,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
//
//
case DESTROY: {
Entity entity = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID());
Entity entity = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityID());
if(entity != null){
ClientEntityUtils.destroyEntity(entity);
}
@ -180,7 +180,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
* @param message the network message to parse
*/
static void setPlayerEntity(EntityMessage message){
Entity target = Globals.clientSceneWrapper.getEntityFromServerId(message.getentityID());
Entity target = Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityID());
if(target != null){
LoggerInterface.loggerNetworking.DEBUG("Set player entity id for entity: " + target.getId() + " to player: " + message.getpropertyValue());
CreatureUtils.setControllerPlayerId(target, message.getpropertyValue());
@ -202,7 +202,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
}
} else {
LoggerInterface.loggerNetworking.WARNING("Tried to set player entity property on an entity that doesn't exist!");
Globals.clientSceneWrapper.dumpTranslationLayerStatus();
Globals.clientState.clientSceneWrapper.dumpTranslationLayerStatus();
}
}
@ -220,7 +220,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
new Quaterniond(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW())
);
Globals.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
Globals.clientState.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
//if the creature template includes an equip section, spawn all the equipped items
CreatureUtils.clientApplyTemplate(newlySpawnedEntity, template);
//apply state synchronization if present
@ -246,7 +246,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
new Quaterniond(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW())
);
Globals.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
Globals.clientState.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
return newlySpawnedEntity;
}
@ -264,7 +264,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
new Quaterniond(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW())
);
Globals.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
Globals.clientState.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
return newlySpawnedEntity;
}
@ -284,7 +284,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
new Vector3d(message.getpositionX(),message.getpositionY(),message.getpositionZ()),
new Quaterniond(message.getrotationX(),message.getrotationY(),message.getrotationZ(),message.getrotationW())
);
Globals.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
Globals.clientState.clientSceneWrapper.mapIdToId(newlySpawnedEntity.getId(), message.getentityID());
return newlySpawnedEntity;
}

View File

@ -45,7 +45,7 @@ public class TerrainProtocol implements ClientProtocolTemplate<TerrainMessage> {
),
message.getworldSizeDiscrete()
);
Globals.clientSceneWrapper.getCollisionEngine().setCollisionWorldData(new CollisionWorldData());
Globals.clientState.clientSceneWrapper.getCollisionEngine().setCollisionWorldData(new CollisionWorldData());
Globals.clientConnection.getMessageProtocol().setHasReceivedWorld(true);
break;
case SPAWNPOSITION:

View File

@ -92,7 +92,7 @@ public class ClientSynchronizationManager {
}
//attempt to handle the message
if(Globals.clientSceneWrapper.containsServerId(message.getentityId()) && Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId()) != null){
if(Globals.clientState.clientSceneWrapper.containsServerId(message.getentityId()) && Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityId()) != null){
messagesToClear.add(message);
messageBounceCount.remove(message);
switch(message.getMessageSubtype()){
@ -104,13 +104,13 @@ public class ClientSynchronizationManager {
case UPDATECLIENTSTRINGSTATE:{
int bTreeId = message.getbTreeId();
int entityId = message.getentityId();
Entity targetEntity = Globals.clientSceneWrapper.getEntityFromServerId(entityId);
Entity targetEntity = Globals.clientState.clientSceneWrapper.getEntityFromServerId(entityId);
this.updateEntityState(targetEntity,bTreeId,message);
} break;
case SERVERNOTIFYBTREETRANSITION: {
int bTreeId = message.getbTreeId();
int entityId = message.getentityId();
Entity targetEntity = Globals.clientSceneWrapper.getEntityFromServerId(entityId);
Entity targetEntity = Globals.clientState.clientSceneWrapper.getEntityFromServerId(entityId);
this.transitionBTree(targetEntity, bTreeId, message);
} break;
case ATTACHTREE:{
@ -131,26 +131,26 @@ public class ClientSynchronizationManager {
//silently ignore
break;
}
} else if(Globals.clientSceneWrapper.containsServerId(message.getentityId()) && Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId()) == null){
} else if(Globals.clientState.clientSceneWrapper.containsServerId(message.getentityId()) && Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityId()) == null){
String errorMessage =
"Client received synchronization packet for entity that does not exists on client!\n" +
"Specifically, the synchronization manager thinks this id is registered, but there is no entity at that key\n" +
"Entity id in network message: " + message.getentityId()
;
Globals.clientSceneWrapper.dumpTranslationLayerStatus();
Globals.clientSceneWrapper.dumpIdData(message.getentityId());
Globals.clientSceneWrapper.getScene().describeScene();
Globals.clientState.clientSceneWrapper.dumpTranslationLayerStatus();
Globals.clientState.clientSceneWrapper.dumpIdData(message.getentityId());
Globals.clientState.clientSceneWrapper.getScene().describeScene();
throw new IllegalStateException(errorMessage);
} else if(!Globals.clientSceneWrapper.containsServerId(message.getentityId()) && !Globals.clientSceneWrapper.hasBeenDeleted(message.getentityId())){
} else if(!Globals.clientState.clientSceneWrapper.containsServerId(message.getentityId()) && !Globals.clientState.clientSceneWrapper.hasBeenDeleted(message.getentityId())){
//TODO: have client send query to server to resend this entity
// String errorMessage =
// "Client received synchronization packet for entity that does not exists on client!\n" +
// "This ID was never created on the client, yet the client is receiving a synchronization packet for it!\n" +
// "Entity id in network message: " + message.getentityId()
// ;
// Globals.clientSceneWrapper.dumpTranslationLayerStatus();
// Globals.clientSceneWrapper.dumpIdData(message.getentityId());
// Globals.clientSceneWrapper.getScene().describeScene();
// Globals.clientState.clientSceneWrapper.dumpTranslationLayerStatus();
// Globals.clientState.clientSceneWrapper.dumpIdData(message.getentityId());
// Globals.clientState.clientSceneWrapper.getScene().describeScene();
// throw new IllegalStateException(errorMessage);
}
@ -159,8 +159,8 @@ public class ClientSynchronizationManager {
//data from the message itself
int serverId = message.getentityId();
String clientContainsServerId = "" + Globals.clientSceneWrapper.containsServerId(serverId);
String entityFromServerId = "" + Globals.clientSceneWrapper.getEntityFromServerId(message.getentityId());
String clientContainsServerId = "" + Globals.clientState.clientSceneWrapper.containsServerId(serverId);
String entityFromServerId = "" + Globals.clientState.clientSceneWrapper.getEntityFromServerId(message.getentityId());
//actual server entity
Entity actualServerEntity = EntityLookupUtils.getEntityById(serverId);

View File

@ -77,7 +77,7 @@ public class DebugContentPipeline implements RenderPipeline {
if(Globals.userSettings.getGraphicsDebugDrawCollisionSpheresClient()){
Model hitboxModel;
for(HitboxCollectionState hitboxState : Globals.clientSceneWrapper.getHitboxManager().getAllHitboxes()){
for(HitboxCollectionState hitboxState : Globals.clientState.clientSceneWrapper.getHitboxManager().getAllHitboxes()){
for(DGeom geom : hitboxState.getGeometries()){
if(geom instanceof DSphere){
DSphere sphereView = (DSphere)geom;
@ -129,7 +129,7 @@ public class DebugContentPipeline implements RenderPipeline {
}
if(Globals.userSettings.getGraphicsDebugDrawCollisionSpheresServer()){
Model hitboxModel;
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
Realm playerRealm = Globals.realmManager.getEntityRealm(serverPlayerEntity);
List<HitboxCollectionState> hitboxStates = new LinkedList<HitboxCollectionState>(playerRealm.getHitboxManager().getAllHitboxes());
@ -186,7 +186,7 @@ public class DebugContentPipeline implements RenderPipeline {
if(Globals.userSettings.graphicsDebugDrawPhysicsObjects()){
Model physicsGraphicsModel;
CollisionEngine engine = Globals.clientSceneWrapper.getCollisionEngine();
CollisionEngine engine = Globals.clientState.clientSceneWrapper.getCollisionEngine();
for(Collidable collidable : engine.getCollidables()){
Entity physicsEntity = collidable.getParent();
if((boolean)physicsEntity.getData(EntityDataStrings.DATA_STRING_DRAW) && physicsEntity.getData(EntityDataStrings.PHYSICS_MODEL_TEMPLATE) != null){
@ -238,7 +238,7 @@ public class DebugContentPipeline implements RenderPipeline {
//Draw grid alignment data
if(Globals.userSettings.getGraphicsDebugDrawGridAlignment()){
Model physicsGraphicsModel = Globals.assetManager.fetchModel(AssetDataStrings.UNITCUBE);
for(Entity entity : Globals.clientSceneWrapper.getScene().getEntityList()){
for(Entity entity : Globals.clientState.clientSceneWrapper.getScene().getEntityList()){
CommonEntityType data = CommonEntityUtils.getCommonData(entity);
if(data == null){
continue;

View File

@ -70,7 +70,7 @@ public class EntityLookupUtils {
if(EntityLookupUtils.isServerEntity(clientEntity)){
throw new Error("Trying to get server equivalent of a server entity!");
}
int serverIdForClientEntity = Globals.clientSceneWrapper.mapClientToServerId(clientEntity.getId());
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(clientEntity.getId());
Entity serverEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
return serverEntity;
}

View File

@ -32,7 +32,7 @@ public class ClientCollidableTreeTests extends EntityTestTemplate {
TestEngineUtils.simulateFrames(3);
//get client entity
Entity clientEntity = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE).iterator().next();
Entity clientEntity = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE).iterator().next();
//verify it was started on server
assertEquals(false, ClientFallTree.getFallTree(clientEntity).isFalling());

View File

@ -50,9 +50,9 @@ public class ClientEquipStateTests extends EntityTestTemplate {
TestEngineUtils.simulateFrames(5);
//verify the client got the extra entities
Set<Entity> clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
Set<Entity> clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
assertEquals(1, clientSideCreatures.size());
Set<Entity> clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
Set<Entity> clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
assertEquals(1, clientSideItems.size());
//equip
@ -64,9 +64,9 @@ public class ClientEquipStateTests extends EntityTestTemplate {
TestEngineUtils.simulateFrames(2);
//verify we still have everything
clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
assertEquals(1, clientSideCreatures.size());
clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
assertEquals(1, clientSideItems.size());
//grab the item in particular
@ -101,9 +101,9 @@ public class ClientEquipStateTests extends EntityTestTemplate {
TestEngineUtils.simulateFrames(5);
//verify the client got the extra entities
Set<Entity> clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
Set<Entity> clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
assertEquals(1, clientSideCreatures.size());
Set<Entity> clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
Set<Entity> clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
assertEquals(1, clientSideItems.size());
//try to store item in inventory
@ -124,9 +124,9 @@ public class ClientEquipStateTests extends EntityTestTemplate {
TestEngineUtils.simulateFrames(5);
//verify we still have everything
clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
assertEquals(1, clientSideCreatures.size());
clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
assertEquals(2, clientSideItems.size());
//verify the equip state thinks it has something equipped

View File

@ -38,9 +38,9 @@ public class InventoryUtilsTests extends EntityTestTemplate {
TestEngineUtils.simulateFrames(1);
//verify the client got the extra entities
Set<Entity> clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
Set<Entity> clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
assertEquals(1, clientSideCreatures.size());
Set<Entity> clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
Set<Entity> clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
assertEquals(1, clientSideItems.size());
//grab player entity
@ -55,9 +55,9 @@ public class InventoryUtilsTests extends EntityTestTemplate {
TestEngineUtils.simulateFrames(2);
//verify we still have everything
clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
assertEquals(1, clientSideCreatures.size());
clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
assertEquals(1, clientSideItems.size());
//grab the item in particular
@ -91,9 +91,9 @@ public class InventoryUtilsTests extends EntityTestTemplate {
TestEngineUtils.simulateFrames(1);
//verify the client got the extra entities
Set<Entity> clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
Set<Entity> clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
assertEquals(1, clientSideCreatures.size());
Set<Entity> clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
Set<Entity> clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
assertEquals(1, clientSideItems.size());
//grab player entity
@ -108,7 +108,7 @@ public class InventoryUtilsTests extends EntityTestTemplate {
TestEngineUtils.simulateFrames(2);
//attempt to eject
clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
clientKatana = clientSideItems.iterator().next();
ClientInventoryState.clientAttemptEjectItem(clientCreature, clientKatana);
@ -116,9 +116,9 @@ public class InventoryUtilsTests extends EntityTestTemplate {
TestEngineUtils.simulateFrames(2);
//verify we still have everything
clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
assertEquals(1, clientSideCreatures.size());
clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
assertEquals(1, clientSideItems.size());
//grab the item in particular
@ -151,9 +151,9 @@ public class InventoryUtilsTests extends EntityTestTemplate {
TestEngineUtils.simulateFrames(1);
//verify the client got the extra entities
Set<Entity> clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
Set<Entity> clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
assertEquals(1, clientSideCreatures.size());
Set<Entity> clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
Set<Entity> clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
assertEquals(0, clientSideItems.size());
//grab player entity
@ -164,9 +164,9 @@ public class InventoryUtilsTests extends EntityTestTemplate {
ClientInventoryState.clientConstructInInventoryItem(clientCreature, "Katana2H");
//verify we still have everything
clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
assertEquals(1, clientSideCreatures.size());
clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
assertEquals(1, clientSideItems.size());
//grab the item in particular

View File

@ -38,9 +38,9 @@ public class ItemUtilsTests extends EntityTestTemplate {
TestEngineUtils.simulateFrames(1);
//verify the client got the extra entities
Set<Entity> clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
Set<Entity> clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
assertEquals(1, clientSideCreatures.size());
Set<Entity> clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
Set<Entity> clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
assertEquals(0, clientSideItems.size());
//get server equivalent of client entity
@ -58,9 +58,9 @@ public class ItemUtilsTests extends EntityTestTemplate {
TestEngineUtils.simulateFrames(2);
//verify we still have everything
clientSideCreatures = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
clientSideCreatures = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.CREATURE);
assertEquals(1, clientSideCreatures.size());
clientSideItems = Globals.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
clientSideItems = Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.ITEM);
assertEquals(1, clientSideItems.size());
//grab the item in particular

View File

@ -16,7 +16,6 @@ public class StateCleanupCheckerExtension implements AfterEachCallback {
public void afterEach(ExtensionContext context) throws Exception {
Object[] objectsToCheck = new Object[]{
Globals.realmManager,
Globals.clientSceneWrapper,
Globals.signalSystem,
Globals.threadManager,
Globals.renderingEngine,

View File

@ -58,11 +58,11 @@ public class TestEngineUtils {
*/
public static Entity getClientEquivalent(Entity serverEntity){
int frames = 0;
while(frames < MAX_FRAMES_TO_WAIT_FOR_CLIENT_PROPAGATION && !Globals.clientSceneWrapper.containsServerId(serverEntity.getId())){
while(frames < MAX_FRAMES_TO_WAIT_FOR_CLIENT_PROPAGATION && !Globals.clientState.clientSceneWrapper.containsServerId(serverEntity.getId())){
TestEngineUtils.simulateFrames(1);
}
if(Globals.clientSceneWrapper.containsServerId(serverEntity.getId())){
Entity rVal = Globals.clientSceneWrapper.getEntityFromServerId(serverEntity.getId());
if(Globals.clientState.clientSceneWrapper.containsServerId(serverEntity.getId())){
Entity rVal = Globals.clientState.clientSceneWrapper.getEntityFromServerId(serverEntity.getId());
if(rVal == null){
fail("Failed to find client entity at server id lookup for id: " + serverEntity.getId());
}
@ -81,10 +81,10 @@ public class TestEngineUtils {
if(clientEntity == null){
fail("Provided null entity to get server equivalent!");
}
if(Globals.clientSceneWrapper.containsServerId(clientEntity.getId())){
if(Globals.clientState.clientSceneWrapper.containsServerId(clientEntity.getId())){
fail("Provided server entity to getServerEquivalent");
}
int serverId = Globals.clientSceneWrapper.mapClientToServerId(clientEntity.getId());
int serverId = Globals.clientState.clientSceneWrapper.mapClientToServerId(clientEntity.getId());
Entity rVal = EntityLookupUtils.getEntityById(serverId);
if(rVal == null){
fail("Failed to find client entity at server id lookup for id: " + clientEntity.getId());