/// <summary> /// Do not make give this method the name canInteractWith because it clashes with Container /// </summary> public virtual bool IsUseableByPlayer(EntityPlayer par1EntityPlayer) { if (WorldObj.GetBlockTileEntity(XCoord, YCoord, ZCoord) != this) { return(false); } return(par1EntityPlayer.GetDistanceSq(XCoord + 0.5F, YCoord + 0.5F, ZCoord + 0.5F) <= 64); }
/// <summary> /// performs the check for adjacent chests to determine if this chest is double or not. /// </summary> public virtual void CheckForAdjacentChests() { if (AdjacentChestChecked) { return; } AdjacentChestChecked = true; AdjacentChestZNeg = null; AdjacentChestXPos = null; AdjacentChestXNeg = null; AdjacentChestZPos = null; if (WorldObj.GetBlockId(XCoord - 1, YCoord, ZCoord) == Block.Chest.BlockID) { AdjacentChestXNeg = (TileEntityChest)WorldObj.GetBlockTileEntity(XCoord - 1, YCoord, ZCoord); } if (WorldObj.GetBlockId(XCoord + 1, YCoord, ZCoord) == Block.Chest.BlockID) { AdjacentChestXPos = (TileEntityChest)WorldObj.GetBlockTileEntity(XCoord + 1, YCoord, ZCoord); } if (WorldObj.GetBlockId(XCoord, YCoord, ZCoord - 1) == Block.Chest.BlockID) { AdjacentChestZNeg = (TileEntityChest)WorldObj.GetBlockTileEntity(XCoord, YCoord, ZCoord - 1); } if (WorldObj.GetBlockId(XCoord, YCoord, ZCoord + 1) == Block.Chest.BlockID) { AdjacentChestZPos = (TileEntityChest)WorldObj.GetBlockTileEntity(XCoord, YCoord, ZCoord + 1); } if (AdjacentChestZNeg != null) { AdjacentChestZNeg.UpdateContainingBlockInfo(); } if (AdjacentChestZPos != null) { AdjacentChestZPos.UpdateContainingBlockInfo(); } if (AdjacentChestXPos != null) { AdjacentChestXPos.UpdateContainingBlockInfo(); } if (AdjacentChestXNeg != null) { AdjacentChestXNeg.UpdateContainingBlockInfo(); } }