move cursor entities
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
6d98af90ac
commit
a2b5de8863
@ -1808,6 +1808,7 @@ 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 playerEntity to clientState
|
||||||
|
Move global cursor entities into cursorState
|
||||||
Move lots of global state to clientState
|
Move lots of global state to clientState
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@ public class ScriptClientAreaUtils {
|
|||||||
@Export
|
@Export
|
||||||
public static void selectAreaRectangular(){
|
public static void selectAreaRectangular(){
|
||||||
// Vector3d blockCursorPos = Globals.cursorState.getBlockCursorPos();
|
// Vector3d blockCursorPos = Globals.cursorState.getBlockCursorPos();
|
||||||
Vector3d cursorPos = new Vector3d(EntityUtils.getPosition(Globals.playerCursor));
|
Vector3d cursorPos = new Vector3d(EntityUtils.getPosition(Globals.cursorState.playerCursor));
|
||||||
Vector3i chunkPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(cursorPos);
|
Vector3i chunkPos = Globals.clientState.clientWorldData.convertRealToWorldSpace(cursorPos);
|
||||||
Vector3i blockPos = Globals.clientState.clientWorldData.convertRealToBlockSpace(cursorPos);
|
Vector3i blockPos = Globals.clientState.clientWorldData.convertRealToBlockSpace(cursorPos);
|
||||||
AreaSelection selection = AreaSelection.selectRectangularBlockCavity(chunkPos, blockPos, AreaSelection.DEFAULT_SELECTION_RADIUS);
|
AreaSelection selection = AreaSelection.selectRectangularBlockCavity(chunkPos, blockPos, AreaSelection.DEFAULT_SELECTION_RADIUS);
|
||||||
|
|||||||
@ -515,7 +515,7 @@ public class ControlCategoryMainGame {
|
|||||||
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.clientState.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.cursorState.playerCursor != null && Globals.cursorState.playerBlockCursor != null){
|
||||||
if(itemData.getTokens().contains(CursorState.CURSOR_BLOCK_TOKEN)) {
|
if(itemData.getTokens().contains(CursorState.CURSOR_BLOCK_TOKEN)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -616,7 +616,7 @@ public class ControlCategoryMainGame {
|
|||||||
!Globals.controlCallback.getKey(GLFW.GLFW_KEY_LEFT_SHIFT)
|
!Globals.controlCallback.getKey(GLFW.GLFW_KEY_LEFT_SHIFT)
|
||||||
){
|
){
|
||||||
//if the block cursor is visible, capture this input and instead modify block cursor
|
//if the block cursor is visible, capture this input and instead modify block cursor
|
||||||
if(Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerBlockCursor)){
|
if(Globals.clientState.clientScene.getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.cursorState.playerBlockCursor)){
|
||||||
Globals.cursorState.updateCursorSize(scrollEvent);
|
Globals.cursorState.updateCursorSize(scrollEvent);
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -92,6 +92,21 @@ public class CursorState {
|
|||||||
*/
|
*/
|
||||||
private boolean clampToExistingBlock = false;
|
private boolean clampToExistingBlock = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Free point selection cursor
|
||||||
|
*/
|
||||||
|
public Entity playerCursor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block cursor
|
||||||
|
*/
|
||||||
|
public Entity playerBlockCursor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Area cursor
|
||||||
|
*/
|
||||||
|
public Entity playerAreaCursor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The fab cursor
|
* The fab cursor
|
||||||
*/
|
*/
|
||||||
@ -134,31 +149,31 @@ public class CursorState {
|
|||||||
*/
|
*/
|
||||||
public static void createCursorEntities(){
|
public static void createCursorEntities(){
|
||||||
//player's cursor
|
//player's cursor
|
||||||
Globals.playerCursor = EntityCreationUtils.createClientSpatialEntity();
|
Globals.cursorState.playerCursor = EntityCreationUtils.createClientSpatialEntity();
|
||||||
EntityCreationUtils.makeEntityDrawable(Globals.playerCursor, AssetDataStrings.UNITSPHERE);
|
EntityCreationUtils.makeEntityDrawable(Globals.cursorState.playerCursor, AssetDataStrings.UNITSPHERE);
|
||||||
Actor cursorActor = EntityUtils.getActor(Globals.playerCursor);
|
Actor cursorActor = EntityUtils.getActor(Globals.cursorState.playerCursor);
|
||||||
cursorActor.addTextureMask(new ActorTextureMask("sphere", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
cursorActor.addTextureMask(new ActorTextureMask("sphere", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
||||||
DrawableUtils.makeEntityTransparent(Globals.playerCursor);
|
DrawableUtils.makeEntityTransparent(Globals.cursorState.playerCursor);
|
||||||
EntityUtils.getScale(Globals.playerCursor).set(0.2f);
|
EntityUtils.getScale(Globals.cursorState.playerCursor).set(0.2f);
|
||||||
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.cursorState.playerCursor, EntityTags.DRAWABLE);
|
||||||
|
|
||||||
//player's block cursor
|
//player's block cursor
|
||||||
Globals.playerBlockCursor = EntityCreationUtils.createClientSpatialEntity();
|
Globals.cursorState.playerBlockCursor = EntityCreationUtils.createClientSpatialEntity();
|
||||||
EntityCreationUtils.makeEntityDrawable(Globals.playerBlockCursor, AssetDataStrings.UNITCUBE);
|
EntityCreationUtils.makeEntityDrawable(Globals.cursorState.playerBlockCursor, AssetDataStrings.UNITCUBE);
|
||||||
Actor blockCursorActor = EntityUtils.getActor(Globals.playerBlockCursor);
|
Actor blockCursorActor = EntityUtils.getActor(Globals.cursorState.playerBlockCursor);
|
||||||
blockCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
blockCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
||||||
DrawableUtils.makeEntityTransparent(Globals.playerBlockCursor);
|
DrawableUtils.makeEntityTransparent(Globals.cursorState.playerBlockCursor);
|
||||||
EntityUtils.getScale(Globals.playerBlockCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER);
|
EntityUtils.getScale(Globals.cursorState.playerBlockCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER);
|
||||||
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.cursorState.playerBlockCursor, EntityTags.DRAWABLE);
|
||||||
|
|
||||||
//player's area cursor
|
//player's area cursor
|
||||||
Globals.playerAreaCursor = EntityCreationUtils.createClientSpatialEntity();
|
Globals.cursorState.playerAreaCursor = EntityCreationUtils.createClientSpatialEntity();
|
||||||
EntityCreationUtils.makeEntityDrawable(Globals.playerAreaCursor, AssetDataStrings.UNITCUBE);
|
EntityCreationUtils.makeEntityDrawable(Globals.cursorState.playerAreaCursor, AssetDataStrings.UNITCUBE);
|
||||||
Actor areaCursorActor = EntityUtils.getActor(Globals.playerAreaCursor);
|
Actor areaCursorActor = EntityUtils.getActor(Globals.cursorState.playerAreaCursor);
|
||||||
areaCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
areaCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{AssetDataStrings.TEXTURE_RED_TRANSPARENT})));
|
||||||
DrawableUtils.makeEntityTransparent(Globals.playerAreaCursor);
|
DrawableUtils.makeEntityTransparent(Globals.cursorState.playerAreaCursor);
|
||||||
EntityUtils.getScale(Globals.playerAreaCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER);
|
EntityUtils.getScale(Globals.cursorState.playerAreaCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER);
|
||||||
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.cursorState.playerAreaCursor, EntityTags.DRAWABLE);
|
||||||
|
|
||||||
//player's fab cursor
|
//player's fab cursor
|
||||||
playerFabCursor = EntityCreationUtils.createClientSpatialEntity();
|
playerFabCursor = EntityCreationUtils.createClientSpatialEntity();
|
||||||
@ -186,7 +201,7 @@ public class CursorState {
|
|||||||
if(
|
if(
|
||||||
collisionEngine != null &&
|
collisionEngine != null &&
|
||||||
camera != null &&
|
camera != null &&
|
||||||
Globals.playerCursor != null
|
Globals.cursorState.playerCursor != null
|
||||||
){
|
){
|
||||||
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera));
|
Vector3d eyePos = new Vector3d(CameraEntityUtils.getCameraEye(camera));
|
||||||
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera));
|
Vector3d centerPos = new Vector3d(CameraEntityUtils.getCameraCenter(camera));
|
||||||
@ -194,14 +209,14 @@ public class CursorState {
|
|||||||
if(cursorPos == null){
|
if(cursorPos == null){
|
||||||
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
cursorPos = new Vector3d(centerPos).add(new Vector3d(eyePos).normalize().mul(-CollisionEngine.DEFAULT_INTERACT_DISTANCE));
|
||||||
}
|
}
|
||||||
EntityUtils.getPosition(Globals.playerCursor).set(cursorPos);
|
EntityUtils.getPosition(Globals.cursorState.playerCursor).set(cursorPos);
|
||||||
|
|
||||||
//clamp block cursor to nearest voxel
|
//clamp block cursor to nearest voxel
|
||||||
if(clampToExistingBlock){
|
if(clampToExistingBlock){
|
||||||
cursorPos = cursorPos.add(new Vector3d(eyePos).normalize().mul(-BlockChunkData.BLOCK_SIZE_MULTIPLIER));
|
cursorPos = cursorPos.add(new Vector3d(eyePos).normalize().mul(-BlockChunkData.BLOCK_SIZE_MULTIPLIER));
|
||||||
}
|
}
|
||||||
cursorPos.set(this.clampPositionToNearestBlock(cursorPos));
|
cursorPos.set(this.clampPositionToNearestBlock(cursorPos));
|
||||||
EntityUtils.getPosition(Globals.playerBlockCursor).set(cursorPos);
|
EntityUtils.getPosition(Globals.cursorState.playerBlockCursor).set(cursorPos);
|
||||||
cursorPos.sub(BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0,BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0,BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0);
|
cursorPos.sub(BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0,BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0,BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0);
|
||||||
EntityUtils.getPosition(CursorState.playerFabCursor).set(cursorPos);
|
EntityUtils.getPosition(CursorState.playerFabCursor).set(cursorPos);
|
||||||
if(gridAlignmentData != null){
|
if(gridAlignmentData != null){
|
||||||
@ -216,7 +231,7 @@ public class CursorState {
|
|||||||
*/
|
*/
|
||||||
public static void makeRealVisible(){
|
public static void makeRealVisible(){
|
||||||
CursorState.hide();
|
CursorState.hide();
|
||||||
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(Globals.cursorState.playerCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -224,9 +239,9 @@ public class CursorState {
|
|||||||
*/
|
*/
|
||||||
public static void makeBlockVisible(String texture){
|
public static void makeBlockVisible(String texture){
|
||||||
CursorState.hide();
|
CursorState.hide();
|
||||||
Actor blockCursorActor = EntityUtils.getActor(Globals.playerBlockCursor);
|
Actor blockCursorActor = EntityUtils.getActor(Globals.cursorState.playerBlockCursor);
|
||||||
blockCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{texture})));
|
blockCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{texture})));
|
||||||
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(Globals.cursorState.playerBlockCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -234,7 +249,7 @@ public class CursorState {
|
|||||||
*/
|
*/
|
||||||
public static void makeAreaVisible(){
|
public static void makeAreaVisible(){
|
||||||
CursorState.hide();
|
CursorState.hide();
|
||||||
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().registerEntityToTag(Globals.cursorState.playerAreaCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -262,9 +277,9 @@ public class CursorState {
|
|||||||
* Hides the cursor
|
* Hides the cursor
|
||||||
*/
|
*/
|
||||||
public static void hide(){
|
public static void hide(){
|
||||||
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.cursorState.playerCursor, EntityTags.DRAWABLE);
|
||||||
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.cursorState.playerBlockCursor, EntityTags.DRAWABLE);
|
||||||
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerAreaCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.cursorState.playerAreaCursor, EntityTags.DRAWABLE);
|
||||||
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(CursorState.playerFabCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(CursorState.playerFabCursor, EntityTags.DRAWABLE);
|
||||||
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(CursorState.playerGridAlignedCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(CursorState.playerGridAlignedCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
@ -277,11 +292,11 @@ public class CursorState {
|
|||||||
this.areaCursorSelection = selection;
|
this.areaCursorSelection = selection;
|
||||||
Vector3d center = new Vector3d(areaCursorSelection.getRectStart()).add(areaCursorSelection.getRectEnd()).mul(0.5f);
|
Vector3d center = new Vector3d(areaCursorSelection.getRectStart()).add(areaCursorSelection.getRectEnd()).mul(0.5f);
|
||||||
Vector3d scale = new Vector3d(areaCursorSelection.getRectStart()).sub(areaCursorSelection.getRectEnd()).absolute();
|
Vector3d scale = new Vector3d(areaCursorSelection.getRectStart()).sub(areaCursorSelection.getRectEnd()).absolute();
|
||||||
EntityCreationUtils.makeEntityDrawable(Globals.playerAreaCursor, AssetDataStrings.UNITCUBE);
|
EntityCreationUtils.makeEntityDrawable(Globals.cursorState.playerAreaCursor, AssetDataStrings.UNITCUBE);
|
||||||
Actor areaCursorActor = EntityUtils.getActor(Globals.playerAreaCursor);
|
Actor areaCursorActor = EntityUtils.getActor(Globals.cursorState.playerAreaCursor);
|
||||||
areaCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{"Textures/transparent_red.png"})));
|
areaCursorActor.addTextureMask(new ActorTextureMask("cube", Arrays.asList(new String[]{"Textures/transparent_red.png"})));
|
||||||
EntityUtils.getPosition(Globals.playerAreaCursor).set(center);
|
EntityUtils.getPosition(Globals.cursorState.playerAreaCursor).set(center);
|
||||||
EntityUtils.getScale(Globals.playerAreaCursor).set(scale);
|
EntityUtils.getScale(Globals.cursorState.playerAreaCursor).set(scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -361,7 +376,7 @@ public class CursorState {
|
|||||||
*/
|
*/
|
||||||
public Vector3d getBlockCursorPos(){
|
public Vector3d getBlockCursorPos(){
|
||||||
double sizeMult = BlockChunkData.BLOCK_SIZE_MULTIPLIER * blockSize;
|
double sizeMult = BlockChunkData.BLOCK_SIZE_MULTIPLIER * blockSize;
|
||||||
Vector3d posRaw = new Vector3d(EntityUtils.getPosition(Globals.playerBlockCursor)).sub(sizeMult/2.0,sizeMult/2.0,sizeMult/2.0);
|
Vector3d posRaw = new Vector3d(EntityUtils.getPosition(Globals.cursorState.playerBlockCursor)).sub(sizeMult/2.0,sizeMult/2.0,sizeMult/2.0);
|
||||||
return posRaw;
|
return posRaw;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -379,7 +394,7 @@ public class CursorState {
|
|||||||
this.blockSize = this.blockSize / 2;
|
this.blockSize = this.blockSize / 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EntityUtils.getScale(Globals.playerBlockCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER * this.blockSize);
|
EntityUtils.getScale(Globals.cursorState.playerBlockCursor).set(BLOCK_CURSOR_SCALE_MULTIPLIER * this.blockSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -531,7 +546,7 @@ public class CursorState {
|
|||||||
ClientToolbarState clientToolbarState = ClientToolbarState.getClientToolbarState(Globals.clientState.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.cursorState.playerCursor != null && Globals.cursorState.playerBlockCursor != null){
|
||||||
if(itemData.getTokens().contains(CursorState.CURSOR_BLOCK_TOKEN)) {
|
if(itemData.getTokens().contains(CursorState.CURSOR_BLOCK_TOKEN)) {
|
||||||
Globals.cursorState.setClampToExistingBlock(false);
|
Globals.cursorState.setClampToExistingBlock(false);
|
||||||
}
|
}
|
||||||
@ -550,14 +565,14 @@ public class CursorState {
|
|||||||
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());
|
||||||
if(Globals.playerCursor != null && Globals.playerBlockCursor != null){
|
if(Globals.cursorState.playerCursor != null && Globals.cursorState.playerBlockCursor != null){
|
||||||
if(itemData.getTokens().contains(CursorState.CURSOR_BLOCK_TOKEN)) {
|
if(itemData.getTokens().contains(CursorState.CURSOR_BLOCK_TOKEN)) {
|
||||||
clearBlockCursor = false;
|
clearBlockCursor = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(clearBlockCursor){
|
if(clearBlockCursor){
|
||||||
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.cursorState.playerBlockCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -568,8 +583,8 @@ public class CursorState {
|
|||||||
public void hintShowBlockCursor(){
|
public void hintShowBlockCursor(){
|
||||||
if(
|
if(
|
||||||
!Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerFabCursor) &&
|
!Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerFabCursor) &&
|
||||||
!Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerAreaCursor) &&
|
!Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.cursorState.playerAreaCursor) &&
|
||||||
!Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerCursor)
|
!Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.cursorState.playerCursor)
|
||||||
){
|
){
|
||||||
CursorState.makeBlockVisible(AssetDataStrings.TEXTURE_RED_TRANSPARENT);
|
CursorState.makeBlockVisible(AssetDataStrings.TEXTURE_RED_TRANSPARENT);
|
||||||
}
|
}
|
||||||
@ -604,14 +619,14 @@ public class CursorState {
|
|||||||
* @return The position if a cursor is visible, null otherwise
|
* @return The position if a cursor is visible, null otherwise
|
||||||
*/
|
*/
|
||||||
public Vector3d getCursorPosition(){
|
public Vector3d getCursorPosition(){
|
||||||
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerCursor)){
|
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.cursorState.playerCursor)){
|
||||||
return EntityUtils.getPosition(Globals.playerCursor);
|
return EntityUtils.getPosition(Globals.cursorState.playerCursor);
|
||||||
}
|
}
|
||||||
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerBlockCursor)){
|
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.cursorState.playerBlockCursor)){
|
||||||
return EntityUtils.getPosition(Globals.playerBlockCursor);
|
return EntityUtils.getPosition(Globals.cursorState.playerBlockCursor);
|
||||||
}
|
}
|
||||||
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.playerAreaCursor)){
|
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(Globals.cursorState.playerAreaCursor)){
|
||||||
return EntityUtils.getPosition(Globals.playerAreaCursor);
|
return EntityUtils.getPosition(Globals.cursorState.playerAreaCursor);
|
||||||
}
|
}
|
||||||
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerFabCursor)){
|
if(Globals.clientState.clientSceneWrapper.getScene().getEntitiesWithTag(EntityTags.DRAWABLE).contains(CursorState.playerFabCursor)){
|
||||||
return EntityUtils.getPosition(CursorState.playerFabCursor);
|
return EntityUtils.getPosition(CursorState.playerFabCursor);
|
||||||
|
|||||||
@ -352,11 +352,6 @@ public class Globals {
|
|||||||
|
|
||||||
//the player camera entity
|
//the player camera entity
|
||||||
public static Entity playerCamera;
|
public static Entity playerCamera;
|
||||||
|
|
||||||
//the player in world cursor
|
|
||||||
public static Entity playerCursor;
|
|
||||||
public static Entity playerBlockCursor;
|
|
||||||
public static Entity playerAreaCursor;
|
|
||||||
|
|
||||||
//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;
|
||||||
|
|||||||
@ -185,7 +185,7 @@ public class ClientToolbarState implements BehaviorTree {
|
|||||||
//cursor logic
|
//cursor logic
|
||||||
if(targetPoint != null && parent == Globals.clientState.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.cursorState.playerCursor != null && Globals.cursorState.playerBlockCursor != null){
|
||||||
CursorState.hide();
|
CursorState.hide();
|
||||||
Globals.cursorState.setClampToExistingBlock(false);
|
Globals.cursorState.setClampToExistingBlock(false);
|
||||||
if(itemData.getTokens().contains(CursorState.CURSOR_TOKEN)){
|
if(itemData.getTokens().contains(CursorState.CURSOR_TOKEN)){
|
||||||
@ -268,11 +268,11 @@ public class ClientToolbarState implements BehaviorTree {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Globals.playerCursor != null){
|
if(Globals.cursorState.playerCursor != null){
|
||||||
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.cursorState.playerCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
if(Globals.playerBlockCursor != null){
|
if(Globals.cursorState.playerBlockCursor != null){
|
||||||
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.playerBlockCursor, EntityTags.DRAWABLE);
|
Globals.clientState.clientSceneWrapper.getScene().removeEntityFromTag(Globals.cursorState.playerBlockCursor, EntityTags.DRAWABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
//hide cursors
|
//hide cursors
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user