public bool HasItem(SegmentEntity entity, ItemBase item) { if (GetFreeSpace(entity) == 1) { return(false); } var conveyor = entity.As <ConveyorEntity>(); if (item.mType == ItemType.ItemCubeStack) { ItemCubeStack cube = item as ItemCubeStack; if (conveyor.mCarriedCube == cube.mCubeType && conveyor.mCarriedValue == cube.mCubeValue) { return(true); } return(false); } return(item.CompareDeep(conveyor.mCarriedItem)); }