Java Code Examples for net.minecraft.entity.player.EntityPlayer#getDistanceSq()
The following examples show how to use
net.minecraft.entity.player.EntityPlayer#getDistanceSq() .
These examples are extracted from open source projects.
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 Project: enderutilities File: ItemBuildersWand.java License: 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 Project: TofuCraftReload File: TileEntityProcessorBaseInventoried.java License: 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 Project: Valkyrien-Skies File: TileEntityPhysicsInfuser.java License: 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 Project: GardenCollection File: TileEntityGarden.java License: 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 Project: Sakura_mod File: TileEntityBarrel.java License: 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 6
Source Project: BigReactors File: TileEntityReactorAccessPort.java License: 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 7
Source Project: Et-Futurum File: ContainerAnvil.java License: 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 8
Source Project: GardenCollection File: TileEntityBloomeryFurnace.java License: 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 9
Source Project: AdvancedRocketry File: TileDataProgrammer.java License: MIT License | 4 votes |
@Override public boolean isUsableByPlayer(EntityPlayer player) { return player.getDistanceSq(pos) < 4096; }
Example 10
Source Project: archimedes-ships File: TileEntityEngine.java License: 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 11
Source Project: Production-Line File: TileContainer.java License: MIT License | 4 votes |
@Override public boolean isUsableByPlayer(EntityPlayer entityPlayer) { return !this.isInvalid() && entityPlayer.getDistanceSq(pos) <= 4096; }
Example 12
Source Project: enderutilities File: ItemBuildersWand.java License: 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 13
Source Project: AdvancedRocketry File: TileAstrobodyDataProcessor.java License: MIT License | 4 votes |
@Override public boolean isUsableByPlayer(EntityPlayer player) { return player.getDistanceSq(pos) < 4096; }
Example 14
Source Project: Cyberware File: TileEntityComponentBox.java License: 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 15
Source Project: PneumaticCraft File: TileEntityPressureChamberInterface.java License: 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 16
Source Project: PneumaticCraft File: TileEntityBase.java License: 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 17
Source Project: Electro-Magic-Tools File: TileEntityEtherealMacerator.java License: 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 18
Source Project: Cyberware File: TileEntityEngineeringTable.java License: 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 19
Source Project: AdvancedRocketry File: TileSatelliteBuilder.java License: MIT License | 4 votes |
@Override public boolean isUsableByPlayer(EntityPlayer player) { return player.getDistanceSq(pos) < 4192; }
Example 20
Source Project: TofuCraftReload File: TileEntitySenderBaseInvenotried.java License: 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; } }