Skip to content

Commit

Permalink
feat(JOML): migrate WellWaterSystem LocationComponent (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
pollend authored Jan 19, 2021
1 parent 8d1d187 commit 4815819
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
package org.terasology.metalrenegades.interaction.systems;

import org.joml.RoundingMode;
import org.joml.Vector3f;
import org.joml.Vector3i;
import org.terasology.dynamicCities.buildings.components.DynParcelRefComponent;
import org.terasology.engine.Time;
import org.terasology.entitySystem.entity.EntityManager;
Expand All @@ -15,7 +18,6 @@
import org.terasology.logic.inventory.events.GiveItemEvent;
import org.terasology.logic.location.LocationComponent;
import org.terasology.math.geom.Rect2i;
import org.terasology.math.geom.Vector3i;
import org.terasology.metalrenegades.interaction.component.WaterCupComponent;
import org.terasology.metalrenegades.interaction.component.WellBlockComponent;
import org.terasology.metalrenegades.interaction.component.WellSourceComponent;
Expand Down Expand Up @@ -154,7 +156,7 @@ private void refillWells() {
*/
private EntityRef getWellEntity(EntityRef sourceBlock) {
LocationComponent blockLocComp = sourceBlock.getComponent(LocationComponent.class);
Vector3i blockLocation = new Vector3i(blockLocComp.getWorldPosition());
Vector3i blockLocation = new Vector3i(blockLocComp.getWorldPosition(new Vector3f()), RoundingMode.FLOOR);

return StreamSupport.stream(entityManager.getEntitiesWith(WellSourceComponent.class).spliterator(), false)
.filter(wellEntity -> buildingContainsPosition(wellEntity, blockLocation))
Expand Down

0 comments on commit 4815819

Please sign in to comment.