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


Java EntityPlayer.getDistanceSq方法代码示例

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


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

示例1: newExplosion

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * returns a new explosion. Does initiation (at time of writing Explosion is not finished)
 */
public Explosion newExplosion(Entity entityIn, double x, double y, double z, float strength, boolean isFlaming, boolean isSmoking)
{
    Explosion explosion = new Explosion(this, entityIn, x, y, z, strength, isFlaming, isSmoking);
    explosion.doExplosionA();
    explosion.doExplosionB(false);

    if (!isSmoking)
    {
        explosion.func_180342_d();
    }

    for (EntityPlayer entityplayer : this.playerEntities)
    {
        if (entityplayer.getDistanceSq(x, y, z) < 4096.0D)
        {
            ((EntityPlayerMP)entityplayer).playerNetServerHandler.sendPacket(new S27PacketExplosion(x, y, z, strength, explosion.getAffectedBlockPositions(), (Vec3)explosion.getPlayerKnockbackMap().get(entityplayer)));
        }
    }

    return explosion;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:25,代码来源:WorldServer.java

示例2: isAnyPlayerWithinRangeAt

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean isAnyPlayerWithinRangeAt(double x, double y, double z, double range)
{
    for (int i = 0; i < this.playerEntities.size(); ++i)
    {
        EntityPlayer entityplayer = (EntityPlayer)this.playerEntities.get(i);

        if (EntitySelectors.NOT_SPECTATING.apply(entityplayer))
        {
            double d0 = entityplayer.getDistanceSq(x, y, z);

            if (range < 0.0D || d0 < range * range)
            {
                return true;
            }
        }
    }

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

示例3: playMoodSoundAndCheckLight

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
protected void playMoodSoundAndCheckLight(int p_147467_1_, int p_147467_2_, Chunk chunkIn)
{
    this.theProfiler.endStartSection("moodSound");

    if (this.ambientTickCountdown == 0 && !this.isRemote)
    {
        this.updateLCG = this.updateLCG * 3 + 1013904223;
        int i = this.updateLCG >> 2;
        int j = i & 15;
        int k = i >> 8 & 15;
        int l = i >> 16 & 255;
        BlockPos blockpos = new BlockPos(j, l, k);
        Block block = chunkIn.getBlock(blockpos);
        j = j + p_147467_1_;
        k = k + p_147467_2_;

        if (block.getMaterial() == Material.air && this.getLight(blockpos) <= this.rand.nextInt(8) && this.getLightFor(EnumSkyBlock.SKY, blockpos) <= 0)
        {
            EntityPlayer entityplayer = this.getClosestPlayer((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, 8.0D);

            if (entityplayer != null && entityplayer.getDistanceSq((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D) > 4.0D)
            {
                this.playSoundEffect((double)j + 0.5D, (double)l + 0.5D, (double)k + 0.5D, "ambient.cave.cave", 0.7F, 0.8F + this.rand.nextFloat() * 0.2F);
                this.ambientTickCountdown = this.rand.nextInt(12000) + 6000;
            }
        }
    }

    this.theProfiler.endStartSection("checkLight");
    chunkIn.enqueueRelightChecks();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:32,代码来源:World.java

示例4: isUseableByPlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
	return this.worldObj.getTileEntity(this.getPos()) == this
			&& player.getDistanceSq(this.pos.add(0.5, 0.5, 0.5)) <= 64;
}
 
开发者ID:astronautlabs,项目名称:rezolve,代码行数:6,代码来源:MachineEntity.java

示例5: getNearestAttackablePlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Nullable
public EntityPlayer getNearestAttackablePlayer(double posX, double posY, double posZ, double maxXZDistance, double maxYDistance, @Nullable Function<EntityPlayer, Double> playerToDouble, @Nullable Predicate<EntityPlayer> p_184150_12_)
{
    double d0 = -1.0D;
    EntityPlayer entityplayer = null;

    for (int i = 0; i < this.playerEntities.size(); ++i)
    {
        EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i);

        if (!entityplayer1.capabilities.disableDamage && entityplayer1.isEntityAlive() && !entityplayer1.isSpectator() && (p_184150_12_ == null || p_184150_12_.apply(entityplayer1)))
        {
            double d1 = entityplayer1.getDistanceSq(posX, entityplayer1.posY, posZ);
            double d2 = maxXZDistance;

            if (entityplayer1.isSneaking())
            {
                d2 = maxXZDistance * 0.800000011920929D;
            }

            if (entityplayer1.isInvisible())
            {
                float f = entityplayer1.getArmorVisibility();

                if (f < 0.1F)
                {
                    f = 0.1F;
                }

                d2 *= (double)(0.7F * f);
            }

            if (playerToDouble != null)
            {
                d2 *= ((Double)Objects.firstNonNull(playerToDouble.apply(entityplayer1), Double.valueOf(1.0D))).doubleValue();
            }

            if ((maxYDistance < 0.0D || Math.abs(entityplayer1.posY - posY) < maxYDistance * maxYDistance) && (maxXZDistance < 0.0D || d1 < d2 * d2) && (d0 == -1.0D || d1 < d0))
            {
                d0 = d1;
                entityplayer = entityplayer1;
            }
        }
    }

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

示例6: canInteractWith

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean canInteractWith(EntityPlayer player) {
	return world.getBlock(posX, posY, posZ) != ModBlocks.enchantment_table ? false : player.getDistanceSq(posX + 0.5D, posY + 0.5D, posZ + 0.5D) <= 64.0D;
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:5,代码来源:ContainerEnchantment.java

示例7: isGuiUseableByPlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean isGuiUseableByPlayer(EntityPlayer player) {
    return getWorld().getTileEntity(getPos()) == this
            && player.getDistanceSq(getPos().getX() + 0.5D, getPos().getY() + 0.5D, getPos().getZ() + 0.5D) <= 64.0D;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:6,代码来源:TileEntityPressureChamberInterface.java

示例8: canInteractWith

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean canInteractWith(EntityPlayer playerIn)
{
    return this.worldObj.getBlockState(this.pos).getBlock() != Blocks.crafting_table ? false : playerIn.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:ContainerWorkbench.java

示例9: canInteractWith

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
    return playerIn.getDistanceSq(storage.getPos()) < 64;
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:6,代码来源:ContainerCodeStorage.java

示例10: isUseableByPlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean isUseableByPlayer(EntityPlayer player) {
   return this.worldObj.getTileEntity(this.getPos()) == this && player.getDistanceSq(this.pos.add(0.5, 0.5, 0.5)) <= 64;
}
 
开发者ID:ImagicTheCat,项目名称:FundamentalChemistry,代码行数:5,代码来源:TileSimpleMachine.java

示例11: isUseableByPlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Don't rename this method to canInteractWith due to conflicts with Container
 */
public boolean isUseableByPlayer(EntityPlayer player)
{
    return this.worldObj.getTileEntity(this.pos) != this ? false : player.getDistanceSq((double)this.pos.getX() + 0.5D, (double)this.pos.getY() + 0.5D, (double)this.pos.getZ() + 0.5D) <= 64.0D;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:8,代码来源:TileEntityHopper.java

示例12: isUsableByPlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean isUsableByPlayer(EntityPlayer player) {
	return player.getDistanceSq(pos.add(0.5f, 0.5f, 0.5f)) <= 64;
}
 
开发者ID:cjburkey01,项目名称:MiningWells,代码行数:4,代码来源:TileEntityMiningWell.java

示例13: isUsableByPlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean isUsableByPlayer(EntityPlayer player) {
    return this.world.getTileEntity(this.getPos()) == this && player.getDistanceSq(this.pos.add(0.5,0.5,0.5)) <= 64;
}
 
开发者ID:inifire201,项目名称:MagicWinds,代码行数:5,代码来源:TileEntityTrinketMaker.java

示例14: canInteractWith

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean canInteractWith(EntityPlayer playerIn) {
	return !te.isInvalid() && playerIn.getDistanceSq(te.getPos().add(0.5D, 0.5D, 0.5D)) <= 64D;
}
 
开发者ID:tiffit,项目名称:Defier,代码行数:5,代码来源:PatternMolderContainer.java

示例15: isUseableByPlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean isUseableByPlayer(EntityPlayer player) {
	return this.world.getTileEntity(this.getPos()) == this
			&& player.getDistanceSq(this.pos.add(0.5, 0.5, 0.5)) <= 64;
}
 
开发者ID:IvanSteklow,项目名称:VanillaExtras,代码行数:5,代码来源:TileEntityBlockBreaker.java


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