本文整理汇总了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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例9: canInteractWith
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean canInteractWith(EntityPlayer playerIn)
{
return playerIn.getDistanceSq(storage.getPos()) < 64;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}