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


Java Entity.getEntityBoundingBox方法代碼示例

本文整理匯總了Java中net.minecraft.entity.Entity.getEntityBoundingBox方法的典型用法代碼示例。如果您正苦於以下問題:Java Entity.getEntityBoundingBox方法的具體用法?Java Entity.getEntityBoundingBox怎麽用?Java Entity.getEntityBoundingBox使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.entity.Entity的用法示例。


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

示例1: getPathPointTo

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Returns given entity's position as PathPoint
 */
public PathPoint getPathPointTo(Entity entityIn)
{
    int i;

    if (this.canSwim && entityIn.isInWater())
    {
        i = (int)entityIn.getEntityBoundingBox().minY;
        BlockPos.MutableBlockPos blockpos$mutableblockpos = new BlockPos.MutableBlockPos(MathHelper.floor_double(entityIn.posX), i, MathHelper.floor_double(entityIn.posZ));

        for (Block block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock(); block == Blocks.flowing_water || block == Blocks.water; block = this.blockaccess.getBlockState(blockpos$mutableblockpos).getBlock())
        {
            ++i;
            blockpos$mutableblockpos.func_181079_c(MathHelper.floor_double(entityIn.posX), i, MathHelper.floor_double(entityIn.posZ));
        }

        this.avoidsWater = false;
    }
    else
    {
        i = MathHelper.floor_double(entityIn.getEntityBoundingBox().minY + 0.5D);
    }

    return this.openPoint(MathHelper.floor_double(entityIn.getEntityBoundingBox().minX), i, MathHelper.floor_double(entityIn.getEntityBoundingBox().minZ));
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:28,代碼來源:WalkNodeProcessor.java

示例2: setLookPositionWithEntity

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Sets position to look at using entity
 */
public void setLookPositionWithEntity(Entity entityIn, float deltaYaw, float deltaPitch)
{
    this.posX = entityIn.posX;

    if (entityIn instanceof EntityLivingBase)
    {
        this.posY = entityIn.posY + (double)entityIn.getEyeHeight();
    }
    else
    {
        this.posY = (entityIn.getEntityBoundingBox().minY + entityIn.getEntityBoundingBox().maxY) / 2.0D;
    }

    this.posZ = entityIn.posZ;
    this.deltaLookYaw = deltaYaw;
    this.deltaLookPitch = deltaPitch;
    this.isLooking = true;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:22,代碼來源:EntityLookHelper.java

示例3: isEntityWithinPlayerFOV

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
private boolean isEntityWithinPlayerFOV(EntityPlayer player, Entity entity) {
    // code used from the Enderman player looking code.
    Vec3d vec3 = player.getLook(1.0F).normalize();
    Vec3d vec31 = new Vec3d(entity.posX - player.posX, entity.getEntityBoundingBox().minY + entity.height / 2.0F - (player.posY + player.getEyeHeight()), entity.posZ - player.posZ);
    double d0 = vec31.lengthVector();
    vec31 = vec31.normalize();
    double d1 = vec3.dotProduct(vec31);
    return d1 > 1.0D - 2.5D / d0;
    // return d1 > 1.0D - 0.025D / d0;
}
 
開發者ID:TeamPneumatic,項目名稱:pnc-repressurized,代碼行數:11,代碼來源:EntityTrackUpgradeHandler.java

示例4: renderDebugBoundingBox

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Renders the bounding box around an entity when F3+B is pressed
 */
private void renderDebugBoundingBox(Entity entityIn, double x, double y, double z, float entityYaw, float partialTicks)
{
    GlStateManager.depthMask(false);
    GlStateManager.disableTexture2D();
    GlStateManager.disableLighting();
    GlStateManager.disableCull();
    GlStateManager.disableBlend();
    float f = entityIn.width / 2.0F;
    AxisAlignedBB axisalignedbb = entityIn.getEntityBoundingBox();
    RenderGlobal.drawBoundingBox(axisalignedbb.minX - entityIn.posX + x, axisalignedbb.minY - entityIn.posY + y, axisalignedbb.minZ - entityIn.posZ + z, axisalignedbb.maxX - entityIn.posX + x, axisalignedbb.maxY - entityIn.posY + y, axisalignedbb.maxZ - entityIn.posZ + z, 1.0F, 1.0F, 1.0F, 1.0F);

    if (entityIn instanceof EntityLivingBase)
    {
        float f1 = 0.01F;
        RenderGlobal.drawBoundingBox(x - (double)f, y + (double)entityIn.getEyeHeight() - 0.009999999776482582D, z - (double)f, x + (double)f, y + (double)entityIn.getEyeHeight() + 0.009999999776482582D, z + (double)f, 1.0F, 0.0F, 0.0F, 1.0F);
    }

    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    Vec3d vec3d = entityIn.getLook(partialTicks);
    vertexbuffer.begin(3, DefaultVertexFormats.POSITION_COLOR);
    vertexbuffer.pos(x, y + (double)entityIn.getEyeHeight(), z).color(0, 0, 255, 255).endVertex();
    vertexbuffer.pos(x + vec3d.xCoord * 2.0D, y + (double)entityIn.getEyeHeight() + vec3d.yCoord * 2.0D, z + vec3d.zCoord * 2.0D).color(0, 0, 255, 255).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.enableLighting();
    GlStateManager.enableCull();
    GlStateManager.disableBlend();
    GlStateManager.depthMask(true);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:34,代碼來源:RenderManager.java

示例5: renderDebugBoundingBox

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Renders the bounding box around an entity when F3+B is pressed
 */
private void renderDebugBoundingBox(Entity entityIn, double p_85094_2_, double p_85094_4_, double p_85094_6_, float p_85094_8_, float p_85094_9_)
{
    GlStateManager.depthMask(false);
    GlStateManager.disableTexture2D();
    GlStateManager.disableLighting();
    GlStateManager.disableCull();
    GlStateManager.disableBlend();
    float f = entityIn.width / 2.0F;
    AxisAlignedBB axisalignedbb = entityIn.getEntityBoundingBox();
    AxisAlignedBB axisalignedbb1 = new AxisAlignedBB(axisalignedbb.minX - entityIn.posX + p_85094_2_, axisalignedbb.minY - entityIn.posY + p_85094_4_, axisalignedbb.minZ - entityIn.posZ + p_85094_6_, axisalignedbb.maxX - entityIn.posX + p_85094_2_, axisalignedbb.maxY - entityIn.posY + p_85094_4_, axisalignedbb.maxZ - entityIn.posZ + p_85094_6_);
    RenderGlobal.func_181563_a(axisalignedbb1, 255, 255, 255, 255);

    if (entityIn instanceof EntityLivingBase)
    {
        float f1 = 0.01F;
        RenderGlobal.func_181563_a(new AxisAlignedBB(p_85094_2_ - (double)f, p_85094_4_ + (double)entityIn.getEyeHeight() - 0.009999999776482582D, p_85094_6_ - (double)f, p_85094_2_ + (double)f, p_85094_4_ + (double)entityIn.getEyeHeight() + 0.009999999776482582D, p_85094_6_ + (double)f), 255, 0, 0, 255);
    }

    Tessellator tessellator = Tessellator.getInstance();
    WorldRenderer worldrenderer = tessellator.getWorldRenderer();
    Vec3 vec3 = entityIn.getLook(p_85094_9_);
    worldrenderer.begin(3, DefaultVertexFormats.POSITION_COLOR);
    worldrenderer.pos(p_85094_2_, p_85094_4_ + (double)entityIn.getEyeHeight(), p_85094_6_).color(0, 0, 255, 255).endVertex();
    worldrenderer.pos(p_85094_2_ + vec3.xCoord * 2.0D, p_85094_4_ + (double)entityIn.getEyeHeight() + vec3.yCoord * 2.0D, p_85094_6_ + vec3.zCoord * 2.0D).color(0, 0, 255, 255).endVertex();
    tessellator.draw();
    GlStateManager.enableTexture2D();
    GlStateManager.enableLighting();
    GlStateManager.enableCull();
    GlStateManager.disableBlend();
    GlStateManager.depthMask(true);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:35,代碼來源:RenderManager.java

示例6: ParticleEmitter

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
public ParticleEmitter(World p_i47219_1_, Entity p_i47219_2_, EnumParticleTypes p_i47219_3_, int p_i47219_4_)
{
    super(p_i47219_1_, p_i47219_2_.posX, p_i47219_2_.getEntityBoundingBox().minY + (double)(p_i47219_2_.height / 2.0F), p_i47219_2_.posZ, p_i47219_2_.motionX, p_i47219_2_.motionY, p_i47219_2_.motionZ);
    this.attachedEntity = p_i47219_2_;
    this.lifetime = p_i47219_4_;
    this.particleTypes = p_i47219_3_;
    this.onUpdate();
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:9,代碼來源:ParticleEmitter.java

示例7: onEntityCollidedWithBlock

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Called When an Entity Collided with the Block
 */
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn)
{
    int i = ((Integer)state.getValue(LEVEL)).intValue();
    float f = (float)pos.getY() + (6.0F + (float)(3 * i)) / 16.0F;

    if (!worldIn.isRemote && entityIn.isBurning() && i > 0 && entityIn.getEntityBoundingBox().minY <= (double)f)
    {
        entityIn.extinguish();
        this.setWaterLevel(worldIn, pos, state, i - 1);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:15,代碼來源:BlockCauldron.java

示例8: getCollisionBox

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@Nullable

    /**
     * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be
     * pushable on contact, like boats or minecarts.
     */
    public AxisAlignedBB getCollisionBox(Entity entityIn)
    {
        return entityIn.canBePushed() ? entityIn.getEntityBoundingBox() : null;
    }
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:11,代碼來源:EntityBoat.java

示例9: applyEntityCollision

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Applies a velocity to the entities, to push them away from eachother.
 */
public void applyEntityCollision(Entity entityIn)
{
    if (entityIn instanceof EntityBoat)
    {
        if (entityIn.getEntityBoundingBox().minY < this.getEntityBoundingBox().maxY)
        {
            super.applyEntityCollision(entityIn);
        }
    }
    else if (entityIn.getEntityBoundingBox().minY <= this.getEntityBoundingBox().minY)
    {
        super.applyEntityCollision(entityIn);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:18,代碼來源:EntityBoat.java

示例10: getCollisionBox

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
@Nullable
public AxisAlignedBB getCollisionBox(Entity entityIn)
{
	return entityIn.getEntityBoundingBox();
}
 
開發者ID:Lemonszz,項目名稱:Anima-Mundi,代碼行數:6,代碼來源:EntityBlockSuck.java

示例11: renderEntityOnFire

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Renders a layer of fire on top of an entity.
 */
private void renderEntityOnFire(Entity entity, double x, double y, double z, float partialTicks)
{
    GlStateManager.disableLighting();
    TextureMap texturemap = Minecraft.getMinecraft().getTextureMapBlocks();
    TextureAtlasSprite textureatlassprite = texturemap.getAtlasSprite("minecraft:blocks/fire_layer_0");
    TextureAtlasSprite textureatlassprite1 = texturemap.getAtlasSprite("minecraft:blocks/fire_layer_1");
    GlStateManager.pushMatrix();
    GlStateManager.translate((float)x, (float)y, (float)z);
    float f = entity.width * 1.4F;
    GlStateManager.scale(f, f, f);
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    float f1 = 0.5F;
    float f2 = 0.0F;
    float f3 = entity.height / f;
    float f4 = (float)(entity.posY - entity.getEntityBoundingBox().minY);
    GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
    GlStateManager.translate(0.0F, 0.0F, -0.3F + (float)((int)f3) * 0.02F);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    float f5 = 0.0F;
    int i = 0;
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);

    while (f3 > 0.0F)
    {
        TextureAtlasSprite textureatlassprite2 = i % 2 == 0 ? textureatlassprite : textureatlassprite1;
        this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        float f6 = textureatlassprite2.getMinU();
        float f7 = textureatlassprite2.getMinV();
        float f8 = textureatlassprite2.getMaxU();
        float f9 = textureatlassprite2.getMaxV();

        if (i / 2 % 2 == 0)
        {
            float f10 = f8;
            f8 = f6;
            f6 = f10;
        }

        vertexbuffer.pos((double)(f1 - 0.0F), (double)(0.0F - f4), (double)f5).tex((double)f8, (double)f9).endVertex();
        vertexbuffer.pos((double)(-f1 - 0.0F), (double)(0.0F - f4), (double)f5).tex((double)f6, (double)f9).endVertex();
        vertexbuffer.pos((double)(-f1 - 0.0F), (double)(1.4F - f4), (double)f5).tex((double)f6, (double)f7).endVertex();
        vertexbuffer.pos((double)(f1 - 0.0F), (double)(1.4F - f4), (double)f5).tex((double)f8, (double)f7).endVertex();
        f3 -= 0.45F;
        f4 -= 0.45F;
        f1 *= 0.9F;
        f5 += 0.03F;
        ++i;
    }

    tessellator.draw();
    GlStateManager.popMatrix();
    GlStateManager.enableLighting();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:58,代碼來源:Render.java

示例12: getCollisionBox

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be
 * pushable on contact, like boats or minecarts.
 */
@Nullable
public AxisAlignedBB getCollisionBox(Entity entityIn)
{
    return entityIn.getEntityBoundingBox();
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:10,代碼來源:EntityBoat.java

示例13: getCollisionBox

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be
 * pushable on contact, like boats or minecarts.
 */
public AxisAlignedBB getCollisionBox(Entity entityIn)
{
    return entityIn.getEntityBoundingBox();
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:9,代碼來源:EntityBoat.java

示例14: func_190589_G

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
private void func_190589_G()
{
    IBlockState iblockstate = this.world.getBlockState(this.getPos());

    if (iblockstate.getBlock() instanceof BlockShulkerBox)
    {
        EnumFacing enumfacing = (EnumFacing)iblockstate.getValue(BlockShulkerBox.field_190957_a);
        AxisAlignedBB axisalignedbb = this.func_190588_c(enumfacing).offset(this.pos);
        List<Entity> list = this.world.getEntitiesWithinAABBExcludingEntity((Entity)null, axisalignedbb);

        if (!list.isEmpty())
        {
            for (int i = 0; i < list.size(); ++i)
            {
                Entity entity = (Entity)list.get(i);

                if (entity.getPushReaction() != EnumPushReaction.IGNORE)
                {
                    double d0 = 0.0D;
                    double d1 = 0.0D;
                    double d2 = 0.0D;
                    AxisAlignedBB axisalignedbb1 = entity.getEntityBoundingBox();

                    switch (enumfacing.getAxis())
                    {
                        case X:
                            if (enumfacing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE)
                            {
                                d0 = axisalignedbb.maxX - axisalignedbb1.minX;
                            }
                            else
                            {
                                d0 = axisalignedbb1.maxX - axisalignedbb.minX;
                            }

                            d0 = d0 + 0.01D;
                            break;

                        case Y:
                            if (enumfacing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE)
                            {
                                d1 = axisalignedbb.maxY - axisalignedbb1.minY;
                            }
                            else
                            {
                                d1 = axisalignedbb1.maxY - axisalignedbb.minY;
                            }

                            d1 = d1 + 0.01D;
                            break;

                        case Z:
                            if (enumfacing.getAxisDirection() == EnumFacing.AxisDirection.POSITIVE)
                            {
                                d2 = axisalignedbb.maxZ - axisalignedbb1.minZ;
                            }
                            else
                            {
                                d2 = axisalignedbb1.maxZ - axisalignedbb.minZ;
                            }

                            d2 = d2 + 0.01D;
                    }

                    entity.moveEntity(MoverType.SHULKER_BOX, d0 * (double)enumfacing.getFrontOffsetX(), d1 * (double)enumfacing.getFrontOffsetY(), d2 * (double)enumfacing.getFrontOffsetZ());
                }
            }
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:71,代碼來源:TileEntityShulkerBox.java

示例15: getCollisionBox

import net.minecraft.entity.Entity; //導入方法依賴的package包/類
/**
 * Returns a boundingBox used to collide the entity with other entities and blocks. This enables the entity to be
 * pushable on contact, like boats or minecarts.
 */
public AxisAlignedBB getCollisionBox(Entity entityIn)
{
    return entityIn.canBePushed() ? entityIn.getEntityBoundingBox() : null;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:9,代碼來源:EntityMinecart.java


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