本文整理了Java中net.minecraft.entity.Entity.getEntityBoundingBox()
方法的一些代码示例,展示了Entity.getEntityBoundingBox()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Entity.getEntityBoundingBox()
方法的具体详情如下:
包路径:net.minecraft.entity.Entity
类名称:Entity
方法名:getEntityBoundingBox
暂无
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
final AxisAlignedBB boundingBox = entity1.getEntityBoundingBox().grow( f1, f1, f1 );
final RayTraceResult RayTraceResult = boundingBox.calculateIntercept( vec3, vec31 );
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
final AxisAlignedBB boundingBox = entity1.getEntityBoundingBox().grow( f1, f1, f1 );
final RayTraceResult RayTraceResult = boundingBox.calculateIntercept( Vec3d, Vec3d1 );
代码示例来源:origin: SleepyTrousers/EnderIO
public SoundSource(Entity ent, float volume) {
AxisAlignedBB bb = ent.getEntityBoundingBox();
pos = new Vector3d(bb.minX + (bb.maxX - bb.minX) / 2, bb.minY + (bb.maxY - bb.minY) / 2, bb.minZ + (bb.maxZ - bb.minZ) / 2);
this.volume = volume;
isEntity = true;
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
final AxisAlignedBB boundingBox = entity1.getEntityBoundingBox().grow( f1, f1, f1 );
final RayTraceResult RayTraceResult = boundingBox.calculateIntercept( Vec3d, Vec3d1 );
代码示例来源:origin: SleepyTrousers/EnderIO
@Override
public Path findPath(@Nonnull IBlockAccess blockaccess, @Nonnull EntityLiving entityFrom, @Nonnull Entity entityTo, float dist) {
return createEntityPathTo(blockaccess, entityFrom, entityTo.posX, entityTo.getEntityBoundingBox().minY, entityTo.posZ, dist);
}
代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition
/**
* Returns given entity's position as PathPoint
*/
public PathPoint getPathPointTo(Entity entity) {
return this.openPoint(MathHelper.floor(entity.getEntityBoundingBox().minX), MathHelper.floor(entity.getEntityBoundingBox().maxY + 0.5), MathHelper.floor(entity.getEntityBoundingBox().minZ));
}
代码示例来源:origin: SleepyTrousers/EnderIO
private static boolean isClear(@Nonnull World world, @Nonnull Entity entity, double targetX, double targetY, double targetZ) {
double origX = entity.posX, origY = entity.posY, origZ = entity.posZ;
try {
entity.setPosition(targetX, targetY, targetZ);
boolean result = world.checkNoEntityCollision(entity.getEntityBoundingBox(), entity)
&& world.getCollisionBoxes(entity, entity.getEntityBoundingBox()).isEmpty() && !world.containsAnyLiquid(entity.getEntityBoundingBox());
return result;
} finally {
entity.setPosition(origX, origY, origZ);
}
}
代码示例来源:origin: Vazkii/Botania
AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow(0.30000001192092896D);
RayTraceResult raytraceresult1 = axisalignedbb.calculateIntercept(vec3d, vec3d1);
代码示例来源:origin: Vazkii/Botania
AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow(0.30000001192092896D);
RayTraceResult raytraceresult1 = axisalignedbb.calculateIntercept(vec3d, vec3d1);
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
double posYMiddle = ( entity.getEntityBoundingBox().minY + entity.getEntityBoundingBox().maxY ) / 2.0D;
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
private double getMinY() {
//noinspection ConstantConditions
return npc.isRiding() ? npc.getRidingEntity().getEntityBoundingBox().minY : npc.getEntityBoundingBox().minY;
}
}
代码示例来源:origin: vadis365/TheErebus
@Override
public boolean attackEntityAsMob(Entity entity) {
if (entity != null && getDistance(entity) <= 1.5F && entity.getEntityBoundingBox().maxY > getEntityBoundingBox().minY && entity.getEntityBoundingBox().minY < getEntityBoundingBox().maxY)
entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) (ConfigHandler.INSTANCE.mobAttackDamageMultiplier < 2 ? 1D : 1D * ConfigHandler.INSTANCE.mobAttackDamageMultiplier));
return super.attackEntityAsMob(entity);
}
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
private static double getDistanceToCollidedEntity(Entity entity, Vec3d startVector, Vec3d endVector) {
float borderSize = entity.getCollisionBorderSize();
AxisAlignedBB entBB = entity.getEntityBoundingBox().grow((double) borderSize, (double) borderSize, (double) borderSize);
RayTraceResult rayTraceResult = entBB.calculateIntercept(startVector, endVector);
return rayTraceResult != null ? startVector.distanceTo(rayTraceResult.hitVec) : Double.MAX_VALUE;
}
代码示例来源:origin: SleepyTrousers/EnderIO
public void faceEntity(Entity entityIn) {
double d0 = entityIn.posX - this.posX;
double d2 = entityIn.posZ - this.posZ;
double d1;
if (entityIn instanceof EntityLivingBase) {
EntityLivingBase entitylivingbase = (EntityLivingBase) entityIn;
d1 = entitylivingbase.posY + entitylivingbase.getEyeHeight() - (this.posY + this.getEyeHeight());
} else {
d1 = (entityIn.getEntityBoundingBox().minY + entityIn.getEntityBoundingBox().maxY) / 2.0D - (this.posY + this.getEyeHeight());
}
double d3 = MathHelper.sqrt(d0 * d0 + d2 * d2);
rotationPitch = MathHelper.wrapDegrees((float) (-(MathHelper.atan2(d1, d3) * (180D / Math.PI))));
rotationYaw = MathHelper.wrapDegrees((float) (MathHelper.atan2(d2, d0) * (180D / Math.PI)) - 90.0F);
}
代码示例来源:origin: vadis365/TheErebus
@Override
public boolean attackEntityAsMob(Entity entity) {
if (getTameState() != 0)
if (entity instanceof EntityPlayer) {
setAttackTarget((EntityLivingBase) null);
return false;
}
if (entity != null && getDistanceSq(entity) <= 2.5F && entity.getEntityBoundingBox().maxY > getEntityBoundingBox().minY && entity.getEntityBoundingBox().minY < getEntityBoundingBox().maxY)
entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) (ConfigHandler.INSTANCE.mobAttackDamageMultiplier < 2 ? 4D : 4D * ConfigHandler.INSTANCE.mobAttackDamageMultiplier));
return super.attackEntityAsMob(entity);
}
代码示例来源:origin: vadis365/TheErebus
@Override
public boolean attackEntityAsMob(Entity entity) {
if (getTameState() != 0)
if (entity instanceof EntityPlayer) {
setAttackTarget((EntityLivingBase) null);
return false;
}
if (entity != null && getDistanceSq(entity) <= 2.5F && entity.getEntityBoundingBox().maxY > getEntityBoundingBox().minY && entity.getEntityBoundingBox().minY < getEntityBoundingBox().maxY)
entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) (ConfigHandler.INSTANCE.mobAttackDamageMultiplier < 2 ? 4D : 4D * ConfigHandler.INSTANCE.mobAttackDamageMultiplier));
return super.attackEntityAsMob(entity);
}
代码示例来源:origin: TerraFirmaCraft/TerraFirmaCraft
public void turnToDirt(World world, BlockPos pos)
{
world.setBlockState(pos, get(rock, Rock.Type.DIRT).getDefaultState());
AxisAlignedBB axisalignedbb = FLIPPED_AABB.offset(pos);
for (Entity entity : world.getEntitiesWithinAABBExcludingEntity(null, axisalignedbb))
{
double d0 = Math.min(axisalignedbb.maxY - axisalignedbb.minY, axisalignedbb.maxY - entity.getEntityBoundingBox().minY);
entity.setPositionAndUpdate(entity.posX, entity.posY + d0 + 0.001D, entity.posZ);
}
}
代码示例来源:origin: Esteemed-Innovation/Esteemed-Innovation
/**
* @param entity The entity.
* @return The block state that is currently underneath the player.
*/
public static IBlockState getBlockUnderEntity(Entity entity) {
int x = MathHelper.floor(entity.posX);
int y = MathHelper.floor(entity.getEntityBoundingBox().minY - 0.11F);
int z = MathHelper.floor(entity.posZ);
BlockPos underPos = new BlockPos(x, y, z);
return entity.world.getBlockState(underPos);
}
}
代码示例来源:origin: Vazkii/Botania
if (entity1.canBeCollidedWith() && (!(entity1 instanceof EntityPlayer) || pickupDelay == 0)) {
float f = 1.0F;
AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().grow(f);
RayTraceResult RayTraceResult1 = axisalignedbb.calculateIntercept(vec3, vec31);
代码示例来源:origin: Vazkii/Quark
@SubscribeEvent
public void onHurt(LivingHurtEvent event) {
Entity e = event.getEntity();
if(e instanceof EntitySquid && !e.world.isRemote && event.getSource().getTrueSource() instanceof EntityPlayer) {
List<EntityPlayer> players = e.world.getEntitiesWithinAABB(EntityPlayer.class, e.getEntityBoundingBox().grow(4, 4, 4));
for(EntityPlayer player : players)
player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, time, 0));
WorldServer ws = (WorldServer) e.world;
ws.spawnParticle(EnumParticleTypes.SMOKE_LARGE, e.posX + e.width / 2, e.posY + e.height / 2, e.posZ + e.width / 2, 100, 0, 0, 0, 0.02);
}
}
内容来源于网络,如有侵权,请联系作者删除!