Search in sources :

Example 6 with Polygon

use of ValkyrienWarfareBase.Collision.Polygon in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class CallRunner method onGetEntitiesWithinAABB.

public static <T extends Entity> List<T> onGetEntitiesWithinAABB(World world, Class<? extends T> clazz, AxisAlignedBB aabb, @Nullable Predicate<? super T> filter) {
    List toReturn = world.getEntitiesWithinAABB(clazz, aabb, filter);
    BlockPos pos = new BlockPos((aabb.minX + aabb.maxX) / 2D, (aabb.minY + aabb.maxY) / 2D, (aabb.minZ + aabb.maxZ) / 2D);
    PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(world, pos);
    if (wrapper != null) {
        Polygon poly = new Polygon(aabb, wrapper.wrapping.coordTransform.lToWTransform);
        //.contract(.3D);
        aabb = poly.getEnclosedAABB();
        toReturn.addAll(world.getEntitiesWithinAABB(clazz, aabb, filter));
    }
    return toReturn;
}
Also used : PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity) ArrayList(java.util.ArrayList) PlayerList(net.minecraft.server.management.PlayerList) List(java.util.List) BlockPos(net.minecraft.util.math.BlockPos) Polygon(ValkyrienWarfareBase.Collision.Polygon) EntityPolygon(ValkyrienWarfareBase.Collision.EntityPolygon)

Aggregations

Polygon (ValkyrienWarfareBase.Collision.Polygon)6 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)5 PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)3 BlockPos (net.minecraft.util.math.BlockPos)3 Vector (ValkyrienWarfareBase.API.Vector)2 EntityPolygon (ValkyrienWarfareBase.Collision.EntityPolygon)2 PhysPolygonCollider (ValkyrienWarfareBase.Collision.PhysPolygonCollider)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 PlayerList (net.minecraft.server.management.PlayerList)2 PhysCollisionObject (ValkyrienWarfareBase.Collision.PhysCollisionObject)1 PhysicsCalculationsOrbital (ValkyrienWarfareBase.Physics.PhysicsCalculationsOrbital)1 EntityMountingWeaponBase (ValkyrienWarfareCombat.Entity.EntityMountingWeaponBase)1 Entity (net.minecraft.entity.Entity)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1