Java Code Examples for net.minecraft.entity.player.EntityPlayer#getDistanceSq()
The following examples show how to use
net.minecraft.entity.player.EntityPlayer#getDistanceSq() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ItemBuildersWand.java From enderutilities with GNU Lesser General Public License v3.0 | 6 votes |
private boolean isStackedAreaWithinLimits(BlockPos pos1, BlockPos pos2, BlockPos endPosRelative, Area3D area, EntityPlayer player) { int sx = Math.abs(endPosRelative.getX()) + 1; int sy = Math.abs(endPosRelative.getY()) + 1; int sz = Math.abs(endPosRelative.getZ()) + 1; BlockPos posMin = PositionUtils.getMinCorner(pos1, pos2).add(-area.getXNeg() * sx, -area.getYNeg() * sy, -area.getZNeg() * sz); BlockPos posMax = PositionUtils.getMaxCorner(pos1, pos2).add( area.getXPos() * sx, area.getYPos() * sy, area.getZPos() * sz); int max = 160; if (player.getDistanceSq(posMin) > (max * max) || player.getDistanceSq(posMax) > (max * max)) { return false; } return true; }
Example 2
Source File: TileEntityProcessorBaseInventoried.java From TofuCraftReload with MIT License | 5 votes |
@Override public boolean isUsableByPlayer(EntityPlayer entityPlayer) { if (this.world.getTileEntity(this.pos) != this) { return false; } else { return entityPlayer.getDistanceSq((double) this.pos.getX() + 0.5D, (double) this.pos.getY() + 0.5D, (double) this.pos.getZ() + 0.5D) <= 64.0D; } }
Example 3
Source File: TileEntityPhysicsInfuser.java From Valkyrien-Skies with Apache License 2.0 | 5 votes |
public boolean isUsableByPlayer(EntityPlayer player) { if (this.world.getTileEntity(this.pos) != this) { return false; } else { return player .getDistanceSq((double) this.pos.getX() + 0.5D, (double) this.pos.getY() + 0.5D, (double) this.pos.getZ() + 0.5D) <= 64.0D; } }
Example 4
Source File: TileEntityGarden.java From GardenCollection with MIT License | 5 votes |
@Override public boolean isUseableByPlayer (EntityPlayer player) { if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) return false; return player.getDistanceSq(xCoord + .5, yCoord + .5, zCoord + .5) <= 64; }
Example 5
Source File: TileEntityReactorAccessPort.java From BigReactors with MIT License | 5 votes |
@Override public boolean isUseableByPlayer(EntityPlayer entityplayer) { if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) { return false; } return entityplayer.getDistanceSq((double)xCoord + 0.5D, (double)yCoord + 0.5D, (double)zCoord + 0.5D) <= 64D; }
Example 6
Source File: TileEntityBarrel.java From Sakura_mod with MIT License | 5 votes |
@Override public boolean isUsableByPlayer(EntityPlayer player) { if (this.world.getTileEntity(this.pos) != this) { return false; } return player.getDistanceSq(this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64.0D; }
Example 7
Source File: TileContainer.java From Production-Line with MIT License | 4 votes |
@Override public boolean isUsableByPlayer(EntityPlayer entityPlayer) { return !this.isInvalid() && entityPlayer.getDistanceSq(pos) <= 4096; }
Example 8
Source File: TileSatelliteBuilder.java From AdvancedRocketry with MIT License | 4 votes |
@Override public boolean isUsableByPlayer(EntityPlayer player) { return player.getDistanceSq(pos) < 4192; }
Example 9
Source File: TileEntityEngineeringTable.java From Cyberware with MIT License | 4 votes |
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; }
Example 10
Source File: TileEntityEtherealMacerator.java From Electro-Magic-Tools with GNU General Public License v3.0 | 4 votes |
public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, (double) this.zCoord + 0.5D) <= 64.0D; }
Example 11
Source File: TileEntityBase.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
public boolean isGuiUseableByPlayer(EntityPlayer par1EntityPlayer){ return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : par1EntityPlayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64.0D; }
Example 12
Source File: TileEntityPressureChamberInterface.java From PneumaticCraft with GNU General Public License v3.0 | 4 votes |
@Override public boolean isGuiUseableByPlayer(EntityPlayer par1EntityPlayer){ return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : par1EntityPlayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64.0D; }
Example 13
Source File: TileEntityComponentBox.java From Cyberware with MIT License | 4 votes |
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; }
Example 14
Source File: TileAstrobodyDataProcessor.java From AdvancedRocketry with MIT License | 4 votes |
@Override public boolean isUsableByPlayer(EntityPlayer player) { return player.getDistanceSq(pos) < 4096; }
Example 15
Source File: ItemBuildersWand.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
private void deleteArea(ItemStack stack, World world, EntityPlayer player, BlockPos posStart, BlockPos posEnd, boolean removeEntities) { if (posStart == null || posEnd == null) { return; } if (player.getDistanceSq(posStart) > 160 * 160) { player.sendStatusMessage(new TextComponentTranslation("enderutilities.chat.message.areatoofar"), true); return; } if (this.isAreaWithinSizeLimit(posStart.subtract(posEnd), stack, player) == false) { player.sendStatusMessage(new TextComponentTranslation("enderutilities.chat.message.areatoolarge"), true); return; } // Set all blocks to air for (BlockPos.MutableBlockPos posMutable : BlockPos.getAllInBoxMutable(posStart, posEnd)) { if (world.isAirBlock(posMutable) == false) { BlockUtils.setBlockToAirWithoutSpillingContents(world, posMutable, 2); } } // Remove pending block updates from within the area BlockPos posMin = PositionUtils.getMinCorner(posStart, posEnd); BlockPos posMax = PositionUtils.getMaxCorner(posStart, posEnd).add(1, 1, 1); StructureBoundingBox sbb = StructureBoundingBox.createProper(posMin.getX(), posMin.getY(), posMin.getZ(), posMax.getX(), posMax.getY(), posMax.getZ()); world.getPendingBlockUpdates(sbb, true); // The boolean parameter indicates whether the entries will be removed // Remove all entities within the area int count = 0; if (removeEntities) { int x1 = Math.min(posStart.getX(), posEnd.getX()); int y1 = Math.min(posStart.getY(), posEnd.getY()); int z1 = Math.min(posStart.getZ(), posEnd.getZ()); int x2 = Math.max(posStart.getX(), posEnd.getX()); int y2 = Math.max(posStart.getY(), posEnd.getY()); int z2 = Math.max(posStart.getZ(), posEnd.getZ()); AxisAlignedBB bb = new AxisAlignedBB(x1, y1, z1, x2 + 1, y2 + 1, z2 + 1); List<Entity> entities = world.getEntitiesWithinAABBExcludingEntity(null, bb); for (Entity entity : entities) { if ((entity instanceof EntityPlayer) == false || entity instanceof FakePlayer) { entity.setDead(); count++; } } if (count > 0) { player.sendStatusMessage(new TextComponentTranslation("enderutilities.chat.message.killedentitieswithcount", count), true); } } }
Example 16
Source File: TileEntityEngine.java From archimedes-ships with MIT License | 4 votes |
@Override public boolean isUseableByPlayer(EntityPlayer player) { return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && player.getDistanceSq(xCoord + 0.5d, yCoord + 0.5d, zCoord + 0.5d) <= 64d; }
Example 17
Source File: TileDataProgrammer.java From AdvancedRocketry with MIT License | 4 votes |
@Override public boolean isUsableByPlayer(EntityPlayer player) { return player.getDistanceSq(pos) < 4096; }
Example 18
Source File: TileEntityBloomeryFurnace.java From GardenCollection with MIT License | 4 votes |
@Override public boolean isUseableByPlayer (EntityPlayer player) { return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && player.getDistanceSq(xCoord + .5, yCoord + .5, zCoord + .5) <= 64; }
Example 19
Source File: ContainerAnvil.java From Et-Futurum with The Unlicense | 4 votes |
@Override public boolean canInteractWith(EntityPlayer player) { return world.getBlock(x, y, z) != ModBlocks.anvil ? false : player.getDistanceSq(x + 0.5D, y + 0.5D, z + 0.5D) <= 64.0D; }
Example 20
Source File: TileEntitySenderBaseInvenotried.java From TofuCraftReload with MIT License | 3 votes |
@Override public boolean isUsableByPlayer(EntityPlayer entityPlayer) { if (this.world.getTileEntity(this.pos) != this) { return false; } else { return entityPlayer.getDistanceSq((double) this.pos.getX() + 0.5D, (double) this.pos.getY() + 0.5D, (double) this.pos.getZ() + 0.5D) <= 64.0D; } }