move playerEntity to clientState

This commit is contained in:
austin 2025-05-15 12:39:25 -04:00
parent ac9c1a017e
commit 6d98af90ac
62 changed files with 310 additions and 306 deletions

View File

@ -1807,6 +1807,7 @@ Move clientWorldData to clientState
Move clientScene to clientState
Move clientSceneWrapper to clientState
Move clientConnection to clientState
Move playerEntity to clientState
Move lots of global state to clientState

View File

@ -16,6 +16,7 @@ import electrosphere.client.terrain.manager.ClientTerrainManager;
import electrosphere.collision.CollisionEngine;
import electrosphere.data.common.CommonEntityType;
import electrosphere.data.voxel.VoxelType;
import electrosphere.entity.Entity;
import electrosphere.entity.scene.Scene;
import electrosphere.net.client.ClientNetworking;
import electrosphere.net.server.player.Player;
@ -126,6 +127,11 @@ public class ClientState {
*/
public ClientPlayerData clientPlayerData = new ClientPlayerData();
/**
* The client side equivalent of this client's entity on the server
*/
public Entity playerEntity;
/**
* Constructor
*/

View File

@ -137,8 +137,8 @@ public class ClientBlockCellManager {
*/
public void update(){
Globals.profiler.beginCpuSample("ClientBlockCellManager.update");
if(shouldUpdate && Globals.playerEntity != null){
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
if(shouldUpdate && Globals.clientState.playerEntity != null){
Vector3d playerPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
Vector3i playerWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(playerPos);
int distCache = this.getDistCache(this.lastPlayerPos, playerWorldPos);
this.lastPlayerPos.set(playerWorldPos);
@ -656,7 +656,7 @@ public class ClientBlockCellManager {
* @return true if within full LOD range, false otherwise
*/
public boolean isFullLOD(Vector3i worldPos){
Vector3d playerRealPos = EntityUtils.getPosition(Globals.playerEntity);
Vector3d playerRealPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
Vector3d chunkMin = Globals.clientState.clientWorldData.convertWorldToRealSpace(worldPos);
Vector3d chunkMax = Globals.clientState.clientWorldData.convertWorldToRealSpace(new Vector3i(worldPos).add(1,1,1));
return GeomUtils.getMinDistanceAABB(playerRealPos, chunkMin, chunkMax) <= FULL_RES_DIST;

View File

@ -79,8 +79,8 @@ public class CameraEntityUtils {
rVal.putData(EntityDataStrings.CAMERA_YAW, 0.0f);
Globals.cameraHandler.setTrackPlayerEntity(true);
//if camera data is defined, use the camera data third person offset instead of the default offset
if(Globals.playerEntity != null && CommonEntityUtils.getCommonData(Globals.playerEntity) != null){
CommonEntityType type = CommonEntityUtils.getCommonData(Globals.playerEntity);
if(Globals.clientState.playerEntity != null && CommonEntityUtils.getCommonData(Globals.clientState.playerEntity) != null){
CommonEntityType type = CommonEntityUtils.getCommonData(Globals.clientState.playerEntity);
if(type.getCameraData() != null && type.getCameraData().getThirdPersonCameraOffset() != null){
rVal.putData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET, new Vector3d(
(float)type.getCameraData().getThirdPersonCameraOffset().x,

View File

@ -31,8 +31,8 @@ public class Crosshair {
static final float TARGET_MAX_DIST = 1;
public static void checkTargetable(){
if(crossHairEntity != null && Globals.playerEntity != null && Globals.playerCamera != null){
Vector3d parentPos = EntityUtils.getPosition(Globals.playerEntity);
if(crossHairEntity != null && Globals.clientState.playerEntity != null && Globals.playerCamera != null){
Vector3d parentPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
// if(currentTarget == null){
if(!crosshairActive){
Entity target = null;
@ -41,7 +41,7 @@ public class Crosshair {
Vector3d entityPos = EntityUtils.getPosition(entity);
double currentDist = parentPos.distance(entityPos);
double currentAngleDiff = new Vector3d(entityPos).sub(parentPos).normalize().dot(new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera)));
if(currentDist + currentAngleDiff < dist && currentDist <= TARGET_MAX_DIST && entity != Globals.playerEntity){
if(currentDist + currentAngleDiff < dist && currentDist <= TARGET_MAX_DIST && entity != Globals.clientState.playerEntity){
target = entity;
dist = currentDist + currentAngleDiff;
}

View File

@ -295,7 +295,7 @@ public class FluidCellManager {
Set<FluidCell> cellsToRemove = new HashSet<FluidCell>();
for(FluidCell cell : cells){
Vector3d realPos = cell.getRealPos();
if(Globals.playerEntity != null && EntityUtils.getPosition(Globals.playerEntity).distance(realPos) > drawRadius){
if(Globals.clientState.playerEntity != null && EntityUtils.getPosition(Globals.clientState.playerEntity).distance(realPos) > drawRadius){
cellsToRemove.add(cell);
}
}
@ -315,8 +315,8 @@ public class FluidCellManager {
* Queues new cells that are in bounds but not currently accounted for
*/
private void queueNewCells(){
if(Globals.playerEntity != null && Globals.clientState.clientWorldData != null){
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
if(Globals.clientState.playerEntity != null && Globals.clientState.clientWorldData != null){
Vector3d playerPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
for(int x = -(int)drawRadius; x < drawRadius; x = x + ChunkData.CHUNK_DATA_SIZE){
for(int y = -(int)drawRadius; y < drawRadius; y = y + ChunkData.CHUNK_DATA_SIZE){
for(int z = -(int)drawRadius; z < drawRadius; z = z + ChunkData.CHUNK_DATA_SIZE){

View File

@ -28,7 +28,7 @@ public class ButtonInteraction {
* Handles a button interaction event
*/
public static void handleButtonInteraction(){
if(Globals.playerEntity != null && Globals.playerCamera != null){
if(Globals.clientState.playerEntity != null && Globals.playerCamera != null){
Entity camera = Globals.playerCamera;
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera)).mul(-1.0);
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera));
@ -36,9 +36,9 @@ public class ButtonInteraction {
if(target != null && CommonEntityFlags.isInteractable(target)){
Globals.interactionTarget = target;
ButtonInteraction.performInteraction(target);
} else if(ClientEquipState.hasEquipState(Globals.playerEntity) && Crosshair.hasTarget()){
if(InventoryUtils.hasNaturalInventory(Globals.playerEntity)){
ClientInventoryState.clientAttemptStoreItem(Globals.playerEntity, Crosshair.getTarget());
} else if(ClientEquipState.hasEquipState(Globals.clientState.playerEntity) && Crosshair.hasTarget()){
if(InventoryUtils.hasNaturalInventory(Globals.clientState.playerEntity)){
ClientInventoryState.clientAttemptStoreItem(Globals.clientState.playerEntity, Crosshair.getTarget());
}
}
}
@ -68,7 +68,7 @@ public class ButtonInteraction {
case InteractionData.ON_INTERACT_INVENTORY: {
LoggerInterface.loggerEngine.DEBUG("Interacting with inventory");
InventoryMainWindow.viewInventory(target);
InventoryMainWindow.viewInventory(Globals.playerEntity);
InventoryMainWindow.viewInventory(Globals.clientState.playerEntity);
Globals.clientState.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestWatchInventoryMessage(Globals.clientState.clientSceneWrapper.mapClientToServerId(target.getId())));
} break;
default: {

View File

@ -229,7 +229,7 @@ public class ClientInteractionEngine {
* Updates the interaction target label
*/
public static void updateInteractionTargetLabel(){
if(Globals.playerEntity != null && Globals.playerCamera != null){
if(Globals.clientState.playerEntity != null && Globals.playerCamera != null){
//clear block cursor
Globals.cursorState.hintClearBlockCursor();

View File

@ -66,16 +66,16 @@ public class ItemActions {
boolean sendServerMessage = true;
//do any immediate client side calculations here (ie start playing an animation until we get response from server)
if(Globals.playerEntity != null){
ClientAttackTree attackTree = CreatureUtils.clientGetAttackTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
ClientAttackTree attackTree = CreatureUtils.clientGetAttackTree(Globals.clientState.playerEntity);
if(attackTree != null){
attackTree.start();
}
ShooterTree shooterTree = ShooterTree.getShooterTree(Globals.playerEntity);
ShooterTree shooterTree = ShooterTree.getShooterTree(Globals.clientState.playerEntity);
if(shooterTree != null){
shooterTree.fire();
}
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.clientState.playerEntity);
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
@ -155,9 +155,9 @@ public class ItemActions {
cursorPos.z
));
//do any immediate client side calculations here (ie start playing an animation until we get response from server)
if(Globals.playerEntity != null){
if(Globals.clientState.playerEntity != null){
// Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
ClientAttackTree attackTree = CreatureUtils.clientGetAttackTree(Globals.playerEntity);
ClientAttackTree attackTree = CreatureUtils.clientGetAttackTree(Globals.clientState.playerEntity);
if(attackTree != null){
// CreatureUtils.setFacingVector(Globals.playerCharacter, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).normalize());
attackTree.release();
@ -184,8 +184,8 @@ public class ItemActions {
boolean sendServerMessage = true;
//do any immediate client side calculations here (ie start playing an animation until we get response from server)
if(Globals.playerEntity != null){
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.clientState.playerEntity);
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
@ -237,8 +237,8 @@ public class ItemActions {
boolean sendServerMessage = true;
//do any immediate client side calculations here (ie start playing an animation until we get response from server)
if(Globals.playerEntity != null){
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.clientState.playerEntity);
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);

View File

@ -285,9 +285,9 @@ public class ClientSceneWrapper {
*/
public void destroyEntitiesOutsideSimRange(){
Globals.profiler.beginCpuSample("destroyEntitiesOutsideSimRange");
// if(Globals.drawCellManager != null && Globals.playerEntity != null){
// if(Globals.drawCellManager != null && Globals.clientState.playerEntity != null){
// double cullRadius = Globals.drawCellManager.getDrawRadius() + ServerTerrainChunk.CHUNK_DIMENSION;
// Vector3d playerPosition = EntityUtils.getPosition(Globals.playerEntity);
// Vector3d playerPosition = EntityUtils.getPosition(Globals.clientState.playerEntity);
// List<Entity> entityList = scene.getEntityList();
// for(Entity entity : entityList){
// Vector3d position = EntityUtils.getPosition(entity);

View File

@ -152,8 +152,8 @@ public class ClientSimulation {
*/
private void updateSkyboxPos(){
Globals.profiler.beginCpuSample("updateSkyboxPos");
if(Globals.skybox != null && Globals.playerEntity != null){
EntityUtils.getPosition(Globals.skybox).set(EntityUtils.getPosition(Globals.playerEntity));
if(Globals.skybox != null && Globals.clientState.playerEntity != null){
EntityUtils.getPosition(Globals.skybox).set(EntityUtils.getPosition(Globals.clientState.playerEntity));
}
Globals.profiler.endCpuSample();
}
@ -164,11 +164,11 @@ public class ClientSimulation {
private void updateFirstPersonAttachments(){
Globals.profiler.beginCpuSample("updateFirstPersonAttachments");
//update the facing vector when camera moves in first person
if(!Globals.controlHandler.cameraIsThirdPerson() && Globals.playerCamera != null && Globals.playerEntity != null){
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
if(!Globals.controlHandler.cameraIsThirdPerson() && Globals.playerCamera != null && Globals.clientState.playerEntity != null){
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
//flush equipped item state
if(ClientEquipState.hasEquipState(Globals.playerEntity)){
ClientEquipState equipState = ClientEquipState.getClientEquipState(Globals.playerEntity);
if(ClientEquipState.hasEquipState(Globals.clientState.playerEntity)){
ClientEquipState equipState = ClientEquipState.getClientEquipState(Globals.clientState.playerEntity);
equipState.evaluatePlayerAttachments();
}
}

View File

@ -172,8 +172,8 @@ public class ClientDrawCellManager {
*/
public void update(){
Globals.profiler.beginCpuSample("ClientDrawCellManager.update");
if(shouldUpdate && Globals.playerEntity != null){
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
if(shouldUpdate && Globals.clientState.playerEntity != null){
Vector3d playerPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
Vector3i playerWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(playerPos);
int distCache = this.getDistCache(this.lastPlayerPos, playerWorldPos);
if(this.bustDistCache){
@ -803,7 +803,7 @@ public class ClientDrawCellManager {
* @return true if within full LOD range, false otherwise
*/
public boolean isFullLOD(Vector3i worldPos){
Vector3d playerRealPos = EntityUtils.getPosition(Globals.playerEntity);
Vector3d playerRealPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
Vector3d chunkMin = Globals.clientState.clientWorldData.convertWorldToRealSpace(worldPos);
Vector3d chunkMax = Globals.clientState.clientWorldData.convertWorldToRealSpace(new Vector3i(worldPos).add(1,1,1));
return GeomUtils.getMinDistanceAABB(playerRealPos, chunkMin, chunkMax) <= FULL_RES_DIST;

View File

@ -194,8 +194,8 @@ public class FoliageCellManager {
*/
public void update(){
Globals.profiler.beginCpuSample("FoliageCellManager.update");
if(shouldUpdate && Globals.playerEntity != null && Globals.userSettings.getGraphicsPerformanceEnableFoliageManager()){
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
if(shouldUpdate && Globals.clientState.playerEntity != null && Globals.userSettings.getGraphicsPerformanceEnableFoliageManager()){
Vector3d playerPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
Vector3i absVoxelPos = Globals.clientState.clientWorldData.convertRealToAbsoluteVoxelSpace(playerPos);
int distCache = this.getDistCache(this.lastPlayerPos, absVoxelPos);
if(bustDistCache || absVoxelPos.distance(this.lastPlayerPos) > TELEPORT_DISTANCE){
@ -742,7 +742,7 @@ public class FoliageCellManager {
* @return true if within full LOD range, false otherwise
*/
public boolean isFullLOD(Vector3i worldPos){
Vector3d playerRealPos = EntityUtils.getPosition(Globals.playerEntity);
Vector3d playerRealPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
Vector3d chunkMin = Globals.clientState.clientWorldData.convertWorldToRealSpace(worldPos);
Vector3d chunkMax = Globals.clientState.clientWorldData.convertWorldToRealSpace(new Vector3i(worldPos).add(1,1,1));
return GeomUtils.getMinDistanceAABB(playerRealPos, chunkMin, chunkMax) <= FULL_RES_DIST;

View File

@ -70,7 +70,7 @@ public class EquipmentInventoryPanel {
//clear item container ui
WindowUtils.cleanItemDraggingWindow();
//re-render inventory
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.playerEntity));
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.clientState.playerEntity));
return false;
}
return true;
@ -150,7 +150,7 @@ public class EquipmentInventoryPanel {
container.removeChild(panel);
WindowUtils.pushItemIconToItemWindow(panel);
panel.setAbsolutePosition(true);
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.playerEntity));
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.clientState.playerEntity));
//play sound effect
if(Globals.virtualAudioSourceManager != null){
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(finalEnt));
@ -188,7 +188,7 @@ public class EquipmentInventoryPanel {
if(Globals.dragSourceInventory == InventoryUtils.getToolbarInventory(entity)){
if(inventory.canEquipItemToSlot(Globals.draggedItem, slots.get(itemId))){
//fire equip event to equip state
ClientEquipState equipState = ClientEquipState.getEquipState(Globals.playerEntity);
ClientEquipState equipState = ClientEquipState.getEquipState(Globals.clientState.playerEntity);
equipState.commandAttemptEquip(Globals.draggedItem,inventory.getEquipPointFromSlot(slots.get(itemId)));
//play sound effect
if(Globals.virtualAudioSourceManager != null){
@ -202,16 +202,16 @@ public class EquipmentInventoryPanel {
} else if(inventory.canEquipItemToCombinedSlot(Globals.draggedItem, slots.get(itemId))){
EquipPoint combinedPoint = inventory.getCombinedPoint(slots.get(itemId));
//fire equip event to equip state
ClientEquipState equipState = ClientEquipState.getEquipState(Globals.playerEntity);
ClientEquipState equipState = ClientEquipState.getEquipState(Globals.clientState.playerEntity);
equipState.commandAttemptEquip(Globals.draggedItem,combinedPoint);
}
} else if(ItemUtils.getContainingParent(Globals.draggedItem) != Globals.playerEntity){
} else if(ItemUtils.getContainingParent(Globals.draggedItem) != Globals.clientState.playerEntity){
throw new UnsupportedOperationException("Unimplemented!");
}
} else if(Globals.dragSourceInventory instanceof UnrelationalInventoryState){
if(inventory.canEquipItemToSlot(Globals.draggedItem, slots.get(itemId))){
//fire equip event to equip state
ClientEquipState equipState = ClientEquipState.getEquipState(Globals.playerEntity);
ClientEquipState equipState = ClientEquipState.getEquipState(Globals.clientState.playerEntity);
equipState.commandAttemptEquip(Globals.draggedItem,inventory.getEquipPointFromSlot(slots.get(itemId)));
//play sound effect
if(Globals.virtualAudioSourceManager != null){
@ -225,7 +225,7 @@ public class EquipmentInventoryPanel {
} else if(inventory.canEquipItemToCombinedSlot(Globals.draggedItem, slots.get(itemId))){
EquipPoint combinedPoint = inventory.getCombinedPoint(slots.get(itemId));
//fire equip event to equip state
ClientEquipState equipState = ClientEquipState.getEquipState(Globals.playerEntity);
ClientEquipState equipState = ClientEquipState.getEquipState(Globals.clientState.playerEntity);
equipState.commandAttemptEquip(Globals.draggedItem,combinedPoint);
}
}
@ -244,7 +244,7 @@ public class EquipmentInventoryPanel {
//clear item container ui
WindowUtils.cleanItemDraggingWindow();
//rerender inventories
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.playerEntity));
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.clientState.playerEntity));
return false;
}});
}

View File

@ -84,7 +84,7 @@ public class ItemIconPanel {
panel.setPositionType(YogaPositionType.Absolute);
panel.setPositionX(panel.getAbsoluteX());
panel.setPositionY(panel.getAbsoluteY());
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.playerEntity));
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.clientState.playerEntity));
//play sound effect
if(Globals.virtualAudioSourceManager != null){
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(finalEnt));
@ -194,7 +194,7 @@ public class ItemIconPanel {
//clear item container ui
WindowUtils.cleanItemDraggingWindow();
//rerender inventories
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.playerEntity));
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.clientState.playerEntity));
return false;
}});

View File

@ -75,7 +75,7 @@ public class NaturalInventoryPanel {
//clear item container ui
WindowUtils.cleanItemDraggingWindow();
//re-render inventory
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.playerEntity));
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.clientState.playerEntity));
}
}
}
@ -91,7 +91,7 @@ public class NaturalInventoryPanel {
//clear ui
WindowUtils.cleanItemDraggingWindow();
//re-render inventory
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.playerEntity));
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.clientState.playerEntity));
return true;
}});

View File

@ -85,7 +85,7 @@ public class ToolbarInventoryPanel {
//clear item container ui
WindowUtils.cleanItemDraggingWindow();
//re-render inventory
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.playerEntity));
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.clientState.playerEntity));
}
}
}
@ -101,7 +101,7 @@ public class ToolbarInventoryPanel {
//clear ui
WindowUtils.cleanItemDraggingWindow();
//re-render inventory
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.playerEntity));
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.clientState.playerEntity));
return true;
}});

View File

@ -193,10 +193,10 @@ public class WindowUtils {
public static void attemptRedrawInventoryWindows(){
//make sure we're client and the player entity exists
if(Globals.RUN_CLIENT){
if(Globals.playerEntity != null){
if(Globals.clientState.playerEntity != null){
if(Globals.elementService.containsWindow(WindowStrings.WINDOW_CHARACTER)){
//redraw if necessary
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.playerEntity));
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.clientState.playerEntity));
}
}
if(Globals.targetContainer != null){

View File

@ -38,10 +38,10 @@ public class ImGuiPlayerEntity {
ImGui.text("Player Entity Details");
//data about player entity
if(Globals.playerEntity != null){
Vector3d clientEntityPos = EntityUtils.getPosition(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
Vector3d clientEntityPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
ImGui.text("Position: " + String.format("%.2f",clientEntityPos.x) + " " + String.format("%.2f",clientEntityPos.y) + " " + String.format("%.2f",clientEntityPos.z));
ImGui.text("Rotation: " + EntityUtils.getRotation(Globals.playerEntity));
ImGui.text("Rotation: " + EntityUtils.getRotation(Globals.clientState.playerEntity));
//physics on client
if(ImGui.collapsingHeader("Physics Data")){
@ -72,7 +72,7 @@ public class ImGuiPlayerEntity {
//
//quick launch entity details
if(ImGui.button("Client Details")){
ImGuiEntityMacros.showEntity(Globals.playerEntity);
ImGuiEntityMacros.showEntity(Globals.clientState.playerEntity);
}
ImGui.sameLine();
@ -90,7 +90,7 @@ public class ImGuiPlayerEntity {
ImGui.sameLine();
if(ImGui.button("Server Details")){
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.clientState.playerEntity.getId());
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
ImGuiEntityMacros.showEntity(serverPlayerEntity);
}
@ -107,14 +107,14 @@ public class ImGuiPlayerEntity {
*/
private static void drawPhysicsData(){
//client-side tree stuff
DBody body = PhysicsEntityUtils.getDBody(Globals.playerEntity);
ClientAttackTree attackTree = ClientAttackTree.getClientAttackTree(Globals.playerEntity);
DBody body = PhysicsEntityUtils.getDBody(Globals.clientState.playerEntity);
ClientAttackTree attackTree = ClientAttackTree.getClientAttackTree(Globals.clientState.playerEntity);
if(body != null){
ImGui.text("Velocity: " + body.getLinearVel());
ImGui.text("Force: " + body.getForce());
ImGui.text("Angular Velocity: " + body.getAngularVel());
ImGui.text("Torque: " + body.getTorque());
ImGui.text("Move Vector: " + CreatureUtils.getFacingVector(Globals.playerEntity));
ImGui.text("Move Vector: " + CreatureUtils.getFacingVector(Globals.clientState.playerEntity));
if(attackTree != null){
ImGui.text("Attack Tree State: " + attackTree.getState());
}
@ -126,7 +126,7 @@ public class ImGuiPlayerEntity {
*/
private static void drawSynchronizationData(){
//server pos
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.clientState.playerEntity.getId());
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
if(serverPlayerEntity != null){
ImGui.text("Position (Server): " + EntityUtils.getPosition(serverPlayerEntity));

View File

@ -45,7 +45,7 @@ public class ImGuiChunkMonitor {
}
if(ImGui.button("Break at chunk")){
if(Globals.clientState.foliageCellManager != null){
Vector3i absVoxelPos = Globals.clientState.clientWorldData.convertRealToAbsoluteVoxelSpace(EntityUtils.getPosition(Globals.playerEntity));
Vector3i absVoxelPos = Globals.clientState.clientWorldData.convertRealToAbsoluteVoxelSpace(EntityUtils.getPosition(Globals.clientState.playerEntity));
Globals.clientState.foliageCellManager.addBreakPoint(absVoxelPos);
}
}

View File

@ -190,7 +190,7 @@ public class ImGuiEntityMacros {
AttachUtils.hasChildren(detailViewEntity) ||
AttachUtils.getParent(detailViewEntity) != null ||
detailViewEntity == Globals.firstPersonEntity ||
detailViewEntity == Globals.playerEntity ||
detailViewEntity == Globals.clientState.playerEntity ||
Globals.clientState.clientSceneWrapper.clientToServerMapContainsId(detailViewEntity.getId())
) &&
ImGui.checkbox("Linked entities`", showLinkedEntitiesTab)
@ -367,11 +367,11 @@ public class ImGuiEntityMacros {
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(Globals.firstPersonEntity));
});
DebugVisualizerUtils.clientSpawnVectorVisualizer((Entity vector) -> {
EntityUtils.getPosition(vector).set(EntityUtils.getPosition(Globals.playerEntity));
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(Globals.playerEntity));
EntityUtils.getPosition(vector).set(EntityUtils.getPosition(Globals.clientState.playerEntity));
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(Globals.clientState.playerEntity));
});
DebugVisualizerUtils.clientSpawnVectorVisualizer((Entity vector) -> {
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.clientState.playerEntity.getId());
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
EntityUtils.getPosition(vector).set(EntityUtils.getPosition(serverPlayerEntity));
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(serverPlayerEntity));
@ -493,11 +493,11 @@ public class ImGuiEntityMacros {
protected static void drawLinkedEntities(){
if(showLinkedEntitiesTab && ImGui.collapsingHeader("Linked entities")){
ImGui.indent();
if(detailViewEntity == Globals.playerEntity && ImGui.button("View Model")){
if(detailViewEntity == Globals.clientState.playerEntity && ImGui.button("View Model")){
ImGuiEntityMacros.showEntity(Globals.firstPersonEntity);
}
if(detailViewEntity == Globals.firstPersonEntity && ImGui.button("3rd Person Model")){
ImGuiEntityMacros.showEntity(Globals.playerEntity);
ImGuiEntityMacros.showEntity(Globals.clientState.playerEntity);
}
if(AttachUtils.getParent(detailViewEntity) != null && ImGui.button("Parent")){
ImGuiEntityMacros.showEntity(AttachUtils.getParent(detailViewEntity));

View File

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

View File

@ -93,7 +93,7 @@ public class ImGuiAI {
}
if(ImGui.collapsingHeader("Debug Player AI")){
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.clientState.playerEntity.getId());
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
AI playerAi = AI.getAI(serverPlayerEntity);
Vector3d playerTargetPos = null;
@ -170,7 +170,7 @@ public class ImGuiAI {
if(ImGui.button("Spawn test macro character")){
Realm realm = Globals.realmManager.first();
GriddedDataCellManager griddedDataCellManager = (GriddedDataCellManager)realm.getDataCellManager();
Entity serverEnt = EntityLookupUtils.getServerEquivalent(Globals.playerEntity);
Entity serverEnt = EntityLookupUtils.getServerEquivalent(Globals.clientState.playerEntity);
Vector3d spawnPos = griddedDataCellManager.getMacroEntryPoint(new Vector3d(EntityUtils.getPosition(serverEnt)).add(50,0,0));
CharacterUtils.spawnCharacter(realm, spawnPos, CharacterUtils.DEFAULT_RACE);
}

View File

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

View File

@ -38,7 +38,7 @@ public class InventoryMainWindow {
* @param entity The entity
*/
public static void viewInventory(Entity entity){
if(entity == Globals.playerEntity){
if(entity == Globals.clientState.playerEntity){
if(Globals.elementService.getWindow(WindowStrings.WINDOW_CHARACTER) == null){
//create window
Window mainMenuWindow = InventoryMainWindow.createInventoryWindow(entity);
@ -113,7 +113,7 @@ public class InventoryMainWindow {
rVal.setMinHeight(MAX_HEIGHT);
String windowString;
if(entity == Globals.playerEntity){
if(entity == Globals.clientState.playerEntity){
windowString = WindowStrings.WINDOW_CHARACTER;
} else {
windowString = WindowStrings.WINDOW_INVENTORY_TARGET;

View File

@ -220,14 +220,14 @@ public class MenuGeneratorsInGame {
//disable drawing player character
Button toggleDrawPlayerButton = Button.createButton("Toggle draw character", new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
// Main.running = false;
if(Globals.playerEntity != null){
if(Globals.playerEntity.containsKey(EntityDataStrings.DATA_STRING_DRAW)){
boolean draw = (boolean)Globals.playerEntity.getData(EntityDataStrings.DATA_STRING_DRAW);
Globals.playerEntity.putData(EntityDataStrings.DATA_STRING_DRAW, !draw);
if(Globals.clientState.playerEntity != null){
if(Globals.clientState.playerEntity.containsKey(EntityDataStrings.DATA_STRING_DRAW)){
boolean draw = (boolean)Globals.clientState.playerEntity.getData(EntityDataStrings.DATA_STRING_DRAW);
Globals.clientState.playerEntity.putData(EntityDataStrings.DATA_STRING_DRAW, !draw);
}
// if(Globals.playerEntity.containsKey(EntityDataStrings.DRAW_CAST_SHADOW)){
// boolean drawShadow = (boolean)Globals.playerEntity.getData(EntityDataStrings.DRAW_CAST_SHADOW);
// Globals.playerEntity.putData(EntityDataStrings.DRAW_CAST_SHADOW, !drawShadow);
// if(Globals.clientState.playerEntity.containsKey(EntityDataStrings.DRAW_CAST_SHADOW)){
// boolean drawShadow = (boolean)Globals.clientState.playerEntity.getData(EntityDataStrings.DRAW_CAST_SHADOW);
// Globals.clientState.playerEntity.putData(EntityDataStrings.DRAW_CAST_SHADOW, !drawShadow);
// }
}
return false;
@ -349,7 +349,7 @@ public class MenuGeneratorsInGame {
return false;
}});
Entity playerEntity = Globals.playerEntity;
Entity playerEntity = Globals.clientState.playerEntity;
Actor playerActor = EntityUtils.getActor(playerEntity);
ActorStaticMorph staticMorph = playerActor.getStaticMorph();
CreatureData playeCreatureType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(CreatureUtils.getType(playerEntity));

View File

@ -25,7 +25,7 @@ public class MenuGeneratorsInventory {
LoggerInterface.loggerUI.INFO("World item drop capture window received drag release");
if(Globals.draggedItem != null){
//drop item
ClientInventoryState.clientAttemptEjectItem(Globals.playerEntity,Globals.draggedItem);
ClientInventoryState.clientAttemptEjectItem(Globals.clientState.playerEntity,Globals.draggedItem);
//play sound effect
if(Globals.virtualAudioSourceManager != null){
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(Globals.draggedItem));
@ -38,7 +38,7 @@ public class MenuGeneratorsInventory {
//clear ui
WindowUtils.cleanItemDraggingWindow();
//re-render inventory
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.playerEntity));
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.clientState.playerEntity));
//null globals
Globals.dragSourceInventory = null;
Globals.draggedItem = null;

View File

@ -42,7 +42,7 @@ public class ToolbarPreviewWindow {
rVal.setJustifyContent(YogaJustification.End);
//attach scrollable after search input for organzation purposes
rVal.addChild(ToolbarInventoryPanel.createToolbarInventoryPanel(Globals.playerEntity, false));
rVal.addChild(ToolbarInventoryPanel.createToolbarInventoryPanel(Globals.clientState.playerEntity, false));
Globals.signalSystem.post(SignalType.YOGA_APPLY,rVal);

View File

@ -74,17 +74,17 @@ void RayCallback(void *Data, dGeomID Geometry1, dGeomID Geometry2) {
Collidable collidable2 = rayCastData.bodyEntityMap.get(b2);
//don't self cast -- should work on both server and client
if(collidable1 != null && collidable1.getParent() == Globals.playerEntity){
if(collidable1 != null && collidable1.getParent() == Globals.clientState.playerEntity){
return;
}
if(collidable2 != null && collidable2.getParent() == Globals.playerEntity){
if(collidable2 != null && collidable2.getParent() == Globals.clientState.playerEntity){
return;
}
//don't collide with entities that are attached to the parent either
if(collidable1 != null && AttachUtils.getParent(collidable1.getParent()) != null && AttachUtils.getParent(collidable1.getParent()) == Globals.playerEntity){
if(collidable1 != null && AttachUtils.getParent(collidable1.getParent()) != null && AttachUtils.getParent(collidable1.getParent()) == Globals.clientState.playerEntity){
return;
}
if(collidable2 != null && AttachUtils.getParent(collidable2.getParent()) != null && AttachUtils.getParent(collidable2.getParent()) == Globals.playerEntity){
if(collidable2 != null && AttachUtils.getParent(collidable2.getParent()) != null && AttachUtils.getParent(collidable2.getParent()) == Globals.clientState.playerEntity){
return;
}

View File

@ -111,7 +111,7 @@ public class CameraHandler {
if(Crosshair.getCrosshairActive()){
Vector3d characterPos = EntityUtils.getPosition(Globals.playerEntity);
Vector3d characterPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
Vector3d targetPos = Crosshair.getTargetPosition();
Vector3d diffed = new Vector3d(targetPos).sub(characterPos).mul(-1).normalize();
cameraRotationVector.set((float)diffed.x, 0.5f, (float)diffed.z).normalize();
@ -132,8 +132,8 @@ public class CameraHandler {
cameraRotationVector = yawQuat.transform(cameraRotationVector);
cameraRotationVector.normalize();
}
if(trackPlayerEntity && Globals.playerEntity != null){
Vector3d entityPos = EntityUtils.getPosition(Globals.playerEntity);
if(trackPlayerEntity && Globals.clientState.playerEntity != null){
Vector3d entityPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
CameraEntityUtils.setCameraCenter(Globals.playerCamera, new Vector3d(entityPos).add(CameraEntityUtils.getOrbitalCameraRadialOffset(Globals.playerCamera)));
}
//update view matrix offset
@ -150,10 +150,10 @@ public class CameraHandler {
if(Globals.controlHandler.cameraIsThirdPerson()){
perspectiveVal = CameraHandler.CAMERA_PERSPECTIVE_THIRD;
}
if(Globals.cameraHandler.getTrackPlayerEntity() && Globals.playerEntity != null){
if(Globals.cameraHandler.getTrackPlayerEntity() && Globals.clientState.playerEntity != null){
Globals.clientState.clientConnection.queueOutgoingMessage(
EntityMessage.constructupdateEntityViewDirMessage(
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.clientState.playerEntity.getId()),
Globals.timekeeper.getNumberOfSimFramesElapsed(),
perspectiveVal,
yaw,

View File

@ -561,9 +561,9 @@ public class ControlHandler {
*/
public void setIsThirdPerson(boolean isThirdPerson){
this.cameraIsThirdPerson = isThirdPerson;
if(Globals.playerEntity != null){
if(Globals.clientState.playerEntity != null){
CameraEntityUtils.initCamera();
ClientEquipState playerEquipState = ClientEquipState.getClientEquipState(Globals.playerEntity);
ClientEquipState playerEquipState = ClientEquipState.getClientEquipState(Globals.clientState.playerEntity);
if(playerEquipState != null){
playerEquipState.evaluatePlayerAttachments();
}

View File

@ -127,57 +127,57 @@ public class ControlCategoryMainGame {
*/
mainGameControlList.add(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD));
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
groundTree.start(MovementRelativeFacing.FORWARD_LEFT);
} else if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).isState()){
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
groundTree.start(MovementRelativeFacing.FORWARD_RIGHT);
} else {
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
groundTree.start(MovementRelativeFacing.FORWARD);
}
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
}
}
}});
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
groundTree.start(MovementRelativeFacing.FORWARD_LEFT);
} else if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).isState()){
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
groundTree.start(MovementRelativeFacing.FORWARD_RIGHT);
} else {
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
groundTree.start(MovementRelativeFacing.FORWARD);
}
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
}
}
}});
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
groundTree.slowdown();
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
clientEditorMovementTree.slowdown();
}
}
@ -187,59 +187,59 @@ public class ControlCategoryMainGame {
*/
mainGameControlList.add(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD));
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(3.0/4.0*Math.PI).normalize());
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(3.0/4.0*Math.PI).normalize());
groundTree.start(MovementRelativeFacing.BACKWARD_LEFT);
} else if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).isState()){
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(5.0/4.0*Math.PI).normalize());
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(5.0/4.0*Math.PI).normalize());
groundTree.start(MovementRelativeFacing.BACKWARD_RIGHT);
} else {
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
groundTree.start(MovementRelativeFacing.BACKWARD);
}
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.BACKWARD);
}
}
}});
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(3.0/4.0*Math.PI).normalize());
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(3.0/4.0*Math.PI).normalize());
groundTree.start(MovementRelativeFacing.BACKWARD_LEFT);
} else if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).isState()){
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(5.0/4.0*Math.PI).normalize());
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(5.0/4.0*Math.PI).normalize());
groundTree.start(MovementRelativeFacing.BACKWARD_RIGHT);
} else {
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
groundTree.start(MovementRelativeFacing.BACKWARD);
}
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.BACKWARD);
}
}
}});
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
groundTree.slowdown();
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
clientEditorMovementTree.slowdown();
}
}
@ -249,8 +249,8 @@ public class ControlCategoryMainGame {
*/
mainGameControlList.add(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT));
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
@ -258,20 +258,20 @@ public class ControlCategoryMainGame {
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
){
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(Math.PI/2.0).normalize());
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(Math.PI/2.0).normalize());
groundTree.start(MovementRelativeFacing.FORWARD);
}
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(Math.PI/2.0).normalize());
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(Math.PI/2.0).normalize());
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
}
}
}});
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
@ -279,25 +279,25 @@ public class ControlCategoryMainGame {
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
){
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(Math.PI/2.0).normalize());
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(Math.PI/2.0).normalize());
groundTree.start(MovementRelativeFacing.FORWARD);
}
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(Math.PI/2.0).normalize());
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(Math.PI/2.0).normalize());
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
}
}
}});
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
groundTree.slowdown();
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
clientEditorMovementTree.slowdown();
}
}
@ -307,8 +307,8 @@ public class ControlCategoryMainGame {
*/
mainGameControlList.add(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT));
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
@ -316,20 +316,20 @@ public class ControlCategoryMainGame {
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
){
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(-Math.PI/2.0).normalize());
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(-Math.PI/2.0).normalize());
groundTree.start(MovementRelativeFacing.FORWARD);
}
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(-Math.PI/2.0).normalize());
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(-Math.PI/2.0).normalize());
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
}
}
}});
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
@ -337,25 +337,25 @@ public class ControlCategoryMainGame {
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).getKeyValue()))
){
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(-Math.PI/2.0).normalize());
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(-Math.PI/2.0).normalize());
groundTree.start(MovementRelativeFacing.FORWARD);
}
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
CreatureUtils.setFacingVector(Globals.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(-Math.PI/2.0).normalize());
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).rotateY(-Math.PI/2.0).normalize());
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
}
}
}});
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
groundTree.slowdown();
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
clientEditorMovementTree.slowdown();
}
}
@ -374,11 +374,11 @@ public class ControlCategoryMainGame {
*/
mainGameControlList.add(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT));
controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
if(
(groundTree.getState()==MovementTreeState.IDLE || groundTree.getState()==MovementTreeState.SLOWDOWN) &&
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
@ -386,19 +386,19 @@ public class ControlCategoryMainGame {
){
groundTree.start(MovementRelativeFacing.LEFT);
}
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.LEFT);
}
}
}});
controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
if(
(groundTree.getState()==MovementTreeState.IDLE || groundTree.getState()==MovementTreeState.SLOWDOWN) &&
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
@ -406,21 +406,21 @@ public class ControlCategoryMainGame {
){
groundTree.start(MovementRelativeFacing.LEFT);
}
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.LEFT);
}
}
}});
controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
groundTree.slowdown();
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
clientEditorMovementTree.slowdown();
}
}
@ -430,11 +430,11 @@ public class ControlCategoryMainGame {
*/
mainGameControlList.add(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT));
controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
if(
(groundTree.getState()==MovementTreeState.IDLE || groundTree.getState()==MovementTreeState.SLOWDOWN) &&
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
@ -442,19 +442,19 @@ public class ControlCategoryMainGame {
){
groundTree.start(MovementRelativeFacing.RIGHT);
}
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.RIGHT);
}
}
}});
controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
if(
(groundTree.getState()==MovementTreeState.IDLE || groundTree.getState()==MovementTreeState.SLOWDOWN) &&
(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).isIsKey() && !Globals.controlCallback.getKey(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).getKeyValue())) &&
@ -462,21 +462,21 @@ public class ControlCategoryMainGame {
){
groundTree.start(MovementRelativeFacing.RIGHT);
}
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.RIGHT);
}
}
}});
controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
if(movementTree instanceof ClientGroundMovementTree){
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
groundTree.slowdown();
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
clientEditorMovementTree.slowdown();
}
}
@ -487,20 +487,20 @@ public class ControlCategoryMainGame {
*/
mainGameControlList.add(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_JUMP));
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_JUMP).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
ClientJumpTree jumpTree = ClientJumpTree.getClientJumpTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
ClientJumpTree jumpTree = ClientJumpTree.getClientJumpTree(Globals.clientState.playerEntity);
if(jumpTree != null){
jumpTree.start();
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.UP);
}
}
}});
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_JUMP).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
clientEditorMovementTree.slowdown();
}
}
@ -510,9 +510,9 @@ public class ControlCategoryMainGame {
*/
mainGameControlList.add(controlMap.get(INPUT_CODE_SINK));
controlMap.get(INPUT_CODE_SINK).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
if(ClientToolbarState.hasClientToolbarState(Globals.playerEntity)){
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
if(ClientToolbarState.hasClientToolbarState(Globals.clientState.playerEntity)){
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.clientState.playerEntity);
if(clientToolbarState.getCurrentPrimaryItem() != null){
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(clientToolbarState.getCurrentPrimaryItem());
if(Globals.playerCursor != null && Globals.playerBlockCursor != null){
@ -522,16 +522,16 @@ public class ControlCategoryMainGame {
}
}
}
if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.DOWN);
}
}
}});
controlMap.get(INPUT_CODE_SINK).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
clientEditorMovementTree.slowdown();
}
}
@ -541,16 +541,16 @@ public class ControlCategoryMainGame {
*/
mainGameControlList.add(controlMap.get(INPUT_CODE_SPRINT));
controlMap.get(INPUT_CODE_SPRINT).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
ClientSprintTree sprintTree = ClientSprintTree.getClientSprintTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
ClientSprintTree sprintTree = ClientSprintTree.getClientSprintTree(Globals.clientState.playerEntity);
if(sprintTree != null){
sprintTree.start();
}
}
}});
controlMap.get(INPUT_CODE_SPRINT).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
ClientSprintTree sprintTree = ClientSprintTree.getClientSprintTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
ClientSprintTree sprintTree = ClientSprintTree.getClientSprintTree(Globals.clientState.playerEntity);
if(sprintTree != null){
sprintTree.interrupt();
}
@ -562,14 +562,14 @@ public class ControlCategoryMainGame {
*/
mainGameControlList.add(controlMap.get(INPUT_CODE_WALK));
controlMap.get(INPUT_CODE_WALK).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null && ClientWalkTree.getClientWalkTree(Globals.playerEntity) != null){
ClientWalkTree clientWalkTree = ClientWalkTree.getClientWalkTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null && ClientWalkTree.getClientWalkTree(Globals.clientState.playerEntity) != null){
ClientWalkTree clientWalkTree = ClientWalkTree.getClientWalkTree(Globals.clientState.playerEntity);
clientWalkTree.start();
}
}});
controlMap.get(INPUT_CODE_WALK).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null && ClientWalkTree.getClientWalkTree(Globals.playerEntity) != null){
ClientWalkTree clientWalkTree = ClientWalkTree.getClientWalkTree(Globals.playerEntity);
if(Globals.clientState.playerEntity != null && ClientWalkTree.getClientWalkTree(Globals.clientState.playerEntity) != null){
ClientWalkTree clientWalkTree = ClientWalkTree.getClientWalkTree(Globals.clientState.playerEntity);
clientWalkTree.interrupt();
}
}});
@ -635,8 +635,8 @@ public class ControlCategoryMainGame {
if(!handled){
if(Globals.playerEntity != null && ClientToolbarState.getClientToolbarState(Globals.playerEntity) != null){
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
if(Globals.clientState.playerEntity != null && ClientToolbarState.getClientToolbarState(Globals.clientState.playerEntity) != null){
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.clientState.playerEntity);
if(scrollEvent.getScrollAmount() > 0){
clientToolbarState.attemptChangeSelection(clientToolbarState.getSelectedSlot() - 1);
} else {
@ -659,12 +659,12 @@ public class ControlCategoryMainGame {
*/
mainGameControlList.add(controlMap.get(INPUT_CODE_DROP));
controlMap.get(INPUT_CODE_DROP).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
if(Globals.playerEntity != null){
if(ClientEquipState.hasEquipState(Globals.playerEntity)){
UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
if(ClientEquipState.hasEquipState(Globals.clientState.playerEntity)){
UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.clientState.playerEntity);
if(inventory.getItems().size() > 0){
Entity itemToDrop = inventory.getItems().get(0);
ClientInventoryState.clientAttemptEjectItem(Globals.playerEntity,itemToDrop);
ClientInventoryState.clientAttemptEjectItem(Globals.clientState.playerEntity,itemToDrop);
}
}
}
@ -716,7 +716,7 @@ public class ControlCategoryMainGame {
mainGameControlList.add(controlMap.get(INPUT_CODE_INVENTORY_OPEN));
inventoryControlList.add(controlMap.get(INPUT_CODE_INVENTORY_OPEN));
controlMap.get(INPUT_CODE_INVENTORY_OPEN).setOnClick(new ControlMethod(){public void execute(MouseState mouseState){
InventoryMainWindow.viewInventory(Globals.playerEntity);
InventoryMainWindow.viewInventory(Globals.clientState.playerEntity);
}});
controlMap.get(INPUT_CODE_INVENTORY_OPEN).setRepeatTimeout(0.5f * Main.targetFrameRate);

View File

@ -527,8 +527,8 @@ public class CursorState {
*/
public void hintClampToExistingBlock(){
Globals.cursorState.setClampToExistingBlock(true);
if(Globals.playerEntity != null && ClientToolbarState.hasClientToolbarState(Globals.playerEntity)){
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
if(Globals.clientState.playerEntity != null && ClientToolbarState.hasClientToolbarState(Globals.clientState.playerEntity)){
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.clientState.playerEntity);
if(clientToolbarState.getCurrentPrimaryItem() != null){
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(clientToolbarState.getCurrentPrimaryItem());
if(Globals.playerCursor != null && Globals.playerBlockCursor != null){
@ -545,8 +545,8 @@ public class CursorState {
*/
public void hintClearBlockCursor(){
Globals.cursorState.setClampToExistingBlock(false);
if(Globals.playerEntity != null && ClientToolbarState.hasClientToolbarState(Globals.playerEntity)){
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
if(Globals.clientState.playerEntity != null && ClientToolbarState.hasClientToolbarState(Globals.clientState.playerEntity)){
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.clientState.playerEntity);
boolean clearBlockCursor = true;
if(clientToolbarState.getCurrentPrimaryItem() != null){
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(clientToolbarState.getCurrentPrimaryItem());

View File

@ -358,8 +358,6 @@ public class Globals {
public static Entity playerBlockCursor;
public static Entity playerAreaCursor;
//the creature the player camera will orbit and will receive controlHandler movementTree updates
public static Entity playerEntity;
//the entity for the first person modal (view model)
public static Entity firstPersonEntity;
@ -660,7 +658,6 @@ public class Globals {
* Unloads scene
*/
public static void unloadScene(){
Globals.playerEntity = null;
Globals.playerCamera = null;
Globals.firstPersonEntity = null;
Globals.playerManager = new PlayerManager();

View File

@ -278,7 +278,7 @@ public class ClientLoading {
EntityUtils.getRotation(skybox).rotateX((float)(-Math.PI/2.0f));
EntityUtils.getScale(skybox).mul(600000.0f);
Globals.clientState.clientScene.registerBehaviorTree(() -> {
EntityUtils.getPosition(skybox).set(EntityUtils.getPosition(Globals.playerEntity));
EntityUtils.getPosition(skybox).set(EntityUtils.getPosition(Globals.clientState.playerEntity));
});
Globals.assetManager.queueOverrideMeshShader("Models/environment/skyboxSphere.fbx", "Sphere", "Shaders/entities/skysphere/skysphere.vs", "Shaders/entities/skysphere/skysphere.fs");

View File

@ -50,7 +50,7 @@ public class MainMenuLoading {
* Resets the client state
*/
private static void resetClientState(){
Globals.playerEntity = null;
Globals.clientState.playerEntity = null;
Globals.clientState.clientSimulation = null;
Globals.clientState.clientConnection.setShouldDisconnect(true);
Globals.renderingEngine.getPostProcessingPipeline().setApplyBlur(false);

View File

@ -83,7 +83,7 @@ public class ClientEntityUtils {
}
HitboxCollectionState.destroyHitboxState(entity,false);
ClientInteractionEngine.destroyCollidableTemplate(entity);
if(entity == Globals.playerEntity && Globals.firstPersonEntity != null){
if(entity == Globals.clientState.playerEntity && Globals.firstPersonEntity != null){
ClientEntityUtils.destroyEntity(Globals.firstPersonEntity);
}
}

View File

@ -151,7 +151,7 @@ public class StateTransitionUtil {
//
//play audio
if(parent == Globals.playerEntity && !Globals.controlHandler.cameraIsThirdPerson() && animation != null){
if(parent == Globals.clientState.playerEntity && !Globals.controlHandler.cameraIsThirdPerson() && animation != null){
//first person
//play first person audio
if(Globals.audioEngine.initialized() && audioData != null && audioData.getAudioPath() != null){

View File

@ -622,7 +622,7 @@ public class AttachUtils {
getChildrenList(parent).remove(toAttach);
}
//special case handling for view model
if(parent == Globals.playerEntity && getChildrenList(Globals.firstPersonEntity) != null){
if(parent == Globals.clientState.playerEntity && getChildrenList(Globals.firstPersonEntity) != null){
getChildrenList(Globals.firstPersonEntity).remove(toAttach);
}
return bone;

View File

@ -565,7 +565,7 @@ public class ClientAttackTree implements BehaviorTree {
if(this.currentMove != null && this.currentMove.getHitstun() != null){
String animName = this.currentMove.getAttackState().getAnimation().getNameThirdPerson();
actor.setFreezeFrames(animName, this.currentMove.getHitstun());
if(parent == Globals.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
if(parent == Globals.clientState.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
Actor viewmodelActor = EntityUtils.getActor(Globals.firstPersonEntity);
animName = this.currentMove.getAttackState().getAnimation().getNameFirstPerson();
viewmodelActor.setFreezeFrames(animName, this.currentMove.getHitstun());

View File

@ -164,7 +164,7 @@ public class FirstPersonTree implements BehaviorTree {
* @param priority The priority of the animation
*/
public static void conditionallyPlayAnimation(Entity entity, String animationName, int priority, double offset){
if(entity != null && entity == Globals.playerEntity && Globals.firstPersonEntity != null && FirstPersonTree.hasTree(Globals.firstPersonEntity)){
if(entity != null && entity == Globals.clientState.playerEntity && Globals.firstPersonEntity != null && FirstPersonTree.hasTree(Globals.firstPersonEntity)){
FirstPersonTree.getTree(Globals.firstPersonEntity).playAnimation(animationName, priority);
}
}
@ -185,7 +185,7 @@ public class FirstPersonTree implements BehaviorTree {
* @param animationName the name of the animation
*/
public static void conditionallyPlayAnimation(Entity entity, TreeDataAnimation animation){
if(entity != null && entity == Globals.playerEntity && Globals.firstPersonEntity != null && FirstPersonTree.hasTree(Globals.firstPersonEntity)){
if(entity != null && entity == Globals.clientState.playerEntity && Globals.firstPersonEntity != null && FirstPersonTree.hasTree(Globals.firstPersonEntity)){
FirstPersonTree.getTree(Globals.firstPersonEntity).playAnimation(animation);
}
}
@ -197,7 +197,7 @@ public class FirstPersonTree implements BehaviorTree {
* @param offset The offset to start the animation at
*/
public static void conditionallyPlayAnimation(Entity entity, TreeDataAnimation animation, double offset){
if(entity != null && entity == Globals.playerEntity && FirstPersonTree.hasTree(Globals.firstPersonEntity)){
if(entity != null && entity == Globals.clientState.playerEntity && FirstPersonTree.hasTree(Globals.firstPersonEntity)){
FirstPersonTree.getTree(Globals.firstPersonEntity).playAnimation(animation,offset);
}
}
@ -208,7 +208,7 @@ public class FirstPersonTree implements BehaviorTree {
* @param animation The animation
*/
public static void conditionallyInterruptAnimation(Entity entity, TreeDataAnimation animation){
if(entity != null && entity == Globals.playerEntity && FirstPersonTree.hasTree(Globals.firstPersonEntity)){
if(entity != null && entity == Globals.clientState.playerEntity && FirstPersonTree.hasTree(Globals.firstPersonEntity)){
FirstPersonTree.getTree(Globals.firstPersonEntity).interruptAnimation(animation);
}
}

View File

@ -402,24 +402,24 @@ public class ClientEquipState implements BehaviorTree {
* This should be used when we change the camera of the player (IE from first to third person or vice versa)
*/
public void evaluatePlayerAttachments(){
if(this.parent != Globals.playerEntity){
if(this.parent != Globals.clientState.playerEntity){
LoggerInterface.loggerEngine.ERROR(new IllegalStateException("Re-evaluating client attachments on non-player entity! This should only be called for the player's entity!"));
}
if(Globals.controlHandler.cameraIsThirdPerson()){
for(String occupiedPoint : this.getEquippedPoints()){
EquipPoint point = this.getEquipPoint(occupiedPoint);
Entity toEquip = this.equipMap.get(point.getEquipPointId());
if(AttachUtils.getParent(toEquip) != Globals.playerEntity){
if(AttachUtils.getParent(toEquip) != Globals.clientState.playerEntity){
AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.firstPersonEntity, toEquip);
AttachUtils.clientAttachEntityToEntityAtBone(
Globals.playerEntity,
Globals.clientState.playerEntity,
toEquip,
point.getBone(),
AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorThirdPerson()),
AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())
);
} else {
AttachUtils.clientUpdateEntityTransforms(toEquip, Globals.playerEntity);
AttachUtils.clientUpdateEntityTransforms(toEquip, Globals.clientState.playerEntity);
}
}
} else {
@ -427,7 +427,7 @@ public class ClientEquipState implements BehaviorTree {
EquipPoint point = this.getEquipPoint(occupiedPoint);
Entity toEquip = this.equipMap.get(point.getEquipPointId());
if(AttachUtils.getParent(toEquip) != Globals.firstPersonEntity){
AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.playerEntity, toEquip);
AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.clientState.playerEntity, toEquip);
AttachUtils.clientAttachEntityToEntityAtBone(
Globals.firstPersonEntity,
toEquip,

View File

@ -183,7 +183,7 @@ public class ClientToolbarState implements BehaviorTree {
}
//cursor logic
if(targetPoint != null && parent == Globals.playerEntity){
if(targetPoint != null && parent == Globals.clientState.playerEntity){
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(toEquip);
if(Globals.playerCursor != null && Globals.playerBlockCursor != null){
CursorState.hide();
@ -396,7 +396,7 @@ public class ClientToolbarState implements BehaviorTree {
public void simulate(float deltaTime) {
if(this.previousFrameSlot != this.selectedSlot){
this.previousFrameSlot = this.selectedSlot;
if(this.parent == Globals.playerEntity){
if(this.parent == Globals.clientState.playerEntity){
ToolbarPreviewWindow.reveal();
}
}

View File

@ -323,8 +323,8 @@ public class HitboxCollectionState {
if(!this.geoms.isEmpty()){
Vector3d entityPosition = EntityUtils.getPosition(parent);
double distanceToPlayer = 0;
if(Globals.playerEntity != null){
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
if(Globals.clientState.playerEntity != null){
Vector3d playerPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
distanceToPlayer = entityPosition.distance(playerPos);
}
if(distanceToPlayer > CLIENT_DISABLE_DISTANCE){

View File

@ -305,7 +305,7 @@ 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.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.clientState.playerEntity.getId()),
Globals.clientState.clientSceneWrapper.mapClientToServerId(item.getId()),
ItemUtils.getType(item)
);

View File

@ -139,7 +139,7 @@ public class ClientEditorMovementTree implements BehaviorTree {
Vector3d position = EntityUtils.getPosition(parent);
Quaterniond rotation = EntityUtils.getRotation(parent);
float velocity = CreatureUtils.getVelocity(parent);
if(this.parent == Globals.playerEntity){
if(this.parent == Globals.clientState.playerEntity){
Globals.clientState.clientConnection.queueOutgoingMessage(
EntityMessage.constructmoveUpdateMessage(
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
@ -169,7 +169,7 @@ public class ClientEditorMovementTree implements BehaviorTree {
Vector3d position = EntityUtils.getPosition(parent);
Quaterniond rotation = EntityUtils.getRotation(parent);
float velocity = CreatureUtils.getVelocity(parent);
if(this.parent == Globals.playerEntity){
if(this.parent == Globals.clientState.playerEntity){
Globals.clientState.clientConnection.queueOutgoingMessage(
EntityMessage.constructmoveUpdateMessage(
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),

View File

@ -139,7 +139,7 @@ public class ClientFallTree implements BehaviorTree {
}
FirstPersonTree.conditionallyPlayAnimation(parent, fallMovementSystem.getLandState().getAnimation());
}
if(parent == Globals.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
if(parent == Globals.clientState.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
//first person
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.LAND, EntityUtils.getPosition(parent));
//play first person audio

View File

@ -147,7 +147,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
Vector3d position = EntityUtils.getPosition(parent);
Quaterniond rotation = EntityUtils.getRotation(parent);
float velocity = CreatureUtils.getVelocity(parent);
if(this.parent == Globals.playerEntity){
if(this.parent == Globals.clientState.playerEntity){
Globals.clientState.clientConnection.queueOutgoingMessage(
EntityMessage.constructmoveUpdateMessage(
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
@ -177,7 +177,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
Vector3d position = EntityUtils.getPosition(parent);
Quaterniond rotation = EntityUtils.getRotation(parent);
float velocity = CreatureUtils.getVelocity(parent);
if(this.parent == Globals.playerEntity){
if(this.parent == Globals.clientState.playerEntity){
Globals.clientState.clientConnection.queueOutgoingMessage(
EntityMessage.constructmoveUpdateMessage(
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
@ -542,7 +542,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
animationTime > firstOffset
){
this.playedFootstepFirst = true;
if(parent == Globals.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
if(parent == Globals.clientState.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.STEP_BARE_REG, position);
} else {
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.STEP_BARE_REG, position);
@ -555,7 +555,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
animationTime > secondOffset
){
this.playedFootstepSecond = true;
if(parent == Globals.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
if(parent == Globals.clientState.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.STEP_BARE_REG, position);
} else {
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.STEP_BARE_REG, position);

View File

@ -322,7 +322,7 @@ public class ClientJumpTree implements BehaviorTree {
case INACTIVE: {
} break;
case ACTIVE: {
if(parent == Globals.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
if(parent == Globals.clientState.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.JUMP, EntityUtils.getPosition(parent));
} else {
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.JUMP, EntityUtils.getPosition(parent));

View File

@ -61,7 +61,7 @@ public class ClientPhysicsSyncTree implements BehaviorTree {
//
//bust distance caches if this is the player's entity and we've traveled a long distance suddenly
if(parent == Globals.playerEntity){
if(parent == Globals.clientState.playerEntity){
if(position.distance(EntityUtils.getPosition(parent)) > FoliageCellManager.TELEPORT_DISTANCE){
Globals.clientState.clientDrawCellManager.bustDistanceCache();
Globals.clientState.foliageCellManager.bustDistanceCache();

View File

@ -77,7 +77,7 @@ public class RotatorTree implements BehaviorTree{
// Vector3f rotationAxis = new Vector3f((float)facingVector.x,(float)facingVector.y,(float)facingVector.z).rotateY((float)Math.PI/2.0f).normalize();
Vector3f rotationAxis = new Vector3f(1,0,0);
float rotationRaw = 0.0f;
if(parent == Globals.playerEntity){
if(parent == Globals.clientState.playerEntity){
rotationRaw = Globals.cameraHandler.getPitch();
} else {
rotationRaw = ViewUtils.getPitch(parent);

View File

@ -77,7 +77,7 @@ public class ServerRotatorTree implements BehaviorTree{
// Vector3f rotationAxis = new Vector3f((float)facingVector.x,(float)facingVector.y,(float)facingVector.z).rotateY((float)Math.PI/2.0f).normalize();
Vector3f rotationAxis = new Vector3f(1,0,0);
float rotationRaw = 0.0f;
if(parent == Globals.playerEntity){
if(parent == Globals.clientState.playerEntity){
rotationRaw = Globals.cameraHandler.getPitch();
} else {
rotationRaw = ViewUtils.getPitch(parent);

View File

@ -190,7 +190,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
if(Globals.clientState.clientPlayer != null && message.getpropertyValue() == Globals.clientState.clientPlayer.getId()){
LoggerInterface.loggerNetworking.DEBUG("Set this player's entity id!");
Globals.clientCharacterID = message.getentityID();
Globals.playerEntity = target;
Globals.clientState.playerEntity = target;
if(viewModelData != null && viewModelData.getFirstPersonModelPath() != null){
Globals.firstPersonEntity = CreatureUtils.clientCreateViewModel(
creatureTypeRaw,

View File

@ -21,63 +21,63 @@ public class InventoryProtocol implements ClientProtocolTemplate<InventoryMessag
switch(message.getMessageSubtype()){
case ADDITEMTOINVENTORY:
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] ADD ITEM TO INVENTORY " + message.getentityId());
if(Globals.playerEntity != null){
if(Globals.clientState.playerEntity != null){
ClientInventoryState inventoryState;
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.playerEntity))!=null){
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.clientState.playerEntity))!=null){
inventoryState.addNetworkMessage(message);
}
}
break;
case SERVERCOMMANDEQUIPITEM: {
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] EQUIP ITEM " + message.getentityId());
if(Globals.playerEntity != null){
if(Globals.clientState.playerEntity != null){
ClientInventoryState inventoryState;
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.playerEntity))!=null){
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.clientState.playerEntity))!=null){
inventoryState.addNetworkMessage(message);
}
}
} break;
case REMOVEITEMFROMINVENTORY:
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] REMOVE ITEM FROM INVENTORY " + message.getentityId());
if(Globals.playerEntity != null){
if(Globals.clientState.playerEntity != null){
ClientInventoryState inventoryState;
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.playerEntity))!=null){
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.clientState.playerEntity))!=null){
inventoryState.addNetworkMessage(message);
}
}
break;
case SERVERCOMMANDMOVEITEMCONTAINER:
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] MOVE ITEM INVENTORY " + message.getentityId());
if(Globals.playerEntity != null){
if(Globals.clientState.playerEntity != null){
ClientInventoryState inventoryState;
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.playerEntity))!=null){
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.clientState.playerEntity))!=null){
inventoryState.addNetworkMessage(message);
}
}
break;
case SERVERCOMMANDUNEQUIPITEM: {
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] UNEQUIP ITEM " + message.getentityId());
if(Globals.playerEntity != null){
if(Globals.clientState.playerEntity != null){
ClientInventoryState inventoryState;
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.playerEntity))!=null){
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.clientState.playerEntity))!=null){
inventoryState.addNetworkMessage(message);
}
}
} break;
case SERVERUPDATEITEMCHARGES: {
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] SET CHARGES OF " + message.getentityId());
if(Globals.playerEntity != null){
if(Globals.clientState.playerEntity != null){
ClientInventoryState inventoryState;
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.playerEntity))!=null){
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.clientState.playerEntity))!=null){
inventoryState.addNetworkMessage(message);
}
}
} break;
case SERVERCOMMANDSTOREITEM: {
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] STORE " + message.getitemEntId());
if(Globals.playerEntity != null){
if(Globals.clientState.playerEntity != null){
ClientInventoryState inventoryState;
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.playerEntity))!=null){
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.clientState.playerEntity))!=null){
inventoryState.addNetworkMessage(message);
}
}

View File

@ -99,13 +99,13 @@ public class FirstPersonItemsPipeline implements RenderPipeline {
Matrix4d rotationMat = CameraEntityUtils.getRotationMat(Globals.playerCamera);
EntityUtils.getRotation(Globals.firstPersonEntity).set(CameraEntityUtils.getRotationQuat(Globals.playerCamera));
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
Vector3d playerPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
Vector4d behindCameraOffsetRaw = rotationMat.transform(new Vector4d(0,tree.getCameraViewDirOffsetY(),tree.getCameraViewDirOffsetZ(),1)); //pushes the model behind the camera
Vector3d behindCameraOffset = new Vector3d(behindCameraOffsetRaw.x,behindCameraOffsetRaw.y,behindCameraOffsetRaw.z);
EntityUtils.getPosition(Globals.firstPersonEntity).set(playerPos).add(0.0f,tree.getHeightFromOrigin(),0.0f).add(behindCameraOffset);
if(ClientEquipState.hasEquipState(Globals.playerEntity)){
ClientEquipState clientEquipState = ClientEquipState.getClientEquipState(Globals.playerEntity);
if(ClientEquipState.hasEquipState(Globals.clientState.playerEntity)){
ClientEquipState clientEquipState = ClientEquipState.getClientEquipState(Globals.clientState.playerEntity);
clientEquipState.evaluatePlayerAttachments();
}
}

View File

@ -276,13 +276,13 @@ public class MainContentPipeline implements RenderPipeline {
//don't draw third person view if camera is first person
(
entity == Globals.playerEntity &&
entity == Globals.clientState.playerEntity &&
!Globals.controlHandler.cameraIsThirdPerson()
) ||
(
!Globals.controlHandler.cameraIsThirdPerson() &&
AttachUtils.getParent(entity) != null &&
AttachUtils.getParent(entity) == Globals.playerEntity
AttachUtils.getParent(entity) == Globals.clientState.playerEntity
) ||
//don't draw items if they're attached to viewmodel

View File

@ -116,13 +116,13 @@ public class NormalsForOutlinePipeline implements RenderPipeline {
//don't draw third person view if camera is first person
(
entity == Globals.playerEntity &&
entity == Globals.clientState.playerEntity &&
!Globals.controlHandler.cameraIsThirdPerson()
) ||
(
!Globals.controlHandler.cameraIsThirdPerson() &&
AttachUtils.getParent(entity) != null &&
AttachUtils.getParent(entity) == Globals.playerEntity
AttachUtils.getParent(entity) == Globals.clientState.playerEntity
) ||
//don't draw items if they're attached to viewmodel

View File

@ -129,7 +129,7 @@ public class DebugContentPipeline implements RenderPipeline {
}
if(Globals.userSettings.getGraphicsDebugDrawCollisionSpheresServer()){
Model hitboxModel;
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId());
int serverIdForClientEntity = Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.clientState.playerEntity.getId());
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
Realm playerRealm = Globals.realmManager.getEntityRealm(serverPlayerEntity);
List<HitboxCollectionState> hitboxStates = new LinkedList<HitboxCollectionState>(playerRealm.getHitboxManager().getAllHitboxes());

View File

@ -108,16 +108,16 @@ public class ClientEquipStateTests extends EntityTestTemplate {
//try to store item in inventory
Entity katanaOnClient = clientSideItems.iterator().next();
ClientInventoryState.clientAttemptStoreItem(Globals.playerEntity, katanaOnClient);
ClientInventoryState.clientAttemptStoreItem(Globals.clientState.playerEntity, katanaOnClient);
//wait for server to perform transform
TestEngineUtils.simulateFrames(5);
//try equipping
UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.playerEntity);
UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.clientState.playerEntity);
assertEquals(1, inventory.getItems().size());
Entity inInventoryItem = inventory.getItems().get(0);
ClientEquipState clientEquipState = ClientEquipState.getClientEquipState(Globals.playerEntity);
ClientEquipState clientEquipState = ClientEquipState.getClientEquipState(Globals.clientState.playerEntity);
clientEquipState.commandAttemptEquip(inInventoryItem, clientEquipState.getEquipPoint("handsCombined"));
//propagate to client

View File

@ -46,7 +46,7 @@ public class InventoryUtilsTests extends EntityTestTemplate {
//grab player entity
Entity clientCreature = clientSideCreatures.iterator().next();
Entity clientKatana = TestEngineUtils.getClientEquivalent(katana);
Globals.playerEntity = clientCreature;
Globals.clientState.playerEntity = clientCreature;
//attempt to store
ClientInventoryState.clientAttemptStoreItem(clientCreature, clientKatana);
@ -99,7 +99,7 @@ public class InventoryUtilsTests extends EntityTestTemplate {
//grab player entity
Entity clientCreature = clientSideCreatures.iterator().next();
Entity clientKatana = TestEngineUtils.getClientEquivalent(katana);
Globals.playerEntity = clientCreature;
Globals.clientState.playerEntity = clientCreature;
//attempt to store
ClientInventoryState.clientAttemptStoreItem(clientCreature, clientKatana);
@ -158,7 +158,7 @@ public class InventoryUtilsTests extends EntityTestTemplate {
//grab player entity
Entity clientCreature = clientSideCreatures.iterator().next();
Globals.playerEntity = clientCreature;
Globals.clientState.playerEntity = clientCreature;
//try creating the item on the client
ClientInventoryState.clientConstructInInventoryItem(clientCreature, "Katana2H");

View File

@ -48,7 +48,7 @@ public class ItemUtilsTests extends EntityTestTemplate {
//grab player entity
Entity clientCreature = clientSideCreatures.iterator().next();
Globals.playerEntity = clientCreature;
Globals.clientState.playerEntity = clientCreature;
//attempt to store
Item item = Globals.gameConfigCurrent.getItemMap().getItem("Katana2H");

View File

@ -45,7 +45,7 @@ public class TestViewportUtils {
//wait for player to spawn
int frames = 0;
while(Globals.playerEntity == null){
while(Globals.clientState.playerEntity == null){
TestEngineUtils.simulateFrames(1);
try {
TimeUnit.MILLISECONDS.sleep(1);