feat(JOML): Migrate CharacterSoundSystem
*/
package org.terasology.logic.characters;
+import org.joml.RoundingMode;
+import org.joml.Vector3f;
+import org.joml.Vector3i;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.terasology.audio.StaticSound;
import org.terasology.logic.health.DoDestroyEvent;
import org.terasology.logic.location.LocationComponent;
import org.terasology.logic.players.event.OnPlayerRespawnedEvent;
-import org.terasology.math.geom.Vector3f;
-import org.terasology.math.geom.Vector3i;
+import org.terasology.math.JomlUtil;
import org.terasology.registry.In;
import org.terasology.utilities.random.FastRandom;
import org.terasology.utilities.random.Random;
@@ -69,7 +71,7 @@ public void onFootstep(FootstepEvent event, EntityRef entity, LocationComponent
List<StaticSound> footstepSounds = characterSounds.footstepSounds;
// Check if the block the character is standing on has footstep sounds
- Vector3i blockPos = new Vector3i(locationComponent.getLocalPosition());
+ Vector3i blockPos = new Vector3i(JomlUtil.from(locationComponent.getLocalPosition()), RoundingMode.FLOOR);
blockPos.y--; // The block *below* the character's feet is interesting to us
Block block = worldProvider.getBlock(blockPos);
if (block != null) {
@@ -107,7 +109,7 @@ public void onJump(JumpEvent event, EntityRef entity, CharacterSoundComponent ch
@ReceiveEvent
public void onLanded(VerticalCollisionEvent event, EntityRef entity, CharacterSoundComponent characterSounds) {
- Vector3f velocity = event.getVelocity();
+ Vector3f velocity = JomlUtil.from(event.getVelocity());
float soundVolumeModifier = (velocity.y * -1 - LANDING_VELOCITY_THRESHOLD) * LANDING_VOLUME_MODIFIER;
if (soundVolumeModifier <= 0f) {
