當前位置: 首頁>>代碼示例>>Java>>正文


Java AxisAlignedBB類代碼示例

本文整理匯總了Java中net.minecraft.util.AxisAlignedBB的典型用法代碼示例。如果您正苦於以下問題:Java AxisAlignedBB類的具體用法?Java AxisAlignedBB怎麽用?Java AxisAlignedBB使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AxisAlignedBB類屬於net.minecraft.util包,在下文中一共展示了AxisAlignedBB類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addCollisionBoxesToList

import net.minecraft.util.AxisAlignedBB; //導入依賴的package包/類
/**
 * Add all collision boxes of this Block to the list that intersect with the given mask.
 */
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity)
{
    this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.3125F, 1.0F);
    super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
    float f = 0.125F;
    this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
    super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
    this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
    super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
    this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
    super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
    this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
    super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
    this.setBlockBoundsForItemRender();
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:19,代碼來源:BlockCauldron.java

示例2: setPositionAndRotation2

import net.minecraft.util.AxisAlignedBB; //導入依賴的package包/類
public void setPositionAndRotation2(double x, double y, double z, float yaw, float pitch, int posRotationIncrements, boolean p_180426_10_)
{
    this.setPosition(x, y, z);
    this.setRotation(yaw, pitch);
    List<AxisAlignedBB> list = this.worldObj.getCollidingBoundingBoxes(this, this.getEntityBoundingBox().contract(0.03125D, 0.0D, 0.03125D));

    if (!list.isEmpty())
    {
        double d0 = 0.0D;

        for (AxisAlignedBB axisalignedbb : list)
        {
            if (axisalignedbb.maxY > d0)
            {
                d0 = axisalignedbb.maxY;
            }
        }

        y = y + (d0 - this.getEntityBoundingBox().minY);
        this.setPosition(x, y, z);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:23,代碼來源:Entity.java

示例3: addCollisionBoxesToList

import net.minecraft.util.AxisAlignedBB; //導入依賴的package包/類
/**
 * Add all collision boxes of this Block to the list that intersect with the given mask.
 */
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity)
{
    this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.625F, 1.0F);
    super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
    float f = 0.125F;
    this.setBlockBounds(0.0F, 0.0F, 0.0F, f, 1.0F, 1.0F);
    super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
    this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, f);
    super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
    this.setBlockBounds(1.0F - f, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
    super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
    this.setBlockBounds(0.0F, 0.0F, 1.0F - f, 1.0F, 1.0F, 1.0F);
    super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
    this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:19,代碼來源:BlockHopper.java

示例4: getEntitiesWithinAABB

import net.minecraft.util.AxisAlignedBB; //導入依賴的package包/類
public <T extends Entity> List<T> getEntitiesWithinAABB(Class <? extends T > clazz, AxisAlignedBB aabb, Predicate <? super T > filter)
{
    int i = MathHelper.floor_double((aabb.minX - 2.0D) / 16.0D);
    int j = MathHelper.floor_double((aabb.maxX + 2.0D) / 16.0D);
    int k = MathHelper.floor_double((aabb.minZ - 2.0D) / 16.0D);
    int l = MathHelper.floor_double((aabb.maxZ + 2.0D) / 16.0D);
    List<T> list = Lists.<T>newArrayList();

    for (int i1 = i; i1 <= j; ++i1)
    {
        for (int j1 = k; j1 <= l; ++j1)
        {
            if (this.isChunkLoaded(i1, j1, true))
            {
                this.getChunkFromChunkCoords(i1, j1).getEntitiesOfTypeWithinAAAB(clazz, aabb, list, filter);
            }
        }
    }

    return list;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:22,代碼來源:World.java

示例5: getEntitiesInAABBexcluding

import net.minecraft.util.AxisAlignedBB; //導入依賴的package包/類
public List<Entity> getEntitiesInAABBexcluding(Entity entityIn, AxisAlignedBB boundingBox, Predicate <? super Entity > predicate)
{
    List<Entity> list = Lists.<Entity>newArrayList();
    int i = MathHelper.floor_double((boundingBox.minX - 2.0D) / 16.0D);
    int j = MathHelper.floor_double((boundingBox.maxX + 2.0D) / 16.0D);
    int k = MathHelper.floor_double((boundingBox.minZ - 2.0D) / 16.0D);
    int l = MathHelper.floor_double((boundingBox.maxZ + 2.0D) / 16.0D);

    for (int i1 = i; i1 <= j; ++i1)
    {
        for (int j1 = k; j1 <= l; ++j1)
        {
            if (this.isChunkLoaded(i1, j1, true))
            {
                this.getChunkFromChunkCoords(i1, j1).getEntitiesWithinAABBForEntity(entityIn, boundingBox, list, predicate);
            }
        }
    }

    return list;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:22,代碼來源:World.java

示例6: getEntityHit

import net.minecraft.util.AxisAlignedBB; //導入依賴的package包/類
private static Entity getEntityHit(ProjectileType type, Vec3 source, Vec3 destination) {
    for (Object o : Minecraft.getMinecraft().theWorld.loadedEntityList) {
        if (o == Minecraft.getMinecraft().getRenderViewEntity())
            continue;
        if (o instanceof EntityLivingBase) {
            EntityLivingBase entity = (EntityLivingBase) o;

            double expander = (type == ProjectileType.ARROW) ? 0.2 : 0.125;
            AxisAlignedBB boundingBox = entity.getEntityBoundingBox().expand(expander, expander, expander);

            MovingObjectPosition raytraceResult = boundingBox.calculateIntercept(source, destination);
            if (raytraceResult != null) {
                return entity;
            }
        }
    }

    return null;
}
 
開發者ID:SerenityEnterprises,項目名稱:SerenityCE,代碼行數:20,代碼來源:Trajectories.java

示例7: getKnotForPosition

import net.minecraft.util.AxisAlignedBB; //導入依賴的package包/類
public static EntityLeashKnot getKnotForPosition(World worldIn, BlockPos pos)
{
    int i = pos.getX();
    int j = pos.getY();
    int k = pos.getZ();

    for (EntityLeashKnot entityleashknot : worldIn.getEntitiesWithinAABB(EntityLeashKnot.class, new AxisAlignedBB((double)i - 1.0D, (double)j - 1.0D, (double)k - 1.0D, (double)i + 1.0D, (double)j + 1.0D, (double)k + 1.0D)))
    {
        if (entityleashknot.getHangingPosition().equals(pos))
        {
            return entityleashknot;
        }
    }

    return null;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:17,代碼來源:EntityLeashKnot.java

示例8: findNearestEntityWithinAABB

import net.minecraft.util.AxisAlignedBB; //導入依賴的package包/類
public <T extends Entity> T findNearestEntityWithinAABB(Class <? extends T > entityType, AxisAlignedBB aabb, T closestTo)
{
    List<T> list = this.<T>getEntitiesWithinAABB(entityType, aabb);
    T t = null;
    double d0 = Double.MAX_VALUE;

    for (int i = 0; i < list.size(); ++i)
    {
        T t1 = list.get(i);

        if (t1 != closestTo && EntitySelectors.NOT_SPECTATING.apply(t1))
        {
            double d1 = closestTo.getDistanceSqToEntity(t1);

            if (d1 <= d0)
            {
                t = t1;
                d0 = d1;
            }
        }
    }

    return t;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:25,代碼來源:World.java

示例9: isNotColliding

import net.minecraft.util.AxisAlignedBB; //導入依賴的package包/類
private boolean isNotColliding(double p_179926_1_, double p_179926_3_, double p_179926_5_, double p_179926_7_)
{
    double d0 = (p_179926_1_ - this.parentEntity.posX) / p_179926_7_;
    double d1 = (p_179926_3_ - this.parentEntity.posY) / p_179926_7_;
    double d2 = (p_179926_5_ - this.parentEntity.posZ) / p_179926_7_;
    AxisAlignedBB axisalignedbb = this.parentEntity.getEntityBoundingBox();

    for (int i = 1; (double)i < p_179926_7_; ++i)
    {
        axisalignedbb = axisalignedbb.offset(d0, d1, d2);

        if (!this.parentEntity.worldObj.getCollidingBoundingBoxes(this.parentEntity, axisalignedbb).isEmpty())
        {
            return false;
        }
    }

    return true;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:20,代碼來源:EntityGhast.java

示例10: setSize

import net.minecraft.util.AxisAlignedBB; //導入依賴的package包/類
/**
 * Sets the width and height of the entity. Args: width, height
 */
protected void setSize(float width, float height)
{
    if (width != this.width || height != this.height)
    {
        float f = this.width;
        this.width = width;
        this.height = height;
        this.setEntityBoundingBox(new AxisAlignedBB(this.getEntityBoundingBox().minX, this.getEntityBoundingBox().minY, this.getEntityBoundingBox().minZ, this.getEntityBoundingBox().minX + (double)this.width, this.getEntityBoundingBox().minY + (double)this.height, this.getEntityBoundingBox().minZ + (double)this.width));

        if (this.width > f && !this.firstUpdate && !this.worldObj.isRemote)
        {
            this.moveEntity((double)(f - this.width), 0.0D, (double)(f - this.width));
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:19,代碼來源:Entity.java

示例11: renderOffsetAABB

import net.minecraft.util.AxisAlignedBB; //導入依賴的package包/類
/**
 * Renders a white box with the bounds of the AABB translated by the offset. Args: aabb, x, y, z
 */
public static void renderOffsetAABB(AxisAlignedBB boundingBox, double x, double y, double z)
{
    GlStateManager.disableTexture2D();
    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    worldrenderer.setTranslation(x, y, z);
    worldrenderer.begin(7, DefaultVertexFormats.POSITION_NORMAL);
    worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex();
    worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(0.0F, 0.0F, -1.0F).endVertex();
    worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex();
    worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 0.0F, 1.0F).endVertex();
    worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(0.0F, -1.0F, 0.0F).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(0.0F, -1.0F, 0.0F).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex();
    worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(0.0F, -1.0F, 0.0F).endVertex();
    worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(0.0F, 1.0F, 0.0F).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 1.0F, 0.0F).endVertex();
    worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(0.0F, 1.0F, 0.0F).endVertex();
    worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex();
    worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.maxZ).normal(-1.0F, 0.0F, 0.0F).endVertex();
    worldrenderer.pos(boundingBox.minX, boundingBox.maxY, boundingBox.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex();
    worldrenderer.pos(boundingBox.minX, boundingBox.minY, boundingBox.minZ).normal(-1.0F, 0.0F, 0.0F).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.minZ).normal(1.0F, 0.0F, 0.0F).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.minZ).normal(1.0F, 0.0F, 0.0F).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex();
    worldrenderer.pos(boundingBox.maxX, boundingBox.minY, boundingBox.maxZ).normal(1.0F, 0.0F, 0.0F).endVertex();
    tessellator.draw();
    worldrenderer.setTranslation(0.0D, 0.0D, 0.0D);
    GlStateManager.enableTexture2D();
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:40,代碼來源:Render.java

示例12: drawBoxOutline

import net.minecraft.util.AxisAlignedBB; //導入依賴的package包/類
public static void drawBoxOutline(AxisAlignedBB boundingBox, int color, boolean depthOff) {
    if (boundingBox == null) return;

    enableRender3D(depthOff);
    glColor(color);

    GL11.glBegin(3);
    GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72338_b, boundingBox.field_72339_c);
    GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72338_b, boundingBox.field_72339_c);
    GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72338_b, boundingBox.field_72334_f);
    GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72338_b, boundingBox.field_72334_f);
    GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72338_b, boundingBox.field_72339_c);
    GL11.glEnd();
    GL11.glBegin(3);
    GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72337_e, boundingBox.field_72339_c);
    GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72337_e, boundingBox.field_72339_c);
    GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72337_e, boundingBox.field_72334_f);
    GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72337_e, boundingBox.field_72334_f);
    GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72337_e, boundingBox.field_72339_c);
    GL11.glEnd();
    GL11.glBegin(1);
    GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72338_b, boundingBox.field_72339_c);
    GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72337_e, boundingBox.field_72339_c);
    GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72338_b, boundingBox.field_72339_c);
    GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72337_e, boundingBox.field_72339_c);
    GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72338_b, boundingBox.field_72334_f);
    GL11.glVertex3d(boundingBox.field_72336_d, boundingBox.field_72337_e, boundingBox.field_72334_f);
    GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72338_b, boundingBox.field_72334_f);
    GL11.glVertex3d(boundingBox.field_72340_a, boundingBox.field_72337_e, boundingBox.field_72334_f);
    GL11.glEnd();

    disableRender3D(depthOff);
}
 
