Source:
public void initialise() { spawnEntityIdButton = find("spawnEntityIdButton", UIButton.class); entityDropdown = find("entityDropdown", UIDropdownScrollable.class); logger.info("Number of available skeletal meshes: " + assetManager.getAvailableAssets(SkeletalMesh.class).size()); if (entityDropdown != null ) { entityDropdown.setOptions(new ArrayList(assetManager.getAvailableAssets(SkeletalMesh.class))); } animationSpeedSlider = find("entityAnimationSpeedSlider", UISlider.class); if (animationSpeedSlider != null) { animationSpeedSlider.setMinimum(-0.0f); animationSpeedSlider.setIncrement(0.1f); animationSpeedSlider.setRange(10.0f); animationSpeedSlider.setPrecision(1); } spawnEntityIdButton.subscribe(widget -> { Vector3f localPlayerPosition = localPlayer.getPosition(); Quat4f localPlayerRotation = localPlayer.getRotation(); Optional<Prefab> prefab = assetManager.getAsset(entityDropdown.getSelection(), Prefab.class); if (prefab.isPresent() && prefab.get().getComponent(LocationComponent.class) != null) { entityRef = entityManager.create(prefab.get(), localPlayerPosition, localPlayerRotation); } SkeletalMeshComponent skeletalMeshComponent = entityRef.getComponent(SkeletalMeshComponent.class); skeletalMeshComponent.animationRate = animationSpeedSlider.getValue(); entityRef.saveComponent(skeletalMeshComponent); CharacterMovementComponent movementComponent = entityRef.getComponent(CharacterMovementComponent.class); movementComponent.speedMultiplier = animationSpeedSlider.getValue(); entityRef.saveComponent(movementComponent); }); }

Target:
public void initialise() { spawnEntityIdButton = find("spawnEntityIdButton", UIButton.class); entityDropdown = find("entityDropdown", UIDropdownScrollable.class); logger.info("Number of available skeletal meshes: " + assetManager.getAvailableAssets(SkeletalMesh.class).size()); ArrayList skeletalMesh = new ArrayList(assetManager.getAvailableAssets(SkeletalMesh.class)); if (entityDropdown != null ) { entityDropdown.setOptions(skeletalMesh); } animationSpeedSlider = find("entityAnimationSpeedSlider", UISlider.class); if (animationSpeedSlider != null) { animationSpeedSlider.setMinimum(-0.0f); animationSpeedSlider.setIncrement(0.1f); animationSpeedSlider.setRange(10.0f); animationSpeedSlider.setPrecision(1); } spawnEntityIdButton.subscribe(widget -> { Vector3f localPlayerPosition = localPlayer.getPosition(); Quat4f localPlayerRotation = localPlayer.getRotation(); Vector3f offset = localPlayer.getViewDirection(); offset.scale(2.0f); offset.y = 0; localPlayerPosition.add(offset); Optional<Prefab> prefab = assetManager.getAsset(entityDropdown.getSelection(), Prefab.class); if (prefab.isPresent() && prefab.get().getComponent(LocationComponent.class) != null) { entityRef = entityManager.create(prefab.get(), localPlayerPosition, localPlayerRotation); SkeletalMeshComponent skeletalMeshComponent = entityRef.getComponent(SkeletalMeshComponent.class); skeletalMeshComponent.animationRate = animationSpeedSlider.getValue(); entityRef.saveComponent(skeletalMeshComponent); CharacterMovementComponent movementComponent = entityRef.getComponent(CharacterMovementComponent.class); movementComponent.speedMultiplier = animationSpeedSlider.getValue(); entityRef.saveComponent(movementComponent); } }); }