本文整理汇总了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));
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
}
示例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;
}
示例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);
}
}
示例10: getCollisionBox
import net.minecraft.entity.Entity; //导入方法依赖的package包/类
@Nullable
public AxisAlignedBB getCollisionBox(Entity entityIn)
{
return entityIn.getEntityBoundingBox();
}
示例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();
}
示例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();
}
示例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();
}
示例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());
}
}
}
}
}
示例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;
}