開發者ID:Ygore,項目名稱:bit-client,代碼行數:34,代碼來源:RenderUtil.java

示例13: addCollisionBoxesToList

import net.minecraft.util.AxisAlignedBB; //導入依賴的package包/類
/**
 * Add all collision boxes of this Block to the list that intersect with the given mask.
 */
public void addCollisionBoxesToList(World worldIn, BlockPos pos, IBlockState state, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity)
{
    this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.8125F, 1.0F);
    super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);

    if (((Boolean)worldIn.getBlockState(pos).getValue(EYE)).booleanValue())
    {
        this.setBlockBounds(0.3125F, 0.8125F, 0.3125F, 0.6875F, 1.0F, 0.6875F);
        super.addCollisionBoxesToList(worldIn, pos, state, mask, list, collidingEntity);
    }

    this.setBlockBoundsForItemRender();
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:17,代碼來源:BlockEndPortalFrame.java

示例14: setPosition

import net.minecraft.util.AxisAlignedBB; //導入依賴的package包/類
/**
 * Sets the x,y,z of the entity from the given parameters. Also seems to set up a bounding box.
 */
public void setPosition(double x, double y, double z)
{
    this.posX = x;
    this.posY = y;
    this.posZ = z;
    float f = this.width / 2.0F;
    float f1 = this.height;
    this.setEntityBoundingBox(new AxisAlignedBB(x - (double)f, y, z - (double)f, x + (double)f, y + (double)f1, z + (double)f));
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:13,代碼來源:Entity.java

示例15: getCollisionBoundingBox

import net.minecraft.util.AxisAlignedBB; //導入依賴的package包/類
public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state)
{
    if (((Boolean)state.getValue(OPEN)).booleanValue())
    {
        return null;
    }
    else
    {
        EnumFacing.Axis enumfacing$axis = ((EnumFacing)state.getValue(FACING)).getAxis();
        return enumfacing$axis == EnumFacing.Axis.Z ? new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)((float)pos.getZ() + 0.375F), (double)(pos.getX() + 1), (double)((float)pos.getY() + 1.5F), (double)((float)pos.getZ() + 0.625F)) : new AxisAlignedBB((double)((float)pos.getX() + 0.375F), (double)pos.getY(), (double)pos.getZ(), (double)((float)pos.getX() + 0.625F), (double)((float)pos.getY() + 1.5F), (double)(pos.getZ() + 1));
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:13,代碼來源:BlockFenceGate.java


注:本文中的net.minecraft.util.AxisAlignedBB類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。