当前位置: 首页>>代码示例>>Java>>正文


Java AxisAlignedBB.intersectsWith方法代码示例

本文整理汇总了Java中net.minecraft.util.math.AxisAlignedBB.intersectsWith方法的典型用法代码示例。如果您正苦于以下问题:Java AxisAlignedBB.intersectsWith方法的具体用法?Java AxisAlignedBB.intersectsWith怎么用?Java AxisAlignedBB.intersectsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.util.math.AxisAlignedBB的用法示例。


在下文中一共展示了AxisAlignedBB.intersectsWith方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: func_190605_a

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
private void func_190605_a(Entity p_190605_1_, EnumFacing p_190605_2_, double p_190605_3_)
{
    AxisAlignedBB axisalignedbb = p_190605_1_.getEntityBoundingBox();
    AxisAlignedBB axisalignedbb1 = Block.FULL_BLOCK_AABB.offset(this.pos);

    if (axisalignedbb.intersectsWith(axisalignedbb1))
    {
        EnumFacing enumfacing = p_190605_2_.getOpposite();
        double d0 = this.func_190612_a(axisalignedbb1, enumfacing, axisalignedbb) + 0.01D;
        double d1 = this.func_190612_a(axisalignedbb1, enumfacing, axisalignedbb.func_191500_a(axisalignedbb1)) + 0.01D;

        if (Math.abs(d0 - d1) < 0.01D)
        {
            d0 = Math.min(d0, p_190605_3_) + 0.01D;
            field_190613_i.set(p_190605_2_);
            p_190605_1_.moveEntity(MoverType.PISTON, d0 * (double)enumfacing.getFrontOffsetX(), d0 * (double)enumfacing.getFrontOffsetY(), d0 * (double)enumfacing.getFrontOffsetZ());
            field_190613_i.set((EnumFacing)null);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:TileEntityPiston.java

示例2: getCollisionBoxes

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
public List<AxisAlignedBB> getCollisionBoxes(@Nullable Entity entityIn, AxisAlignedBB aabb)
{
    List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
    this.func_191504_a(entityIn, aabb, false, list);

    if (entityIn != null)
    {
        List<Entity> list1 = this.getEntitiesWithinAABBExcludingEntity(entityIn, aabb.expandXyz(0.25D));

        for (int i = 0; i < list1.size(); ++i)
        {
            Entity entity = (Entity)list1.get(i);

            if (!entityIn.isRidingSameEntity(entity))
            {
                AxisAlignedBB axisalignedbb = entity.getCollisionBoundingBox();

                if (axisalignedbb != null && axisalignedbb.intersectsWith(aabb))
                {
                    list.add(axisalignedbb);
                }

                axisalignedbb = entityIn.getCollisionBox(entity);

                if (axisalignedbb != null && axisalignedbb.intersectsWith(aabb))
                {
                    list.add(axisalignedbb);
                }
            }
        }
    }

    return list;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:35,代码来源:World.java

示例3: addCollisionBoxToList

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
protected static void addCollisionBoxToList(BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable AxisAlignedBB blockBox)
{
    if (blockBox != NULL_AABB)
    {
        AxisAlignedBB axisalignedbb = blockBox.offset(pos);

        if (entityBox.intersectsWith(axisalignedbb))
        {
            collidingBoxes.add(axisalignedbb);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:Block.java

示例4: moveCollidedEntities

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
private void moveCollidedEntities(float p_184322_1_)
{
    EnumFacing enumfacing = this.extending ? this.pistonFacing : this.pistonFacing.getOpposite();
    double d0 = (double)(p_184322_1_ - this.progress);
    List<AxisAlignedBB> list = Lists.<AxisAlignedBB>newArrayList();
    this.func_190606_j().addCollisionBoxToList(this.world, BlockPos.ORIGIN, new AxisAlignedBB(BlockPos.ORIGIN), list, (Entity)null, true);

    if (!((List)list).isEmpty())
    {
        AxisAlignedBB axisalignedbb = this.func_190607_a(this.func_191515_a(list));
        List<Entity> list1 = this.world.getEntitiesWithinAABBExcludingEntity((Entity)null, this.func_190610_a(axisalignedbb, enumfacing, d0).union(axisalignedbb));

        if (!list1.isEmpty())
        {
            boolean flag = this.pistonState.getBlock() == Blocks.SLIME_BLOCK;

            for (int i = 0; i < list1.size(); ++i)
            {
                Entity entity = (Entity)list1.get(i);

                if (entity.getPushReaction() != EnumPushReaction.IGNORE)
                {
                    if (flag)
                    {
                        switch (enumfacing.getAxis())
                        {
                            case X:
                                entity.motionX = (double)enumfacing.getFrontOffsetX();
                                break;

                            case Y:
                                entity.motionY = (double)enumfacing.getFrontOffsetY();
                                break;

                            case Z:
                                entity.motionZ = (double)enumfacing.getFrontOffsetZ();
                        }
                    }

                    double d1 = 0.0D;

                    for (int j = 0; j < ((List)list).size(); ++j)
                    {
                        AxisAlignedBB axisalignedbb1 = this.func_190610_a(this.func_190607_a((AxisAlignedBB)list.get(j)), enumfacing, d0);
                        AxisAlignedBB axisalignedbb2 = entity.getEntityBoundingBox();

                        if (axisalignedbb1.intersectsWith(axisalignedbb2))
                        {
                            d1 = Math.max(d1, this.func_190612_a(axisalignedbb1, enumfacing, axisalignedbb2));

                            if (d1 >= d0)
                            {
                                break;
                            }
                        }
                    }

                    if (d1 > 0.0D)
                    {
                        d1 = Math.min(d1, d0) + 0.01D;
                        field_190613_i.set(enumfacing);
                        entity.moveEntity(MoverType.PISTON, d1 * (double)enumfacing.getFrontOffsetX(), d1 * (double)enumfacing.getFrontOffsetY(), d1 * (double)enumfacing.getFrontOffsetZ());
                        field_190613_i.set((EnumFacing)null);

                        if (!this.extending && this.shouldHeadBeRendered)
                        {
                            this.func_190605_a(entity, enumfacing, d0);
                        }
                    }
                }
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:75,代码来源:TileEntityPiston.java

示例5: filterResults

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
private static <T extends Entity> List<T> filterResults(Map<String, String> params, Class <? extends T > entityClass, List<Predicate<Entity>> inputList, String type, World worldIn, BlockPos position)
{
    List<T> list = Lists.<T>newArrayList();
    String s = getArgument(params, field_190849_w);
    s = s != null && s.startsWith("!") ? s.substring(1) : s;
    boolean flag = !type.equals("e");
    boolean flag1 = type.equals("r") && s != null;
    int i = getInt(params, field_190838_l, 0);
    int j = getInt(params, field_190839_m, 0);
    int k = getInt(params, field_190840_n, 0);
    int l = getInt(params, field_190831_e, -1);
    Predicate<Entity> predicate = Predicates.and(inputList);
    Predicate<Entity> predicate1 = Predicates.<Entity> and (EntitySelectors.IS_ALIVE, predicate);

    if (!params.containsKey(field_190838_l) && !params.containsKey(field_190839_m) && !params.containsKey(field_190840_n))
    {
        if (l >= 0)
        {
            AxisAlignedBB axisalignedbb1 = new AxisAlignedBB((double)(position.getX() - l), (double)(position.getY() - l), (double)(position.getZ() - l), (double)(position.getX() + l + 1), (double)(position.getY() + l + 1), (double)(position.getZ() + l + 1));

            if (flag && !flag1)
            {
                list.addAll(worldIn.<T>getPlayers(entityClass, predicate1));
            }
            else
            {
                list.addAll(worldIn.<T>getEntitiesWithinAABB(entityClass, axisalignedbb1, predicate1));
            }
        }
        else if (type.equals("a"))
        {
            list.addAll(worldIn.<T>getPlayers(entityClass, predicate));
        }
        else if (!type.equals("p") && (!type.equals("r") || flag1))
        {
            list.addAll(worldIn.<T>getEntities(entityClass, predicate1));
        }
        else
        {
            list.addAll(worldIn.<T>getPlayers(entityClass, predicate1));
        }
    }
    else
    {
        final AxisAlignedBB axisalignedbb = getAABB(position, i, j, k);

        if (flag && !flag1)
        {
            Predicate<Entity> predicate2 = new Predicate<Entity>()
            {
                public boolean apply(@Nullable Entity p_apply_1_)
                {
                    return p_apply_1_ != null && axisalignedbb.intersectsWith(p_apply_1_.getEntityBoundingBox());
                }
            };
            list.addAll(worldIn.<T>getPlayers(entityClass, Predicates.<T> and (predicate1, predicate2)));
        }
        else
        {
            list.addAll(worldIn.<T>getEntitiesWithinAABB(entityClass, axisalignedbb, predicate1));
        }
    }

    return list;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:66,代码来源:EntitySelector.java

示例6: filterResults

import net.minecraft.util.math.AxisAlignedBB; //导入方法依赖的package包/类
private static <T extends Entity> List<T> filterResults(Map<String, String> params, Class <? extends T > entityClass, List<Predicate<Entity>> inputList, String type, World worldIn, BlockPos position)
{
    List<T> list = Lists.<T>newArrayList();
    String s = getArgument(params, "type");
    s = s != null && s.startsWith("!") ? s.substring(1) : s;
    boolean flag = !type.equals("e");
    boolean flag1 = type.equals("r") && s != null;
    int i = parseIntWithDefault(params, "dx", 0);
    int j = parseIntWithDefault(params, "dy", 0);
    int k = parseIntWithDefault(params, "dz", 0);
    int l = parseIntWithDefault(params, "r", -1);
    Predicate<Entity> predicate = Predicates.and(inputList);
    Predicate<Entity> predicate1 = Predicates.<Entity>and(EntitySelectors.IS_ALIVE, predicate);
    int i1 = worldIn.playerEntities.size();
    int j1 = worldIn.loadedEntityList.size();
    boolean flag2 = i1 < j1 / 16;

    if (!params.containsKey("dx") && !params.containsKey("dy") && !params.containsKey("dz"))
    {
        if (l >= 0)
        {
            AxisAlignedBB axisalignedbb1 = new AxisAlignedBB((double)(position.getX() - l), (double)(position.getY() - l), (double)(position.getZ() - l), (double)(position.getX() + l + 1), (double)(position.getY() + l + 1), (double)(position.getZ() + l + 1));

            if (flag && flag2 && !flag1)
            {
                list.addAll(worldIn.<T>getPlayers(entityClass, predicate1));
            }
            else
            {
                list.addAll(worldIn.<T>getEntitiesWithinAABB(entityClass, axisalignedbb1, predicate1));
            }
        }
        else if (type.equals("a"))
        {
            list.addAll(worldIn.<T>getPlayers(entityClass, predicate));
        }
        else if (!type.equals("p") && (!type.equals("r") || flag1))
        {
            list.addAll(worldIn.<T>getEntities(entityClass, predicate1));
        }
        else
        {
            list.addAll(worldIn.<T>getPlayers(entityClass, predicate1));
        }
    }
    else
    {
        final AxisAlignedBB axisalignedbb = getAABB(position, i, j, k);

        if (flag && flag2 && !flag1)
        {
            Predicate<Entity> predicate2 = new Predicate<Entity>()
            {
                public boolean apply(@Nullable Entity p_apply_1_)
                {
                    return p_apply_1_ != null && axisalignedbb.intersectsWith(p_apply_1_.getEntityBoundingBox());
                }
            };
            list.addAll(worldIn.<T>getPlayers(entityClass, Predicates.<T>and(predicate1, predicate2)));
        }
        else
        {
            list.addAll(worldIn.<T>getEntitiesWithinAABB(entityClass, axisalignedbb, predicate1));
        }
    }

    return list;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:69,代码来源:EntitySelector.java


注:本文中的net.minecraft.util.math.AxisAlignedBB.intersectsWith方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。