@Override public boolean isUseableByPlayer(EntityPlayer player) { this.thePlayer = player; return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) == this && player.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D; }
@Override public boolean isUseableByPlayer(EntityPlayer player) { return worldObj.getTileEntity(this.getPos()) == this && player.getDistanceSq( this.getPos().getX() + 0.5, this.getPos().getY() + 0.5, this.getPos().getZ() + 0.5) < 64; }
public boolean canInteractWith(EntityPlayer par1EntityPlayer) { return this.worldObj.getBlock(this.posX, this.posY, this.posZ) != Blocks.crafting_table ? false : par1EntityPlayer.getDistanceSq( (double) this.posX + 0.5D, (double) this.posY + 0.5D, (double) this.posZ + 0.5D) <= 64.0D; }
public boolean isUseableByPlayer(EntityPlayer entityplayer) { if (this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this) { return false; } return entityplayer.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D; }
/** Check if the TIle Entity can be used by the player. */ @Override public boolean isUseableByPlayer(EntityPlayer player) { return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && player.getDistanceSq( (double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D) <= 64.0D; }
private void explode() { final float strength = 20.0F; final Explosion explosion = new Explosion(worldObj, null, posX, posY, posZ, strength); explosion.isFlaming = false; explosion.isSmoking = true; explosion.doExplosionA(); explosion.doExplosionB(true); if (!worldObj.isRemote) { final Iterator var12 = worldObj.playerEntities.iterator(); while (var12.hasNext()) { final EntityPlayer player = (EntityPlayer) var12.next(); if (player.getDistanceSq(posX, posY, posZ) < 4096.0D) { ((EntityPlayerMP) player) .playerNetServerHandler.sendPacketToPlayer( new Packet60Explosion( posX, posY, posZ, strength, explosion.affectedBlockPositions, (Vec3) explosion.func_77277_b().get(player))); sendPacket( posX, posY, posZ, strength, explosion.affectedBlockPositions, (Vec3) explosion.func_77277_b().get(player)); } } } }
/** Do not make give this method the name canInteractWith because it clashes with Container */ @Override public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq(this.xCoord + 0.5D, this.yCoord + 0.5D, this.zCoord + 0.5D) <= 64.0D; }
@Override public boolean isUseableByPlayer(EntityPlayer entityplayer) { if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) { return false; } return entityplayer.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <= 64D; }
@Override public boolean isUseableByPlayer(EntityPlayer entityPlayer) { return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : entityPlayer.getDistanceSq( (double) xCoord + 0.5, (double) yCoord + 0.5, (double) zCoord + 0.5) <= 64.0; }
@Override public boolean isUseableByPlayer(EntityPlayer player) { if (worldObj.getTileEntity(xCoord, yCoord, zCoord) != this) { return false; } else { return player.getDistanceSq(xCoord + 0.5d, yCoord + 0.5d, zCoord + 0.5d) <= 64.0d; } }
@Override public boolean isUseableByPlayer(EntityPlayer entityplayer) { return this.worldObj.getTileEntity(this.pos) != this ? false : entityplayer.getDistanceSq( this.pos.getX() + 0.5D, this.pos.getY() + 0.5D, this.pos.getZ() + 0.5D) <= 64.0D; }
@Override public boolean isUseableByPlayer(EntityPlayer entityplayer) { return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) == this && entityplayer.getDistanceSq( (double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, (double) this.zCoord + 0.5D) <= 64.0D; }
@Override public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) { return this.worldObj.getTileEntity(getPos()) == this && par1EntityPlayer.getDistanceSq( this.getPos().getX() + 0.5D, this.getPos().getY() + 0.5D, this.getPos().getZ() + 0.5D) <= 64.0D; }
@Override public boolean isUseableByPlayer(EntityPlayer entityplayer) { // TODO Auto-generated method stub return worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this ? false : entityplayer.getDistanceSq( (double) xCoord + 0.5, (double) yCoord + 0.5, (double) zCoord + 0.5) <= 64.0; }
/** Do not make give this method the name canInteractWith because it clashes 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; }
/** Do not make give this method the name canInteractWith because it clashes with Container */ public boolean isUseableByPlayer(EntityPlayer entityplayer) { if (worldObj.getBlockTileEntity(xCoord, yCoord, zCoord) != this) { return false; } else { return entityplayer.getDistanceSq( (double) xCoord + 0.5D, (double) yCoord + 0.5D, (double) zCoord + 0.5D) <= 64D; } }
/** Do not make give this method the name canInteractWith because it clashes with Container */ public boolean isUseableByPlayer(EntityPlayer var1) { return this.worldObj.getBlockTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : var1.getDistanceSq( (double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, (double) this.zCoord + 0.5D) <= 64.0D; }
@Override // Is usable at the same distance as a chest public boolean isUseableByPlayer(EntityPlayer p_70300_1_) { return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : p_70300_1_.getDistanceSq( (double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, (double) this.zCoord + 0.5D) <= 64.0D; }
@Override public boolean canInteractWith(EntityPlayer entityPlayer) { return this.world.getBlockId(this.xCoord, this.yCoord, this.zCoord) != MabiCraftBlock.blockEnchanter.blockID ? false : entityPlayer.getDistanceSq( (double) this.xCoord + 0.5D, (double) this.yCoord + 0.5D, (double) this.zCoord + 0.5D) <= 64.0D; }
// Return true if the given player is able to use this block. In this case it checks that // 1) the world tileentity hasn't been replaced in the meantime, and // 2) the player isn't too far away from the centre of the block @Override public boolean isUseableByPlayer(EntityPlayer player) { if (this.worldObj.getTileEntity(this.pos) != this) return false; final double X_CENTRE_OFFSET = 0.5; final double Y_CENTRE_OFFSET = 0.5; final double Z_CENTRE_OFFSET = 0.5; final double MAXIMUM_DISTANCE_SQ = 8.0 * 8.0; return player.getDistanceSq( pos.getX() + X_CENTRE_OFFSET, pos.getY() + Y_CENTRE_OFFSET, pos.getZ() + Z_CENTRE_OFFSET) < MAXIMUM_DISTANCE_SQ; }
@Override public void receiveCommand(String command, Side side, Object sender, ByteBuf stream) { super.receiveCommand(command, side, sender, stream); if (side.isClient()) { if ("clearItemRequirements".equals(command)) { requiredToBuild = null; } else if ("setItemRequirements".equals(command)) { int size = stream.readUnsignedMedium(); requiredToBuild = new ArrayList<RequirementItemStack>(); for (int i = 0; i < size; i++) { int itemId = stream.readUnsignedShort(); int itemDamage = stream.readShort(); int stackSize = stream.readUnsignedMedium(); boolean hasCompound = stackSize >= 0x800000; ItemStack stack = new ItemStack(Item.getItemById(itemId), 1, itemDamage); if (hasCompound) { stack.setTagCompound(NetworkUtils.readNBT(stream)); } if (stack != null && stack.getItem() != null) { requiredToBuild.add(new RequirementItemStack(stack, stackSize & 0x7FFFFF)); } else { BCLog.logger.error( "Corrupt ItemStack in TileBuilder.receiveCommand! This should not happen! (ID " + itemId + ", damage " + itemDamage + ")"); } } } } else if (side.isServer()) { EntityPlayer player = (EntityPlayer) sender; if ("eraseFluidTank".equals(command)) { int id = stream.readInt(); if (id < 0 || id >= fluidTanks.length) { return; } if (isUseableByPlayer(player) && player.getDistanceSq(xCoord, yCoord, zCoord) <= 64) { fluidTanks[id].setFluid(null); sendNetworkUpdate(); } } } }
/** Create an explosion which only affects a single block. */ @SuppressWarnings("unchecked") public static void explodeBlock(World world, int x, int y, int z) { if (FMLCommonHandler.instance().getEffectiveSide().isClient()) return; Explosion explosion = new Explosion(world, null, x + .5, y + .5, z + .5, 3f); explosion.affectedBlockPositions.add(new ChunkPosition(x, y, z)); explosion.doExplosionB(true); for (EntityPlayer player : (List<EntityPlayer>) world.playerEntities) { if (!(player instanceof EntityPlayerMP)) continue; if (player.getDistanceSq(x, y, z) < 4096) { ((EntityPlayerMP) player) .playerNetServerHandler.sendPacketToPlayer( new Packet60Explosion( x + .5, y + .5, z + .5, 3f, explosion.affectedBlockPositions, null)); } } }
@Override public Explosion newExplosion( World world, Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_) { Explosion explosion = new ExplosionRocket( world, p_72885_1_, p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, true, true); explosion.isFlaming = p_72885_9_; explosion.isSmoking = p_72885_10_; explosion.doExplosionA(); explosion.doExplosionB(true); if (!p_72885_10_) { explosion.affectedBlockPositions.clear(); } Iterator iterator = world.playerEntities.iterator(); while (iterator.hasNext()) { EntityPlayer entityplayer = (EntityPlayer) iterator.next(); if (entityplayer.getDistanceSq(p_72885_2_, p_72885_4_, p_72885_6_) < 4096.0D) { ((EntityPlayerMP) entityplayer) .playerNetServerHandler.sendPacket( new S27PacketExplosion( p_72885_2_, p_72885_4_, p_72885_6_, p_72885_8_, explosion.affectedBlockPositions, (Vec3) explosion.func_77277_b().get(entityplayer))); } } return explosion; }
@Nullable @Override public EntityPlayer getClosestPlayerWhoAffectsSpawning( double x, double y, double z, double distance) { double bestDistance = -1.0D; EntityPlayer result = null; for (Object entity : this.playerEntities) { EntityPlayer player = (EntityPlayer) entity; if (player == null || player.isDead || !((IMixinEntityPlayer) player).affectsSpawning()) { continue; } double playerDistance = player.getDistanceSq(x, y, z); if ((distance < 0.0D || playerDistance < distance * distance) && (bestDistance == -1.0D || playerDistance < bestDistance)) { bestDistance = playerDistance; result = player; } } return result; }
public boolean isUseableByPlayer(EntityPlayer player) { return worldObj.getTileEntity(xCoord, yCoord, zCoord) == this && player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 64; }
@Override public boolean isUseableByPlayer(EntityPlayer player) { return player.getDistanceSq(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5) < 8 * 8; }
@Override public boolean canInteractWith(EntityPlayer p_75145_1_) { return player.getDistanceSq(tile.xCoord + .5, tile.yCoord + .5, tile.zCoord + .5) < 64; }
@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; }
@Override public void onInventoryChanged() { super.onInventoryChanged(); if (!this.worldObj.isRemote) { this.rotateCraftingGrid(); this.inventory[this.getSizeInventory()] = CraftingManager.getInstance() .findMatchingRecipe(this.container.craftMatrix, this.worldObj); if (CraftingPillars.modThaumcraft) { if (this.worldObj.loadedEntityList != null) { float closest = Float.MAX_VALUE; for (int i = 0; i < this.worldObj.loadedEntityList.size(); i++) { if (this.worldObj.loadedEntityList.get(i) instanceof EntityPlayer) { EntityPlayer currentPlayer = (EntityPlayer) this.worldObj.loadedEntityList.get(i); if (currentPlayer.isEntityAlive()) { float distance = (float) currentPlayer.getDistanceSq(this.xCoord, this.yCoord, this.zCoord); if (distance < closest) { closest = distance; this.closestPlayer = currentPlayer; } } } } } // if(this.closestPlayer != null && this.getStackInSlot(10) != null) // { // ItemStack result = // CraftingPillarsAPIHelper.findMatchingArcaneRecipe(this.container.craftMatrix, // this.closestPlayer); // if(result != null) // { // FMLLog.warning("Result " + result.getDisplayName()); // // this.inventory[this.getSizeInventory()] = result; // aspectsForRecipe = // CraftingPillarsAPIHelper.findMatchingArcaneRecipeAspects(this.container.craftMatrix, // this.closestPlayer); // // for(int i = 0; i < aspectsForRecipe.size(); i++) // { // FMLLog.warning(aspectsForRecipe.getAspects()[i].getName() + ": " + // aspectsForRecipe.getAmount(aspectsForRecipe.getAspects()[i])); // } // // } // else { // FMLLog.warning("no Result"); // //// aspects = null; // } // } } CraftingPillars.proxy.sendToPlayers( this.getDescriptionPacket(), this.worldObj, this.xCoord, this.yCoord, this.zCoord, 64); } }
@Override public boolean isUseableByPlayer(EntityPlayer player) { return worldObj.getTileEntity(xCoord, yCoord, zCoord) != this ? false : formed && player.getDistanceSq(xCoord + .5D, yCoord + .5D, zCoord + .5D) <= 64; }