Search in sources :

Example 51 with Vector3dc

use of org.joml.Vector3dc in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class VSDarknessLibAPILightProvider method apply.

@Override
public Integer apply(final EntityPlayer entityPlayer) {
    final World world = entityPlayer.world;
    final AxisAlignedBB searchBB = new AxisAlignedBB(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ, entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ).grow(8);
    final List<PhysicsObject> nearbyShips = ValkyrienUtils.getPhysObjWorld(world).getPhysObjectsInAABB(searchBB);
    final Vector3d temp0 = new Vector3d();
    final BlockPos.MutableBlockPos temp1 = new BlockPos.MutableBlockPos();
    int maxLight = 0;
    for (final PhysicsObject physicsObject : nearbyShips) {
        final Vector3dc positionInShip = physicsObject.getShipTransform().transformPositionNew(temp0.set(entityPlayer.posX, entityPlayer.posY, entityPlayer.posZ), TransformType.GLOBAL_TO_SUBSPACE);
        final BlockPos blockPosInShip = temp1.setPos(positionInShip.x(), positionInShip.y(), positionInShip.z());
        final int blockLight = getLightFromNeighborsFor(world, EnumSkyBlock.BLOCK, blockPosInShip);
        maxLight = Math.max(blockLight, maxLight);
    }
    return maxLight;
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) Vector3dc(org.joml.Vector3dc) Vector3d(org.joml.Vector3d) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World) PhysicsObject(org.valkyrienskies.mod.common.ships.ship_world.PhysicsObject)

Aggregations

Vector3dc (org.joml.Vector3dc)51 Vector3d (org.joml.Vector3d)33 ShipTransform (org.valkyrienskies.mod.common.ships.ship_transform.ShipTransform)15 PhysicsObject (org.valkyrienskies.mod.common.ships.ship_world.PhysicsObject)9 BlockPos (net.minecraft.util.math.BlockPos)8 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)7 Location (io.xol.chunkstories.api.Location)6 IBlockState (net.minecraft.block.state.IBlockState)6 World (net.minecraft.world.World)6 WorldMaster (io.xol.chunkstories.api.world.WorldMaster)5 EntityShipMovementData (org.valkyrienskies.mod.common.entity.EntityShipMovementData)5 Entity (io.xol.chunkstories.api.entity.Entity)4 CollisionBox (io.xol.chunkstories.api.physics.CollisionBox)4 WorldClient (io.xol.chunkstories.api.world.WorldClient)4 CellData (io.xol.chunkstories.api.world.cell.CellData)4 Nullable (javax.annotation.Nullable)4 EntityLiving (io.xol.chunkstories.api.entity.EntityLiving)3 HitBox (io.xol.chunkstories.api.entity.EntityLiving.HitBox)3 Voxel (io.xol.chunkstories.api.voxel.Voxel)3 Block (net.minecraft.block.Block)3