re-enable extra interaction engine checks
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
d3769a43d4
commit
e7d2bf42c1
@ -246,66 +246,66 @@ public class ClientInteractionEngine {
|
||||
InteractionTargetMenu.setInteractionTargetString(text);
|
||||
set = true;
|
||||
}
|
||||
// if(!set){
|
||||
// target = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCast(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||
// if(target != null){
|
||||
// EntityType type = CommonEntityUtils.getEntityType(target);
|
||||
// if(type == null){
|
||||
// throw new Error("Entity does not have a type defined!");
|
||||
// }
|
||||
// switch(type){
|
||||
// case CREATURE: {
|
||||
// InteractionTargetMenu.setInteractionTargetString(CommonEntityUtils.getEntitySubtype(target));
|
||||
// set = true;
|
||||
// } break;
|
||||
// case ITEM: {
|
||||
// InteractionTargetMenu.setInteractionTargetString(CommonEntityUtils.getEntitySubtype(target));
|
||||
// set = true;
|
||||
// } break;
|
||||
// case FOLIAGE: {
|
||||
// InteractionTargetMenu.setInteractionTargetString(CommonEntityUtils.getEntitySubtype(target));
|
||||
// set = true;
|
||||
// } break;
|
||||
// default: {
|
||||
// //silently ignore
|
||||
// } break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if(!set){
|
||||
// Vector3d collisionPosition = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(centerPos, new Vector3d(eyePos).mul(-1), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||
// if(
|
||||
// collisionPosition != null &&
|
||||
// collisionPosition.distance(centerPos) < CollisionEngine.DEFAULT_INTERACT_DISTANCE &&
|
||||
// collisionPosition.x >= 0 && collisionPosition.y >= 0 && collisionPosition.z >= 0
|
||||
// ){
|
||||
// //grab block at point
|
||||
// BlockChunkData blockChunkData = Globals.clientState.clientBlockManager.getChunkDataAtWorldPoint(Globals.clientState.clientWorldData.convertRealToWorldSpace(collisionPosition), 0);
|
||||
// if(blockChunkData != null){
|
||||
// Vector3i blockPos = ClientWorldData.convertRealToLocalBlockSpace(new Vector3d(collisionPosition).add(new Vector3d(eyePos).mul(-BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0f)));
|
||||
// if(!blockChunkData.isEmpty(blockPos.x, blockPos.y, blockPos.z)){
|
||||
// short type = blockChunkData.getType(blockPos.x, blockPos.y, blockPos.z);
|
||||
// String text = Globals.gameConfigCurrent.getBlockData().getTypeFromId(type).getName();
|
||||
// InteractionTargetMenu.setInteractionTargetString(text);
|
||||
// Globals.cursorState.hintShowBlockCursor();
|
||||
// Globals.cursorState.hintClampToExistingBlock();
|
||||
// set = true;
|
||||
// }
|
||||
// }
|
||||
// //if we didn't find a block type, try terrain
|
||||
// if(!set){
|
||||
// ChunkData chunkData = Globals.clientState.clientTerrainManager.getChunkDataAtWorldPoint(Globals.clientState.clientWorldData.convertRealToWorldSpace(collisionPosition), 0);
|
||||
// if(chunkData != null){
|
||||
// int voxelType = chunkData.getType(ClientWorldData.convertRealToVoxelSpace(new Vector3d(collisionPosition).add(new Vector3d(ServerTerrainChunk.VOXEL_SIZE / 2.0f))));
|
||||
// if(voxelType != ServerTerrainChunk.VOXEL_TYPE_AIR){
|
||||
// String text = Globals.gameConfigCurrent.getVoxelData().getTypeFromId(voxelType).getName();
|
||||
// InteractionTargetMenu.setInteractionTargetString(text);
|
||||
// set = true;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if(!set){
|
||||
target = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCast(new Vector3d(centerPos), new Vector3d(eyePos).mul(-1), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||
if(target != null){
|
||||
EntityType type = CommonEntityUtils.getEntityType(target);
|
||||
if(type == null){
|
||||
throw new Error("Entity does not have a type defined!");
|
||||
}
|
||||
switch(type){
|
||||
case CREATURE: {
|
||||
InteractionTargetMenu.setInteractionTargetString(CommonEntityUtils.getEntitySubtype(target));
|
||||
set = true;
|
||||
} break;
|
||||
case ITEM: {
|
||||
InteractionTargetMenu.setInteractionTargetString(CommonEntityUtils.getEntitySubtype(target));
|
||||
set = true;
|
||||
} break;
|
||||
case FOLIAGE: {
|
||||
InteractionTargetMenu.setInteractionTargetString(CommonEntityUtils.getEntitySubtype(target));
|
||||
set = true;
|
||||
} break;
|
||||
default: {
|
||||
//silently ignore
|
||||
} break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!set){
|
||||
Vector3d collisionPosition = Globals.clientState.clientSceneWrapper.getCollisionEngine().rayCastPosition(centerPos, new Vector3d(eyePos).mul(-1), CollisionEngine.DEFAULT_INTERACT_DISTANCE);
|
||||
if(
|
||||
collisionPosition != null &&
|
||||
collisionPosition.distance(centerPos) < CollisionEngine.DEFAULT_INTERACT_DISTANCE &&
|
||||
collisionPosition.x >= 0 && collisionPosition.y >= 0 && collisionPosition.z >= 0
|
||||
){
|
||||
//grab block at point
|
||||
BlockChunkData blockChunkData = Globals.clientState.clientBlockManager.getChunkDataAtWorldPoint(Globals.clientState.clientWorldData.convertRealToWorldSpace(collisionPosition), 0);
|
||||
if(blockChunkData != null){
|
||||
Vector3i blockPos = ClientWorldData.convertRealToLocalBlockSpace(new Vector3d(collisionPosition).add(new Vector3d(eyePos).mul(-BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0f)));
|
||||
if(!blockChunkData.isEmpty(blockPos.x, blockPos.y, blockPos.z)){
|
||||
short type = blockChunkData.getType(blockPos.x, blockPos.y, blockPos.z);
|
||||
String text = Globals.gameConfigCurrent.getBlockData().getTypeFromId(type).getName();
|
||||
InteractionTargetMenu.setInteractionTargetString(text);
|
||||
Globals.cursorState.hintShowBlockCursor();
|
||||
Globals.cursorState.hintClampToExistingBlock();
|
||||
set = true;
|
||||
}
|
||||
}
|
||||
//if we didn't find a block type, try terrain
|
||||
if(!set){
|
||||
ChunkData chunkData = Globals.clientState.clientTerrainManager.getChunkDataAtWorldPoint(Globals.clientState.clientWorldData.convertRealToWorldSpace(collisionPosition), 0);
|
||||
if(chunkData != null){
|
||||
int voxelType = chunkData.getType(ClientWorldData.convertRealToVoxelSpace(new Vector3d(collisionPosition).add(new Vector3d(ServerTerrainChunk.VOXEL_SIZE / 2.0f))));
|
||||
if(voxelType != ServerTerrainChunk.VOXEL_TYPE_AIR){
|
||||
String text = Globals.gameConfigCurrent.getVoxelData().getTypeFromId(voxelType).getName();
|
||||
InteractionTargetMenu.setInteractionTargetString(text);
|
||||
set = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!set){
|
||||
InteractionTargetMenu.setInteractionTargetString("");
|
||||
}
|
||||
|
||||
@ -45,18 +45,20 @@ public class InteractionTargetMenu {
|
||||
*/
|
||||
public static void setInteractionTargetString(String text){
|
||||
Window interactionTooltipWindow = (Window)Globals.elementService.getWindow(WindowStrings.TARGET_TOOLTIP);
|
||||
Panel container = (Panel)interactionTooltipWindow.getChildren().get(0);
|
||||
Label label = (Label)container.getChildren().get(0);
|
||||
if(text.length() == 0){
|
||||
if(label.getText().length() != 0){
|
||||
label.setText("");
|
||||
}
|
||||
interactionTooltipWindow.setVisible(false);
|
||||
} else {
|
||||
interactionTooltipWindow.setVisible(true);
|
||||
if(!label.getText().contains(text)){
|
||||
label.setText(text);
|
||||
Globals.engineState.signalSystem.post(SignalType.YOGA_APPLY, interactionTooltipWindow);
|
||||
if(interactionTooltipWindow != null){
|
||||
Panel container = (Panel)interactionTooltipWindow.getChildren().get(0);
|
||||
Label label = (Label)container.getChildren().get(0);
|
||||
if(text.length() == 0){
|
||||
if(label.getText().length() != 0){
|
||||
label.setText("");
|
||||
}
|
||||
interactionTooltipWindow.setVisible(false);
|
||||
} else {
|
||||
interactionTooltipWindow.setVisible(true);
|
||||
if(!label.getText().contains(text)){
|
||||
label.setText(text);
|
||||
Globals.engineState.signalSystem.post(SignalType.YOGA_APPLY, interactionTooltipWindow);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user