Adjusted for WorldlyTooltip
import org.terasology.registry.In;
import org.terasology.rendering.world.WorldRenderer;
import org.terasology.world.BlockEntityRegistry;
+import org.terasology.world.block.BlockComponent;
import java.math.RoundingMode;
import java.util.Arrays;
private Vector3f hitNormal = new Vector3f();
private CollisionGroup[] filter = {StandardCollisionGroup.DEFAULT, StandardCollisionGroup.WORLD, StandardCollisionGroup.CHARACTER};
private float focalDistance;
+ private boolean isBlock;
+
private static final Logger logger = LoggerFactory.getLogger(CameraTargetSystem.class);
@Override
@@ -131,6 +134,11 @@ public void update(float delta) {
oldTarget.send(new CameraOutEvent());
newTarget.send(new CameraOverEvent());
localPlayer.getCharacterEntity().send(new CameraTargetChangedEvent(oldTarget, newTarget));
+ if (isTargetAvailable() && !newTarget.hasComponent(BlockComponent.class)) {
+ isBlock = false;
+ } else {
+ isBlock = true;
+ }
}
target = newTarget;
targetBlockPos = newBlockPos;
@@ -190,5 +198,9 @@ public Vector3i getTargetBlockPosition() {
public float getFocalDistance() {
return focalDistance;
}
+
+ public boolean isBlock() {
+ return isBlock;
+ }
}
