use of org.terasology.engine.logic.characters.GazeMountPointComponent in project Terasology by MovingBlocks.
the class MovementDebugCommands method showHeight.
@Command(shortDescription = "Show your Height", requiredPermission = PermissionManager.CHEAT_PERMISSION)
public String showHeight(@Sender EntityRef client) {
ClientComponent clientComp = client.getComponent(ClientComponent.class);
CharacterMovementComponent move = clientComp.character.getComponent(CharacterMovementComponent.class);
float height = move.height;
GazeMountPointComponent gazeMountPointComponent = clientComp.character.getComponent(GazeMountPointComponent.class);
float eyeHeight = gazeMountPointComponent.translate.y;
return "Your height: " + height + " Eye-height: " + eyeHeight;
}
use of org.terasology.engine.logic.characters.GazeMountPointComponent in project Terasology by MovingBlocks.
the class MovementDebugCommands method playerEyeHeight.
@Command(shortDescription = "Sets the eye-height of the player", runOnServer = true, requiredPermission = PermissionManager.CHEAT_PERMISSION)
public String playerEyeHeight(@Sender EntityRef client, @CommandParam("eye-height") float amount) {
EntityRef player = client.getComponent(ClientComponent.class).character;
try {
GazeMountPointComponent gazeMountPointComponent = player.getComponent(GazeMountPointComponent.class);
if (gazeMountPointComponent != null) {
float prevHeight = gazeMountPointComponent.translate.y;
gazeMountPointComponent.translate.y = amount;
Location.removeChild(player, gazeMountPointComponent.gazeEntity);
Location.attachChild(player, gazeMountPointComponent.gazeEntity, gazeMountPointComponent.translate, new Quaternionf());
player.saveComponent(gazeMountPointComponent);
return "Eye-height of player set to " + amount + " (was " + prevHeight + ")";
}
return "";
} catch (NullPointerException e) {
e.printStackTrace();
return "";
}
}
Aggregations