move playerEntity to clientState
This commit is contained in:
parent
ac9c1a017e
commit
6d98af90ac
@ -1807,6 +1807,7 @@ Move clientWorldData to clientState
|
|||||||
Move clientScene to clientState
|
Move clientScene to clientState
|
||||||
Move clientSceneWrapper to clientState
|
Move clientSceneWrapper to clientState
|
||||||
Move clientConnection to clientState
|
Move clientConnection to clientState
|
||||||
|
Move playerEntity to clientState
|
||||||
Move lots of global state to clientState
|
Move lots of global state to clientState
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import electrosphere.client.terrain.manager.ClientTerrainManager;
|
|||||||
import electrosphere.collision.CollisionEngine;
|
import electrosphere.collision.CollisionEngine;
|
||||||
import electrosphere.data.common.CommonEntityType;
|
import electrosphere.data.common.CommonEntityType;
|
||||||
import electrosphere.data.voxel.VoxelType;
|
import electrosphere.data.voxel.VoxelType;
|
||||||
|
import electrosphere.entity.Entity;
|
||||||
import electrosphere.entity.scene.Scene;
|
import electrosphere.entity.scene.Scene;
|
||||||
import electrosphere.net.client.ClientNetworking;
|
import electrosphere.net.client.ClientNetworking;
|
||||||
import electrosphere.net.server.player.Player;
|
import electrosphere.net.server.player.Player;
|
||||||
@ -126,6 +127,11 @@ public class ClientState {
|
|||||||
*/
|
*/
|
||||||
public ClientPlayerData clientPlayerData = new ClientPlayerData();
|
public ClientPlayerData clientPlayerData = new ClientPlayerData();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The client side equivalent of this client's entity on the server
|
||||||
|
*/
|
||||||
|
public Entity playerEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -137,8 +137,8 @@ public class ClientBlockCellManager {
|
|||||||
*/
|
*/
|
||||||
public void update(){
|
public void update(){
|
||||||
Globals.profiler.beginCpuSample("ClientBlockCellManager.update");
|
Globals.profiler.beginCpuSample("ClientBlockCellManager.update");
|
||||||
if(shouldUpdate && Globals.playerEntity != null){
|
if(shouldUpdate && Globals.clientState.playerEntity != null){
|
||||||
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
|
Vector3d playerPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
|
||||||
Vector3i playerWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(playerPos);
|
Vector3i playerWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(playerPos);
|
||||||
int distCache = this.getDistCache(this.lastPlayerPos, playerWorldPos);
|
int distCache = this.getDistCache(this.lastPlayerPos, playerWorldPos);
|
||||||
this.lastPlayerPos.set(playerWorldPos);
|
this.lastPlayerPos.set(playerWorldPos);
|
||||||
@ -656,7 +656,7 @@ public class ClientBlockCellManager {
|
|||||||
* @return true if within full LOD range, false otherwise
|
* @return true if within full LOD range, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isFullLOD(Vector3i worldPos){
|
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 chunkMin = Globals.clientState.clientWorldData.convertWorldToRealSpace(worldPos);
|
||||||
Vector3d chunkMax = Globals.clientState.clientWorldData.convertWorldToRealSpace(new Vector3i(worldPos).add(1,1,1));
|
Vector3d chunkMax = Globals.clientState.clientWorldData.convertWorldToRealSpace(new Vector3i(worldPos).add(1,1,1));
|
||||||
return GeomUtils.getMinDistanceAABB(playerRealPos, chunkMin, chunkMax) <= FULL_RES_DIST;
|
return GeomUtils.getMinDistanceAABB(playerRealPos, chunkMin, chunkMax) <= FULL_RES_DIST;
|
||||||
|
|||||||
@ -79,8 +79,8 @@ public class CameraEntityUtils {
|
|||||||
rVal.putData(EntityDataStrings.CAMERA_YAW, 0.0f);
|
rVal.putData(EntityDataStrings.CAMERA_YAW, 0.0f);
|
||||||
Globals.cameraHandler.setTrackPlayerEntity(true);
|
Globals.cameraHandler.setTrackPlayerEntity(true);
|
||||||
//if camera data is defined, use the camera data third person offset instead of the default offset
|
//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){
|
if(Globals.clientState.playerEntity != null && CommonEntityUtils.getCommonData(Globals.clientState.playerEntity) != null){
|
||||||
CommonEntityType type = CommonEntityUtils.getCommonData(Globals.playerEntity);
|
CommonEntityType type = CommonEntityUtils.getCommonData(Globals.clientState.playerEntity);
|
||||||
if(type.getCameraData() != null && type.getCameraData().getThirdPersonCameraOffset() != null){
|
if(type.getCameraData() != null && type.getCameraData().getThirdPersonCameraOffset() != null){
|
||||||
rVal.putData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET, new Vector3d(
|
rVal.putData(EntityDataStrings.CAMERA_ORBIT_RADIAL_OFFSET, new Vector3d(
|
||||||
(float)type.getCameraData().getThirdPersonCameraOffset().x,
|
(float)type.getCameraData().getThirdPersonCameraOffset().x,
|
||||||
|
|||||||
@ -31,8 +31,8 @@ public class Crosshair {
|
|||||||
|
|
||||||
static final float TARGET_MAX_DIST = 1;
|
static final float TARGET_MAX_DIST = 1;
|
||||||
public static void checkTargetable(){
|
public static void checkTargetable(){
|
||||||
if(crossHairEntity != null && Globals.playerEntity != null && Globals.playerCamera != null){
|
if(crossHairEntity != null && Globals.clientState.playerEntity != null && Globals.playerCamera != null){
|
||||||
Vector3d parentPos = EntityUtils.getPosition(Globals.playerEntity);
|
Vector3d parentPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
|
||||||
// if(currentTarget == null){
|
// if(currentTarget == null){
|
||||||
if(!crosshairActive){
|
if(!crosshairActive){
|
||||||
Entity target = null;
|
Entity target = null;
|
||||||
@ -41,7 +41,7 @@ public class Crosshair {
|
|||||||
Vector3d entityPos = EntityUtils.getPosition(entity);
|
Vector3d entityPos = EntityUtils.getPosition(entity);
|
||||||
double currentDist = parentPos.distance(entityPos);
|
double currentDist = parentPos.distance(entityPos);
|
||||||
double currentAngleDiff = new Vector3d(entityPos).sub(parentPos).normalize().dot(new Vector3d(CameraEntityUtils.getCameraEye(Globals.playerCamera)));
|
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;
|
target = entity;
|
||||||
dist = currentDist + currentAngleDiff;
|
dist = currentDist + currentAngleDiff;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -295,7 +295,7 @@ public class FluidCellManager {
|
|||||||
Set<FluidCell> cellsToRemove = new HashSet<FluidCell>();
|
Set<FluidCell> cellsToRemove = new HashSet<FluidCell>();
|
||||||
for(FluidCell cell : cells){
|
for(FluidCell cell : cells){
|
||||||
Vector3d realPos = cell.getRealPos();
|
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);
|
cellsToRemove.add(cell);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -315,8 +315,8 @@ public class FluidCellManager {
|
|||||||
* Queues new cells that are in bounds but not currently accounted for
|
* Queues new cells that are in bounds but not currently accounted for
|
||||||
*/
|
*/
|
||||||
private void queueNewCells(){
|
private void queueNewCells(){
|
||||||
if(Globals.playerEntity != null && Globals.clientState.clientWorldData != null){
|
if(Globals.clientState.playerEntity != null && Globals.clientState.clientWorldData != null){
|
||||||
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
|
Vector3d playerPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
|
||||||
for(int x = -(int)drawRadius; x < drawRadius; x = x + ChunkData.CHUNK_DATA_SIZE){
|
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 y = -(int)drawRadius; y < drawRadius; y = y + ChunkData.CHUNK_DATA_SIZE){
|
||||||
for(int z = -(int)drawRadius; z < drawRadius; z = z + ChunkData.CHUNK_DATA_SIZE){
|
for(int z = -(int)drawRadius; z < drawRadius; z = z + ChunkData.CHUNK_DATA_SIZE){
|
||||||
|
|||||||
@ -28,7 +28,7 @@ public class ButtonInteraction {
|
|||||||
* Handles a button interaction event
|
* Handles a button interaction event
|
||||||
*/
|
*/
|
||||||
public static void handleButtonInteraction(){
|
public static void handleButtonInteraction(){
|
||||||
if(Globals.playerEntity != null && Globals.playerCamera != null){
|
if(Globals.clientState.playerEntity != null && Globals.playerCamera != null){
|
||||||
Entity camera = Globals.playerCamera;
|
Entity camera = Globals.playerCamera;
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera)).mul(-1.0);
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera)).mul(-1.0);
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera));
|
||||||
@ -36,9 +36,9 @@ public class ButtonInteraction {
|
|||||||
if(target != null && CommonEntityFlags.isInteractable(target)){
|
if(target != null && CommonEntityFlags.isInteractable(target)){
|
||||||
Globals.interactionTarget = target;
|
Globals.interactionTarget = target;
|
||||||
ButtonInteraction.performInteraction(target);
|
ButtonInteraction.performInteraction(target);
|
||||||
} else if(ClientEquipState.hasEquipState(Globals.playerEntity) && Crosshair.hasTarget()){
|
} else if(ClientEquipState.hasEquipState(Globals.clientState.playerEntity) && Crosshair.hasTarget()){
|
||||||
if(InventoryUtils.hasNaturalInventory(Globals.playerEntity)){
|
if(InventoryUtils.hasNaturalInventory(Globals.clientState.playerEntity)){
|
||||||
ClientInventoryState.clientAttemptStoreItem(Globals.playerEntity, Crosshair.getTarget());
|
ClientInventoryState.clientAttemptStoreItem(Globals.clientState.playerEntity, Crosshair.getTarget());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -68,7 +68,7 @@ public class ButtonInteraction {
|
|||||||
case InteractionData.ON_INTERACT_INVENTORY: {
|
case InteractionData.ON_INTERACT_INVENTORY: {
|
||||||
LoggerInterface.loggerEngine.DEBUG("Interacting with inventory");
|
LoggerInterface.loggerEngine.DEBUG("Interacting with inventory");
|
||||||
InventoryMainWindow.viewInventory(target);
|
InventoryMainWindow.viewInventory(target);
|
||||||
InventoryMainWindow.viewInventory(Globals.playerEntity);
|
InventoryMainWindow.viewInventory(Globals.clientState.playerEntity);
|
||||||
Globals.clientState.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestWatchInventoryMessage(Globals.clientState.clientSceneWrapper.mapClientToServerId(target.getId())));
|
Globals.clientState.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestWatchInventoryMessage(Globals.clientState.clientSceneWrapper.mapClientToServerId(target.getId())));
|
||||||
} break;
|
} break;
|
||||||
default: {
|
default: {
|
||||||
|
|||||||
@ -229,7 +229,7 @@ public class ClientInteractionEngine {
|
|||||||
* Updates the interaction target label
|
* Updates the interaction target label
|
||||||
*/
|
*/
|
||||||
public static void updateInteractionTargetLabel(){
|
public static void updateInteractionTargetLabel(){
|
||||||
if(Globals.playerEntity != null && Globals.playerCamera != null){
|
if(Globals.clientState.playerEntity != null && Globals.playerCamera != null){
|
||||||
//clear block cursor
|
//clear block cursor
|
||||||
Globals.cursorState.hintClearBlockCursor();
|
Globals.cursorState.hintClearBlockCursor();
|
||||||
|
|
||||||
|
|||||||
@ -66,16 +66,16 @@ public class ItemActions {
|
|||||||
boolean sendServerMessage = true;
|
boolean sendServerMessage = true;
|
||||||
|
|
||||||
//do any immediate client side calculations here (ie start playing an animation until we get response from server)
|
//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){
|
||||||
ClientAttackTree attackTree = CreatureUtils.clientGetAttackTree(Globals.playerEntity);
|
ClientAttackTree attackTree = CreatureUtils.clientGetAttackTree(Globals.clientState.playerEntity);
|
||||||
if(attackTree != null){
|
if(attackTree != null){
|
||||||
attackTree.start();
|
attackTree.start();
|
||||||
}
|
}
|
||||||
ShooterTree shooterTree = ShooterTree.getShooterTree(Globals.playerEntity);
|
ShooterTree shooterTree = ShooterTree.getShooterTree(Globals.clientState.playerEntity);
|
||||||
if(shooterTree != null){
|
if(shooterTree != null){
|
||||||
shooterTree.fire();
|
shooterTree.fire();
|
||||||
}
|
}
|
||||||
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
|
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.clientState.playerEntity);
|
||||||
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
|
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
|
||||||
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
|
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
|
||||||
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
|
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
|
||||||
@ -155,9 +155,9 @@ public class ItemActions {
|
|||||||
cursorPos.z
|
cursorPos.z
|
||||||
));
|
));
|
||||||
//do any immediate client side calculations here (ie start playing an animation until we get response from server)
|
//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);
|
// Vector3f cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
ClientAttackTree attackTree = CreatureUtils.clientGetAttackTree(Globals.playerEntity);
|
ClientAttackTree attackTree = CreatureUtils.clientGetAttackTree(Globals.clientState.playerEntity);
|
||||||
if(attackTree != null){
|
if(attackTree != null){
|
||||||
// CreatureUtils.setFacingVector(Globals.playerCharacter, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).normalize());
|
// CreatureUtils.setFacingVector(Globals.playerCharacter, new Vector3d(-cameraEyeVector.x,0,-cameraEyeVector.z).normalize());
|
||||||
attackTree.release();
|
attackTree.release();
|
||||||
@ -184,8 +184,8 @@ public class ItemActions {
|
|||||||
boolean sendServerMessage = true;
|
boolean sendServerMessage = true;
|
||||||
|
|
||||||
//do any immediate client side calculations here (ie start playing an animation until we get response from server)
|
//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){
|
||||||
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
|
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.clientState.playerEntity);
|
||||||
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
|
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
|
||||||
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
|
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
|
||||||
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
|
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
|
||||||
@ -237,8 +237,8 @@ public class ItemActions {
|
|||||||
boolean sendServerMessage = true;
|
boolean sendServerMessage = true;
|
||||||
|
|
||||||
//do any immediate client side calculations here (ie start playing an animation until we get response from server)
|
//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){
|
||||||
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
|
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.clientState.playerEntity);
|
||||||
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
|
Entity primaryEntity = clientToolbarState.getCurrentPrimaryItem();
|
||||||
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
|
if(primaryEntity != null && Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity) != null){
|
||||||
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
|
Item data = Globals.gameConfigCurrent.getItemMap().getItem(primaryEntity);
|
||||||
|
|||||||
@ -285,9 +285,9 @@ public class ClientSceneWrapper {
|
|||||||
*/
|
*/
|
||||||
public void destroyEntitiesOutsideSimRange(){
|
public void destroyEntitiesOutsideSimRange(){
|
||||||
Globals.profiler.beginCpuSample("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;
|
// 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();
|
// List<Entity> entityList = scene.getEntityList();
|
||||||
// for(Entity entity : entityList){
|
// for(Entity entity : entityList){
|
||||||
// Vector3d position = EntityUtils.getPosition(entity);
|
// Vector3d position = EntityUtils.getPosition(entity);
|
||||||
|
|||||||
@ -152,8 +152,8 @@ public class ClientSimulation {
|
|||||||
*/
|
*/
|
||||||
private void updateSkyboxPos(){
|
private void updateSkyboxPos(){
|
||||||
Globals.profiler.beginCpuSample("updateSkyboxPos");
|
Globals.profiler.beginCpuSample("updateSkyboxPos");
|
||||||
if(Globals.skybox != null && Globals.playerEntity != null){
|
if(Globals.skybox != null && Globals.clientState.playerEntity != null){
|
||||||
EntityUtils.getPosition(Globals.skybox).set(EntityUtils.getPosition(Globals.playerEntity));
|
EntityUtils.getPosition(Globals.skybox).set(EntityUtils.getPosition(Globals.clientState.playerEntity));
|
||||||
}
|
}
|
||||||
Globals.profiler.endCpuSample();
|
Globals.profiler.endCpuSample();
|
||||||
}
|
}
|
||||||
@ -164,11 +164,11 @@ public class ClientSimulation {
|
|||||||
private void updateFirstPersonAttachments(){
|
private void updateFirstPersonAttachments(){
|
||||||
Globals.profiler.beginCpuSample("updateFirstPersonAttachments");
|
Globals.profiler.beginCpuSample("updateFirstPersonAttachments");
|
||||||
//update the facing vector when camera moves in first person
|
//update the facing vector when camera moves in first person
|
||||||
if(!Globals.controlHandler.cameraIsThirdPerson() && Globals.playerCamera != null && Globals.playerEntity != null){
|
if(!Globals.controlHandler.cameraIsThirdPerson() && Globals.playerCamera != null && Globals.clientState.playerEntity != null){
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
//flush equipped item state
|
//flush equipped item state
|
||||||
if(ClientEquipState.hasEquipState(Globals.playerEntity)){
|
if(ClientEquipState.hasEquipState(Globals.clientState.playerEntity)){
|
||||||
ClientEquipState equipState = ClientEquipState.getClientEquipState(Globals.playerEntity);
|
ClientEquipState equipState = ClientEquipState.getClientEquipState(Globals.clientState.playerEntity);
|
||||||
equipState.evaluatePlayerAttachments();
|
equipState.evaluatePlayerAttachments();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -172,8 +172,8 @@ public class ClientDrawCellManager {
|
|||||||
*/
|
*/
|
||||||
public void update(){
|
public void update(){
|
||||||
Globals.profiler.beginCpuSample("ClientDrawCellManager.update");
|
Globals.profiler.beginCpuSample("ClientDrawCellManager.update");
|
||||||
if(shouldUpdate && Globals.playerEntity != null){
|
if(shouldUpdate && Globals.clientState.playerEntity != null){
|
||||||
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
|
Vector3d playerPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
|
||||||
Vector3i playerWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(playerPos);
|
Vector3i playerWorldPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(playerPos);
|
||||||
int distCache = this.getDistCache(this.lastPlayerPos, playerWorldPos);
|
int distCache = this.getDistCache(this.lastPlayerPos, playerWorldPos);
|
||||||
if(this.bustDistCache){
|
if(this.bustDistCache){
|
||||||
@ -803,7 +803,7 @@ public class ClientDrawCellManager {
|
|||||||
* @return true if within full LOD range, false otherwise
|
* @return true if within full LOD range, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isFullLOD(Vector3i worldPos){
|
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 chunkMin = Globals.clientState.clientWorldData.convertWorldToRealSpace(worldPos);
|
||||||
Vector3d chunkMax = Globals.clientState.clientWorldData.convertWorldToRealSpace(new Vector3i(worldPos).add(1,1,1));
|
Vector3d chunkMax = Globals.clientState.clientWorldData.convertWorldToRealSpace(new Vector3i(worldPos).add(1,1,1));
|
||||||
return GeomUtils.getMinDistanceAABB(playerRealPos, chunkMin, chunkMax) <= FULL_RES_DIST;
|
return GeomUtils.getMinDistanceAABB(playerRealPos, chunkMin, chunkMax) <= FULL_RES_DIST;
|
||||||
|
|||||||
@ -194,8 +194,8 @@ public class FoliageCellManager {
|
|||||||
*/
|
*/
|
||||||
public void update(){
|
public void update(){
|
||||||
Globals.profiler.beginCpuSample("FoliageCellManager.update");
|
Globals.profiler.beginCpuSample("FoliageCellManager.update");
|
||||||
if(shouldUpdate && Globals.playerEntity != null && Globals.userSettings.getGraphicsPerformanceEnableFoliageManager()){
|
if(shouldUpdate && Globals.clientState.playerEntity != null && Globals.userSettings.getGraphicsPerformanceEnableFoliageManager()){
|
||||||
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
|
Vector3d playerPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
|
||||||
Vector3i absVoxelPos = Globals.clientState.clientWorldData.convertRealToAbsoluteVoxelSpace(playerPos);
|
Vector3i absVoxelPos = Globals.clientState.clientWorldData.convertRealToAbsoluteVoxelSpace(playerPos);
|
||||||
int distCache = this.getDistCache(this.lastPlayerPos, absVoxelPos);
|
int distCache = this.getDistCache(this.lastPlayerPos, absVoxelPos);
|
||||||
if(bustDistCache || absVoxelPos.distance(this.lastPlayerPos) > TELEPORT_DISTANCE){
|
if(bustDistCache || absVoxelPos.distance(this.lastPlayerPos) > TELEPORT_DISTANCE){
|
||||||
@ -742,7 +742,7 @@ public class FoliageCellManager {
|
|||||||
* @return true if within full LOD range, false otherwise
|
* @return true if within full LOD range, false otherwise
|
||||||
*/
|
*/
|
||||||
public boolean isFullLOD(Vector3i worldPos){
|
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 chunkMin = Globals.clientState.clientWorldData.convertWorldToRealSpace(worldPos);
|
||||||
Vector3d chunkMax = Globals.clientState.clientWorldData.convertWorldToRealSpace(new Vector3i(worldPos).add(1,1,1));
|
Vector3d chunkMax = Globals.clientState.clientWorldData.convertWorldToRealSpace(new Vector3i(worldPos).add(1,1,1));
|
||||||
return GeomUtils.getMinDistanceAABB(playerRealPos, chunkMin, chunkMax) <= FULL_RES_DIST;
|
return GeomUtils.getMinDistanceAABB(playerRealPos, chunkMin, chunkMax) <= FULL_RES_DIST;
|
||||||
|
|||||||
@ -70,7 +70,7 @@ public class EquipmentInventoryPanel {
|
|||||||
//clear item container ui
|
//clear item container ui
|
||||||
WindowUtils.cleanItemDraggingWindow();
|
WindowUtils.cleanItemDraggingWindow();
|
||||||
//re-render inventory
|
//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 false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -150,7 +150,7 @@ public class EquipmentInventoryPanel {
|
|||||||
container.removeChild(panel);
|
container.removeChild(panel);
|
||||||
WindowUtils.pushItemIconToItemWindow(panel);
|
WindowUtils.pushItemIconToItemWindow(panel);
|
||||||
panel.setAbsolutePosition(true);
|
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
|
//play sound effect
|
||||||
if(Globals.virtualAudioSourceManager != null){
|
if(Globals.virtualAudioSourceManager != null){
|
||||||
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(finalEnt));
|
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(finalEnt));
|
||||||
@ -188,7 +188,7 @@ public class EquipmentInventoryPanel {
|
|||||||
if(Globals.dragSourceInventory == InventoryUtils.getToolbarInventory(entity)){
|
if(Globals.dragSourceInventory == InventoryUtils.getToolbarInventory(entity)){
|
||||||
if(inventory.canEquipItemToSlot(Globals.draggedItem, slots.get(itemId))){
|
if(inventory.canEquipItemToSlot(Globals.draggedItem, slots.get(itemId))){
|
||||||
//fire equip event to equip state
|
//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)));
|
equipState.commandAttemptEquip(Globals.draggedItem,inventory.getEquipPointFromSlot(slots.get(itemId)));
|
||||||
//play sound effect
|
//play sound effect
|
||||||
if(Globals.virtualAudioSourceManager != null){
|
if(Globals.virtualAudioSourceManager != null){
|
||||||
@ -202,16 +202,16 @@ public class EquipmentInventoryPanel {
|
|||||||
} else if(inventory.canEquipItemToCombinedSlot(Globals.draggedItem, slots.get(itemId))){
|
} else if(inventory.canEquipItemToCombinedSlot(Globals.draggedItem, slots.get(itemId))){
|
||||||
EquipPoint combinedPoint = inventory.getCombinedPoint(slots.get(itemId));
|
EquipPoint combinedPoint = inventory.getCombinedPoint(slots.get(itemId));
|
||||||
//fire equip event to equip state
|
//fire equip event to equip state
|
||||||
ClientEquipState equipState = ClientEquipState.getEquipState(Globals.playerEntity);
|
ClientEquipState equipState = ClientEquipState.getEquipState(Globals.clientState.playerEntity);
|
||||||
equipState.commandAttemptEquip(Globals.draggedItem,combinedPoint);
|
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!");
|
throw new UnsupportedOperationException("Unimplemented!");
|
||||||
}
|
}
|
||||||
} else if(Globals.dragSourceInventory instanceof UnrelationalInventoryState){
|
} else if(Globals.dragSourceInventory instanceof UnrelationalInventoryState){
|
||||||
if(inventory.canEquipItemToSlot(Globals.draggedItem, slots.get(itemId))){
|
if(inventory.canEquipItemToSlot(Globals.draggedItem, slots.get(itemId))){
|
||||||
//fire equip event to equip state
|
//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)));
|
equipState.commandAttemptEquip(Globals.draggedItem,inventory.getEquipPointFromSlot(slots.get(itemId)));
|
||||||
//play sound effect
|
//play sound effect
|
||||||
if(Globals.virtualAudioSourceManager != null){
|
if(Globals.virtualAudioSourceManager != null){
|
||||||
@ -225,7 +225,7 @@ public class EquipmentInventoryPanel {
|
|||||||
} else if(inventory.canEquipItemToCombinedSlot(Globals.draggedItem, slots.get(itemId))){
|
} else if(inventory.canEquipItemToCombinedSlot(Globals.draggedItem, slots.get(itemId))){
|
||||||
EquipPoint combinedPoint = inventory.getCombinedPoint(slots.get(itemId));
|
EquipPoint combinedPoint = inventory.getCombinedPoint(slots.get(itemId));
|
||||||
//fire equip event to equip state
|
//fire equip event to equip state
|
||||||
ClientEquipState equipState = ClientEquipState.getEquipState(Globals.playerEntity);
|
ClientEquipState equipState = ClientEquipState.getEquipState(Globals.clientState.playerEntity);
|
||||||
equipState.commandAttemptEquip(Globals.draggedItem,combinedPoint);
|
equipState.commandAttemptEquip(Globals.draggedItem,combinedPoint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ public class EquipmentInventoryPanel {
|
|||||||
//clear item container ui
|
//clear item container ui
|
||||||
WindowUtils.cleanItemDraggingWindow();
|
WindowUtils.cleanItemDraggingWindow();
|
||||||
//rerender inventories
|
//rerender inventories
|
||||||
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.playerEntity));
|
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.clientState.playerEntity));
|
||||||
return false;
|
return false;
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -84,7 +84,7 @@ public class ItemIconPanel {
|
|||||||
panel.setPositionType(YogaPositionType.Absolute);
|
panel.setPositionType(YogaPositionType.Absolute);
|
||||||
panel.setPositionX(panel.getAbsoluteX());
|
panel.setPositionX(panel.getAbsoluteX());
|
||||||
panel.setPositionY(panel.getAbsoluteY());
|
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
|
//play sound effect
|
||||||
if(Globals.virtualAudioSourceManager != null){
|
if(Globals.virtualAudioSourceManager != null){
|
||||||
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(finalEnt));
|
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(finalEnt));
|
||||||
@ -194,7 +194,7 @@ public class ItemIconPanel {
|
|||||||
//clear item container ui
|
//clear item container ui
|
||||||
WindowUtils.cleanItemDraggingWindow();
|
WindowUtils.cleanItemDraggingWindow();
|
||||||
//rerender inventories
|
//rerender inventories
|
||||||
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.playerEntity));
|
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.clientState.playerEntity));
|
||||||
return false;
|
return false;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
|||||||
@ -75,7 +75,7 @@ public class NaturalInventoryPanel {
|
|||||||
//clear item container ui
|
//clear item container ui
|
||||||
WindowUtils.cleanItemDraggingWindow();
|
WindowUtils.cleanItemDraggingWindow();
|
||||||
//re-render inventory
|
//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
|
//clear ui
|
||||||
WindowUtils.cleanItemDraggingWindow();
|
WindowUtils.cleanItemDraggingWindow();
|
||||||
//re-render inventory
|
//re-render inventory
|
||||||
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.playerEntity));
|
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.clientState.playerEntity));
|
||||||
return true;
|
return true;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
|||||||
@ -85,7 +85,7 @@ public class ToolbarInventoryPanel {
|
|||||||
//clear item container ui
|
//clear item container ui
|
||||||
WindowUtils.cleanItemDraggingWindow();
|
WindowUtils.cleanItemDraggingWindow();
|
||||||
//re-render inventory
|
//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
|
//clear ui
|
||||||
WindowUtils.cleanItemDraggingWindow();
|
WindowUtils.cleanItemDraggingWindow();
|
||||||
//re-render inventory
|
//re-render inventory
|
||||||
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.playerEntity));
|
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.clientState.playerEntity));
|
||||||
return true;
|
return true;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
|
|||||||
@ -193,10 +193,10 @@ public class WindowUtils {
|
|||||||
public static void attemptRedrawInventoryWindows(){
|
public static void attemptRedrawInventoryWindows(){
|
||||||
//make sure we're client and the player entity exists
|
//make sure we're client and the player entity exists
|
||||||
if(Globals.RUN_CLIENT){
|
if(Globals.RUN_CLIENT){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
if(Globals.elementService.containsWindow(WindowStrings.WINDOW_CHARACTER)){
|
if(Globals.elementService.containsWindow(WindowStrings.WINDOW_CHARACTER)){
|
||||||
//redraw if necessary
|
//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){
|
if(Globals.targetContainer != null){
|
||||||
|
|||||||
@ -38,10 +38,10 @@ public class ImGuiPlayerEntity {
|
|||||||
ImGui.text("Player Entity Details");
|
ImGui.text("Player Entity Details");
|
||||||
|
|
||||||
//data about player entity
|
//data about player entity
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
Vector3d clientEntityPos = EntityUtils.getPosition(Globals.playerEntity);
|
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("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
|
//physics on client
|
||||||
if(ImGui.collapsingHeader("Physics Data")){
|
if(ImGui.collapsingHeader("Physics Data")){
|
||||||
@ -72,7 +72,7 @@ public class ImGuiPlayerEntity {
|
|||||||
//
|
//
|
||||||
//quick launch entity details
|
//quick launch entity details
|
||||||
if(ImGui.button("Client Details")){
|
if(ImGui.button("Client Details")){
|
||||||
ImGuiEntityMacros.showEntity(Globals.playerEntity);
|
ImGuiEntityMacros.showEntity(Globals.clientState.playerEntity);
|
||||||
}
|
}
|
||||||
ImGui.sameLine();
|
ImGui.sameLine();
|
||||||
|
|
||||||
@ -90,7 +90,7 @@ public class ImGuiPlayerEntity {
|
|||||||
ImGui.sameLine();
|
ImGui.sameLine();
|
||||||
|
|
||||||
if(ImGui.button("Server Details")){
|
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);
|
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
||||||
ImGuiEntityMacros.showEntity(serverPlayerEntity);
|
ImGuiEntityMacros.showEntity(serverPlayerEntity);
|
||||||
}
|
}
|
||||||
@ -107,14 +107,14 @@ public class ImGuiPlayerEntity {
|
|||||||
*/
|
*/
|
||||||
private static void drawPhysicsData(){
|
private static void drawPhysicsData(){
|
||||||
//client-side tree stuff
|
//client-side tree stuff
|
||||||
DBody body = PhysicsEntityUtils.getDBody(Globals.playerEntity);
|
DBody body = PhysicsEntityUtils.getDBody(Globals.clientState.playerEntity);
|
||||||
ClientAttackTree attackTree = ClientAttackTree.getClientAttackTree(Globals.playerEntity);
|
ClientAttackTree attackTree = ClientAttackTree.getClientAttackTree(Globals.clientState.playerEntity);
|
||||||
if(body != null){
|
if(body != null){
|
||||||
ImGui.text("Velocity: " + body.getLinearVel());
|
ImGui.text("Velocity: " + body.getLinearVel());
|
||||||
ImGui.text("Force: " + body.getForce());
|
ImGui.text("Force: " + body.getForce());
|
||||||
ImGui.text("Angular Velocity: " + body.getAngularVel());
|
ImGui.text("Angular Velocity: " + body.getAngularVel());
|
||||||
ImGui.text("Torque: " + body.getTorque());
|
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){
|
if(attackTree != null){
|
||||||
ImGui.text("Attack Tree State: " + attackTree.getState());
|
ImGui.text("Attack Tree State: " + attackTree.getState());
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ public class ImGuiPlayerEntity {
|
|||||||
*/
|
*/
|
||||||
private static void drawSynchronizationData(){
|
private static void drawSynchronizationData(){
|
||||||
//server pos
|
//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);
|
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
||||||
if(serverPlayerEntity != null){
|
if(serverPlayerEntity != null){
|
||||||
ImGui.text("Position (Server): " + EntityUtils.getPosition(serverPlayerEntity));
|
ImGui.text("Position (Server): " + EntityUtils.getPosition(serverPlayerEntity));
|
||||||
|
|||||||
@ -45,7 +45,7 @@ public class ImGuiChunkMonitor {
|
|||||||
}
|
}
|
||||||
if(ImGui.button("Break at chunk")){
|
if(ImGui.button("Break at chunk")){
|
||||||
if(Globals.clientState.foliageCellManager != null){
|
if(Globals.clientState.foliageCellManager != null){
|
||||||
Vector3i absVoxelPos = Globals.clientState.clientWorldData.convertRealToAbsoluteVoxelSpace(EntityUtils.getPosition(Globals.playerEntity));
|
Vector3i absVoxelPos = Globals.clientState.clientWorldData.convertRealToAbsoluteVoxelSpace(EntityUtils.getPosition(Globals.clientState.playerEntity));
|
||||||
Globals.clientState.foliageCellManager.addBreakPoint(absVoxelPos);
|
Globals.clientState.foliageCellManager.addBreakPoint(absVoxelPos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -190,7 +190,7 @@ public class ImGuiEntityMacros {
|
|||||||
AttachUtils.hasChildren(detailViewEntity) ||
|
AttachUtils.hasChildren(detailViewEntity) ||
|
||||||
AttachUtils.getParent(detailViewEntity) != null ||
|
AttachUtils.getParent(detailViewEntity) != null ||
|
||||||
detailViewEntity == Globals.firstPersonEntity ||
|
detailViewEntity == Globals.firstPersonEntity ||
|
||||||
detailViewEntity == Globals.playerEntity ||
|
detailViewEntity == Globals.clientState.playerEntity ||
|
||||||
Globals.clientState.clientSceneWrapper.clientToServerMapContainsId(detailViewEntity.getId())
|
Globals.clientState.clientSceneWrapper.clientToServerMapContainsId(detailViewEntity.getId())
|
||||||
) &&
|
) &&
|
||||||
ImGui.checkbox("Linked entities`", showLinkedEntitiesTab)
|
ImGui.checkbox("Linked entities`", showLinkedEntitiesTab)
|
||||||
@ -367,11 +367,11 @@ public class ImGuiEntityMacros {
|
|||||||
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(Globals.firstPersonEntity));
|
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(Globals.firstPersonEntity));
|
||||||
});
|
});
|
||||||
DebugVisualizerUtils.clientSpawnVectorVisualizer((Entity vector) -> {
|
DebugVisualizerUtils.clientSpawnVectorVisualizer((Entity vector) -> {
|
||||||
EntityUtils.getPosition(vector).set(EntityUtils.getPosition(Globals.playerEntity));
|
EntityUtils.getPosition(vector).set(EntityUtils.getPosition(Globals.clientState.playerEntity));
|
||||||
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(Globals.playerEntity));
|
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(Globals.clientState.playerEntity));
|
||||||
});
|
});
|
||||||
DebugVisualizerUtils.clientSpawnVectorVisualizer((Entity vector) -> {
|
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);
|
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
||||||
EntityUtils.getPosition(vector).set(EntityUtils.getPosition(serverPlayerEntity));
|
EntityUtils.getPosition(vector).set(EntityUtils.getPosition(serverPlayerEntity));
|
||||||
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(serverPlayerEntity));
|
EntityUtils.getRotation(vector).set(EntityUtils.getRotation(serverPlayerEntity));
|
||||||
@ -493,11 +493,11 @@ public class ImGuiEntityMacros {
|
|||||||
protected static void drawLinkedEntities(){
|
protected static void drawLinkedEntities(){
|
||||||
if(showLinkedEntitiesTab && ImGui.collapsingHeader("Linked entities")){
|
if(showLinkedEntitiesTab && ImGui.collapsingHeader("Linked entities")){
|
||||||
ImGui.indent();
|
ImGui.indent();
|
||||||
if(detailViewEntity == Globals.playerEntity && ImGui.button("View Model")){
|
if(detailViewEntity == Globals.clientState.playerEntity && ImGui.button("View Model")){
|
||||||
ImGuiEntityMacros.showEntity(Globals.firstPersonEntity);
|
ImGuiEntityMacros.showEntity(Globals.firstPersonEntity);
|
||||||
}
|
}
|
||||||
if(detailViewEntity == Globals.firstPersonEntity && ImGui.button("3rd Person Model")){
|
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")){
|
if(AttachUtils.getParent(detailViewEntity) != null && ImGui.button("Parent")){
|
||||||
ImGuiEntityMacros.showEntity(AttachUtils.getParent(detailViewEntity));
|
ImGuiEntityMacros.showEntity(AttachUtils.getParent(detailViewEntity));
|
||||||
|
|||||||
@ -21,7 +21,7 @@ public class ImGuiEntityDebugActions {
|
|||||||
|
|
||||||
if(ImGui.button("Teleport to player")){
|
if(ImGui.button("Teleport to player")){
|
||||||
if(Globals.clientState.clientSceneWrapper.containsServerId(detailViewEntity.getId())){
|
if(Globals.clientState.clientSceneWrapper.containsServerId(detailViewEntity.getId())){
|
||||||
ServerEntityUtils.repositionEntity(detailViewEntity, EntityUtils.getPosition(Globals.playerEntity));
|
ServerEntityUtils.repositionEntity(detailViewEntity, EntityUtils.getPosition(Globals.clientState.playerEntity));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -93,7 +93,7 @@ public class ImGuiAI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(ImGui.collapsingHeader("Debug Player AI")){
|
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);
|
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
||||||
AI playerAi = AI.getAI(serverPlayerEntity);
|
AI playerAi = AI.getAI(serverPlayerEntity);
|
||||||
Vector3d playerTargetPos = null;
|
Vector3d playerTargetPos = null;
|
||||||
@ -170,7 +170,7 @@ public class ImGuiAI {
|
|||||||
if(ImGui.button("Spawn test macro character")){
|
if(ImGui.button("Spawn test macro character")){
|
||||||
Realm realm = Globals.realmManager.first();
|
Realm realm = Globals.realmManager.first();
|
||||||
GriddedDataCellManager griddedDataCellManager = (GriddedDataCellManager)realm.getDataCellManager();
|
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));
|
Vector3d spawnPos = griddedDataCellManager.getMacroEntryPoint(new Vector3d(EntityUtils.getPosition(serverEnt)).add(50,0,0));
|
||||||
CharacterUtils.spawnCharacter(realm, spawnPos, CharacterUtils.DEFAULT_RACE);
|
CharacterUtils.spawnCharacter(realm, spawnPos, CharacterUtils.DEFAULT_RACE);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -59,14 +59,14 @@ public class CraftingWindow {
|
|||||||
(RecipeData recipe) -> {
|
(RecipeData recipe) -> {
|
||||||
if(Globals.interactionTarget != null){
|
if(Globals.interactionTarget != null){
|
||||||
Globals.clientState.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestCraftMessage(
|
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()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.interactionTarget.getId()),
|
||||||
recipe.getId()
|
recipe.getId()
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
Globals.clientState.clientConnection.queueOutgoingMessage(InventoryMessage.constructclientRequestCraftMessage(
|
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.playerEntity.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.clientState.playerEntity.getId()),
|
||||||
recipe.getId()
|
recipe.getId()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,7 @@ public class InventoryMainWindow {
|
|||||||
* @param entity The entity
|
* @param entity The entity
|
||||||
*/
|
*/
|
||||||
public static void viewInventory(Entity entity){
|
public static void viewInventory(Entity entity){
|
||||||
if(entity == Globals.playerEntity){
|
if(entity == Globals.clientState.playerEntity){
|
||||||
if(Globals.elementService.getWindow(WindowStrings.WINDOW_CHARACTER) == null){
|
if(Globals.elementService.getWindow(WindowStrings.WINDOW_CHARACTER) == null){
|
||||||
//create window
|
//create window
|
||||||
Window mainMenuWindow = InventoryMainWindow.createInventoryWindow(entity);
|
Window mainMenuWindow = InventoryMainWindow.createInventoryWindow(entity);
|
||||||
@ -113,7 +113,7 @@ public class InventoryMainWindow {
|
|||||||
rVal.setMinHeight(MAX_HEIGHT);
|
rVal.setMinHeight(MAX_HEIGHT);
|
||||||
|
|
||||||
String windowString;
|
String windowString;
|
||||||
if(entity == Globals.playerEntity){
|
if(entity == Globals.clientState.playerEntity){
|
||||||
windowString = WindowStrings.WINDOW_CHARACTER;
|
windowString = WindowStrings.WINDOW_CHARACTER;
|
||||||
} else {
|
} else {
|
||||||
windowString = WindowStrings.WINDOW_INVENTORY_TARGET;
|
windowString = WindowStrings.WINDOW_INVENTORY_TARGET;
|
||||||
|
|||||||
@ -220,14 +220,14 @@ public class MenuGeneratorsInGame {
|
|||||||
//disable drawing player character
|
//disable drawing player character
|
||||||
Button toggleDrawPlayerButton = Button.createButton("Toggle draw character", new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
Button toggleDrawPlayerButton = Button.createButton("Toggle draw character", new ClickableElement.ClickEventCallback(){public boolean execute(ClickEvent event){
|
||||||
// Main.running = false;
|
// Main.running = false;
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
if(Globals.playerEntity.containsKey(EntityDataStrings.DATA_STRING_DRAW)){
|
if(Globals.clientState.playerEntity.containsKey(EntityDataStrings.DATA_STRING_DRAW)){
|
||||||
boolean draw = (boolean)Globals.playerEntity.getData(EntityDataStrings.DATA_STRING_DRAW);
|
boolean draw = (boolean)Globals.clientState.playerEntity.getData(EntityDataStrings.DATA_STRING_DRAW);
|
||||||
Globals.playerEntity.putData(EntityDataStrings.DATA_STRING_DRAW, !draw);
|
Globals.clientState.playerEntity.putData(EntityDataStrings.DATA_STRING_DRAW, !draw);
|
||||||
}
|
}
|
||||||
// if(Globals.playerEntity.containsKey(EntityDataStrings.DRAW_CAST_SHADOW)){
|
// if(Globals.clientState.playerEntity.containsKey(EntityDataStrings.DRAW_CAST_SHADOW)){
|
||||||
// boolean drawShadow = (boolean)Globals.playerEntity.getData(EntityDataStrings.DRAW_CAST_SHADOW);
|
// boolean drawShadow = (boolean)Globals.clientState.playerEntity.getData(EntityDataStrings.DRAW_CAST_SHADOW);
|
||||||
// Globals.playerEntity.putData(EntityDataStrings.DRAW_CAST_SHADOW, !drawShadow);
|
// Globals.clientState.playerEntity.putData(EntityDataStrings.DRAW_CAST_SHADOW, !drawShadow);
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -349,7 +349,7 @@ public class MenuGeneratorsInGame {
|
|||||||
return false;
|
return false;
|
||||||
}});
|
}});
|
||||||
|
|
||||||
Entity playerEntity = Globals.playerEntity;
|
Entity playerEntity = Globals.clientState.playerEntity;
|
||||||
Actor playerActor = EntityUtils.getActor(playerEntity);
|
Actor playerActor = EntityUtils.getActor(playerEntity);
|
||||||
ActorStaticMorph staticMorph = playerActor.getStaticMorph();
|
ActorStaticMorph staticMorph = playerActor.getStaticMorph();
|
||||||
CreatureData playeCreatureType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(CreatureUtils.getType(playerEntity));
|
CreatureData playeCreatureType = Globals.gameConfigCurrent.getCreatureTypeLoader().getType(CreatureUtils.getType(playerEntity));
|
||||||
|
|||||||
@ -25,7 +25,7 @@ public class MenuGeneratorsInventory {
|
|||||||
LoggerInterface.loggerUI.INFO("World item drop capture window received drag release");
|
LoggerInterface.loggerUI.INFO("World item drop capture window received drag release");
|
||||||
if(Globals.draggedItem != null){
|
if(Globals.draggedItem != null){
|
||||||
//drop item
|
//drop item
|
||||||
ClientInventoryState.clientAttemptEjectItem(Globals.playerEntity,Globals.draggedItem);
|
ClientInventoryState.clientAttemptEjectItem(Globals.clientState.playerEntity,Globals.draggedItem);
|
||||||
//play sound effect
|
//play sound effect
|
||||||
if(Globals.virtualAudioSourceManager != null){
|
if(Globals.virtualAudioSourceManager != null){
|
||||||
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(Globals.draggedItem));
|
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(ItemUtils.getType(Globals.draggedItem));
|
||||||
@ -38,7 +38,7 @@ public class MenuGeneratorsInventory {
|
|||||||
//clear ui
|
//clear ui
|
||||||
WindowUtils.cleanItemDraggingWindow();
|
WindowUtils.cleanItemDraggingWindow();
|
||||||
//re-render inventory
|
//re-render inventory
|
||||||
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.playerEntity));
|
WindowUtils.replaceWindow(WindowStrings.WINDOW_CHARACTER, InventoryMainWindow.createInventoryWindow(Globals.clientState.playerEntity));
|
||||||
//null globals
|
//null globals
|
||||||
Globals.dragSourceInventory = null;
|
Globals.dragSourceInventory = null;
|
||||||
Globals.draggedItem = null;
|
Globals.draggedItem = null;
|
||||||
|
|||||||
@ -42,7 +42,7 @@ public class ToolbarPreviewWindow {
|
|||||||
rVal.setJustifyContent(YogaJustification.End);
|
rVal.setJustifyContent(YogaJustification.End);
|
||||||
|
|
||||||
//attach scrollable after search input for organzation purposes
|
//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);
|
Globals.signalSystem.post(SignalType.YOGA_APPLY,rVal);
|
||||||
|
|
||||||
|
|||||||
@ -74,17 +74,17 @@ void RayCallback(void *Data, dGeomID Geometry1, dGeomID Geometry2) {
|
|||||||
Collidable collidable2 = rayCastData.bodyEntityMap.get(b2);
|
Collidable collidable2 = rayCastData.bodyEntityMap.get(b2);
|
||||||
|
|
||||||
//don't self cast -- should work on both server and client
|
//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;
|
return;
|
||||||
}
|
}
|
||||||
if(collidable2 != null && collidable2.getParent() == Globals.playerEntity){
|
if(collidable2 != null && collidable2.getParent() == Globals.clientState.playerEntity){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//don't collide with entities that are attached to the parent either
|
//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;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -111,7 +111,7 @@ public class CameraHandler {
|
|||||||
|
|
||||||
if(Crosshair.getCrosshairActive()){
|
if(Crosshair.getCrosshairActive()){
|
||||||
|
|
||||||
Vector3d characterPos = EntityUtils.getPosition(Globals.playerEntity);
|
Vector3d characterPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
|
||||||
Vector3d targetPos = Crosshair.getTargetPosition();
|
Vector3d targetPos = Crosshair.getTargetPosition();
|
||||||
Vector3d diffed = new Vector3d(targetPos).sub(characterPos).mul(-1).normalize();
|
Vector3d diffed = new Vector3d(targetPos).sub(characterPos).mul(-1).normalize();
|
||||||
cameraRotationVector.set((float)diffed.x, 0.5f, (float)diffed.z).normalize();
|
cameraRotationVector.set((float)diffed.x, 0.5f, (float)diffed.z).normalize();
|
||||||
@ -132,8 +132,8 @@ public class CameraHandler {
|
|||||||
cameraRotationVector = yawQuat.transform(cameraRotationVector);
|
cameraRotationVector = yawQuat.transform(cameraRotationVector);
|
||||||
cameraRotationVector.normalize();
|
cameraRotationVector.normalize();
|
||||||
}
|
}
|
||||||
if(trackPlayerEntity && Globals.playerEntity != null){
|
if(trackPlayerEntity && Globals.clientState.playerEntity != null){
|
||||||
Vector3d entityPos = EntityUtils.getPosition(Globals.playerEntity);
|
Vector3d entityPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
|
||||||
CameraEntityUtils.setCameraCenter(Globals.playerCamera, new Vector3d(entityPos).add(CameraEntityUtils.getOrbitalCameraRadialOffset(Globals.playerCamera)));
|
CameraEntityUtils.setCameraCenter(Globals.playerCamera, new Vector3d(entityPos).add(CameraEntityUtils.getOrbitalCameraRadialOffset(Globals.playerCamera)));
|
||||||
}
|
}
|
||||||
//update view matrix offset
|
//update view matrix offset
|
||||||
@ -150,10 +150,10 @@ public class CameraHandler {
|
|||||||
if(Globals.controlHandler.cameraIsThirdPerson()){
|
if(Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
perspectiveVal = CameraHandler.CAMERA_PERSPECTIVE_THIRD;
|
perspectiveVal = CameraHandler.CAMERA_PERSPECTIVE_THIRD;
|
||||||
}
|
}
|
||||||
if(Globals.cameraHandler.getTrackPlayerEntity() && Globals.playerEntity != null){
|
if(Globals.cameraHandler.getTrackPlayerEntity() && Globals.clientState.playerEntity != null){
|
||||||
Globals.clientState.clientConnection.queueOutgoingMessage(
|
Globals.clientState.clientConnection.queueOutgoingMessage(
|
||||||
EntityMessage.constructupdateEntityViewDirMessage(
|
EntityMessage.constructupdateEntityViewDirMessage(
|
||||||
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.playerEntity.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(Globals.clientState.playerEntity.getId()),
|
||||||
Globals.timekeeper.getNumberOfSimFramesElapsed(),
|
Globals.timekeeper.getNumberOfSimFramesElapsed(),
|
||||||
perspectiveVal,
|
perspectiveVal,
|
||||||
yaw,
|
yaw,
|
||||||
|
|||||||
@ -561,9 +561,9 @@ public class ControlHandler {
|
|||||||
*/
|
*/
|
||||||
public void setIsThirdPerson(boolean isThirdPerson){
|
public void setIsThirdPerson(boolean isThirdPerson){
|
||||||
this.cameraIsThirdPerson = isThirdPerson;
|
this.cameraIsThirdPerson = isThirdPerson;
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
CameraEntityUtils.initCamera();
|
CameraEntityUtils.initCamera();
|
||||||
ClientEquipState playerEquipState = ClientEquipState.getClientEquipState(Globals.playerEntity);
|
ClientEquipState playerEquipState = ClientEquipState.getClientEquipState(Globals.clientState.playerEntity);
|
||||||
if(playerEquipState != null){
|
if(playerEquipState != null){
|
||||||
playerEquipState.evaluatePlayerAttachments();
|
playerEquipState.evaluatePlayerAttachments();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -127,57 +127,57 @@ public class ControlCategoryMainGame {
|
|||||||
*/
|
*/
|
||||||
mainGameControlList.add(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD));
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
|
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);
|
groundTree.start(MovementRelativeFacing.FORWARD_LEFT);
|
||||||
} else if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).isState()){
|
} 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);
|
groundTree.start(MovementRelativeFacing.FORWARD_RIGHT);
|
||||||
} else {
|
} else {
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
groundTree.start(MovementRelativeFacing.FORWARD);
|
groundTree.start(MovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
|
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);
|
groundTree.start(MovementRelativeFacing.FORWARD_LEFT);
|
||||||
} else if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).isState()){
|
} 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);
|
groundTree.start(MovementRelativeFacing.FORWARD_RIGHT);
|
||||||
} else {
|
} else {
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
groundTree.start(MovementRelativeFacing.FORWARD);
|
groundTree.start(MovementRelativeFacing.FORWARD);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_FORWARD).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
groundTree.slowdown();
|
groundTree.slowdown();
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
clientEditorMovementTree.slowdown();
|
clientEditorMovementTree.slowdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -187,59 +187,59 @@ public class ControlCategoryMainGame {
|
|||||||
*/
|
*/
|
||||||
mainGameControlList.add(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD));
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
|
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);
|
groundTree.start(MovementRelativeFacing.BACKWARD_LEFT);
|
||||||
} else if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).isState()){
|
} 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);
|
groundTree.start(MovementRelativeFacing.BACKWARD_RIGHT);
|
||||||
} else {
|
} else {
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
groundTree.start(MovementRelativeFacing.BACKWARD);
|
groundTree.start(MovementRelativeFacing.BACKWARD);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.BACKWARD);
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).isState()){
|
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);
|
groundTree.start(MovementRelativeFacing.BACKWARD_LEFT);
|
||||||
} else if(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).isState()){
|
} 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);
|
groundTree.start(MovementRelativeFacing.BACKWARD_RIGHT);
|
||||||
} else {
|
} else {
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
groundTree.start(MovementRelativeFacing.BACKWARD);
|
groundTree.start(MovementRelativeFacing.BACKWARD);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.BACKWARD);
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_BACKWARD).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
groundTree.slowdown();
|
groundTree.slowdown();
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
clientEditorMovementTree.slowdown();
|
clientEditorMovementTree.slowdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -249,8 +249,8 @@ public class ControlCategoryMainGame {
|
|||||||
*/
|
*/
|
||||||
mainGameControlList.add(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT));
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
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_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()))
|
(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);
|
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);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
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());
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
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_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()))
|
(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);
|
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);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
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());
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_LEFT).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
groundTree.slowdown();
|
groundTree.slowdown();
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
clientEditorMovementTree.slowdown();
|
clientEditorMovementTree.slowdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -307,8 +307,8 @@ public class ControlCategoryMainGame {
|
|||||||
*/
|
*/
|
||||||
mainGameControlList.add(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT));
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
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_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()))
|
(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);
|
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);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
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());
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
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_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()))
|
(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);
|
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);
|
Vector3d cameraEyeVector = CameraEntityUtils.getCameraEye(Globals.playerCamera);
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
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());
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.FORWARD);
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_RIGHT).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
groundTree.slowdown();
|
groundTree.slowdown();
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
clientEditorMovementTree.slowdown();
|
clientEditorMovementTree.slowdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -374,11 +374,11 @@ public class ControlCategoryMainGame {
|
|||||||
*/
|
*/
|
||||||
mainGameControlList.add(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT));
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
if(
|
if(
|
||||||
(groundTree.getState()==MovementTreeState.IDLE || groundTree.getState()==MovementTreeState.SLOWDOWN) &&
|
(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())) &&
|
(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);
|
groundTree.start(MovementRelativeFacing.LEFT);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.LEFT);
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
if(
|
if(
|
||||||
(groundTree.getState()==MovementTreeState.IDLE || groundTree.getState()==MovementTreeState.SLOWDOWN) &&
|
(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())) &&
|
(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);
|
groundTree.start(MovementRelativeFacing.LEFT);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.LEFT);
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_LEFT).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
groundTree.slowdown();
|
groundTree.slowdown();
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
clientEditorMovementTree.slowdown();
|
clientEditorMovementTree.slowdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -430,11 +430,11 @@ public class ControlCategoryMainGame {
|
|||||||
*/
|
*/
|
||||||
mainGameControlList.add(controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT));
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
if(
|
if(
|
||||||
(groundTree.getState()==MovementTreeState.IDLE || groundTree.getState()==MovementTreeState.SLOWDOWN) &&
|
(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())) &&
|
(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);
|
groundTree.start(MovementRelativeFacing.RIGHT);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.RIGHT);
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).setOnRepeat(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
if(
|
if(
|
||||||
(groundTree.getState()==MovementTreeState.IDLE || groundTree.getState()==MovementTreeState.SLOWDOWN) &&
|
(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())) &&
|
(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);
|
groundTree.start(MovementRelativeFacing.RIGHT);
|
||||||
}
|
}
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
CreatureUtils.setFacingVector(Globals.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
CreatureUtils.setFacingVector(Globals.clientState.playerEntity, CameraEntityUtils.getFacingVec(Globals.playerCamera));
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.RIGHT);
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_STRAFE_RIGHT).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.playerEntity);
|
BehaviorTree movementTree = CreatureUtils.clientGetEntityMovementTree(Globals.clientState.playerEntity);
|
||||||
if(movementTree instanceof ClientGroundMovementTree){
|
if(movementTree instanceof ClientGroundMovementTree){
|
||||||
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
ClientGroundMovementTree groundTree = (ClientGroundMovementTree) movementTree;
|
||||||
groundTree.slowdown();
|
groundTree.slowdown();
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
clientEditorMovementTree.slowdown();
|
clientEditorMovementTree.slowdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -487,20 +487,20 @@ public class ControlCategoryMainGame {
|
|||||||
*/
|
*/
|
||||||
mainGameControlList.add(controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_JUMP));
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_JUMP).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
ClientJumpTree jumpTree = ClientJumpTree.getClientJumpTree(Globals.playerEntity);
|
ClientJumpTree jumpTree = ClientJumpTree.getClientJumpTree(Globals.clientState.playerEntity);
|
||||||
if(jumpTree != null){
|
if(jumpTree != null){
|
||||||
jumpTree.start();
|
jumpTree.start();
|
||||||
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
} else if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.UP);
|
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){
|
controlMap.get(DATA_STRING_INPUT_CODE_MOVEMENT_JUMP).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
clientEditorMovementTree.slowdown();
|
clientEditorMovementTree.slowdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -510,9 +510,9 @@ public class ControlCategoryMainGame {
|
|||||||
*/
|
*/
|
||||||
mainGameControlList.add(controlMap.get(INPUT_CODE_SINK));
|
mainGameControlList.add(controlMap.get(INPUT_CODE_SINK));
|
||||||
controlMap.get(INPUT_CODE_SINK).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
|
controlMap.get(INPUT_CODE_SINK).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
if(ClientToolbarState.hasClientToolbarState(Globals.playerEntity)){
|
if(ClientToolbarState.hasClientToolbarState(Globals.clientState.playerEntity)){
|
||||||
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
|
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.clientState.playerEntity);
|
||||||
if(clientToolbarState.getCurrentPrimaryItem() != null){
|
if(clientToolbarState.getCurrentPrimaryItem() != null){
|
||||||
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(clientToolbarState.getCurrentPrimaryItem());
|
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(clientToolbarState.getCurrentPrimaryItem());
|
||||||
if(Globals.playerCursor != null && Globals.playerBlockCursor != null){
|
if(Globals.playerCursor != null && Globals.playerBlockCursor != null){
|
||||||
@ -522,16 +522,16 @@ public class ControlCategoryMainGame {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.DOWN);
|
clientEditorMovementTree.start(electrosphere.entity.state.movement.editor.ClientEditorMovementTree.EditorMovementRelativeFacing.DOWN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
controlMap.get(INPUT_CODE_SINK).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
|
controlMap.get(INPUT_CODE_SINK).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity) != null){
|
if(ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.playerEntity);
|
ClientEditorMovementTree clientEditorMovementTree = ClientEditorMovementTree.getClientEditorMovementTree(Globals.clientState.playerEntity);
|
||||||
clientEditorMovementTree.slowdown();
|
clientEditorMovementTree.slowdown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -541,16 +541,16 @@ public class ControlCategoryMainGame {
|
|||||||
*/
|
*/
|
||||||
mainGameControlList.add(controlMap.get(INPUT_CODE_SPRINT));
|
mainGameControlList.add(controlMap.get(INPUT_CODE_SPRINT));
|
||||||
controlMap.get(INPUT_CODE_SPRINT).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
|
controlMap.get(INPUT_CODE_SPRINT).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
ClientSprintTree sprintTree = ClientSprintTree.getClientSprintTree(Globals.playerEntity);
|
ClientSprintTree sprintTree = ClientSprintTree.getClientSprintTree(Globals.clientState.playerEntity);
|
||||||
if(sprintTree != null){
|
if(sprintTree != null){
|
||||||
sprintTree.start();
|
sprintTree.start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
controlMap.get(INPUT_CODE_SPRINT).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
|
controlMap.get(INPUT_CODE_SPRINT).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
ClientSprintTree sprintTree = ClientSprintTree.getClientSprintTree(Globals.playerEntity);
|
ClientSprintTree sprintTree = ClientSprintTree.getClientSprintTree(Globals.clientState.playerEntity);
|
||||||
if(sprintTree != null){
|
if(sprintTree != null){
|
||||||
sprintTree.interrupt();
|
sprintTree.interrupt();
|
||||||
}
|
}
|
||||||
@ -562,14 +562,14 @@ public class ControlCategoryMainGame {
|
|||||||
*/
|
*/
|
||||||
mainGameControlList.add(controlMap.get(INPUT_CODE_WALK));
|
mainGameControlList.add(controlMap.get(INPUT_CODE_WALK));
|
||||||
controlMap.get(INPUT_CODE_WALK).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
|
controlMap.get(INPUT_CODE_WALK).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null && ClientWalkTree.getClientWalkTree(Globals.playerEntity) != null){
|
if(Globals.clientState.playerEntity != null && ClientWalkTree.getClientWalkTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientWalkTree clientWalkTree = ClientWalkTree.getClientWalkTree(Globals.playerEntity);
|
ClientWalkTree clientWalkTree = ClientWalkTree.getClientWalkTree(Globals.clientState.playerEntity);
|
||||||
clientWalkTree.start();
|
clientWalkTree.start();
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
controlMap.get(INPUT_CODE_WALK).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
|
controlMap.get(INPUT_CODE_WALK).setOnRelease(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null && ClientWalkTree.getClientWalkTree(Globals.playerEntity) != null){
|
if(Globals.clientState.playerEntity != null && ClientWalkTree.getClientWalkTree(Globals.clientState.playerEntity) != null){
|
||||||
ClientWalkTree clientWalkTree = ClientWalkTree.getClientWalkTree(Globals.playerEntity);
|
ClientWalkTree clientWalkTree = ClientWalkTree.getClientWalkTree(Globals.clientState.playerEntity);
|
||||||
clientWalkTree.interrupt();
|
clientWalkTree.interrupt();
|
||||||
}
|
}
|
||||||
}});
|
}});
|
||||||
@ -635,8 +635,8 @@ public class ControlCategoryMainGame {
|
|||||||
|
|
||||||
|
|
||||||
if(!handled){
|
if(!handled){
|
||||||
if(Globals.playerEntity != null && ClientToolbarState.getClientToolbarState(Globals.playerEntity) != null){
|
if(Globals.clientState.playerEntity != null && ClientToolbarState.getClientToolbarState(Globals.clientState.playerEntity) != null){
|
||||||
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
|
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.clientState.playerEntity);
|
||||||
if(scrollEvent.getScrollAmount() > 0){
|
if(scrollEvent.getScrollAmount() > 0){
|
||||||
clientToolbarState.attemptChangeSelection(clientToolbarState.getSelectedSlot() - 1);
|
clientToolbarState.attemptChangeSelection(clientToolbarState.getSelectedSlot() - 1);
|
||||||
} else {
|
} else {
|
||||||
@ -659,12 +659,12 @@ public class ControlCategoryMainGame {
|
|||||||
*/
|
*/
|
||||||
mainGameControlList.add(controlMap.get(INPUT_CODE_DROP));
|
mainGameControlList.add(controlMap.get(INPUT_CODE_DROP));
|
||||||
controlMap.get(INPUT_CODE_DROP).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
|
controlMap.get(INPUT_CODE_DROP).setOnPress(new ControlMethod(){public void execute(MouseState mouseState){
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
if(ClientEquipState.hasEquipState(Globals.playerEntity)){
|
if(ClientEquipState.hasEquipState(Globals.clientState.playerEntity)){
|
||||||
UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.playerEntity);
|
UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.clientState.playerEntity);
|
||||||
if(inventory.getItems().size() > 0){
|
if(inventory.getItems().size() > 0){
|
||||||
Entity itemToDrop = inventory.getItems().get(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));
|
mainGameControlList.add(controlMap.get(INPUT_CODE_INVENTORY_OPEN));
|
||||||
inventoryControlList.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){
|
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);
|
controlMap.get(INPUT_CODE_INVENTORY_OPEN).setRepeatTimeout(0.5f * Main.targetFrameRate);
|
||||||
|
|
||||||
|
|||||||
@ -527,8 +527,8 @@ public class CursorState {
|
|||||||
*/
|
*/
|
||||||
public void hintClampToExistingBlock(){
|
public void hintClampToExistingBlock(){
|
||||||
Globals.cursorState.setClampToExistingBlock(true);
|
Globals.cursorState.setClampToExistingBlock(true);
|
||||||
if(Globals.playerEntity != null && ClientToolbarState.hasClientToolbarState(Globals.playerEntity)){
|
if(Globals.clientState.playerEntity != null && ClientToolbarState.hasClientToolbarState(Globals.clientState.playerEntity)){
|
||||||
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
|
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.clientState.playerEntity);
|
||||||
if(clientToolbarState.getCurrentPrimaryItem() != null){
|
if(clientToolbarState.getCurrentPrimaryItem() != null){
|
||||||
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(clientToolbarState.getCurrentPrimaryItem());
|
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(clientToolbarState.getCurrentPrimaryItem());
|
||||||
if(Globals.playerCursor != null && Globals.playerBlockCursor != null){
|
if(Globals.playerCursor != null && Globals.playerBlockCursor != null){
|
||||||
@ -545,8 +545,8 @@ public class CursorState {
|
|||||||
*/
|
*/
|
||||||
public void hintClearBlockCursor(){
|
public void hintClearBlockCursor(){
|
||||||
Globals.cursorState.setClampToExistingBlock(false);
|
Globals.cursorState.setClampToExistingBlock(false);
|
||||||
if(Globals.playerEntity != null && ClientToolbarState.hasClientToolbarState(Globals.playerEntity)){
|
if(Globals.clientState.playerEntity != null && ClientToolbarState.hasClientToolbarState(Globals.clientState.playerEntity)){
|
||||||
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.playerEntity);
|
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.clientState.playerEntity);
|
||||||
boolean clearBlockCursor = true;
|
boolean clearBlockCursor = true;
|
||||||
if(clientToolbarState.getCurrentPrimaryItem() != null){
|
if(clientToolbarState.getCurrentPrimaryItem() != null){
|
||||||
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(clientToolbarState.getCurrentPrimaryItem());
|
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(clientToolbarState.getCurrentPrimaryItem());
|
||||||
|
|||||||
@ -358,8 +358,6 @@ public class Globals {
|
|||||||
public static Entity playerBlockCursor;
|
public static Entity playerBlockCursor;
|
||||||
public static Entity playerAreaCursor;
|
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)
|
//the entity for the first person modal (view model)
|
||||||
public static Entity firstPersonEntity;
|
public static Entity firstPersonEntity;
|
||||||
|
|
||||||
@ -660,7 +658,6 @@ public class Globals {
|
|||||||
* Unloads scene
|
* Unloads scene
|
||||||
*/
|
*/
|
||||||
public static void unloadScene(){
|
public static void unloadScene(){
|
||||||
Globals.playerEntity = null;
|
|
||||||
Globals.playerCamera = null;
|
Globals.playerCamera = null;
|
||||||
Globals.firstPersonEntity = null;
|
Globals.firstPersonEntity = null;
|
||||||
Globals.playerManager = new PlayerManager();
|
Globals.playerManager = new PlayerManager();
|
||||||
|
|||||||
@ -278,7 +278,7 @@ public class ClientLoading {
|
|||||||
EntityUtils.getRotation(skybox).rotateX((float)(-Math.PI/2.0f));
|
EntityUtils.getRotation(skybox).rotateX((float)(-Math.PI/2.0f));
|
||||||
EntityUtils.getScale(skybox).mul(600000.0f);
|
EntityUtils.getScale(skybox).mul(600000.0f);
|
||||||
Globals.clientState.clientScene.registerBehaviorTree(() -> {
|
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");
|
Globals.assetManager.queueOverrideMeshShader("Models/environment/skyboxSphere.fbx", "Sphere", "Shaders/entities/skysphere/skysphere.vs", "Shaders/entities/skysphere/skysphere.fs");
|
||||||
|
|
||||||
|
|||||||
@ -50,7 +50,7 @@ public class MainMenuLoading {
|
|||||||
* Resets the client state
|
* Resets the client state
|
||||||
*/
|
*/
|
||||||
private static void resetClientState(){
|
private static void resetClientState(){
|
||||||
Globals.playerEntity = null;
|
Globals.clientState.playerEntity = null;
|
||||||
Globals.clientState.clientSimulation = null;
|
Globals.clientState.clientSimulation = null;
|
||||||
Globals.clientState.clientConnection.setShouldDisconnect(true);
|
Globals.clientState.clientConnection.setShouldDisconnect(true);
|
||||||
Globals.renderingEngine.getPostProcessingPipeline().setApplyBlur(false);
|
Globals.renderingEngine.getPostProcessingPipeline().setApplyBlur(false);
|
||||||
|
|||||||
@ -83,7 +83,7 @@ public class ClientEntityUtils {
|
|||||||
}
|
}
|
||||||
HitboxCollectionState.destroyHitboxState(entity,false);
|
HitboxCollectionState.destroyHitboxState(entity,false);
|
||||||
ClientInteractionEngine.destroyCollidableTemplate(entity);
|
ClientInteractionEngine.destroyCollidableTemplate(entity);
|
||||||
if(entity == Globals.playerEntity && Globals.firstPersonEntity != null){
|
if(entity == Globals.clientState.playerEntity && Globals.firstPersonEntity != null){
|
||||||
ClientEntityUtils.destroyEntity(Globals.firstPersonEntity);
|
ClientEntityUtils.destroyEntity(Globals.firstPersonEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -151,7 +151,7 @@ public class StateTransitionUtil {
|
|||||||
|
|
||||||
//
|
//
|
||||||
//play audio
|
//play audio
|
||||||
if(parent == Globals.playerEntity && !Globals.controlHandler.cameraIsThirdPerson() && animation != null){
|
if(parent == Globals.clientState.playerEntity && !Globals.controlHandler.cameraIsThirdPerson() && animation != null){
|
||||||
//first person
|
//first person
|
||||||
//play first person audio
|
//play first person audio
|
||||||
if(Globals.audioEngine.initialized() && audioData != null && audioData.getAudioPath() != null){
|
if(Globals.audioEngine.initialized() && audioData != null && audioData.getAudioPath() != null){
|
||||||
|
|||||||
@ -622,7 +622,7 @@ public class AttachUtils {
|
|||||||
getChildrenList(parent).remove(toAttach);
|
getChildrenList(parent).remove(toAttach);
|
||||||
}
|
}
|
||||||
//special case handling for view model
|
//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);
|
getChildrenList(Globals.firstPersonEntity).remove(toAttach);
|
||||||
}
|
}
|
||||||
return bone;
|
return bone;
|
||||||
|
|||||||
@ -565,7 +565,7 @@ public class ClientAttackTree implements BehaviorTree {
|
|||||||
if(this.currentMove != null && this.currentMove.getHitstun() != null){
|
if(this.currentMove != null && this.currentMove.getHitstun() != null){
|
||||||
String animName = this.currentMove.getAttackState().getAnimation().getNameThirdPerson();
|
String animName = this.currentMove.getAttackState().getAnimation().getNameThirdPerson();
|
||||||
actor.setFreezeFrames(animName, this.currentMove.getHitstun());
|
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);
|
Actor viewmodelActor = EntityUtils.getActor(Globals.firstPersonEntity);
|
||||||
animName = this.currentMove.getAttackState().getAnimation().getNameFirstPerson();
|
animName = this.currentMove.getAttackState().getAnimation().getNameFirstPerson();
|
||||||
viewmodelActor.setFreezeFrames(animName, this.currentMove.getHitstun());
|
viewmodelActor.setFreezeFrames(animName, this.currentMove.getHitstun());
|
||||||
|
|||||||
@ -164,7 +164,7 @@ public class FirstPersonTree implements BehaviorTree {
|
|||||||
* @param priority The priority of the animation
|
* @param priority The priority of the animation
|
||||||
*/
|
*/
|
||||||
public static void conditionallyPlayAnimation(Entity entity, String animationName, int priority, double offset){
|
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);
|
FirstPersonTree.getTree(Globals.firstPersonEntity).playAnimation(animationName, priority);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -185,7 +185,7 @@ public class FirstPersonTree implements BehaviorTree {
|
|||||||
* @param animationName the name of the animation
|
* @param animationName the name of the animation
|
||||||
*/
|
*/
|
||||||
public static void conditionallyPlayAnimation(Entity entity, TreeDataAnimation 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);
|
FirstPersonTree.getTree(Globals.firstPersonEntity).playAnimation(animation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -197,7 +197,7 @@ public class FirstPersonTree implements BehaviorTree {
|
|||||||
* @param offset The offset to start the animation at
|
* @param offset The offset to start the animation at
|
||||||
*/
|
*/
|
||||||
public static void conditionallyPlayAnimation(Entity entity, TreeDataAnimation animation, double offset){
|
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);
|
FirstPersonTree.getTree(Globals.firstPersonEntity).playAnimation(animation,offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -208,7 +208,7 @@ public class FirstPersonTree implements BehaviorTree {
|
|||||||
* @param animation The animation
|
* @param animation The animation
|
||||||
*/
|
*/
|
||||||
public static void conditionallyInterruptAnimation(Entity entity, TreeDataAnimation 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);
|
FirstPersonTree.getTree(Globals.firstPersonEntity).interruptAnimation(animation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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)
|
* This should be used when we change the camera of the player (IE from first to third person or vice versa)
|
||||||
*/
|
*/
|
||||||
public void evaluatePlayerAttachments(){
|
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!"));
|
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()){
|
if(Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
for(String occupiedPoint : this.getEquippedPoints()){
|
for(String occupiedPoint : this.getEquippedPoints()){
|
||||||
EquipPoint point = this.getEquipPoint(occupiedPoint);
|
EquipPoint point = this.getEquipPoint(occupiedPoint);
|
||||||
Entity toEquip = this.equipMap.get(point.getEquipPointId());
|
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.clientDetatchEntityFromEntityAtBone(Globals.firstPersonEntity, toEquip);
|
||||||
AttachUtils.clientAttachEntityToEntityAtBone(
|
AttachUtils.clientAttachEntityToEntityAtBone(
|
||||||
Globals.playerEntity,
|
Globals.clientState.playerEntity,
|
||||||
toEquip,
|
toEquip,
|
||||||
point.getBone(),
|
point.getBone(),
|
||||||
AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorThirdPerson()),
|
AttachUtils.getEquipPointVectorOffset(point.getOffsetVectorThirdPerson()),
|
||||||
AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())
|
AttachUtils.getEquipPointRotationOffset(point.getOffsetRotationThirdPerson())
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
AttachUtils.clientUpdateEntityTransforms(toEquip, Globals.playerEntity);
|
AttachUtils.clientUpdateEntityTransforms(toEquip, Globals.clientState.playerEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -427,7 +427,7 @@ public class ClientEquipState implements BehaviorTree {
|
|||||||
EquipPoint point = this.getEquipPoint(occupiedPoint);
|
EquipPoint point = this.getEquipPoint(occupiedPoint);
|
||||||
Entity toEquip = this.equipMap.get(point.getEquipPointId());
|
Entity toEquip = this.equipMap.get(point.getEquipPointId());
|
||||||
if(AttachUtils.getParent(toEquip) != Globals.firstPersonEntity){
|
if(AttachUtils.getParent(toEquip) != Globals.firstPersonEntity){
|
||||||
AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.playerEntity, toEquip);
|
AttachUtils.clientDetatchEntityFromEntityAtBone(Globals.clientState.playerEntity, toEquip);
|
||||||
AttachUtils.clientAttachEntityToEntityAtBone(
|
AttachUtils.clientAttachEntityToEntityAtBone(
|
||||||
Globals.firstPersonEntity,
|
Globals.firstPersonEntity,
|
||||||
toEquip,
|
toEquip,
|
||||||
|
|||||||
@ -183,7 +183,7 @@ public class ClientToolbarState implements BehaviorTree {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//cursor logic
|
//cursor logic
|
||||||
if(targetPoint != null && parent == Globals.playerEntity){
|
if(targetPoint != null && parent == Globals.clientState.playerEntity){
|
||||||
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(toEquip);
|
Item itemData = Globals.gameConfigCurrent.getItemMap().getItem(toEquip);
|
||||||
if(Globals.playerCursor != null && Globals.playerBlockCursor != null){
|
if(Globals.playerCursor != null && Globals.playerBlockCursor != null){
|
||||||
CursorState.hide();
|
CursorState.hide();
|
||||||
@ -396,7 +396,7 @@ public class ClientToolbarState implements BehaviorTree {
|
|||||||
public void simulate(float deltaTime) {
|
public void simulate(float deltaTime) {
|
||||||
if(this.previousFrameSlot != this.selectedSlot){
|
if(this.previousFrameSlot != this.selectedSlot){
|
||||||
this.previousFrameSlot = this.selectedSlot;
|
this.previousFrameSlot = this.selectedSlot;
|
||||||
if(this.parent == Globals.playerEntity){
|
if(this.parent == Globals.clientState.playerEntity){
|
||||||
ToolbarPreviewWindow.reveal();
|
ToolbarPreviewWindow.reveal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -323,8 +323,8 @@ public class HitboxCollectionState {
|
|||||||
if(!this.geoms.isEmpty()){
|
if(!this.geoms.isEmpty()){
|
||||||
Vector3d entityPosition = EntityUtils.getPosition(parent);
|
Vector3d entityPosition = EntityUtils.getPosition(parent);
|
||||||
double distanceToPlayer = 0;
|
double distanceToPlayer = 0;
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
Vector3d playerPos = EntityUtils.getPosition(Globals.playerEntity);
|
Vector3d playerPos = EntityUtils.getPosition(Globals.clientState.playerEntity);
|
||||||
distanceToPlayer = entityPosition.distance(playerPos);
|
distanceToPlayer = entityPosition.distance(playerPos);
|
||||||
}
|
}
|
||||||
if(distanceToPlayer > CLIENT_DISABLE_DISTANCE){
|
if(distanceToPlayer > CLIENT_DISABLE_DISTANCE){
|
||||||
|
|||||||
@ -305,7 +305,7 @@ public class ClientInventoryState implements BehaviorTree {
|
|||||||
public static void clientAttemptStoreItem(Entity creature, Entity item){
|
public static void clientAttemptStoreItem(Entity creature, Entity item){
|
||||||
//tell the server we want to try the transform
|
//tell the server we want to try the transform
|
||||||
NetworkMessage requestPickupMessage = InventoryMessage.constructaddItemToInventoryMessage(
|
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()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(item.getId()),
|
||||||
ItemUtils.getType(item)
|
ItemUtils.getType(item)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -139,7 +139,7 @@ public class ClientEditorMovementTree implements BehaviorTree {
|
|||||||
Vector3d position = EntityUtils.getPosition(parent);
|
Vector3d position = EntityUtils.getPosition(parent);
|
||||||
Quaterniond rotation = EntityUtils.getRotation(parent);
|
Quaterniond rotation = EntityUtils.getRotation(parent);
|
||||||
float velocity = CreatureUtils.getVelocity(parent);
|
float velocity = CreatureUtils.getVelocity(parent);
|
||||||
if(this.parent == Globals.playerEntity){
|
if(this.parent == Globals.clientState.playerEntity){
|
||||||
Globals.clientState.clientConnection.queueOutgoingMessage(
|
Globals.clientState.clientConnection.queueOutgoingMessage(
|
||||||
EntityMessage.constructmoveUpdateMessage(
|
EntityMessage.constructmoveUpdateMessage(
|
||||||
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||||
@ -169,7 +169,7 @@ public class ClientEditorMovementTree implements BehaviorTree {
|
|||||||
Vector3d position = EntityUtils.getPosition(parent);
|
Vector3d position = EntityUtils.getPosition(parent);
|
||||||
Quaterniond rotation = EntityUtils.getRotation(parent);
|
Quaterniond rotation = EntityUtils.getRotation(parent);
|
||||||
float velocity = CreatureUtils.getVelocity(parent);
|
float velocity = CreatureUtils.getVelocity(parent);
|
||||||
if(this.parent == Globals.playerEntity){
|
if(this.parent == Globals.clientState.playerEntity){
|
||||||
Globals.clientState.clientConnection.queueOutgoingMessage(
|
Globals.clientState.clientConnection.queueOutgoingMessage(
|
||||||
EntityMessage.constructmoveUpdateMessage(
|
EntityMessage.constructmoveUpdateMessage(
|
||||||
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||||
|
|||||||
@ -139,7 +139,7 @@ public class ClientFallTree implements BehaviorTree {
|
|||||||
}
|
}
|
||||||
FirstPersonTree.conditionallyPlayAnimation(parent, fallMovementSystem.getLandState().getAnimation());
|
FirstPersonTree.conditionallyPlayAnimation(parent, fallMovementSystem.getLandState().getAnimation());
|
||||||
}
|
}
|
||||||
if(parent == Globals.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
|
if(parent == Globals.clientState.playerEntity && !Globals.controlHandler.cameraIsThirdPerson()){
|
||||||
//first person
|
//first person
|
||||||
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.LAND, EntityUtils.getPosition(parent));
|
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.LAND, EntityUtils.getPosition(parent));
|
||||||
//play first person audio
|
//play first person audio
|
||||||
|
|||||||
@ -147,7 +147,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
|
|||||||
Vector3d position = EntityUtils.getPosition(parent);
|
Vector3d position = EntityUtils.getPosition(parent);
|
||||||
Quaterniond rotation = EntityUtils.getRotation(parent);
|
Quaterniond rotation = EntityUtils.getRotation(parent);
|
||||||
float velocity = CreatureUtils.getVelocity(parent);
|
float velocity = CreatureUtils.getVelocity(parent);
|
||||||
if(this.parent == Globals.playerEntity){
|
if(this.parent == Globals.clientState.playerEntity){
|
||||||
Globals.clientState.clientConnection.queueOutgoingMessage(
|
Globals.clientState.clientConnection.queueOutgoingMessage(
|
||||||
EntityMessage.constructmoveUpdateMessage(
|
EntityMessage.constructmoveUpdateMessage(
|
||||||
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||||
@ -177,7 +177,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
|
|||||||
Vector3d position = EntityUtils.getPosition(parent);
|
Vector3d position = EntityUtils.getPosition(parent);
|
||||||
Quaterniond rotation = EntityUtils.getRotation(parent);
|
Quaterniond rotation = EntityUtils.getRotation(parent);
|
||||||
float velocity = CreatureUtils.getVelocity(parent);
|
float velocity = CreatureUtils.getVelocity(parent);
|
||||||
if(this.parent == Globals.playerEntity){
|
if(this.parent == Globals.clientState.playerEntity){
|
||||||
Globals.clientState.clientConnection.queueOutgoingMessage(
|
Globals.clientState.clientConnection.queueOutgoingMessage(
|
||||||
EntityMessage.constructmoveUpdateMessage(
|
EntityMessage.constructmoveUpdateMessage(
|
||||||
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
Globals.clientState.clientSceneWrapper.mapClientToServerId(parent.getId()),
|
||||||
@ -542,7 +542,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
|
|||||||
animationTime > firstOffset
|
animationTime > firstOffset
|
||||||
){
|
){
|
||||||
this.playedFootstepFirst = true;
|
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);
|
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.STEP_BARE_REG, position);
|
||||||
} else {
|
} else {
|
||||||
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.STEP_BARE_REG, position);
|
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.STEP_BARE_REG, position);
|
||||||
@ -555,7 +555,7 @@ public class ClientGroundMovementTree implements BehaviorTree {
|
|||||||
animationTime > secondOffset
|
animationTime > secondOffset
|
||||||
){
|
){
|
||||||
this.playedFootstepSecond = true;
|
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);
|
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.STEP_BARE_REG, position);
|
||||||
} else {
|
} else {
|
||||||
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.STEP_BARE_REG, position);
|
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.STEP_BARE_REG, position);
|
||||||
|
|||||||
@ -322,7 +322,7 @@ public class ClientJumpTree implements BehaviorTree {
|
|||||||
case INACTIVE: {
|
case INACTIVE: {
|
||||||
} break;
|
} break;
|
||||||
case ACTIVE: {
|
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));
|
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.JUMP, EntityUtils.getPosition(parent));
|
||||||
} else {
|
} else {
|
||||||
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.JUMP, EntityUtils.getPosition(parent));
|
Globals.movementAudioService.playAudioPositional(ClientVoxelSampler.getVoxelTypeBeneathEntity(parent), InteractionType.JUMP, EntityUtils.getPosition(parent));
|
||||||
|
|||||||
@ -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
|
//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){
|
if(position.distance(EntityUtils.getPosition(parent)) > FoliageCellManager.TELEPORT_DISTANCE){
|
||||||
Globals.clientState.clientDrawCellManager.bustDistanceCache();
|
Globals.clientState.clientDrawCellManager.bustDistanceCache();
|
||||||
Globals.clientState.foliageCellManager.bustDistanceCache();
|
Globals.clientState.foliageCellManager.bustDistanceCache();
|
||||||
|
|||||||
@ -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((float)facingVector.x,(float)facingVector.y,(float)facingVector.z).rotateY((float)Math.PI/2.0f).normalize();
|
||||||
Vector3f rotationAxis = new Vector3f(1,0,0);
|
Vector3f rotationAxis = new Vector3f(1,0,0);
|
||||||
float rotationRaw = 0.0f;
|
float rotationRaw = 0.0f;
|
||||||
if(parent == Globals.playerEntity){
|
if(parent == Globals.clientState.playerEntity){
|
||||||
rotationRaw = Globals.cameraHandler.getPitch();
|
rotationRaw = Globals.cameraHandler.getPitch();
|
||||||
} else {
|
} else {
|
||||||
rotationRaw = ViewUtils.getPitch(parent);
|
rotationRaw = ViewUtils.getPitch(parent);
|
||||||
|
|||||||
@ -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((float)facingVector.x,(float)facingVector.y,(float)facingVector.z).rotateY((float)Math.PI/2.0f).normalize();
|
||||||
Vector3f rotationAxis = new Vector3f(1,0,0);
|
Vector3f rotationAxis = new Vector3f(1,0,0);
|
||||||
float rotationRaw = 0.0f;
|
float rotationRaw = 0.0f;
|
||||||
if(parent == Globals.playerEntity){
|
if(parent == Globals.clientState.playerEntity){
|
||||||
rotationRaw = Globals.cameraHandler.getPitch();
|
rotationRaw = Globals.cameraHandler.getPitch();
|
||||||
} else {
|
} else {
|
||||||
rotationRaw = ViewUtils.getPitch(parent);
|
rotationRaw = ViewUtils.getPitch(parent);
|
||||||
|
|||||||
@ -190,7 +190,7 @@ public class EntityProtocol implements ClientProtocolTemplate<EntityMessage> {
|
|||||||
if(Globals.clientState.clientPlayer != null && message.getpropertyValue() == Globals.clientState.clientPlayer.getId()){
|
if(Globals.clientState.clientPlayer != null && message.getpropertyValue() == Globals.clientState.clientPlayer.getId()){
|
||||||
LoggerInterface.loggerNetworking.DEBUG("Set this player's entity id!");
|
LoggerInterface.loggerNetworking.DEBUG("Set this player's entity id!");
|
||||||
Globals.clientCharacterID = message.getentityID();
|
Globals.clientCharacterID = message.getentityID();
|
||||||
Globals.playerEntity = target;
|
Globals.clientState.playerEntity = target;
|
||||||
if(viewModelData != null && viewModelData.getFirstPersonModelPath() != null){
|
if(viewModelData != null && viewModelData.getFirstPersonModelPath() != null){
|
||||||
Globals.firstPersonEntity = CreatureUtils.clientCreateViewModel(
|
Globals.firstPersonEntity = CreatureUtils.clientCreateViewModel(
|
||||||
creatureTypeRaw,
|
creatureTypeRaw,
|
||||||
|
|||||||
@ -21,63 +21,63 @@ public class InventoryProtocol implements ClientProtocolTemplate<InventoryMessag
|
|||||||
switch(message.getMessageSubtype()){
|
switch(message.getMessageSubtype()){
|
||||||
case ADDITEMTOINVENTORY:
|
case ADDITEMTOINVENTORY:
|
||||||
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] ADD ITEM TO INVENTORY " + message.getentityId());
|
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] ADD ITEM TO INVENTORY " + message.getentityId());
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
ClientInventoryState inventoryState;
|
ClientInventoryState inventoryState;
|
||||||
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.playerEntity))!=null){
|
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.clientState.playerEntity))!=null){
|
||||||
inventoryState.addNetworkMessage(message);
|
inventoryState.addNetworkMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SERVERCOMMANDEQUIPITEM: {
|
case SERVERCOMMANDEQUIPITEM: {
|
||||||
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] EQUIP ITEM " + message.getentityId());
|
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] EQUIP ITEM " + message.getentityId());
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
ClientInventoryState inventoryState;
|
ClientInventoryState inventoryState;
|
||||||
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.playerEntity))!=null){
|
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.clientState.playerEntity))!=null){
|
||||||
inventoryState.addNetworkMessage(message);
|
inventoryState.addNetworkMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case REMOVEITEMFROMINVENTORY:
|
case REMOVEITEMFROMINVENTORY:
|
||||||
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] REMOVE ITEM FROM INVENTORY " + message.getentityId());
|
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] REMOVE ITEM FROM INVENTORY " + message.getentityId());
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
ClientInventoryState inventoryState;
|
ClientInventoryState inventoryState;
|
||||||
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.playerEntity))!=null){
|
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.clientState.playerEntity))!=null){
|
||||||
inventoryState.addNetworkMessage(message);
|
inventoryState.addNetworkMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SERVERCOMMANDMOVEITEMCONTAINER:
|
case SERVERCOMMANDMOVEITEMCONTAINER:
|
||||||
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] MOVE ITEM INVENTORY " + message.getentityId());
|
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] MOVE ITEM INVENTORY " + message.getentityId());
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
ClientInventoryState inventoryState;
|
ClientInventoryState inventoryState;
|
||||||
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.playerEntity))!=null){
|
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.clientState.playerEntity))!=null){
|
||||||
inventoryState.addNetworkMessage(message);
|
inventoryState.addNetworkMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SERVERCOMMANDUNEQUIPITEM: {
|
case SERVERCOMMANDUNEQUIPITEM: {
|
||||||
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] UNEQUIP ITEM " + message.getentityId());
|
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] UNEQUIP ITEM " + message.getentityId());
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
ClientInventoryState inventoryState;
|
ClientInventoryState inventoryState;
|
||||||
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.playerEntity))!=null){
|
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.clientState.playerEntity))!=null){
|
||||||
inventoryState.addNetworkMessage(message);
|
inventoryState.addNetworkMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case SERVERUPDATEITEMCHARGES: {
|
case SERVERUPDATEITEMCHARGES: {
|
||||||
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] SET CHARGES OF " + message.getentityId());
|
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] SET CHARGES OF " + message.getentityId());
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
ClientInventoryState inventoryState;
|
ClientInventoryState inventoryState;
|
||||||
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.playerEntity))!=null){
|
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.clientState.playerEntity))!=null){
|
||||||
inventoryState.addNetworkMessage(message);
|
inventoryState.addNetworkMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case SERVERCOMMANDSTOREITEM: {
|
case SERVERCOMMANDSTOREITEM: {
|
||||||
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] STORE " + message.getitemEntId());
|
LoggerInterface.loggerNetworking.DEBUG("[CLIENT] STORE " + message.getitemEntId());
|
||||||
if(Globals.playerEntity != null){
|
if(Globals.clientState.playerEntity != null){
|
||||||
ClientInventoryState inventoryState;
|
ClientInventoryState inventoryState;
|
||||||
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.playerEntity))!=null){
|
if((inventoryState = ClientInventoryState.getClientInventoryState(Globals.clientState.playerEntity))!=null){
|
||||||
inventoryState.addNetworkMessage(message);
|
inventoryState.addNetworkMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,13 +99,13 @@ public class FirstPersonItemsPipeline implements RenderPipeline {
|
|||||||
Matrix4d rotationMat = CameraEntityUtils.getRotationMat(Globals.playerCamera);
|
Matrix4d rotationMat = CameraEntityUtils.getRotationMat(Globals.playerCamera);
|
||||||
EntityUtils.getRotation(Globals.firstPersonEntity).set(CameraEntityUtils.getRotationQuat(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
|
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);
|
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);
|
EntityUtils.getPosition(Globals.firstPersonEntity).set(playerPos).add(0.0f,tree.getHeightFromOrigin(),0.0f).add(behindCameraOffset);
|
||||||
|
|
||||||
if(ClientEquipState.hasEquipState(Globals.playerEntity)){
|
if(ClientEquipState.hasEquipState(Globals.clientState.playerEntity)){
|
||||||
ClientEquipState clientEquipState = ClientEquipState.getClientEquipState(Globals.playerEntity);
|
ClientEquipState clientEquipState = ClientEquipState.getClientEquipState(Globals.clientState.playerEntity);
|
||||||
clientEquipState.evaluatePlayerAttachments();
|
clientEquipState.evaluatePlayerAttachments();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -276,13 +276,13 @@ public class MainContentPipeline implements RenderPipeline {
|
|||||||
|
|
||||||
//don't draw third person view if camera is first person
|
//don't draw third person view if camera is first person
|
||||||
(
|
(
|
||||||
entity == Globals.playerEntity &&
|
entity == Globals.clientState.playerEntity &&
|
||||||
!Globals.controlHandler.cameraIsThirdPerson()
|
!Globals.controlHandler.cameraIsThirdPerson()
|
||||||
) ||
|
) ||
|
||||||
(
|
(
|
||||||
!Globals.controlHandler.cameraIsThirdPerson() &&
|
!Globals.controlHandler.cameraIsThirdPerson() &&
|
||||||
AttachUtils.getParent(entity) != null &&
|
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
|
//don't draw items if they're attached to viewmodel
|
||||||
|
|||||||
@ -116,13 +116,13 @@ public class NormalsForOutlinePipeline implements RenderPipeline {
|
|||||||
|
|
||||||
//don't draw third person view if camera is first person
|
//don't draw third person view if camera is first person
|
||||||
(
|
(
|
||||||
entity == Globals.playerEntity &&
|
entity == Globals.clientState.playerEntity &&
|
||||||
!Globals.controlHandler.cameraIsThirdPerson()
|
!Globals.controlHandler.cameraIsThirdPerson()
|
||||||
) ||
|
) ||
|
||||||
(
|
(
|
||||||
!Globals.controlHandler.cameraIsThirdPerson() &&
|
!Globals.controlHandler.cameraIsThirdPerson() &&
|
||||||
AttachUtils.getParent(entity) != null &&
|
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
|
//don't draw items if they're attached to viewmodel
|
||||||
|
|||||||
@ -129,7 +129,7 @@ public class DebugContentPipeline implements RenderPipeline {
|
|||||||
}
|
}
|
||||||
if(Globals.userSettings.getGraphicsDebugDrawCollisionSpheresServer()){
|
if(Globals.userSettings.getGraphicsDebugDrawCollisionSpheresServer()){
|
||||||
Model hitboxModel;
|
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);
|
Entity serverPlayerEntity = EntityLookupUtils.getEntityById(serverIdForClientEntity);
|
||||||
Realm playerRealm = Globals.realmManager.getEntityRealm(serverPlayerEntity);
|
Realm playerRealm = Globals.realmManager.getEntityRealm(serverPlayerEntity);
|
||||||
List<HitboxCollectionState> hitboxStates = new LinkedList<HitboxCollectionState>(playerRealm.getHitboxManager().getAllHitboxes());
|
List<HitboxCollectionState> hitboxStates = new LinkedList<HitboxCollectionState>(playerRealm.getHitboxManager().getAllHitboxes());
|
||||||
|
|||||||
@ -108,16 +108,16 @@ public class ClientEquipStateTests extends EntityTestTemplate {
|
|||||||
|
|
||||||
//try to store item in inventory
|
//try to store item in inventory
|
||||||
Entity katanaOnClient = clientSideItems.iterator().next();
|
Entity katanaOnClient = clientSideItems.iterator().next();
|
||||||
ClientInventoryState.clientAttemptStoreItem(Globals.playerEntity, katanaOnClient);
|
ClientInventoryState.clientAttemptStoreItem(Globals.clientState.playerEntity, katanaOnClient);
|
||||||
|
|
||||||
//wait for server to perform transform
|
//wait for server to perform transform
|
||||||
TestEngineUtils.simulateFrames(5);
|
TestEngineUtils.simulateFrames(5);
|
||||||
|
|
||||||
//try equipping
|
//try equipping
|
||||||
UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.playerEntity);
|
UnrelationalInventoryState inventory = InventoryUtils.getNaturalInventory(Globals.clientState.playerEntity);
|
||||||
assertEquals(1, inventory.getItems().size());
|
assertEquals(1, inventory.getItems().size());
|
||||||
Entity inInventoryItem = inventory.getItems().get(0);
|
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"));
|
clientEquipState.commandAttemptEquip(inInventoryItem, clientEquipState.getEquipPoint("handsCombined"));
|
||||||
|
|
||||||
//propagate to client
|
//propagate to client
|
||||||
|
|||||||
@ -46,7 +46,7 @@ public class InventoryUtilsTests extends EntityTestTemplate {
|
|||||||
//grab player entity
|
//grab player entity
|
||||||
Entity clientCreature = clientSideCreatures.iterator().next();
|
Entity clientCreature = clientSideCreatures.iterator().next();
|
||||||
Entity clientKatana = TestEngineUtils.getClientEquivalent(katana);
|
Entity clientKatana = TestEngineUtils.getClientEquivalent(katana);
|
||||||
Globals.playerEntity = clientCreature;
|
Globals.clientState.playerEntity = clientCreature;
|
||||||
|
|
||||||
//attempt to store
|
//attempt to store
|
||||||
ClientInventoryState.clientAttemptStoreItem(clientCreature, clientKatana);
|
ClientInventoryState.clientAttemptStoreItem(clientCreature, clientKatana);
|
||||||
@ -99,7 +99,7 @@ public class InventoryUtilsTests extends EntityTestTemplate {
|
|||||||
//grab player entity
|
//grab player entity
|
||||||
Entity clientCreature = clientSideCreatures.iterator().next();
|
Entity clientCreature = clientSideCreatures.iterator().next();
|
||||||
Entity clientKatana = TestEngineUtils.getClientEquivalent(katana);
|
Entity clientKatana = TestEngineUtils.getClientEquivalent(katana);
|
||||||
Globals.playerEntity = clientCreature;
|
Globals.clientState.playerEntity = clientCreature;
|
||||||
|
|
||||||
//attempt to store
|
//attempt to store
|
||||||
ClientInventoryState.clientAttemptStoreItem(clientCreature, clientKatana);
|
ClientInventoryState.clientAttemptStoreItem(clientCreature, clientKatana);
|
||||||
@ -158,7 +158,7 @@ public class InventoryUtilsTests extends EntityTestTemplate {
|
|||||||
|
|
||||||
//grab player entity
|
//grab player entity
|
||||||
Entity clientCreature = clientSideCreatures.iterator().next();
|
Entity clientCreature = clientSideCreatures.iterator().next();
|
||||||
Globals.playerEntity = clientCreature;
|
Globals.clientState.playerEntity = clientCreature;
|
||||||
|
|
||||||
//try creating the item on the client
|
//try creating the item on the client
|
||||||
ClientInventoryState.clientConstructInInventoryItem(clientCreature, "Katana2H");
|
ClientInventoryState.clientConstructInInventoryItem(clientCreature, "Katana2H");
|
||||||
|
|||||||
@ -48,7 +48,7 @@ public class ItemUtilsTests extends EntityTestTemplate {
|
|||||||
|
|
||||||
//grab player entity
|
//grab player entity
|
||||||
Entity clientCreature = clientSideCreatures.iterator().next();
|
Entity clientCreature = clientSideCreatures.iterator().next();
|
||||||
Globals.playerEntity = clientCreature;
|
Globals.clientState.playerEntity = clientCreature;
|
||||||
|
|
||||||
//attempt to store
|
//attempt to store
|
||||||
Item item = Globals.gameConfigCurrent.getItemMap().getItem("Katana2H");
|
Item item = Globals.gameConfigCurrent.getItemMap().getItem("Katana2H");
|
||||||
|
|||||||
@ -45,7 +45,7 @@ public class TestViewportUtils {
|
|||||||
|
|
||||||
//wait for player to spawn
|
//wait for player to spawn
|
||||||
int frames = 0;
|
int frames = 0;
|
||||||
while(Globals.playerEntity == null){
|
while(Globals.clientState.playerEntity == null){
|
||||||
TestEngineUtils.simulateFrames(1);
|
TestEngineUtils.simulateFrames(1);
|
||||||
try {
|
try {
|
||||||
TimeUnit.MILLISECONDS.sleep(1);
|
TimeUnit.MILLISECONDS.sleep(1);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user